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 OHOS_APPEXECFWK_REVERSE_CONTINUATION_SCHEDULER_PRIMARY_STUB_H 16 #define OHOS_APPEXECFWK_REVERSE_CONTINUATION_SCHEDULER_PRIMARY_STUB_H 17 18 #include "iremote_stub.h" 19 #include "reverse_continuation_scheduler_primary_interface.h" 20 21 namespace OHOS { 22 namespace AppExecFwk { 23 24 class ReverseContinuationSchedulerPrimaryStub : public IRemoteStub<IReverseContinuationSchedulerPrimary> { 25 public: 26 ReverseContinuationSchedulerPrimaryStub(); 27 virtual ~ReverseContinuationSchedulerPrimaryStub(); 28 29 /** 30 * @brief Sets an entry for receiving requests. 31 * 32 * @param code Indicates the service request code sent from the peer end. 33 * @param data Indicates the MessageParcel object sent from the peer end. 34 * @param reply Indicates the response message object sent from the remote service. The local service writes the 35 * response data to the MessageParcel object. 36 * @param option Indicates whether the operation is synchronous or asynchronous. 37 * @return ERR_NONE if success, otherwise false. 38 */ 39 virtual int OnRemoteRequest( 40 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 41 42 private: 43 int NotifyReplicaTerminatedInner(MessageParcel &data, MessageParcel &reply); 44 int ContinuationBackInner(MessageParcel &data, MessageParcel &reply); 45 46 static const std::string DESCRIPTOR; 47 48 private: 49 using RequestFuncType = int (ReverseContinuationSchedulerPrimaryStub::*)(MessageParcel &data, MessageParcel &reply); 50 std::map<uint32_t, RequestFuncType> requestFuncMap_; 51 }; 52 53 } // namespace AppExecFwk 54 } // namespace OHOS 55 #endif /* OHOS_APPEXECFWK_REVERSE_CONTINUATION_SCHEDULER_PRIMARY_STUB_H */