mesh: undo network ID flipping to connect with BlueNRG-Mesh

This commit is contained in:
Milanka Ringwald 2018-11-26 14:42:11 +01:00 committed by Matthias Ringwald
parent c6dc8338fb
commit ff1bc96bd6

View File

@ -65,7 +65,7 @@ static uint8_t adv_data[] = {
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x06,
// 16-bit Service UUIDs
0x03, BLUETOOTH_DATA_TYPE_COMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS, ORG_BLUETOOTH_SERVICE_MESH_PROXY & 0xff, ORG_BLUETOOTH_SERVICE_MESH_PROXY >> 8,
// Service Data (22)
// Service Data
0x0C, BLUETOOTH_DATA_TYPE_SERVICE_DATA, ORG_BLUETOOTH_SERVICE_MESH_PROXY & 0xff, ORG_BLUETOOTH_SERVICE_MESH_PROXY >> 8,
// MESH_IDENTIFICATION_NETWORK_ID_TYPE
0x00,
@ -118,9 +118,12 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
if (!prov_len) break;
// dynamically store network ID into adv data
uint8_t netid_flipped[8];
reverse_64(provisioning_data.network_id, netid_flipped);
memcpy(&adv_data[12], netid_flipped, sizeof(netid_flipped));
// uint8_t netid_flipped[8];
// reverse_64(provisioning_data.network_id, netid_flipped);
// memcpy(&adv_data[12], netid_flipped, sizeof(netid_flipped));
memcpy(&adv_data[12], provisioning_data.network_id, sizeof(provisioning_data.network_id));
// printf("network id flipped: ");
// printf_hexdump(netid_flipped, 8);
// setup advertisements
bd_addr_t null_addr;
memset(null_addr, 0, 6);
@ -134,6 +137,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
switch (hci_event_le_meta_get_subevent_code(packet)){
case HCI_SUBEVENT_LE_CONNECTION_COMPLETE:
con_handle = hci_subevent_le_connection_complete_get_connection_handle(packet);
printf("connected handle 0x%02x\n", con_handle);
break;
default:
break;