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 
16 #ifndef DISTRIBUTEDDATAFWK_ARK_COMMUNICATION_PROVIDER_H
17 #define DISTRIBUTEDDATAFWK_ARK_COMMUNICATION_PROVIDER_H
18 
19 #include "communication_provider_impl.h"
20 #include "idevice_query.h"
21 #include "app_pipe_mgr.h"
22 #include "nocopyable.h"
23 
24 namespace OHOS {
25 namespace AppDistributedKv {
26 class ArkCommunicationProvider : public CommunicationProviderImpl {
27 public:
28     static CommunicationProvider &Init();
29     void SetDeviceQuery(std::shared_ptr<IDeviceQuery> deviceQuery) override;
30     // Get online deviceList
31     std::vector<DeviceInfo> GetRemoteDevices() const;
32     // Get deviceInfo by Id
33     DeviceInfo GetDeviceInfo(const std::string &networkId) const;
34     // Get local device information
35     DeviceInfo GetLocalDevice() const;
36 
~ArkCommunicationProvider()37     ~ArkCommunicationProvider() override {};
38 private:
39     DISALLOW_COPY_AND_MOVE(ArkCommunicationProvider);
40     ArkCommunicationProvider();
41     std::shared_ptr<IDeviceQuery> deviceQuery_ {};
42     AppPipeMgr appPipeMgrImpl_ {};
43     bool isInited = false;
44 };
45 }  // namespace AppDistributedKv
46 }  // namespace OHOS
47 #endif  // DISTRIBUTEDDATAFWK_ARK_COMMUNICATION_PROVIDER_H
48