Microchip® Advanced Software Framework

btstack_util.c File Reference
#include "btstack_config.h"
#include "btstack_debug.h"
#include "btstack_util.h"
#include <stdio.h>
#include <string.h>

Macros

#define __BTSTACK_FILE__   "btstack_util.c"
 
#define CRC8_INIT   0xFF
 
#define CRC8_OK   0xCF
 

Functions

int bd_addr_cmp (const bd_addr_t a, const bd_addr_t b)
 Compare two Bluetooth addresses. More...
 
void bd_addr_copy (bd_addr_t dest, const bd_addr_t src)
 Copy Bluetooth address. More...
 
char * bd_addr_to_str (const bd_addr_t addr)
 Create human readable represenationt of Bluetooth address. More...
 
uint32_t big_endian_read_16 (const uint8_t *buffer, int pos)
 Read 16/24/32 bit big endian value from buffer. More...
 
uint32_t big_endian_read_24 (const uint8_t *buffer, int pos)
 
uint32_t big_endian_read_32 (const uint8_t *buffer, int pos)
 
void big_endian_store_16 (uint8_t *buffer, uint16_t pos, uint16_t value)
 Write 16/32 bit big endian value into buffer. More...
 
void big_endian_store_24 (uint8_t *buffer, uint16_t pos, uint32_t value)
 
void big_endian_store_32 (uint8_t *buffer, uint16_t pos, uint32_t value)
 
uint32_t btstack_atoi (const char *str)
 Parse unsigned number. More...
 
uint8_t btstack_crc8_calc (uint8_t *data, uint16_t len)
 
uint8_t btstack_crc8_check (uint8_t *data, uint16_t len, uint8_t check_sum)
 CRC8 functions using ETSI TS 101 369 V6.3.0. More...
 
uint32_t btstack_max (uint32_t a, uint32_t b)
 Maximum function for uint32_t. More...
 
uint32_t btstack_min (uint32_t a, uint32_t b)
 Minimum function for uint32_t. More...
 
static char char_for_high_nibble (int value)
 
static char char_for_low_nibble (int value)
 
char char_for_nibble (int nibble)
 ASCII character for 4-bit nibble. More...
 
int count_set_bits_uint32 (uint32_t x)
 Return number of set bits in a uint32 number. More...
 
static uint8_t crc8 (uint8_t *data, uint16_t len)
 
uint16_t little_endian_read_16 (const uint8_t *buffer, int pos)
 Read 16/24/32 bit little endian value from buffer. More...
 
uint32_t little_endian_read_24 (const uint8_t *buffer, int pos)
 
uint32_t little_endian_read_32 (const uint8_t *buffer, int pos)
 
void little_endian_store_16 (uint8_t *buffer, uint16_t pos, uint16_t value)
 Write 16/32 bit little endian value into buffer. More...
 
void little_endian_store_32 (uint8_t *buffer, uint16_t pos, uint32_t value)
 
void log_debug_hexdump (const void *data, int size)
 Hexdump via log_debug *. More...
 
void log_info_hexdump (const void *data, int size)
 Hexdump via log_info. More...
 
void log_info_key (const char *name, sm_key_t key)
 Log Security Manager key via log_info. More...
 
int nibble_for_char (char c)
 4-bit nibble from ASCII character More...
 
void printf_hexdump (const void *data, int size)
 Use printf to write hexdump as single line of data. More...
 
void reverse_128 (const uint8_t *src, uint8_t *dst)
 
void reverse_24 (const uint8_t *src, uint8_t *dst)
 Wrapper around reverse_bytes for common buffer sizes. More...
 
void reverse_256 (const uint8_t *src, uint8_t *dst)
 
void reverse_48 (const uint8_t *src, uint8_t *dst)
 
void reverse_56 (const uint8_t *src, uint8_t *dst)
 
void reverse_64 (const uint8_t *src, uint8_t *dst)
 
void reverse_bd_addr (const bd_addr_t src, bd_addr_t dest)
 
void reverse_bytes (const uint8_t *src, uint8_t *dst, int len)
 Copy from source to destination and reverse byte order. More...
 
static int scan_hex_byte (const char *byte_string)
 
int sscanf_bd_addr (const char *addr_string, bd_addr_t addr)
 Parse Bluetooth address. More...
 
int string_len_for_uint32 (uint32_t i)
 Return number of digits of a uint32 number. More...
 
char * uuid128_to_str (const uint8_t *uuid)
 Create human readable representation for UUID128. More...
 
void uuid_add_bluetooth_prefix (uint8_t *uuid, uint32_t shortUUID)
 Constructs UUID128 from 16 or 32 bit UUID using Bluetooth base UUID. More...
 
int uuid_has_bluetooth_prefix (const uint8_t *uuid128)
 Checks if UUID128 has Bluetooth base UUID prefix. More...
 

Variables

static char bd_addr_to_str_buffer [6 *3]
 
const uint8_t bluetooth_base_uuid []
 
static const uint8_t crc8table [256]
 
static char uuid128_to_str_buffer [32+4+1]
 

#define __BTSTACK_FILE__   "btstack_util.c"
#define CRC8_INIT   0xFF

Referenced by crc8().

#define CRC8_OK   0xCF

Referenced by btstack_crc8_check().

int bd_addr_cmp ( const bd_addr_t  a,
const bd_addr_t  b 
)

Compare two Bluetooth addresses.

Parameters
a
b
Returns
0 if equal

References BD_ADDR_LEN.

Referenced by get_item().

void bd_addr_copy ( bd_addr_t  dest,
const bd_addr_t  src 
)

Copy Bluetooth address.

Parameters
dest
src

References BD_ADDR_LEN.

Referenced by create_connection_for_bd_addr_and_type(), event_handler(), and sscanf_bd_addr().

char* bd_addr_to_str ( const bd_addr_t  addr)

Create human readable represenationt of Bluetooth address.

Note
uses fixed global buffer
Returns
pointer to Bluetooth address string

References bd_addr_to_str_buffer, char_for_high_nibble(), and char_for_low_nibble().

Referenced by create_connection_for_bd_addr_and_type(), event_handler(), hci_initializing_run(), hci_send_cmd_packet(), hci_shutdown_connection(), le_device_db_add(), le_device_db_dump(), sm_key_distribution_handle_all_received(), and sm_run().

uint32_t big_endian_read_16 ( const uint8_t *  buffer,
int  pos 
)

Read 16/24/32 bit big endian value from buffer.

Parameters
buffer
positionin buffer
Returns
value

Referenced by hci_transport_h5_process_frame(), sm_handle_encryption_result(), and sm_handle_random_result().

uint32_t big_endian_read_24 ( const uint8_t *  buffer,
int  pos 
)
uint32_t big_endian_read_32 ( const uint8_t *  buffer,
int  pos 
)
void big_endian_store_16 ( uint8_t *  buffer,
uint16_t  pos,
uint16_t  value 
)

Write 16/32 bit big endian value into buffer.

Parameters
buffer
positionin buffer
value

Referenced by hci_transport_slip_encode_chunk_and_send(), and sm_d1_d_prime().

void big_endian_store_24 ( uint8_t *  buffer,
uint16_t  pos,
uint32_t  value 
)
void big_endian_store_32 ( uint8_t *  buffer,
uint16_t  pos,
uint32_t  value 
)
uint32_t btstack_atoi ( const char *  str)

Parse unsigned number.

Parameters
strto parse
Returns
value
uint8_t btstack_crc8_calc ( uint8_t *  data,
uint16_t  len 
)

References crc8().

uint8_t btstack_crc8_check ( uint8_t *  data,
uint16_t  len,
uint8_t  check_sum 
)

CRC8 functions using ETSI TS 101 369 V6.3.0.

Only used by RFCOMM

References crc8(), and CRC8_OK.

uint32_t btstack_max ( uint32_t  a,
uint32_t  b 
)

Maximum function for uint32_t.

Parameters
a
b
Returns
value
uint32_t btstack_min ( uint32_t  a,
uint32_t  b 
)
static char char_for_high_nibble ( int  value)
inlinestatic
static char char_for_low_nibble ( int  value)
inlinestatic
char char_for_nibble ( int  nibble)

ASCII character for 4-bit nibble.

Returns
character

Referenced by char_for_high_nibble(), and char_for_low_nibble().

int count_set_bits_uint32 ( uint32_t  x)

Return number of set bits in a uint32 number.

Parameters
uint32_number
Returns
num_set_bits
static uint8_t crc8 ( uint8_t *  data,
uint16_t  len 
)
static

References CRC8_INIT.

Referenced by btstack_crc8_calc(), and btstack_crc8_check().

uint16_t little_endian_read_16 ( const uint8_t *  buffer,
int  position 
)

Read 16/24/32 bit little endian value from buffer.

Parameters
buffer
positionin buffer
Returns
value

Referenced by a2dp_subevent_command_accepted_get_a2dp_cid(), a2dp_subevent_command_rejected_get_a2dp_cid(), a2dp_subevent_incoming_connection_established_get_a2dp_cid(), a2dp_subevent_signaling_connection_released_get_a2dp_cid(), a2dp_subevent_signaling_media_codec_other_configuration_get_a2dp_cid(), a2dp_subevent_signaling_media_codec_other_configuration_get_media_codec_information_len(), a2dp_subevent_signaling_media_codec_other_configuration_get_media_codec_type(), a2dp_subevent_signaling_media_codec_sbc_configuration_get_a2dp_cid(), a2dp_subevent_signaling_media_codec_sbc_configuration_get_sampling_frequency(), a2dp_subevent_stream_established_get_a2dp_cid(), a2dp_subevent_stream_released_get_a2dp_cid(), a2dp_subevent_stream_started_get_a2dp_cid(), a2dp_subevent_stream_stopped_get_a2dp_cid(), a2dp_subevent_stream_suspended_get_a2dp_cid(), a2dp_subevent_streaming_can_send_media_packet_now_get_a2dp_cid(), ad_data_contains_uuid128(), ad_data_contains_uuid16(), ancs_chunk_parser_handle_byte(), att_dump_attributes(), att_event_handle_value_indication_complete_get_attribute_handle(), att_event_handle_value_indication_complete_get_conn_handle(), att_event_mtu_exchange_complete_get_handle(), att_event_mtu_exchange_complete_get_MTU(), att_event_packet_handler(), att_iterator_fetch_next(), att_iterator_match_uuid(), att_iterator_match_uuid16(), att_run_for_context(), att_uuid_for_handle(), att_write_callback(), avdtp_subevent_signaling_accept_get_avdtp_cid(), avdtp_subevent_signaling_connection_established_get_avdtp_cid(), avdtp_subevent_signaling_connection_released_get_avdtp_cid(), avdtp_subevent_signaling_general_reject_get_avdtp_cid(), avdtp_subevent_signaling_media_codec_other_capability_get_avdtp_cid(), avdtp_subevent_signaling_media_codec_other_capability_get_media_codec_information_len(), avdtp_subevent_signaling_media_codec_other_capability_get_media_codec_type(), avdtp_subevent_signaling_media_codec_other_configuration_get_avdtp_cid(), avdtp_subevent_signaling_media_codec_other_configuration_get_media_codec_information_len(), avdtp_subevent_signaling_media_codec_other_configuration_get_media_codec_type(), avdtp_subevent_signaling_media_codec_sbc_capability_get_avdtp_cid(), avdtp_subevent_signaling_media_codec_sbc_configuration_get_avdtp_cid(), avdtp_subevent_signaling_media_codec_sbc_configuration_get_sampling_frequency(), avdtp_subevent_signaling_reject_get_avdtp_cid(), avdtp_subevent_signaling_sep_found_get_avdtp_cid(), avdtp_subevent_streaming_can_send_media_packet_now_get_avdtp_cid(), avdtp_subevent_streaming_can_send_media_packet_now_get_sequence_number(), avdtp_subevent_streaming_connection_established_get_avdtp_cid(), avdtp_subevent_streaming_connection_released_get_avdtp_cid(), avrcp_subevent_company_ids_query_get_avrcp_cid(), avrcp_subevent_connection_established_get_avrcp_cid(), avrcp_subevent_connection_released_get_avrcp_cid(), avrcp_subevent_enable_notification_complete_get_avrcp_cid(), avrcp_subevent_event_ids_query_get_avrcp_cid(), avrcp_subevent_notification_available_players_changed_get_avrcp_cid(), avrcp_subevent_notification_now_playing_content_changed_get_avrcp_cid(), avrcp_subevent_notification_playback_status_changed_get_avrcp_cid(), avrcp_subevent_notification_track_changed_get_avrcp_cid(), avrcp_subevent_notification_volume_changed_get_avrcp_cid(), avrcp_subevent_now_playing_album_info_get_avrcp_cid(), avrcp_subevent_now_playing_artist_info_get_avrcp_cid(), avrcp_subevent_now_playing_genre_info_get_avrcp_cid(), avrcp_subevent_now_playing_info_done_get_avrcp_cid(), avrcp_subevent_now_playing_song_length_ms_info_get_avrcp_cid(), avrcp_subevent_now_playing_title_info_get_avrcp_cid(), avrcp_subevent_now_playing_total_tracks_info_get_avrcp_cid(), avrcp_subevent_now_playing_track_info_get_avrcp_cid(), avrcp_subevent_operation_complete_get_avrcp_cid(), avrcp_subevent_operation_get_avrcp_cid(), avrcp_subevent_operation_start_get_avrcp_cid(), avrcp_subevent_play_status_get_avrcp_cid(), avrcp_subevent_play_status_query_get_avrcp_cid(), avrcp_subevent_player_application_value_response_get_avrcp_cid(), avrcp_subevent_set_absolute_volume_response_get_avrcp_cid(), avrcp_subevent_shuffle_and_repeat_mode_get_avrcp_cid(), battery_service_write_callback(), bnep_event_can_send_now_get_bnep_cid(), bnep_event_can_send_now_get_destination_uuid(), bnep_event_can_send_now_get_source_uuid(), bnep_event_channel_closed_get_bnep_cid(), bnep_event_channel_closed_get_destination_uuid(), bnep_event_channel_closed_get_source_uuid(), bnep_event_channel_opened_get_bnep_cid(), bnep_event_channel_opened_get_destination_uuid(), bnep_event_channel_opened_get_mtu(), bnep_event_channel_opened_get_source_uuid(), bnep_event_channel_timeout_get_bnep_cid(), bnep_event_channel_timeout_get_destination_uuid(), bnep_event_channel_timeout_get_source_uuid(), bnep_event_service_registered_get_service_uuid(), characteristic_start_found(), event_handler(), gap_event_inquiry_result_get_clock_offset(), gap_event_security_level_get_handle(), gatt_client_att_packet_handler(), gatt_client_deserialize_characteristic(), gatt_client_deserialize_characteristic_descriptor(), gatt_client_deserialize_service(), gatt_client_hci_event_packet_handler(), get_last_result_handle_from_characteristics_list(), get_last_result_handle_from_included_services_list(), get_last_result_handle_from_service_list(), goep_subevent_can_send_now_get_goep_cid(), goep_subevent_connection_closed_get_goep_cid(), goep_subevent_connection_opened_get_con_handle(), goep_subevent_connection_opened_get_goep_cid(), handle_exchange_mtu_request(), handle_find_by_type_value_request(), handle_find_information_request(), handle_hci_event(), handle_prepare_write_request(), handle_read_blob_request(), handle_read_by_group_type_request(), handle_read_by_type_request(), handle_read_multiple_request2(), handle_read_request(), handle_write_command(), handle_write_request(), hci_event_authentication_complete_event_get_connection_handle(), hci_event_change_connection_link_key_complete_get_connection_handle(), hci_event_command_complete_get_command_opcode(), hci_event_command_status_get_command_opcode(), hci_event_connection_complete_get_connection_handle(), hci_event_connection_packet_type_changed_get_handle(), hci_event_connection_packet_type_changed_get_packet_types(), hci_event_disconnection_complete_get_connection_handle(), hci_event_encryption_change_get_connection_handle(), hci_event_encryption_key_refresh_complete_get_handle(), hci_event_extended_inquiry_response_get_clock_offset(), hci_event_inquiry_result_get_clock_offset(), hci_event_inquiry_result_with_rssi_get_clock_offset(), hci_event_master_link_key_complete_get_connection_handle(), hci_event_max_slots_changed_get_handle(), hci_event_mode_change_event_get_handle(), hci_event_mode_change_event_get_interval(), hci_event_read_clock_offset_complete_get_clock_offset(), hci_event_read_clock_offset_complete_get_handle(), hci_event_synchronous_connection_complete_get_handle(), hci_event_synchronous_connection_complete_get_rx_packet_length(), hci_event_synchronous_connection_complete_get_tx_packet_length(), hci_initializing_event_handler(), hci_initializing_run(), hci_send_acl_packet_fragments(), hci_send_cmd_packet(), hci_subevent_le_connection_complete_get_conn_interval(), hci_subevent_le_connection_complete_get_conn_latency(), hci_subevent_le_connection_complete_get_connection_handle(), hci_subevent_le_connection_complete_get_supervision_timeout(), hci_subevent_le_connection_update_complete_get_conn_interval(), hci_subevent_le_connection_update_complete_get_conn_latency(), hci_subevent_le_connection_update_complete_get_connection_handle(), hci_subevent_le_connection_update_complete_get_supervision_timeout(), hci_subevent_le_data_length_change_get_connection_handle(), hci_subevent_le_data_length_change_get_max_rx_octets(), hci_subevent_le_data_length_change_get_max_rx_time(), hci_subevent_le_data_length_change_get_max_tx_octets(), hci_subevent_le_data_length_change_get_max_tx_time(), hci_subevent_le_enhanced_connection_complete_get_conn_interval(), hci_subevent_le_enhanced_connection_complete_get_conn_latency(), hci_subevent_le_enhanced_connection_complete_get_connection_handle(), hci_subevent_le_enhanced_connection_complete_get_supervision_timeout(), hci_subevent_le_long_term_key_request_get_connection_handle(), hci_subevent_le_long_term_key_request_get_encryption_diversifier(), hci_subevent_le_read_remote_used_features_complete_get_connection_handle(), hci_subevent_le_read_remote_used_features_complete_get_encryption_diversifier(), hci_subevent_le_remote_connection_parameter_request_get_connection_handle(), hci_subevent_le_remote_connection_parameter_request_get_interval_max(), hci_subevent_le_remote_connection_parameter_request_get_interval_min(), hci_subevent_le_remote_connection_parameter_request_get_latency(), hci_subevent_le_remote_connection_parameter_request_get_timeout(), hci_transport_h4_block_read(), hfp_subevent_audio_connection_established_get_handle(), hfp_subevent_service_level_connection_established_get_con_handle(), hid_subevent_can_send_now_get_hid_cid(), hid_subevent_connection_closed_get_hid_cid(), hid_subevent_connection_opened_get_con_handle(), hid_subevent_connection_opened_get_hid_cid(), hids_subevent_boot_keyboard_input_report_enable_get_con_handle(), hids_subevent_boot_mouse_input_report_enable_get_con_handle(), hids_subevent_can_send_now_get_con_handle(), hids_subevent_input_report_enable_get_con_handle(), hids_subevent_protocol_mode_get_con_handle(), hsp_subevent_audio_connection_complete_get_handle(), is_value_valid(), l2cap_acl_classic_handler(), l2cap_acl_le_handler(), l2cap_event_can_send_now_get_local_cid(), l2cap_event_channel_closed_get_local_cid(), l2cap_event_channel_opened_get_flush_timeout(), l2cap_event_channel_opened_get_handle(), l2cap_event_channel_opened_get_local_cid(), l2cap_event_channel_opened_get_local_mtu(), l2cap_event_channel_opened_get_psm(), l2cap_event_channel_opened_get_remote_cid(), l2cap_event_channel_opened_get_remote_mtu(), l2cap_event_connection_parameter_update_request_get_handle(), l2cap_event_connection_parameter_update_request_get_interval_max(), l2cap_event_connection_parameter_update_request_get_interval_min(), l2cap_event_connection_parameter_update_request_get_latencey(), l2cap_event_connection_parameter_update_request_get_timeout_multiplier(), l2cap_event_connection_parameter_update_response_get_handle(), l2cap_event_connection_parameter_update_response_get_result(), l2cap_event_incoming_connection_get_handle(), l2cap_event_incoming_connection_get_local_cid(), l2cap_event_incoming_connection_get_psm(), l2cap_event_incoming_connection_get_remote_cid(), l2cap_event_le_can_send_now_get_local_cid(), l2cap_event_le_channel_closed_get_local_cid(), l2cap_event_le_channel_opened_get_handle(), l2cap_event_le_channel_opened_get_local_cid(), l2cap_event_le_channel_opened_get_local_mtu(), l2cap_event_le_channel_opened_get_psm(), l2cap_event_le_channel_opened_get_remote_cid(), l2cap_event_le_channel_opened_get_remote_mtu(), l2cap_event_le_incoming_connection_get_handle(), l2cap_event_le_incoming_connection_get_local_cid(), l2cap_event_le_incoming_connection_get_psm(), l2cap_event_le_incoming_connection_get_remote_cid(), l2cap_event_le_incoming_connection_get_remote_mtu(), l2cap_event_le_packet_sent_get_local_cid(), l2cap_hci_event_handler(), pbap_subevent_connection_closed_get_goep_cid(), pbap_subevent_connection_opened_get_con_handle(), pbap_subevent_connection_opened_get_pbap_cid(), pbap_subevent_operation_completed_get_goep_cid(), report_gatt_all_characteristic_descriptors(), report_gatt_characteristics(), report_gatt_services(), rfcomm_event_can_send_now_get_rfcomm_cid(), rfcomm_event_channel_closed_get_rfcomm_cid(), rfcomm_event_channel_opened_get_con_handle(), rfcomm_event_channel_opened_get_max_frame_size(), rfcomm_event_channel_opened_get_rfcomm_cid(), rfcomm_event_incoming_connection_get_rfcomm_cid(), rfcomm_event_remote_line_status_get_rfcomm_cid(), rfcomm_event_remote_modem_status_get_rfcomm_cid(), sdp_event_query_attribute_byte_get_attribute_id(), sdp_event_query_attribute_byte_get_attribute_length(), sdp_event_query_attribute_byte_get_data_offset(), sdp_event_query_attribute_byte_get_record_id(), sdp_event_query_attribute_value_get_attribute_id(), sdp_event_query_attribute_value_get_attribute_length(), sdp_event_query_attribute_value_get_record_id(), sdp_event_query_service_record_handle_get_record_index(), sdp_event_query_service_record_handle_get_total_count(), sm_event_packet_handler(), sm_pdu_handler(), and uuid16_from_uuid().

void little_endian_store_16 ( uint8_t *  buffer,
uint16_t  position,
uint16_t  value 
)

Write 16/32 bit little endian value into buffer.

Parameters
buffer
positionin buffer
value

Referenced by acl_handler(), att_db_util_add_attribute_uuid128(), att_db_util_add_attribute_uuid16(), att_db_util_add_characteristic_uuid128(), att_db_util_add_characteristic_uuid16(), att_db_util_add_client_characteristic_configuration(), att_db_util_add_service_uuid16(), att_emit_mtu_event(), att_exchange_mtu_request(), att_find_by_type_value_request(), att_find_information_request(), att_handle_value_indication_notify_client(), att_prepare_write_request(), att_read_blob_request(), att_read_by_type_or_group_request_for_uuid128(), att_read_by_type_or_group_request_for_uuid16(), att_read_callback_handle_little_endian_16(), att_read_multiple_request(), att_read_request(), att_write_request(), battery_service_read_callback(), device_information_service_server_set_ieee_regulatory_certification(), device_information_service_server_set_pnp_id(), device_information_service_server_set_system_id(), emit_gatt_all_characteristic_descriptors_result_event(), emit_gatt_characteristic_query_result_event(), emit_gatt_complete_event(), emit_gatt_included_service_query_result_event(), emit_gatt_service_query_result_event(), gatt_client_write_client_characteristic_configuration(), gatt_server_get_get_handle_range_for_service_with_uuid16(), handle_exchange_mtu_request(), handle_find_by_type_value_request2(), handle_find_information_request2(), handle_read_by_group_type_request2(), handle_read_by_type_request2(), hci_dump_packet(), hci_emit_disconnection_complete(), hci_send_acl_packet_fragments(), hids_device_can_send_now(), hids_device_emit_event_with_uint8(), l2cap_create_signaling_internal(), l2cap_emit_can_send_now(), l2cap_run(), l2cap_setup_header(), notify_client_simple(), notify_client_text(), prepare_handle_value(), send_gatt_by_uuid_request(), setup_characteristic_value_packet(), setup_error(), setup_long_characteristic_value_packet(), sm_pdu_handler(), sm_run(), and sm_setup_event_base().

void log_debug_hexdump ( const void *  data,
int  size 
)

Hexdump via log_debug *.

Parameters
data
size

References LOG_LEVEL_DEBUG, and UNUSED.

Referenced by hci_transport_h5_process_frame(), hci_transport_link_send_control(), and hci_transport_link_send_queued_packet().

void log_info_key ( const char *  name,
sm_key_t  key 
)
int nibble_for_char ( char  c)

4-bit nibble from ASCII character

Returns
value

Referenced by scan_hex_byte().

void printf_hexdump ( const void *  data,
int  size 
)

Use printf to write hexdump as single line of data.

Referenced by printf_packet().

void reverse_24 ( const uint8_t *  src,
uint8_t *  dest 
)

Wrapper around reverse_bytes for common buffer sizes.

Parameters
src
dest

References reverse_bytes().

Referenced by sm_handle_encryption_result().

void reverse_256 ( const uint8_t *  src,
uint8_t *  dst 
)

References reverse_bytes().

Referenced by sm_pdu_handler(), and sm_run().

void reverse_48 ( const uint8_t *  src,
uint8_t *  dst 
)

References reverse_bytes().

void reverse_56 ( const uint8_t *  src,
uint8_t *  dst 
)

References reverse_bytes().

Referenced by sm_c1_t1().

void reverse_64 ( const uint8_t *  src,
uint8_t *  dst 
)
void reverse_bd_addr ( const bd_addr_t  src,
bd_addr_t  dest 
)

References reverse_bytes().

Referenced by a2dp_subevent_incoming_connection_established_get_bd_addr(), a2dp_subevent_stream_established_get_bd_addr(), att_event_packet_handler(), atwilc3000_set_bd_addr_command(), avdtp_subevent_signaling_connection_established_get_bd_addr(), avdtp_subevent_streaming_connection_established_get_bd_addr(), avrcp_subevent_connection_established_get_bd_addr(), bnep_event_can_send_now_get_remote_address(), bnep_event_channel_closed_get_remote_address(), bnep_event_channel_opened_get_remote_address(), bnep_event_channel_timeout_get_remote_address(), event_handler(), gap_event_advertising_report_get_address(), gap_event_dedicated_bonding_completed_get_address(), gap_event_inquiry_result_get_bd_addr(), goep_subevent_connection_opened_get_bd_addr(), hci_emit_dedicated_bonding_result(), hci_event_connection_complete_get_bd_addr(), hci_event_connection_request_get_bd_addr(), hci_event_extended_inquiry_response_get_bd_addr(), hci_event_inquiry_result_get_bd_addr(), hci_event_inquiry_result_with_rssi_get_bd_addr(), hci_event_link_key_request_get_bd_addr(), hci_event_pin_code_request_get_bd_addr(), hci_event_remote_name_request_complete_get_bd_addr(), hci_event_remote_oob_data_request_get_bd_addr(), hci_event_role_change_get_bd_addr(), hci_event_sco_can_send_now_get_handle(), hci_event_simple_pairing_complete_get_bd_addr(), hci_event_synchronous_connection_complete_get_bd_addr(), hci_event_user_confirmation_request_get_bd_addr(), hci_event_user_passkey_request_get_bd_addr(), hci_send_cmd_packet(), hci_subevent_le_connection_complete_get_peer_address(), hci_subevent_le_enhanced_connection_complete_get_local_resolvable_private_addres(), hci_subevent_le_enhanced_connection_complete_get_peer_resolvable_private_addres(), hci_subevent_le_enhanced_connection_complete_get_perr_addresss(), hfp_subevent_audio_connection_established_get_bd_addr(), hfp_subevent_service_level_connection_established_get_bd_addr(), hid_subevent_connection_opened_get_bd_addr(), l2cap_event_channel_opened_get_address(), l2cap_event_incoming_connection_get_address(), l2cap_event_le_channel_opened_get_address(), l2cap_event_le_incoming_connection_get_address(), l2cap_hci_event_handler(), pbap_subevent_connection_opened_get_bd_addr(), rfcomm_event_channel_opened_get_bd_addr(), rfcomm_event_incoming_connection_get_bd_addr(), sm_event_packet_handler(), sm_notify_client_index(), sm_pdu_handler(), sm_run(), and sm_setup_event_base().

static int scan_hex_byte ( const char *  byte_string)
static

References nibble_for_char().

Referenced by sscanf_bd_addr().

int sscanf_bd_addr ( const char *  addr_string,
bd_addr_t  addr 
)

Parse Bluetooth address.

Parameters
address_string
bufferfor parsed address
Returns
1 if string was parsed successfully

References bd_addr_copy(), BD_ADDR_LEN, and scan_hex_byte().

int string_len_for_uint32 ( uint32_t  i)

Return number of digits of a uint32 number.

Parameters
uint32_number
Returns
num_digits
char* uuid128_to_str ( const uint8_t *  uuid)

Create human readable representation for UUID128.

Note
uses fixed global buffer
Returns
pointer to UUID128 string

References char_for_high_nibble(), char_for_low_nibble(), and uuid128_to_str_buffer.

Referenced by att_dump_attributes().

int uuid_has_bluetooth_prefix ( const uint8_t *  uuid128)

Checks if UUID128 has Bluetooth base UUID prefix.

Parameters
uui128to test
Returns
1 if it can be expressed as UUID32

Referenced by gatt_client_deserialize_characteristic(), and gatt_client_deserialize_service().

char bd_addr_to_str_buffer[6 *3]
static

Referenced by bd_addr_to_str().

const uint8_t bluetooth_base_uuid[]
Initial value:
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }
const uint8_t crc8table[256]
static
Initial value:
= {
0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B,
0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84, 0xF6, 0x67,
0x38, 0xA9, 0xDB, 0x4A, 0x3F, 0xAE, 0xDC, 0x4D, 0x36, 0xA7, 0xD5, 0x44, 0x31, 0xA0, 0xD2, 0x43,
0x24, 0xB5, 0xC7, 0x56, 0x23, 0xB2, 0xC0, 0x51, 0x2A, 0xBB, 0xC9, 0x58, 0x2D, 0xBC, 0xCE, 0x5F,
0x70, 0xE1, 0x93, 0x02, 0x77, 0xE6, 0x94, 0x05, 0x7E, 0xEF, 0x9D, 0x0C, 0x79, 0xE8, 0x9A, 0x0B,
0x6C, 0xFD, 0x8F, 0x1E, 0x6B, 0xFA, 0x88, 0x19, 0x62, 0xF3, 0x81, 0x10, 0x65, 0xF4, 0x86, 0x17,
0x48, 0xD9, 0xAB, 0x3A, 0x4F, 0xDE, 0xAC, 0x3D, 0x46, 0xD7, 0xA5, 0x34, 0x41, 0xD0, 0xA2, 0x33,
0x54, 0xC5, 0xB7, 0x26, 0x53, 0xC2, 0xB0, 0x21, 0x5A, 0xCB, 0xB9, 0x28, 0x5D, 0xCC, 0xBE, 0x2F,
0xE0, 0x71, 0x03, 0x92, 0xE7, 0x76, 0x04, 0x95, 0xEE, 0x7F, 0x0D, 0x9C, 0xE9, 0x78, 0x0A, 0x9B,
0xFC, 0x6D, 0x1F, 0x8E, 0xFB, 0x6A, 0x18, 0x89, 0xF2, 0x63, 0x11, 0x80, 0xF5, 0x64, 0x16, 0x87,
0xD8, 0x49, 0x3B, 0xAA, 0xDF, 0x4E, 0x3C, 0xAD, 0xD6, 0x47, 0x35, 0xA4, 0xD1, 0x40, 0x32, 0xA3,
0xC4, 0x55, 0x27, 0xB6, 0xC3, 0x52, 0x20, 0xB1, 0xCA, 0x5B, 0x29, 0xB8, 0xCD, 0x5C, 0x2E, 0xBF,
0x90, 0x01, 0x73, 0xE2, 0x97, 0x06, 0x74, 0xE5, 0x9E, 0x0F, 0x7D, 0xEC, 0x99, 0x08, 0x7A, 0xEB,
0x8C, 0x1D, 0x6F, 0xFE, 0x8B, 0x1A, 0x68, 0xF9, 0x82, 0x13, 0x61, 0xF0, 0x85, 0x14, 0x66, 0xF7,
0xA8, 0x39, 0x4B, 0xDA, 0xAF, 0x3E, 0x4C, 0xDD, 0xA6, 0x37, 0x45, 0xD4, 0xA1, 0x30, 0x42, 0xD3,
0xB4, 0x25, 0x57, 0xC6, 0xB3, 0x22, 0x50, 0xC1, 0xBA, 0x2B, 0x59, 0xC8, 0xBD, 0x2C, 0x5E, 0xCF
}
char uuid128_to_str_buffer[32+4+1]
static

Referenced by uuid128_to_str().