wm_bt_av.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /**
  2. * @file wm_bt_av.h
  3. *
  4. * @brief Bluetooth API
  5. *
  6. * @author WinnerMicro
  7. *
  8. * Copyright (c) 2020 Winner Microelectronics Co., Ltd.
  9. */
  10. #ifndef __WM_BT_A2DP_H__
  11. #define __WM_BT_A2DP_H__
  12. #include "wm_bt.h"
  13. /**
  14. * @defgroup BT_APIs Bluetooth APIs
  15. * @brief Bluetooth related APIs
  16. */
  17. /**
  18. * @addtogroup BT_APIs
  19. * @{
  20. */
  21. /**
  22. * @defgroup BT_AV_APIs
  23. * @brief BT_AV APIs
  24. */
  25. /**
  26. * @addtogroup BT_AV_APIs
  27. * @{
  28. */
  29. /**sink realed api*/
  30. /**
  31. * @brief Initializes the AV interface for sink mode
  32. *
  33. * @param[in] callback pointer on callback function
  34. *
  35. * @retval @ref tls_bt_status_t
  36. *
  37. * @note None
  38. */
  39. tls_bt_status_t tls_bt_av_sink_init(tls_bt_a2dp_sink_callback_t callback);
  40. /**
  41. * @brief Shuts down the AV sink interface and does the cleanup
  42. *
  43. * @param None
  44. *
  45. * @retval @ref tls_bt_status_t
  46. *
  47. * @note None
  48. */
  49. tls_bt_status_t tls_bt_av_sink_deinit(void);
  50. /**
  51. * @brief Establishes the AV signalling channel with the source
  52. *
  53. * @param[in] *bd_addr remote device bluetooth device address
  54. *
  55. * @retval @ref tls_bt_status_t
  56. *
  57. * @note None
  58. */
  59. tls_bt_status_t tls_bt_av_sink_connect_src(tls_bt_addr_t *bd_addr);
  60. /**
  61. * @brief Tears down the AV signalling channel with the source side
  62. *
  63. * @param[in] *bd_addr remote device bluetooth device address
  64. *
  65. * @retval @ref tls_bt_status_t
  66. *
  67. * @note None
  68. */
  69. tls_bt_status_t tls_bt_av_sink_disconnect(tls_bt_addr_t *bd_addr);
  70. /**src realed api*/
  71. /**
  72. * @brief Initializes the AV interface for source mode
  73. *
  74. * @param[in] callback pointer on callback function
  75. *
  76. * @retval @ref tls_bt_status_t
  77. *
  78. * @note None
  79. */
  80. tls_bt_status_t tls_bt_av_src_init(tls_bt_a2dp_src_callback_t callback);
  81. /**
  82. * @brief Shuts down the AV source interface and does the cleanup
  83. *
  84. * @param None
  85. *
  86. * @retval @ref tls_bt_status_t
  87. *
  88. * @note None
  89. */
  90. tls_bt_status_t tls_bt_av_src_deinit(void);
  91. /**
  92. * @brief Establishes the AV signalling channel with the sink
  93. *
  94. * @param[in] *bd_addr remote device bluetooth device address
  95. *
  96. * @retval @ref tls_bt_status_t
  97. *
  98. * @note None
  99. */
  100. tls_bt_status_t tls_bt_av_src_connect_sink(tls_bt_addr_t *bd_addr);
  101. /**
  102. * @brief Tears down the AV signalling channel with the sink side
  103. *
  104. * @param[in] *bd_addr remote device bluetooth device address
  105. *
  106. * @retval @ref tls_bt_status_t
  107. *
  108. * @note None
  109. */
  110. tls_bt_status_t tls_bt_av_src_disconnect(tls_bt_addr_t *bd_addr);
  111. /**btrc related api supported by now*/
  112. /**
  113. * @brief Initializes the AVRC interface
  114. *
  115. * @param[in] callback pointer on callback function
  116. *
  117. * @retval @ref tls_bt_status_t
  118. *
  119. * @note None
  120. */
  121. tls_bt_status_t tls_btrc_init(tls_btrc_callback_t callback);
  122. /**
  123. * @brief Closes the AVRC interface
  124. *
  125. * @param None
  126. *
  127. * @retval @ref tls_bt_status_t
  128. *
  129. * @note None
  130. */
  131. tls_bt_status_t tls_btrc_deinit(void);
  132. /**
  133. * @brief Returns the current play status.
  134. *
  135. * @param[in] tls_btrc_play_status_t stopped, playing, paused...
  136. * @param[in] song_len seconds of the song
  137. * @param[in] song_pos played seconds of the song
  138. *
  139. * @retval @ref tls_bt_status_t
  140. *
  141. * @note This method is called in response to GetPlayStatus request.
  142. */
  143. tls_bt_status_t tls_btrc_get_play_status_rsp(tls_btrc_play_status_t play_status, uint32_t song_len,
  144. uint32_t song_pos);
  145. /**
  146. * @brief Returns the current songs' element attributes in text
  147. *
  148. * @param[in] num_attr counter of song`s element attributes
  149. * @param[in] p_attrs pointer of element attributes
  150. *
  151. * @retval @ref tls_bt_status_t
  152. *
  153. * @note None
  154. */
  155. tls_bt_status_t tls_btrc_get_element_attr_rsp(uint8_t num_attr, tls_btrc_element_attr_val_t *p_attrs);
  156. /**
  157. * @brief Response to the register notification request in text
  158. *
  159. * @param[in] event_id play_status, track or play_pos changed
  160. * @param[in] type notification type
  161. * @param[in] p_param pointer to details of notification structer
  162. *
  163. * @retval @ref tls_bt_status_t
  164. *
  165. * @note None
  166. */
  167. tls_bt_status_t tls_btrc_register_notification_rsp(tls_btrc_event_id_t event_id,
  168. tls_btrc_notification_type_t type, tls_btrc_register_notification_t *p_param);
  169. /**
  170. * @brief Send current volume setting to remote side
  171. *
  172. * @param[in] volue Should be in the range 0-127. bit7 is reseved and cannot be set
  173. *
  174. * @retval @ref tls_bt_status_t
  175. *
  176. * @note Support limited to SetAbsoluteVolume
  177. * This can be enhanced to support Relative Volume (AVRCP 1.0).
  178. * With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN
  179. * as opposed to absolute volume level
  180. */
  181. tls_bt_status_t tls_btrc_set_volume(uint8_t volume);
  182. /**btrc ctrl related api supported by now*/
  183. /**
  184. * @brief Initializes the AVRC ctrl interface
  185. *
  186. * @param[in] callback pointer on callback function
  187. *
  188. * @retval @ref tls_bt_status_t
  189. *
  190. * @note None
  191. */
  192. tls_bt_status_t tls_btrc_ctrl_init(tls_btrc_ctrl_callback_t callback);
  193. /**
  194. * @brief Closes the AVRC ctrl interface
  195. *
  196. * @param None
  197. *
  198. * @retval @ref tls_bt_status_t
  199. *
  200. * @note None
  201. */
  202. tls_bt_status_t tls_btrc_ctrl_deinit(void);
  203. /**
  204. * @brief Send Pass-Through command
  205. *
  206. * @param[in] bd_addr remote device bluetooth device address
  207. * @param[in] key_code code definition of the key
  208. * @param[in] key_state key stae
  209. *
  210. * @retval @ref tls_bt_status_t
  211. *
  212. * @note None
  213. */
  214. tls_bt_status_t tls_btrc_ctrl_send_passthrough_cmd(tls_bt_addr_t *bd_addr, uint8_t key_code, uint8_t key_state);
  215. /**
  216. * @brief Send group navigation command
  217. *
  218. * @param[in] bd_addr remote device bluetooth device address
  219. * @param[in] key_code code definition of the key
  220. * @param[in] key_state key stae
  221. *
  222. * @retval @ref tls_bt_status_t
  223. *
  224. * @note None
  225. */
  226. tls_bt_status_t tls_btrc_ctrl_send_groupnavigation_cmd(tls_bt_addr_t *bd_addr, uint8_t key_code, uint8_t key_state);
  227. /**
  228. * @brief Set current values of Player Attributes
  229. *
  230. * @param[in] bd_addr remote device bluetooth device address
  231. * @param[in] num_attrib couner of attributes
  232. * @param[in] attrib_ids atrribute of index indicator
  233. * @param[in] attrib_vals attribute of values
  234. *
  235. * @retval @ref tls_bt_status_t
  236. *
  237. * @note None
  238. */
  239. tls_bt_status_t tls_btrc_ctrl_change_player_app_setting(tls_bt_addr_t *bd_addr, uint8_t num_attrib, uint8_t *attrib_ids, uint8_t *attrib_vals);
  240. /**
  241. * @brief Rsp for SetAbsoluteVolume Command
  242. *
  243. * @param[in] bd_addr remote device bluetooth device address
  244. * @param[in] abs_vol the absolute volume
  245. * @param[in] label label indicator
  246. *
  247. * @retval @ref tls_bt_status_t
  248. *
  249. * @note None
  250. */
  251. tls_bt_status_t tls_btrc_ctrl_set_volume_rsp(tls_bt_addr_t *bd_addr, uint8_t abs_vol, uint8_t label);
  252. /**
  253. * @brief Rsp for Notification of Absolute Volume
  254. *
  255. * @param[in] bd_addr remote device bluetooth device address
  256. * @param[in] rsp_type interim or changed
  257. * @param[in] abs_vol the absolute volume value
  258. * @param[in] label label indicator
  259. *
  260. * @retval @ref tls_bt_status_t
  261. *
  262. * @note None
  263. */
  264. tls_bt_status_t tls_btrc_ctrl_volume_change_notification_rsp(tls_bt_addr_t *bd_addr, tls_btrc_notification_type_t rsp_type,uint8_t abs_vol, uint8_t label);
  265. #endif