• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FOUNDATION_APPEXECFWK_OHOS_CONTINUATION_REGISTER_MANAGER_H
16 #define FOUNDATION_APPEXECFWK_OHOS_CONTINUATION_REGISTER_MANAGER_H
17 
18 #include <string>
19 #include "continuation_register_manager_interface.h"
20 
21 namespace OHOS {
22 namespace AppExecFwk {
23 class ContinuationRegisterManagerProxy;
24 class ContinuationRegisterManager : public IContinuationRegisterManager {
25 public:
26     ContinuationRegisterManager() = default;
27     virtual ~ContinuationRegisterManager() = default;
28 
29     void Init(const std::shared_ptr<ContinuationRegisterManagerProxy> &continuationRegisterManagerProxy);
30     /**
31      * register to controlcenter continuation register service.
32      *
33      * @param bundleName bundlename of ability.
34      * @param parameter filter with supported device list.
35      * @param callback callback for device connect and disconnect.
36      * @param requestCallback callback for this request, -1 means failed, otherwise is register token.
37      */
38     virtual void Register(const std::string &bundleName, const ExtraParams &parameter,
39         const std::shared_ptr<IContinuationDeviceCallback> &deviceCallback,
40         const std::shared_ptr<RequestCallback> &requestCallback) override;
41 
42     /**
43      * unregister to controlcenter continuation register service.
44      *
45      * @param token token from register return value.
46      * @param requestCallback callback for this request, -1 means failed, otherwise succeeded.
47      */
48     virtual void Unregister(int token, const std::shared_ptr<RequestCallback> &requestCallback) override;
49 
50     /**
51      * notify continuation status to controlcenter continuation register service.
52      *
53      * @param token token from register.
54      * @param deviceId deviceid.
55      * @param status device status.
56      * @param requestCallback callback for this request, -1 means failed, otherwise successed.
57      */
58     virtual void UpdateConnectStatus(int token, const std::string &deviceId, int status,
59         const std::shared_ptr<RequestCallback> &requestCallback) override;
60 
61     /**
62      * notify controlcenter continuation register service to show device list.
63      *
64      * @param token token from register
65      * @param parameter filter with supported device list.
66      * @param requestCallback callback for this request, -1 means failed, otherwise successed.
67      */
68     virtual void ShowDeviceList(
69         int token, const ExtraParams &parameter, const std::shared_ptr<RequestCallback> &requestCallback) override;
70 
71     /**
72      * disconnect to controlcenter continuation register service.
73      */
74     virtual void Disconnect(void) override;
75 
76 private:
77     std::shared_ptr<ContinuationRegisterManagerProxy> continuationRegisterManagerProxy_ = nullptr;
78 };
79 }  // namespace AppExecFwk
80 }  // namespace OHOS
81 #endif  // FOUNDATION_APPEXECFWK_OHOS_CONTINUATION_REGISTER_MANAGER_H