mesh: add type pb_type_t, rename ADV to TRANSPORT in events

This commit is contained in:
Milanka Ringwald 2018-11-16 10:12:06 +01:00 committed by Matthias Ringwald
parent beeedc4565
commit 26ecb6246e
12 changed files with 136 additions and 118 deletions

View File

@ -85,15 +85,16 @@ static hci_con_handle_t get_con_handle(void){
return mesh_provisioning.con_handle;
}
static void pb_adv_emit_link_open(uint8_t status, uint16_t pb_adv_cid){
uint8_t event[6] = { HCI_EVENT_MESH_META, 6, MESH_PB_ADV_LINK_OPEN, status};
little_endian_store_16(event, 4, pb_adv_cid);
static void pb_adv_emit_link_open(hci_con_handle_t con_handle, uint8_t status){
uint8_t event[6] = { HCI_EVENT_MESH_META, 6, MESH_PB_TRANSPORT_LINK_OPEN, status, PB_TYPE_GATT};
little_endian_store_16(event, 4, con_handle);
event[5] = PB_TYPE_GATT;
mesh_provisioning_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
static void pb_adv_emit_link_close(uint16_t pb_adv_cid, uint8_t reason){
uint8_t event[5] = { HCI_EVENT_MESH_META, 6, MESH_PB_ADV_LINK_CLOSED};
little_endian_store_16(event, 4, pb_adv_cid);
static void pb_adv_emit_link_close(hci_con_handle_t con_handle, uint8_t reason){
uint8_t event[5] = { HCI_EVENT_MESH_META, 6, MESH_PB_TRANSPORT_LINK_CLOSED};
little_endian_store_16(event, 4, con_handle);
mesh_provisioning_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
@ -139,7 +140,7 @@ static int mesh_provisioning_service_write_callback(hci_con_handle_t con_handle,
if (instance->data_out_client_configuration_descriptor_value){
pb_adv_emit_link_close(con_handle, 0);
} else {
pb_adv_emit_link_open(0, con_handle);
pb_adv_emit_link_open(con_handle, 0);
}
return 0;
}
@ -257,7 +258,7 @@ void pb_adv_init(const uint8_t * device_uuid){
}
static void pb_adv_emit_pdu_sent(uint8_t status){
uint8_t event[] = {HCI_EVENT_MESH_META, 2, MESH_PB_ADV_PDU_SENT, status};
uint8_t event[] = {HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status};
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
@ -353,8 +354,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
switch (hci_event_packet_get_type(packet)) {
case HCI_EVENT_MESH_META:
switch (hci_event_mesh_meta_get_subevent_code(packet)){
case MESH_PB_ADV_LINK_OPEN:
case MESH_PB_ADV_LINK_CLOSED:
case MESH_PB_TRANSPORT_LINK_OPEN:
case MESH_PB_TRANSPORT_LINK_CLOSED:
// Forward link open/close
pb_gatt_mtu = ATT_DEFAULT_MTU;
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, packet, size);

View File

@ -43,6 +43,7 @@
#include <string.h>
#include "ble/mesh/adv_bearer.h"
#include "ble/mesh/beacon.h"
#include "provisioning.h"
#include "btstack_util.h"
#include "btstack_debug.h"
#include "btstack_event.h"
@ -133,18 +134,19 @@ static uint32_t pb_adv_random(void){
}
static void pb_adv_emit_pdu_sent(uint8_t status){
uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_PB_ADV_PDU_SENT, status};
uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status};
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
static void pb_adv_emit_link_open(uint8_t status, uint16_t pb_adv_cid){
uint8_t event[6] = { HCI_EVENT_MESH_META, 6, MESH_PB_ADV_LINK_OPEN, status};
uint8_t event[6] = { HCI_EVENT_MESH_META, 6, MESH_PB_TRANSPORT_LINK_OPEN, status};
little_endian_store_16(event, 4, pb_adv_cid);
event[5] = PB_TYPE_ADV;
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
static void pb_adv_emit_link_close(uint16_t pb_adv_cid, uint8_t reason){
uint8_t event[5] = { HCI_EVENT_MESH_META, 6, MESH_PB_ADV_LINK_CLOSED};
uint8_t event[5] = { HCI_EVENT_MESH_META, 6, MESH_PB_TRANSPORT_LINK_CLOSED};
little_endian_store_16(event, 4, pb_adv_cid);
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}

View File

@ -2321,28 +2321,29 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code
* @param status
*/
#define MESH_PB_ADV_PDU_SENT 0x02
#define MESH_PB_TRANSPORT_PDU_SENT 0x02
/**
* @format 1121
* @param subevent_code
* @param status
* @param pb_transport_cid
* @param pb_type
*/
#define MESH_PB_TRANSPORT_LINK_OPEN 0x03
/**
* @format 112
* @param subevent_code
* @param status
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_ADV_LINK_OPEN 0x03
/**
* @format 112
* @param subevent_code
* @param status
* @param pb_adv_cid
*/
#define MESH_PB_ADV_LINK_CLOSED 0x04
#define MESH_PB_TRANSPORT_LINK_CLOSED 0x04
/**
* @format 121
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
* @param attention_time in seconds
*/
#define MESH_PB_PROV_ATTENTION_TIMER 0x10
@ -2351,7 +2352,7 @@ typedef uint8_t sm_key_t[16];
* Device Role
* @format 12
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_PROV_START_EMIT_PUBLIC_KEY_OOB 0x11
@ -2359,7 +2360,7 @@ typedef uint8_t sm_key_t[16];
* Device Role
* @format 12
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB 0x12
@ -2367,7 +2368,7 @@ typedef uint8_t sm_key_t[16];
* Device Role
* @format 12
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_PROV_INPUT_OOB_REQUEST 0x13
@ -2375,7 +2376,7 @@ typedef uint8_t sm_key_t[16];
* Device Role
* @format 124
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
* @param output_oob number
*/
#define MESH_PB_PROV_START_EMIT_OUTPUT_OOB 0x15
@ -2384,7 +2385,7 @@ typedef uint8_t sm_key_t[16];
* Device Role
* @format 12
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_PROV_STOP_EMIT_OUTPUT_OOB 0x16
@ -2392,7 +2393,7 @@ typedef uint8_t sm_key_t[16];
* Provisioner Role
* @format 12
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB 0x17
@ -2400,7 +2401,7 @@ typedef uint8_t sm_key_t[16];
* Provisioner Role
* @format 12
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_PROV_STOP_RECEIVE_PUBLIC_KEY_OOB 0x18
@ -2408,7 +2409,7 @@ typedef uint8_t sm_key_t[16];
* Provisioner Role
* @format 12
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_PROV_OUTPUT_OOB_REQUEST 0x19
@ -2416,7 +2417,7 @@ typedef uint8_t sm_key_t[16];
* Provisioner Role
* @format 124
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
* @param output_oob number
*/
#define MESH_PB_PROV_START_EMIT_INPUT_OOB 0x1a
@ -2425,7 +2426,7 @@ typedef uint8_t sm_key_t[16];
* Provisioner Role
* @format 12
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_PROV_STOP_EMIT_INPUT_OOB 0x1b
@ -2433,7 +2434,7 @@ typedef uint8_t sm_key_t[16];
* Provisioner Role
* @format 1212111212
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
* @param num_elements
* @param algorithms
* @param public_key
@ -2448,7 +2449,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 12
* @param subevent_code
* @param pb_adv_cid
* @param pb_transport_cid
*/
#define MESH_PB_PROV_COMPLETE 0x1d

View File

@ -3259,60 +3259,69 @@ static inline uint8_t gap_event_inquiry_complete_get_status(const uint8_t * even
}
/**
* @brief Get field status from event MESH_PB_ADV_PDU_SENT_EVENT
* @brief Get field status from event MESH_PB_TRANSPORT_PDU_SENT_EVENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_adv_pdu_sent_event_get_status(const uint8_t * event){
static inline uint8_t mesh_pb_transport_pdu_sent_event_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field status from event MESH_PB_ADV_LINK_OPEN_EVENT
* @brief Get field status from event MESH_PB_TRANSPORT_LINK_OPEN_EVENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_adv_link_open_event_get_status(const uint8_t * event){
static inline uint8_t mesh_pb_transport_link_open_event_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_ADV_LINK_OPEN_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_TRANSPORT_LINK_OPEN_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_adv_link_open_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_transport_link_open_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field pb_type from event MESH_PB_TRANSPORT_LINK_OPEN_EVENT
* @param event packet
* @return pb_type
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_transport_link_open_event_get_pb_type(const uint8_t * event){
return event[6];
}
/**
* @brief Get field status from event MESH_PB_TRANSPORT_LINK_CLOSED_EVENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_transport_link_closed_event_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_TRANSPORT_LINK_CLOSED_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_transport_link_closed_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field status from event MESH_PB_ADV_LINK_CLOSED_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_ATTENTION_TIMER_EVENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_adv_link_closed_event_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_ADV_LINK_CLOSED_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_adv_link_closed_event_get_pb_adv_cid(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_ATTENTION_TIMER_EVENT
* @param event packet
* @return pb_adv_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_attention_timer_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_attention_timer_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -3326,42 +3335,42 @@ static inline uint8_t mesh_pb_prov_attention_timer_event_get_attention_time(cons
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_START_EMIT_PUBLIC_KEY_OOB_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_START_EMIT_PUBLIC_KEY_OOB_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_start_emit_public_key_oob_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_start_emit_public_key_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_stop_emit_public_key_oob_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_stop_emit_public_key_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_INPUT_OOB_REQUEST_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_INPUT_OOB_REQUEST_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_input_oob_request_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_input_oob_request_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_START_EMIT_OUTPUT_OOB_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_START_EMIT_OUTPUT_OOB_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_start_emit_output_oob_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_start_emit_output_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -3375,52 +3384,52 @@ static inline uint32_t mesh_pb_prov_start_emit_output_oob_event_get_output_oob(c
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_STOP_EMIT_OUTPUT_OOB_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_STOP_EMIT_OUTPUT_OOB_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_stop_emit_output_oob_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_stop_emit_output_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_start_receive_public_key_oob_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_start_receive_public_key_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_STOP_RECEIVE_PUBLIC_KEY_OOB_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_STOP_RECEIVE_PUBLIC_KEY_OOB_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_stop_receive_public_key_oob_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_stop_receive_public_key_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_OUTPUT_OOB_REQUEST_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_OUTPUT_OOB_REQUEST_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_output_oob_request_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_output_oob_request_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_START_EMIT_INPUT_OOB_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_START_EMIT_INPUT_OOB_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_start_emit_input_oob_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_start_emit_input_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -3434,22 +3443,22 @@ static inline uint32_t mesh_pb_prov_start_emit_input_oob_event_get_output_oob(co
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_STOP_EMIT_INPUT_OOB_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_STOP_EMIT_INPUT_OOB_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_stop_emit_input_oob_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_stop_emit_input_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_CAPABILITIES_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_capabilities_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_capabilities_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -3526,12 +3535,12 @@ static inline uint16_t mesh_pb_prov_capabilities_event_get_input_oob_action(cons
}
/**
* @brief Get field pb_adv_cid from event MESH_PB_PROV_COMPLETE_EVENT
* @brief Get field pb_transport_cid from event MESH_PB_PROV_COMPLETE_EVENT
* @param event packet
* @return pb_adv_cid
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_complete_event_get_pb_adv_cid(const uint8_t * event){
static inline uint16_t mesh_pb_prov_complete_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}

View File

@ -21,7 +21,7 @@ CORE += \
include ${BTSTACK_ROOT}/example/Makefile.inc
include ${BTSTACK_ROOT}/src/ble/gatt-service/Makefile.inc
CFLAGS += -g -DUNIT_TEST \
CFLAGS += -g -DUNIT_TEST -Wall \
-I$(BTSTACK_ROOT)/platform/embedded \
-I$(BTSTACK_ROOT)/platform/posix \
-I$(BTSTACK_ROOT)/3rd-party/tinydir \

View File

@ -159,11 +159,11 @@ static void mesh_message_handler (uint8_t packet_type, uint16_t channel, uint8_t
switch(packet[0]){
case HCI_EVENT_MESH_META:
switch(packet[2]){
case MESH_PB_ADV_LINK_OPEN:
case MESH_PB_TRANSPORT_LINK_OPEN:
printf("Provisioner link opened");
pb_transport_cid = mesh_pb_adv_link_open_event_get_pb_adv_cid(packet);
pb_transport_cid = mesh_pb_transport_link_open_event_get_pb_transport_cid(packet);
break;
case MESH_PB_ADV_LINK_CLOSED:
case MESH_PB_TRANSPORT_LINK_CLOSED:
pb_transport_cid = MESH_PB_TRANSPORT_INVALID_CID;
break;
case MESH_PB_PROV_ATTENTION_TIMER:
@ -1189,7 +1189,7 @@ int btstack_main(void)
// Network layer
mesh_network_init();
mesh_network_set_higher_layer_handler(&mesh_transport_received_mesage);
// PTS app key
uint8_t application_key[16];
const char * application_key_string = "3216D1509884B533248541792B877F98";

View File

@ -161,7 +161,7 @@ static void mesh_message_handler (uint8_t packet_type, uint16_t channel, uint8_t
switch(packet[0]){
case HCI_EVENT_MESH_META:
switch(packet[2]){
case MESH_PB_ADV_LINK_OPEN:
case MESH_PB_TRANSPORT_LINK_OPEN:
printf("Provisioner link opened");
break;
case MESH_PB_PROV_CAPABILITIES:

View File

@ -81,6 +81,10 @@ extern "C"
#define MESH_INPUT_OOB_NUMBER 0x04
#define MESH_INPUT_OOB_STRING 0x08
typedef enum {
PB_TYPE_ADV = 0,
PB_TYPE_GATT
} pb_type_t;
typedef struct {
uint8_t network_key[16];

View File

@ -772,16 +772,16 @@ static void provisioning_handle_pdu(uint8_t packet_type, uint16_t channel, uint8
case HCI_EVENT_PACKET:
if (packet[0] != HCI_EVENT_MESH_META) break;
switch (packet[2]){
case MESH_PB_ADV_LINK_OPEN:
case MESH_PB_TRANSPORT_LINK_OPEN:
printf("Link opened, reset state\n");
pb_transport_cid = mesh_pb_adv_link_open_event_get_pb_adv_cid(packet);
pb_transport_cid = mesh_pb_transport_link_open_event_get_pb_transport_cid(packet);
provisioning_done();
break;
case MESH_PB_ADV_PDU_SENT:
case MESH_PB_TRANSPORT_PDU_SENT:
printf("Outgoing packet acked\n");
prov_waiting_for_outgoing_complete = 0;
break;
case MESH_PB_ADV_LINK_CLOSED:
case MESH_PB_TRANSPORT_LINK_CLOSED:
printf("Link close, reset state\n");
pb_transport_cid = MESH_PB_TRANSPORT_INVALID_CID;
provisioning_done();

View File

@ -140,7 +140,7 @@ static void send_prov_pdu(const uint8_t * packet, uint16_t size){
}
static void pb_adv_emit_pdu_sent(uint8_t status){
uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_PB_ADV_PDU_SENT, status};
uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status};
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}

View File

@ -633,15 +633,15 @@ static void provisioning_handle_pdu(uint8_t packet_type, uint16_t channel, uint8
case HCI_EVENT_PACKET:
if (packet[0] != HCI_EVENT_MESH_META) break;
switch (packet[2]){
case MESH_PB_ADV_LINK_OPEN:
case MESH_PB_TRANSPORT_LINK_OPEN:
printf("Link opened, sending Invite\n");
provisioning_handle_link_opened(pb_adv_cid);
break;
case MESH_PB_ADV_PDU_SENT:
case MESH_PB_TRANSPORT_PDU_SENT:
printf("Outgoing packet acked\n");
prov_waiting_for_outgoing_complete = 0;
break;
case MESH_PB_ADV_LINK_CLOSED:
case MESH_PB_TRANSPORT_LINK_CLOSED:
printf("Link close, reset state\n");
provisioning_done();
break;

View File

@ -97,13 +97,14 @@ static uint8_t * pdu_data;
static uint16_t pdu_size;
static void pb_adv_emit_link_open(uint8_t status, uint16_t pb_adv_cid){
uint8_t event[6] = { HCI_EVENT_MESH_META, 6, MESH_PB_ADV_LINK_OPEN, status};
uint8_t event[6] = { HCI_EVENT_MESH_META, 6, MESH_PB_TRANSPORT_LINK_OPEN, status};
little_endian_store_16(event, 4, pb_adv_cid);
event[5] = PB_TYPE_ADV;
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
static void pb_adv_emit_pdu_sent(uint8_t status){
uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_PB_ADV_PDU_SENT, status};
uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status};
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}