From 5667c97efeca80d27549a266841c01bb1b754437 Mon Sep 17 00:00:00 2001 From: h2zero Date: Mon, 25 May 2020 18:52:46 -0600 Subject: [PATCH] Add access to the adv type of remote device Adds new method `uint8_t NimBLEAdvertisedDevice::getAdvType()` to get the advertisement type of the found device. --- src/NimBLEAdvertisedDevice.cpp | 10 ++++++++++ src/NimBLEAdvertisedDevice.h | 1 + src/nimconfig.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/NimBLEAdvertisedDevice.cpp b/src/NimBLEAdvertisedDevice.cpp index 3634bac..f81b172 100644 --- a/src/NimBLEAdvertisedDevice.cpp +++ b/src/NimBLEAdvertisedDevice.cpp @@ -62,6 +62,16 @@ NimBLEAddress NimBLEAdvertisedDevice::getAddress() { } // getAddress +/** + * @brief Get the advertised type. + * + * @return The advertised type of the advertised device. + */ +uint8_t NimBLEAdvertisedDevice::getAdvType() { + return m_advType; +} // getAddress + + /** * @brief Get the appearance. * diff --git a/src/NimBLEAdvertisedDevice.h b/src/NimBLEAdvertisedDevice.h index 7a4115f..8f0b78c 100644 --- a/src/NimBLEAdvertisedDevice.h +++ b/src/NimBLEAdvertisedDevice.h @@ -42,6 +42,7 @@ public: NimBLEAdvertisedDevice(); NimBLEAddress getAddress(); + uint8_t getAdvType(); uint16_t getAppearance(); std::string getManufacturerData(); std::string getName(); diff --git a/src/nimconfig.h b/src/nimconfig.h index 94147f1..2fb8d1b 100644 --- a/src/nimconfig.h +++ b/src/nimconfig.h @@ -115,7 +115,9 @@ #define CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM 0 /** Do not comment out */ +#ifndef CONFIG_BT_ENABLED #define CONFIG_BT_ENABLED +#endif #define CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY #define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL