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