prasad-alatkar commented on a change in pull request #777: nimble/host: Clear 
master and slave states on host reset
URL: https://github.com/apache/mynewt-nimble/pull/777#discussion_r396568391
 
 

 ##########
 File path: nimble/host/src/ble_gap.c
 ##########
 @@ -737,6 +737,30 @@ ble_gap_slave_reset_state(uint8_t instance)
 #endif
 }
 
+/**
+ * Clears advertisement and discovery state.  This function is necessary
+ * when the controller loses its active state (e.g. on stack reset).
+ */
+void
+ble_gap_master_slave_reset_state(void)
+{
+#if NIMBLE_BLE_ADVERTISE
+#if MYNEWT_VAL(BLE_EXT_ADV)
+    uint8_t i;
+
+    for (i = 0; i < BLE_ADV_INSTANCES; i++) {
+        ble_gap_slave_reset_state(i);
+    }
+#else
+    ble_gap_slave_reset_state(0);
+#endif
+#endif
+
+#if NIMBLE_BLE_SCAN
+    ble_gap_master_reset_state();
 
 Review comment:
   1. Yes, we should call ` ble_gap_disc_complete`, have made changes.
   2. Yes, however in `ble_hs_reset`, we also call `ble_gap_conn_broken` which 
ultimately calls GAP event `BLE_GAP_EVENT_DISCONNECT` to notify app. But I do 
understand, you want to cover the cases where  there may be `connection 
establishment procedure` and may not be any `active connection (established)`. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to