Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Committer:
davidjhoward
Date:
Mon Oct 24 21:05:41 2016 +0000
Revision:
257:e22102d2e079
Parent:
249:68ed571e0002
Child:
266:09ba8e22963d
Added more messages and updated BLE module

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmarkel44 0:65cfa4873284 1 /******************************************************************************
davidjhoward 249:68ed571e0002 2 *
jmarkel44 0:65cfa4873284 3 * File: BLEDataHandler.cpp
jmarkel44 0:65cfa4873284 4 * Desciption: source for the ICE Bluetooth Low Energy Data Handler
jmarkel44 0:65cfa4873284 5 *
jmarkel44 0:65cfa4873284 6 *****************************************************************************/
jmarkel44 0:65cfa4873284 7 #include "global.h"
jmarkel44 0:65cfa4873284 8 #include <stdio.h>
jmarkel44 0:65cfa4873284 9 #include "BLEDataHandler.h"
davidjhoward 249:68ed571e0002 10 #include "LoggerApi.h"
davidjhoward 249:68ed571e0002 11 #include "ble_main.h"
davidjhoward 249:68ed571e0002 12 #include "ble_init.h"
davidjhoward 249:68ed571e0002 13 #include "ble_msg_handler.h"
davidjhoward 257:e22102d2e079 14 #include "ble_spi.h"
jmarkel44 0:65cfa4873284 15
jmarkel44 0:65cfa4873284 16 /*****************************************************************************
jmarkel44 0:65cfa4873284 17 * Function: BLEDataHandler
davidjhoward 249:68ed571e0002 18 * Description: entry point for the Analytics Logger
jmarkel44 0:65cfa4873284 19 *
jmarkel44 0:65cfa4873284 20 * @param (IN) args (user-defined arguments)
jmarkel44 0:65cfa4873284 21 * @return none
jmarkel44 0:65cfa4873284 22 *****************************************************************************/
davidjhoward 249:68ed571e0002 23
davidjhoward 249:68ed571e0002 24 BLE_FILE BLE;
davidjhoward 249:68ed571e0002 25 BLE_INIT ble_init;
davidjhoward 249:68ed571e0002 26
jmarkel44 0:65cfa4873284 27 void BLEDataHandler(void const *args)
jmarkel44 0:65cfa4873284 28 {
davidjhoward 257:e22102d2e079 29 uint8_t tx_array[500], rx_buf[500];
davidjhoward 257:e22102d2e079 30 uint8_t event_status;
davidjhoward 257:e22102d2e079 31
davidjhoward 249:68ed571e0002 32 /*TODO
davidjhoward 257:e22102d2e079 33 Getting the init status from Nano BLE register and
davidjhoward 257:e22102d2e079 34 Proceed based on the status.
davidjhoward 257:e22102d2e079 35 */
davidjhoward 257:e22102d2e079 36 event_status = BLE.ConfigureBLEDevice();
jmarkel44 0:65cfa4873284 37
davidjhoward 257:e22102d2e079 38 while(1) {
davidjhoward 257:e22102d2e079 39
davidjhoward 257:e22102d2e079 40 event_status = PollBLEEvents(rx_buf);
davidjhoward 257:e22102d2e079 41 if(event_status == true) {
davidjhoward 257:e22102d2e079 42 printf("BLE Handler rx_buf=%s\r\n",rx_buf);
davidjhoward 257:e22102d2e079 43 GetCurrentReadings( (char *)tx_array, sizeof(tx_array));
davidjhoward 257:e22102d2e079 44 BLE.SendFile(tx_array,strlen((char *)tx_array));
davidjhoward 249:68ed571e0002 45 }
davidjhoward 257:e22102d2e079 46 Thread::wait(100);
davidjhoward 257:e22102d2e079 47 }
jmarkel44 0:65cfa4873284 48 }