From 4662af4a88ca1e7d6d85dcfaea44271a9a60ea26 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 27 Jun 2019 11:39:11 +0200 Subject: [PATCH] mesh: streamline adv + gatt baerer api: network pdu, provisioning pdu, beacon --- src/mesh/adv_bearer.c | 18 +++++++++--------- src/mesh/adv_bearer.h | 18 +++++++++--------- src/mesh/beacon.c | 17 +++++++++-------- src/mesh/gatt_bearer.c | 12 ++++++------ src/mesh/gatt_bearer.h | 12 ++++++------ src/mesh/mesh_network.c | 17 ++++++++++------- src/mesh/pb_adv.c | 24 ++++++++++++------------ test/mesh/btstack_config.h | 2 +- test/mesh/mesh_message_test.c | 16 ++++++---------- test/mesh/provisioner.c | 2 +- 10 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/mesh/adv_bearer.c b/src/mesh/adv_bearer.c index cd3d4d9fb..020b810f9 100644 --- a/src/mesh/adv_bearer.c +++ b/src/mesh/adv_bearer.c @@ -310,39 +310,39 @@ void adv_bearer_init(void){ // adv bearer packet handler regisration -void adv_bearer_register_for_mesh_message(btstack_packet_handler_t packet_handler){ +void adv_bearer_register_for_network_pdu(btstack_packet_handler_t packet_handler){ client_callbacks[MESH_NETWORK_ID] = packet_handler; } -void adv_bearer_register_for_mesh_beacon(btstack_packet_handler_t packet_handler){ +void adv_bearer_register_for_beacon(btstack_packet_handler_t packet_handler){ client_callbacks[MESH_BEACON_ID] = packet_handler; } -void adv_bearer_register_for_pb_adv(btstack_packet_handler_t packet_handler){ +void adv_bearer_register_for_provisioning_pdu(btstack_packet_handler_t packet_handler){ client_callbacks[PB_ADV_ID] = packet_handler; } // adv bearer request to send -void adv_bearer_request_can_send_now_for_mesh_message(void){ +void adv_bearer_request_can_send_now_for_network_pdu(void){ adv_bearer_request(MESH_NETWORK_ID); } -void adv_bearer_request_can_send_now_for_mesh_beacon(void){ +void adv_bearer_request_can_send_now_for_beacon(void){ adv_bearer_request(MESH_BEACON_ID); } -void adv_bearer_request_can_send_now_for_pb_adv(void){ +void adv_bearer_request_can_send_now_for_provisioning_pdu(void){ adv_bearer_request(PB_ADV_ID); } // adv bearer send message -void adv_bearer_send_mesh_message(const uint8_t * data, uint16_t data_len){ +void adv_bearer_send_network_pdu(const uint8_t * data, uint16_t data_len){ adv_bearer_prepare_message(data, data_len, BLUETOOTH_DATA_TYPE_MESH_MESSAGE); adv_bearer_run(); } -void adv_bearer_send_mesh_beacon(const uint8_t * data, uint16_t data_len){ +void adv_bearer_send_beacon(const uint8_t * data, uint16_t data_len){ adv_bearer_prepare_message(data, data_len, BLUETOOTH_DATA_TYPE_MESH_BEACON); adv_bearer_run(); } -void adv_bearer_send_pb_adv(const uint8_t * data, uint16_t data_len){ +void adv_bearer_send_provisioning_pdu(const uint8_t * data, uint16_t data_len){ adv_bearer_prepare_message(data, data_len, BLUETOOTH_DATA_TYPE_PB_ADV); adv_bearer_run(); } diff --git a/src/mesh/adv_bearer.h b/src/mesh/adv_bearer.h index b55a28c12..1986a667a 100644 --- a/src/mesh/adv_bearer.h +++ b/src/mesh/adv_bearer.h @@ -102,25 +102,25 @@ void adv_bearer_advertisements_enable(int enabled); /** * Register listener for particular message types: Mesh Message, Mesh Beacon, PB-ADV */ -void adv_bearer_register_for_mesh_message(btstack_packet_handler_t packet_handler); -void adv_bearer_register_for_mesh_beacon(btstack_packet_handler_t packet_handler); -void adv_bearer_register_for_pb_adv(btstack_packet_handler_t packet_handler); +void adv_bearer_register_for_network_pdu(btstack_packet_handler_t packet_handler); +void adv_bearer_register_for_beacon(btstack_packet_handler_t packet_handler); +void adv_bearer_register_for_provisioning_pdu(btstack_packet_handler_t packet_handler); /** * Request can send now event for particular message type: Mesh Message, Mesh Beacon, PB-ADV */ -void adv_bearer_request_can_send_now_for_mesh_message(void); -void adv_bearer_request_can_send_now_for_mesh_beacon(void); -void adv_bearer_request_can_send_now_for_pb_adv(void); +void adv_bearer_request_can_send_now_for_network_pdu(void); +void adv_bearer_request_can_send_now_for_beacon(void); +void adv_bearer_request_can_send_now_for_provisioning_pdu(void); /** * Send particular message type: Mesh Message, Mesh Beacon, PB-ADV * @param data to send * @param data_len max 29 bytes */ -void adv_bearer_send_mesh_message(const uint8_t * network_pdu, uint16_t size); -void adv_bearer_send_mesh_beacon(const uint8_t * beacon_update, uint16_t size); -void adv_bearer_send_pb_adv(const uint8_t * pb_adv_pdu, uint16_t size); +void adv_bearer_send_network_pdu(const uint8_t * network_pdu, uint16_t size); +void adv_bearer_send_beacon(const uint8_t * beacon_update, uint16_t size); +void adv_bearer_send_provisioning_pdu(const uint8_t * pb_adv_pdu, uint16_t size); #if defined __cplusplus diff --git a/src/mesh/beacon.c b/src/mesh/beacon.c index 613940d8c..b9c6c4560 100644 --- a/src/mesh/beacon.c +++ b/src/mesh/beacon.c @@ -42,6 +42,7 @@ #include "mesh/beacon.h" #include "mesh/adv_bearer.h" #include "mesh/gatt_bearer.h" +#include "mesh_foundation.h" #include "ble/core.h" #include "bluetooth.h" #include "bluetooth_data_types.h" @@ -107,7 +108,7 @@ static void beacon_timer_handler(btstack_timer_source_t * ts){ // request to send beacon_send_device_beacon = 1; - adv_bearer_request_can_send_now_for_mesh_beacon(); + adv_bearer_request_can_send_now_for_beacon(); } #endif @@ -203,7 +204,7 @@ static void mesh_secure_network_beacon_run(btstack_timer_source_t * ts){ #ifdef ENABLE_MESH_ADV_BEARER subnet->beacon_state = MESH_SECURE_NETWORK_BEACON_W2_SEND_ADV; - adv_bearer_request_can_send_now_for_mesh_beacon(); + adv_bearer_request_can_send_now_for_beacon(); break; #endif subnet->beacon_state = MESH_SECURE_NETWORK_BEACON_ADV_SENT; @@ -215,7 +216,7 @@ static void mesh_secure_network_beacon_run(btstack_timer_source_t * ts){ #ifdef ENABLE_MESH_GATT_BEARER if (gatt_bearer_con_handle != HCI_CON_HANDLE_INVALID && mesh_foundation_gatt_proxy_get() != 0){ subnet->beacon_state = MESH_SECURE_NETWORK_BEACON_W2_SEND_GATT; - gatt_bearer_request_can_send_now_for_mesh_beacon(); + gatt_bearer_request_can_send_now_for_beacon(); break; } #endif @@ -322,7 +323,7 @@ static void beacon_adv_packet_handler (uint8_t packet_type, uint16_t channel, ui case MESH_SUBEVENT_CAN_SEND_NOW: if (beacon_send_device_beacon){ beacon_send_device_beacon = 0; - adv_bearer_send_mesh_beacon(mesh_beacon_data, mesh_beacon_len); + adv_bearer_send_beacon(mesh_beacon_data, mesh_beacon_len); break; } // secure beacon state machine @@ -331,7 +332,7 @@ static void beacon_adv_packet_handler (uint8_t packet_type, uint16_t channel, ui mesh_network_key_t * subnet = mesh_network_key_iterator_get_next(&it); switch (subnet->beacon_state){ case MESH_SECURE_NETWORK_BEACON_W2_SEND_ADV: - adv_bearer_send_mesh_beacon(mesh_beacon_data, mesh_beacon_len); + adv_bearer_send_beacon(mesh_beacon_data, mesh_beacon_len); subnet->beacon_state = MESH_SECURE_NETWORK_BEACON_ADV_SENT; mesh_secure_network_beacon_run(NULL); break; @@ -368,7 +369,7 @@ static void beacon_gatt_handle_mesh_event(uint8_t mesh_subevent){ case MESH_SECURE_NETWORK_BEACON_W2_SEND_GATT: // skip send on MESH_SUBEVENT_PROXY_DISCONNECTED if (mesh_subevent == MESH_SUBEVENT_CAN_SEND_NOW){ - gatt_bearer_send_mesh_beacon(mesh_beacon_data, mesh_beacon_len); + gatt_bearer_send_beacon(mesh_beacon_data, mesh_beacon_len); } subnet->beacon_state = MESH_SECURE_NETWORK_BEACON_GATT_SENT; mesh_secure_network_beacon_run(NULL); @@ -417,11 +418,11 @@ static void beacon_gatt_packet_handler (uint8_t packet_type, uint16_t channel, u void beacon_init(void){ #ifdef ENABLE_MESH_ADV_BEARER - adv_bearer_register_for_mesh_beacon(&beacon_adv_packet_handler); + adv_bearer_register_for_beacon(&beacon_adv_packet_handler); #endif #ifdef ENABLE_MESH_GATT_BEARER gatt_bearer_con_handle = HCI_CON_HANDLE_INVALID; - gatt_bearer_register_for_mesh_beacon(&beacon_gatt_packet_handler); + gatt_bearer_register_for_beacon(&beacon_gatt_packet_handler); #endif } diff --git a/src/mesh/gatt_bearer.c b/src/mesh/gatt_bearer.c index b3d93e5e8..f1c070fda 100644 --- a/src/mesh/gatt_bearer.c +++ b/src/mesh/gatt_bearer.c @@ -288,20 +288,20 @@ void gatt_bearer_init(void){ mesh_proxy_service_server_register_packet_handler(packet_handler); } -void gatt_bearer_register_for_mesh_network_pdu(btstack_packet_handler_t _packet_handler){ +void gatt_bearer_register_for_network_pdu(btstack_packet_handler_t _packet_handler){ client_callbacks[MESH_MSG_TYPE_NETWORK_PDU] = _packet_handler; } -void gatt_bearer_register_for_mesh_beacon(btstack_packet_handler_t _packet_handler){ +void gatt_bearer_register_for_beacon(btstack_packet_handler_t _packet_handler){ client_callbacks[MESH_MSG_TYPE_BEACON] = _packet_handler; } void gatt_bearer_register_for_mesh_proxy_configuration(btstack_packet_handler_t _packet_handler){ client_callbacks[MESH_MSG_TYPE_PROXY_CONFIGURATION] = _packet_handler; } -void gatt_bearer_request_can_send_now_for_mesh_network_pdu(void){ +void gatt_bearer_request_can_send_now_for_network_pdu(void){ gatt_bearer_request(MESH_MSG_TYPE_NETWORK_PDU); } -void gatt_bearer_request_can_send_now_for_mesh_beacon(void){ +void gatt_bearer_request_can_send_now_for_beacon(void){ gatt_bearer_request(MESH_MSG_TYPE_BEACON); } void gatt_bearer_request_can_send_now_for_mesh_proxy_configuration(void){ @@ -326,12 +326,12 @@ static void gatt_bearer_send_pdu(uint16_t con_handle, const uint8_t * pdu, uint1 gatt_bearer_start_sending(con_handle); } -void gatt_bearer_send_mesh_network_pdu(const uint8_t * data, uint16_t data_len){ +void gatt_bearer_send_network_pdu(const uint8_t * data, uint16_t data_len){ msg_type = MESH_MSG_TYPE_NETWORK_PDU; gatt_bearer_send_pdu(gatt_bearer_con_handle, data, data_len); } -void gatt_bearer_send_mesh_beacon(const uint8_t * data, uint16_t data_len){ +void gatt_bearer_send_beacon(const uint8_t * data, uint16_t data_len){ msg_type = MESH_MSG_TYPE_BEACON; gatt_bearer_send_pdu(gatt_bearer_con_handle, data, data_len); } diff --git a/src/mesh/gatt_bearer.h b/src/mesh/gatt_bearer.h index db6caad08..ac7750b6f 100644 --- a/src/mesh/gatt_bearer.h +++ b/src/mesh/gatt_bearer.h @@ -54,15 +54,15 @@ void gatt_bearer_init(void); /** * Register listener for particular message types: Mesh Message, Mesh Beacon, proxy configuration */ -void gatt_bearer_register_for_mesh_network_pdu(btstack_packet_handler_t packet_handler); -void gatt_bearer_register_for_mesh_beacon(btstack_packet_handler_t packet_handler); +void gatt_bearer_register_for_network_pdu(btstack_packet_handler_t packet_handler); +void gatt_bearer_register_for_beacon(btstack_packet_handler_t packet_handler); void gatt_bearer_register_for_mesh_proxy_configuration(btstack_packet_handler_t _packet_handler); /** * Request can send now event for particular message type: Mesh Message, Mesh Beacon, proxy configuration */ -void gatt_bearer_request_can_send_now_for_mesh_network_pdu(void); -void gatt_bearer_request_can_send_now_for_mesh_beacon(void); +void gatt_bearer_request_can_send_now_for_network_pdu(void); +void gatt_bearer_request_can_send_now_for_beacon(void); void gatt_bearer_request_can_send_now_for_mesh_proxy_configuration(void); /** @@ -70,8 +70,8 @@ void gatt_bearer_request_can_send_now_for_mesh_proxy_configuration(void); * @param data to send * @param data_len max 29 bytes */ -void gatt_bearer_send_mesh_network_pdu(const uint8_t * network_pdu, uint16_t size); -void gatt_bearer_send_mesh_beacon(const uint8_t * beacon_update, uint16_t size); +void gatt_bearer_send_network_pdu(const uint8_t * network_pdu, uint16_t size); +void gatt_bearer_send_beacon(const uint8_t * beacon_update, uint16_t size); void gatt_bearer_send_mesh_proxy_configuration(const uint8_t * proxy_configuration, uint16_t size); /* Utility functions */ diff --git a/src/mesh/mesh_network.c b/src/mesh/mesh_network.c index d9aa92a7d..bd730e64b 100644 --- a/src/mesh/mesh_network.c +++ b/src/mesh/mesh_network.c @@ -574,14 +574,14 @@ static void mesh_network_run(void){ // request to send via gatt if (send_to_next_bearer){ send_to_next_bearer = 0; - gatt_bearer_request_can_send_now_for_mesh_network_pdu(); + gatt_bearer_request_can_send_now_for_network_pdu(); } #endif #ifdef ENABLE_MESH_ADV_BEARER // request to send via adv if (send_to_next_bearer){ send_to_next_bearer = 0; - adv_bearer_request_can_send_now_for_mesh_message(); + adv_bearer_request_can_send_now_for_network_pdu(); } #endif if (send_to_next_bearer == 1){ @@ -635,7 +635,7 @@ static void mesh_adv_message_handler(uint8_t packet_type, uint16_t channel, uint printf("TX-E-NetworkPDU (%p): ", actual_bearer_network_pdu); printf_hexdump(actual_bearer_network_pdu->data, actual_bearer_network_pdu->len); #endif - adv_bearer_send_mesh_message(actual_bearer_network_pdu->data, actual_bearer_network_pdu->len); + adv_bearer_send_network_pdu(actual_bearer_network_pdu->data, actual_bearer_network_pdu->len); network_pdu = actual_bearer_network_pdu; actual_bearer_network_pdu = NULL; @@ -659,7 +659,10 @@ static void mesh_adv_message_handler(uint8_t packet_type, uint16_t channel, uint #ifdef ENABLE_MESH_GATT_BEARER void mesh_gatt_handle_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ +#ifndef ENABLE_MESH_ADV_BEARER mesh_network_pdu_t * network_pdu; +#endif + switch (packet_type){ case HCI_EVENT_PACKET: switch(packet[0]){ @@ -671,14 +674,14 @@ void mesh_gatt_handle_event(uint8_t packet_type, uint16_t channel, uint8_t *pack printf("G-TX-E-NetworkPDU (%p): ", actual_bearer_network_pdu); printf_hexdump(actual_bearer_network_pdu->data, actual_bearer_network_pdu->len); #endif - gatt_bearer_send_mesh_network_pdu(actual_bearer_network_pdu->data, actual_bearer_network_pdu->len); + gatt_bearer_send_network_pdu(actual_bearer_network_pdu->data, actual_bearer_network_pdu->len); break; case MESH_SUBEVENT_MESSAGE_SENT: if (actual_bearer_network_pdu == NULL) break; #ifdef ENABLE_MESH_ADV_BEARER // request to send via adv bearer - adv_bearer_request_can_send_now_for_mesh_message(); + adv_bearer_request_can_send_now_for_network_pdu(); break; #else // notify upper layer @@ -735,10 +738,10 @@ static void mesh_proxy_packet_handler_network_pdu(uint8_t packet_type, uint16_t void mesh_network_init(void){ #ifdef ENABLE_MESH_ADV_BEARER - adv_bearer_register_for_mesh_message(&mesh_adv_message_handler); + adv_bearer_register_for_network_pdu(&mesh_adv_message_handler); #endif #ifdef ENABLE_MESH_GATT_BEARER - gatt_bearer_register_for_mesh_network_pdu(&mesh_proxy_packet_handler_network_pdu); + gatt_bearer_register_for_network_pdu(&mesh_proxy_packet_handler_network_pdu); #endif } diff --git a/src/mesh/pb_adv.c b/src/mesh/pb_adv.c index f537bcd65..6e7e5fbf1 100644 --- a/src/mesh/pb_adv.c +++ b/src/mesh/pb_adv.c @@ -168,14 +168,14 @@ static void pb_adv_handle_bearer_control(uint32_t link_id, uint8_t transaction_n log_info("link open, id %08x", pb_adv_link_id); printf("PB-ADV: Link Open %08x\n", pb_adv_link_id); link_state = LINK_STATE_W2_SEND_ACK; - adv_bearer_request_can_send_now_for_pb_adv(); + adv_bearer_request_can_send_now_for_provisioning_pdu(); pb_adv_emit_link_open(0, pb_adv_cid); break; case LINK_STATE_OPEN: if (pb_adv_link_id != link_id) break; log_info("link open, resend ACK"); link_state = LINK_STATE_W2_SEND_ACK; - adv_bearer_request_can_send_now_for_pb_adv(); + adv_bearer_request_can_send_now_for_provisioning_pdu(); break; default: break; @@ -367,7 +367,7 @@ static int pb_adv_packet_to_send(void){ static void pb_adv_timer_handler(btstack_timer_source_t * ts){ pb_adv_random_delay_active = 0; if (!pb_adv_packet_to_send()) return; - adv_bearer_request_can_send_now_for_pb_adv(); + adv_bearer_request_can_send_now_for_provisioning_pdu(); } static void pb_adv_run(void){ @@ -440,7 +440,7 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe buffer[4] = 0; // Transaction ID = 0 buffer[5] = (0 << 2) | 3; // Link Open | Provisioning Bearer Control memcpy(&buffer[6], pb_adv_peer_device_uuid, 16); - adv_bearer_send_pb_adv(buffer, sizeof(buffer)); + adv_bearer_send_provisioning_pdu(buffer, sizeof(buffer)); log_info("link open %08x", pb_adv_link_id); printf("PB-ADV: Sending Link Open for device uuid: "); printf_hexdump(pb_adv_peer_device_uuid, 16); @@ -458,10 +458,10 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe buffer[4] = 0; // Transaction ID = 0 buffer[5] = (2 << 2) | 3; // Link Close | Provisioning Bearer Control buffer[6] = pb_adv_link_close_reason; - adv_bearer_send_pb_adv(buffer, sizeof(buffer)); + adv_bearer_send_provisioning_pdu(buffer, sizeof(buffer)); pb_adv_link_close_countdown--; if (pb_adv_link_close_countdown) { - adv_bearer_request_can_send_now_for_pb_adv(); + adv_bearer_request_can_send_now_for_provisioning_pdu(); } else { link_state = LINK_STATE_W4_OPEN; } @@ -475,7 +475,7 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe big_endian_store_32(buffer, 0, pb_adv_link_id); buffer[4] = 0; buffer[5] = (1 << 2) | 3; // Link Ack | Provisioning Bearer Control - adv_bearer_send_pb_adv(buffer, sizeof(buffer)); + adv_bearer_send_provisioning_pdu(buffer, sizeof(buffer)); log_info("link ack %08x", pb_adv_link_id); printf("PB-ADV: Sending Link Open Ack\n"); break; @@ -486,7 +486,7 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe big_endian_store_32(buffer, 0, pb_adv_link_id); buffer[4] = pb_adv_msg_in_transaction_nr_prev; buffer[5] = MESH_GPCF_TRANSACTION_ACK; - adv_bearer_send_pb_adv(buffer, sizeof(buffer)); + adv_bearer_send_provisioning_pdu(buffer, sizeof(buffer)); log_info("transaction ack %08x", pb_adv_link_id); printf("PB-ADV: %02x sending ACK\n", pb_adv_msg_in_transaction_nr_prev); pb_adv_run(); @@ -537,7 +537,7 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe // done pb_adv_msg_out_pos = 0; } - adv_bearer_send_pb_adv(buffer, pos); + adv_bearer_send_provisioning_pdu(buffer, pos); pb_adv_run(); break; } @@ -552,7 +552,7 @@ static void pb_adv_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe void pb_adv_init(uint8_t * device_uuid){ pb_adv_own_device_uuid = device_uuid; - adv_bearer_register_for_pb_adv(&pb_adv_handler); + adv_bearer_register_for_provisioning_pdu(&pb_adv_handler); pb_adv_lfsr = 0x12345678; pb_adv_random(); } @@ -586,7 +586,7 @@ void pb_adv_close_link(uint16_t pb_adv_cid, uint8_t reason){ link_state = LINK_STATE_CLOSING; pb_adv_link_close_countdown = 3; pb_adv_link_close_reason = reason; - adv_bearer_request_can_send_now_for_pb_adv(); + adv_bearer_request_can_send_now_for_provisioning_pdu(); break; case LINK_STATE_W4_OPEN: case LINK_STATE_CLOSING: @@ -609,7 +609,7 @@ uint16_t pb_adv_create_link(const uint8_t * device_uuid){ link_state = LINK_STATE_W4_ACK; // request outgoing - adv_bearer_request_can_send_now_for_pb_adv(); + adv_bearer_request_can_send_now_for_provisioning_pdu(); // dummy pb_adv_cid return pb_adv_cid; diff --git a/test/mesh/btstack_config.h b/test/mesh/btstack_config.h index 55b2aa2b2..08e0edc50 100644 --- a/test/mesh/btstack_config.h +++ b/test/mesh/btstack_config.h @@ -21,7 +21,7 @@ #define ENABLE_MICRO_ECC_P256 // Mesh Config -// #define ENABLE_MESH_ADV_BEARER +#define ENABLE_MESH_ADV_BEARER #define ENABLE_MESH_GATT_BEARER // #define ENABLE_MESH_PB_ADV #define ENABLE_MESH_PB_GATT diff --git a/test/mesh/mesh_message_test.c b/test/mesh/mesh_message_test.c index 95d97ba10..ab84b213b 100644 --- a/test/mesh/mesh_message_test.c +++ b/test/mesh/mesh_message_test.c @@ -29,11 +29,10 @@ static uint16_t recv_upper_transport_pdu_len; #ifdef ENABLE_MESH_ADV_BEARER static btstack_packet_handler_t adv_packet_handler; -void adv_bearer_register_for_mesh_message(btstack_packet_handler_t packet_handler){ +void adv_bearer_register_for_network_pdu(btstack_packet_handler_t packet_handler){ adv_packet_handler = packet_handler; } -void adv_bearer_request_can_send_now_for_mesh_message(void){ - printf("adv_bearer_request_can_send_now_for_mesh_message\n"); +void adv_bearer_request_can_send_now_for_network_pdu(void){ // simulate can send now uint8_t event[3]; event[0] = HCI_EVENT_MESH_META; @@ -41,8 +40,7 @@ void adv_bearer_request_can_send_now_for_mesh_message(void){ event[2] = MESH_SUBEVENT_CAN_SEND_NOW; (*adv_packet_handler)(HCI_EVENT_PACKET, 0, &event[0], sizeof(event)); } -void adv_bearer_send_mesh_message(const uint8_t * network_pdu, uint16_t size){ - printf("adv_bearer_send_mesh_message: \n"); +void adv_bearer_send_network_pdu(const uint8_t * network_pdu, uint16_t size){ printf_hexdump(network_pdu, size); memcpy(sent_network_pdu_data, network_pdu, size); sent_network_pdu_len = size; @@ -58,11 +56,10 @@ void adv_bearer_emit_sent(void){ #ifdef ENABLE_MESH_GATT_BEARER static btstack_packet_handler_t gatt_packet_handler; -void gatt_bearer_register_for_mesh_network_pdu(btstack_packet_handler_t packet_handler){ +void gatt_bearer_register_for_network_pdu(btstack_packet_handler_t packet_handler){ gatt_packet_handler = packet_handler; } -void gatt_bearer_request_can_send_now_for_mesh_network_pdu(void){ - printf("gatt_bearer_request_can_send_now_for_mesh_network_pdu\n"); +void gatt_bearer_request_can_send_now_for_network_pdu(void){ // simulate can send now uint8_t event[3]; event[0] = HCI_EVENT_MESH_META; @@ -70,8 +67,7 @@ void gatt_bearer_request_can_send_now_for_mesh_network_pdu(void){ event[2] = MESH_SUBEVENT_CAN_SEND_NOW; (*gatt_packet_handler)(HCI_EVENT_PACKET, 0, &event[0], sizeof(event)); } -void gatt_bearer_send_mesh_network_pdu(const uint8_t * network_pdu, uint16_t size){ - printf("gatt_bearer_send_mesh_network_pdu: \n"); +void gatt_bearer_send_network_pdu(const uint8_t * network_pdu, uint16_t size){ printf_hexdump(network_pdu, size); memcpy(sent_network_pdu_data, network_pdu, size); sent_network_pdu_len = size; diff --git a/test/mesh/provisioner.c b/test/mesh/provisioner.c index 7bc1f80db..32ea406c7 100644 --- a/test/mesh/provisioner.c +++ b/test/mesh/provisioner.c @@ -293,7 +293,7 @@ int btstack_main(void) // mesh adv_bearer_init(); - adv_bearer_register_for_mesh_message(&mesh_message_handler); + adv_bearer_register_for_network_pdu(&mesh_message_handler); beacon_init(); beacon_register_for_unprovisioned_device_beacons(&mesh_unprovisioned_beacon_handler);