mesh: Encapsulate feature config

Moves mesh feature configuration to a separate module, deprecating the
bt_mesh_cfg_srv structure. The initial values for the features should
now be enabled through KConfig, where new config entries have been added
for each feature.

This removes the upward dependency on the config server from the core
stack, and makes the config server a pure frontend for the configuration
states, as all spec mandated behavior around the feature states is now
encapsulated.

this is port of ad2fd44d7ad915e66765ba17ce53d4c5829a0efb
This commit is contained in:
Krzysztof Kopyściński
2021-01-12 14:05:19 +01:00
committed by Łukasz Rymanowski
parent c06a03adfc
commit 011dbfda65
28 changed files with 669 additions and 583 deletions
+1 -21
View File
@@ -40,26 +40,6 @@ static int recent_test_id = STANDARD_TEST_ID;
static bool has_reg_fault = true;
static struct bt_mesh_cfg_srv cfg_srv = {
.relay = BT_MESH_RELAY_ENABLED,
.beacon = BT_MESH_BEACON_ENABLED,
#if MYNEWT_VAL(BLE_MESH_FRIEND)
.frnd = BT_MESH_FRIEND_ENABLED,
#else
.frnd = BT_MESH_FRIEND_NOT_SUPPORTED ,
#endif
#if MYNEWT_VAL(BLE_MESH_GATT_PROXY)
.gatt_proxy = BT_MESH_GATT_PROXY_ENABLED,
#else
.gatt_proxy = BT_MESH_GATT_PROXY_NOT_SUPPORTED,
#endif
.default_ttl = 7,
/* 3 transmissions with 20ms interval */
.net_transmit = BT_MESH_TRANSMIT(2, 20),
.relay_retransmit = BT_MESH_TRANSMIT(2, 20),
};
static int
fault_get_cur(struct bt_mesh_model *model,
uint8_t *test_id,
@@ -323,7 +303,7 @@ static const struct bt_mesh_model_op gen_level_op[] = {
};
static struct bt_mesh_model root_models[] = {
BT_MESH_MODEL_CFG_SRV(&cfg_srv),
BT_MESH_MODEL_CFG_SRV,
BT_MESH_MODEL_HEALTH_SRV(&health_srv, &health_pub),
BT_MESH_MODEL(BT_MESH_MODEL_ID_GEN_ONOFF_SRV, gen_onoff_op,
&gen_onoff_pub, NULL),
@@ -1192,6 +1192,42 @@
#define MYNEWT_VAL_BLE_MESH_LOOPBACK_BUFS (3)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_DEFAULT_TTL
#define MYNEWT_VAL_BLE_MESH_DEFAULT_TTL (7)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_NETWORK_TRANSMIT_COUNT
#define MYNEWT_VAL_BLE_MESH_NETWORK_TRANSMIT_COUNT (2)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_NETWORK_TRANSMIT_INTERVAL
#define MYNEWT_VAL_BLE_MESH_NETWORK_TRANSMIT_INTERVAL (20)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_RELAY_RETRANSMIT_COUNT
#define MYNEWT_VAL_BLE_MESH_RELAY_RETRANSMIT_COUNT (2)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_BEACON_ENABLED
#define MYNEWT_VAL_BLE_MESH_BEACON_ENABLED (1)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_GATT_PROXY_ENABLED
#define MYNEWT_VAL_BLE_MESH_GATT_PROXY_ENABLED (1)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_FRIEND_ENABLED
#define MYNEWT_VAL_BLE_MESH_FRIEND_ENABLED (1)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_RELAY_ENABLED
#define MYNEWT_VAL_BLE_MESH_RELAY_ENABLED (1)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_RELAY_RETRANSMIT_INTERVAL
#define MYNEWT_VAL_BLE_MESH_RELAY_RETRANSMIT_INTERVAL (20)
#endif
/*** @apache-mynewt-nimble/nimble/host/services/ans */
#ifndef MYNEWT_VAL_BLE_SVC_ANS_NEW_ALERT_CAT
#define MYNEWT_VAL_BLE_SVC_ANS_NEW_ALERT_CAT (0)