1 /* 2 * Copyright (C) 2025-2025 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 INTEROPERABLE_COMMUNICATION_MANAGER_H 17 #define INTEROPERABLE_COMMUNICATION_MANAGER_H 18 19 #include "singleton.h" 20 #include "ffrt.h" 21 #include "interoperable_device_observer.h" 22 #include "interoperable_data_controller.h" 23 #include "device_manager_callback.h" 24 #include "call_state_listener_base.h" 25 26 namespace OHOS { 27 namespace Telephony { 28 enum class InteroperableRole : int8_t { 29 UNKNOWN = -1, 30 PHONE = 0, 31 OTHERS = 1 32 }; 33 class InteroperableCommunicationManager : public CallStateListenerBase { 34 DECLARE_DELAYED_SINGLETON(InteroperableCommunicationManager) 35 36 public: 37 void OnDeviceOnline(const DistributedHardware::DmDeviceInfo &deviceInfo); 38 void OnDeviceOffline(const DistributedHardware::DmDeviceInfo &deviceInfo); 39 void SetMuted(bool isMute); 40 void MuteRinger(); 41 void CallStateUpdated(sptr<CallBase> &callObjectPtr, TelCallState priorState, TelCallState nextState) override; 42 void NewCallCreated(sptr<CallBase> &call) override; CallDestroyed(const DisconnectedDetails & details)43 void CallDestroyed(const DisconnectedDetails &details) override {} 44 int32_t GetBtCallSlotId(const std::string &phoneNum); 45 46 private: 47 ffrt::mutex mutex_{}; 48 std::list<std::string> peerDevices_{}; 49 std::shared_ptr<InteroperableDeviceObserver> devObserver_{nullptr}; 50 std::shared_ptr<InteroperableDataController> dataController_{nullptr}; 51 InteroperableRole role_{InteroperableRole::UNKNOWN}; 52 }; 53 } 54 } 55 #endif // INTEROPERABLE_COMMUNICATION_MANAGER_H