Skip to content

Commit 3a9fe64

Browse files
committed
Add lib name/metadata to version string and log at initialization.
1 parent 3ce11f0 commit 3a9fe64

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

src/NimBLECppVersion.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,28 @@
5353
#define NIMBLE_CPP_VERSION_STRINGIFY(x) NIMBLE_CPP_VERSION_STRINGIFY_IMPL(x)
5454
/** @endcond */
5555

56-
/** @brief NimBLE-Arduino library version as a string. */
56+
/**
57+
* @brief Optional Semantic Versioning prerelease suffix.
58+
* @details Include the leading '-' when defined, for example: "-beta.1"
59+
*/
60+
#ifndef NIMBLE_CPP_VERSION_PRERELEASE
61+
# define NIMBLE_CPP_VERSION_PRERELEASE ""
62+
#endif
63+
64+
/**
65+
* @brief Optional Semantic Versioning build metadata suffix.
66+
* @details Include the leading '+' when defined, for example: "+sha.abcd1234"
67+
*/
68+
#ifndef NIMBLE_CPP_VERSION_BUILD_METADATA
69+
# define NIMBLE_CPP_VERSION_BUILD_METADATA ""
70+
#endif
71+
72+
/** @brief NimBLE-Arduino library version as a prefixed Semantic Versioning string. */
5773
#define NIMBLE_CPP_VERSION_STR \
74+
"NimBLE-Arduino " \
5875
NIMBLE_CPP_VERSION_STRINGIFY(NIMBLE_CPP_VERSION_MAJOR) "." \
5976
NIMBLE_CPP_VERSION_STRINGIFY(NIMBLE_CPP_VERSION_MINOR) "." \
60-
NIMBLE_CPP_VERSION_STRINGIFY(NIMBLE_CPP_VERSION_PATCH)
77+
NIMBLE_CPP_VERSION_STRINGIFY(NIMBLE_CPP_VERSION_PATCH) \
78+
NIMBLE_CPP_VERSION_PRERELEASE NIMBLE_CPP_VERSION_BUILD_METADATA
6179

6280
#endif // NIMBLE_CPP_VERSION_H_

src/NimBLEDevice.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ void NimBLEDevice::onSync(void) {
867867
* @brief The main host task.
868868
*/
869869
void NimBLEDevice::host_task(void* param) {
870-
NIMBLE_LOGI(LOG_TAG, "BLE Host Task Started");
870+
NIMBLE_LOGI(LOG_TAG, "NimBLE Started!");
871871
nimble_port_run(); // This function will return only when nimble_port_stop() is executed
872872
nimble_port_freertos_deinit();
873873
} // host_task
@@ -878,6 +878,7 @@ void NimBLEDevice::host_task(void* param) {
878878
*/
879879
bool NimBLEDevice::init(const std::string& deviceName) {
880880
if (!m_initialized) {
881+
NIMBLE_LOGD(LOG_TAG, "Starting %s", getVersion());
881882
# ifdef ESP_PLATFORM
882883

883884
# if defined(CONFIG_ENABLE_ARDUINO_DEPENDS) && SOC_BT_SUPPORTED
@@ -999,6 +1000,7 @@ bool NimBLEDevice::init(const std::string& deviceName) {
9991000
}
10001001

10011002
m_initialized = true; // Set the initialization flag to ensure we are only initialized once.
1003+
NIMBLE_LOGD(LOG_TAG, "Initialized");
10021004
return true;
10031005
} // init
10041006

@@ -1331,7 +1333,7 @@ std::string NimBLEDevice::toString() {
13311333

13321334
/**
13331335
* @brief Return the library version as a string.
1334-
* @return A const char* containing the version string in the format "major.minor.patch".
1336+
* @return A const char* containing library version information.
13351337
*/
13361338
const char* NimBLEDevice::getVersion() {
13371339
return NIMBLE_CPP_VERSION_STR;

0 commit comments

Comments
 (0)