this is a new program based on BLE_Uart_Peripheral. Change program name due to relation Client&Peripheral to Client&Server

Dependencies:   RingBuffer nRF51_Vdd nRF51_WakeUp

This is a BLE Server (Device) program for nRF51.
You can communicate with mbed BLE using "BLE_Uart_Client" program as follows.
/users/kenjiArai/code/BLE_Uart_Client/
Please refer following my notebook.
/users/kenjiArai/notebook/ble-client-and-peripheral-using-switch-sience-ty51/#

Revision:
8:dd23c6d67b58
Parent:
7:0d94f4cf2a69
--- a/main.cpp	Fri Feb 09 22:31:30 2018 +0000
+++ b/main.cpp	Sun Feb 11 02:04:59 2018 +0000
@@ -24,8 +24,8 @@
  *
  *      Started:  March     7th, 2016
  *      Revised:  June     13th, 2016
- *      Revised:  October  22nd, 2017   Run on mbed-OS-5.6.2
  *      Revised:  Feburary 10th, 2018   Not set mac addr but use device name
+ *      Revised:  Feburary 11th, 2018   use mbed-os5.7.4 with CircularBuffer
  *
  *  Original program:
  *      BLE_LoopbackUART
@@ -45,7 +45,7 @@
 #include "UARTService.h"
 #include "nRF51_Vdd.h"
 #include "nRF51_WakeUp.h"
-#include "RingBuffer.h"
+#include "CircularBuffer.h"
 
 //  Definition -----------------------------------------------------------------
 //#define     USE_MAC           // if you use mac address, please define it
@@ -53,9 +53,11 @@
 #define     NUM_ONCE            20
 #define     BFSIZE              (NUM_ONCE+4)
 
-// If you set 1, you need to connected LED1 and P_0
 // Please refer nRF51_WakeUP library
 #define     GOTO_SLEEP_MODE     0
+#if GOTO_SLEEP_MODE
+#warning "Make sure!! -> You need to connected P0_21(LED1) and P0_0"
+#endif
 
 //#define    USE_DEBUG_MODE
 #ifdef USE_DEBUG_MODE
@@ -68,13 +70,13 @@
 BLE&            ble_uart = BLE::Instance();
 DigitalOut      connectedLED(LED2);
 InterruptIn     wake_up_sw(P0_1);
-nRF51_WakeUp    wakeup(LED1, P0_0);
+nRF51_WakeUp    wakeup(P0_21, P0_0);
 nRF51_Vdd       vdd(3.0f, 2.2f);
 Serial          pc(USBTX, USBRX, 115200);
 //Serial        pc(P0_3, P0_1, 115200);     // for another board
 UARTService     *uartServicePtr;
 Ticker          ticker;
-RingBuffer      ser_bf(1024);
+CircularBuffer<char, 1536> ser_bf;
 Thread          tsk;
 Mutex           bletx_mutex;
 
@@ -278,7 +280,7 @@
 
 void serialRxCallback()
 {
-    ser_bf.save(pc.getc());
+    ser_bf.push(pc.getc());
     rx_isr_busy = true;
     tsk.signal_set(0x01);
 }
@@ -290,7 +292,7 @@
 
     while(true) {
         Thread::signal_wait(0x01);
-        if (ser_bf.check() == 0) {
+        if (ser_bf.empty()) {
             if (linebf_irq_len != 0) {
                 linebf_irq[linebf_irq_len] = 0;
                 adjust_line(linebf_irq);
@@ -304,8 +306,9 @@
                 bletx_mutex.unlock();
             }
         }
-        while(ser_bf.check() != 0) {
-            char c = ser_bf.read();
+        while(!ser_bf.empty()) {
+            char c;
+            ser_bf.pop(c);
             if (c == '\b') {
                 linebf_irq_len--;
                 pc.putc(c);
@@ -381,27 +384,27 @@
     sprintf((char *)tx_buf,"  ~?:help\r\n");
     tx_len = strlen((const char *)tx_buf);
     Update_Values();
-    wait(0.2);
+    Thread::wait(200);
     //          12345678901234567890
     sprintf((char *)tx_buf,"  ~v:vdd\r\n");
     tx_len = strlen((const char *)tx_buf);
     Update_Values();
-    wait(0.2);
+    Thread::wait(200);
     //          12345678901234567890
     sprintf((char *)tx_buf,"  ~t:temperature\r\n");
     tx_len = strlen((const char *)tx_buf);
     Update_Values();
-    wait(0.2);
+    Thread::wait(200);
     //          12345678901234567890
     sprintf((char *)tx_buf,"  ~w:wait, w 120\r\n");
     tx_len = strlen((const char *)tx_buf);
     Update_Values();
-    wait(0.2);
+    Thread::wait(200);
     //          12345678901234567890
     sprintf((char *)tx_buf,"  ~q:quit/sleep\r\n");
     tx_len = strlen((const char *)tx_buf);
     Update_Values();
-    wait(0.2);
+    Thread::wait(200);
 }
 
 void action_tx_vdd()
@@ -458,7 +461,7 @@
     sprintf((char *)tx_buf,"Terminated the BLE");
     tx_len = strlen((const char *)tx_buf);
     Update_Values();
-    wait(1.0);
+    Thread::wait(1000);
     wakeup.set_and_wait(sleep_time);
     while(true) {   // never come here but just in case
         deepsleep();