mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-04 10:14:18 +00:00
Use inttypes.h macros for printing/logging (u)int32_t data
This commit is contained in:
parent
893b4ccd70
commit
cb7b3e6fb9
@ -41,6 +41,7 @@
|
||||
* rfcomm.c
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h> // memcpy
|
||||
#include <stdint.h>
|
||||
|
||||
@ -1769,7 +1770,7 @@ static int rfcomm_channel_ready_for_open(rfcomm_channel_t *channel){
|
||||
// log_info("rfcomm_channel_ready_for_open state %u, flags needed %04x, current %04x, rf credits %u, l2cap credits %u ", channel->state, RFCOMM_CHANNEL_STATE_VAR_RCVD_MSC_RSP|RFCOMM_CHANNEL_STATE_VAR_SENT_MSC_RSP|RFCOMM_CHANNEL_STATE_VAR_SENT_CREDITS, channel->state_var, channel->credits_outgoing, channel->multiplexer->l2cap_credits);
|
||||
// if ((channel->state_var & RFCOMM_CHANNEL_STATE_VAR_SENT_MSC_RSP) == 0) return 0;
|
||||
// if (channel->credits_outgoing == 0) return 0;
|
||||
log_info("rfcomm_channel_ready_for_open state %u, flags needed %04x, current %04x, rf credits %u",
|
||||
log_info("rfcomm_channel_ready_for_open state %u, flags needed %04x, current %08" PRIx32 ", rf credits %u",
|
||||
channel->state, RFCOMM_CHANNEL_STATE_VAR_RCVD_MSC_RSP, channel->state_var, channel->credits_outgoing);
|
||||
if ((channel->state_var & RFCOMM_CHANNEL_STATE_VAR_RCVD_MSC_RSP) == 0) return 0;
|
||||
if ((channel->state_var & RFCOMM_CHANNEL_STATE_VAR_SENT_CREDITS) == 0) return 0;
|
||||
@ -1778,7 +1779,7 @@ static int rfcomm_channel_ready_for_open(rfcomm_channel_t *channel){
|
||||
}
|
||||
|
||||
static int rfcomm_channel_ready_for_incoming_dlc_setup(rfcomm_channel_t * channel){
|
||||
log_info("rfcomm_channel_ready_for_incoming_dlc_setup state var %04x", channel->state_var);
|
||||
log_info("rfcomm_channel_ready_for_incoming_dlc_setup state var %08" PRIx32, channel->state_var);
|
||||
// Client accept and SABM/UA is required, PN RSP is needed if PN was received
|
||||
if ((channel->state_var & RFCOMM_CHANNEL_STATE_VAR_CLIENT_ACCEPTED) == 0) return 0;
|
||||
if ((channel->state_var & RFCOMM_CHANNEL_STATE_VAR_RCVD_SABM ) == 0) return 0;
|
||||
|
@ -2518,7 +2518,7 @@ static void hci_handle_remote_features_page_2(hci_connection_t * conn, const uin
|
||||
static void hci_handle_remote_features_received(hci_connection_t * conn){
|
||||
conn->bonding_flags &= ~BONDING_REMOTE_FEATURES_QUERY_ACTIVE;
|
||||
conn->bonding_flags |= BONDING_RECEIVED_REMOTE_FEATURES;
|
||||
log_info("Remote features %02x, bonding flags %x", conn->remote_supported_features[0], conn->bonding_flags);
|
||||
log_info("Remote features %02x, bonding flags %" PRIx32, conn->remote_supported_features[0], conn->bonding_flags);
|
||||
if (conn->bonding_flags & BONDING_DEDICATED){
|
||||
conn->bonding_flags |= BONDING_SEND_AUTHENTICATE_REQUEST;
|
||||
}
|
||||
@ -2607,7 +2607,7 @@ static void hci_store_local_supported_commands(const uint8_t * packet){
|
||||
hci_stack->local_supported_commands |= (1LU << i);
|
||||
}
|
||||
}
|
||||
log_info("Local supported commands summary %04x", hci_stack->local_supported_commands);
|
||||
log_info("Local supported commands summary %08" PRIx32, hci_stack->local_supported_commands);
|
||||
}
|
||||
|
||||
static void handle_command_complete_event(uint8_t * packet, uint16_t size){
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#define ENABLE_LOG_DEBUG
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mesh/adv_bearer.h"
|
||||
@ -208,7 +209,7 @@ static void adv_bearer_timeout_handler(btstack_timer_source_t * ts){
|
||||
gap_advertisements_enable(0);
|
||||
if (gap_advertising_enabled){
|
||||
gap_adv_next_ms = now + gap_adv_int_ms - ADVERTISING_INTERVAL_CONNECTABLE_MIN_MS;
|
||||
log_debug("Next adv: %u", gap_adv_next_ms);
|
||||
log_debug("Next adv: %" PRIu32, gap_adv_next_ms);
|
||||
}
|
||||
adv_bearer_state = STATE_IDLE;
|
||||
break;
|
||||
@ -248,7 +249,7 @@ static void adv_bearer_run(void){
|
||||
adv_bearer_connectable_advertisement_data_item_t * item = (adv_bearer_connectable_advertisement_data_item_t *) btstack_linked_list_pop(&gap_connectable_advertisements);
|
||||
if (item == NULL){
|
||||
gap_adv_next_ms += gap_adv_int_ms;
|
||||
log_debug("Next adv: %u", gap_adv_next_ms);
|
||||
log_debug("Next adv: %" PRIu32, gap_adv_next_ms);
|
||||
} else {
|
||||
// queue again
|
||||
btstack_linked_list_add_tail(&gap_connectable_advertisements, (void*) item);
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#define BTSTACK_FILE__ "mesh.c"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -1150,7 +1151,7 @@ static int mesh_node_startup_from_tlv(void){
|
||||
}
|
||||
|
||||
// dump into packet log
|
||||
hci_dump_log(HCI_DUMP_LOG_LEVEL_INFO, "mesh-iv-index: %08x", iv_index);
|
||||
hci_dump_log(HCI_DUMP_LOG_LEVEL_INFO, "mesh-iv-index: %08" PRIx32, iv_index);
|
||||
mesh_log_key("mesh-devkey", 0xffff, persistent_provisioning_data.device_key);
|
||||
|
||||
} else {
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#define BTSTACK_FILE__ "mesh_access.c"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
@ -786,7 +787,7 @@ static void mesh_access_message_process_handler(mesh_pdu_t * pdu){
|
||||
}
|
||||
|
||||
uint16_t len = mesh_pdu_len(pdu);
|
||||
printf("MESH Access Message, Opcode = %x: ", opcode);
|
||||
printf("MESH Access Message, Opcode = %08" PRIx32 ": ", opcode);
|
||||
printf_hexdump(mesh_pdu_data(pdu), len);
|
||||
|
||||
uint16_t src = mesh_pdu_src(pdu);
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#define BTSTACK_FILE__ "mesh_configuration_server.c"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -1732,7 +1733,7 @@ config_model_publication_get_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu)
|
||||
|
||||
static void config_heartbeat_publication_emit(mesh_heartbeat_publication_t * mesh_heartbeat_publication){
|
||||
|
||||
printf("CONFIG_SERVER_HEARTBEAT: Emit (dest %04x, count %u, period %u ms)\n",
|
||||
printf("CONFIG_SERVER_HEARTBEAT: Emit (dest %04x, count %u, period %" PRIu32 " ms)\n",
|
||||
mesh_heartbeat_publication->destination,
|
||||
mesh_heartbeat_publication->count,
|
||||
mesh_heartbeat_publication->period_ms);
|
||||
@ -1852,7 +1853,7 @@ static void config_heartbeat_publication_set_handler(mesh_model_t *mesh_model, m
|
||||
if (network_key == NULL){
|
||||
status = MESH_FOUNDATION_STATUS_INVALID_NETKEY_INDEX;
|
||||
} else {
|
||||
printf("MESH config_heartbeat_publication_set, destination %x, count = %x, period = %u s\n",
|
||||
printf("MESH config_heartbeat_publication_set, destination %x, count = %x, period = %" PRIu32 " s\n",
|
||||
requested_publication.destination, requested_publication.count, requested_publication.period_ms);
|
||||
|
||||
// stop timer if active
|
||||
@ -2016,7 +2017,7 @@ static uint32_t config_heartbeat_subscription_get_period_remaining_s(mesh_heartb
|
||||
if (time_since_start_s < period_s){
|
||||
period_remaining_s = period_s - time_since_start_s;
|
||||
}
|
||||
printf("Heartbeat: time since start %d s, period %u s, period remaining %u s\n", time_since_start_s, period_s, period_remaining_s);
|
||||
printf("Heartbeat: time since start %" PRId32 " s, period %" PRIu32 " s, period remaining %" PRIu32 " s\n", time_since_start_s, period_s, period_remaining_s);
|
||||
return period_remaining_s;
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#define BTSTACK_FILE__ "mesh_generic_level_server.c"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -78,7 +79,7 @@ static mesh_transition_t * generic_level_server_get_base_transition(mesh_model_t
|
||||
|
||||
static void mesh_server_transition_handler(mesh_transition_t * base_transition, model_state_update_reason_t event){
|
||||
mesh_transition_int16_t * transition = (mesh_transition_int16_t*) base_transition;
|
||||
printf("Transition: event %x, current %x, target %x, increment %x, time %u\n", (int) event, transition->current_value, transition->target_value, transition->stepwise_value_increment, btstack_run_loop_get_time_ms());
|
||||
printf("Transition: event %x, current %x, target %x, increment %x, time %" PRIu32 "\n", (int) event, transition->current_value, transition->target_value, transition->stepwise_value_increment, btstack_run_loop_get_time_ms());
|
||||
switch (event){
|
||||
case MODEL_STATE_UPDATE_REASON_TRANSITION_ACTIVE:
|
||||
transition->current_value = add_and_clip_int16(transition->current_value, transition->stepwise_value_increment);
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#define BTSTACK_FILE__ "mesh_lower_transport.c"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -349,7 +350,7 @@ static mesh_segmented_pdu_t * mesh_lower_transport_incoming_pdu_for_segmented_me
|
||||
peer->block_ack = 0;
|
||||
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("mesh_transport_pdu_for_segmented_message: setup transport pdu %p for src %x, seq %06x, seq_zero %x\n", pdu, src,
|
||||
printf("mesh_transport_pdu_for_segmented_message: setup transport pdu %p for src %x, seq %06" PRIx32 ", seq_zero %x\n", pdu, src,
|
||||
pdu->seq, seq_zero);
|
||||
#endif
|
||||
return peer->message_pdu;
|
||||
@ -495,7 +496,7 @@ static void mesh_lower_transport_outgoing_process_segment_acknowledgement_messag
|
||||
uint32_t block_ack = big_endian_read_32(lower_transport_pdu, 3);
|
||||
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("[+] Segment Acknowledgment message with seq_zero %06x, block_ack %08x - outgoing seq %06x, block_ack %08x\n",
|
||||
printf("[+] Segment Acknowledgment message with seq_zero %06x, block_ack %08" PRIx32 " - outgoing seq %06x, block_ack %08" PRIx32 "\n",
|
||||
seq_zero_pdu, block_ack, seq_zero_out, segmented_pdu->block_ack);
|
||||
#endif
|
||||
|
||||
@ -524,7 +525,7 @@ static void mesh_lower_transport_outgoing_process_segment_acknowledgement_messag
|
||||
|
||||
segmented_pdu->block_ack &= ~block_ack;
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("[+] Updated block_ack %08x\n", segmented_pdu->block_ack);
|
||||
printf("[+] Updated block_ack %08" PRIx32 "\n", segmented_pdu->block_ack);
|
||||
#endif
|
||||
|
||||
if (segmented_pdu->block_ack == 0){
|
||||
@ -555,7 +556,7 @@ static void mesh_lower_transport_outgoing_restart_segment_transmission_timer(mes
|
||||
}
|
||||
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06x: setup transmission timeout %u ms\n", segmented_pdu,
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06" PRIx32 ": setup transmission timeout %u ms\n", segmented_pdu,
|
||||
segmented_pdu->seq, (int) timeout);
|
||||
#endif
|
||||
|
||||
@ -648,7 +649,7 @@ static void mesh_lower_transport_outgoing_send_next_segment(void){
|
||||
btstack_assert(lower_transport_outgoing_message != NULL);
|
||||
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("[+] Lower Transport, segmented pdu %p, seq %06x: send next segment\n", lower_transport_outgoing_message,
|
||||
printf("[+] Lower Transport, segmented pdu %p, seq %06" PRIx32 ": send next segment\n", lower_transport_outgoing_message,
|
||||
lower_transport_outgoing_message->seq);
|
||||
#endif
|
||||
|
||||
@ -663,7 +664,7 @@ static void mesh_lower_transport_outgoing_send_next_segment(void){
|
||||
|
||||
if (lower_transport_outgoing_seg_o > seg_n){
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("[+] Lower Transport, segmented pdu %p, seq %06x: send complete (dst %x)\n", lower_transport_outgoing_message,
|
||||
printf("[+] Lower Transport, segmented pdu %p, seq %06" PRIx32 ": send complete (dst %x)\n", lower_transport_outgoing_message,
|
||||
lower_transport_outgoing_message->seq,
|
||||
lower_transport_outgoing_message->dst);
|
||||
#endif
|
||||
@ -706,7 +707,7 @@ static void mesh_lower_transport_outgoing_send_next_segment(void){
|
||||
lower_transport_outgoing_segment);
|
||||
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("[+] Lower Transport, segmented pdu %p, seq %06x: send seg_o %x, seg_n %x\n", lower_transport_outgoing_message,
|
||||
printf("[+] Lower Transport, segmented pdu %p, seq %06" PRIx32 ": send seg_o %x, seg_n %x\n", lower_transport_outgoing_message,
|
||||
lower_transport_outgoing_message->seq, lower_transport_outgoing_seg_o, seg_n);
|
||||
mesh_print_hex("LowerTransportPDU", &lower_transport_outgoing_segment->data[9], lower_transport_outgoing_segment->len-9);
|
||||
#endif
|
||||
@ -720,7 +721,7 @@ static void mesh_lower_transport_outgoing_send_next_segment(void){
|
||||
}
|
||||
|
||||
static void mesh_lower_transport_outgoing_setup_sending_segmented_pdus(mesh_segmented_pdu_t *segmented_pdu) {
|
||||
printf("[+] Lower Transport, segmented pdu %p, seq %06x: send retry count %u\n", segmented_pdu, segmented_pdu->seq, segmented_pdu->retry_count);
|
||||
printf("[+] Lower Transport, segmented pdu %p, seq %06" PRIx32 ": send retry count %u\n", segmented_pdu, segmented_pdu->seq, segmented_pdu->retry_count);
|
||||
|
||||
segmented_pdu->retry_count--;
|
||||
lower_transport_outgoing_seg_o = 0;
|
||||
@ -734,14 +735,14 @@ static void mesh_lower_transport_outgoing_setup_sending_segmented_pdus(mesh_segm
|
||||
static void mesh_lower_transport_outgoing_segment_transmission_fired(mesh_segmented_pdu_t *segmented_pdu) {
|
||||
// once more?
|
||||
if (segmented_pdu->retry_count == 0){
|
||||
printf("[!] Lower transport, segmented pdu %p, seq %06x: send failed, retries exhausted\n", segmented_pdu,
|
||||
printf("[!] Lower transport, segmented pdu %p, seq %06" PRIx32 ": send failed, retries exhausted\n", segmented_pdu,
|
||||
segmented_pdu->seq);
|
||||
mesh_lower_transport_outgoing_complete(segmented_pdu, MESH_TRANSPORT_STATUS_SEND_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06x: transmission fired\n", segmented_pdu, segmented_pdu->seq);
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06" PRIx32": transmission fired\n", segmented_pdu, segmented_pdu->seq);
|
||||
#endif
|
||||
|
||||
// re-queue message for sending remaining segments
|
||||
@ -759,7 +760,7 @@ static void mesh_lower_transport_outgoing_segment_transmission_fired(mesh_segmen
|
||||
static void mesh_lower_transport_outgoing_segment_transmission_timeout(btstack_timer_source_t * ts){
|
||||
mesh_segmented_pdu_t * segmented_pdu = (mesh_segmented_pdu_t *) btstack_run_loop_get_timer_context(ts);
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06x: transmission timer fired\n", segmented_pdu,
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06" PRIx32 ": transmission timer fired\n", segmented_pdu,
|
||||
segmented_pdu->seq);
|
||||
#endif
|
||||
segmented_pdu->flags &= ~MESH_TRANSPORT_FLAG_ACK_TIMER;
|
||||
@ -788,7 +789,7 @@ static void mesh_lower_transport_network_pdu_sent(mesh_network_pdu_t *network_pd
|
||||
|
||||
// of segmented message
|
||||
#ifdef LOG_LOWER_TRANSPORT
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06x: network pdu %p sent\n", lower_transport_outgoing_message,
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06" PRIx32 ": network pdu %p sent\n", lower_transport_outgoing_message,
|
||||
lower_transport_outgoing_message->seq, network_pdu);
|
||||
#endif
|
||||
|
||||
@ -925,7 +926,7 @@ static void mesh_lower_transport_run(void){
|
||||
case MESH_PDU_TYPE_SEGMENTED:
|
||||
message_pdu = (mesh_segmented_pdu_t *) pdu;
|
||||
//
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06x: run start sending now\n", message_pdu,
|
||||
printf("[+] Lower transport, segmented pdu %p, seq %06" PRIx32 ": run start sending now\n", message_pdu,
|
||||
message_pdu->seq);
|
||||
// start sending segmented pdu
|
||||
mesh_lower_transport_outgoing_setup_sending_segmented_pdus(message_pdu);
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#define BTSTACK_FILE__ "mesh_network.c"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -561,7 +562,7 @@ static void process_network_pdu_validate_d(void * arg){
|
||||
// check cache
|
||||
uint32_t hash = mesh_network_cache_hash(incoming_pdu_decoded);
|
||||
#ifdef LOG_NETWORK
|
||||
printf("RX-Hash (%p): %08x\n", incoming_pdu_decoded, hash);
|
||||
printf("RX-Hash (%p): %08" PRIx32 "\n", incoming_pdu_decoded, hash);
|
||||
#endif
|
||||
if (mesh_network_cache_find(hash)){
|
||||
// found in cache, drop
|
||||
@ -600,7 +601,7 @@ static uint32_t iv_index_for_pdu(const mesh_network_pdu_t * network_pdu){
|
||||
if ((iv_index & 1 ) ^ ivi){
|
||||
iv_index--;
|
||||
#ifdef LOG_NETWORK
|
||||
printf("RX-IV: IVI indicates previous IV index, using 0x%08x\n", iv_index);
|
||||
printf("RX-IV: IVI indicates previous IV index, using 0x%08" PRIx32 "\n", iv_index);
|
||||
#endif
|
||||
}
|
||||
return iv_index;
|
||||
|
@ -35,28 +35,21 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "btstack_tlv.h"
|
||||
#include "mesh/mesh_foundation.h"
|
||||
#include "mesh_upper_transport.h"
|
||||
#include "mesh/mesh.h"
|
||||
#include "mesh/mesh_proxy.h"
|
||||
#include "mesh/mesh_node.h"
|
||||
|
||||
#define BTSTACK_FILE__ "mesh_upper_transport.c"
|
||||
|
||||
#include "mesh/mesh_upper_transport.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack_bool.h"
|
||||
#include "btstack_tlv.h"
|
||||
#include "btstack_util.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_bool.h"
|
||||
|
||||
#include "mesh/beacon.h"
|
||||
#include "mesh/mesh_foundation.h"
|
||||
#include "mesh_upper_transport.h"
|
||||
#include "mesh/mesh_iv_index_seq_number.h"
|
||||
#include "mesh/mesh_keys.h"
|
||||
#include "mesh/mesh_lower_transport.h"
|
||||
@ -745,7 +738,7 @@ static void mesh_upper_transport_send_access(mesh_upper_transport_pdu_t * upper_
|
||||
UNUSED(payload_len);
|
||||
|
||||
// Dump PDU
|
||||
printf("[+] Upper transport, send upper (un)segmented Access PDU - dest %04x, seq %06x\n", upper_pdu->dst, upper_pdu->seq);
|
||||
printf("[+] Upper transport, send upper (un)segmented Access PDU - dest %04x, seq %06" PRIx32 "\n", upper_pdu->dst, upper_pdu->seq);
|
||||
mesh_print_hex("Access Payload", incoming_pdu_singleton.access.data, upper_pdu->len);
|
||||
|
||||
// setup nonce - uses dst, so after pseudo address translation
|
||||
@ -779,7 +772,7 @@ static void mesh_upper_transport_send_unsegmented_control_pdu(mesh_network_pdu_t
|
||||
mesh_network_pdu_set_seq(network_pdu, seq);
|
||||
// Dump PDU
|
||||
uint8_t opcode = network_pdu->data[9];
|
||||
printf("[+] Upper transport, send unsegmented Control PDU %p - seq %06x opcode %02x\n", network_pdu, seq, opcode);
|
||||
printf("[+] Upper transport, send unsegmented Control PDU %p - seq %06" PRIx32 " opcode %02x\n", network_pdu, seq, opcode);
|
||||
mesh_print_hex("Access Payload", &network_pdu->data[10], network_pdu->len - 10);
|
||||
|
||||
// send
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "pb_adv.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -177,8 +178,8 @@ static void pb_adv_device_link_timeout(btstack_timer_source_t * ts){
|
||||
UNUSED(ts);
|
||||
// timeout occured
|
||||
link_state = LINK_STATE_W4_OPEN;
|
||||
log_info("link timeout, %08x", pb_adv_link_id);
|
||||
printf("PB-ADV: Link timeout %08x\n", pb_adv_link_id);
|
||||
log_info("link timeout, %08" PRIx32, pb_adv_link_id);
|
||||
printf("PB-ADV: Link timeout %08" PRIx32 "\n", pb_adv_link_id);
|
||||
pb_adv_emit_link_close(pb_adv_cid, ERROR_CODE_PAGE_TIMEOUT);
|
||||
}
|
||||
|
||||
@ -206,8 +207,8 @@ static void pb_adv_handle_bearer_control(uint32_t link_id, uint8_t transaction_n
|
||||
pb_adv_provisioner_role = 0;
|
||||
pb_adv_msg_in_transaction_nr = 0xff; // first transaction nr will be 0x00
|
||||
pb_adv_msg_in_transaction_nr_prev = 0xff;
|
||||
log_info("link open, id %08x", pb_adv_link_id);
|
||||
printf("PB-ADV: Link Open %08x\n", pb_adv_link_id);
|
||||
log_info("link open, id %08" PRIx32, pb_adv_link_id);
|
||||
printf("PB-ADV: Link Open %08" PRIx32 "\n", pb_adv_link_id);
|
||||
link_state = LINK_STATE_W2_SEND_ACK;
|
||||
adv_bearer_request_can_send_now_for_provisioning_pdu();
|
||||
pb_adv_emit_link_open(ERROR_CODE_SUCCESS, pb_adv_cid);
|
||||
@ -230,8 +231,8 @@ static void pb_adv_handle_bearer_control(uint32_t link_id, uint8_t transaction_n
|
||||
pb_adv_msg_in_transaction_nr = 0x7f; // first transaction nr will be 0x80
|
||||
pb_adv_msg_in_transaction_nr_prev = 0x7f;
|
||||
btstack_run_loop_remove_timer(&pb_adv_link_timer);
|
||||
log_info("link open, id %08x", pb_adv_link_id);
|
||||
printf("PB-ADV: Link Open %08x\n", pb_adv_link_id);
|
||||
log_info("link open, id %08" PRIx32, pb_adv_link_id);
|
||||
printf("PB-ADV: Link Open %08" PRIx32 "\n", pb_adv_link_id);
|
||||
pb_adv_emit_link_open(ERROR_CODE_SUCCESS, pb_adv_cid);
|
||||
break;
|
||||
#endif
|
||||
@ -513,7 +514,7 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
buffer[5] = (0 << 2) | 3; // Link Open | Provisioning Bearer Control
|
||||
(void)memcpy(&buffer[6], pb_adv_peer_device_uuid, 16);
|
||||
adv_bearer_send_provisioning_pdu(buffer, sizeof(buffer));
|
||||
log_info("link open %08x", pb_adv_link_id);
|
||||
log_info("link open %08" PRIx32, pb_adv_link_id);
|
||||
printf("PB-ADV: Sending Link Open for device uuid: ");
|
||||
printf_hexdump(pb_adv_peer_device_uuid, 16);
|
||||
btstack_run_loop_set_timer_handler(&pb_adv_link_timer, &pb_adv_timer_handler);
|
||||
@ -523,8 +524,8 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
}
|
||||
#endif
|
||||
if (link_state == LINK_STATE_CLOSING){
|
||||
log_info("link close %08x", pb_adv_link_id);
|
||||
printf("PB-ADV: Sending Link Close %08x\n", pb_adv_link_id);
|
||||
log_info("link close %08" PRIx32, pb_adv_link_id);
|
||||
printf("PB-ADV: Sending Link Close %08" PRIx32 "\n", pb_adv_link_id);
|
||||
// build packet
|
||||
uint8_t buffer[7];
|
||||
big_endian_store_32(buffer, 0, pb_adv_link_id);
|
||||
@ -549,8 +550,8 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
buffer[4] = 0;
|
||||
buffer[5] = (1 << 2) | 3; // Link Ack | Provisioning Bearer Control
|
||||
adv_bearer_send_provisioning_pdu(buffer, sizeof(buffer));
|
||||
log_info("link ack %08x", pb_adv_link_id);
|
||||
printf("PB-ADV: Sending Link Open Ack %08x\n", pb_adv_link_id);
|
||||
log_info("link ack %08" PRIx32, pb_adv_link_id);
|
||||
printf("PB-ADV: Sending Link Open Ack %08" PRIx32 "\n", pb_adv_link_id);
|
||||
break;
|
||||
}
|
||||
if (pb_adv_msg_in_send_ack){
|
||||
@ -560,7 +561,7 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
buffer[4] = pb_adv_msg_in_transaction_nr_prev;
|
||||
buffer[5] = MESH_GPCF_TRANSACTION_ACK;
|
||||
adv_bearer_send_provisioning_pdu(buffer, sizeof(buffer));
|
||||
log_info("transaction ack %08x", pb_adv_link_id);
|
||||
log_info("transaction ack %08" PRIx32, pb_adv_link_id);
|
||||
printf("PB-ADV: %02x sending ACK\n", pb_adv_msg_in_transaction_nr_prev);
|
||||
pb_adv_run();
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user