1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2 //
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.
14 
15 #ifndef __BTC_UTIL_H__
16 #define __BTC_UTIL_H__
17 
18 #include <stdbool.h>
19 #include "stack/bt_types.h"
20 #include "common/bt_defs.h"
21 #include "esp_bt_defs.h"
22 #include "esp_hf_defs.h"
23 
24 /*******************************************************************************
25 **  Constants & Macros
26 ********************************************************************************/
27 #define CASE_RETURN_STR(const) case const: return #const;
28 
29 /*******************************************************************************
30 **  Type definitions for callback functions
31 ********************************************************************************/
32 typedef char bdstr_t[18];
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 /*******************************************************************************
38 **  Functions
39 ********************************************************************************/
40 #if(BTA_AV_INCLUDED == TRUE)
41 const char *dump_rc_event(UINT8 event);
42 const char *dump_rc_notification_event_id(UINT8 event_id);
43 const char *dump_rc_pdu(UINT8 pdu);
44 #endif
45 
46 #if(BTA_AG_INCLUDED == TRUE)
47 const char *dump_hf_conn_state(UINT16 event);
48 const char *dump_hf_event(UINT16 event);
49 const char *dump_hf_call_state(esp_hf_call_status_t call_state);
50 const char* dump_hf_call_setup_state(esp_hf_call_setup_status_t call_setup_state);
51 #endif
52 
53 #if(BTA_HD_INCLUDED == TRUE)
54 const char* dump_hd_event(uint16_t event);
55 #endif
56 
57 #if(BTA_HH_INCLUDED == TRUE)
58 const char* dump_hh_event(uint16_t event);
59 #endif
60 
61 UINT32 devclass2uint(DEV_CLASS dev_class);
62 void uint2devclass(UINT32 dev, DEV_CLASS dev_class);
63 void uuid128_be_to_esp_uuid(esp_bt_uuid_t *u, uint8_t* uuid128);
64 
65 void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str);
66 
67 esp_bt_status_t btc_hci_to_esp_status(uint8_t hci_status);
68 esp_bt_status_t btc_btm_status_to_esp_status (uint8_t btm_status);
69 esp_bt_status_t btc_bta_status_to_esp_status (uint8_t bta_status);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /*  __BTC_UTIL_H__ */
76