1 /*
2  * Copyright (C) 2023 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 TELEPHONY_DISTRIBUTED_CALL_PROXY_H
17 #define TELEPHONY_DISTRIBUTED_CALL_PROXY_H
18 
19 #include <mutex>
20 #include <memory>
21 
22 #include "idcall_device_callback.h"
23 #include "dcall/idcall_client.h"
24 
25 namespace OHOS {
26 namespace Telephony {
27 class DistributedCallProxy {
28 public:
29     DistributedCallProxy();
30     ~DistributedCallProxy();
31 
32     int32_t Init();
33     int32_t UnInit();
34     int32_t SwitchDevice(const std::string& devId, int32_t flag);
35     int32_t GetOnlineDeviceList(std::vector<std::string>& devList);
36     int32_t RegisterDeviceCallback(const std::string name,
37         const std::shared_ptr<OHOS::DistributedHardware::IDCallDeviceCallback>& callback);
38     int32_t UnRegisterDeviceCallback(const std::string& name);
39     int32_t GetDCallDeviceInfo(const std::string &devId, OHOS::DistributedHardware::DCallDeviceInfo& devInfo);
40 
41 private:
42     OHOS::DistributedHardware::IDCallClient* GetDCallClient();
43 
44 private:
45     std::mutex dcallClientMtx_;
46     OHOS::DistributedHardware::IDCallClient* dcallClient_ = nullptr;
47     void *dCallClientHandler_ = nullptr;
48 };
49 } // Telephony
50 } // OHOS
51 #endif // TELEPHONY_DISTRIBUTED_CALL_PROXY_H