mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
mesh: configuration client, define and send MESH_SUBEVENT_FOUNDATION_BEACON_STATUS event"
This commit is contained in:
parent
c5d6cafb93
commit
699be93dac
@ -2928,4 +2928,14 @@ typedef uint8_t sm_key_t[16];
|
|||||||
* @param transition_time_gdtt
|
* @param transition_time_gdtt
|
||||||
*/
|
*/
|
||||||
#define MESH_SUBEVENT_GENERIC_DEFAULT_TRANSITION_TIME_STATUS 0x35
|
#define MESH_SUBEVENT_GENERIC_DEFAULT_TRANSITION_TIME_STATUS 0x35
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @format 1211
|
||||||
|
* @param subevent_code
|
||||||
|
* @param dest
|
||||||
|
* @param foundation_status
|
||||||
|
* @param secure_network_beacon_state
|
||||||
|
*/
|
||||||
|
#define MESH_SUBEVENT_FOUNDATION_BEACON_STATUS 0x36
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8008,6 +8008,34 @@ static inline uint8_t mesh_subevent_generic_default_transition_time_status_get_t
|
|||||||
return event[6];
|
return event[6];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field dest from event MESH_SUBEVENT_FOUNDATION_BEACON_STATUS
|
||||||
|
* @param event packet
|
||||||
|
* @return dest
|
||||||
|
* @note: btstack_type 2
|
||||||
|
*/
|
||||||
|
static inline uint16_t mesh_subevent_foundation_beacon_status_get_dest(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 3);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Get field foundation_status from event MESH_SUBEVENT_FOUNDATION_BEACON_STATUS
|
||||||
|
* @param event packet
|
||||||
|
* @return foundation_status
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t mesh_subevent_foundation_beacon_status_get_foundation_status(const uint8_t * event){
|
||||||
|
return event[5];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Get field secure_network_beacon_state from event MESH_SUBEVENT_FOUNDATION_BEACON_STATUS
|
||||||
|
* @param event packet
|
||||||
|
* @return secure_network_beacon_state
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t mesh_subevent_foundation_beacon_status_get_secure_network_beacon_state(const uint8_t * event){
|
||||||
|
return event[6];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* API_END */
|
/* API_END */
|
||||||
|
@ -122,7 +122,7 @@ static const mesh_access_message_t mesh_configuration_client_publication_virtual
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t mesh_configuration_send_message_client_config_beacon_get(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index){
|
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){
|
||||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||||
if (status != ERROR_CODE_SUCCESS) return status;
|
if (status != ERROR_CODE_SUCCESS) return status;
|
||||||
|
|
||||||
@ -133,6 +133,34 @@ uint8_t mesh_configuration_send_message_client_config_beacon_get(mesh_model_t *
|
|||||||
return ERROR_CODE_SUCCESS;;
|
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;
|
||||||
|
mesh_access_parser_init(&parser, (mesh_pdu_t*) pdu);
|
||||||
|
|
||||||
|
uint8_t beacon_status = mesh_access_parser_get_u8(&parser);
|
||||||
|
|
||||||
|
uint8_t event[7] = {HCI_EVENT_MESH_META, 5, MESH_SUBEVENT_FOUNDATION_BEACON_STATUS};
|
||||||
|
int pos = 3;
|
||||||
|
// dest
|
||||||
|
little_endian_store_16(event, pos, mesh_pdu_src(pdu));
|
||||||
|
pos += 2;
|
||||||
|
event[pos++] = ERROR_CODE_SUCCESS;
|
||||||
|
event[pos++] = beacon_status;
|
||||||
|
|
||||||
|
(*mesh_model->model_packet_handler)(HCI_EVENT_PACKET, 0, event, pos);
|
||||||
|
mesh_access_message_processed(pdu);
|
||||||
|
}
|
||||||
|
|
||||||
|
const static mesh_operation_t mesh_configuration_client_model_operations[] = {
|
||||||
|
{ MESH_FOUNDATION_OPERATION_BEACON_STATUS, 0, mesh_configuration_client_status_handler },
|
||||||
|
{ 0, 0, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
const mesh_operation_t * mesh_configuration_client_get_operations(void){
|
||||||
|
return mesh_configuration_client_model_operations;
|
||||||
|
}
|
||||||
|
|
||||||
void mesh_configuration_client_register_packet_handler(mesh_model_t *configuration_client_model, btstack_packet_handler_t events_packet_handler){
|
void mesh_configuration_client_register_packet_handler(mesh_model_t *configuration_client_model, btstack_packet_handler_t events_packet_handler){
|
||||||
btstack_assert(events_packet_handler != NULL);
|
btstack_assert(events_packet_handler != NULL);
|
||||||
btstack_assert(configuration_client_model != NULL);
|
btstack_assert(configuration_client_model != NULL);
|
||||||
|
@ -62,7 +62,7 @@ void mesh_configuration_client_register_packet_handler(mesh_model_t *configurati
|
|||||||
* @param appkey_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
|
||||||
*/
|
*/
|
||||||
uint8_t mesh_configuration_send_message_client_config_beacon_get(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index);
|
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);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user