Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

src/OutputTask/OutputTask.cpp

Committer:
jmarkel44
Date:
2016-09-15
Revision:
63:0ded43237b22
Parent:
56:225786c56315
Child:
66:db1425574b58

File content as of revision 63:0ded43237b22:

#include "global.h"



void OutputTask(void const *args)
{
    UNUSED(args);

    while (true) {
        // wait for an event
        osEvent evt = OutputMasterMailBox.get();
        if (evt.status == osEventMail) {
            OutputControlMsg_t *msg = (OutputControlMsg_t*) evt.value.p;
            printf("\r%s received message from someone...\n", __func__);
            printf("\rmsg->relay    = %s\n", msg->output.c_str());
            printf("\rmsg->state    = %s\n", msg->state == ON ? "ON" : "OFF");
            printf("\rmsg->priority = %u\n", msg->priority);

            switch ( msg->action ) {
                case ACTION_NEW:
                    // read the file and and create an output entry
                    break;
                case ACTION_CONTROL_REQ:                    
                default:
                    break;
            }

            // free the message
            OutputMasterMailBox.free(msg);
        }
    }
}