• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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. * Description: BT AUDIO module.
14  */
15 
16 /**
17  * @defgroup bluetooth_bt_audio AUDIO API
18  * @ingroup  bluetooth
19  * @{
20  */
21 
22 #ifndef BT_AUDIO_H
23 #define BT_AUDIO_H
24 #include <td_type.h>
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define BT_AVRCP_EVENT_STATUS_MAX_LEN 0x08
30 
31 /**
32  * @if Eng
33  * @brief  Struct of avrcp event param of TG.
34  * @else
35  * @brief  TG返回的GetElementAttributes响应参数,在接口 {@link AvrcpCtGetElementAttributeCallback} 中使用。
36  * @endif
37  */
38 typedef struct {
39     td_u8 event_id;       /*!< @if Eng  event id @else 事件id @endif */
40     td_u8 pad[3];         /*!< @if Eng  reserved  @else 预留 @endif */
41     td_u8 event_status[BT_AVRCP_EVENT_STATUS_MAX_LEN];  /*!< @if Eng  event status @else 事件的状态信息 @endif */
42 } bt_avrcp_tg_evt_status_param;
43 
44 /**
45  * @if Eng
46  * @brief  Callback invoked in response to avrcp pass through.
47  * @par Description:
48  *          Callback invoked in response to avrcp pass through.
49  * @attention  1. This function is called in bts context,should not be blocked or do long time waiting.
50  * @param  [in]  key_operation type  #td_u32, key operation.
51  * @param  [in]  key_value type  #td_u32, key value.
52  * @retval #void  no return value.
53  * @par Dependency:
54  * @li bt_audio.h
55  * @see  bt_avrcp_tg_bts_cbk
56  * @else
57  * @brief  avrcp pass through响应回调函数。
58  * @par 说明:avrcp pass through响应回调函数。
59  * @attention 1. 该回调函数运行于bts线程,不能阻塞或长时间等待。
60  * @param  [in]  key_operation type  #td_u32, 按键操作。
61  * @param  [in]  key_value type  #td_u32, 按键值。
62  * @retval #void  无返回值。
63  * @par 依赖:
64  * @li bt_audio.h
65  * @see  bt_avrcp_tg_bts_cbk
66  * @endif
67  */
68 typedef td_void (*bt_avrcp_tg_pass_through_response_cbks)(td_u32 key_operation, td_u32 key_value);
69 
70 /**
71  * @if Eng
72  * @brief  Callback invoked in getting media status by bts.
73  * @par Description:
74  *         Callback invoked in getting media status by bts.
75  * @attention  1. This function is called in bts context,should not be blocked or do long time waiting.
76  * @attention  2. The memories of <devices> are requested and freed by the bts automatically.
77  * @param  [in]  event_status_param type  #bt_avrcp_tg_evt_status_param, media status of the avrcp tg.
78  * @retval #void  no return value.
79  * @par Dependency:
80  * @li bt_audio.h
81  * @see  bt_avrcp_tg_bts_cbk
82  * @else
83  * @brief  蓝牙服务查询媒体状态信息的回调函数。
84  * @par 说明:蓝牙服务查询媒体状态信息的回调函数。
85  * @attention  1. 该回调函数运行于bts线程,不能阻塞或长时间等待。
86  * @attention  2. <devices>由bts申请内存,也由bts释放,回调中不应释放。
87  * @param  [in]  event_status_param type  #bt_avrcp_tg_evt_status_param, avrcp tg端的媒体状态信息。
88  * @retval #void  无返回值
89  * @par 依赖:
90  * @li bt_audio.h
91  * @see  bt_avrcp_tg_bts_cbk
92  * @endif
93  */
94 typedef td_void (*bt_avrcp_tg_get_media_status_cbks)(bt_avrcp_tg_evt_status_param *event_status_param);
95 
96 /**
97  * @if Eng
98  * @brief  Struct of Avrcp TG media callback function.
99  * @else
100  * @brief  Avrcp TG媒体回调函数接口定义。
101  * @endif
102  */
103 typedef struct {
104     bt_avrcp_tg_pass_through_response_cbks notify_pass_through_status_cbk;
105     bt_avrcp_tg_get_media_status_cbks   get_media_status_cbk;
106 } bt_avrcp_tg_bts_cbk;
107 
108 /**
109  * @if Eng
110  * @brief  Use this funtion to register callback function of avrcp tg media.
111  * @par Description:
112  *           Use this funtion to register callback function of avrcp tg media.
113  * @attention  NULL
114  * @param  [in]  func type  #bt_avrcp_tg_bts_cbk *, a poniter of the callback funcs.
115  * @retval #td_void  no return value.
116  * @par Dependency:
117  * @li bt_audio.h
118  * @else
119  * @brief  媒体注册Avrcp TG回调函数。
120  * @par 说明:媒体注册Avrcp TG回调函数。
121  * @attention  NULL
122  * @param  [in]  func type  #bt_avrcp_tg_bts_cbk *, 指向回调函数接口定义的指针, 参考 {@link bt_avrcp_tg_bts_cbk}。
123  * @retval #td_void  无返回值。
124  * @par 依赖:
125  * @li bt_audio.h
126  * @endif
127  */
128 td_void bt_avrcp_tg_register_audio_cbk(bt_avrcp_tg_bts_cbk *func);
129 
130 /**
131  * @if Eng
132  * @brief  Use this funtion to deregister callback function of avrcp tg media.
133  * @par Description:
134  *           Use this funtion to deregister callback function of avrcp tg media.
135  * @attention  NULL
136  * @param  [in]  #td_void
137  * @retval #td_void  no return value.
138  * @par Dependency:
139  * @li bt_audio.h
140  * @else
141  * @brief  媒体去注册Avrcp TG回调函数。
142  * @par 说明:媒体去注册Avrcp TG回调函数。
143  * @attention  NULL
144  * @param  [in]  #td_void
145  * @retval #td_void  无返回值。
146  * @par 依赖:
147  * @li bt_audio.h
148  * @endif
149  */
150 td_void bt_avrcp_tg_degister_audio_cbk(td_void);
151 
152 /**
153  * @}
154  */
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 #endif /* __BT_A2DP_SERVICE_H__ */
160