mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 22:20:37 +00:00
mesh: send active features in hearbeat transport pdu
This commit is contained in:
parent
0e9fe84441
commit
e65ae0419a
@ -59,6 +59,8 @@
|
||||
|
||||
typedef struct {
|
||||
btstack_timer_source_t timer;
|
||||
uint16_t active_features;
|
||||
//
|
||||
uint16_t destination;
|
||||
uint16_t count_log;
|
||||
uint8_t period_log;
|
||||
@ -1748,11 +1750,14 @@ static void config_heartbeat_publication_emit(btstack_timer_source_t * ts){
|
||||
printf("CONFIG_SERVER_HEARTBEAT: Emit (dest %04x, count %u, period %u ms, seq %x)\n", mesh_heartbeat_publication.destination, mesh_heartbeat_publication.count_log, time_ms, mesh_lower_transport_peek_seq());
|
||||
mesh_heartbeat_publication.count_log--;
|
||||
|
||||
// active features
|
||||
mesh_heartbeat_publication.active_features = mesh_foundation_get_features();
|
||||
|
||||
mesh_network_pdu_t * network_pdu = mesh_network_pdu_get();
|
||||
if (network_pdu){
|
||||
uint8_t data[3];
|
||||
data[0] = mesh_heartbeat_publication.ttl;
|
||||
big_endian_store_16(data, 1, mesh_heartbeat_publication.features);
|
||||
big_endian_store_16(data, 1, mesh_heartbeat_publication.active_features);
|
||||
mesh_upper_transport_setup_control_pdu((mesh_pdu_t *) network_pdu, mesh_heartbeat_publication.netkey_index,
|
||||
mesh_heartbeat_publication.ttl, mesh_access_get_primary_element_address(), mesh_heartbeat_publication.destination,
|
||||
MESH_TRANSPORT_OPCODE_HEARTBEAT, data, sizeof(data));
|
||||
|
@ -50,18 +50,27 @@ static uint8_t mesh_foundation_default_ttl = 7;
|
||||
static uint8_t mesh_foundation_network_transmit = (10 << 3) | 2; // step 300 ms, send 3 times
|
||||
static uint8_t mesh_foundation_relay = MESH_FOUNDATION_STATE_NOT_SUPPORTED;
|
||||
static uint8_t mesh_foundation_relay_retransmit = 0;
|
||||
static uint8_t mesh_foundation_friend = MESH_FOUNDATION_STATE_NOT_SUPPORTED; // not supported
|
||||
static uint8_t mesh_foundation_friend = MESH_FOUNDATION_STATE_NOT_SUPPORTED; // not supported
|
||||
static uint8_t mesh_foundation_low_power = MESH_FOUNDATION_STATE_NOT_SUPPORTED;
|
||||
|
||||
void mesh_foundation_gatt_proxy_set(uint8_t ttl){
|
||||
mesh_foundation_gatt_proxy = ttl;
|
||||
void mesh_foundation_gatt_proxy_set(uint8_t value){
|
||||
mesh_foundation_gatt_proxy = value;
|
||||
printf("MESH: GATT PROXY %x\n", mesh_foundation_gatt_proxy);
|
||||
}
|
||||
uint8_t mesh_foundation_gatt_proxy_get(void){
|
||||
return mesh_foundation_gatt_proxy;
|
||||
}
|
||||
|
||||
void mesh_foundation_beacon_set(uint8_t ttl){
|
||||
mesh_foundation_beacon = ttl;
|
||||
void mesh_foundation_low_power_set(uint8_t value){
|
||||
mesh_foundation_low_power = value;
|
||||
printf("MESH: LOW POWER %x\n", mesh_foundation_low_power);
|
||||
}
|
||||
uint8_t mesh_foundation_low_power_get(void){
|
||||
return mesh_foundation_low_power;
|
||||
}
|
||||
|
||||
void mesh_foundation_beacon_set(uint8_t value){
|
||||
mesh_foundation_beacon = value;
|
||||
printf("MESH: Secure Network Beacon %x\n", mesh_foundation_beacon);
|
||||
}
|
||||
uint8_t mesh_foundation_beacon_get(void){
|
||||
@ -76,8 +85,8 @@ uint8_t mesh_foundation_default_ttl_get(void){
|
||||
return mesh_foundation_default_ttl;
|
||||
}
|
||||
|
||||
void mesh_foundation_friend_set(uint8_t ttl){
|
||||
mesh_foundation_friend = ttl;
|
||||
void mesh_foundation_friend_set(uint8_t value){
|
||||
mesh_foundation_friend = value;
|
||||
printf("MESH: Friend = 0x%x\n", mesh_foundation_friend);
|
||||
}
|
||||
uint8_t mesh_foundation_friend_get(void){
|
||||
@ -109,3 +118,20 @@ void mesh_foundation_relay_retransmit_set(uint8_t relay_retransmit){
|
||||
uint8_t mesh_foundation_relay_retransmit_get(void){
|
||||
return mesh_foundation_relay_retransmit;
|
||||
}
|
||||
|
||||
uint16_t mesh_foundation_get_features(void){
|
||||
uint16_t active_features = 0;
|
||||
if (mesh_foundation_low_power_get() == 1){
|
||||
active_features |= 1 << 3;
|
||||
}
|
||||
if (mesh_foundation_friend_get() == 1){
|
||||
active_features |= 1 << 2;
|
||||
}
|
||||
if (mesh_foundation_gatt_proxy_get() == 1){
|
||||
active_features |= 1 << 1;
|
||||
}
|
||||
if (mesh_foundation_relay_get() == 1){
|
||||
active_features |= 1 << 0;
|
||||
}
|
||||
return active_features;
|
||||
}
|
||||
|
@ -170,9 +170,9 @@ extern "C"
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ttl
|
||||
* @param value on/off
|
||||
*/
|
||||
void mesh_foundation_gatt_proxy_set(uint8_t ttl);
|
||||
void mesh_foundation_gatt_proxy_set(uint8_t value);
|
||||
|
||||
/**
|
||||
*
|
||||
@ -182,9 +182,9 @@ uint8_t mesh_foundation_gatt_proxy_get(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ttl
|
||||
* @param value on/off
|
||||
*/
|
||||
void mesh_foundation_beacon_set(uint8_t ttl);
|
||||
void mesh_foundation_beacon_set(uint8_t value);
|
||||
|
||||
/**
|
||||
*
|
||||
@ -203,11 +203,12 @@ void mesh_foundation_default_ttl_set(uint8_t ttl);
|
||||
* @return
|
||||
*/
|
||||
uint8_t mesh_foundation_default_ttl_get(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ttl
|
||||
* @param value on/off
|
||||
*/
|
||||
void mesh_foundation_friend_set(uint8_t ttl);
|
||||
void mesh_foundation_friend_set(uint8_t value);
|
||||
|
||||
/**
|
||||
*
|
||||
@ -215,6 +216,18 @@ void mesh_foundation_friend_set(uint8_t ttl);
|
||||
*/
|
||||
uint8_t mesh_foundation_friend_get(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value on/off
|
||||
*/
|
||||
void mesh_foundation_low_power_set(uint8_t value);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
uint8_t mesh_foundation_low_power_get(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param network_transmit
|
||||
@ -250,6 +263,11 @@ void mesh_foundation_relay_retransmit_set(uint8_t relay_retransmit);
|
||||
*/
|
||||
uint8_t mesh_foundation_relay_retransmit_get(void);
|
||||
|
||||
/**
|
||||
* @brief Get Features map (Relay, Proxy, Friend, Low Power)
|
||||
*/
|
||||
uint16_t mesh_foundation_get_features(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user