Skip to content

Commit 4cdc4e0

Browse files
committed
Don't set advertisement flags if not connectable.
1 parent 6f2ecea commit 4cdc4e0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/NimBLEAdvertising.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,16 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv
434434
if(m_advParams.conn_mode == BLE_GAP_CONN_MODE_NON) {
435435
if(!m_scanResp) {
436436
m_advParams.disc_mode = BLE_GAP_DISC_MODE_NON;
437-
m_advData.flags = BLE_HS_ADV_F_BREDR_UNSUP;
437+
// non-connectable advertising does not require AD flags.
438+
m_advData.flags = 0;
438439
}
439440
}
440441

441442
int rc = 0;
442443

443444
if (!m_customAdvData && !m_advDataSet) {
444-
//start with 3 bytes for the flags data
445-
uint8_t payloadLen = (2 + 1);
445+
//start with 3 bytes for the flags data if required
446+
uint8_t payloadLen = (m_advData.flags > 0) ? (2 + 1) : 0;
446447
if(m_advData.mfg_data_len > 0)
447448
payloadLen += (2 + m_advData.mfg_data_len);
448449

0 commit comments

Comments
 (0)