mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-26 09:41:01 +00:00
mesh: generate random device uuid on start
This commit is contained in:
parent
39cd8755fb
commit
58a4c3985a
@ -117,7 +117,7 @@ mesh_element_t * mesh_element_iterator_next(mesh_element_iterator_t * iterator){
|
||||
}
|
||||
|
||||
void mesh_node_set_device_uuid(const uint8_t * device_uuid){
|
||||
memcpy(mesh_node_get_device_uuid, device_uuid, 16);
|
||||
memcpy(mesh_node_device_uuid, device_uuid, 16);
|
||||
mesh_node_have_device_uuid = 1;
|
||||
}
|
||||
|
||||
|
@ -1738,14 +1738,31 @@ void mesh_access_setup_from_provisioning_data(const mesh_provisioning_data_t * p
|
||||
#endif
|
||||
}
|
||||
|
||||
void mesh_access_setup_without_provisiong_data(void){
|
||||
const uint8_t * device_uuid = mesh_node_get_device_uuid();
|
||||
static btstack_crypto_random_t mesh_access_crypto_random;
|
||||
|
||||
static uint8_t random_device_uuid[16];
|
||||
|
||||
static void mesh_access_setup_unprovisioned_device(void * arg){
|
||||
// set random value
|
||||
if (arg == NULL){
|
||||
mesh_node_set_device_uuid(random_device_uuid);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MESH_PB_ADV
|
||||
// PB-ADV
|
||||
beacon_unprovisioned_device_start(device_uuid, 0);
|
||||
beacon_unprovisioned_device_start(mesh_node_get_device_uuid(), 0);
|
||||
#endif
|
||||
#ifdef ENABLE_MESH_PB_GATT
|
||||
mesh_proxy_start_advertising_unprovisioned_device();
|
||||
#endif
|
||||
}
|
||||
|
||||
void mesh_access_setup_without_provisiong_data(void){
|
||||
const uint8_t * device_uuid = mesh_node_get_device_uuid();
|
||||
if (device_uuid){
|
||||
mesh_access_setup_unprovisioned_device((void *)device_uuid);
|
||||
} else{
|
||||
btstack_crypto_random_generate(&mesh_access_crypto_random, random_device_uuid, 16, &mesh_access_setup_unprovisioned_device, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "mesh/gatt_bearer.h"
|
||||
#include "mesh/mesh_crypto.h"
|
||||
#include "mesh/mesh_network.h"
|
||||
#include "mesh/mesh_node.h"
|
||||
#include "mesh/mesh_lower_transport.h"
|
||||
#include "bluetooth_company_id.h"
|
||||
#include "bluetooth_data_types.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user