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