Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

src/main.cpp

Committer:
jmarkel44
Date:
2016-09-01
Revision:
1:057d8fc6cb2f
Parent:
0:65cfa4873284
Child:
3:8ea4db957749

File content as of revision 1:057d8fc6cb2f:

/******************************************************************************
 * 
 * File:                main.cpp
 * Desciption:          main ICE driver routine
 *
 *****************************************************************************/
#include "mbed.h"
#include "rtos.h"
#include <stdio.h>
#include "mDot.h"
#include "global.h"
#include "ConfigurationHandler.h"
#include "AnalyticsLogger.h"
#include "ModbusMaster.h"
#include "CloudDataHandler.h"
#include "BLEDataHandler.h"

// main thread identifier (for signaling)
osThreadId mainThreadId = NULL;

int sig_continue = 0x1;

// data handler to configuration hanlder mailbox
Mail<Message_t, 16> MailBox;

// local function prototypes
static void banner(void);

/*****************************************************************************
 * Function:            banner()
 * Description:         Display the application boot banner
 *
 * @param               none
 * @return              none
 *****************************************************************************/
static void banner( void )
{
    printf("\n\n\r\nWelcome to Project: ICE v0.0.1\n");
    printf("\rThe Intelligent Connected Experience\n");
    printf("\rCopyright 2016 Nalco Water, an Ecolab Company\n");

    printf("\r\t  _____    _____   ______ \n");
    printf("\r\t |_   _|  / ____| |  ____|\n");
    printf("\r\t   | |   | |      | |__   \n");
    printf("\r\t   | |   | |      |  __|  \n");
    printf("\r\t  _| |_  | |____  | |____ \n");
    printf("\r\t |_____|  \\_____| |______|\n");

    printf("\r\n\r\n\r\r\n");
}

/*****************************************************************************
 * Function:            banner()
 * Description:         Display the application boot banner
 *
 * @param               none
 * @return              none
 *****************************************************************************/
int main( void )
{
    mDot *dot;
    
    dot = mDot::getInstance();
    mainThreadId = osThreadGetId();
    
    banner();
    printf("\rMultiTech mDot library version: %s\n", dot->getId().c_str());
    
    // start the configuration handler 
    Thread ch_thread(ConfigurationHandler);
    
    // wait for the configuration handler to signal us
    osSignalWait(sig_continue, osWaitForever);
    
    printf("\r%s: continuing to initialize...\n", __func__);
    
    Thread al_thread(AnalyticsLogger);
    Thread mm_thread(ModbusMaster);
    Thread cdh_thread(CloudDataHandler);
    Thread ble_thread(BLEDataHandler);
    
    Thread::wait(1000);
    
       // display free memory on the heap 
    __heapstats((__heapprt)fprintf,stdout); 
    
    Thread::wait(2000);
    printf("\r\n");
    
    // start the command shell 
    ntshell_execute(&ntshell, func_read, func_write, func_cb_ntshell);
    
    //ch_thread.join();
    for (;;) {}
}