mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-25 15:41:00 +00:00
mesh: provide src,dest,hops,features to mesh_configuration_server_process_heartbeat
This commit is contained in:
parent
be22c60c15
commit
cf858fe010
@ -1085,9 +1085,19 @@ static void mesh_control_message_handler(mesh_pdu_t * pdu){
|
|||||||
// get opcode
|
// get opcode
|
||||||
uint8_t opcode = mesh_pdu_control_opcode(pdu);
|
uint8_t opcode = mesh_pdu_control_opcode(pdu);
|
||||||
printf("Opcode: 0x%02x\n", opcode);
|
printf("Opcode: 0x%02x\n", opcode);
|
||||||
|
|
||||||
|
uint8_t init_ttl;
|
||||||
|
uint8_t hops = 0;
|
||||||
|
uint16_t features = 0;
|
||||||
switch(opcode){
|
switch(opcode){
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
mesh_configuration_server_process_heartbeat(&mesh_configuration_server_model, pdu);
|
// read params
|
||||||
|
init_ttl = (*mesh_pdu_data(pdu)) & 0x7fu;
|
||||||
|
features = big_endian_read_16(mesh_pdu_data(pdu), 1);
|
||||||
|
// calculates hops
|
||||||
|
hops = init_ttl - mesh_pdu_ttl(pdu) + 1;
|
||||||
|
// process heartbeat info
|
||||||
|
mesh_configuration_server_process_heartbeat(&mesh_configuration_server_model, mesh_pdu_src(pdu), mesh_pdu_dst(pdu), hops, features);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -2245,10 +2245,12 @@ const mesh_operation_t * mesh_configuration_server_get_operations(void){
|
|||||||
return mesh_configuration_server_model_operations;
|
return mesh_configuration_server_model_operations;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mesh_configuration_server_process_heartbeat(mesh_model_t * configuration_server_model, mesh_pdu_t * pdu){
|
void mesh_configuration_server_process_heartbeat(mesh_model_t * configuration_server_model, uint16_t src, uint16_t dest, uint8_t hops, uint16_t features){
|
||||||
mesh_heartbeat_subscription_t * mesh_heartbeat_subscription = &((mesh_configuration_server_model_context_t*) configuration_server_model->model_data)->heartbeat_subscription;
|
mesh_heartbeat_subscription_t * mesh_heartbeat_subscription = &((mesh_configuration_server_model_context_t*) configuration_server_model->model_data)->heartbeat_subscription;
|
||||||
if (config_heartbeat_subscription_get_period_remaining_s(mesh_heartbeat_subscription) == 0) return;
|
if (config_heartbeat_subscription_get_period_remaining_s(mesh_heartbeat_subscription) == 0) return;
|
||||||
if (mesh_heartbeat_subscription->source != mesh_pdu_src(pdu)) return;
|
if (mesh_heartbeat_subscription->source != src) return;
|
||||||
|
if (mesh_heartbeat_subscription->destination != dest) return;
|
||||||
|
// update count
|
||||||
if (mesh_heartbeat_subscription->count != 0xffff){
|
if (mesh_heartbeat_subscription->count != 0xffff){
|
||||||
mesh_heartbeat_subscription->count++;
|
mesh_heartbeat_subscription->count++;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ const mesh_operation_t * mesh_configuration_server_get_operations(void);
|
|||||||
|
|
||||||
void mesh_configuration_server_feature_changed(void);
|
void mesh_configuration_server_feature_changed(void);
|
||||||
|
|
||||||
void mesh_configuration_server_process_heartbeat(mesh_model_t * configuration_server_model, mesh_pdu_t * pdu);
|
void mesh_configuration_server_process_heartbeat(mesh_model_t * configuration_server_model, uint16_t src, uint16_t dest, uint8_t hops, uint16_t features);
|
||||||
|
|
||||||
// PTS Testing
|
// PTS Testing
|
||||||
void config_nekey_list_set_max(uint16_t max);
|
void config_nekey_list_set_max(uint16_t max);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user