mesh: track if network pdu was received from gatt bearer

This commit is contained in:
Matthias Ringwald 2019-06-27 14:36:45 +02:00
parent fd7ffe0047
commit f727526daf
3 changed files with 6 additions and 6 deletions

View File

@ -637,7 +637,7 @@ static void mesh_adv_bearer_handle_network_event(uint8_t packet_type, uint16_t c
printf("received network pdu from adv (len %u): ", size);
printf_hexdump(packet, size);
#endif
mesh_network_received_message(packet, size);
mesh_network_received_message(packet, size, 0);
break;
case HCI_EVENT_PACKET:
@ -699,7 +699,7 @@ static void mesh_network_gatt_bearer_handle_network_event(uint8_t packet_type, u
printf("received network pdu from gatt (len %u): ", size);
printf_hexdump(packet, size);
#endif
mesh_network_received_message(packet, size);
mesh_network_received_message(packet, size, MESH_NETWORK_PDU_FLAGS_GATT_BEARER);
break;
case HCI_EVENT_PACKET:
switch (hci_event_packet_get_type(packet)){
@ -761,7 +761,7 @@ void mesh_network_set_primary_element_address(uint16_t addr){
mesh_network_num_elements = 1;
}
void mesh_network_received_message(const uint8_t * pdu_data, uint8_t pdu_len){
void mesh_network_received_message(const uint8_t * pdu_data, uint8_t pdu_len, uint8_t flags){
// verify len
if (pdu_len > 29) return;
@ -772,7 +772,7 @@ void mesh_network_received_message(const uint8_t * pdu_data, uint8_t pdu_len){
// store data
memcpy(network_pdu->data, pdu_data, pdu_len);
network_pdu->len = pdu_len;
network_pdu->flags = 0; // regular Network PDU
network_pdu->flags = flags;
// add to list and go
btstack_linked_list_add_tail(&network_pdus_received, (btstack_linked_item_t *) network_pdu);

View File

@ -267,7 +267,7 @@ void mesh_set_iv_index(uint32_t iv_index);
uint32_t mesh_get_iv_index(void);
// Testing only
void mesh_network_received_message(const uint8_t * pdu_data, uint8_t pdu_len);
void mesh_network_received_message(const uint8_t * pdu_data, uint8_t pdu_len, uint8_t flags);
void mesh_network_process_proxy_configuration_message(const uint8_t * pdu_data, uint8_t pdu_len);
void mesh_network_encrypt_proxy_configuration_message(mesh_network_pdu_t * network_pdu, void (* callback)(mesh_network_pdu_t * callback));
void mesh_network_dump(void);

View File

@ -327,7 +327,7 @@ void test_receive_network_pdus(int count, char ** network_pdus, char ** lower_tr
test_network_pdu_len = strlen(network_pdus[i]) / 2;
btstack_parse_hex(network_pdus[i], test_network_pdu_len, test_network_pdu_data);
mesh_network_received_message(test_network_pdu_data, test_network_pdu_len);
mesh_network_received_message(test_network_pdu_data, test_network_pdu_len, 0);
while (received_network_pdu == NULL) {
mock_process_hci_cmd();