My fork of X_NUCLEO_IDB0XA1

Fork of X_NUCLEO_IDB0XA1 by ST

Revision:
156:662bb3992a03
Parent:
154:357d698334ba
Child:
157:e27f00b5e251
--- a/source/BlueNRGGap.cpp	Wed Oct 28 08:57:21 2015 +0100
+++ b/source/BlueNRGGap.cpp	Wed Oct 28 14:04:55 2015 +0100
@@ -1053,11 +1053,18 @@
     PRINTF("BTLE re-init\n\r");
   }
   
-  ret = aci_gap_start_general_discovery_proc(scanningParams.getInterval(),
-                                             scanningParams.getWindow(),
-                                             addr_type,
-                                             1); // 1 to filter duplicates
+  while((ret = aci_gap_start_general_discovery_proc(scanningParams.getInterval(),
+						    scanningParams.getWindow(),
+						    addr_type,
+						    1) // 1 to filter duplicates
+	 ) == ERR_COMMAND_DISALLOWED) {
+	  PRINTF("betzw: wait a bit ...\n\r");
 
+	  // FIXME: We need to wait for a while before creating a connection
+	  // due to BlueNRG process queue handling
+	  Clock_Wait(1000);
+  }
+  
   if (ret != BLE_STATUS_SUCCESS) {
     printf("Start Discovery Procedure failed (0x%02X)\n\r", ret);
     return BLE_ERROR_UNSPECIFIED;