mesh: fix compile, use mesh model to send messages, target model for params

This commit is contained in:
Milanka Ringwald 2019-06-07 11:10:42 +02:00 committed by Matthias Ringwald
parent ff65abb41e
commit 81dc2fe64a

View File

@ -2443,6 +2443,25 @@ static void config_model_subscription_delete_handler(mesh_model_t *mesh_model, m
mesh_access_message_processed(pdu);
}
static void config_model_subscription_virtual_address_delete_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);
uint16_t 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_delete_subscription(target_model, address);
}
config_model_subscription_status(mesh_model, mesh_pdu_netkey_index(pdu), mesh_pdu_src(pdu), status, element_address, address, model_identifier);
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);
@ -2461,7 +2480,7 @@ static void config_model_subscription_delete_all_handler(mesh_model_t *mesh_mode
mesh_access_message_processed(pdu);
}
static void config_model_subscription_list_status(mesh_model_t * target_model, uint16_t netkey_index, uint16_t dest, uint8_t status, uint16_t element_address, uint32_t model_identifier){
static void config_model_subscription_list_status(mesh_model_t * mesh_model, uint16_t netkey_index, uint16_t dest, uint8_t status, uint16_t element_address, uint32_t model_identifier, mesh_model_t * target_model){
uint16_t opcode;
if (mesh_model_is_bluetooth_sig(model_identifier)){
opcode = MESH_FOUNDATION_OPERATION_SIG_MODEL_SUBSCRIPTION_LIST;
@ -2498,7 +2517,7 @@ static void config_model_subscription_get_handler(mesh_model_t *mesh_model, mesh
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);
config_model_subscription_list_status(target_model, mesh_pdu_netkey_index(pdu), mesh_pdu_src(pdu), status, element_address, model_identifier);
config_model_subscription_list_status(mesh_model, mesh_pdu_netkey_index(pdu), mesh_pdu_src(pdu), status, element_address, model_identifier, target_model);
mesh_access_message_processed(pdu);
}
@ -3133,7 +3152,7 @@ static mesh_operation_t mesh_configuration_server_model_operations[] = {
{ MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_ADD, 6, config_model_subscription_add_handler },
{ 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_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_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 },