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_CONTINUATION_DEVICE_CALLBACK_PROXY_H
16 #define OHOS_ABILITY_RUNTIME_CONTINUATION_DEVICE_CALLBACK_PROXY_H
17 #include <memory>
18 #include "connect_callback_stub.h"
19 #include "continuation_device_callback_interface.h"
20 
21 namespace OHOS {
22 namespace AppExecFwk {
23 class ContinuationDeviceCallbackProxy : public ConnectCallbackStub {
24 public:
25     /**
26      * A constructor used to create a {@link ohos.aafwk.ability.continuation.ContinuationDeviceCallbackProxy} instance.
27      */
28     explicit ContinuationDeviceCallbackProxy(std::shared_ptr<IContinuationDeviceCallback> &callback);
29     /**
30      * A destructor used to release a {@link ohos.aafwk.ability.continuation.ContinuationDeviceCallbackProxy} instance.
31      */
32     virtual ~ContinuationDeviceCallbackProxy();
33 
34     /**
35      * @brief After the connection of continuationdevice is completed, call back the function.
36      * @param deviceId indicates the continuation device ID.
37      * @param deviceType indicators he continuation device deviceType.
38      * @return none.
39      */
40     virtual void Connect(const std::string &deviceId, const std::string &deviceType) override;
41 
42     /**
43      * @brief When the continuationdevice is disconnected, call back the function.
44      * @param deviceId indicates the continuation device ID.
45      * @param deviceType indicators he continuation device deviceType.
46      * @return none.
47      */
48     virtual void Disconnect(const std::string &deviceId) override;
49 
50 private:
51     std::weak_ptr<IContinuationDeviceCallback> callback_;
52 };
53 }  // namespace AppExecFwk
54 }  // namespace OHOS
55 #endif
56