mesh: make start/stop advertisting with node id private to proxy

This commit is contained in:
Matthias Ringwald 2019-06-14 14:46:14 +02:00
parent ad9347bb4d
commit 4b924f238a
3 changed files with 6 additions and 21 deletions

View File

@ -444,7 +444,7 @@ static void mesh_provisioning_message_handler (uint8_t packet_type, uint16_t cha
mesh_setup_from_provisioning_data(&provisioning_data);
// start advertising with node id after provisioning
mesh_proxy_start_advertising_with_node_id(network_key->netkey_index);
mesh_proxy_set_advertising_with_node_id(network_key->netkey_index, MESH_NODE_IDENTITY_STATE_ADVERTISING_RUNNING);
break;
default:
break;

View File

@ -84,9 +84,6 @@ static const uint8_t adv_data_with_node_identity_template[] = {
// Random - 8 bytes
};
static void mesh_proxy_stop_all_advertising_with_node_id(void){
mesh_network_key_iterator_t it;
mesh_network_key_iterator_init(&it);
@ -129,21 +126,21 @@ static void mesh_proxy_node_id_handle_random(void * arg){
btstack_crypto_aes128_encrypt(&mesh_proxy_node_id_crypto_request_aes128, proxy_identity_key, mesh_proxy_node_id_plaintext, mesh_proxy_node_id_hash, mesh_proxy_node_id_handle_get_aes128, NULL);
}
// Public API
void mesh_proxy_start_advertising_with_node_id(uint16_t netkey_index){
static void mesh_proxy_start_advertising_with_node_id(uint16_t netkey_index){
mesh_proxy_stop_all_advertising_with_node_id();
log_info("Proxy start advertising with node id, netkey index %04x", netkey_index);
// setup node id
btstack_crypto_random_generate(&mesh_proxy_node_id_crypto_request_random, mesh_proxy_node_id_random_value, sizeof(mesh_proxy_node_id_random_value), mesh_proxy_node_id_handle_random, NULL);
}
void mesh_proxy_stop_advertising_with_node_id(uint16_t netkey_index){
static void mesh_proxy_stop_advertising_with_node_id(uint16_t netkey_index){
UNUSED(netkey_index);
log_info("Proxy stop advertising with node id, netkey index %04x", netkey_index);
mesh_proxy_stop_all_advertising_with_node_id();
}
// Public API
uint8_t mesh_proxy_get_advertising_with_node_id_status(uint16_t netkey_index, mesh_node_identity_state_t * out_state ){
mesh_network_key_t * network_key = mesh_network_key_list_get(netkey_index);
if (network_key == NULL){

View File

@ -56,23 +56,11 @@ typedef enum {
*/
void mesh_proxy_init(uint16_t primary_unicast_address, const uint8_t * identity_key);
/**
* @brief Start Advertising with Node ID on given subnet
* @param netkey_index of subnet
* @note Node ID is only advertised on one subnet at a time and it is limited to 60 seconds
*/
void mesh_proxy_start_advertising_with_node_id(uint16_t netkey_index);
/**
* @brief Stop Advertising with Node ID on given subnet
* @param netkey_index of subnet
*/
void mesh_proxy_stop_advertising_with_node_id(uint16_t netkey_index);
/**
* @brief Set Advertising with Node ID on given subnet
* @param netkey_index of subnet
* @returns MESH_FOUNDATION_STATUS_SUCCESS, MESH_FOUNDATION_STATUS_FEATURE_NOT_SUPPORTED, or MESH_FOUNDATION_STATUS_INVALID_NETKEY_INDEX
* @note Node ID is only advertised on one subnet at a time and it is limited to 60 seconds
*/
uint8_t mesh_proxy_set_advertising_with_node_id(uint16_t netkey_index, mesh_node_identity_state_t state);