mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2025-12-24 07:38:18 +01:00
Compare commits
2 Commits
mesh-confi
...
mesh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4786960902 | ||
|
|
507f146477 |
@@ -48,13 +48,16 @@ set(srcs "src/NimBLE2904.cpp"
|
||||
"src/NimBLEUUID.cpp")
|
||||
|
||||
if(CONFIG_BT_NIMBLE_MESH)
|
||||
list(APPEND srcs "src/mesh_config_store/config/config_store.c"
|
||||
"src/NimBLEMeshCreateModel.c"
|
||||
list(APPEND srcs "src/NimBLEMeshCreateModel.c"
|
||||
"src/NimBLEMeshElement.cpp"
|
||||
"src/NimBLEMeshModel.cpp"
|
||||
"src/NimBLEMeshNode.cpp")
|
||||
endif()
|
||||
|
||||
if(CONFIG_NIMBLE_CPP_PERSIST_MESH_SETTINGS)
|
||||
list(APPEND srcs "src/mesh_config_store/config/config_store.c")
|
||||
endif()
|
||||
|
||||
idf_component_register(
|
||||
REQUIRED_IDF_TARGETS
|
||||
"esp32"
|
||||
@@ -71,7 +74,7 @@ idf_component_register(
|
||||
${ESP_NIMBLE_PRIV_REQUIRES}
|
||||
)
|
||||
|
||||
if(CONFIG_BT_NIMBLE_MESH)
|
||||
if(CONFIG_BT_NIMBLE_MESH AND CONFIG_NIMBLE_CPP_PERSIST_MESH_SETTINGS)
|
||||
idf_build_set_property(COMPILE_OPTIONS "-DMYNEWT_VAL_BLE_MESH_SETTINGS=1" APPEND)
|
||||
idf_build_set_property(COMPILE_OPTIONS "-I${COMPONENT_DIR}/src/mesh_config_store" APPEND)
|
||||
endif()
|
||||
|
||||
14
Kconfig
14
Kconfig
@@ -33,7 +33,7 @@ config NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT
|
||||
Enabling this option will display return code values as text
|
||||
messages in the debug log. This will use approximately 8kB
|
||||
of flash memory.
|
||||
|
||||
|
||||
config NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT
|
||||
bool "Show NimBLE gap events as text in debug log."
|
||||
default "n"
|
||||
@@ -47,7 +47,7 @@ config NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT
|
||||
default "n"
|
||||
help
|
||||
Enabling this option will display advertisment types recieved
|
||||
while scanning as text messages in the debug log.
|
||||
while scanning as text messages in the debug log.
|
||||
This will use approximately 250 bytes of flash memory.
|
||||
|
||||
config NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
|
||||
@@ -68,5 +68,13 @@ config NIMBLE_CPP_ATT_VALUE_INIT_LENGTH
|
||||
when the constructor is called. This is also the size used when a remote
|
||||
characteristic or descriptor is constructed before a value is read/notifed.
|
||||
Increasing this will reduce reallocations but increase memory footprint.
|
||||
|
||||
|
||||
config NIMBLE_CPP_PERSIST_MESH_SETTINGS
|
||||
bool "Enable persistent storage of mesh config settings."
|
||||
default "n"
|
||||
depends on BT_NIMBLE_MESH
|
||||
help
|
||||
Enabling this option will store the provisioning and app key settings
|
||||
in non-volatile storage when using NimBLE Mesh.
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if CONFIG_BT_NIMBLE_MESH
|
||||
|
||||
#include "NimBLEMeshCreateModel.h"
|
||||
|
||||
static struct bt_mesh_model_cb mod_cb = {
|
||||
@@ -28,3 +31,5 @@ struct bt_mesh_model createGenModel(int16_t _id, struct bt_mesh_model_op* op,
|
||||
struct bt_mesh_model mod = BT_MESH_MODEL_CB(_id, op, pub, udata, &mod_cb);
|
||||
return mod;
|
||||
}
|
||||
|
||||
#endif // CONFIG_BT_NIMBLE_MESH
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if CONFIG_BT_NIMBLE_MESH
|
||||
|
||||
#include "NimBLEMeshElement.h"
|
||||
#include "NimBLELog.h"
|
||||
#include "NimBLEMeshCreateModel.h"
|
||||
@@ -139,4 +142,4 @@ bt_mesh_elem* NimBLEMeshElement::start() {
|
||||
return m_pElem;
|
||||
}
|
||||
|
||||
|
||||
#endif // CONFIG_BT_NIMBLE_MESH
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if CONFIG_BT_NIMBLE_MESH
|
||||
|
||||
#include "NimBLEMeshModel.h"
|
||||
#include "NimBLEUtils.h"
|
||||
#include "NimBLELog.h"
|
||||
@@ -59,6 +62,8 @@ NimBLEMeshModel::NimBLEMeshModel(NimBLEMeshModelCallbacks *pCallbacks,
|
||||
m_transStep = 0;
|
||||
|
||||
memset(&m_opPub, 0, sizeof(m_opPub));
|
||||
memset(&m_tdTimer, 0, sizeof(m_tdTimer));
|
||||
memset(&m_pubTimer, 0, sizeof(m_pubTimer));
|
||||
}
|
||||
|
||||
|
||||
@@ -691,3 +696,5 @@ void NimBLEHealthSrvCallbacks::attentionOff(bt_mesh_model *model)
|
||||
NimBLEMeshModel* pModel = NimBLEDevice::getMeshNode()->getHealthModel(model);
|
||||
pModel->m_callbacks->attentionOff(pModel);
|
||||
}
|
||||
|
||||
#endif // CONFIG_BT_NIMBLE_MESH
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#if CONFIG_BT_NIMBLE_MESH
|
||||
|
||||
#include "NimBLEMeshNode.h"
|
||||
#include "NimBLELog.h"
|
||||
@@ -206,5 +206,4 @@ bool NimBLEMeshNode::start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#endif // CONFIG_BT_ENABLED
|
||||
#endif // CONFIG_BT_NIMBLE_MESH
|
||||
|
||||
@@ -233,6 +233,6 @@ int conf_save_one(const char *name, char *var);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SYSINIT_PANIC_ASSERT_MSG(rc, msg)
|
||||
#define SYSINIT_PANIC_ASSERT_MSG(rc, msg) assert(rc)
|
||||
|
||||
#endif /* __SYS_CONFIG_H_ */
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "nimconfig.h"
|
||||
#ifdef ESP_PLATFORM
|
||||
#if CONFIG_BT_NIMBLE_MESH
|
||||
#if CONFIG_BT_NIMBLE_MESH && CONFIG_NIMBLE_CPP_PERSIST_MESH_SETTINGS
|
||||
|
||||
#include "config.h"
|
||||
#include "nvs.h"
|
||||
@@ -50,7 +50,7 @@ int conf_parse_name(char *name, int *name_argc, char *name_argv[])
|
||||
int conf_load(void)
|
||||
{
|
||||
esp_err_t err;
|
||||
nvs_handle_t handle;
|
||||
nvs_handle handle;
|
||||
|
||||
err = nvs_open(config_handler->ch_name, NVS_READONLY, &handle);
|
||||
if (err != ESP_OK) return err;
|
||||
@@ -73,7 +73,6 @@ int conf_load(void)
|
||||
free(val);
|
||||
return err;
|
||||
}
|
||||
printf("key '%s', type '%d' value %s \n", info.key, info.type, val);
|
||||
}
|
||||
|
||||
int name_argc;
|
||||
@@ -133,5 +132,5 @@ int conf_register(struct conf_handler *cf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // CONFIG_BT_NIMBLE_MESH
|
||||
#endif // CONFIG_BT_NIMBLE_MESH && MYNEWT_VAL_BLE_MESH_SETTINGS
|
||||
#endif // ESP_PLATFORM
|
||||
|
||||
Reference in New Issue
Block a user