mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-28 16:11:24 +00:00
examples: unify status stdout format
This commit is contained in:
parent
6bcf18c2f9
commit
fcd55a0b5a
@ -588,7 +588,7 @@ static void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
|
||||
local_cid = avrcp_subevent_connection_established_get_avrcp_cid(packet);
|
||||
status = avrcp_subevent_connection_established_get_status(packet);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("AVRCP: Connection failed: status 0x%02x\n", status);
|
||||
printf("AVRCP: Connection failed, status 0x%02x\n", status);
|
||||
connection->avrcp_cid = 0;
|
||||
return;
|
||||
}
|
||||
@ -849,7 +849,7 @@ static void a2dp_sink_packet_handler(uint8_t packet_type, uint16_t channel, uint
|
||||
a2dp_conn->a2dp_cid = a2dp_subevent_stream_established_get_a2dp_cid(packet);
|
||||
a2dp_conn->stream_state = STREAM_STATE_OPEN;
|
||||
|
||||
printf("A2DP Sink : Streaming connection is established, address %s, cid 0x%02X, local seid %d\n",
|
||||
printf("A2DP Sink : Streaming connection is established, address %s, cid 0x%02x, local seid %d\n",
|
||||
bd_addr_to_str(address), a2dp_conn->a2dp_cid, a2dp_conn->a2dp_local_seid);
|
||||
#ifdef HAVE_BTSTACK_STDIN
|
||||
// use address for outgoing connections
|
||||
@ -859,7 +859,7 @@ static void a2dp_sink_packet_handler(uint8_t packet_type, uint16_t channel, uint
|
||||
|
||||
#ifdef ENABLE_AVDTP_ACCEPTOR_EXPLICIT_START_STREAM_CONFIRMATION
|
||||
case A2DP_SUBEVENT_START_STREAM_REQUESTED:
|
||||
printf("A2DP Sink : Explicit Accept to start stream, local_seid 0x%02x\n", a2dp_subevent_start_stream_requested_get_local_seid(packet));
|
||||
printf("A2DP Sink : Explicit Accept to start stream, local_seid %d\n", a2dp_subevent_start_stream_requested_get_local_seid(packet));
|
||||
a2dp_sink_start_stream_accept(a2dp_cid, a2dp_local_seid);
|
||||
break;
|
||||
#endif
|
||||
|
@ -690,7 +690,7 @@ static void a2dp_source_packet_handler(uint8_t packet_type, uint16_t channel, ui
|
||||
cid = a2dp_subevent_stream_reconfigured_get_a2dp_cid(packet);
|
||||
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("A2DP Source: Stream reconfiguration failed with status 0x%02x\n", status);
|
||||
printf("A2DP Source: Stream reconfiguration failed, status 0x%02x\n", status);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -804,7 +804,7 @@ static void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
|
||||
}
|
||||
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("Responding to event 0x%02x failed with status 0x%02x\n", packet[2], status);
|
||||
printf("Responding to event 0x%02x failed, status 0x%02x\n", packet[2], status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -856,7 +856,7 @@ static void avrcp_target_packet_handler(uint8_t packet_type, uint16_t channel, u
|
||||
}
|
||||
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("Responding to event 0x%02x failed with status 0x%02x\n", packet[2], status);
|
||||
printf("Responding to event 0x%02x failed, status 0x%02x\n", packet[2], status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -874,7 +874,7 @@ static void avrcp_controller_packet_handler(uint8_t packet_type, uint16_t channe
|
||||
break;
|
||||
case AVRCP_SUBEVENT_NOTIFICATION_EVENT_BATT_STATUS_CHANGED:
|
||||
// see avrcp_battery_status_t
|
||||
printf("AVRCP Controller: Notification Battery Status %d\n", avrcp_subevent_notification_event_batt_status_changed_get_battery_status(packet));
|
||||
printf("AVRCP Controller: Notification Battery Status 0x%02x\n", avrcp_subevent_notification_event_batt_status_changed_get_battery_status(packet));
|
||||
break;
|
||||
case AVRCP_SUBEVENT_NOTIFICATION_STATE:
|
||||
printf("AVRCP Controller: Notification %s - %s\n",
|
||||
|
@ -150,7 +150,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (rfcomm_event_channel_opened_get_status(packet)) {
|
||||
printf("RFCOMM channel open failed, status %u\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
printf("RFCOMM channel open failed, status 0%02x\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
} else {
|
||||
rfcomm_channel_id = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
|
||||
mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
|
||||
@ -219,9 +219,9 @@ static void heartbeat_handler(struct btstack_timer_source *ts){
|
||||
sprintf(lineBuffer, "BTstack counter %04u\n\r", ++counter);
|
||||
puts(lineBuffer);
|
||||
if (rfcomm_can_send_packet_now(rfcomm_channel_id)){
|
||||
int err = rfcomm_send(rfcomm_channel_id, (uint8_t*) lineBuffer, strlen(lineBuffer));
|
||||
if (err) {
|
||||
printf("rfcomm_send -> error %d", err);
|
||||
uint8_t status = rfcomm_send(rfcomm_channel_id, (uint8_t*) lineBuffer, strlen(lineBuffer));
|
||||
if (status) {
|
||||
printf("rfcomm_send -> status 0x%02x", status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ static void att_update_value(struct btstack_timer_source *ts){
|
||||
// trigger ATT Server to try request again
|
||||
int status = att_server_response_ready(con_handle);
|
||||
|
||||
printf("Value updated -> complete ATT request - status %02x\n", status);
|
||||
printf("Value updated -> complete ATT request - status 0x%02x\n", status);
|
||||
|
||||
// simulated value becoming stale again
|
||||
att_timer.process = &att_invalidate_value;
|
||||
@ -181,14 +181,14 @@ static uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t a
|
||||
if (value_ready){
|
||||
return att_read_callback_handle_blob((const uint8_t *)test_string, strlen(test_string), offset, buffer, buffer_size);
|
||||
} else {
|
||||
printf("Read callback for handle %02x, but value not ready -> report response pending\n", att_handle);
|
||||
printf("Read callback for handle 0x%02x, but value not ready -> report response pending\n", att_handle);
|
||||
con_handle = connection_handle;
|
||||
return ATT_READ_RESPONSE_PENDING;
|
||||
}
|
||||
break;
|
||||
case ATT_READ_RESPONSE_PENDING:
|
||||
// virtual handle indicating all attributes have been queried
|
||||
printf("Read callback for virtual handle %02x - all attributes have been queried (important for read multiple or read by type) -> start updating values\n", att_handle);
|
||||
printf("Read callback for virtual handle 0x%02x - all attributes have been queried (important for read multiple or read by type) -> start updating values\n", att_handle);
|
||||
// simulated delayed response for example
|
||||
att_timer.process = &att_update_value;
|
||||
btstack_run_loop_set_timer(&att_timer, ATT_VALUE_DELAY_MS);
|
||||
@ -228,7 +228,7 @@ static int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_h
|
||||
printf("Write callback, value ready\n");
|
||||
return 0;
|
||||
} else {
|
||||
printf("Write callback for handle %02x, but not ready -> return response pending\n", att_handle);
|
||||
printf("Write callback for handle 0x%02x, but not ready -> return response pending\n", att_handle);
|
||||
}
|
||||
// simulated delayed response for example
|
||||
att_timer.process = &att_update_value;
|
||||
|
@ -341,7 +341,7 @@ static void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
|
||||
local_cid = avrcp_subevent_connection_established_get_avrcp_cid(packet);
|
||||
status = avrcp_subevent_connection_established_get_status(packet);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("AVRCP: Connection failed: status 0x%02x\n", status);
|
||||
printf("AVRCP: Connection failed, status 0x%02x\n", status);
|
||||
avrcp_cid = 0;
|
||||
return;
|
||||
}
|
||||
@ -415,7 +415,7 @@ static void avrcp_browsing_controller_packet_handler(uint8_t packet_type, uint16
|
||||
local_cid = avrcp_subevent_browsing_connection_established_get_browsing_cid(packet);
|
||||
status = avrcp_subevent_browsing_connection_established_get_status(packet);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("AVRCP: Connection failed: status 0x%02x\n", status);
|
||||
printf("AVRCP: Connection failed, status 0x%02x\n", status);
|
||||
browsing_cid = 0;
|
||||
return;
|
||||
}
|
||||
@ -454,7 +454,7 @@ static void avrcp_browsing_controller_packet_handler(uint8_t packet_type, uint16
|
||||
browsing_state = AVRCP_BROWSING_STATE_W4_SET_PLAYER;
|
||||
status = avrcp_browsing_controller_set_browsed_player(browsing_cid, media_player_items[0].player_id);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("Could not set player, status 0x%02X\n", status);
|
||||
printf("Could not set player, status 0x%02x\n", status);
|
||||
status = AVRCP_BROWSING_STATE_W4_GET_PLAYERS;
|
||||
break;
|
||||
}
|
||||
@ -530,7 +530,7 @@ static void avrcp_browsing_controller_packet_handler(uint8_t packet_type, uint16
|
||||
uint8_t feature_bitmask[16];
|
||||
memcpy(feature_bitmask, packet, 16);
|
||||
pos += 16;
|
||||
printf("player ID 0x%04x, major_type %d, subtype %d, status %d\n", player_id, major_type, subtype, status);
|
||||
printf("player ID 0x%04x, major_type %d, subtype %d, status 0x%02x\n", player_id, major_type, subtype, status);
|
||||
media_player_items[next_media_player_item_index()].player_id = player_id;
|
||||
break;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
}
|
||||
break;
|
||||
case GAP_EVENT_DEDICATED_BONDING_COMPLETED:
|
||||
printf("GAP Dedicated Bonding Complete, status %u\n", packet[2]);
|
||||
printf("GAP Dedicated Bonding Complete, status 0x%02x\n", packet[2]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -287,7 +287,7 @@ static void gatt_client_event_handler(uint8_t packet_type, uint16_t channel, uin
|
||||
gattservice_subevent_battery_service_connected_get_poll_bitmap(packet));
|
||||
break;
|
||||
default:
|
||||
printf("Battery service client connection failed, err 0x%02x.\n", status);
|
||||
printf("Battery service client connection failed, status 0x%02x.\n", status);
|
||||
add_to_blacklist(report.address);
|
||||
gap_disconnect(connection_handle);
|
||||
break;
|
||||
|
@ -148,7 +148,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
att_status = gatt_event_query_complete_get_att_status(packet);
|
||||
if (att_status != ATT_ERROR_SUCCESS){
|
||||
printf("SERVICE_QUERY_RESULT - Error status %x.\n", att_status);
|
||||
printf("SERVICE_QUERY_RESULT - ATT Error 0x%02x.\n", att_status);
|
||||
gap_disconnect(connection_handle);
|
||||
break;
|
||||
}
|
||||
@ -169,7 +169,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
att_status = gatt_event_query_complete_get_att_status(packet);
|
||||
if (att_status != ATT_ERROR_SUCCESS){
|
||||
printf("CHARACTERISTIC_QUERY_RESULT - Error status %x.\n", att_status);
|
||||
printf("CHARACTERISTIC_QUERY_RESULT - ATT Error 0x%02x.\n", att_status);
|
||||
gap_disconnect(connection_handle);
|
||||
break;
|
||||
}
|
||||
@ -190,7 +190,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case TC_W4_ENABLE_NOTIFICATIONS_COMPLETE:
|
||||
switch(hci_event_packet_get_type(packet)){
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
printf("Notifications enabled, ATT status %02x\n", gatt_event_query_complete_get_att_status(packet));
|
||||
printf("Notifications enabled, ATT status 0x%02x\n", gatt_event_query_complete_get_att_status(packet));
|
||||
|
||||
state = TC_W4_SENSOR_LOCATION_CHARACTERISTIC;
|
||||
printf("Search for Sensor Location characteristic.\n");
|
||||
@ -209,7 +209,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
break;
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
if (gatt_event_query_complete_get_att_status(packet) != ATT_ERROR_SUCCESS){
|
||||
printf("CHARACTERISTIC_QUERY_RESULT - Error status %x.\n", packet[4]);
|
||||
printf("CHARACTERISTIC_QUERY_RESULT - ATT Error 0x%02x.\n", packet[4]);
|
||||
state = TC_CONNECTED;
|
||||
break;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ static void hci_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
|
||||
break;
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||
con_handle = hci_event_disconnection_complete_get_connection_handle(packet);
|
||||
printf("- LE Connection %04x: disconnect, reason %02x\n", con_handle, hci_event_disconnection_complete_get_reason(packet));
|
||||
printf("- LE Connection 0x%04x: disconnect, reason %02x\n", con_handle, hci_event_disconnection_complete_get_reason(packet));
|
||||
break;
|
||||
case HCI_EVENT_LE_META:
|
||||
switch (hci_event_le_meta_get_subevent_code(packet)) {
|
||||
@ -262,18 +262,18 @@ static void hci_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
|
||||
// print connection parameters (without using float operations)
|
||||
con_handle = hci_subevent_le_connection_complete_get_connection_handle(packet);
|
||||
conn_interval = hci_subevent_le_connection_complete_get_conn_interval(packet);
|
||||
printf("- LE Connection %04x: connected - connection interval %u.%02u ms, latency %u\n", con_handle, conn_interval * 125 / 100,
|
||||
printf("- LE Connection 0x%04x: connected - connection interval %u.%02u ms, latency %u\n", con_handle, conn_interval * 125 / 100,
|
||||
25 * (conn_interval & 3), hci_subevent_le_connection_complete_get_conn_latency(packet));
|
||||
|
||||
// request min con interval 15 ms for iOS 11+
|
||||
printf("- LE Connection %04x: request 15 ms connection interval\n", con_handle);
|
||||
printf("- LE Connection 0x%04x: request 15 ms connection interval\n", con_handle);
|
||||
gap_request_connection_parameter_update(con_handle, 12, 12, 0, 0x0048);
|
||||
break;
|
||||
case HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE:
|
||||
// print connection parameters (without using float operations)
|
||||
con_handle = hci_subevent_le_connection_update_complete_get_connection_handle(packet);
|
||||
conn_interval = hci_subevent_le_connection_update_complete_get_conn_interval(packet);
|
||||
printf("- LE Connection %04x: connection update - connection interval %u.%02u ms, latency %u\n", con_handle, conn_interval * 125 / 100,
|
||||
printf("- LE Connection 0x%04x: connection update - connection interval %u.%02u ms, latency %u\n", con_handle, conn_interval * 125 / 100,
|
||||
25 * (conn_interval & 3), hci_subevent_le_connection_update_complete_get_conn_latency(packet));
|
||||
break;
|
||||
default:
|
||||
@ -311,7 +311,7 @@ static void att_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
|
||||
context->counter = 'A';
|
||||
context->connection_handle = att_event_connected_get_handle(packet);
|
||||
context->test_data_len = btstack_min(att_server_get_mtu(context->connection_handle) - 3, sizeof(context->test_data));
|
||||
printf("%c: ATT connected, handle %04x, test data len %u\n", context->name, context->connection_handle, context->test_data_len);
|
||||
printf("%c: ATT connected, handle 0x%04x, test data len %u\n", context->name, context->connection_handle, context->test_data_len);
|
||||
break;
|
||||
case ATT_EVENT_MTU_EXCHANGE_COMPLETE:
|
||||
mtu = att_event_mtu_exchange_complete_get_MTU(packet) - 3;
|
||||
@ -327,7 +327,7 @@ static void att_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
|
||||
context = connection_for_conn_handle(att_event_disconnected_get_handle(packet));
|
||||
if (!context) break;
|
||||
// free connection
|
||||
printf("%c: ATT disconnected, handle %04x\n", context->name, context->connection_handle);
|
||||
printf("%c: ATT disconnected, handle 0x%04x\n", context->name, context->connection_handle);
|
||||
context->le_notification_enabled = 0;
|
||||
context->connection_handle = HCI_CON_HANDLE_INVALID;
|
||||
break;
|
||||
@ -398,7 +398,7 @@ static void streamer(void){
|
||||
static int att_write_callback(hci_con_handle_t con_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size){
|
||||
UNUSED(offset);
|
||||
|
||||
// printf("att_write_callback att_handle %04x, transaction mode %u\n", att_handle, transaction_mode);
|
||||
// printf("att_write_callback att_handle 0x%04x, transaction mode %u\n", att_handle, transaction_mode);
|
||||
if (transaction_mode != ATT_TRANSACTION_MODE_NONE) return 0;
|
||||
le_streamer_connection_t * context = connection_for_conn_handle(con_handle);
|
||||
switch(att_handle){
|
||||
|
@ -535,7 +535,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
break;
|
||||
case HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED:
|
||||
if (hfp_subevent_audio_connection_established_get_status(event) != ERROR_CODE_SUCCESS){
|
||||
printf("Audio connection establishment failed with status %u\n", hfp_subevent_audio_connection_established_get_status(event));
|
||||
printf("Audio connection establishment failed with status 0x%02x\n", hfp_subevent_audio_connection_established_get_status(event));
|
||||
} else {
|
||||
sco_handle = hfp_subevent_audio_connection_established_get_sco_handle(event);
|
||||
printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle);
|
||||
@ -679,7 +679,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
printf("Received BATTERY LEVEL indicator, value %d\n", hfp_subevent_hf_indicator_get_value(event));
|
||||
break;
|
||||
default:
|
||||
printf("Received HF INDICATOR indicator, UUID 0x%4X, value %d\n", hfp_subevent_hf_indicator_get_uuid(event), hfp_subevent_hf_indicator_get_value(event));
|
||||
printf("Received HF INDICATOR indicator, UUID 0x%4x, value %d\n", hfp_subevent_hf_indicator_get_uuid(event), hfp_subevent_hf_indicator_get_value(event));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -550,19 +550,19 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
break;
|
||||
|
||||
case HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED:
|
||||
printf("AG Indicator Status | INDEX %d: status %d, '%s'\n",
|
||||
printf("AG Indicator Status | INDEX %d: status 0x%02x, '%s'\n",
|
||||
hfp_subevent_ag_indicator_status_changed_get_indicator_index(event),
|
||||
hfp_subevent_ag_indicator_status_changed_get_indicator_status(event),
|
||||
(const char*) hfp_subevent_ag_indicator_status_changed_get_indicator_name(event));
|
||||
break;
|
||||
case HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED:
|
||||
printf("NETWORK_OPERATOR_CHANGED, operator mode: %d, format: %d, name: %s\n",
|
||||
printf("NETWORK_OPERATOR_CHANGED, operator mode %d, format %d, name %s\n",
|
||||
hfp_subevent_network_operator_changed_get_network_operator_mode(event),
|
||||
hfp_subevent_network_operator_changed_get_network_operator_format(event),
|
||||
(char *) hfp_subevent_network_operator_changed_get_network_operator_name(event));
|
||||
break;
|
||||
case HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR:
|
||||
printf("EXTENDED_AUDIO_GATEWAY_ERROR_REPORT, status: 0x%02x\n",
|
||||
printf("EXTENDED_AUDIO_GATEWAY_ERROR_REPORT, status 0x%02x\n",
|
||||
hfp_subevent_extended_audio_gateway_error_get_error(event));
|
||||
break;
|
||||
case HFP_SUBEVENT_START_RINGING:
|
||||
@ -604,7 +604,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
case HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED:
|
||||
status = hfp_subevent_voice_recognition_activated_get_status(event);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("Voice Recognition Activate command failed\n");
|
||||
printf("Voice Recognition Activate command failed, status 0x%02x\n", status);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
case HFP_SUBEVENT_VOICE_RECOGNITION_DEACTIVATED:
|
||||
status = hfp_subevent_voice_recognition_deactivated_get_status(event);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("Voice Recognition Deactivate command failed\n");
|
||||
printf("Voice Recognition Deactivate command failed, status 0x%02x\n", status);
|
||||
break;
|
||||
}
|
||||
printf("\nVoice Recognition DEACTIVATED\n\n");
|
||||
|
@ -309,7 +309,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
// connections were opened successfully.
|
||||
status = hid_subevent_connection_opened_get_status(packet);
|
||||
if (status != ERROR_CODE_SUCCESS) {
|
||||
printf("Connection failed, status 0x%x\n", status);
|
||||
printf("Connection failed, status 0x%02x\n", status);
|
||||
app_state = APP_IDLE;
|
||||
hid_host_cid = 0;
|
||||
return;
|
||||
@ -332,7 +332,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
hid_host_descriptor_available = true;
|
||||
printf("HID Descriptor available, please start typing.\n");
|
||||
} else {
|
||||
printf("Cannot handle input report, HID Descriptor is not available.\n");
|
||||
printf("Cannot handle input report, HID Descriptor is not available, status 0x%02x\n", status);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -354,7 +354,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
att_status = gatt_event_query_complete_get_att_status(packet);
|
||||
if (att_status != ATT_ERROR_SUCCESS) {
|
||||
printf("ATT Error status %x.\n", att_status);
|
||||
printf("Query failed, ATT Error 0x%02x.\n", att_status);
|
||||
handle_outgoing_connection_error();
|
||||
break;
|
||||
}
|
||||
@ -391,7 +391,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
att_status = gatt_event_query_complete_get_att_status(packet);
|
||||
if (att_status != ATT_ERROR_SUCCESS) {
|
||||
printf("ATT Error status %x.\n", att_status);
|
||||
printf("Query failed, ATT Error 0x%02x.\n", att_status);
|
||||
handle_outgoing_connection_error();
|
||||
break;
|
||||
}
|
||||
@ -408,7 +408,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
att_status = gatt_event_query_complete_get_att_status(packet);
|
||||
if (att_status != ATT_ERROR_SUCCESS) {
|
||||
printf("ATT Error status %x.\n", att_status);
|
||||
printf("Query failed, ATT Error 0x%02x.\n", att_status);
|
||||
handle_outgoing_connection_error();
|
||||
break;
|
||||
}
|
||||
@ -428,7 +428,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
att_status = gatt_event_query_complete_get_att_status(packet);
|
||||
if (att_status != ATT_ERROR_SUCCESS) {
|
||||
printf("ATT Error status %x.\n", att_status);
|
||||
printf("Query failed, ATT Error 0x%02x.\n", att_status);
|
||||
handle_outgoing_connection_error();
|
||||
break;
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
app_state = READY;
|
||||
break;
|
||||
default:
|
||||
printf("HID service client connection failed, err 0x%02x.\n", status);
|
||||
printf("HID service client connection failed, status 0x%02x.\n", status);
|
||||
handle_outgoing_connection_error();
|
||||
break;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
case HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE:
|
||||
status = hsp_subevent_rfcomm_connection_complete_get_status(event);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("RFCOMM connection establishement failed with status %u\n", status);
|
||||
printf("RFCOMM connection establishement failed, status 0x%02x\n", status);
|
||||
break;
|
||||
}
|
||||
printf("RFCOMM connection established.\n");
|
||||
@ -222,7 +222,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
case HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE:
|
||||
status = hsp_subevent_audio_connection_complete_get_status(event);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("Audio connection establishment failed with status %u\n", status);
|
||||
printf("Audio connection establishment failed, status 0x%02x\n", status);
|
||||
} else {
|
||||
sco_handle = hsp_subevent_audio_connection_complete_get_sco_handle(event);
|
||||
printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle);
|
||||
@ -257,7 +257,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("event not handled %u\n", event[2]);
|
||||
printf("event not handled 0x%02x\n", event[2]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -198,7 +198,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
case HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE:
|
||||
status = hsp_subevent_rfcomm_connection_complete_get_status(event);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("RFCOMM connection establishment failed with status %u\n", status);
|
||||
printf("RFCOMM connection establishment failed, status 0x%02x\n", status);
|
||||
} else {
|
||||
printf("RFCOMM connection established.\n");
|
||||
}
|
||||
@ -209,7 +209,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
case HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE:
|
||||
status = hsp_subevent_audio_connection_complete_get_status(event);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
printf("Audio connection establishment failed with status %u\n", status);
|
||||
printf("Audio connection establishment failed, status 0x%02x\n", status);
|
||||
} else {
|
||||
sco_handle = hsp_subevent_audio_connection_complete_get_sco_handle(event);
|
||||
printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle);
|
||||
@ -240,7 +240,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("event not handled %u\n", hci_event_hsp_meta_get_subevent_code(event));
|
||||
printf("event not handled 0x%02x\n", hci_event_hsp_meta_get_subevent_code(event));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -265,7 +265,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
handle = l2cap_event_cbm_channel_opened_get_handle(packet);
|
||||
status = l2cap_event_cbm_channel_opened_get_status(packet);
|
||||
if (status == ERROR_CODE_SUCCESS) {
|
||||
printf("L2CAP: CBM Channel successfully opened: %s, handle 0x%02x, psm 0x%02x, local cid 0x%02x, remote cid 0x%02x\n",
|
||||
printf("L2CAP: CBM Channel successfully opened: %s, handle 0x%04x, psm 0x%02x, local cid 0x%02x, remote cid 0x%02x\n",
|
||||
bd_addr_to_str(event_address), handle, psm, cid, little_endian_read_16(packet, 15));
|
||||
le_cbm_connection.cid = cid;
|
||||
le_cbm_connection.connection_handle = handle;
|
||||
|
@ -186,7 +186,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
break;
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||
// free connection
|
||||
printf("%c: Disconnect, reason %02x\n", le_cbm_connection.name, hci_event_disconnection_complete_get_reason(packet));
|
||||
printf("%c: Disconnect, reason 0x%02x\n", le_cbm_connection.name, hci_event_disconnection_complete_get_reason(packet));
|
||||
le_cbm_connection.connection_handle = HCI_CON_HANDLE_INVALID;
|
||||
break;
|
||||
case HCI_EVENT_LE_META:
|
||||
@ -216,7 +216,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
break;
|
||||
|
||||
case L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE:
|
||||
printf("L2CAP Connection Parameter Update Complete, response: %x\n", l2cap_event_connection_parameter_update_response_get_result(packet));
|
||||
printf("L2CAP Connection Parameter Update Complete, result: 0x%02x\n", l2cap_event_connection_parameter_update_response_get_result(packet));
|
||||
break;
|
||||
|
||||
// LE Credit-based Flow-Control Mode
|
||||
@ -237,7 +237,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
handle = l2cap_event_cbm_channel_opened_get_handle(packet);
|
||||
status = l2cap_event_cbm_channel_opened_get_status(packet);
|
||||
if (status == ERROR_CODE_SUCCESS) {
|
||||
printf("L2CAP: Channel successfully opened: %s, handle 0x%02x, psm 0x%02x, local cid 0x%02x, remote cid 0x%02x\n",
|
||||
printf("L2CAP: Channel successfully opened: %s, handle 0x%04x, psm 0x%02x, local cid 0x%02x, remote cid 0x%02x\n",
|
||||
bd_addr_to_str(event_address), handle, psm, cid, little_endian_read_16(packet, 15));
|
||||
// setup new
|
||||
le_cbm_connection.counter = 'A';
|
||||
@ -250,7 +250,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
l2cap_cbm_request_can_send_now_event(le_data_channel_connection.cid);
|
||||
#endif
|
||||
} else {
|
||||
printf("L2CAP: Connection to device %s failed. status code %u\n", bd_addr_to_str(event_address), status);
|
||||
printf("L2CAP: Connection to device %s failed, status 0x%02x\n", bd_addr_to_str(event_address), status);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -161,7 +161,7 @@ static void streamer(le_streamer_connection_t * context){
|
||||
// send
|
||||
uint8_t status = gatt_client_write_value_of_characteristic_without_response(connection_handle, le_streamer_characteristic_rx.value_handle, context->test_data_len, (uint8_t*) context->test_data);
|
||||
if (status){
|
||||
printf("error %02x for write without response!\n", status);
|
||||
printf("Write without response failed, status 0x%02x.\n", status);
|
||||
return;
|
||||
} else {
|
||||
test_track_data(&le_streamer_connection, context->test_data_len);
|
||||
@ -216,7 +216,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
att_status = gatt_event_query_complete_get_att_status(packet);
|
||||
if (att_status != ATT_ERROR_SUCCESS){
|
||||
printf("SERVICE_QUERY_RESULT - Error status %x.\n", att_status);
|
||||
printf("SERVICE_QUERY_RESULT, ATT Error 0x%02x.\n", att_status);
|
||||
gap_disconnect(connection_handle);
|
||||
break;
|
||||
}
|
||||
@ -238,7 +238,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
att_status = gatt_event_query_complete_get_att_status(packet);
|
||||
if (att_status != ATT_ERROR_SUCCESS){
|
||||
printf("CHARACTERISTIC_QUERY_RESULT - Error status %x.\n", att_status);
|
||||
printf("CHARACTERISTIC_QUERY_RESULT, ATT Error 0x%02x.\n", att_status);
|
||||
gap_disconnect(connection_handle);
|
||||
break;
|
||||
}
|
||||
@ -260,7 +260,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
att_status = gatt_event_query_complete_get_att_status(packet);
|
||||
if (att_status != ATT_ERROR_SUCCESS){
|
||||
printf("CHARACTERISTIC_QUERY_RESULT - Error status %x.\n", att_status);
|
||||
printf("CHARACTERISTIC_QUERY_RESULT, ATT Error 0x%02x.\n", att_status);
|
||||
gap_disconnect(connection_handle);
|
||||
break;
|
||||
}
|
||||
@ -296,7 +296,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
case TC_W4_ENABLE_NOTIFICATIONS_COMPLETE:
|
||||
switch(hci_event_packet_get_type(packet)){
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
printf("Notifications enabled, ATT status %02x\n", gatt_event_query_complete_get_att_status(packet));
|
||||
printf("Notifications enabled, ATT status 0x%02x\n", gatt_event_query_complete_get_att_status(packet));
|
||||
if (gatt_event_query_complete_get_att_status(packet) != ATT_ERROR_SUCCESS) break;
|
||||
state = TC_W4_TEST_DATA;
|
||||
#if (TEST_MODE & TEST_MODE_WRITE_WITHOUT_RESPONSE)
|
||||
@ -320,7 +320,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
streamer(&le_streamer_connection);
|
||||
break;
|
||||
default:
|
||||
printf("Unknown packet type %x\n", hci_event_packet_get_type(packet));
|
||||
printf("Unknown packet type 0x%02x\n", hci_event_packet_get_type(packet));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -123,7 +123,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
*/
|
||||
case BNEP_EVENT_CHANNEL_OPENED:
|
||||
if (bnep_event_channel_opened_get_status(packet)) {
|
||||
printf("BNEP channel open failed, status %02x\n", bnep_event_channel_opened_get_status(packet));
|
||||
printf("BNEP channel open failed, status 0x%02x\n", bnep_event_channel_opened_get_status(packet));
|
||||
} else {
|
||||
uint16_t uuid_source = bnep_event_channel_opened_get_source_uuid(packet);
|
||||
uint16_t uuid_dest = bnep_event_channel_opened_get_destination_uuid(packet);
|
||||
|
@ -285,7 +285,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel
|
||||
|
||||
case SDP_EVENT_QUERY_COMPLETE:
|
||||
handle_sdp_client_record_complete();
|
||||
fprintf(stderr, "General query done with status %d, bnep psm %04x.\n", sdp_event_query_complete_get_status(packet), bnep_l2cap_psm);
|
||||
fprintf(stderr, "Query complete, status 0%02x, bnep psm 0x%04x.\n", sdp_event_query_complete_get_status(packet), bnep_l2cap_psm);
|
||||
if (bnep_l2cap_psm){
|
||||
/* Create BNEP connection */
|
||||
bnep_connect(packet_handler, remote_addr, bnep_l2cap_psm, BLUETOOTH_SERVICE_CLASS_PANU, bnep_remote_uuid);
|
||||
@ -360,7 +360,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
*/
|
||||
case BNEP_EVENT_CHANNEL_OPENED:
|
||||
if (bnep_event_channel_opened_get_status(packet)) {
|
||||
printf("BNEP channel open failed, status %02x\n", bnep_event_channel_opened_get_status(packet));
|
||||
printf("BNEP channel open failed, status 0x%02x\n", bnep_event_channel_opened_get_status(packet));
|
||||
} else {
|
||||
bnep_cid = bnep_event_channel_opened_get_bnep_cid(packet);
|
||||
uuid_source = bnep_event_channel_opened_get_source_uuid(packet);
|
||||
|
@ -300,7 +300,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
case PBAP_SUBEVENT_PHONEBOOK_SIZE:
|
||||
status = pbap_subevent_phonebook_size_get_status(packet);
|
||||
if (status){
|
||||
printf("[!] Get Phonebook size error: 0x%x\n", status);
|
||||
printf("[!] Get Phonebook size error: 0x%02x\n", status);
|
||||
} else {
|
||||
printf("[+] Phonebook size: %u\n", pbap_subevent_phonebook_size_get_phonebook_size(packet));
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel
|
||||
break;
|
||||
case SDP_EVENT_QUERY_COMPLETE:
|
||||
if (sdp_event_query_complete_get_status(packet)){
|
||||
printf("SDP query failed 0x%02x\n", sdp_event_query_complete_get_status(packet));
|
||||
printf("SDP query failed, status 0x%02x\n", sdp_event_query_complete_get_status(packet));
|
||||
break;
|
||||
}
|
||||
printf("SDP query done.\n");
|
||||
|
@ -138,7 +138,7 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uin
|
||||
break;
|
||||
case SDP_EVENT_QUERY_COMPLETE:
|
||||
if (sdp_event_query_complete_get_status(packet)){
|
||||
printf("SDP query failed 0x%02x\n", sdp_event_query_complete_get_status(packet));
|
||||
printf("SDP query failed, status 0x%02x\n", sdp_event_query_complete_get_status(packet));
|
||||
break;
|
||||
}
|
||||
printf("SDP query done.\n");
|
||||
|
@ -279,19 +279,19 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
status = gatt_event_query_complete_get_att_status(packet);
|
||||
switch (status){
|
||||
case ATT_ERROR_INSUFFICIENT_ENCRYPTION:
|
||||
printf("GATT Query result: Insufficient Encryption\n");
|
||||
printf("GATT Query failed, Insufficient Encryption\n");
|
||||
break;
|
||||
case ATT_ERROR_INSUFFICIENT_AUTHENTICATION:
|
||||
printf("GATT Query result: Insufficient Authentication\n");
|
||||
printf("GATT Query failed, Insufficient Authentication\n");
|
||||
break;
|
||||
case ATT_ERROR_BONDING_INFORMATION_MISSING:
|
||||
printf("GATT Query result: Bonding Information Missing\n");
|
||||
printf("GATT Query failed, Bonding Information Missing\n");
|
||||
break;
|
||||
case ATT_ERROR_SUCCESS:
|
||||
printf("GATT Query result: OK\n");
|
||||
printf("GATT Query successful\n");
|
||||
break;
|
||||
default:
|
||||
printf("GATT Query result: 0x%02x\n", gatt_event_query_complete_get_att_status(packet));
|
||||
printf("GATT Query failed, status 0x%02x\n", gatt_event_query_complete_get_att_status(packet));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -149,7 +149,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (rfcomm_event_channel_opened_get_status(packet)) {
|
||||
printf("RFCOMM channel open failed, status %u\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
printf("RFCOMM channel open failed, status 0x%02x\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
} else {
|
||||
rfcomm_channel_id = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
|
||||
mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
|
||||
|
@ -295,7 +295,7 @@ static void rfcomm_packet_handler (uint8_t packet_type, uint16_t channel, uint8_
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (rfcomm_event_channel_opened_get_status(packet)) {
|
||||
printf("RFCOMM channel open failed, status %u\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
printf("RFCOMM channel open failed, status 0x%02x\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
} else {
|
||||
rfcomm_cid = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
|
||||
rfcomm_mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
|
||||
|
@ -215,7 +215,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
if (rfcomm_event_channel_opened_get_status(packet)) {
|
||||
printf("RFCOMM channel open failed, status %u\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
printf("RFCOMM channel open failed, status 0x%02x\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
} else {
|
||||
rfcomm_channel_id = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
|
||||
mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
|
||||
|
@ -160,11 +160,11 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
if (rfcomm_event_channel_opened_get_status(packet)) {
|
||||
printf("RFCOMM channel open failed, status %u\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
printf("RFCOMM channel open failed, status 0x%02x\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
} else {
|
||||
rfcomm_channel_id = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
|
||||
mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
|
||||
printf("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u\n", rfcomm_channel_id, mtu);
|
||||
printf("RFCOMM channel open succeeded. New RFCOMM Channel ID 0x%02x, max frame size %u\n", rfcomm_channel_id, mtu);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -207,17 +207,17 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_event_incoming_connection_get_bd_addr(packet, event_addr);
|
||||
rfcomm_channel_nr = rfcomm_event_incoming_connection_get_server_channel(packet);
|
||||
rfcomm_cid = rfcomm_event_incoming_connection_get_rfcomm_cid(packet);
|
||||
printf("RFCOMM channel %u requested for %s\n", rfcomm_channel_nr, bd_addr_to_str(event_addr));
|
||||
printf("RFCOMM channel 0x%02x requested for %s\n", rfcomm_channel_nr, bd_addr_to_str(event_addr));
|
||||
rfcomm_accept_connection(rfcomm_cid);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
if (rfcomm_event_channel_opened_get_status(packet)) {
|
||||
printf("RFCOMM channel open failed, status %u\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
printf("RFCOMM channel open failed, status 0x%02x\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
} else {
|
||||
rfcomm_cid = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
|
||||
rfcomm_mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
|
||||
printf("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u\n", rfcomm_cid, rfcomm_mtu);
|
||||
printf("RFCOMM channel open succeeded. New RFCOMM Channel ID 0x%02x, max frame size %u\n", rfcomm_cid, rfcomm_mtu);
|
||||
|
||||
spp_test_data_len = rfcomm_mtu;
|
||||
if (spp_test_data_len > sizeof(test_data)){
|
||||
|
@ -211,14 +211,14 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uin
|
||||
break;
|
||||
case SDP_EVENT_QUERY_COMPLETE:
|
||||
if (sdp_event_query_complete_get_status(packet)){
|
||||
printf("SDP query failed 0x%02x\n", sdp_event_query_complete_get_status(packet));
|
||||
printf("SDP query failed, status 0x%02x\n", sdp_event_query_complete_get_status(packet));
|
||||
break;
|
||||
}
|
||||
if (rfcomm_server_channel == 0){
|
||||
printf("No SPP service found\n");
|
||||
break;
|
||||
}
|
||||
printf("SDP query done, channel %u.\n", rfcomm_server_channel);
|
||||
printf("SDP query done, channel 0x%02x.\n", rfcomm_server_channel);
|
||||
rfcomm_create_channel(packet_handler, peer_addr, rfcomm_server_channel, NULL);
|
||||
break;
|
||||
default:
|
||||
@ -306,17 +306,17 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_event_incoming_connection_get_bd_addr(packet, event_addr);
|
||||
rfcomm_channel_nr = rfcomm_event_incoming_connection_get_server_channel(packet);
|
||||
rfcomm_cid = rfcomm_event_incoming_connection_get_rfcomm_cid(packet);
|
||||
printf("RFCOMM channel %u requested for %s\n", rfcomm_channel_nr, bd_addr_to_str(event_addr));
|
||||
printf("RFCOMM channel 0x%02x requested for %s\n", rfcomm_channel_nr, bd_addr_to_str(event_addr));
|
||||
rfcomm_accept_connection(rfcomm_cid);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
if (rfcomm_event_channel_opened_get_status(packet)) {
|
||||
printf("RFCOMM channel open failed, status %u\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
printf("RFCOMM channel open failed, status 0x%02x\n", rfcomm_event_channel_opened_get_status(packet));
|
||||
} else {
|
||||
rfcomm_cid = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
|
||||
rfcomm_mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
|
||||
printf("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u\n", rfcomm_cid, rfcomm_mtu);
|
||||
printf("RFCOMM channel open succeeded. New RFCOMM Channel ID 0x%02x, max frame size %u\n", rfcomm_cid, rfcomm_mtu);
|
||||
test_reset();
|
||||
|
||||
// disable page/inquiry scan to get max performance
|
||||
|
Loading…
x
Reference in New Issue
Block a user