Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

src/BLEDataHandler/BLEDataHandler.cpp

Committer:
davidjhoward
Date:
2016-10-24
Revision:
257:e22102d2e079
Parent:
249:68ed571e0002
Child:
266:09ba8e22963d

File content as of revision 257:e22102d2e079:

/******************************************************************************
 *
 * File:                BLEDataHandler.cpp
 * Desciption:          source for the ICE Bluetooth Low Energy Data Handler
 *
 *****************************************************************************/
#include "global.h"
#include <stdio.h>
#include "BLEDataHandler.h"
#include "LoggerApi.h"
#include "ble_main.h"
#include "ble_init.h"
#include "ble_msg_handler.h"
#include "ble_spi.h"

/*****************************************************************************
 * Function:             BLEDataHandler
 * Description:          entry point for the Analytics Logger
 *
 * @param                (IN) args (user-defined arguments)
 * @return               none
 *****************************************************************************/

BLE_FILE BLE;
BLE_INIT ble_init;

void BLEDataHandler(void const *args)
{
    uint8_t tx_array[500], rx_buf[500];
    uint8_t event_status;

    /*TODO
        Getting the init status from Nano BLE register and
        Proceed based on the status.
    */
    event_status = BLE.ConfigureBLEDevice();

    while(1) {

        event_status = PollBLEEvents(rx_buf);
        if(event_status == true) {
            printf("BLE Handler rx_buf=%s\r\n",rx_buf);
            GetCurrentReadings( (char *)tx_array, sizeof(tx_array));
            BLE.SendFile(tx_array,strlen((char *)tx_array));
        }
        Thread::wait(100);
    }
}