BLE Nano Code.Tested with Integrated mDot code

Dependencies:   BLE_API mbed nRF51822

Fork of eco_Labs_ble_Client by Happiest

Revision:
31:d25111c2fa21
Parent:
25:96044c55f844
Child:
33:17b8c186eb07
--- a/ble_uart.cpp	Thu Nov 17 06:10:54 2016 +0000
+++ b/ble_uart.cpp	Thu Dec 01 14:50:00 2016 +0000
@@ -27,7 +27,7 @@
 /******************************************************************************/
 #define DEBUG(STR) { if (uart) uart->write(STR, strlen(STR)); }
  
-#define BLE_DEVICE_NAME "Ecolab"
+//#define BLE_DEVICE_NAME "Ecolab"
  
 /******************************************************************************/
 /* Global Variables                                                           */
@@ -110,7 +110,7 @@
  * @param  none
  * @retval none
  */
-void ble_init(void)
+void ble_init(uint8_t *tx_buf, uint8_t length)
 {    
     ble.init();
     ble.onConnection(ble_connectionCallback);
@@ -123,7 +123,7 @@
     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 *)BLE_DEVICE_NAME, sizeof(BLE_DEVICE_NAME) - 1);
+                                     (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));