• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
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 #ifndef MONITOR_SERVICE_STUB_H
17 #define MONITOR_SERVICE_STUB_H
18 
19 #include <map>
20 #include "i_standard_monitor_service.h"
21 #include "nocopyable.h"
22 
23 namespace OHOS {
24 namespace Media {
25 using MonitorStubFunc = std::function<int32_t(MessageParcel &data, MessageParcel &reply)>;
26 class MonitorServiceStub : public IRemoteStub<IStandardMonitorService>, public NoCopyable {
27 public:
28     virtual ~MonitorServiceStub();
29 
30     static sptr<MonitorServiceStub> GetInstance();
31 
32     int32_t DumpInfo(int32_t fd, bool needDetail);
33     int32_t OnClientDie(int32_t pid);
34 
35     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
36     int32_t Click() override;
37     int32_t EnableMonitor() override;
38     int32_t DisableMonitor() override;
39 
40 private:
41     MonitorServiceStub();
42     int32_t Init();
43     int32_t Click(MessageParcel &data, MessageParcel &reply);
44     int32_t EnableMonitor(MessageParcel &data, MessageParcel &reply);
45     int32_t DisableMonitor(MessageParcel &data, MessageParcel &reply);
46 
47     std::map<uint32_t, MonitorStubFunc> monitorFuncs_;
48 };
49 } // namespace Media
50 } // namespace OHOS
51 #endif // MONITOR_SERVICE_STUB_H
52