1e1c44949Sopenharmony_ci/* 2e1c44949Sopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd. 3e1c44949Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4e1c44949Sopenharmony_ci * you may not use this file except in compliance with the License. 5e1c44949Sopenharmony_ci * You may obtain a copy of the License at 6e1c44949Sopenharmony_ci * 7e1c44949Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8e1c44949Sopenharmony_ci * 9e1c44949Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10e1c44949Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11e1c44949Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12e1c44949Sopenharmony_ci * See the License for the specific language governing permissions and 13e1c44949Sopenharmony_ci * limitations under the License. 14e1c44949Sopenharmony_ci */ 15e1c44949Sopenharmony_ci 16e1c44949Sopenharmony_ci#ifndef BLUETOOTH_CALL_SERVICE_H 17e1c44949Sopenharmony_ci#define BLUETOOTH_CALL_SERVICE_H 18e1c44949Sopenharmony_ci 19e1c44949Sopenharmony_ci#include <memory> 20e1c44949Sopenharmony_ci 21e1c44949Sopenharmony_ci#include "bluetooth_call_policy.h" 22e1c44949Sopenharmony_ci#include "bluetooth_call_stub.h" 23e1c44949Sopenharmony_ci#include "call_control_manager.h" 24e1c44949Sopenharmony_ci 25e1c44949Sopenharmony_cinamespace OHOS { 26e1c44949Sopenharmony_cinamespace Telephony { 27e1c44949Sopenharmony_ciclass BluetoothCallService : public BluetoothCallStub, public BluetoothCallPolicy { 28e1c44949Sopenharmony_cipublic: 29e1c44949Sopenharmony_ci BluetoothCallService(); 30e1c44949Sopenharmony_ci ~BluetoothCallService(); 31e1c44949Sopenharmony_ci /** 32e1c44949Sopenharmony_ci * AnswerCall 33e1c44949Sopenharmony_ci * 34e1c44949Sopenharmony_ci * @brief Answer a phone call 35e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 36e1c44949Sopenharmony_ci */ 37e1c44949Sopenharmony_ci int32_t AnswerCall() override; 38e1c44949Sopenharmony_ci 39e1c44949Sopenharmony_ci /** 40e1c44949Sopenharmony_ci * RejectCall 41e1c44949Sopenharmony_ci * 42e1c44949Sopenharmony_ci * @brief Reject a phone call 43e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 44e1c44949Sopenharmony_ci */ 45e1c44949Sopenharmony_ci int32_t RejectCall() override; 46e1c44949Sopenharmony_ci 47e1c44949Sopenharmony_ci /** 48e1c44949Sopenharmony_ci * HangUpCall 49e1c44949Sopenharmony_ci * 50e1c44949Sopenharmony_ci * @brief Hang up the phone 51e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 52e1c44949Sopenharmony_ci */ 53e1c44949Sopenharmony_ci int32_t HangUpCall() override; 54e1c44949Sopenharmony_ci 55e1c44949Sopenharmony_ci /** 56e1c44949Sopenharmony_ci * GetCallState 57e1c44949Sopenharmony_ci * 58e1c44949Sopenharmony_ci * @brief Obtain the call status of the device 59e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 60e1c44949Sopenharmony_ci */ 61e1c44949Sopenharmony_ci int32_t GetCallState() override; 62e1c44949Sopenharmony_ci 63e1c44949Sopenharmony_ci /** 64e1c44949Sopenharmony_ci * HoldCall 65e1c44949Sopenharmony_ci * 66e1c44949Sopenharmony_ci * @brief Park a phone call 67e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 68e1c44949Sopenharmony_ci */ 69e1c44949Sopenharmony_ci int32_t HoldCall() override; 70e1c44949Sopenharmony_ci 71e1c44949Sopenharmony_ci /** 72e1c44949Sopenharmony_ci * UnHoldCall 73e1c44949Sopenharmony_ci * 74e1c44949Sopenharmony_ci * @brief Activate a phone call 75e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 76e1c44949Sopenharmony_ci */ 77e1c44949Sopenharmony_ci int32_t UnHoldCall() override; 78e1c44949Sopenharmony_ci 79e1c44949Sopenharmony_ci /** 80e1c44949Sopenharmony_ci * SwitchCall 81e1c44949Sopenharmony_ci * 82e1c44949Sopenharmony_ci * @brief Switch the phone 83e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 84e1c44949Sopenharmony_ci */ 85e1c44949Sopenharmony_ci int32_t SwitchCall() override; 86e1c44949Sopenharmony_ci 87e1c44949Sopenharmony_ci /** 88e1c44949Sopenharmony_ci * StartDtmf 89e1c44949Sopenharmony_ci * 90e1c44949Sopenharmony_ci * @brief Enable and send DTMF 91e1c44949Sopenharmony_ci * @param str[in], Characters sent 92e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 93e1c44949Sopenharmony_ci */ 94e1c44949Sopenharmony_ci int32_t StartDtmf(char str) override; 95e1c44949Sopenharmony_ci 96e1c44949Sopenharmony_ci /** 97e1c44949Sopenharmony_ci * StopDtmf 98e1c44949Sopenharmony_ci * 99e1c44949Sopenharmony_ci * @brief Stop the DTMF 100e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 101e1c44949Sopenharmony_ci */ 102e1c44949Sopenharmony_ci int32_t StopDtmf() override; 103e1c44949Sopenharmony_ci 104e1c44949Sopenharmony_ci /** 105e1c44949Sopenharmony_ci * CombineConference 106e1c44949Sopenharmony_ci * 107e1c44949Sopenharmony_ci * @brief Merge calls to form a conference 108e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 109e1c44949Sopenharmony_ci */ 110e1c44949Sopenharmony_ci int32_t CombineConference() override; 111e1c44949Sopenharmony_ci 112e1c44949Sopenharmony_ci /** 113e1c44949Sopenharmony_ci * SeparateConference 114e1c44949Sopenharmony_ci * 115e1c44949Sopenharmony_ci * @brief Separates a specified call from a conference call 116e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 117e1c44949Sopenharmony_ci */ 118e1c44949Sopenharmony_ci int32_t SeparateConference() override; 119e1c44949Sopenharmony_ci 120e1c44949Sopenharmony_ci /** 121e1c44949Sopenharmony_ci * KickOutFromConference 122e1c44949Sopenharmony_ci * 123e1c44949Sopenharmony_ci * @brief Kick out a specified call from a conference call 124e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 125e1c44949Sopenharmony_ci */ 126e1c44949Sopenharmony_ci int32_t KickOutFromConference() override; 127e1c44949Sopenharmony_ci 128e1c44949Sopenharmony_ci /** 129e1c44949Sopenharmony_ci * GetCurrentCallList 130e1c44949Sopenharmony_ci * 131e1c44949Sopenharmony_ci * @brief Get current call list 132e1c44949Sopenharmony_ci * @param slotId[in], The slot id 133e1c44949Sopenharmony_ci * @return Returns call info list. 134e1c44949Sopenharmony_ci */ 135e1c44949Sopenharmony_ci std::vector<CallAttributeInfo> GetCurrentCallList(int32_t slotId) override; 136e1c44949Sopenharmony_ciprivate: 137e1c44949Sopenharmony_ci std::shared_ptr<CallControlManager> callControlManagerPtr_; 138e1c44949Sopenharmony_ci bool sendDtmfState_; 139e1c44949Sopenharmony_ci int32_t sendDtmfCallId_; 140e1c44949Sopenharmony_ci std::mutex lock_; 141e1c44949Sopenharmony_ci}; 142e1c44949Sopenharmony_ci} // namespace Telephony 143e1c44949Sopenharmony_ci} // namespace OHOS 144e1c44949Sopenharmony_ci 145e1c44949Sopenharmony_ci#endif // BLUETOOTH_CALL_SERVICE_H 146