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 * @file interface_profile_avrcp_ct.h 18 * 19 * @brief Declares the basic class of the AVRCP service, including attributes, and methods. 20 * 21 * @since 6 22 */ 23 24 #ifndef INTERFACE_PROFILE_AVRCP_CT_H 25 #define INTERFACE_PROFILE_AVRCP_CT_H 26 27 #include <vector> 28 #include "bt_def.h" 29 #include "avrcp_media.h" 30 #include "interface_profile.h" 31 32 namespace OHOS { 33 namespace bluetooth { 34 /** 35 * @brief This class provides data interaction for asynchronous actions. 36 * 37 * @since 6 38 */ 39 class IProfileAvrcpCt : public IProfile { 40 public: 41 /** 42 * @brief This abstract class declares a set of methods for observing the class of the <b>IProfileAvrcpCt</b>. 43 * 44 * @since 6 45 */ 46 class IObserver { 47 public: 48 /** 49 * @brief A constructor used to create an <b>IProfileAvrcpCt::IObserver</b> instance. 50 * 51 * @since 6 52 */ 53 IObserver() = default; 54 55 /** 56 * @brief A destructor used to delete the <b>IProfileAvrcpCt::IObserver</b> instance. 57 * 58 * @since 6 59 */ 60 virtual ~IObserver() = default; 61 62 /** 63 * @brief Informs the state of the connection. 64 * 65 * @param[in] device The bluetooth device. 66 * @param[in] state The connection state. Refer to <b>BTConnectState</b>. 67 * 68 * @since 6 69 */ 70 virtual void OnConnectionStateChanged(const RawAddress &rawAddr, int state) = 0; 71 72 /** 73 * @brief Responds the data of the <b>PressButton</b>. 74 * 75 * @param[in] rawAddr The address of the bluetooth device. 76 * @param[in] button The value of the key operation. Refer to <b>AvrcKeyOperation</b>. 77 * @param[in] result The result of the execution.<br> 78 * @a RET_NO_ERROR : Execute success.<br> 79 * @a RET_NO_SUPPORT : Not support.<br> 80 * @a RET_BAD_STATUS : Execute failure. 81 * 82 * @since 6 83 */ 84 virtual void OnPressButton(const RawAddress &rawAddr, uint8_t button, int result) = 0; 85 86 /** 87 * @brief Responds the data of the <b>ReleaseButton</b>. 88 * 89 * @param[in] rawAddr The address of the bluetooth device. 90 * @param[in] button The value of the key operation. Refer to <b>AvrcKeyOperation</b>. 91 * @param[in] result The result of the execution.<br> 92 * @a RET_NO_ERROR : Execute success.<br> 93 * @a RET_NO_SUPPORT : Not support.<br> 94 * @a RET_BAD_STATUS : Execute failure. 95 * 96 * @since 6 97 */ 98 virtual void OnReleaseButton(const RawAddress &rawAddr, uint8_t button, int result) = 0; 99 100 /** 101 * @brief Responds the data of the <b>SetAddressedPlayer</b>. 102 * 103 * @param[in] rawAddr The address of the bluetooth device. 104 * @param[in] result The result of the execution.<br> 105 * @a RET_NO_ERROR : Execute success.<br> 106 * @a RET_NO_SUPPORT : Not support.<br> 107 * @a RET_BAD_STATUS : Execute failure. 108 * @param[in] detail The detail result of the execution. Refer to <b>AvrcEsCode</b>.<br> 109 * @a AVRC_ES_CODE_NO_ERROR<br> 110 * @a AVRC_ES_CODE_INTERNAL_ERROR<br> 111 * @a AVRC_ES_CODE_UID_CHANGED<br> 112 * @a AVRC_ES_CODE_INVALID_PLAYER_ID<br> 113 * @a AVRC_ES_CODE_NO_AVAILABLE_PLAYERS 114 * 115 * @since 6 116 */ 117 virtual void OnSetAddressedPlayer(const RawAddress &rawAddr, int result, int detail) = 0; 118 119 /** 120 * @brief Responds the data of the <b>SetBrowsedPlayer</b>. 121 * 122 * @param[in] rawAddr The address of the bluetooth device. 123 * @param[in] uidCounter The value of the uid counter. 124 * @param[in] numOfItems The number of items in the directory. 125 * @param[in] folderNames The current browsed path of the player. The first element in folderNames is the parent 126 * folder. The root folder has no name. The names are in UTF-8. 127 * @param[in] result The result of the execution.<br> 128 * @a RET_NO_ERROR : Execute success.<br> 129 * @a RET_NO_SUPPORT : Not support.<br> 130 * @a RET_BAD_STATUS : Execute failure. 131 * @param[in] detail The detail result of the execution. Refer to <b>AvrcEsCode</b>.<br> 132 * @a AVRC_ES_CODE_NO_ERROR<br> 133 * @a AVRC_ES_CODE_INTERNAL_ERROR<br> 134 * @a AVRC_ES_CODE_UID_CHANGED<br> 135 * @a AVRC_ES_CODE_INVALID_PLAYER_ID<br> 136 * @a AVRC_ES_CODE_PLAYER_NOT_BROWSABLE<br> 137 * @a AVRC_ES_CODE_PLAYER_NOT_ADDRESSED<br> 138 * @a AVRC_ES_CODE_NO_AVAILABLE_PLAYERS 139 * 140 * @since 6 141 */ 142 virtual void OnSetBrowsedPlayer(const RawAddress &rawAddr, uint16_t uidCounter, uint32_t numOfItems, 143 const std::vector<std::string> &folderNames, int result, int detail) = 0; 144 145 /** 146 * @brief Responds the data of the <b>GetCapabilities</b>. 147 * 148 * @param[in] addr The address of the bluetooth device. 149 * @param[in] companies The list of CompanyId. 150 * @param[in] events The list of Events. 151 * @param[in] result The result of the execution.<br> 152 * @a RET_NO_ERROR : Execute success.<br> 153 * @a RET_NO_SUPPORT : Not support.<br> 154 * @a RET_BAD_STATUS : Execute failure. 155 * 156 * @since 6 157 */ 158 virtual void OnGetCapabilities(const RawAddress &rawAddr, const std::vector<uint32_t> &companies, 159 const std::vector<uint8_t> &events, int result) = 0; 160 161 /** 162 * @brief Responds the data of the <b>GetPlayerAppSettingAttributes</b>. 163 * 164 * @param[in] rawAddr The address of the bluetooth device. 165 * @param[in] attributes The attribute of the player application settings. 166 * @param[in] result The result of the execution.<br> 167 * @a RET_NO_ERROR : Execute success.<br> 168 * @a RET_NO_SUPPORT : Not support.<br> 169 * @a RET_BAD_STATUS : Execute failure. 170 * 171 * @since 6 172 */ 173 virtual void OnGetPlayerAppSettingAttributes( 174 const RawAddress &rawAddr, std::vector<uint8_t> attributes, int result) = 0; 175 176 /** 177 * @brief Responds the data of the <b>GetPlayerAppSettingValues</b>. 178 * 179 * @param[in] rawAddr The address of the bluetooth device. 180 * @param[in] attribute The attribute of the player application setting. Refer to <b>AvrcPlayerAttribute</b>. 181 * @param[in] values The values associated witch the attribute. 182 * @param[in] result The result of the execution.<br> 183 * @a RET_NO_ERROR : Execute success.<br> 184 * @a RET_NO_SUPPORT : Not support.<br> 185 * @a RET_BAD_STATUS : Execute failure. 186 * 187 * @since 6 188 */ 189 virtual void OnGetPlayerAppSettingValues( 190 const RawAddress &rawAddr, uint8_t attribute, const std::vector<uint8_t> &values, int result) = 0; 191 192 /** 193 * @brief Responds the data of the <b>GetPlayerAppSettingCurrentValue</b>. 194 * 195 * @param[in] rawAddr The address of the bluetooth device. 196 * @param[in] attributes The attribute of the player application settings. Refer to <b>AvrcPlayerAttribute</b>. 197 * @param[in] values The values associated witch the attribute. 198 * @param[in] result The result of the execution.<br> 199 * @a RET_NO_ERROR : Execute success.<br> 200 * @a RET_NO_SUPPORT : Not support.<br> 201 * @a RET_BAD_STATUS : Execute failure. 202 * 203 * @since 6 204 */ 205 virtual void OnGetPlayerAppSettingCurrentValue(const RawAddress &rawAddr, 206 const std::vector<uint8_t> &attributes, const std::vector<uint8_t> &values, int result) = 0; 207 208 /** 209 * @brief Responds the data of the <b>SetPlayerAppSettingCurrentValue</b>. 210 * 211 * @param[in] rawAddr The address of the bluetooth device. 212 * @param[in] result The result of the execution.<br> 213 * @a RET_NO_ERROR : Execute success.<br> 214 * @a RET_NO_SUPPORT : Not support.<br> 215 * @a RET_BAD_STATUS : Execute failure. 216 * 217 * @since 6 218 */ 219 virtual void OnSetPlayerAppSettingCurrentValue(const RawAddress &rawAddr, int result) = 0; 220 221 /** 222 * @brief Responds the data of the <b>GetPlayerApplicationSettingAttributeText</b>. 223 * 224 * @param[in] rawAddr The address of the bluetooth device. 225 * @param[in] attributes The attribute of the player application settings. 226 * @param[in] attrStr The values associated witch the attribute. 227 * @param[in] result The result of the execution.<br> 228 * @a RET_NO_ERROR : Execute success.<br> 229 * @a RET_NO_SUPPORT : Not support.<br> 230 * @a RET_BAD_STATUS : Execute failure. 231 * @since 6 232 */ 233 virtual void OnGetPlayerAppSettingAttributeText(const RawAddress &rawAddr, 234 const std::vector<uint8_t> &attributes, const std::vector<std::string> &attrStr, int result) = 0; 235 236 /** 237 * @brief Responds the data of the <b>GetPlayerAppSettingValueText</b>. 238 * 239 * @param[in] addr The address of the bluetooth device. 240 * @param[in] values Player application setting value ID. 241 * @param[in] valueStr Specifies the value string of player application setting value. 242 * @param[in] result The result of the execution.<br> 243 * @a RET_NO_ERROR : Execute success.<br> 244 * @a RET_NO_SUPPORT : Not support.<br> 245 * @a RET_BAD_STATUS : Execute failure. 246 * @since 6 247 */ 248 virtual void OnGetPlayerAppSettingValueText(const RawAddress &rawAddr, const std::vector<uint8_t> &values, 249 const std::vector<std::string> &valueStr, int result) = 0; 250 251 /** 252 * @brief Responds the data of the <b>GetElementAttribtues</b>. 253 * 254 * @param[in] rawAddr The address of the bluetooth device. 255 * @param[in] attributes The attributes of the player application setting. Refer to <b>AvrcPlayerAttribute</b>. 256 * @param[in] values The values associated witch the attribute.Refer to <b>GetElementAttribtues</b>. 257 * @param[in] result The result of the execution.<br> 258 * @a RET_NO_ERROR : Execute success.<br> 259 * @a RET_NO_SUPPORT : Not support.<br> 260 * @a RET_BAD_STATUS : Execute failure. 261 * 262 * @since 6 263 */ 264 265 virtual void OnGetElementAttributes(const RawAddress &rawAddr, const std::vector<uint32_t> &attributes, 266 const std::vector<std::string> &values, int result) = 0; 267 268 /** 269 * @brief Responds the data of the <b>GetPlayStatus</b>. 270 * 271 * @param[in] rawAddr The address of the bluetooth device. 272 * @param[in] songLength The total length of the playing song in milliseconds. 273 * @param[in] songPosition The current position of the playing in milliseconds elapsed. 274 * @param[in] playStatus The current status of playing. Refer to <b>AvrcPlayStatus</b>. 275 * @param[in] result The result of the execution.<br> 276 * @a RET_NO_ERROR : Execute success.<br> 277 * @a RET_NO_SUPPORT : Not support.<br> 278 * @a RET_BAD_STATUS : Execute failure. 279 * 280 * @since 6 281 */ 282 virtual void OnGetPlayStatus( 283 const RawAddress &rawAddr, uint32_t songLength, uint32_t songPosition, uint8_t playStatus, int result) = 0; 284 285 /** 286 * @brief Responds the data of the <b>AddToNowPlaying</b>. 287 * 288 * @param[in] rawAddr The address of the bluetooth device. 289 * @param[in] result The result of the execution.<br> 290 * @a RET_NO_ERROR : Execute success.<br> 291 * @a RET_NO_SUPPORT : Not support.<br> 292 * @a RET_BAD_STATUS : Execute failure. 293 * @param[in] detail The detail result of the execution. Refer to <b>AvrcEsCode</b>.<br> 294 * @a AVRC_ES_CODE_NO_ERROR<br> 295 * @a AVRC_ES_CODE_INTERNAL_ERROR<br> 296 * @a AVRC_ES_CODE_UID_CHANGED<br> 297 * @a AVRC_ES_CODE_DOES_NOT_EXIST<br> 298 * @a AVRC_ES_CODE_INVALID_SCOPE<br> 299 * @a AVRC_ES_CODE_FOLDER_ITEM_IS_NOT_PLAYABLE<br> 300 * @a AVRC_ES_CODE_MEDIA_IN_USE<br> 301 * @a AVRC_ES_CODE_NOW_PLAYING_LIST_FULL<br> 302 * @a AVRC_ES_CODE_NO_AVAILABLE_PLAYERS 303 * 304 * @since 6 305 */ 306 virtual void OnAddToNowPlaying(const RawAddress &rawAddr, int result, int detail) = 0; 307 308 /** 309 * @brief Responds the data of the <b>PlayItem</b>. 310 * 311 * @param[in] rawAddr The address of the bluetooth device. 312 * @param[in] result The result of the execution.<br> 313 * @a RET_NO_ERROR : Execute success.<br> 314 * @a RET_NO_SUPPORT : Not support.<br> 315 * @a RET_BAD_STATUS : Execute failure. 316 * @param[in] detail The detail result of the execution. Refer to <b>AvrcEsCode</b>.<br> 317 * @a AVRC_ES_CODE_NO_ERROR<br> 318 * @a AVRC_ES_CODE_INTERNAL_ERROR<br> 319 * @a AVRC_ES_CODE_UID_CHANGED<br> 320 * @a AVRC_ES_CODE_DOES_NOT_EXIST<br> 321 * @a AVRC_ES_CODE_INVALID_SCOPE<br> 322 * @a AVRC_ES_CODE_FOLDER_ITEM_IS_NOT_PLAYABLE<br> 323 * @a AVRC_ES_CODE_MEDIA_IN_USE<br> 324 * @a AVRC_ES_CODE_NOW_PLAYING_LIST_FULL<br> 325 * @a AVRC_ES_CODE_NO_AVAILABLE_PLAYERS 326 * 327 * @since 6 328 */ 329 virtual void OnPlayItem(const RawAddress &rawAddr, int result, int detail) = 0; 330 331 /** 332 * @brief Responds the data of the <b>ChangePath</b>. 333 * 334 * @param[in] rawAddr The address of the bluetooth device. 335 * @param[in] numOfItems The number of items in the directory. 336 * @param[in] result The result of the execution.<br> 337 * @a RET_NO_ERROR : Execute success.<br> 338 * @a RET_NO_SUPPORT : Not support.<br> 339 * @a RET_BAD_STATUS : Execute failure. 340 * @param[in] detail The detail result of the execution. Refer to <b>AvrcEsCode</b>.<br> 341 * @a AVRC_ES_CODE_NO_ERROR<br> 342 * @a AVRC_ES_CODE_INTERNAL_ERROR<br> 343 * @a AVRC_ES_CODE_UID_CHANGED<br> 344 * @a AVRC_ES_CODE_INVALID_DIRECTION<br> 345 * @a AVRC_ES_CODE_NOT_A_DIRECTORY<br> 346 * @a AVRC_ES_CODE_DOES_NOT_EXIST<br> 347 * @a AVRC_ES_CODE_NO_AVAILABLE_PLAYERS 348 * 349 * @since 6 350 */ 351 virtual void OnChangePath(const RawAddress &rawAddr, uint32_t numOfItems, int result, int detail) = 0; 352 353 /** 354 * @brief Responds the data of the <b>GetFolderItems</b>. 355 * 356 * @param[in] rawAddr The address of the bluetooth device. 357 * @param[in] uidCounter The value of the uid counter. 358 * @param[in] items The list of media player. 359 * @param[in] result The result of the execution.<br> 360 * @a RET_NO_ERROR : Execute success.<br> 361 * @a RET_NO_SUPPORT : Not support.<br> 362 * @a RET_BAD_STATUS : Execute failure. 363 * @param[in] detail The detail result of the execution. Refer to <b>AvrcEsCode</b>.<br> 364 * @a AVRC_ES_CODE_NO_ERROR<br> 365 * @a AVRC_ES_CODE_INTERNAL_ERROR<br> 366 * @a AVRC_ES_CODE_UID_CHANGED<br> 367 * @a AVRC_ES_CODE_DOES_NOT_EXIST<br> 368 * @a AVRC_ES_CODE_INVALID_SCOPE<br> 369 * @a AVRC_ES_CODE_NO_AVAILABLE_PLAYERS 370 * 371 * @since 6 372 */ 373 virtual void OnGetMediaPlayers(const RawAddress &rawAddr, uint16_t uidCounter, 374 const std::vector<AvrcMpItem> &items, int result, int detail) = 0; 375 376 /** 377 * @brief Responds the data of the <b>GetFolderItems</b>. 378 * 379 * @param[in] rawAddr The address of the bluetooth device. 380 * @param[in] uidCounter The value of the uid counter. 381 * @param[in] items The list of media items. 382 * @param[in] result The result of the execution.<br> 383 * @a RET_NO_ERROR : Execute success.<br> 384 * @a RET_NO_SUPPORT : Not support.<br> 385 * @a RET_BAD_STATUS : Execute failure. 386 * @param[in] detail The detail result of the execution. Refer to <b>AvrcEsCode</b>.<br> 387 * @a AVRC_ES_CODE_NO_ERROR<br> 388 * @a AVRC_ES_CODE_INTERNAL_ERROR<br> 389 * @a AVRC_ES_CODE_UID_CHANGED<br> 390 * @a AVRC_ES_CODE_DOES_NOT_EXIST<br> 391 * @a AVRC_ES_CODE_INVALID_SCOPE<br> 392 * @a AVRC_ES_CODE_NO_AVAILABLE_PLAYERS 393 * 394 * @since 6 395 */ 396 virtual void OnGetFolderItems(const RawAddress &rawAddr, uint16_t uidCounter, 397 const std::vector<AvrcMeItem> &items, int result, int detail) = 0; 398 399 /** 400 * @brief Responds the data of the <b>GetItemAttributes</b>. 401 * 402 * @param[in] rawAddr The address of the bluetooth device. 403 * @param[in] attributes The list of media attributes. 404 * @param[in] values The list of the value of this attribute. 405 * @param[in] result The result of the execution.<br> 406 * @a RET_NO_ERROR : Execute success.<br> 407 * @a RET_NO_SUPPORT : Not support.<br> 408 * @a RET_BAD_STATUS : Execute failure. 409 * @param[in] detail The detail result of the execution. Refer to <b>AvrcEsCode</b>.<br> 410 * @a AVRC_ES_CODE_NO_ERROR<br> 411 * @a AVRC_ES_CODE_INTERNAL_ERROR<br> 412 * @a AVRC_ES_CODE_UID_CHANGED<br> 413 * @a AVRC_ES_CODE_DOES_NOT_EXIST<br> 414 * @a AVRC_ES_CODE_INVALID_SCOPE<br> 415 * @a AVRC_ES_CODE_NO_AVAILABLE_PLAYERS 416 * 417 * @since 6 418 */ 419 virtual void OnGetItemAttributes(const RawAddress &rawAddr, const std::vector<uint32_t> &attributes, 420 const std::vector<std::string> &values, int result, int detail) = 0; 421 422 /** 423 * @brief Responds the data of the <b>GetTotalNumberOfItems</b>. 424 * 425 * @param[in] rawAddr The address of the bluetooth device. 426 * @param[in] uidCounter The value of the uid counter. 427 * @param[in] numOfItems The number of items in the directory. 428 * @param[in] result The result of the execution.<br> 429 * @a RET_NO_ERROR : Execute success.<br> 430 * @a RET_NO_SUPPORT : Not support.<br> 431 * @a RET_BAD_STATUS : Execute failure. 432 * @param[in] detail The detail result of the execution. Refer to <b>AvrcEsCode</b>.<br> 433 * @a AVRC_ES_CODE_NO_ERROR<br> 434 * @a AVRC_ES_CODE_INTERNAL_ERROR<br> 435 * @a AVRC_ES_CODE_UID_CHANGED<br> 436 * @a AVRC_ES_CODE_NO_AVAILABLE_PLAYERS 437 * 438 * @since 6 439 */ 440 virtual void OnGetTotalNumberOfItems( 441 const RawAddress &rawAddr, uint16_t uidCounter, uint32_t numOfItems, int result, int detail) = 0; 442 443 /** 444 * @brief Responds the data of the <b>SetAbsoluteVolume</b>. 445 * 446 * @param[in] rawAddr The address of the bluetooth device. 447 * @param[in] volume The percentage of the absolute volume. Refer to <b>AvrcAbsoluteVolume</b>. 448 * @param[in] result The result of the execution.<br> 449 * @a RET_NO_ERROR : Execute success.<br> 450 * @a RET_NO_SUPPORT : Not support.<br> 451 * @a RET_BAD_STATUS : Execute failure. 452 * 453 * @since 6 454 */ 455 virtual void OnSetAbsoluteVolume(const RawAddress &rawAddr, uint8_t volume, int result) = 0; 456 457 /** 458 * @brief Responds the data of the notification <b>EVENT_PLAYBACK_STATUS_CHANGED</b>. 459 * 460 * @param[in] rawAddr The address of the bluetooth device. 461 * @param[in] playStatus The current status of playing. Refer to <b>AvrcPlayStatus</b>. 462 * 463 * @since 6 464 */ 465 virtual void OnPlaybackStatusChanged(const RawAddress &rawAddr, uint8_t playStatus, int result) = 0; 466 467 /** 468 * @brief Responds the data of the notification <b>EVENT_TRACK_CHANGED</b>. 469 * 470 * @param[in] rawAddr The address of the bluetooth device. 471 * @param[in] uid The unique ID of media item. 472 * 473 * @since 6 474 */ 475 virtual void OnTrackChanged(const RawAddress &rawAddr, uint64_t uid, int result) = 0; 476 477 /** 478 * @brief Responds the data of the notification <b>EVENT_TRACK_REACHED_END</b>. 479 * 480 * @param[in] rawAddr The address of the bluetooth device. 481 * 482 * @since 6 483 */ 484 virtual void OnTrackReachedEnd(const RawAddress &rawAddr, int result) = 0; 485 486 /** 487 * @brief Responds the data of the notification <b>EVENT_TRACK_REACHED_START</b>. 488 * 489 * @param[in] rawAddr The address of the bluetooth device. 490 * 491 * @since 6 492 */ 493 virtual void OnTrackReachedStart(const RawAddress &rawAddr, int result) = 0; 494 495 /** 496 * @brief Responds the data of the notification <b>EVENT_PLAYBACK_POS_CHANGED</b>. 497 * 498 * @param[in] rawAddr The address of the bluetooth device. 499 * @param[in] playbackPos Current playback position in millisecond. 500 * 501 * @since 6 502 */ 503 virtual void OnPlaybackPosChanged(const RawAddress &rawAddr, uint32_t playbackPos, int result) = 0; 504 505 /** 506 * @brief Responds the data of the notification <b>EVENT_PLAYER_APPLICATION_SETTING_CHANGED</b>. 507 * 508 * @param[in] rawAddr The address of the bluetooth device. 509 * @param[in] attribute The attribute of the player application setting. Refer to <b>AvrcPlayerAttribute</b>. 510 * @param[in] values The values associated witch the attribute. 511 * 512 * @since 6 513 */ 514 virtual void OnPlayerAppSettingChanged(const RawAddress &rawAddr, const std::vector<uint8_t> &attributes, 515 const std::vector<uint8_t> &values, int result) = 0; 516 517 /** 518 * @brief Responds the data of the notification <b>EVENT_NOW_PLAYING_CONTENT_CHANGED</b>. 519 * 520 * @param[in] rawAddr The address of the bluetooth device. 521 * 522 * @since 6 523 */ 524 virtual void OnNowPlayingContentChanged(const RawAddress &rawAddr, int result) = 0; 525 526 /** 527 * @brief Responds the data of the notification <b>EVENT_AVAILABLE_PLAYERS_CHANGED</b>. 528 * 529 * @param[in] rawAddr The address of the bluetooth device. 530 * 531 * @since 6 532 */ 533 virtual void OnAvailablePlayersChanged(const RawAddress &rawAddr, int result) = 0; 534 535 /** 536 * @brief Responds the data of the notification <b>EVENT_ADDRESSED_PLAYER_CHANGED</b>. 537 * 538 * @param[in] rawAddr The address of the bluetooth device. 539 * @param[in] playerId The unique media player id. 540 * @param[in] uidCounter The UID counter shall be incremented every time the TG makes an update. 541 * 542 * @since 6 543 */ 544 virtual void OnAddressedPlayerChanged( 545 const RawAddress &rawAddr, uint16_t playerId, uint16_t uidCounter, int result) = 0; 546 547 /** 548 * @brief Responds the data of the notification <b>EVENT_UIDS_CHANGED</b>. 549 * 550 * @param[in] rawAddr The address of the bluetooth device. 551 * @param[in] uidCounter The UID counter shall be incremented every time the TG makes an update. 552 * 553 * @since 6 554 */ 555 virtual void OnUidChanged(const RawAddress &rawAddr, uint16_t uidCounter, int result) = 0; 556 557 /** 558 * @brief Responds the data of the notification <b>EVENT_VOLUME_CHANGED</b>. 559 * 560 * @param[in] rawAddr The address of the bluetooth device. 561 * @param[in] volume The percentage of the absolute volume. Refer to <b>AvrcAbsoluteVolume</b>. 562 * 563 * @since 6 564 */ 565 virtual void OnVolumeChanged(const RawAddress &rawAddr, uint8_t volume, int result) = 0; 566 }; 567 568 /****************************************************************** 569 * REGISTER / UNREGISTER OBSERVER * 570 ******************************************************************/ 571 572 /** 573 * @brief Registers the observer into the instance of the class <b>AvrcpController</b>. 574 * 575 * @param[in] observer The observer which wants to register. 576 * @since 6 577 */ 578 virtual void RegisterObserver(IObserver *observer) = 0; 579 580 /** 581 * @brief Unregisters the observer from the instance of the class <b>AvrcpController</b>. 582 * 583 * @param[in] observer The observer which already registered. 584 * @since 6 585 */ 586 virtual void UnregisterObserver(void) = 0; 587 588 /****************************************************************** 589 * ENABLE / DISABLE * 590 ******************************************************************/ 591 592 /** 593 * @brief Checks whether the AVRCP CT service is enabled. 594 * 595 * @return The result of the method execution. 596 * @retval true The service is enabled. 597 * @retval false The service is disabled. 598 */ 599 virtual bool IsEnabled(void) = 0; 600 601 /****************************************************************** 602 * CONNECTION * 603 ******************************************************************/ 604 605 /** 606 * @brief Gets the devices of the specified states. 607 * 608 * @param[in] states The connection states. Refer to <b>BTConnectState</b>. 609 * @return The list of the instance of the <b>RawAddress</b> class. 610 * 611 * @since 6 612 */ 613 virtual std::vector<RawAddress> GetConnectedDevices(void) = 0; 614 615 /** 616 * @brief Gets the devices of the specified states. 617 * 618 * @param[in] states The connection states. Refer to <b>BTConnectState</b>. 619 * @return The list of the instance of the <b>RawAddress</b> class. 620 * 621 * @since 6 622 */ 623 virtual std::vector<RawAddress> GetDevicesByStates(const std::vector<int> &states) = 0; 624 625 /** 626 * @brief Gets the connection state of the specified bluetooth device. 627 * 628 * @param[in] rawAddr The address of the bluetooth device. 629 * @return The connection state. Refer to <b>BTConnectState</b>. 630 * 631 * @since 6 632 */ 633 virtual int GetDeviceState(const RawAddress &rawAddr) = 0; 634 635 /****************************************************************** 636 * BUTTON OPERATION * 637 ******************************************************************/ 638 639 /** 640 * @brief Presses the button. 641 * 642 * @details Switch to the thread of the AVRCP CT service in this method. 643 * @param[in] rawAddr The address of the bluetooth device. 644 * @param[in] button The value of the key operation. Refer to <b>AvrcKeyOperation</b> 645 * @return The result of the method execution. 646 * @retval RET_NO_ERROR Execute success. 647 * @retval RET_NO_SUPPORT Not support. 648 * @retval RET_BAD_STATUS Execute failure. 649 * 650 * @since 6 651 */ 652 virtual int PressButton(const RawAddress &rawAddr, uint8_t button) = 0; 653 654 /** 655 * @brief Releases the button. 656 * 657 * @details Switch to the thread of the AVRCP CT service in this method. 658 * @param[in] rawAddr The address of the bluetooth device. 659 * @param[in] button The value of the key operation. Refer to <b>AvrcKeyOperation</b> 660 * @return The result of the method execution. 661 * @retval RET_NO_ERROR Execute success. 662 * @retval RET_NO_SUPPORT Not support. 663 * @retval RET_BAD_STATUS Execute failure. 664 * 665 * @since 6 666 */ 667 virtual int ReleaseButton(const RawAddress &rawAddr, uint8_t button) = 0; 668 669 /****************************************************************** 670 * UNIT INFO / SUB UNIT INFO * 671 ******************************************************************/ 672 673 /** 674 * @brief Gets the unit information. 675 * 676 * @details Switch to the thread of the AVRCP CT service in this method. 677 * @param[in] rawAddr The address of the bluetooth device. 678 * @return The result of the method execution. 679 * @retval RET_NO_ERROR Execute success. 680 * @retval RET_NO_SUPPORT Not support. 681 * @retval RET_BAD_STATUS Execute failure. 682 * 683 * @since 6 684 */ 685 virtual int GetUnitInfo(const RawAddress &rawAddr) = 0; 686 687 /** 688 * @brief Gets the sub unit information. 689 * 690 * @details Switch to the thread of the AVRCP CT service in this method. 691 * @param[in] rawAddr The address of the bluetooth device. 692 * @return The result of the method execution. 693 * @retval RET_NO_ERROR Execute success. 694 * @retval RET_NO_SUPPORT Not support. 695 * @retval RET_BAD_STATUS Execute failure. 696 * 697 * @since 6 698 */ 699 virtual int GetSubUnitInfo(const RawAddress &rawAddr) = 0; 700 701 /****************************************************************** 702 * Media Player Selection * 703 ******************************************************************/ 704 705 /** 706 * @brief Informs to which media player wishes to control. 707 * 708 * @details Switch to the thread of the AVRCP CT service in this method. 709 * @param[in] rawAddr The address of the bluetooth device. 710 * @param[in] playerId The unique media player id. 711 * @return The result of the method execution. 712 * @retval RET_NO_ERROR Execute success. 713 * @retval RET_NO_SUPPORT Not Support. 714 * @retval RET_BAD_STATUS Execute failure. 715 * 716 * @since 6 717 */ 718 virtual int SetAddressedPlayer(const RawAddress &rawAddr, uint16_t playerId) = 0; 719 720 /** 721 * @brief Informs to which player browsing commands should be routed. 722 * 723 * @details Switch to the thread of the AVRCP CT service in this method. 724 * @param[in] rawAddr The address of the bluetooth device. 725 * @param[in] playerId The unique media player id. 726 * @return The result of the method execution. 727 * @retval RET_NO_ERROR Execute success. 728 * @retval RET_NO_SUPPORT Not Support. 729 * @retval RET_BAD_STATUS Execute failure. 730 * 731 * @since 6 732 */ 733 virtual int SetBrowsedPlayer(const RawAddress &rawAddr, uint16_t playerId) = 0; 734 735 /****************************************************************** 736 * Capabilities * 737 ******************************************************************/ 738 739 /** 740 * @brief Get the supported companies by remote device. 741 * 742 * @details This is sent by CT to get the capabilities of the peer device 743 * @param[in] rawAddr The address of the bluetooth device. 744 * @param[in] capabilityID Specific capability requested 745 * @return The result of the method execution. 746 * @retval RET_NO_ERROR Execute success. 747 * @retval RET_NO_SUPPORT Not Support. 748 * @retval RET_BAD_STATUS Execute failure. 749 * 750 * @since 6 751 */ 752 virtual int GetSupportedCompanies(const RawAddress &rawAddr) = 0; 753 754 /** 755 * @brief Get the supported events by remote device. 756 * 757 * @details This is sent by CT to get the capabilities of the peer device 758 * @param[in] rawAddr The address of the bluetooth device. 759 * @param[in] capabilityID Specific capability requested 760 * @return The result of the method execution. 761 * @retval RET_NO_ERROR Execute success. 762 * @retval RET_NO_SUPPORT Not Support. 763 * @retval RET_BAD_STATUS Execute failure. 764 * 765 * @since 6 766 */ 767 virtual int GetSupportedEvents(const RawAddress &rawAddr) = 0; 768 /****************************************************************** 769 * PLAYER APPLICATION SETTINGS * 770 ******************************************************************/ 771 772 /** 773 * @brief Gets the attribute of the player application. 774 * 775 * @details Switch to the thread of the AVRCP CT service in this method. 776 * @param[in] rawAddr The address of the bluetooth device. 777 * @return The result of the method execution. 778 * @retval RET_NO_ERROR Execute success. 779 * @retval RET_NO_SUPPORT Not Support. 780 * @retval RET_BAD_STATUS Execute failure. 781 * 782 * @since 6 783 */ 784 virtual int GetPlayerAppSettingAttributes(const RawAddress &rawAddr) = 0; 785 786 /** 787 * @brief Gets the values of the specified attribute of the player application. 788 * 789 * @details Switch to the thread of the AVRCP CT service in this method. 790 * @param[in] rawAddr The address of the bluetooth device. 791 * @param[in] attribute The attribute of the player application setting. Refer to <b>AvrcPlayerAttribute</b>. 792 * @return The result of the method execution. 793 * @retval RET_NO_ERROR Execute success. 794 * @retval RET_NO_SUPPORT Not Support. 795 * @retval RET_BAD_STATUS Execute failure. 796 * 797 * @since 6 798 */ 799 virtual int GetPlayerAppSettingValues(const RawAddress &rawAddr, uint8_t attribute) = 0; 800 801 /** 802 * @brief Gets the current set values on the target for the provided player application setting attributes list. 803 * 804 * @details Switch to the thread of the AVRCP CT service in this method. 805 * @param[in] rawAddr The address of the bluetooth device. 806 * @param[in] attributes The attribute of the player application settings. Refer to <b>AvrcPlayerAttribute</b>. 807 * @return The result of the method execution. 808 * @retval RET_NO_ERROR Execute success. 809 * @retval RET_NO_SUPPORT Not Support. 810 * @retval RET_BAD_STATUS Execute failure. 811 * 812 * @since 6 813 */ 814 virtual int GetPlayerAppSettingCurrentValue(const RawAddress &rawAddr, const std::vector<uint8_t> &attributes) = 0; 815 816 /** 817 * @brief Sets the player application setting list of player application setting values on the target device for the 818 * corresponding defined list of AvrcPlayerAttribute. 819 * 820 * @details Switch to the thread of the AVRCP CT service in this method. 821 * @param[in] rawAddr The address of the bluetooth device. 822 * @param[in] attributes The attribute of the player application settings. Refer to <b>AvrcPlayerAttribute</b>. 823 * @param[in] values The value of the player application setting attribute. 824 * @return The result of the method execution. 825 * @retval RET_NO_ERROR Execute success. 826 * @retval RET_NO_SUPPORT Not Support. 827 * @retval RET_BAD_STATUS Execute failure. 828 * 829 * @since 6 830 */ 831 virtual int SetPlayerAppSettingCurrentValue( 832 const RawAddress &rawAddr, const std::vector<uint8_t> &attributes, const std::vector<uint8_t> &values) = 0; 833 834 /** 835 * @brief provide supported player application setting attribute displayable text. 836 * 837 * @details Switch to the thread of the AVRCP CT service in this method. 838 * @param[in] rawAddr The address of the bluetooth device. 839 * @param[in] attributes The attribute of the player application settings. 840 * @return The result of the method execution. 841 * @retval RET_NO_ERROR Execute success. 842 * @retval RET_NO_SUPPORT Not Support. 843 * @retval RET_BAD_STATUS Execute failure. 844 * 845 * @since 6 846 */ 847 virtual int GetPlayerAppSettingAttributeText(const RawAddress &rawAddr, const std::vector<uint8_t> &attributes) = 0; 848 849 /** 850 * @brief request the target device to provide target supported player application setting value displayable text 851 * 852 * @details Switch to the thread of the AVRCP CT service in this method. 853 * @param[in] rawAddr The address of the bluetooth device. 854 * @param[in] attributeId Player application setting attribute ID. 855 * @param[in] values Player application setting value ID. 856 * @return The result of the method execution. 857 * @retval RET_NO_ERROR Execute success. 858 * @retval RET_NO_SUPPORT Not Support. 859 * @retval RET_BAD_STATUS Execute failure. 860 * 861 * @since 6 862 */ 863 virtual int GetPlayerAppSettingValueText( 864 const RawAddress &rawAddr, uint8_t attributeId, const std::vector<uint8_t> &values) = 0; 865 866 /****************************************************************** 867 * MEDIA INFORMATION * 868 ******************************************************************/ 869 870 /** 871 * @brief Requests the TG to provide the attributes of the element specified in the parameter. 872 * 873 * @details Switch to the thread of the AVRCP CT service in this function. 874 * @param[in] rawAddr The address of the bluetooth device. 875 * @param[in] identifier Unique identifier to identify an element on TG 876 * @param[in] attributes Specifies the attributeID for the attributes to be retrieved 877 * @c RET_NO_ERROR : The action is successful. 878 * @c RET_NO_SUPPORT : The action is not supported. 879 * @c RET_BAD_STATUS : The action is failed. 880 */ 881 virtual int GetElementAttributes( 882 const RawAddress &rawAddr, uint64_t identifier, const std::vector<uint32_t> &attributes) = 0; 883 884 /****************************************************************** 885 * PLAY * 886 ******************************************************************/ 887 888 /** 889 * @brief Gets the play status. 890 * 891 * @details Switch to the thread of the AVRCP CT service in this method. 892 * @param[in] rawAddr The address of the bluetooth device. 893 * @return The result of the method execution. 894 * @retval RET_NO_ERROR Execute success. 895 * @retval RET_NO_SUPPORT Not support. 896 * @retval RET_BAD_STATUS Execute failure. 897 * 898 * @since 6 899 */ 900 virtual int GetPlayStatus(const RawAddress &rawAddr) = 0; 901 902 /** 903 * @brief Starts playing an item indicated by the UID. 904 * 905 * @details Switch to the thread of the AVRCP CT service in this method. 906 * @param[in] rawAddr The address of the bluetooth device. 907 * @param[in] scope The scope in which media content navigation may take place. Refer to <b>AvrcMediaScope</b>. 908 * @param[in] uid The unique ID of media item. 909 * @param[in] uidCounter The UID counter shall be incremented every time the TG makes an update. 910 * @return The result of the method execution. 911 * @retval RET_NO_ERROR Execute success. 912 * @retval RET_NO_SUPPORT Not support. 913 * @retval RET_BAD_STATUS Execute failure. 914 * 915 * @since 6 916 */ 917 virtual int PlayItem(const RawAddress &rawAddr, uint8_t scope, uint64_t uid, uint16_t uidCounter) = 0; 918 919 /** 920 * @brief Adds an item indicated by the UID to the Now Playing queue. 921 * 922 * @details Switch to the thread of the AVRCP CT service in this method. 923 * @param[in] rawAddr The address of the bluetooth device. 924 * @param[in] scope The scope in which media content navigation may take place. Refer to <b>AvrcMediaScope</b>. 925 * @param[in] uid The UID of the media element item or folder item. 926 * @param[in] uidCounter The UID Counter. 927 * @return The result of the method execution. 928 * @retval RET_NO_ERROR Execute success. 929 * @retval RET_NO_SUPPORT Not support. 930 * @retval RET_BAD_STATUS Execute failure. 931 * 932 * @since 6 933 */ 934 virtual int AddToNowPlaying(const RawAddress &rawAddr, uint8_t scope, uint64_t uid, uint16_t uidCounter) = 0; 935 936 /****************************************************************** 937 * CONTINUING RESPONSE / ABORT CONTINUING RESPONSE * 938 ******************************************************************/ 939 940 /** 941 * @brief Requests continuing result. 942 * 943 * @details Switch to the thread of the AVRCP CT service in this method. 944 * @param[in] rawAddr The address of the bluetooth device. 945 * @param[in] pduId The PDU ID which wants to request. 946 * @return The result of the method execution. 947 * @retval RET_NO_ERROR Execute success. 948 * @retval RET_NO_SUPPORT Not support. 949 * @retval RET_BAD_STATUS Execute failure. 950 * 951 * @since 6 952 */ 953 virtual int RequestContinuingResponse(const RawAddress &rawAddr, uint8_t pduId) = 0; 954 955 /** 956 * @brief Aborts continuing result. 957 * 958 * @details Switch to the thread of the AVRCP CT service in this method. 959 * @param[in] rawAddr The address of the bluetooth device. 960 * @param[in] pduId The PDU ID which wants to abort. 961 * @return The result of the method execution. 962 * @retval RET_NO_ERROR Execute success. 963 * @retval RET_NO_SUPPORT Not support. 964 * @retval RET_BAD_STATUS Execute failure. 965 * 966 * @since 6 967 */ 968 virtual int AbortContinuingResponse(const RawAddress &rawAddr, uint8_t pduId) = 0; 969 970 /****************************************************************** 971 * OPERATE THE VIRTUAL FILE SYSTEM * 972 ******************************************************************/ 973 974 /** 975 * @brief Navigates one level up or down in the virtual file system. 976 * 977 * @details Switch to the thread of the AVRCP CT service in this method. 978 * @param[in] rawAddr The address of the bluetooth device. 979 * @param[in] uidCounter The value of the uid counter. 980 * @param[in] direction The flag of the navigation. Refer to <b>AvrcFolderDirection</b>. 981 * @param[in] folderUid The UID of the folder to navigate to. This may be retrieved via a GetFolderItems command. 982 * If the navigation command is Folder Up this field is reserved. 983 * @return The result of the method execution. 984 * @retval RET_NO_ERROR Execute success. 985 * @retval RET_NO_SUPPORT Not support. 986 * @retval RET_BAD_STATUS Execute failure. 987 * 988 * @since 6 989 */ 990 virtual int ChangePath(const RawAddress &rawAddr, uint16_t uidCounter, uint8_t direction, uint64_t folderUid) = 0; 991 992 /** 993 * @brief Retrieves a listing of the contents of a folder. 994 * 995 * @details Switch to the thread of the AVRCP CT service in this method. 996 * @param[in] rawAddr The address of the bluetooth device. 997 * @param[in] scope The scope in which media content navigation may take place. Refer to <b>AvrcMediaScope</b>. 998 * @param[in] startItem The offset within the listing of the item, which should be the first returned item. The 999 * first element in the listing is at offset 0. 1000 * @param[in] endItem The offset within the listing of the item which should be the final returned item. If this 1001 * is set to a value beyond what is available, the TG shall return items from the provided Start Item index to the 1002 * index of the final item. If the End Item index is smaller than the Start Item index, the TG shall return an 1003 * error. If CT requests too many items, TG can respond with a sub-set of the requested items. 1004 * @param[in] attributes The list of media attributes. 1005 * @return The result of the method execution. 1006 * @retval RET_NO_ERROR Execute success. 1007 * @retval RET_NO_SUPPORT Not support. 1008 * @retval RET_BAD_STATUS Execute failure. 1009 * 1010 * @since 6 1011 */ 1012 virtual int GetFolderItems(const RawAddress &rawAddr, uint8_t scope, uint32_t startItem, uint32_t endItem, 1013 const std::vector<uint32_t> &attributes) = 0; 1014 1015 /** 1016 * @brief Retrieves the metadata attributes for a particular media element item or folder item. 1017 * 1018 * @details Switch to the thread of the AVRCP CT service in this method. 1019 * @param[in] rawAddr The address of the bluetooth device. 1020 * @param[in] scope The scope in which media content navigation may take place. Refer to <b>AvrcMediaScope</b>. 1021 * @param[in] uid The UID of the media element item or folder item. 1022 * @param[in] uidCounter The UID Counter. 1023 * @param[in] attributes The list of media attributes. 1024 * @return The result of the method execution. 1025 * @retval RET_NO_ERROR Execute success. 1026 * @retval RET_NO_SUPPORT Not support. 1027 * @retval RET_BAD_STATUS Execute failure. 1028 * 1029 * @since 6 1030 */ 1031 virtual int GetItemAttributes(const RawAddress &rawAddr, uint8_t scope, uint64_t uid, uint16_t uidCounter, 1032 const std::vector<uint32_t> &attributes) = 0; 1033 1034 /** 1035 * @brief Gets the number of items in the selected folder at the selected scope. 1036 * 1037 * @details Switch to the thread of the AVRCP CT service in this method. 1038 * @param[in] rawAddr The address of the bluetooth device. 1039 * @param[in] scope The scope in which media content navigation may take place. Refer to <b>AvrcMediaScope</b>. 1040 * @return The result of the method execution. 1041 * @retval RET_NO_ERROR Execute success. 1042 * @retval RET_NO_SUPPORT Not support. 1043 * @retval RET_BAD_STATUS Execute failure. 1044 * 1045 * @since 6 1046 */ 1047 virtual int GetTotalNumberOfItems(const RawAddress &rawAddr, uint8_t scope) = 0; 1048 1049 /****************************************************************** 1050 * ABSOLUTE VOLUME * 1051 ******************************************************************/ 1052 1053 /** 1054 * @brief Sets an absolute volume to be used by the rendering device. 1055 * 1056 * @details Switch to the thread of the AVRCP CT service in this method. 1057 * @param[in] rawAddr The address of the bluetooth device. 1058 * @param[in] volume The percentage of the absolute volume. Refer to <b>AvrcAbsoluteVolume</b>. 1059 * @return The result of the method execution. 1060 * @retval RET_NO_ERROR Execute success. 1061 * @retval RET_NO_SUPPORT Not support. 1062 * @retval RET_BAD_STATUS Execute failure. 1063 * 1064 * @since 6 1065 */ 1066 virtual int SetAbsoluteVolume(const RawAddress &rawAddr, uint8_t volume) = 0; 1067 1068 /****************************************************************** 1069 * NOTIFICATION * 1070 ******************************************************************/ 1071 1072 /** 1073 * @brief Enables for receiving notifications asynchronously based on specific events occurring. 1074 * 1075 * @details Switch to the thread of the AVRCP CT service in this method. 1076 * @param[in] rawAddr The address of the bluetooth device. 1077 * @param[in] events The event for which the requires notification. Refer to <b>AvrcEventId</b>. 1078 * @param[in] interval The specifies the time interval (in seconds) at which the change in playback position will be 1079 * notified. 1080 * @return The result of the method execution. 1081 * @retval RET_NO_ERROR Execute success. 1082 * @retval RET_NO_SUPPORT Not support. 1083 * @retval RET_BAD_STATUS Execute failure. 1084 * 1085 * @since 6 1086 */ 1087 virtual int EnableNotification(const RawAddress &rawAddr, const std::vector<uint8_t> &events, uint8_t interval) = 0; 1088 1089 /** 1090 * @brief Disables for receiving notifications asynchronously based on specific events occurring. 1091 * 1092 * @details Switch to the thread of the AVRCP CT service in this method. 1093 * @param[in] rawAddr The address of the bluetooth device. 1094 * @param[in] events The event for which the requires notification. Refer to <b>AvrcEventId</b>. 1095 * @return The result of the method execution. 1096 * @retval RET_NO_ERROR Execute success. 1097 * @retval RET_NO_SUPPORT Not support. 1098 * @retval RET_BAD_STATUS Execute failure. 1099 * 1100 * @since 6 1101 */ 1102 virtual int DisableNotification(const RawAddress &rawAddr, const std::vector<uint8_t> &events) = 0; 1103 }; 1104 } // namespace bluetooth 1105 } // namespace OHOS 1106 1107 #endif // INTERFACE_PROFILE_AVRCP_CT_H 1108