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