1 /****************************************************************************** 2 * 3 * Copyright (c) 2014 The Android Open Source Project 4 * Copyright 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 <stdbool.h> 25 #include <sys/time.h> 26 27 #include "stack/include/bt_dev_class.h" 28 29 /******************************************************************************* 30 * Constants & Macros 31 ******************************************************************************/ 32 33 #define CASE_RETURN_STR(const) \ 34 case const: \ 35 return #const; 36 37 /******************************************************************************* 38 * Type definitions for callback functions 39 ******************************************************************************/ 40 41 /******************************************************************************* 42 * Functions 43 ******************************************************************************/ 44 45 std::string dump_bt_status(bt_status_t status); 46 std::string dump_dm_search_event(uint16_t event); 47 std::string dump_dm_event(uint16_t event); 48 std::string dump_hf_event(uint16_t event); 49 std::string dump_hf_client_event(uint16_t event); 50 std::string dump_hd_event(uint16_t event); 51 std::string dump_property_type(bt_property_type_t type); 52 std::string dump_adapter_scan_mode(bt_scan_mode_t mode); 53 std::string dump_thread_evt(bt_cb_thread_evt evt); 54 std::string dump_av_conn_state(uint16_t event); 55 std::string dump_av_audio_state(uint16_t event); 56 std::string dump_rc_opcode(uint8_t opcode); 57 std::string dump_rc_event(uint8_t event); 58 std::string dump_rc_notification_event_id(uint8_t event_id); 59 std::string dump_rc_pdu(uint8_t pdu); 60 61 uint32_t devclass2uint(const DEV_CLASS dev_class); 62 DEV_CLASS uint2devclass(uint32_t dev); 63 64 int ascii_2_hex(const char* p_ascii, int len, uint8_t* p_hex); 65 66 #endif /* BTIF_UTIL_H */ 67