mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-28 16:11:24 +00:00
mesh: foundation message subscription_deleteall
This commit is contained in:
parent
7849b63391
commit
5f6e8f7ce0
@ -1679,6 +1679,13 @@ static void mesh_model_overwrite_subscription(mesh_model_t * mesh_model, uint16_
|
||||
}
|
||||
}
|
||||
|
||||
static void mesh_model_deleteall_subscription(mesh_model_t * mesh_model){
|
||||
int i;
|
||||
for (i=0;i<MAX_NR_MESH_SUBSCRIPTION_PER_MODEL;i++){
|
||||
mesh_model->subscriptions[i] = MESH_ADDRESS_UNSASSIGNED;
|
||||
}
|
||||
}
|
||||
|
||||
static int mesh_model_is_configuration_server(uint32_t model_identifier){
|
||||
return mesh_model_is_bluetooth_sig(model_identifier) && (mesh_model_get_model_id(model_identifier) == MESH_SIG_MODEL_ID_CONFIGURATION_SERVER);
|
||||
}
|
||||
@ -2432,6 +2439,24 @@ static void config_model_subscription_delete_handler(mesh_model_t *mesh_model, m
|
||||
mesh_access_message_processed(pdu);
|
||||
}
|
||||
|
||||
static void config_model_subscription_delete_all_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu){
|
||||
mesh_access_parser_state_t parser;
|
||||
mesh_access_parser_init(&parser, (mesh_pdu_t*) pdu);
|
||||
|
||||
uint16_t element_address = mesh_access_parser_get_u16(&parser);
|
||||
uint32_t model_identifier = mesh_access_parser_get_model_identifier(&parser);
|
||||
|
||||
uint8_t status = MESH_FOUNDATION_STATUS_SUCCESS;
|
||||
mesh_model_t * target_model = mesh_access_model_for_address_and_model_identifier(element_address, model_identifier, &status);
|
||||
|
||||
if (target_model != NULL){
|
||||
mesh_model_deleteall_subscription(target_model);
|
||||
}
|
||||
|
||||
config_model_subscription_status(mesh_model, mesh_pdu_netkey_index(pdu), mesh_pdu_src(pdu), status, element_address, MESH_ADDRESS_UNSASSIGNED, model_identifier);
|
||||
mesh_access_message_processed(pdu);
|
||||
}
|
||||
|
||||
static void config_model_subscription_overwrite_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu){
|
||||
mesh_access_parser_state_t parser;
|
||||
mesh_access_parser_init(&parser, (mesh_pdu_t*) pdu);
|
||||
@ -3066,9 +3091,9 @@ static mesh_operation_t mesh_configuration_server_model_operations[] = {
|
||||
{ MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_VIRTUAL_ADDRESS_ADD, 20, config_model_subscription_virtual_address_add_handler },
|
||||
{ MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_DELETE, 6, config_model_subscription_delete_handler },
|
||||
// { MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_VIRTUAL_ADDRESS_DELETE, 20, config_model_subscription_virtual_address_delete_handler },
|
||||
{ MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_OVERWRITE, 6, config_model_subscription_overwrite_handler },
|
||||
{ MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_OVERWRITE, 6, config_model_subscription_delete_all_handler },
|
||||
// { MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_VIRTUAL_ADDRESS_OVERWRITE,20, config_model_subscription_virtual_address_overwrite_handler },
|
||||
// { MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_DELETE_ALL, 4, config_model_subscription_delete_all_handler },
|
||||
{ MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_DELETE_ALL, 4, config_model_subscription_delete_all_handler },
|
||||
// { MESH_FOUNDATION_OPERATION_SIG_MODEL_SUBSCRIPTION_GET, 4, config_sig_model_subscription_get_handler },
|
||||
// { MESH_FOUNDATION_OPERATION_VENDOR_MODEL_SUBSCRIPTION_GET, 6, config_vendor_model_subscription_get_handler },
|
||||
{ MESH_FOUNDATION_OPERATION_SIG_MODEL_APP_GET, 4, config_sig_model_app_get_handler },
|
||||
|
Loading…
x
Reference in New Issue
Block a user