• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 #ifndef RESSCHED_INTERFACES_INNERKITS_RESSCHED_CLIENT_INCLUDE_RES_SCHED_SERVICE_PROXY_H
17 #define RESSCHED_INTERFACES_INNERKITS_RESSCHED_CLIENT_INCLUDE_RES_SCHED_SERVICE_PROXY_H
18 
19 #include <cstdint>               // for int64_t, uint32_t
20 #include "iremote_proxy.h"       // for IRemoteProxy
21 #include "ires_sched_service.h"  // for IResSchedService
22 #include "nlohmann/json.hpp"     // for Value
23 #include "nocopyable.h"          // for DISALLOW_COPY_AND_MOVE
24 
25 namespace OHOS { class IRemoteObject; }
26 
27 namespace OHOS {
28 namespace ResourceSchedule {
29 class ResSchedServiceProxy : public IRemoteProxy<IResSchedService> {
30 public:
31     /**
32      * @brief Report resource data to the resource schedule service through inter-process communication.
33      *
34      * @param resType Indicates the resource type, all of the type have listed in res_type.h.
35      * @param value Indicates the value of the resource type, defined by the developers.
36      * @param payload Indicates the context info of the resource type event.
37      */
38     void ReportData(uint32_t resType, int64_t value, const nlohmann::json& payload) override;
39 
40     /**
41      * @brief Kill process with pid.
42      *
43      * @param payload Indicates the context info of the kill message.
44      */
45     int32_t KillProcess(const nlohmann::json& payload) override;
46 public:
47     /**
48      * @brief Construct a new ResSchedServiceProxy object.
49      *
50      * @param impl RemoteObject.
51      */
ResSchedServiceProxy(const sptr<IRemoteObject> & impl)52     explicit ResSchedServiceProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IResSchedService>(impl) {}
53 
54     /**
55      * @brief Destroy the ResSchedServiceProxy object
56      */
~ResSchedServiceProxy()57     virtual ~ResSchedServiceProxy() {}
58 
59 private:
60     DISALLOW_COPY_AND_MOVE(ResSchedServiceProxy);
61     static inline BrokerDelegator<ResSchedServiceProxy> delegator_;
62 };
63 } // namespace ResourceSchedule
64 } // namespace OHOS
65 
66 #endif // RESSCHED_INTERFACES_INNERKITS_RESSCHED_CLIENT_INCLUDE_RES_SCHED_SERVICE_PROXY_H
67