mesh: implement Config Beacon Set configuration client message [a2463]

This commit is contained in:
Milanka Ringwald 2019-12-06 14:48:10 +01:00
parent 699be93dac
commit 5448198c8e
2 changed files with 26 additions and 4 deletions

View File

@ -76,13 +76,12 @@ static uint8_t mesh_access_validate_envelop_params(mesh_model_t * mesh_model, ui
static const mesh_access_message_t mesh_configuration_client_beacon_get = {
MESH_FOUNDATION_OPERATION_BEACON_GET, ""
};
#if 0
static const mesh_access_message_t mesh_configuration_client_beacon_set = {
MESH_FOUNDATION_OPERATION_BEACON_SET, "1"
};
#if 0
static const mesh_access_message_t mesh_configuration_client_composition_data_get = {
MESH_FOUNDATION_OPERATION_COMPOSITION_DATA_GET, "1"
};
@ -133,6 +132,19 @@ uint8_t mesh_configuration_client_send_message_config_beacon_get(mesh_model_t *
return ERROR_CODE_SUCCESS;;
}
uint8_t mesh_configuration_client_send_message_config_beacon_set(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index, uint8_t beacon){
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
if (status != ERROR_CODE_SUCCESS) return status;
if (beacon > 1) return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
mesh_network_pdu_t * network_pdu = mesh_access_setup_unsegmented_message(&mesh_configuration_client_beacon_set, beacon);
if (!network_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
mesh_configuration_client_send_message_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) network_pdu, MESH_FOUNDATION_OPERATION_BEACON_STATUS);
return ERROR_CODE_SUCCESS;;
}
// Model Operations
static void mesh_configuration_client_status_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu){
mesh_access_parser_state_t parser;

View File

@ -55,15 +55,25 @@ extern "C"
void mesh_configuration_client_register_packet_handler(mesh_model_t *configuration_client_model, btstack_packet_handler_t events_packet_handler);
/**
* @brief Get configuration beacon
* @brief Get the current Secure Network Beacon state of a node.
* @param mesh_model
* @param dest
* @param netkey_index
* @param appkey_index
* @return status ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED
* @return status ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED or ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE
*/
uint8_t mesh_configuration_client_send_message_config_beacon_get(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index);
/**
* @brief Get the current Secure Network Beacon state of a node.
* @param mesh_model
* @param dest
* @param netkey_index
* @param appkey_index
* @param Beacon 0x01 The node is broadcasting a Secure Network beacon, 0x00 broadcastinis off
* @return status ERROR_CODE_SUCCESS if successful, otherwise BTSTACK_MEMORY_ALLOC_FAILED or ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE
*/
uint8_t mesh_configuration_client_send_message_config_beacon_set(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index, uint8_t beacon);
#ifdef __cplusplus
} /* end of extern "C" */