fix all Wmissing-prototype warnings for libusb target

This commit is contained in:
Matthias Ringwald 2015-11-06 19:43:35 +01:00
parent 557161fc71
commit 7f02f4148e
33 changed files with 89 additions and 87 deletions

View File

@ -80,15 +80,15 @@ typedef struct att_iterator {
uint8_t const * value;
} att_iterator_t;
void att_iterator_init(att_iterator_t *it){
static void att_iterator_init(att_iterator_t *it){
it->att_ptr = att_db;
}
int att_iterator_has_next(att_iterator_t *it){
static int att_iterator_has_next(att_iterator_t *it){
return it->att_ptr != NULL;
}
void att_iterator_fetch_next(att_iterator_t *it){
static void att_iterator_fetch_next(att_iterator_t *it){
it->size = READ_BT_16(it->att_ptr, 0);
if (it->size == 0){
it->flags = 0;
@ -114,7 +114,7 @@ void att_iterator_fetch_next(att_iterator_t *it){
it->att_ptr += it->size;
}
int att_iterator_match_uuid16(att_iterator_t *it, uint16_t uuid){
static int att_iterator_match_uuid16(att_iterator_t *it, uint16_t uuid){
if (it->handle == 0) return 0;
if (it->flags & ATT_PROPERTY_UUID128){
if (!is_Bluetooth_Base_UUID(it->uuid)) return 0;
@ -123,7 +123,7 @@ int att_iterator_match_uuid16(att_iterator_t *it, uint16_t uuid){
return READ_BT_16(it->uuid, 0) == uuid;
}
int att_iterator_match_uuid(att_iterator_t *it, uint8_t *uuid, uint16_t uuid_len){
static int att_iterator_match_uuid(att_iterator_t *it, uint8_t *uuid, uint16_t uuid_len){
if (it->handle == 0) return 0;
// input: UUID16
if (uuid_len == 2) {
@ -139,7 +139,7 @@ int att_iterator_match_uuid(att_iterator_t *it, uint8_t *uuid, uint16_t uuid_len
}
int att_find_handle(att_iterator_t *it, uint16_t handle){
static int att_find_handle(att_iterator_t *it, uint16_t handle){
if (handle == 0) return 0;
att_iterator_init(it);
while (att_iterator_has_next(it)){
@ -650,7 +650,7 @@ static uint16_t handle_read_blob_request2(att_connection_t * att_connection, uin
return offset;
}
uint16_t handle_read_blob_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
static uint16_t handle_read_blob_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
uint8_t * response_buffer, uint16_t response_buffer_size){
return handle_read_blob_request2(att_connection, response_buffer, response_buffer_size, READ_BT_16(request_buffer, 1), READ_BT_16(request_buffer, 3));
}
@ -715,7 +715,7 @@ static uint16_t handle_read_multiple_request2(att_connection_t * att_connection,
response_buffer[0] = ATT_READ_MULTIPLE_RESPONSE;
return offset;
}
uint16_t handle_read_multiple_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
static uint16_t handle_read_multiple_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
uint8_t * response_buffer, uint16_t response_buffer_size){
int num_handles = (request_len - 1) >> 1;
return handle_read_multiple_request2(att_connection, response_buffer, response_buffer_size, num_handles, (uint16_t*) &request_buffer[1]);
@ -828,7 +828,7 @@ static uint16_t handle_read_by_group_type_request2(att_connection_t * att_connec
response_buffer[0] = ATT_READ_BY_GROUP_TYPE_RESPONSE;
return offset;
}
uint16_t handle_read_by_group_type_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
static uint16_t handle_read_by_group_type_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len,
uint8_t * response_buffer, uint16_t response_buffer_size){
int attribute_type_len;
if (request_len <= 7){

View File

@ -367,7 +367,7 @@ le_command_status_t gatt_client_cancel_write(uint16_t gatt_client_id, uint16_t c
/* API_END */
// only used for testing
void gatt_client_pts_suppress_mtu_exchange();
void gatt_client_pts_suppress_mtu_exchange(void);
#if defined __cplusplus
}

View File

@ -176,6 +176,8 @@ void le_device_db_local_counter_set(int index, uint32_t counter);
*/
void le_device_db_remove(int index);
void le_device_db_dump(void);
/* API_END */
#if defined __cplusplus

View File

@ -97,7 +97,7 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
}
}
void ancs_callback(ancs_event_t * event){
static void ancs_callback(ancs_event_t * event){
const char * attribute_name;
switch (event->type){
case ANCS_CLIENT_CONNECTED:

View File

@ -83,7 +83,7 @@ enum STATE {INIT, ACTIVE} ;
enum STATE state = INIT;
int getDeviceIndexForAddress( bd_addr_t addr){
static int getDeviceIndexForAddress( bd_addr_t addr){
int j;
for (j=0; j< deviceCount; j++){
if (BD_ADDR_CMP(addr, devices[j].address) == 0){
@ -93,12 +93,12 @@ int getDeviceIndexForAddress( bd_addr_t addr){
return -1;
}
void start_scan(void){
static void start_scan(void){
printf("Starting inquiry scan..\n");
hci_send_cmd(&hci_inquiry, HCI_INQUIRY_LAP, INQUIRY_INTERVAL, 0);
}
int has_more_remote_name_requests(void){
static int has_more_remote_name_requests(void){
int i;
for (i=0;i<deviceCount;i++) {
if (devices[i].state == REMOTE_NAME_REQUEST) return 1;
@ -106,7 +106,7 @@ int has_more_remote_name_requests(void){
return 0;
}
void do_next_remote_name_request(void){
static void do_next_remote_name_request(void){
int i;
for (i=0;i<deviceCount;i++) {
// remote name request

View File

@ -78,7 +78,7 @@ enum STATE {INIT, W4_INQUIRY_MODE_COMPLETE, ACTIVE} ;
enum STATE state = INIT;
int getDeviceIndexForAddress( bd_addr_t addr){
static int getDeviceIndexForAddress( bd_addr_t addr){
int j;
for (j=0; j< deviceCount; j++){
if (BD_ADDR_CMP(addr, devices[j].address) == 0){
@ -88,12 +88,12 @@ int getDeviceIndexForAddress( bd_addr_t addr){
return -1;
}
void start_scan(void){
static void start_scan(void){
printf("Starting inquiry scan..\n");
hci_send_cmd(&hci_inquiry, HCI_INQUIRY_LAP, INQUIRY_INTERVAL, 0);
}
int has_more_bonding_requests(void){
static int has_more_bonding_requests(void){
int i;
for (i=0;i<deviceCount;i++) {
if (devices[i].state == BONDING_REQUEST) return 1;
@ -101,7 +101,7 @@ int has_more_bonding_requests(void){
return 0;
}
void do_next_bonding_request(void){
static void do_next_bonding_request(void){
int i;
for (i=0;i<deviceCount;i++) {
// remote name request

View File

@ -127,7 +127,7 @@ static char * flags[] = {
*/
/* LISTING_START(GAPLEAdvDataParsing): Parsing advertising data */
void dump_advertisement_data(uint8_t * adv_data, uint8_t adv_size){
static void dump_advertisement_data(uint8_t * adv_data, uint8_t adv_size){
ad_context_t context;
for (ad_iterator_init(&context, adv_size, adv_data) ; ad_iterator_has_more(&context) ; ad_iterator_next(&context)){
uint8_t data_type = ad_iterator_get_data_type(&context);

View File

@ -161,7 +161,7 @@ static void extract_characteristic(le_characteristic_t * characteristic, uint8_t
}
}
void handle_gatt_client_event(int8_t packet_type, uint8_t *packet, uint16_t size){
static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
switch(state){
case TC_W4_SERVICE_RESULT:
@ -284,7 +284,7 @@ static void handle_hci_event(void * connection, uint8_t packet_type, uint16_t ch
}
}
void usage(const char *name){
static void usage(const char *name){
fprintf(stderr, "\nUsage: %s [-a|--address aa:bb:cc:dd:ee:ff]\n", name);
fprintf(stderr, "If no argument is provided, GATT browser will start scanning and connect to the first found device.\nTo connect to a specific device use argument [-a].\n\n");
}

View File

@ -300,7 +300,7 @@ void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint16_t siz
}
/* LISTING_END */
void usage(const char *name){
static void usage(const char *name){
fprintf(stderr, "\nUsage: %s [-a|--address aa:bb:cc:dd:ee:ff]\n", name);
fprintf(stderr, "If no argument is provided, GATT browser will start scanning and connect to the first found device.\nTo connect to a specific device use argument [-a].\n\n");
}

View File

@ -131,7 +131,7 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
}
/* LISTING_END */
char * get_string_from_data_element(uint8_t * element){
static char * get_string_from_data_element(uint8_t * element){
de_size_t de_size = de_get_size_type(element);
int pos = de_get_header_size(element);
int len = 0;

View File

@ -84,7 +84,7 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
}
}
void store_found_service(uint8_t * name, uint8_t port){
static void store_found_service(uint8_t * name, uint8_t port){
printf("APP: Service name: '%s', RFCOMM port %u\n", name, port);
channel_nr[service_index] = port;
service_name[service_index] = (char*) malloc(SDP_SERVICE_NAME_LEN+1);
@ -93,7 +93,7 @@ void store_found_service(uint8_t * name, uint8_t port){
service_index++;
}
void report_found_services(void){
static void report_found_services(void){
printf("\n *** Client query response done. ");
if (service_index == 0){
printf("No service found.\n\n");
@ -107,7 +107,7 @@ void report_found_services(void){
printf(" ***\n\n");
}
void handle_query_rfcomm_event(sdp_query_event_t * event, void * context){
static void handle_query_rfcomm_event(sdp_query_event_t * event, void * context){
sdp_query_rfcomm_service_event_t * ve;
sdp_query_complete_event_t * ce;

View File

@ -89,7 +89,7 @@ static uint32_t spp_service_buffer[150/4]; // implicit alignment to 4-byte mem
*/
/* LISTING_START(SPPSetup): SPP service setup */
void spp_service_setup(void){
static void spp_service_setup(void){
l2cap_init();
l2cap_register_packet_handler(packet_handler);

View File

@ -150,7 +150,7 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
}
}
void handle_found_service(char * name, uint8_t port){
static void handle_found_service(char * name, uint8_t port){
printf("APP: Service name: '%s', RFCOMM port %u\n", name, port);
if (strncmp(name, spp_service_name_prefix, strlen(spp_service_name_prefix)) != 0) return;
@ -160,7 +160,7 @@ void handle_found_service(char * name, uint8_t port){
state = W4_SDP_COMPLETE;
}
void handle_query_rfcomm_event(sdp_query_event_t * event, void * context){
static void handle_query_rfcomm_event(sdp_query_event_t * event, void * context){
sdp_query_rfcomm_service_event_t * ve;
switch (event->type){

View File

@ -9,7 +9,7 @@ COMMON += hci_transport_h2_libusb.c run_loop_posix.c remote_device_db_fs.c
include ${BTSTACK_ROOT}/example/embedded/Makefile.inc
# CC = gcc-fsf-4.9
CFLAGS += -g -Wall
CFLAGS += -g -Wall -Wmissing-prototypes -Werror
# CFLAGS += -Werror
CFLAGS += -I${POSIX_ROOT}/src

View File

@ -325,7 +325,7 @@ static int usb_process_ds(struct data_source *ds) {
return 0;
}
void usb_process_ts(timer_source_t *timer) {
static void usb_process_ts(timer_source_t *timer) {
// log_info("in usb_process_ts");
// timer is deactive, when timer callback gets called

View File

@ -51,13 +51,6 @@
static char keypath[sizeof(LINK_KEY_PATH) + sizeof(LINK_KEY_PREFIX) + 17 + sizeof(LINK_KEY_SUFIX) + 1];
static char char_for_nibble(int nibble){
if (nibble < 10) return '0' + nibble;
nibble -= 10;
if (nibble < 6) return 'A' + nibble;
return '?';
}
static char bd_addr_to_dash_str_buffer[6*3]; // 12-45-78-01-34-67\0
static char * bd_addr_to_dash_str(bd_addr_t addr){
char * p = bd_addr_to_dash_str_buffer;

View File

@ -88,7 +88,7 @@ void btstack_stdin_reset(void){
#endif
}
int getstring(char *line, int size)
static int getstring(char *line, int size)
{
int i = 0;
while (1){

View File

@ -355,7 +355,7 @@ uint8_t hci_number_free_acl_slots_for_handle(hci_con_handle_t con_handle){
}
}
int hci_number_free_sco_slots_for_handle(hci_con_handle_t handle){
static int hci_number_free_sco_slots_for_handle(hci_con_handle_t handle){
int num_sco_packets_sent = 0;
linked_item_t *it;
for (it = (linked_item_t *) hci_stack->connections; it ; it = it->next){
@ -432,7 +432,7 @@ void hci_release_packet_buffer(void){
}
// assumption: synchronous implementations don't provide can_send_packet_now as they don't keep the buffer after the call
int hci_transport_synchronous(void){
static int hci_transport_synchronous(void){
return hci_stack->hci_transport->can_send_packet_now == NULL;
}
@ -762,17 +762,17 @@ int hci_non_flushable_packet_boundary_flag_supported(void){
return (hci_stack->local_supported_features[6] & (1 << 6)) != 0;
}
int hci_ssp_supported(void){
static int hci_ssp_supported(void){
// No. 51, byte 6, bit 3
return (hci_stack->local_supported_features[6] & (1 << 3)) != 0;
}
int hci_classic_supported(void){
static int hci_classic_supported(void){
// No. 37, byte 4, bit 5, = No BR/EDR Support
return (hci_stack->local_supported_features[4] & (1 << 5)) == 0;
}
int hci_le_supported(void){
static int hci_le_supported(void){
#ifdef HAVE_BLE
// No. 37, byte 4, bit 6 = LE Supported (Controller)
return (hci_stack->local_supported_features[4] & (1 << 6)) != 0;
@ -792,7 +792,7 @@ void hci_le_advertisement_address(uint8_t * addr_type, bd_addr_t addr){
}
#ifdef HAVE_BLE
void le_handle_advertisement_report(uint8_t *packet, int size){
static void le_handle_advertisement_report(uint8_t *packet, int size){
int offset = 3;
int num_reports = packet[offset];
offset += 1;
@ -2729,7 +2729,7 @@ void hci_emit_connection_complete(hci_connection_t *conn, uint8_t status){
hci_stack->packet_handler(HCI_EVENT_PACKET, event, sizeof(event));
}
void hci_emit_le_connection_complete(uint8_t address_type, bd_addr_t address, uint16_t conn_handle, uint8_t status){
static void hci_emit_le_connection_complete(uint8_t address_type, bd_addr_t address, uint16_t conn_handle, uint8_t status){
uint8_t event[21];
event[0] = HCI_EVENT_LE_META;
event[1] = sizeof(event) - 2;

View File

@ -126,7 +126,7 @@ void l2cap_register_packet_handler(void (*handler)(void * connection, uint8_t pa
}
// notify client/protocol handler
void l2cap_dispatch(l2cap_channel_t *channel, uint8_t type, uint8_t * data, uint16_t size){
static void l2cap_dispatch(l2cap_channel_t *channel, uint8_t type, uint8_t * data, uint16_t size){
if (channel->packet_handler) {
(* (channel->packet_handler))(type, channel->local_cid, data, size);
} else {
@ -179,7 +179,7 @@ void l2cap_emit_connection_request(l2cap_channel_t *channel) {
l2cap_dispatch(channel, HCI_EVENT_PACKET, event, sizeof(event));
}
void l2cap_emit_connection_parameter_update_response(uint16_t handle, uint16_t result){
static void l2cap_emit_connection_parameter_update_response(uint16_t handle, uint16_t result){
uint8_t event[6];
event[0] = L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE;
event[1] = 4;
@ -200,7 +200,7 @@ static void l2cap_emit_service_registered(void *connection, uint8_t status, uint
(*packet_handler)(connection, HCI_EVENT_PACKET, 0, event, sizeof(event));
}
void l2cap_emit_credits(l2cap_channel_t *channel, uint8_t credits) {
static void l2cap_emit_credits(l2cap_channel_t *channel, uint8_t credits) {
log_info("L2CAP_EVENT_CREDITS local_cid 0x%x credits %u", channel->local_cid, credits);
// track credits
@ -219,7 +219,7 @@ void l2cap_block_new_credits(uint8_t blocked){
new_credits_blocked = blocked;
}
void l2cap_hand_out_credits(void){
static void l2cap_hand_out_credits(void){
if (new_credits_blocked) return; // we're told not to. used by daemon
@ -235,7 +235,7 @@ void l2cap_hand_out_credits(void){
}
}
l2cap_channel_t * l2cap_get_channel_for_local_cid(uint16_t local_cid){
static l2cap_channel_t * l2cap_get_channel_for_local_cid(uint16_t local_cid){
linked_list_iterator_t it;
linked_list_iterator_init(&it, &l2cap_channels);
while (linked_list_iterator_has_next(&it)){
@ -330,7 +330,7 @@ static int l2cap_security_level_0_allowed_for_PSM(uint16_t psm){
return (psm == PSM_SDP) && (!require_security_level2_for_outgoing_sdp);
}
int l2cap_send_signaling_packet(hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, ...){
static int l2cap_send_signaling_packet(hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, ...){
if (!hci_can_send_acl_packet_now(handle)){
log_info("l2cap_send_signaling_packet, cannot send");
@ -349,7 +349,7 @@ int l2cap_send_signaling_packet(hci_con_handle_t handle, L2CAP_SIGNALING_COMMAND
}
#ifdef HAVE_BLE
int l2cap_send_le_signaling_packet(hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, ...){
static int l2cap_send_le_signaling_packet(hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, ...){
if (!hci_can_send_acl_packet_now(handle)){
log_info("l2cap_send_signaling_packet, cannot send");
@ -520,7 +520,7 @@ static inline void channelStateVarClearFlag(l2cap_channel_t *channel, L2CAP_CHAN
// MARK: L2CAP_RUN
// process outstanding signaling tasks
void l2cap_run(void){
static void l2cap_run(void){
// log_info("l2cap_run: entered");
@ -872,7 +872,7 @@ static void l2cap_handle_connection_success_for_addr(bd_addr_t address, hci_con_
l2cap_run();
}
void l2cap_event_handler(uint8_t *packet, uint16_t size){
static void l2cap_event_handler(uint8_t *packet, uint16_t size){
bd_addr_t address;
hci_con_handle_t handle;
@ -1133,7 +1133,7 @@ void l2cap_decline_connection_internal(uint16_t local_cid, uint8_t reason){
l2cap_run();
}
void l2cap_signaling_handle_configure_request(l2cap_channel_t *channel, uint8_t *command){
static void l2cap_signaling_handle_configure_request(l2cap_channel_t *channel, uint8_t *command){
channel->remote_sig_id = command[L2CAP_SIGNALING_COMMAND_SIGID_OFFSET];
@ -1180,7 +1180,7 @@ static int l2cap_channel_ready_for_open(l2cap_channel_t *channel){
}
void l2cap_signaling_handler_channel(l2cap_channel_t *channel, uint8_t *command){
static void l2cap_signaling_handler_channel(l2cap_channel_t *channel, uint8_t *command){
uint8_t code = command[L2CAP_SIGNALING_COMMAND_CODE_OFFSET];
uint8_t identifier = command[L2CAP_SIGNALING_COMMAND_SIGID_OFFSET];
@ -1310,7 +1310,7 @@ void l2cap_signaling_handler_channel(l2cap_channel_t *channel, uint8_t *command)
}
void l2cap_signaling_handler_dispatch( hci_con_handle_t handle, uint8_t * command){
static void l2cap_signaling_handler_dispatch( hci_con_handle_t handle, uint8_t * command){
// get code, signalind identifier and command len
uint8_t code = command[L2CAP_SIGNALING_COMMAND_CODE_OFFSET];
@ -1372,7 +1372,7 @@ void l2cap_signaling_handler_dispatch( hci_con_handle_t handle, uint8_t * comman
}
}
void l2cap_acl_handler( uint8_t *packet, uint16_t size ){
static void l2cap_acl_handler( uint8_t *packet, uint16_t size ){
// Get Channel ID
uint16_t channel_id = READ_L2CAP_CHANNEL_ID(packet);
@ -1596,10 +1596,11 @@ void l2cap_register_fixed_channel(btstack_packet_handler_t packet_handler, uint1
#ifdef HAVE_BLE
#if 0
static inline l2cap_service_t * l2cap_le_get_service(uint16_t psm){
return l2cap_get_service_internal(&l2cap_le_services, psm);
}
/**
* @brief Regster L2CAP LE Credit Based Flow Control Mode service
* @param
@ -1652,3 +1653,4 @@ void l2cap_le_unregister_service_internal(void * connection, uint16_t psm) {
btstack_memory_l2cap_service_free(service);
}
#endif
#endif

View File

@ -85,7 +85,7 @@ uint16_t l2cap_next_local_cid(void){
return source_cid++;
}
uint16_t l2cap_create_signaling_internal(uint8_t * acl_buffer, hci_con_handle_t handle, uint16_t cid, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, va_list argptr){
static uint16_t l2cap_create_signaling_internal(uint8_t * acl_buffer, hci_con_handle_t handle, uint16_t cid, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, va_list argptr){
int pb = hci_non_flushable_packet_boundary_flag_supported() ? 0x00 : 0x02;

View File

@ -58,7 +58,7 @@ static const char default_nap_service_desc[] = "Personal Ad-hoc Network Service
static const char default_gn_service_name[] = "Group Ad-hoc Network Service";
static const char default_gn_service_desc[] = "Personal Group Ad-hoc Network Service";
void pan_create_service(uint8_t *service, uint32_t service_uuid, uint16_t * network_packet_types, const char *name, const char *descriptor,
static void pan_create_service(uint8_t *service, uint32_t service_uuid, uint16_t * network_packet_types, const char *name, const char *descriptor,
security_description_t security_desc, net_access_type_t net_access_type, uint32_t max_net_access_rate,
const char *IPv4Subnet, const char *IPv6Subnet){

View File

@ -87,6 +87,8 @@ extern const remote_device_db_t remote_device_db_memory;
*/
extern const remote_device_db_t remote_device_db_fs;
const remote_device_db_t * remote_device_db_fs_instance(void);
/* API_END */
// MARK: non-persistent implementation

View File

@ -228,8 +228,7 @@ static void rfcomm_emit_service_registered(void *connection, uint8_t status, uin
(*app_packet_handler)(connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
}
// static
void rfcomm_emit_remote_line_status(rfcomm_channel_t *channel, uint8_t line_status){
static void rfcomm_emit_remote_line_status(rfcomm_channel_t *channel, uint8_t line_status){
log_info("RFCOMM_EVENT_REMOTE_LINE_STATUS cid 0x%02x c, line status 0x%x", channel->rfcomm_cid, line_status);
uint8_t event[5];
event[0] = RFCOMM_EVENT_REMOTE_LINE_STATUS;
@ -240,7 +239,7 @@ void rfcomm_emit_remote_line_status(rfcomm_channel_t *channel, uint8_t line_stat
(*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
}
void rfcomm_emit_port_configuration(rfcomm_channel_t *channel){
static void rfcomm_emit_port_configuration(rfcomm_channel_t *channel){
// notify client about new settings
uint8_t event[2+sizeof(rfcomm_rpn_data_t)];
event[0] = RFCOMM_EVENT_PORT_CONFIGURATION;
@ -1406,7 +1405,7 @@ static void rfcomm_channel_state_machine_2(rfcomm_multiplexer_t * multiplexer, u
rfcomm_channel_state_machine(channel, event);
}
void rfcomm_channel_packet_handler(rfcomm_multiplexer_t * multiplexer, uint8_t *packet, uint16_t size){
static void rfcomm_channel_packet_handler(rfcomm_multiplexer_t * multiplexer, uint8_t *packet, uint16_t size){
// rfcomm: (0) addr [76543 server channel] [2 direction: initiator uses 1] [1 C/R: CMD by initiator = 1] [0 EA=1]
const uint8_t frame_dlci = packet[0] >> 2;
@ -2183,7 +2182,7 @@ int rfcomm_query_port_configuration(uint16_t rfcomm_cid){
}
void rfcomm_create_channel2(void * connection, bd_addr_t addr, uint8_t server_channel, uint8_t incoming_flow_control, uint8_t initial_credits){
static void rfcomm_create_channel2(void * connection, bd_addr_t addr, uint8_t server_channel, uint8_t incoming_flow_control, uint8_t initial_credits){
log_info("RFCOMM_CREATE_CHANNEL addr %s channel #%u flow control %u init credits %u", bd_addr_to_str(addr), server_channel,
incoming_flow_control, initial_credits);
@ -2245,7 +2244,7 @@ void rfcomm_disconnect_internal(uint16_t rfcomm_cid){
}
void rfcomm_register_service2(void * connection, uint8_t channel, uint16_t max_frame_size, uint8_t incoming_flow_control, uint8_t initial_credits){
static void rfcomm_register_service2(void * connection, uint8_t channel, uint16_t max_frame_size, uint8_t incoming_flow_control, uint8_t initial_credits){
log_info("RFCOMM_REGISTER_SERVICE channel #%u mtu %u flow_control %u credits %u",
channel, max_frame_size, incoming_flow_control, initial_credits);
// check if already registered

View File

@ -85,7 +85,7 @@ void sdp_register_packet_handler(void (*handler)(void * connection, uint8_t pack
l2cap_cid = 0;
}
uint32_t sdp_get_service_record_handle(uint8_t * record){
static uint32_t sdp_get_service_record_handle(uint8_t * record){
uint8_t * serviceRecordHandleAttribute = sdp_get_attribute_value_for_attribute_id(record, SDP_ServiceRecordHandle);
if (!serviceRecordHandleAttribute) return 0;
if (de_get_element_type(serviceRecordHandleAttribute) != DE_UINT) return 0;
@ -105,7 +105,7 @@ static void sdp_emit_service_registered(void *connection, uint32_t handle, uint8
(*app_packet_handler)(connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
}
service_record_item_t * sdp_get_record_for_handle(uint32_t handle){
static service_record_item_t * sdp_get_record_for_handle(uint32_t handle){
linked_item_t *it;
for (it = (linked_item_t *) sdp_service_records; it ; it = it->next){
service_record_item_t * item = (service_record_item_t *) it;
@ -117,7 +117,7 @@ service_record_item_t * sdp_get_record_for_handle(uint32_t handle){
}
// get next free, unregistered service record handle
uint32_t sdp_create_service_record_handle(void){
static uint32_t sdp_create_service_record_handle(void){
uint32_t handle = 0;
do {
handle = sdp_next_service_record_handle++;
@ -264,7 +264,7 @@ void sdp_unregister_service_internal(void *connection, uint32_t service_record_h
// PDU
// PDU ID (1), Transaction ID (2), Param Length (2), Param 1, Param 2, ..
int sdp_create_error_response(uint16_t transaction_id, uint16_t error_code){
static int sdp_create_error_response(uint16_t transaction_id, uint16_t error_code){
sdp_response_buffer[0] = SDP_ErrorResponse;
net_store_16(sdp_response_buffer, 1, transaction_id);
net_store_16(sdp_response_buffer, 3, 2);

View File

@ -78,7 +78,7 @@ static sdp_client_state_t sdp_client_state = INIT;
static SDP_PDU_ID_t PDU_ID = SDP_Invalid;
// TODO: inline if not needed (des(des))
void parse_attribute_lists(uint8_t* packet, uint16_t length){
static void parse_attribute_lists(uint8_t* packet, uint16_t length){
sdp_parser_handle_chunk(packet, length);
}

View File

@ -107,7 +107,7 @@ int de_state_size(uint8_t eventByte, de_state_t *de_state){
return 1;
}
void dummy_notify(sdp_query_event_t* event){}
static void dummy_notify(sdp_query_event_t* event){}
void sdp_parser_register_callback(void (*sdp_callback)(sdp_query_event_t* event)){
sdp_query_callback = dummy_notify;
@ -116,7 +116,7 @@ void sdp_parser_register_callback(void (*sdp_callback)(sdp_query_event_t* event)
}
}
void parse(uint8_t eventByte){
static void parse(uint8_t eventByte){
// count all bytes
list_offset++;
record_offset++;

View File

@ -107,7 +107,7 @@ void sdp_query_rfcomm_register_callback(void (*sdp_callback)(sdp_query_event_t*
sdp_app_context = context;
}
void handleProtocolDescriptorListData(uint32_t attribute_value_length, uint32_t data_offset, uint8_t data){
static void handleProtocolDescriptorListData(uint32_t attribute_value_length, uint32_t data_offset, uint8_t data){
// init state on first byte
if (data_offset == 0){
pdl_state = GET_PROTOCOL_LIST_LENGTH;
@ -206,7 +206,7 @@ void handleProtocolDescriptorListData(uint32_t attribute_value_length, uint32_t
}
}
void handleServiceNameData(uint32_t attribute_value_length, uint32_t data_offset, uint8_t data){
static void handleServiceNameData(uint32_t attribute_value_length, uint32_t data_offset, uint8_t data){
// Get Header Len
if (data_offset == 0){
@ -289,7 +289,7 @@ static void handle_sdp_parser_event(sdp_query_event_t * event){
// insert higher level code HERE
}
void sdp_query_rfcomm_init(void){
static void sdp_query_rfcomm_init(void){
// init
de_state_init(&de_header_state);
de_state_init(&sn_de_header_state);

View File

@ -40,7 +40,8 @@
*/
#include "sdp_parser.h"
#include "sdp_client.h"
#include "sdp_query_util.h"
static uint8_t des_attributeIDList[] = { 0x35, 0x05, 0x0A, 0x00, 0x01, 0xff, 0xff}; // Attribute: 0x0001 - 0x0100
static uint8_t des_serviceSearchPattern[] = {0x35, 0x03, 0x19, 0x00, 0x00};
static uint8_t des_serviceSearchPatternUUID128[] = {
@ -48,7 +49,7 @@ static uint8_t des_serviceSearchPatternUUID128[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8_t* create_service_search_pattern_for_uuid128(uint8_t* uuid){
static uint8_t* create_service_search_pattern_for_uuid128(uint8_t* uuid){
memcpy(&des_serviceSearchPatternUUID128[3], uuid, 16);
return (uint8_t*)des_serviceSearchPatternUUID128;
}

View File

@ -57,12 +57,12 @@ uint8_t* create_service_search_pattern_for_uuid(uint16_t uuid);
/*
* @brief Searches SDP records on a remote device for all services with a given UUID.
*/
void sdp_general_query_for_uuid(bd_addr_t remote, uint16_t uuid);
void sdp_general_query_for_uuid(bd_addr_t remote, uint16_t uuid16);
/*
* @brief
*/
void sdp_general_query_for_uuid128(bd_addr_t remote, uint8_t* uuid);
void sdp_general_query_for_uuid128(bd_addr_t remote, uint8_t* uuid128);
/* API_END */

View File

@ -289,9 +289,6 @@ void des_iterator_next(des_iterator_t * it){
it->pos += element_len;
}
void sdp_add_attribute(uint8_t *seq, uint16_t attributeID, uint8_t attributeValue){
}
// MARK: DataElementSequence traversal
typedef int (*de_traversal_callback_t)(uint8_t * element, de_type_t type, de_size_t size, void *context);
static void de_traverse_sequence(uint8_t * element, de_traversal_callback_t handler, void *context){
@ -359,6 +356,7 @@ static int sdp_traversal_attributeID_search(uint8_t * element, de_type_t type, d
}
return 0;
}
int sdp_attribute_list_constains_id(uint8_t *attributeIDList, uint16_t attributeID){
struct sdp_context_attributeID_search attributeID_search;
attributeID_search.result = 0;
@ -607,6 +605,7 @@ struct sdp_context_match_pattern {
uint8_t * record;
int result;
};
int sdp_traversal_match_pattern(uint8_t * element, de_type_t attributeType, de_size_t size, void *my_context){
struct sdp_context_match_pattern * context = (struct sdp_context_match_pattern *) my_context;
uint8_t normalizedUUID[16];

View File

@ -169,6 +169,8 @@ uint8_t sdp_set_attribute_value_for_attribute_id(uint8_t * record, uint16_t at
int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceSearchPattern);
int spd_get_filtered_size(uint8_t *record, uint8_t *attributeIDList);
int sdp_filter_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint16_t *usedBytes, uint8_t *buffer);
int sdp_attribute_list_constains_id(uint8_t *attributeIDList, uint16_t attributeID);
int sdp_traversal_match_pattern(uint8_t * element, de_type_t attributeType, de_size_t size, void *my_context);
void sdp_create_spp_service(uint8_t *service, int service_id, const char *name);
void sdp_normalize_uuid(uint8_t *uuid, uint32_t shortUUID);

View File

@ -311,7 +311,7 @@ static const uint8_t crc8table[256] = { /* reversed, 8-bit, poly=0x07 */
#define CRC8_INIT 0xFF // Initial FCS value
#define CRC8_OK 0xCF // Good final FCS value
/*-----------------------------------------------------------------------------------*/
uint8_t crc8(uint8_t *data, uint16_t len)
static uint8_t crc8(uint8_t *data, uint16_t len)
{
uint16_t count;
uint8_t crc = CRC8_INIT;

View File

@ -142,6 +142,8 @@ void swap56(const uint8_t src[7], uint8_t dst[7]);
void swap64(const uint8_t src[8], uint8_t dst[8]);
void swap128(const uint8_t src[16], uint8_t dst[16]);
char char_for_nibble(int nibble);
void printf_hexdump(const void *data, int size);
void hexdump(const void *data, int size);
void hexdumpf(const void *data, int size);