mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-02 07:20:16 +00:00
mesh: extract mesh_proxy_set_advertising_with_node_id from config server
This commit is contained in:
parent
af6e0db766
commit
ad9347bb4d
@ -2055,27 +2055,7 @@ static void config_node_identity_set_handler(mesh_model_t *mesh_model, mesh_pdu_
|
|||||||
uint16_t netkey_index = mesh_access_parser_get_u16(&parser);
|
uint16_t netkey_index = mesh_access_parser_get_u16(&parser);
|
||||||
mesh_node_identity_state_t node_identity_state = (mesh_node_identity_state_t) mesh_access_parser_get_u8(&parser);
|
mesh_node_identity_state_t node_identity_state = (mesh_node_identity_state_t) mesh_access_parser_get_u8(&parser);
|
||||||
|
|
||||||
uint8_t status = MESH_FOUNDATION_STATUS_FEATURE_NOT_SUPPORTED;
|
uint8_t status = mesh_proxy_set_advertising_with_node_id(netkey_index, node_identity_state);
|
||||||
|
|
||||||
mesh_network_key_t * network_key = mesh_network_key_list_get(netkey_index);
|
|
||||||
if (network_key == NULL){
|
|
||||||
status = MESH_FOUNDATION_STATUS_INVALID_NETKEY_INDEX;
|
|
||||||
} else {
|
|
||||||
#ifdef ENABLE_MESH_PROXY_SERVER
|
|
||||||
switch (node_identity_state){
|
|
||||||
case MESH_NODE_IDENTITY_STATE_ADVERTISING_STOPPED:
|
|
||||||
mesh_proxy_stop_advertising_with_node_id(netkey_index);
|
|
||||||
status = MESH_FOUNDATION_STATUS_SUCCESS;
|
|
||||||
break;
|
|
||||||
case MESH_NODE_IDENTITY_STATE_ADVERTISING_RUNNING:
|
|
||||||
mesh_proxy_start_advertising_with_node_id(netkey_index);
|
|
||||||
status = MESH_FOUNDATION_STATUS_SUCCESS;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
config_node_identity_status(mesh_model, mesh_pdu_netkey_index(pdu), mesh_pdu_src(pdu), status, netkey_index, node_identity_state);
|
config_node_identity_status(mesh_model, mesh_pdu_netkey_index(pdu), mesh_pdu_src(pdu), status, netkey_index, node_identity_state);
|
||||||
mesh_access_message_processed(pdu);
|
mesh_access_message_processed(pdu);
|
||||||
|
@ -145,7 +145,6 @@ void mesh_proxy_stop_advertising_with_node_id(uint16_t netkey_index){
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t mesh_proxy_get_advertising_with_node_id_status(uint16_t netkey_index, mesh_node_identity_state_t * out_state ){
|
uint8_t mesh_proxy_get_advertising_with_node_id_status(uint16_t netkey_index, mesh_node_identity_state_t * out_state ){
|
||||||
|
|
||||||
mesh_network_key_t * network_key = mesh_network_key_list_get(netkey_index);
|
mesh_network_key_t * network_key = mesh_network_key_list_get(netkey_index);
|
||||||
if (network_key == NULL){
|
if (network_key == NULL){
|
||||||
*out_state = MESH_NODE_IDENTITY_STATE_ADVERTISING_NOT_SUPPORTED;
|
*out_state = MESH_NODE_IDENTITY_STATE_ADVERTISING_NOT_SUPPORTED;
|
||||||
@ -165,6 +164,28 @@ uint8_t mesh_proxy_get_advertising_with_node_id_status(uint16_t netkey_index, me
|
|||||||
return MESH_FOUNDATION_STATUS_SUCCESS;
|
return MESH_FOUNDATION_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t mesh_proxy_set_advertising_with_node_id(uint16_t netkey_index, mesh_node_identity_state_t state){
|
||||||
|
mesh_network_key_t * network_key = mesh_network_key_list_get(netkey_index);
|
||||||
|
if (network_key == NULL){
|
||||||
|
return MESH_FOUNDATION_STATUS_INVALID_NETKEY_INDEX;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_MESH_PROXY_SERVER
|
||||||
|
switch (state){
|
||||||
|
case MESH_NODE_IDENTITY_STATE_ADVERTISING_STOPPED:
|
||||||
|
mesh_proxy_stop_advertising_with_node_id(netkey_index);
|
||||||
|
return MESH_FOUNDATION_STATUS_SUCCESS;
|
||||||
|
case MESH_NODE_IDENTITY_STATE_ADVERTISING_RUNNING:
|
||||||
|
mesh_proxy_start_advertising_with_node_id(netkey_index);
|
||||||
|
return MESH_FOUNDATION_STATUS_SUCCESS;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return MESH_FOUNDATION_STATUS_FEATURE_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void mesh_proxy_start_advertising_with_network_id(void){
|
void mesh_proxy_start_advertising_with_network_id(void){
|
||||||
mesh_network_key_iterator_t it;
|
mesh_network_key_iterator_t it;
|
||||||
|
@ -69,6 +69,13 @@ void mesh_proxy_start_advertising_with_node_id(uint16_t netkey_index);
|
|||||||
*/
|
*/
|
||||||
void mesh_proxy_stop_advertising_with_node_id(uint16_t netkey_index);
|
void mesh_proxy_stop_advertising_with_node_id(uint16_t netkey_index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set Advertising with Node ID on given subnet
|
||||||
|
* @param netkey_index of subnet
|
||||||
|
* @returns MESH_FOUNDATION_STATUS_SUCCESS, MESH_FOUNDATION_STATUS_FEATURE_NOT_SUPPORTED, or MESH_FOUNDATION_STATUS_INVALID_NETKEY_INDEX
|
||||||
|
*/
|
||||||
|
uint8_t mesh_proxy_set_advertising_with_node_id(uint16_t netkey_index, mesh_node_identity_state_t state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if Advertising with Node ID is active
|
* @brief Check if Advertising with Node ID is active
|
||||||
* @param netey_index of subnet
|
* @param netey_index of subnet
|
||||||
|
Loading…
x
Reference in New Issue
Block a user