Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

src/OutputTask/OutputTask.h

Committer:
jmarkel44
Date:
2016-09-22
Revision:
115:1558e01d04c6
Parent:
77:43e0a3d9e536
Child:
182:6408a4ae99c3
Child:
183:44f7fea6b208

File content as of revision 115:1558e01d04c6:

#ifndef OUTPUTTASK_H
#define OUTPUTTASK_H

#include <string>
#include <stdio.h>
#include "global.h"

void OutputTask(void const *args);
void DisplayOutputs(void);

#define OUTPUT_STR  "output"

typedef enum {
    CONTROL_OFF = 0,
    CONTROL_ON  = 1
} ControlState;


/*****************************************************************************
 * Control class
 * Contains the most pertinent control information to stack onto the output
 * entry
 ****************************************************************************/
class Control
{
private:
    std::string     id;             // control identifier
    Control_t       controlType;    // control type 
    std::string     input;          // input
    unsigned int    priority;       // control priority 
    ControlState    state;          // state (ON or OFF) 

public:
    // ctor
    Control(std::string id, Control_t controlType, std::string input, unsigned int priority, ControlState state) :
        id(id),  controlType(controlType), input(input), priority(priority), state(state) {}
    // dtor
    ~Control() {}
    
    // displays a control's pertinents
    void display() {
        printf("[%s | %s | %u]",
               id.c_str(), (state == CONTROL_ON) ? "ON" : "OFF", priority);
    }

    std::string getId() const {
        return id;
    }
    
    Control_t getControlType(void) const { 
        return controlType;
    }
    
    std::string getInput(void) const {
        return input;
    }

    unsigned int getPriority() const {
        return priority;
    }

    ControlState getState(void) const {
        return state;
    }

    void setState(ControlState _state) {
        state = _state;
    }
};


#endif