Merge pull request #145 from michal-narajowski/mesh-settings-fix

mesh: Add option to not compile Mesh settings/storage
This commit is contained in:
Michał Narajowski
2018-07-24 16:20:43 +02:00
committed by GitHub
5 changed files with 35 additions and 13 deletions
+14 -7
View File
@@ -41,7 +41,9 @@
#include "tinycrypt/cmac_mode.h"
#include "tinycrypt/ecc_dh.h"
#if MYNEWT_VAL(BLE_MESH_SETTINGS)
#include "config/config.h"
#endif
#define u8_t uint8_t
#define s8_t int8_t
@@ -430,13 +432,8 @@ void net_buf_slist_merge_slist(struct net_buf_slist_t *list,
struct net_buf_slist_t *list_to_append);
#define NET_BUF_SLIST_FOR_EACH_NODE(head, var) STAILQ_FOREACH(var, head, omp_next)
/**
* Load serialized items from registered persistence sources. Handlers for
* serialized item subtrees registered earlier will be called for encountered
* values.
*
* @return 0 on success, non-zero on failure.
*/
#if MYNEWT_VAL(BLE_MESH_SETTINGS)
#define settings_load conf_load
int settings_bytes_from_str(char *val_str, void *vp, int *len);
char *settings_str_from_bytes(void *vp, int vp_len, char *buf, int buf_len);
@@ -445,4 +442,14 @@ char *settings_str_from_bytes(void *vp, int vp_len, char *buf, int buf_len);
#define BT_SETTINGS_SIZE(in_size) ((((((in_size) - 1) / 3) * 4) + 4) + 1)
#define settings_save_one conf_save_one
#else
static inline int
settings_load(void)
{
return 0;
}
#endif /* MYNEWT_VAL(MYNEWT_VAL_BLE_MESH_SETTINGS) */
#endif
+4 -2
View File
@@ -30,14 +30,16 @@ pkg.deps:
- "@apache-mynewt-core/kernel/os"
- "@apache-mynewt-core/util/mem"
- "@apache-mynewt-core/crypto/tinycrypt"
- "@apache-mynewt-core/encoding/base64"
- "@apache-mynewt-core/sys/config"
- nimble
- nimble/host
pkg.deps.BLE_MESH_SHELL:
- "@apache-mynewt-core/sys/shell"
pkg.deps.BLE_MESH_SETTINGS:
- "@apache-mynewt-core/encoding/base64"
- "@apache-mynewt-core/sys/config"
pkg.req_apis:
- log
- stats
+8 -1
View File
@@ -17,13 +17,16 @@
* under the License.
*/
#include "base64/base64.h"
#include "mesh/glue.h"
#include "adv.h"
#ifndef MYNEWT
#include "nimble/nimble_port.h"
#endif
#if MYNEWT_VAL(BLE_MESH_SETTINGS)
#include "base64/base64.h"
#endif
#define BT_DBG_ENABLED (MYNEWT_VAL(BLE_MESH_DEBUG))
#if MYNEWT_VAL(BLE_EXT_ADV)
@@ -827,6 +830,8 @@ void net_buf_slist_merge_slist(struct net_buf_slist_t *list,
STAILQ_INIT(list);
}
#if MYNEWT_VAL(BLE_MESH_SETTINGS)
int settings_bytes_from_str(char *val_str, void *vp, int *len)
{
*len = base64_decode(val_str, vp);
@@ -844,3 +849,5 @@ char *settings_str_from_bytes(void *vp, int vp_len, char *buf, int buf_len)
return buf;
}
#endif /* MYNEWT_VAL(BLE_MESH_SETTINGS) */
+3 -3
View File
@@ -236,9 +236,9 @@ int bt_mesh_init(uint8_t own_addr_type, const struct bt_mesh_prov *prov,
ble_gap_mesh_cb_register(bt_mesh_gap_event, NULL);
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
bt_mesh_settings_init();
}
#if (MYNEWT_VAL(BLE_MESH_SETTINGS))
bt_mesh_settings_init();
#endif
return 0;
}
+6
View File
@@ -4,6 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include "syscfg/syscfg.h"
#if MYNEWT_VAL(BLE_MESH_SETTINGS)
#define BT_DBG_ENABLED MYNEWT_VAL(BLE_MESH_DEBUG_SETTINGS)
#include "mesh/mesh.h"
@@ -1573,3 +1577,5 @@ void bt_mesh_settings_init(void)
k_delayed_work_init(&pending_store, store_pending);
}
#endif /* MYNEWT_VAL(BLE_MESH_SETTINGS) */