1 /******************************************************************************
2 *
3 * Copyright (c) 2014 The Android Open Source Project
4 * Copyright (C) 2009-2012 Broadcom Corporation
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 ******************************************************************************/
19
20 /************************************************************************************
21 *
22 * Filename: btif_util.c
23 *
24 * Description: Miscellaneous helper functions
25 *
26 *
27 ***********************************************************************************/
28
29 #include <hardware/bluetooth.h>
30 #include <hardware/bt_hf.h>
31 #include <hardware/bt_av.h>
32 #include <netinet/in.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #include <ctype.h>
37
38
39 #define LOG_TAG "bt_btif_util"
40 #include "btif_common.h"
41 #include "bta_api.h"
42 #include "gki.h"
43 #include "btu.h"
44 #include "bte.h"
45 #include "btif_dm.h"
46 #include "btif_util.h"
47 #include "bta_ag_api.h"
48 #include "bta_av_api.h"
49 #include "bta_hh_api.h"
50 #include "bta_hf_client_api.h"
51 #include "avrc_defs.h"
52
53 /************************************************************************************
54 ** Constants & Macros
55 ************************************************************************************/
56 #define ISDIGIT(a) ((a>='0') && (a<='9'))
57 #define ISXDIGIT(a) (((a>='0') && (a<='9'))||((a>='A') && (a<='F'))||((a>='a') && (a<='f')))
58
59 /************************************************************************************
60 ** Local type definitions
61 ************************************************************************************/
62
63 /************************************************************************************
64 ** Static variables
65 ************************************************************************************/
66
67 /************************************************************************************
68 ** Static functions
69 ************************************************************************************/
70
71 /************************************************************************************
72 ** Externs
73 ************************************************************************************/
74
75 /************************************************************************************
76 ** Functions
77 ************************************************************************************/
78
79 /*****************************************************************************
80 ** Logging helper functions
81 *****************************************************************************/
82
devclass2uint(DEV_CLASS dev_class)83 UINT32 devclass2uint(DEV_CLASS dev_class)
84 {
85 UINT32 cod = 0;
86
87 if(dev_class != NULL)
88 {
89 /* if COD is 0, irrespective of the device type set it to Unclassified device */
90 cod = (dev_class[2]) | (dev_class[1] << 8) | (dev_class[0] << 16);
91 }
92 return cod;
93 }
uint2devclass(UINT32 cod,DEV_CLASS dev_class)94 void uint2devclass(UINT32 cod, DEV_CLASS dev_class)
95 {
96 dev_class[2] = (UINT8)cod;
97 dev_class[1] = (UINT8)(cod >> 8);
98 dev_class[0] = (UINT8)(cod >> 16);
99 }
100
101 static const UINT8 sdp_base_uuid[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
102 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
103
uuid16_to_uuid128(uint16_t uuid16,bt_uuid_t * uuid128)104 void uuid16_to_uuid128(uint16_t uuid16, bt_uuid_t* uuid128)
105 {
106 uint16_t uuid16_bo;
107 memset(uuid128, 0, sizeof(bt_uuid_t));
108
109 memcpy(uuid128->uu, sdp_base_uuid, MAX_UUID_SIZE);
110 uuid16_bo = ntohs(uuid16);
111 memcpy(uuid128->uu + 2, &uuid16_bo, sizeof(uint16_t));
112 }
113
string_to_uuid(char * str,bt_uuid_t * p_uuid)114 void string_to_uuid(char *str, bt_uuid_t *p_uuid)
115 {
116 uint32_t uuid0, uuid4;
117 uint16_t uuid1, uuid2, uuid3, uuid5;
118
119 sscanf(str, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
120 &uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
121
122 uuid0 = htonl(uuid0);
123 uuid1 = htons(uuid1);
124 uuid2 = htons(uuid2);
125 uuid3 = htons(uuid3);
126 uuid4 = htonl(uuid4);
127 uuid5 = htons(uuid5);
128
129 memcpy(&(p_uuid->uu[0]), &uuid0, 4);
130 memcpy(&(p_uuid->uu[4]), &uuid1, 2);
131 memcpy(&(p_uuid->uu[6]), &uuid2, 2);
132 memcpy(&(p_uuid->uu[8]), &uuid3, 2);
133 memcpy(&(p_uuid->uu[10]), &uuid4, 4);
134 memcpy(&(p_uuid->uu[14]), &uuid5, 2);
135
136 return;
137
138 }
139
uuid_to_string_legacy(bt_uuid_t * p_uuid,char * str)140 void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str)
141 {
142 uint32_t uuid0, uuid4;
143 uint16_t uuid1, uuid2, uuid3, uuid5;
144
145 memcpy(&uuid0, &(p_uuid->uu[0]), 4);
146 memcpy(&uuid1, &(p_uuid->uu[4]), 2);
147 memcpy(&uuid2, &(p_uuid->uu[6]), 2);
148 memcpy(&uuid3, &(p_uuid->uu[8]), 2);
149 memcpy(&uuid4, &(p_uuid->uu[10]), 4);
150 memcpy(&uuid5, &(p_uuid->uu[14]), 2);
151
152 sprintf((char *)str, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x",
153 ntohl(uuid0), ntohs(uuid1),
154 ntohs(uuid2), ntohs(uuid3),
155 ntohl(uuid4), ntohs(uuid5));
156 return;
157 }
158
159 /*****************************************************************************
160 ** Function ascii_2_hex
161 **
162 ** Description This function converts an ASCII string into HEX
163 **
164 ** Returns the number of hex bytes filled.
165 */
ascii_2_hex(char * p_ascii,int len,UINT8 * p_hex)166 int ascii_2_hex (char *p_ascii, int len, UINT8 *p_hex)
167 {
168 int x;
169 UINT8 c;
170
171 for (x = 0; (x < len) && (*p_ascii); x++)
172 {
173 if (ISDIGIT (*p_ascii))
174 c = (*p_ascii - '0') << 4;
175 else
176 c = (toupper(*p_ascii) - 'A' + 10) << 4;
177
178 p_ascii++;
179 if (*p_ascii)
180 {
181 if (ISDIGIT (*p_ascii))
182 c |= (*p_ascii - '0');
183 else
184 c |= (toupper(*p_ascii) - 'A' + 10);
185
186 p_ascii++;
187 }
188 *p_hex++ = c;
189 }
190
191 return (x);
192 }
193
194
dump_dm_search_event(UINT16 event)195 const char* dump_dm_search_event(UINT16 event)
196 {
197 switch(event)
198 {
199 CASE_RETURN_STR(BTA_DM_INQ_RES_EVT)
200 CASE_RETURN_STR(BTA_DM_INQ_CMPL_EVT)
201 CASE_RETURN_STR(BTA_DM_DISC_RES_EVT)
202 CASE_RETURN_STR(BTA_DM_DISC_BLE_RES_EVT)
203 CASE_RETURN_STR(BTA_DM_DISC_CMPL_EVT)
204 CASE_RETURN_STR(BTA_DM_DI_DISC_CMPL_EVT)
205 CASE_RETURN_STR(BTA_DM_SEARCH_CANCEL_CMPL_EVT)
206
207 default:
208 return "UNKNOWN MSG ID";
209 }
210 }
211
212
dump_property_type(bt_property_type_t type)213 const char* dump_property_type(bt_property_type_t type)
214 {
215 switch(type)
216 {
217 CASE_RETURN_STR(BT_PROPERTY_BDNAME)
218 CASE_RETURN_STR(BT_PROPERTY_BDADDR)
219 CASE_RETURN_STR(BT_PROPERTY_UUIDS)
220 CASE_RETURN_STR(BT_PROPERTY_CLASS_OF_DEVICE)
221 CASE_RETURN_STR(BT_PROPERTY_TYPE_OF_DEVICE)
222 CASE_RETURN_STR(BT_PROPERTY_REMOTE_RSSI)
223 CASE_RETURN_STR(BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT)
224 CASE_RETURN_STR(BT_PROPERTY_ADAPTER_BONDED_DEVICES)
225 CASE_RETURN_STR(BT_PROPERTY_ADAPTER_SCAN_MODE)
226 CASE_RETURN_STR(BT_PROPERTY_REMOTE_FRIENDLY_NAME)
227
228 default:
229 return "UNKNOWN PROPERTY ID";
230 }
231 }
232
dump_dm_event(UINT16 event)233 const char* dump_dm_event(UINT16 event)
234 {
235 switch(event)
236 {
237 CASE_RETURN_STR(BTA_DM_ENABLE_EVT)
238 CASE_RETURN_STR(BTA_DM_DISABLE_EVT)
239 CASE_RETURN_STR(BTA_DM_PIN_REQ_EVT)
240 CASE_RETURN_STR(BTA_DM_AUTH_CMPL_EVT)
241 CASE_RETURN_STR(BTA_DM_AUTHORIZE_EVT)
242 CASE_RETURN_STR(BTA_DM_LINK_UP_EVT)
243 CASE_RETURN_STR(BTA_DM_LINK_DOWN_EVT)
244 CASE_RETURN_STR(BTA_DM_SIG_STRENGTH_EVT)
245 CASE_RETURN_STR(BTA_DM_BUSY_LEVEL_EVT)
246 CASE_RETURN_STR(BTA_DM_BOND_CANCEL_CMPL_EVT)
247 CASE_RETURN_STR(BTA_DM_SP_CFM_REQ_EVT)
248 CASE_RETURN_STR(BTA_DM_SP_KEY_NOTIF_EVT)
249 CASE_RETURN_STR(BTA_DM_SP_RMT_OOB_EVT)
250 CASE_RETURN_STR(BTA_DM_SP_KEYPRESS_EVT)
251 CASE_RETURN_STR(BTA_DM_ROLE_CHG_EVT)
252 CASE_RETURN_STR(BTA_DM_BLE_KEY_EVT)
253 CASE_RETURN_STR(BTA_DM_BLE_SEC_REQ_EVT)
254 CASE_RETURN_STR(BTA_DM_BLE_PASSKEY_NOTIF_EVT)
255 CASE_RETURN_STR(BTA_DM_BLE_PASSKEY_REQ_EVT)
256 CASE_RETURN_STR(BTA_DM_BLE_OOB_REQ_EVT)
257 CASE_RETURN_STR(BTA_DM_BLE_LOCAL_IR_EVT)
258 CASE_RETURN_STR(BTA_DM_BLE_LOCAL_ER_EVT)
259 CASE_RETURN_STR(BTA_DM_BLE_AUTH_CMPL_EVT)
260 CASE_RETURN_STR(BTA_DM_DEV_UNPAIRED_EVT)
261 CASE_RETURN_STR(BTA_DM_HW_ERROR_EVT)
262 CASE_RETURN_STR(BTA_DM_ENER_INFO_READ)
263
264 default:
265 return "UNKNOWN DM EVENT";
266 }
267 }
268
dump_hf_event(UINT16 event)269 const char* dump_hf_event(UINT16 event)
270 {
271 switch(event)
272 {
273 CASE_RETURN_STR(BTA_AG_ENABLE_EVT)
274 CASE_RETURN_STR(BTA_AG_REGISTER_EVT)
275 CASE_RETURN_STR(BTA_AG_OPEN_EVT)
276 CASE_RETURN_STR(BTA_AG_CLOSE_EVT)
277 CASE_RETURN_STR(BTA_AG_CONN_EVT)
278 CASE_RETURN_STR(BTA_AG_AUDIO_OPEN_EVT)
279 CASE_RETURN_STR(BTA_AG_AUDIO_CLOSE_EVT)
280 CASE_RETURN_STR(BTA_AG_SPK_EVT)
281 CASE_RETURN_STR(BTA_AG_MIC_EVT)
282 CASE_RETURN_STR(BTA_AG_AT_CKPD_EVT)
283 CASE_RETURN_STR(BTA_AG_DISABLE_EVT)
284 #if (BTM_WBS_INCLUDED == TRUE )
285 CASE_RETURN_STR(BTA_AG_WBS_EVT)
286 #endif
287 CASE_RETURN_STR(BTA_AG_AT_A_EVT)
288 CASE_RETURN_STR(BTA_AG_AT_D_EVT)
289 CASE_RETURN_STR(BTA_AG_AT_CHLD_EVT)
290 CASE_RETURN_STR(BTA_AG_AT_CHUP_EVT)
291 CASE_RETURN_STR(BTA_AG_AT_CIND_EVT)
292 CASE_RETURN_STR(BTA_AG_AT_VTS_EVT)
293 CASE_RETURN_STR(BTA_AG_AT_BINP_EVT)
294 CASE_RETURN_STR(BTA_AG_AT_BLDN_EVT)
295 CASE_RETURN_STR(BTA_AG_AT_BVRA_EVT)
296 CASE_RETURN_STR(BTA_AG_AT_NREC_EVT)
297 CASE_RETURN_STR(BTA_AG_AT_CNUM_EVT)
298 CASE_RETURN_STR(BTA_AG_AT_BTRH_EVT)
299 CASE_RETURN_STR(BTA_AG_AT_CLCC_EVT)
300 CASE_RETURN_STR(BTA_AG_AT_COPS_EVT)
301 CASE_RETURN_STR(BTA_AG_AT_UNAT_EVT)
302 CASE_RETURN_STR(BTA_AG_AT_CBC_EVT)
303 CASE_RETURN_STR(BTA_AG_AT_BAC_EVT)
304 CASE_RETURN_STR(BTA_AG_AT_BCS_EVT)
305
306 default:
307 return "UNKNOWN MSG ID";
308 }
309 }
310
dump_hf_client_event(UINT16 event)311 const char* dump_hf_client_event(UINT16 event)
312 {
313 switch(event)
314 {
315 CASE_RETURN_STR(BTA_HF_CLIENT_ENABLE_EVT)
316 CASE_RETURN_STR(BTA_HF_CLIENT_REGISTER_EVT)
317 CASE_RETURN_STR(BTA_HF_CLIENT_OPEN_EVT)
318 CASE_RETURN_STR(BTA_HF_CLIENT_CLOSE_EVT)
319 CASE_RETURN_STR(BTA_HF_CLIENT_CONN_EVT)
320 CASE_RETURN_STR(BTA_HF_CLIENT_AUDIO_OPEN_EVT)
321 CASE_RETURN_STR(BTA_HF_CLIENT_AUDIO_MSBC_OPEN_EVT)
322 CASE_RETURN_STR(BTA_HF_CLIENT_AUDIO_CLOSE_EVT)
323 CASE_RETURN_STR(BTA_HF_CLIENT_SPK_EVT)
324 CASE_RETURN_STR(BTA_HF_CLIENT_MIC_EVT)
325 CASE_RETURN_STR(BTA_HF_CLIENT_DISABLE_EVT)
326 CASE_RETURN_STR(BTA_HF_CLIENT_IND_EVT)
327 CASE_RETURN_STR(BTA_HF_CLIENT_VOICE_REC_EVT)
328 CASE_RETURN_STR(BTA_HF_CLIENT_OPERATOR_NAME_EVT)
329 CASE_RETURN_STR(BTA_HF_CLIENT_CLIP_EVT)
330 CASE_RETURN_STR(BTA_HF_CLIENT_CCWA_EVT)
331 CASE_RETURN_STR(BTA_HF_CLIENT_AT_RESULT_EVT)
332 CASE_RETURN_STR(BTA_HF_CLIENT_CLCC_EVT)
333 CASE_RETURN_STR(BTA_HF_CLIENT_CNUM_EVT)
334 CASE_RETURN_STR(BTA_HF_CLIENT_BTRH_EVT)
335 CASE_RETURN_STR(BTA_HF_CLIENT_BSIR_EVT)
336 CASE_RETURN_STR(BTA_HF_CLIENT_BINP_EVT)
337 CASE_RETURN_STR(BTA_HF_CLIENT_RING_INDICATION)
338 default:
339 return "UNKNOWN MSG ID";
340 }
341 }
342
dump_hh_event(UINT16 event)343 const char* dump_hh_event(UINT16 event)
344 {
345 switch(event)
346 {
347 CASE_RETURN_STR(BTA_HH_ENABLE_EVT)
348 CASE_RETURN_STR(BTA_HH_DISABLE_EVT)
349 CASE_RETURN_STR(BTA_HH_OPEN_EVT)
350 CASE_RETURN_STR(BTA_HH_CLOSE_EVT)
351 CASE_RETURN_STR(BTA_HH_GET_DSCP_EVT)
352 CASE_RETURN_STR(BTA_HH_GET_PROTO_EVT)
353 CASE_RETURN_STR(BTA_HH_GET_RPT_EVT)
354 CASE_RETURN_STR(BTA_HH_GET_IDLE_EVT)
355 CASE_RETURN_STR(BTA_HH_SET_PROTO_EVT)
356 CASE_RETURN_STR(BTA_HH_SET_RPT_EVT)
357 CASE_RETURN_STR(BTA_HH_SET_IDLE_EVT)
358 CASE_RETURN_STR(BTA_HH_VC_UNPLUG_EVT)
359 CASE_RETURN_STR(BTA_HH_ADD_DEV_EVT)
360 CASE_RETURN_STR(BTA_HH_RMV_DEV_EVT)
361 CASE_RETURN_STR(BTA_HH_API_ERR_EVT)
362 default:
363 return "UNKNOWN MSG ID";
364 }
365 }
366
367
dump_hf_conn_state(UINT16 event)368 const char* dump_hf_conn_state(UINT16 event)
369 {
370 switch(event)
371 {
372 CASE_RETURN_STR(BTHF_CONNECTION_STATE_DISCONNECTED)
373 CASE_RETURN_STR(BTHF_CONNECTION_STATE_CONNECTING)
374 CASE_RETURN_STR(BTHF_CONNECTION_STATE_CONNECTED)
375 CASE_RETURN_STR(BTHF_CONNECTION_STATE_SLC_CONNECTED)
376 CASE_RETURN_STR(BTHF_CONNECTION_STATE_DISCONNECTING)
377 default:
378 return "UNKNOWN MSG ID";
379 }
380 }
381
dump_hf_call_state(bthf_call_state_t call_state)382 const char* dump_hf_call_state(bthf_call_state_t call_state)
383 {
384 switch(call_state)
385 {
386 CASE_RETURN_STR(BTHF_CALL_STATE_IDLE)
387 CASE_RETURN_STR(BTHF_CALL_STATE_HELD)
388 CASE_RETURN_STR(BTHF_CALL_STATE_DIALING)
389 CASE_RETURN_STR(BTHF_CALL_STATE_ALERTING)
390 CASE_RETURN_STR(BTHF_CALL_STATE_INCOMING)
391 CASE_RETURN_STR(BTHF_CALL_STATE_WAITING)
392 CASE_RETURN_STR(BTHF_CALL_STATE_ACTIVE)
393 default:
394 return "UNKNOWN CALL STATE";
395 }
396 }
397
dump_thread_evt(bt_cb_thread_evt evt)398 const char* dump_thread_evt(bt_cb_thread_evt evt)
399 {
400 switch(evt)
401 {
402 CASE_RETURN_STR(ASSOCIATE_JVM)
403 CASE_RETURN_STR(DISASSOCIATE_JVM)
404
405 default:
406 return "unknown thread evt";
407 }
408 }
409
410
dump_hf_audio_state(UINT16 event)411 const char* dump_hf_audio_state(UINT16 event)
412 {
413 switch(event)
414 {
415 CASE_RETURN_STR(BTHF_AUDIO_STATE_DISCONNECTED)
416 CASE_RETURN_STR(BTHF_AUDIO_STATE_CONNECTING)
417 CASE_RETURN_STR(BTHF_AUDIO_STATE_CONNECTED)
418 CASE_RETURN_STR(BTHF_AUDIO_STATE_DISCONNECTING)
419 default:
420 return "UNKNOWN MSG ID";
421
422 }
423 }
424
dump_av_conn_state(UINT16 event)425 const char* dump_av_conn_state(UINT16 event)
426 {
427 switch(event)
428 {
429 CASE_RETURN_STR(BTAV_CONNECTION_STATE_DISCONNECTED)
430 CASE_RETURN_STR(BTAV_CONNECTION_STATE_CONNECTING)
431 CASE_RETURN_STR(BTAV_CONNECTION_STATE_CONNECTED)
432 CASE_RETURN_STR(BTAV_CONNECTION_STATE_DISCONNECTING)
433 default:
434 return "UNKNOWN MSG ID";
435 }
436 }
437
dump_av_audio_state(UINT16 event)438 const char* dump_av_audio_state(UINT16 event)
439 {
440 switch(event)
441 {
442 CASE_RETURN_STR(BTAV_AUDIO_STATE_REMOTE_SUSPEND)
443 CASE_RETURN_STR(BTAV_AUDIO_STATE_STOPPED)
444 CASE_RETURN_STR(BTAV_AUDIO_STATE_STARTED)
445 default:
446 return "UNKNOWN MSG ID";
447 }
448 }
449
dump_adapter_scan_mode(bt_scan_mode_t mode)450 const char* dump_adapter_scan_mode(bt_scan_mode_t mode)
451 {
452 switch(mode)
453 {
454 CASE_RETURN_STR(BT_SCAN_MODE_NONE)
455 CASE_RETURN_STR(BT_SCAN_MODE_CONNECTABLE)
456 CASE_RETURN_STR(BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE)
457
458 default:
459 return "unknown scan mode";
460 }
461 }
462
dump_bt_status(bt_status_t status)463 const char* dump_bt_status(bt_status_t status)
464 {
465 switch(status)
466 {
467 CASE_RETURN_STR(BT_STATUS_SUCCESS)
468 CASE_RETURN_STR(BT_STATUS_FAIL)
469 CASE_RETURN_STR(BT_STATUS_NOT_READY)
470 CASE_RETURN_STR(BT_STATUS_NOMEM)
471 CASE_RETURN_STR(BT_STATUS_BUSY)
472 CASE_RETURN_STR(BT_STATUS_UNSUPPORTED)
473
474 default:
475 return "unknown scan mode";
476 }
477 }
478
dump_rc_event(UINT8 event)479 const char *dump_rc_event(UINT8 event)
480 {
481 switch(event) {
482 CASE_RETURN_STR(BTA_AV_RC_OPEN_EVT)
483 CASE_RETURN_STR(BTA_AV_RC_CLOSE_EVT)
484 CASE_RETURN_STR(BTA_AV_REMOTE_CMD_EVT)
485 CASE_RETURN_STR(BTA_AV_REMOTE_RSP_EVT)
486 CASE_RETURN_STR(BTA_AV_VENDOR_CMD_EVT)
487 CASE_RETURN_STR(BTA_AV_VENDOR_RSP_EVT)
488 CASE_RETURN_STR(BTA_AV_META_MSG_EVT)
489 CASE_RETURN_STR(BTA_AV_RC_FEAT_EVT)
490 default:
491 return "UNKNOWN_EVENT";
492 }
493 }
494
dump_rc_notification_event_id(UINT8 event_id)495 const char * dump_rc_notification_event_id(UINT8 event_id)
496 {
497 switch(event_id)
498 {
499 CASE_RETURN_STR(AVRC_EVT_PLAY_STATUS_CHANGE)
500 CASE_RETURN_STR(AVRC_EVT_TRACK_CHANGE)
501 CASE_RETURN_STR(AVRC_EVT_TRACK_REACHED_END)
502 CASE_RETURN_STR(AVRC_EVT_TRACK_REACHED_START)
503 CASE_RETURN_STR(AVRC_EVT_PLAY_POS_CHANGED)
504 CASE_RETURN_STR(AVRC_EVT_BATTERY_STATUS_CHANGE)
505 CASE_RETURN_STR(AVRC_EVT_SYSTEM_STATUS_CHANGE)
506 CASE_RETURN_STR(AVRC_EVT_APP_SETTING_CHANGE)
507 CASE_RETURN_STR(AVRC_EVT_VOLUME_CHANGE)
508
509 default:
510 return "Unhandled Event ID";
511 }
512 }
513
dump_rc_pdu(UINT8 pdu)514 const char* dump_rc_pdu(UINT8 pdu)
515 {
516 switch(pdu)
517 {
518 CASE_RETURN_STR(AVRC_PDU_LIST_PLAYER_APP_ATTR)
519 CASE_RETURN_STR(AVRC_PDU_LIST_PLAYER_APP_VALUES)
520 CASE_RETURN_STR(AVRC_PDU_GET_CUR_PLAYER_APP_VALUE)
521 CASE_RETURN_STR(AVRC_PDU_SET_PLAYER_APP_VALUE)
522 CASE_RETURN_STR(AVRC_PDU_GET_PLAYER_APP_ATTR_TEXT)
523 CASE_RETURN_STR(AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT)
524 CASE_RETURN_STR(AVRC_PDU_INFORM_DISPLAY_CHARSET)
525 CASE_RETURN_STR(AVRC_PDU_INFORM_BATTERY_STAT_OF_CT)
526 CASE_RETURN_STR(AVRC_PDU_GET_ELEMENT_ATTR)
527 CASE_RETURN_STR(AVRC_PDU_GET_PLAY_STATUS)
528 CASE_RETURN_STR(AVRC_PDU_REGISTER_NOTIFICATION)
529 CASE_RETURN_STR(AVRC_PDU_REQUEST_CONTINUATION_RSP)
530 CASE_RETURN_STR(AVRC_PDU_ABORT_CONTINUATION_RSP)
531 CASE_RETURN_STR(AVRC_PDU_SET_ABSOLUTE_VOLUME)
532 default:
533 return "Unknown PDU";
534 }
535 }
536