Skip to content

Commit a237bdd

Browse files
committed
[Bugfix] NimBLEAdvertisedDevice::isConnectable incorrect result
1 parent e6e8019 commit a237bdd

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/NimBLEAdvertisedDevice.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ const NimBLEAddress& NimBLEAdvertisedDevice::getAddress() const {
8686
/**
8787
* @brief Get the advertisement type.
8888
* @return The advertising type the device is reporting:
89-
* * BLE_HCI_ADV_TYPE_ADV_IND (0) - indirect advertising
90-
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertising - high duty cycle
91-
* * BLE_HCI_ADV_TYPE_ADV_SCAN_IND (2) - indirect scan response
92-
* * BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertising - not connectable
93-
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD (4) - direct advertising - low duty cycle
89+
* * BLE_HCI_ADV_RPT_EVTYPE_ADV_IND (0) - indirect advertising - connectable and scannable
90+
* * BLE_HCI_ADV_RPT_EVTYPE_DIR_IND (1) - direct advertising - connectable
91+
* * BLE_HCI_ADV_RPT_EVTYPE_SCAN_IND (2) - indirect scan response - not connectable - scannable
92+
* * BLE_HCI_ADV_RPT_EVTYPE_NONCONN_IND (3) - beacon only - not connectable - not scannable
93+
* * BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP (4) - scan response
9494
*/
9595
uint8_t NimBLEAdvertisedDevice::getAdvType() const {
9696
return m_advType;
@@ -752,11 +752,12 @@ uint8_t NimBLEAdvertisedDevice::getAddressType() const {
752752
*/
753753
bool NimBLEAdvertisedDevice::isConnectable() const {
754754
# if CONFIG_BT_NIMBLE_EXT_ADV
755-
if (m_isLegacyAdv) {
756-
return m_advType == BLE_HCI_ADV_RPT_EVTYPE_ADV_IND || m_advType == BLE_HCI_ADV_RPT_EVTYPE_DIR_IND;
755+
if (!m_isLegacyAdv) {
756+
return (m_advType & BLE_HCI_ADV_CONN_MASK) || (m_advType & BLE_HCI_ADV_DIRECT_MASK);
757757
}
758758
# endif
759-
return (m_advType & BLE_HCI_ADV_CONN_MASK) || (m_advType & BLE_HCI_ADV_DIRECT_MASK);
759+
760+
return m_advType == BLE_HCI_ADV_RPT_EVTYPE_ADV_IND || m_advType == BLE_HCI_ADV_RPT_EVTYPE_DIR_IND;
760761
} // isConnectable
761762

762763
/**

0 commit comments

Comments
 (0)