1 /* 2 * Copyright (c) 2022 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 FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_FRAMEWORKS_INCLUDE_BACKGROUND_TASK_SUBSCRIBER_STUB_H 17 #define FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_FRAMEWORKS_INCLUDE_BACKGROUND_TASK_SUBSCRIBER_STUB_H 18 19 #include <iremote_stub.h> 20 21 #include "bgtaskmgr_inner_errors.h" 22 #include "ibackground_task_subscriber.h" 23 #include "resource_callback_info.h" 24 namespace OHOS { 25 namespace BackgroundTaskMgr { 26 class BackgroundTaskSubscriberStub : public IRemoteStub<IBackgroundTaskSubscriber> { 27 public: 28 BackgroundTaskSubscriberStub(); 29 ~BackgroundTaskSubscriberStub() override; 30 DISALLOW_COPY_AND_MOVE(BackgroundTaskSubscriberStub); 31 32 /** 33 * @brief Request service code and service data. 34 * 35 * @param code Service request code. 36 * @param data MessageParcel object. 37 * @param reply Local service response. 38 * @param option Point out async or sync. 39 * @return ERR_OK if success, else fail. 40 */ 41 int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; 42 43 private: 44 ErrCode HandleOnConnected(); 45 ErrCode HandleOnDisconnected(); 46 ErrCode HandleOnTransientTaskStart(MessageParcel& data); 47 ErrCode HandleOnTransientTaskEnd(MessageParcel& data); 48 ErrCode HandleOnTransientTaskErr(MessageParcel& data); 49 ErrCode HandleOnAppTransientTaskStart(MessageParcel& data); 50 ErrCode HandleOnAppTransientTaskEnd(MessageParcel& data); 51 ErrCode HandleOnContinuousTaskStart(MessageParcel &data); 52 ErrCode HandleOnContinuousTaskUpdate(MessageParcel &data); 53 ErrCode HandleOnContinuousTaskCancel(MessageParcel &data); 54 ErrCode HandleOnAppContinuousTaskStop(MessageParcel &data); 55 ErrCode HandleOnAppEfficiencyResourcesApply(MessageParcel &data); 56 ErrCode HandleOnAppEfficiencyResourcesReset(MessageParcel &data); 57 ErrCode HandleOnProcEfficiencyResourcesApply(MessageParcel &data); 58 ErrCode HandleOnProcEfficiencyResourcesReset(MessageParcel &data); 59 ErrCode HandleTransientTask(uint32_t code, MessageParcel &data); 60 ErrCode OnRemoteRequestInner(uint32_t code, 61 MessageParcel& data, MessageParcel& reply, MessageOption& option); 62 }; 63 } // namespace BackgroundTaskMgr 64 } // namespace OHOS 65 #endif // FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_FRAMEWORKS_INCLUDE_BACKGROUND_TASK_SUBSCRIBER_STUB_H