Ejemplo n.º 1
0
    ,_delayedPulseTimer(DELAYEDPULSETIMER_INVALID)
    ,_countdown(COUNTDOWN_INVALID)
    ,_valueCallbackRelay(NULL)
//--- (end of Relay initialization)
{
    _className="Relay";
}

YRelay::~YRelay() 
{
//--- (YRelay cleanup)
//--- (end of YRelay cleanup)
}
//--- (YRelay implementation)
// static attributes
const YDelayedPulse YRelay::DELAYEDPULSETIMER_INVALID = YDelayedPulse();

int YRelay::_parseAttr(yJsonStateMachine& j)
{
    if(!strcmp(j.token, "state")) {
        if(yJsonParse(&j) != YJSON_PARSE_AVAIL) goto failed;
        _state =  (Y_STATE_enum)atoi(j.token);
        return 1;
    }
    if(!strcmp(j.token, "stateAtPowerOn")) {
        if(yJsonParse(&j) != YJSON_PARSE_AVAIL) goto failed;
        _stateAtPowerOn =  (Y_STATEATPOWERON_enum)atoi(j.token);
        return 1;
    }
    if(!strcmp(j.token, "maxTimeOnStateA")) {
        if(yJsonParse(&j) != YJSON_PARSE_AVAIL) goto failed;
Ejemplo n.º 2
0
    ,_triggerDuration(TRIGGERDURATION_INVALID)
    ,_valueCallbackWatchdog(NULL)
    ,_firm(0)
//--- (end of YWatchdog initialization)
{
    _className="Watchdog";
}

YWatchdog::~YWatchdog()
{
//--- (YWatchdog cleanup)
//--- (end of YWatchdog cleanup)
}
//--- (YWatchdog implementation)
// static attributes
const YDelayedPulse YWatchdog::DELAYEDPULSETIMER_INVALID = YDelayedPulse();

int YWatchdog::_parseAttr(YJSONObject* json_val)
{
    if(json_val->has("state")) {
        _state =  (Y_STATE_enum)json_val->getInt("state");
    }
    if(json_val->has("stateAtPowerOn")) {
        _stateAtPowerOn =  (Y_STATEATPOWERON_enum)json_val->getInt("stateAtPowerOn");
    }
    if(json_val->has("maxTimeOnStateA")) {
        _maxTimeOnStateA =  json_val->getLong("maxTimeOnStateA");
    }
    if(json_val->has("maxTimeOnStateB")) {
        _maxTimeOnStateB =  json_val->getLong("maxTimeOnStateB");
    }