1/* 2 * Copyright (C) 2022 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 CALL_CONNECT_ABILITY_H 17#define CALL_CONNECT_ABILITY_H 18 19#include <condition_variable> 20#include <mutex> 21 22#include "ability_connect_callback_interface.h" 23#include "call_manager_inner_type.h" 24#include "ipc_skeleton.h" 25#include "singleton.h" 26 27namespace OHOS { 28namespace Telephony { 29class CallConnectAbility { 30DECLARE_DELAYED_SINGLETON(CallConnectAbility) 31public: 32 void ConnectAbility(); 33 void DisconnectAbility(); 34 void SetConnectFlag(bool isConnected); 35 bool GetConnectFlag(); 36 void SetConnectingFlag(bool isConnecting); 37 void SetDisconnectingFlag(bool isDisconnecting); 38 void NotifyAll(); 39 bool WaitForConnectResult(); 40 41private: 42 sptr<AAFwk::IAbilityConnection> connectCallback_ = nullptr; 43 bool isConnected_ = false; 44 bool isConnecting_ = false; 45 bool isDisconnecting_ = false; 46 static std::condition_variable cv_; 47 std::mutex mutex_; 48}; 49} // namespace Telephony 50} // namespace OHOS 51#endif // CALL_CONNECT_ABILITY_H 52