• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #ifndef HDI_SERVICE_STATUS_LISTENER_INF_H
16 #define HDI_SERVICE_STATUS_LISTENER_INF_H
17 
18 #include <refbase.h>
19 #include <iremote_broker.h>
20 #include <iremote_stub.h>
21 
22 #include "hdf_io_service_if.h"
23 
24 namespace OHOS {
25 namespace HDI {
26 namespace ServiceManager {
27 namespace V1_0 {
28 enum ServiceStatusType {
29     SERVIE_STATUS_START,
30     SERVIE_STATUS_CHANGE,
31     SERVIE_STATUS_STOP,
32     SERVIE_STATUS_MAX,
33 };
34 
35 struct ServiceStatus {
36     std::string serviceName;
37     uint16_t deviceClass;   /* ref to DeviceClass */
38     uint16_t status;        /* ref to ServiceStatusType */
39     std::string info;
40 };
41 
42 class IServStatListener : public ::OHOS::IRemoteBroker {
43 public:
44     DECLARE_INTERFACE_DESCRIPTOR(u"HDI.IServiceStatusListener.V1_0");
45     virtual void OnReceive(const ServiceStatus &status) = 0;
46 };
47 
48 class ServStatListenerStub : public ::OHOS::IRemoteStub<IServStatListener> {
49 public:
50     ServStatListenerStub() = default;
~ServStatListenerStub()51     virtual ~ServStatListenerStub() {}
52 
53     int OnRemoteRequest(uint32_t code,
54         ::OHOS::MessageParcel &data, ::OHOS::MessageParcel &reply, ::OHOS::MessageOption &option) override;
55 private:
56     int32_t ServStatListenerStubOnReceive(::OHOS::MessageParcel& data,
57         ::OHOS::MessageParcel& reply, ::OHOS::MessageOption& option);
58 };
59 } // namespace V1_0
60 } // namespace ServiceManager
61 } // namespace HDI
62 } // namespace OHOS
63 
64 #endif /* HDI_SERVICE_STATUS_LISTENER_INF_H */