1c29fa5a6Sopenharmony_ci/* 2c29fa5a6Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3c29fa5a6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4c29fa5a6Sopenharmony_ci * you may not use this file except in compliance with the License. 5c29fa5a6Sopenharmony_ci * You may obtain a copy of the License at 6c29fa5a6Sopenharmony_ci * 7c29fa5a6Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8c29fa5a6Sopenharmony_ci * 9c29fa5a6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10c29fa5a6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11c29fa5a6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c29fa5a6Sopenharmony_ci * See the License for the specific language governing permissions and 13c29fa5a6Sopenharmony_ci * limitations under the License. 14c29fa5a6Sopenharmony_ci */ 15c29fa5a6Sopenharmony_ci 16c29fa5a6Sopenharmony_ci// IPC service abstraction. 17c29fa5a6Sopenharmony_ci 18c29fa5a6Sopenharmony_ci#ifndef I_INTENTION_H 19c29fa5a6Sopenharmony_ci#define I_INTENTION_H 20c29fa5a6Sopenharmony_ci 21c29fa5a6Sopenharmony_ci#include "iremote_broker.h" 22c29fa5a6Sopenharmony_ci#include "message_parcel.h" 23c29fa5a6Sopenharmony_ci 24c29fa5a6Sopenharmony_ci#include "intention_identity.h" 25c29fa5a6Sopenharmony_ci 26c29fa5a6Sopenharmony_cinamespace OHOS { 27c29fa5a6Sopenharmony_cinamespace Msdp { 28c29fa5a6Sopenharmony_cinamespace DeviceStatus { 29c29fa5a6Sopenharmony_ci// Abstration of services. 30c29fa5a6Sopenharmony_ci// 31c29fa5a6Sopenharmony_ci// By design, for ease of extention, all service implementations are required to 32c29fa5a6Sopenharmony_ci// map its functions to this collection of interface, with services identified 33c29fa5a6Sopenharmony_ci// by Intentions. 34c29fa5a6Sopenharmony_ciclass IIntention : public IRemoteBroker { 35c29fa5a6Sopenharmony_cipublic: 36c29fa5a6Sopenharmony_ci // Enable the service identified by [`intention`]. 37c29fa5a6Sopenharmony_ci virtual int32_t Enable(Intention intention, MessageParcel &data, MessageParcel &reply) = 0; 38c29fa5a6Sopenharmony_ci // Disable the service identified by [`intention`]. 39c29fa5a6Sopenharmony_ci virtual int32_t Disable(Intention intention, MessageParcel &data, MessageParcel &reply) = 0; 40c29fa5a6Sopenharmony_ci // Start the service identified by [`intention`]. 41c29fa5a6Sopenharmony_ci virtual int32_t Start(Intention intention, MessageParcel &data, MessageParcel &reply) = 0; 42c29fa5a6Sopenharmony_ci // Stop the service identified by [`intention`]. 43c29fa5a6Sopenharmony_ci virtual int32_t Stop(Intention intention, MessageParcel &data, MessageParcel &reply) = 0; 44c29fa5a6Sopenharmony_ci // Add a watch of state of service, with the service identified by [`intention`], 45c29fa5a6Sopenharmony_ci // the state to watch identified by [`id`], parameters packed in [`data`] parcel. 46c29fa5a6Sopenharmony_ci virtual int32_t AddWatch(Intention intention, uint32_t id, MessageParcel &data, MessageParcel &reply) = 0; 47c29fa5a6Sopenharmony_ci // Remove a watch of state of service. 48c29fa5a6Sopenharmony_ci virtual int32_t RemoveWatch(Intention intention, uint32_t id, MessageParcel &data, MessageParcel &reply) = 0; 49c29fa5a6Sopenharmony_ci // Set a parameter of service, with the service identified by [`intention`], 50c29fa5a6Sopenharmony_ci // the parameter identified by [`id`], and values packed in [`data`] parcel. 51c29fa5a6Sopenharmony_ci virtual int32_t SetParam(Intention intention, uint32_t id, MessageParcel &data, MessageParcel &reply) = 0; 52c29fa5a6Sopenharmony_ci // Get a parameter of service, with the service identified by [`intention`], 53c29fa5a6Sopenharmony_ci // the parameter identified by [`id`]. 54c29fa5a6Sopenharmony_ci virtual int32_t GetParam(Intention intention, uint32_t id, MessageParcel &data, MessageParcel &reply) = 0; 55c29fa5a6Sopenharmony_ci // Interact with service identified by [`intention`] for general purpose. This interface 56c29fa5a6Sopenharmony_ci // supplements functions of previous intefaces. Functionalities of this interface is 57c29fa5a6Sopenharmony_ci // service spicific. 58c29fa5a6Sopenharmony_ci virtual int32_t Control(Intention intention, uint32_t id, MessageParcel &data, MessageParcel &reply) = 0; 59c29fa5a6Sopenharmony_ci 60c29fa5a6Sopenharmony_ci DECLARE_INTERFACE_DESCRIPTOR(u"ohos.msdp.devicestatus.intention"); 61c29fa5a6Sopenharmony_ci}; 62c29fa5a6Sopenharmony_ci} // namespace DeviceStatus 63c29fa5a6Sopenharmony_ci} // namespace Msdp 64c29fa5a6Sopenharmony_ci} // namespace OHOS 65c29fa5a6Sopenharmony_ci#endif // I_INTENTION_H 66