diff --git a/src/mesh/mesh_configuration_server.c b/src/mesh/mesh_configuration_server.c index d52962aae..aac6e54fb 100644 --- a/src/mesh/mesh_configuration_server.c +++ b/src/mesh/mesh_configuration_server.c @@ -275,11 +275,11 @@ static void config_composition_data_status(uint16_t netkey_index, uint16_t dest) mesh_access_transport_add_uint8(transport_pdu, 0); // CID - mesh_access_transport_add_uint16(transport_pdu, BLUETOOTH_COMPANY_ID_BLUEKITCHEN_GMBH); + mesh_access_transport_add_uint16(transport_pdu, mesh_node_get_company_id()); // PID - mesh_access_transport_add_uint16(transport_pdu, 0); + mesh_access_transport_add_uint16(transport_pdu, mesh_node_get_product_id()); // VID - mesh_access_transport_add_uint16(transport_pdu, 0); + mesh_access_transport_add_uint16(transport_pdu, mesh_node_get_product_version_id()); // CRPL - number of protection list entries mesh_access_transport_add_uint16(transport_pdu, 1); // Features - Relay, Proxy, Friend, Lower Power, ... diff --git a/src/mesh/mesh_node.c b/src/mesh/mesh_node.c index 3ae9a4efd..9729eda45 100644 --- a/src/mesh/mesh_node.c +++ b/src/mesh/mesh_node.c @@ -58,6 +58,10 @@ static uint16_t mid_counter; static uint8_t mesh_node_device_uuid[16]; static int mesh_node_have_device_uuid; +static uint16_t mesh_node_company_id; +static uint16_t mesh_node_product_id; +static uint16_t mesh_node_product_version_id; + void mesh_node_primary_element_address_set(uint16_t unicast_address){ primary_element_address = unicast_address; } @@ -71,6 +75,24 @@ void mesh_node_init(void){ mesh_node_add_element(&primary_element); } +void mesh_node_set_info(uint16_t company_id, uint16_t product_id, uint16_t product_version_id){ + mesh_node_company_id = company_id; + mesh_node_product_id = product_id; + mesh_node_product_version_id = product_version_id; +} + +uint16_t mesh_node_get_company_id(void){ + return mesh_node_company_id; +} + +uint16_t mesh_node_get_product_id(void){ + return mesh_node_product_id; +} + +uint16_t mesh_node_get_product_version_id(void){ + return mesh_node_product_version_id; +} + void mesh_node_add_element(mesh_element_t * element){ element->element_index = mesh_element_index_next++; btstack_linked_list_add_tail(&mesh_elements, (void*) element); diff --git a/src/mesh/mesh_node.h b/src/mesh/mesh_node.h index f0740578e..1fc1be18e 100644 --- a/src/mesh/mesh_node.h +++ b/src/mesh/mesh_node.h @@ -275,6 +275,32 @@ void mesh_node_set_device_uuid(const uint8_t * device_uuid); */ const uint8_t * mesh_node_get_device_uuid(void); +/** + * @brief Set node info reported in Composition Data Page 0 + * @param company_id (cid) + * @param product_id (pid) + * @param product_version_id (vid) + */ +void mesh_node_set_info(uint16_t company_id, uint16_t product_id, uint16_t product_version_id); + +/** + * @brief Get node info: company_id + * @returns company_id + */ +uint16_t mesh_node_get_company_id(void); + +/** + * @brief Get node info: product_id + * @returns product_id + */ +uint16_t mesh_node_get_product_id(void); + +/** + * @brief Get node info: product_version_id + * @returns product_version_id + */ +uint16_t mesh_node_get_product_version_id(void); + #if defined __cplusplus } #endif diff --git a/test/mesh/mesh_pts.c b/test/mesh/mesh_pts.c index c63a83290..246cd508a 100644 --- a/test/mesh/mesh_pts.c +++ b/test/mesh/mesh_pts.c @@ -615,6 +615,9 @@ int btstack_main(void) // Loc - bottom - https://www.bluetooth.com/specifications/assigned-numbers/gatt-namespace-descriptors mesh_node_set_element_location(mesh_node_get_primary_element(), 0x103); + // Setup node info + mesh_node_set_info(BLUETOOTH_COMPANY_ID_BLUEKITCHEN_GMBH, 0, 0); + // Setup Generic On/Off 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.operations = mesh_generic_on_off_server_get_operations();