BLE Nano Code.Tested with Integrated mDot code

Dependencies:   BLE_API mbed nRF51822

Fork of eco_Labs_ble_Client by Happiest

Revision:
35:b2af2293635a
Parent:
33:17b8c186eb07
--- a/ble_uart.cpp	Fri Dec 16 10:20:16 2016 +0000
+++ b/ble_uart.cpp	Fri Dec 16 11:32:53 2016 +0000
@@ -22,7 +22,7 @@
 #include "ble_types.h"
 #include "spi_slave.h"
 #include "UARTService.h"
- 
+#include "ble_gap.h"
 /******************************************************************************/
 /* Local Defines                                                              */
 /******************************************************************************/
@@ -120,12 +120,17 @@
     ble.onDataWritten(ble_dataReceiveCallback);
  
     uart = new UARTService(ble);
- 
+
+    ble_gap_conn_sec_mode_t sec_mode;
+
+    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
+    sd_ble_gap_device_name_set(&sec_mode,(const uint8_t *)tx_buf,length);
+  
     /* Setup advertising */
     ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
     ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
-    ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME,
-                                     (const uint8_t *)tx_buf, length);
+//    ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME,
+//                                     (const uint8_t *)tx_buf, length);
 //  ble.accumulateAdvertisingPayload(GapAdvertisingData::INCOMPLETE_LIST_128BIT_SERVICE_IDS,
 //                                  (const uint8_t *)UARTServiceUUID_reversed, sizeof(UARTServiceUUID_reversed));
 //  ble.accumulateAdvertisingPayload(GapAdvertisingData::INCOMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list));