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#ifndef BTIF_UTIL_H
21#define BTIF_UTIL_H
22
23#include <hardware/bluetooth.h>
24#include <hardware/bt_hf.h>
25#include <stdbool.h>
26#include <sys/time.h>
27
28#include "bt_types.h"
29#include "bt_utils.h"
30
31/*******************************************************************************
32**  Constants & Macros
33********************************************************************************/
34
35#define CASE_RETURN_STR(const) case const: return #const;
36
37
38/*******************************************************************************
39**  Type definitions for callback functions
40********************************************************************************/
41
42typedef char bdstr_t[18];
43
44
45/*******************************************************************************
46**  Functions
47********************************************************************************/
48
49const char* dump_bt_status(bt_status_t status);
50const char* dump_dm_search_event(UINT16 event);
51const char* dump_dm_event(UINT16 event);
52const char* dump_hf_event(UINT16 event);
53const char* dump_hf_client_event(UINT16 event);
54const char* dump_hh_event(UINT16 event);
55const char* dump_hf_conn_state(UINT16 event);
56const char* dump_hf_call_state(bthf_call_state_t call_state);
57const char* dump_property_type(bt_property_type_t type);
58const char* dump_hf_audio_state(UINT16 event);
59const char* dump_adapter_scan_mode(bt_scan_mode_t mode);
60const char* dump_thread_evt(bt_cb_thread_evt evt);
61const char* dump_av_conn_state(UINT16 event);
62const char* dump_av_audio_state(UINT16 event);
63const char* dump_rc_event(UINT8 event);
64const char* dump_rc_notification_event_id(UINT8 event_id);
65const char* dump_rc_pdu(UINT8 pdu);
66
67UINT32 devclass2uint(DEV_CLASS dev_class);
68void uint2devclass(UINT32 dev, DEV_CLASS dev_class);
69void uuid16_to_uuid128(uint16_t uuid16, bt_uuid_t* uuid128);
70
71void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str);
72void string_to_uuid(char *str, bt_uuid_t *p_uuid);
73int ascii_2_hex (char *p_ascii, int len, UINT8 *p_hex);
74
75#endif /* BTIF_UTIL_H */
76