mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 22:20:37 +00:00
mesh: store AppKey List for all models
This commit is contained in:
parent
6eb2ec7108
commit
7c18100b8e
@ -126,7 +126,7 @@ int mesh_model_is_bluetooth_sig(uint32_t model_identifier){
|
|||||||
}
|
}
|
||||||
|
|
||||||
mesh_model_t * mesh_model_get_configuration_server(void){
|
mesh_model_t * mesh_model_get_configuration_server(void){
|
||||||
return mesh_model_get_by_identifier(primary_element, mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_CONFIGURATION_SERVER));
|
return mesh_model_get_by_identifier(&primary_element, mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_CONFIGURATION_SERVER));
|
||||||
}
|
}
|
||||||
|
|
||||||
void mesh_element_add_model(mesh_element_t * element, mesh_model_t * mesh_model){
|
void mesh_element_add_model(mesh_element_t * element, mesh_model_t * mesh_model){
|
||||||
@ -728,8 +728,6 @@ void mesh_delete_app_keys(void){
|
|||||||
|
|
||||||
// Model to Appkey List
|
// Model to Appkey List
|
||||||
|
|
||||||
#define MESH_MODEL_INDEX_MAX (16)
|
|
||||||
|
|
||||||
static uint32_t mesh_model_tag_for_index(uint16_t internal_model_id){
|
static uint32_t mesh_model_tag_for_index(uint16_t internal_model_id){
|
||||||
return ((uint32_t) 'M' << 24) | ((uint32_t) 'B' << 16) | ((uint32_t) internal_model_id);
|
return ((uint32_t) 'M' << 24) | ((uint32_t) 'B' << 16) | ((uint32_t) internal_model_id);
|
||||||
}
|
}
|
||||||
@ -742,15 +740,16 @@ static void mesh_load_appkey_list(mesh_model_t * model){
|
|||||||
|
|
||||||
static void mesh_store_appkey_list(mesh_model_t * model){
|
static void mesh_store_appkey_list(mesh_model_t * model){
|
||||||
mesh_access_setup_tlv();
|
mesh_access_setup_tlv();
|
||||||
|
|
||||||
if (model->mid >= MESH_MODEL_INDEX_MAX){
|
|
||||||
printf("Warning: Model with internal model id %x (>= %u) are not persisted\n", model->mid, MESH_MODEL_INDEX_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t tag = mesh_model_tag_for_index(model->mid);
|
uint32_t tag = mesh_model_tag_for_index(model->mid);
|
||||||
btstack_tlv_singleton_impl->get_tag(btstack_tlv_singleton_context, tag, (uint8_t *) &model->appkey_indices, sizeof(model->appkey_indices));
|
btstack_tlv_singleton_impl->get_tag(btstack_tlv_singleton_context, tag, (uint8_t *) &model->appkey_indices, sizeof(model->appkey_indices));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mesh_delete_appkey_list(mesh_model_t * model){
|
||||||
|
mesh_access_setup_tlv();
|
||||||
|
uint32_t tag = mesh_model_tag_for_index(model->mid);
|
||||||
|
btstack_tlv_singleton_impl->delete_tag(btstack_tlv_singleton_context, tag);
|
||||||
|
}
|
||||||
|
|
||||||
void mesh_load_appkey_lists(void){
|
void mesh_load_appkey_lists(void){
|
||||||
printf("Load Appkey Lists\n");
|
printf("Load Appkey Lists\n");
|
||||||
// iterate over elements and models
|
// iterate over elements and models
|
||||||
@ -768,13 +767,19 @@ void mesh_load_appkey_lists(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mesh_delete_appkey_lists(void){
|
void mesh_delete_appkey_lists(void){
|
||||||
printf("Delete App Keys\n");
|
printf("Delete Appkey Lists\n");
|
||||||
mesh_access_setup_tlv();
|
mesh_access_setup_tlv();
|
||||||
// iterate over elements and models
|
// iterate over elements and models
|
||||||
uint16_t internal_model_id;
|
mesh_element_iterator_t element_it;
|
||||||
for (internal_model_id = 0; internal_model_id < MESH_MODEL_INDEX_MAX; internal_model_id++){
|
mesh_element_iterator_init(&element_it);
|
||||||
uint32_t tag = mesh_model_tag_for_index(internal_model_id);
|
while (mesh_element_iterator_has_next(&element_it)){
|
||||||
btstack_tlv_singleton_impl->delete_tag(btstack_tlv_singleton_context, tag);
|
mesh_element_t * element = mesh_element_iterator_next(&element_it);
|
||||||
|
mesh_model_iterator_t model_it;
|
||||||
|
mesh_model_iterator_init(&model_it, element);
|
||||||
|
while (mesh_model_iterator_has_next(&model_it)){
|
||||||
|
mesh_model_t * model = mesh_model_iterator_next(&model_it);
|
||||||
|
mesh_delete_appkey_list(model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#include "btstack_memory.h"
|
#include "btstack_memory.h"
|
||||||
#include "ble/mesh/mesh_crypto.h"
|
#include "ble/mesh/mesh_crypto.h"
|
||||||
#include "mesh_virtual_addresses.h"
|
#include "mesh_virtual_addresses.h"
|
||||||
|
#include "btstack_debug.h"
|
||||||
|
|
||||||
// Foundatiopn Message
|
// Foundatiopn Message
|
||||||
|
|
||||||
@ -439,7 +440,7 @@ static void config_model_network_transmit_set_handler(mesh_model_t * mesh_model,
|
|||||||
|
|
||||||
static int config_netkey_list_max = 0;
|
static int config_netkey_list_max = 0;
|
||||||
|
|
||||||
static void config_nekey_list_set_max(uint16_t max){
|
void config_nekey_list_set_max(uint16_t max){
|
||||||
config_netkey_list_max = max;
|
config_netkey_list_max = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,9 @@ extern "C"
|
|||||||
|
|
||||||
const mesh_operation_t * mesh_configuration_server_get_operations(void);
|
const mesh_operation_t * mesh_configuration_server_get_operations(void);
|
||||||
|
|
||||||
|
// PTS Testing
|
||||||
|
void config_nekey_list_set_max(uint16_t max);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* end of extern "C" */
|
} /* end of extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user