mesh: store beacon_interval_ms in mesh_network_key_t

This commit is contained in:
Matthias Ringwald 2019-06-17 17:21:48 +02:00
parent 7f6a0379f1
commit b9ccacabde
3 changed files with 27 additions and 1 deletions

View File

@ -39,6 +39,7 @@
#include <string.h>
#include "ble/mesh/beacon.h"
#include "ble/mesh/adv_bearer.h"
#include "ble/core.h"
#include "bluetooth.h"
@ -136,7 +137,22 @@ void beacon_unprovisioned_device_stop(void){
btstack_run_loop_remove_timer(&beacon_timer);
}
// secure network beacons
// crypto context
static void beacon_secure_network_timer_handler(btstack_timer_source_t * ts){
}
void beacon_secure_network_start(mesh_network_key_t * mesh_network_key){
// start with default interval
mesh_network_key->beacon_interval_ms = 10 * 1000; // 10 seconds
// set timer for next one
//
}
// register handler
void beacon_register_for_unprovisioned_device_beacons(btstack_packet_handler_t packet_handler){
unprovisioned_device_beacon_handler = packet_handler;
}
@ -144,4 +160,3 @@ void beacon_register_for_unprovisioned_device_beacons(btstack_packet_handler_t p
void beacon_register_for_secure_network_beacons(btstack_packet_handler_t packet_handler){
secure_network_beacon_handler = packet_handler;
}

View File

@ -41,6 +41,7 @@
#include <stdint.h>
#include "btstack_defines.h"
#include "mesh_keys.h"
#if defined __cplusplus
extern "C" {
@ -62,6 +63,12 @@ void beacon_unprovisioned_device_start(const uint8_t * device_uuid, uint16_t oob
*/
void beacon_unprovisioned_device_stop(void);
/**
* Start sending Secure Network Beacons on given subnet
* @param mesh_network_key subnet
*/
void beacon_secure_network_start(mesh_network_key_t * mesh_network_key);
/**
* Register Beacon handler for unprovisioned device beacons
*/

View File

@ -92,6 +92,10 @@ typedef struct {
// advertisement data for proxy
adv_bearer_connectable_advertisement_data_item_t advertisement_with_network_id;
// secure network beacons
btstack_timer_source_t beacon_timer;
uint32_t beacon_interval_ms;
} mesh_network_key_t;
typedef struct {