mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-01 10:13:29 +00:00
mesh: send Config Model Subscription Status for Config Model Subscription Add
This commit is contained in:
parent
f8e58086aa
commit
0691c6f147
@ -683,8 +683,44 @@ static void config_appkey_add_handler(mesh_transport_pdu_t * transport_pdu){
|
||||
mesh_k4(&mesh_cmac_request, new_app_key, &new_aid, config_appkey_add_aid, NULL);
|
||||
}
|
||||
|
||||
static void config_model_subscription_status(uint8_t status, uint16_t element_address, uint16_t address, uint32_t model_identifier){
|
||||
uint16_t src = primary_element_address;
|
||||
uint16_t dest = 0x0001;
|
||||
uint8_t ttl = 10;
|
||||
|
||||
uint16_t netkey_index = 0;
|
||||
uint16_t appkey_index = MESH_DEVICE_KEY_INDEX;
|
||||
|
||||
uint8_t access_pdu_data[2 + 7];
|
||||
int access_pdu_len = sizeof(access_pdu_data);
|
||||
int pos = 0;
|
||||
access_pdu_data[pos++] = 0x80;
|
||||
access_pdu_data[pos++] = 0x1F;
|
||||
access_pdu_data[pos++] = status;
|
||||
little_endian_store_16(access_pdu_data, pos, element_address);
|
||||
pos += 2;
|
||||
little_endian_store_16(access_pdu_data, pos, address);
|
||||
pos += 2;
|
||||
little_endian_store_16(access_pdu_data, pos, model_identifier);
|
||||
pos += 2;
|
||||
|
||||
// send as segmented access pdu
|
||||
mesh_transport_pdu_t * transport_pdu = btstack_memory_mesh_transport_pdu_get();
|
||||
mesh_upper_transport_setup_segmented_access_pdu(transport_pdu, netkey_index, appkey_index, ttl, src, dest, 0, access_pdu_data, access_pdu_len);
|
||||
mesh_upper_transport_send_segmented_access_pdu(transport_pdu);
|
||||
}
|
||||
|
||||
static void config_model_subscription_add_handler(mesh_transport_pdu_t * transport_pdu){
|
||||
uint16_t element_address = little_endian_read_16(transport_pdu->data, 2);
|
||||
uint16_t address = little_endian_read_16(transport_pdu->data, 4);
|
||||
uint16_t model_identifier = little_endian_read_16(transport_pdu->data, 6);
|
||||
|
||||
config_model_subscription_status(0, element_address, address, model_identifier);
|
||||
}
|
||||
|
||||
static const uint8_t config_composition_data_get[] = { 0x80, 0x08, 0xff };
|
||||
static const uint8_t config_appkey_add[] = { 0x00 };
|
||||
static const uint8_t config_model_subscription_add[] = { 0x80, 0x1b };
|
||||
|
||||
void mesh_segemented_message_handler(mesh_transport_pdu_t * transport_pdu){
|
||||
if ( (transport_pdu->len == sizeof(config_composition_data_get)) && memcmp(transport_pdu->data, config_composition_data_get, sizeof(config_composition_data_get)) == 0){
|
||||
@ -693,6 +729,9 @@ void mesh_segemented_message_handler(mesh_transport_pdu_t * transport_pdu){
|
||||
if ( (transport_pdu->len > sizeof(config_appkey_add)) && memcmp(transport_pdu->data, config_appkey_add, sizeof(config_appkey_add)) == 0){
|
||||
config_appkey_add_handler(transport_pdu);
|
||||
}
|
||||
if ( (transport_pdu->len > sizeof(config_model_subscription_add)) && memcmp(transport_pdu->data, config_model_subscription_add, sizeof(config_model_subscription_add)) == 0){
|
||||
config_model_subscription_add_handler(transport_pdu);
|
||||
}
|
||||
}
|
||||
|
||||
int btstack_main(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user