void timer_Callback(object state)
 {
     DeskApp.Send("{\"cmd\":2}");         // Pause
     _op.StateOfMoa = MoaState.None;
     DeskApp.Trace("MOA: Timer -> End");
     _tm = null;
 }
Beispiel #2
0
 void timer_Callback(object state)
 {
     DeskApp.Send("{\"cmd\":2}");
     _op.StateOfBcut = HbcState.Pause;
     DeskApp.Trace("HBC: Timer -> Pause");
     _tm = null;
 }
    bool IPlugin.Todo(PluginData pd)
    {
        StatusCode ls = pd.Data.LastState;

        DeskApp.Trace(string.Format("MOA: State {0}", ls));
        if (_op.StateOfMoa == MoaState.Mon && ls == StatusCode.WIRE_GOING_HOME)
        {
            DeskApp.Send("{\"cmd\":2}");             // Pause
            _op.StateOfMoa = MoaState.None;
            DeskApp.Trace("MOA: Monitor -> End");
            // hier noch eine Meldung?
        }
        return(true);
    }
Beispiel #4
0
 bool IPlugin.Doit(PluginData pd)
 {
     if (pd.Data.LastState == StatusCode.HOME)
     {
         DeskApp.Send("{\"cmd\":4}");
         DeskApp.Trace("HBC: Training");
         _op.StateOfBcut = HbcState.Leave;
     }
     else
     {
         return(false);
     }
     return(true);
 }
Beispiel #5
0
    bool IPlugin.Todo(PluginData pd)
    {
        Data d = pd.Data;

        if (_op.StateOfBcut != HbcState.None)
        {
            DeskApp.Trace(string.Format("HBC: State {0}", pd.Data.LastState));
            if (d.LastState == StatusCode.HOME || d.LastState == StatusCode.LEAVE_HOUSE)
            {
                if (_op.StateOfBcut == HbcState.Leave)
                {
                    _tm             = new Timer(timer_Callback, null, _op.TimeToWire * 1000, Timeout.Infinite);
                    _op.StateOfBcut = HbcState.Wait;
                    DeskApp.Trace("HBC: Leave -> Timer");
                }
                else
                {
                    DeskApp.Trace("HBC: Leave ignore " + d.LastState);
                }
                //} else if( _op.StateOfBcut == HbcState.Leave && d.LastState == StatusCode.APP_WIRE_FOLLOW_AREA_TRAINING ) {
                //  if( _op.TimeOnWire > 0 ) {
                //    _tm = new Timer(timer_Callback, null, _op.TimeOnWire * 1000, Timeout.Infinite);
                //    _op.StateOfBcut = HbcState.Wait;
                //    DeskApp.Trace("HBC: Wire -> Timer");
                //  } else {
                //    _op.StateOfBcut = HbcState.Pause;
                //    DeskApp.Send("{\"cmd\":2}"); // Stop
                //    DeskApp.Trace("HBC: Wire -> Pause");
                //  }
            }
            else if (_op.StateOfBcut == HbcState.Pause && d.LastState == StatusCode.PAUSE)
            {
                DeskApp.Send("{\"cmd\":3}"); // Home
                _op.StateOfBcut = HbcState.None;
                DeskApp.Trace("HBC: Pause -> Home");
            }
            else
            {
                _op.StateOfBcut = HbcState.None; // somthing wrong?
                DeskApp.Trace("HBC: aborted " + d.LastState);
                return(false);
            }
        }
        return(true);
    }