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 /** 17 * @addtogroup Bluetooth 18 * @{ 19 * 20 * @brief Defines a bluetooth system that provides basic blurtooth connection and profile functions, 21 * including A2DP, AVRCP, BLE, GATT, HFP, MAP, PBAP, and SPP, etc. 22 * 23 * @since 6 24 * @version 1.0 25 */ 26 27 /** 28 * @file bluetooth_hf_calls.h 29 * 30 * @brief Declares HFP HandsFree Unit calls data class. 31 * 32 * @since 6 33 * @version 1.0 34 */ 35 36 #ifndef HANDS_FREE_UNIT_CALLS_H 37 #define HANDS_FREE_UNIT_CALLS_H 38 39 #include <string> 40 #include "bt_uuid.h" 41 #include "iosfwd" 42 43 namespace OHOS { 44 namespace bluetooth { 45 /** 46 * @brief Phone call state enum. 47 * 48 * @since 6 49 * @version 1.0 50 */ 51 enum HfpCallState { 52 HFP_CALL_STATE_ACTIVE = 0, 53 HFP_CALL_STATE_HELD, 54 HFP_CALL_STATE_DIALING, 55 HFP_CALL_STATE_ALERTING, 56 HFP_CALL_STATE_INCOMING, 57 HFP_CALL_STATE_WAITING, 58 HFP_CALL_STATE_RESPONSE_HELD, 59 HFP_CALL_STATE_FINISHED 60 }; 61 62 /** 63 * @brief Class for HandsFree Unit calls. 64 * 65 * @since 6 66 * @version 1.0 67 */ 68 class HandsFreeUnitCalls { 69 public: 70 /** 71 * @brief Construct a new HandsFreeUnitCalls object. 72 * 73 * @param device Remote device address. 74 * @param id Call index. 75 * @param state Call state @see HfpCallState. 76 * @param number Call number. 77 * @param multiParty Is multiparty flag. 78 * @param outgoing Incoming/outing flag. 79 * @param inBandRing Is inband-ring flag. 80 * @since 6 81 * @version 1.0 82 */ 83 HandsFreeUnitCalls(const std::string &device, int id, int state, const std::string &number, 84 bool multiParty, bool outgoing, bool inBandRing); 85 86 /** 87 * @brief Construct a new HandsFreeUnitCalls object. 88 * 89 * @param device Remote device address. 90 * @param id Call index. 91 * @param state Call state @see HfpCallState. 92 * @param number Call number. 93 * @param uuid Call uuid. 94 * @param multiParty Is multiparty flag. 95 * @param outgoing Incoming/outing flag. 96 * @param inBandRing Is inband-ring flag. 97 * @param creationTime Call's creation time. 98 * @since 6 99 * @version 1.0 100 */ 101 HandsFreeUnitCalls(const std::string &device, int id, int state, const std::string &number, Uuid &uuid, 102 bool multiParty, bool outgoing, bool inBandRing, long creationTime); 103 104 /** 105 * @brief Construct a new HandsFreeUnitCall object as default. 106 * 107 * @since 6 108 * @version 1.0 109 */ 110 HandsFreeUnitCalls() = default; 111 112 /** 113 * @brief Construct a new HandsFreeUnitCalls object as default. 114 * 115 * @param other Other HandsFreeUnitCalls object. 116 * @since 6 117 * @version 1.0 118 */ 119 HandsFreeUnitCalls(const HandsFreeUnitCalls& other) = default; 120 121 /** 122 * @brief Destroy the HandsFreeUnitCall object. 123 * 124 * @since 6 125 * @version 1.0 126 */ 127 ~HandsFreeUnitCalls() = default; 128 129 /** 130 * @brief Get the remote device address. 131 * 132 * @return Returns remote device address. 133 * @since 6 134 * @version 1.0 135 */ 136 const std::string &GetRemoteDevice() const; 137 138 /** 139 * @brief Get the call index. 140 * 141 * @return Returns the call index. 142 * @since 6 143 * @version 1.0 144 */ 145 int GetId() const; 146 147 /** 148 * @brief Get the uuid object. 149 * 150 * @return Returns the call uuid. 151 * @since 6 152 * @version 1.0 153 */ 154 Uuid GetUuid() const; 155 156 /** 157 * @brief Get the call state. 158 * 159 * @return Returns the call state. 160 * @since 6 161 * @version 1.0 162 */ 163 int GetState() const; 164 165 /** 166 * @brief Get the call number. 167 * 168 * @return Returns the call number. 169 * @since 6 170 * @version 1.0 171 */ 172 const std::string &GetNumber() const; 173 174 /** 175 * @brief Get the call's creation time. 176 * 177 * @return Returns the call's creation time. 178 * @since 6 179 * @version 1.0 180 */ 181 long GetCreationTime() const; 182 183 /** 184 * @brief Get the IsMultiParty flag. 185 * 186 * @return Returns the IsMultiParty flag. 187 * @since 6 188 * @version 1.0 189 */ 190 bool IsMultiParty() const; 191 192 /** 193 * @brief Get the IsOutgoing flag. 194 * 195 * @return Returns the IsOutgoing flag. 196 * @since 6 197 * @version 1.0 198 */ 199 bool IsOutgoing() const; 200 201 /** 202 * @brief Get the IsInBandRing flag. 203 * 204 * @return Returns the IsInBandRing flag. 205 * @since 6 206 * @version 1.0 207 */ 208 bool IsInBandRing() const; 209 210 /** 211 * @brief Set the call state. 212 * 213 * @param state Call state. 214 * @since 6 215 * @version 1.0 216 */ 217 void SetState(int state); 218 219 /** 220 * @brief Set the call number. 221 * 222 * @param number Call number. 223 * @since 6 224 * @version 1.0 225 */ 226 void SetNumber(const std::string &number); 227 228 /** 229 * @brief Set the multiParty flag. 230 * 231 * @param multiParty The multiParty flag 232 * @since 6 233 * @version 1.0 234 */ 235 void SetMultiParty(bool multiParty); 236 237 protected: 238 std::string device_ {""}; 239 int id_ {0}; 240 int state_ {-1}; 241 std::string number_ {""}; 242 Uuid uuid_ {}; 243 bool multiParty_ {false}; 244 bool outgoing_ {false}; 245 bool inBandRing_ {false}; 246 long creationTime_ {0}; 247 }; 248 } // namespace bluetooth 249 } // namespace OHOS 250 #endif // HANDS_FREE_UNIT_CALLS_H