mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 22:20:37 +00:00
mesh: setup primary element in mesh_access_init
This commit is contained in:
parent
723bf6fbce
commit
54691d7b86
@ -3251,37 +3251,26 @@ int btstack_main(void)
|
|||||||
|
|
||||||
// Access layer
|
// Access layer
|
||||||
mesh_access_init();
|
mesh_access_init();
|
||||||
|
|
||||||
// PTS Virtual Address Label UUID - without Config Model, PTS uses our device uuid
|
|
||||||
btstack_parse_hex("001BDC0810210B0E0A0C000B0E0A0C00", 16, label_uuid);
|
|
||||||
pts_proxy_dst = mesh_virtual_address_register(label_uuid, 0x9779);
|
|
||||||
|
|
||||||
// Access layer - add Primary Element to list of elements - should be hid in e.g mesh_access_init()
|
|
||||||
mesh_element_add(mesh_primary_element());
|
|
||||||
|
|
||||||
// Setup Primary Element
|
|
||||||
mesh_element_t * primary_element = mesh_primary_element();
|
|
||||||
|
|
||||||
// Loc - bottom - https://www.bluetooth.com/specifications/assigned-numbers/gatt-namespace-descriptors
|
// Loc - bottom - https://www.bluetooth.com/specifications/assigned-numbers/gatt-namespace-descriptors
|
||||||
primary_element->loc = 0x0103;
|
mesh_access_set_primary_element_location(0x103);
|
||||||
|
|
||||||
// Setup models
|
// Setup models
|
||||||
mesh_configuration_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_CONFIGURATION_SERVER);
|
mesh_configuration_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_CONFIGURATION_SERVER);
|
||||||
mesh_model_reset_appkeys(&mesh_configuration_server_model);
|
mesh_model_reset_appkeys(&mesh_configuration_server_model);
|
||||||
mesh_configuration_server_model.operations = mesh_configuration_server_model_operations;
|
mesh_configuration_server_model.operations = mesh_configuration_server_model_operations;
|
||||||
mesh_element_add_model(primary_element, &mesh_configuration_server_model);
|
mesh_element_add_model(mesh_primary_element(), &mesh_configuration_server_model);
|
||||||
|
|
||||||
mesh_health_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_HEALTH_SERVER);
|
mesh_health_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_HEALTH_SERVER);
|
||||||
mesh_model_reset_appkeys(&mesh_health_server_model);
|
mesh_model_reset_appkeys(&mesh_health_server_model);
|
||||||
mesh_element_add_model(primary_element, &mesh_health_server_model);
|
mesh_element_add_model(mesh_primary_element(), &mesh_health_server_model);
|
||||||
|
|
||||||
mesh_generic_on_off_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_GENERIC_ON_OFF_SERVER);
|
mesh_generic_on_off_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_GENERIC_ON_OFF_SERVER);
|
||||||
mesh_model_reset_appkeys(&mesh_generic_on_off_server_model);
|
mesh_model_reset_appkeys(&mesh_generic_on_off_server_model);
|
||||||
mesh_element_add_model(primary_element, &mesh_generic_on_off_server_model);
|
mesh_element_add_model(mesh_primary_element(), &mesh_generic_on_off_server_model);
|
||||||
|
|
||||||
mesh_vendor_model.model_identifier = mesh_model_get_model_identifier(BLUETOOTH_COMPANY_ID_BLUEKITCHEN_GMBH, MESH_BLUEKITCHEN_MODEL_ID_TEST_SERVER);
|
mesh_vendor_model.model_identifier = mesh_model_get_model_identifier(BLUETOOTH_COMPANY_ID_BLUEKITCHEN_GMBH, MESH_BLUEKITCHEN_MODEL_ID_TEST_SERVER);
|
||||||
mesh_model_reset_appkeys(&mesh_vendor_model);
|
mesh_model_reset_appkeys(&mesh_vendor_model);
|
||||||
mesh_element_add_model(primary_element, &mesh_vendor_model);
|
mesh_element_add_model(mesh_primary_element(), &mesh_vendor_model);
|
||||||
|
|
||||||
// calc s1('vtad')7
|
// calc s1('vtad')7
|
||||||
// btstack_crypto_aes128_cmac_zero(&salt_request, 4, (const uint8_t *) "vtad", salt_hash, salt_complete, NULL);
|
// btstack_crypto_aes128_cmac_zero(&salt_request, 4, (const uint8_t *) "vtad", salt_hash, salt_complete, NULL);
|
||||||
@ -3296,6 +3285,11 @@ int btstack_main(void)
|
|||||||
// printf_hexdump(test_network_key.net_key, 16);
|
// printf_hexdump(test_network_key.net_key, 16);
|
||||||
// mesh_network_key_derive(&salt_request, &test_network_key, key_derived, NULL);
|
// mesh_network_key_derive(&salt_request, &test_network_key, key_derived, NULL);
|
||||||
|
|
||||||
|
// PTS Virtual Address Label UUID - without Config Model, PTS uses our device uuid
|
||||||
|
btstack_parse_hex("001BDC0810210B0E0A0C000B0E0A0C00", 16, label_uuid);
|
||||||
|
pts_proxy_dst = mesh_virtual_address_register(label_uuid, 0x9779);
|
||||||
|
|
||||||
|
// PTS Device UUID
|
||||||
btstack_parse_hex(pts_device_uuid_string, 16, pts_device_uuid);
|
btstack_parse_hex(pts_device_uuid_string, 16, pts_device_uuid);
|
||||||
btstack_print_hex(pts_device_uuid, 16, 0);
|
btstack_print_hex(pts_device_uuid, 16, 0);
|
||||||
|
|
||||||
|
@ -52,6 +52,8 @@ static btstack_linked_list_t mesh_elements;
|
|||||||
static uint16_t mid_counter;
|
static uint16_t mid_counter;
|
||||||
|
|
||||||
void mesh_access_init(void){
|
void mesh_access_init(void){
|
||||||
|
// Access layer - add Primary Element to list of elements
|
||||||
|
mesh_element_add(&primary_element);
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh_element_t * mesh_primary_element(void){
|
mesh_element_t * mesh_primary_element(void){
|
||||||
@ -62,6 +64,10 @@ void mesh_access_set_primary_element_address(uint16_t unicast_address){
|
|||||||
primary_element.unicast_address = unicast_address;
|
primary_element.unicast_address = unicast_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mesh_access_set_primary_element_location(uint16_t location){
|
||||||
|
primary_element.loc = location;
|
||||||
|
}
|
||||||
|
|
||||||
void mesh_element_add(mesh_element_t * element){
|
void mesh_element_add(mesh_element_t * element){
|
||||||
btstack_linked_list_add_tail(&mesh_elements, (void*) element);
|
btstack_linked_list_add_tail(&mesh_elements, (void*) element);
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,8 @@ mesh_element_t * mesh_primary_element(void);
|
|||||||
|
|
||||||
void mesh_access_set_primary_element_address(uint16_t unicast_address);
|
void mesh_access_set_primary_element_address(uint16_t unicast_address);
|
||||||
|
|
||||||
|
void mesh_access_set_primary_element_location(uint16_t location);
|
||||||
|
|
||||||
void mesh_element_add(mesh_element_t * element);
|
void mesh_element_add(mesh_element_t * element);
|
||||||
|
|
||||||
mesh_element_t * mesh_element_for_unicast_address(uint16_t unicast_address);
|
mesh_element_t * mesh_element_for_unicast_address(uint16_t unicast_address);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user