Only start scan/advertise when host re-synced if duration was indefinite.

Previously when the host reset while scanning (if active prior) it would be restarted automatically.
This caused errors for some applications and has been removed since the event invokes the scan
ended callback for the app to take action. Instead scanning will now only be restarted if the duration
was indefinite and a callback was set for the advertisment events, this use case is less likely to have
a scan ended callback.

Advertising (if active prior) would be started without regard to it's previous state.
This has been corrected to only start advertising again if it was advertising for an idefinite time.
This commit is contained in:
h2zero committed 2021-01-12 20:42:19 -07:00
1 parent 28573f5abe
commit 372c79a6b8
5 files changed
+52 -30

No files matched your search

+2 -2
View File
@@ -95,7 +95,7 @@ public:
private:
friend class NimBLEDevice;
void onHostReset();
void onHostSync();
static int handleGapEvent(struct ble_gap_event *event, void *arg);
ble_hs_adv_fields m_advData;
@@ -108,7 +108,7 @@ private:
bool m_advDataSet;
void (*m_advCompCB)(NimBLEAdvertising *pAdv);
uint8_t m_slaveItvl[4];
uint32_t m_duration;
};
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)