Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

src/ControlTask/ControlTask.cpp

Committer:
jmarkel44
Date:
2016-09-13
Revision:
46:4cb96ab2d1c8
Parent:
22:fe535532859c
Child:
48:1c7861d80d16

File content as of revision 46:4cb96ab2d1c8:

#include "ControlTask.h"
#include <stdio.h>
#include "rtos.h"
#include "ConfigurationHandler.h"
#include "MTSLog.h"

static void serviceSetpointControl(SetpointControl *control);
static void serviceTimerControl(TimerControl *control);

/*****************************************************************************
 * Function:            ControlTask()
 * Description:         show the controls
 *
 * @param               msg
 * @return              none
 *****************************************************************************/
void ControlTask(void const *args)
{
    printf("\r%s has started...\n", __func__);

    while ( true ) {
        // service the setpoint controls
        if ( !setpointTable.empty() ) {
            StringSetpointMap::iterator pos;
            for ( pos = setpointTable.begin(); pos != setpointTable.end(); ++pos ) {
                serviceSetpointControl(pos->second);
            }
        }
        // service the timer controls
        if ( !timerTable.empty() ) {
            StringTimerMap::iterator pos;
            for ( pos = timerTable.begin(); pos != timerTable.end(); ++pos ) {
                serviceTimerControl(pos->second);
            }
        }
        Thread::wait(5000);
    }
}

/*****************************************************************************
 * Function:            serviceSetpointControl()
 * Description:         service a setpoint control
 *
 * @param               control -> the setpoint control object
 * @return              none
 *****************************************************************************/
static void serviceSetpointControl(SetpointControl *control)
{
    logInfo("\r%s: servicing control %s\n",
            __func__, control->getControlFile().c_str());
}

/*****************************************************************************
 * Function:            serviceTimerControl()
 * Description:         service a timer control
 *
 * @param               control -> the timer control object
 * @return              none
 *****************************************************************************/
static void serviceTimerControl(TimerControl *control)
{
    logInfo("\r%s: servicing timer control %s\n",
            __func__, control->getControlFile().c_str());
}