this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Revision:
76:6afda865fbf8
Parent:
75:08eff6258e1b
Child:
77:0b505d1e15f4
--- a/source/main-https.cpp	Thu Mar 14 21:34:06 2019 +0000
+++ b/source/main-https.cpp	Fri Mar 15 14:26:44 2019 +0000
@@ -456,7 +456,7 @@
 
 
 
-
+#define MAX_LOOP_COUNT 3
 int ble_security_main()
 {
     BLE& ble = BLE::Instance();
@@ -469,19 +469,25 @@
         printf("Filesystem creation failed, will use memory storage\r\n");
     }
 #endif
-
+    int loopCount = 0; 
     while(1) {
         {
             printf("\r\n PERIPHERAL \r\n\r\n");
             SMDevicePeripheral peripheral(ble, queue, peer_address);
             peripheral.run();
         }
+        if(loopCount >= MAX_LOOP_COUNT)
+        {
+            return 0;
+        }
 
         {
             printf("\r\n CENTRAL \r\n\r\n");
             SMDeviceCentral central(ble, queue, peer_address);
             central.run();
         }
+        loopCount++;
+        printf("loop Cycle #%d\r\n", loopCount);
     }
 
     return 0;
@@ -491,7 +497,11 @@
     reset_counter++;
     //RawSerial *device(USBTX, USBRX); // tx, rx
     device = new RawSerial(USBTX, USBRX, DEFAULT_BAUD_RATE);
+#ifndef USE_MAIN_BLE
     ble_security_main();
+    wait(1); // wait for advertising interval so advertising has started 
+    reportGapState();
+#else
     device->printf("\n --- Running UART-BLE-UartService --- (rst_cnt = %d)\n", reset_counter);
 
     eventQueue.call_every(500, blinkCallback);
@@ -539,9 +549,10 @@
 #endif
      btle_thread.start(callback(&eventQueue, &EventQueue::dispatch_forever));
      printWait(5);
+#endif
      //device->printf("\n Press any key to start Wifi demo: ");
      //device->getc();
-#ifdef false // comment out wifi part
+#ifndef DISABLE_WIFI_DEMO // comment out wifi part
      int start = Kernel::get_ms_count();
      NetworkInterface* network = connect_to_default_network_interface();
      int stop = Kernel::get_ms_count();
@@ -550,7 +561,7 @@
      t.start(callback(wifi_demo, network));
      t.join(); 
 #endif
-     //network->disconnect(); 
+     network->disconnect(); 
      //delete network;
      printMacAddress();  
      reportGapState();