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