예제 #1
0
 void timer_Callback(object state)
 {
     DeskApp.Send("{\"cmd\":2}");         // Pause
     _op.StateOfMoa = MoaState.None;
     DeskApp.Trace("MOA: Timer -> End");
     _tm = null;
 }
예제 #2
0
 void timer_Callback(object state)
 {
     DeskApp.Send("{\"cmd\":2}");
     _op.StateOfBcut = HbcState.Pause;
     DeskApp.Trace("HBC: Timer -> Pause");
     _tm = null;
 }
예제 #3
0
 bool IPlugin.Doit(PluginData pd)
 {
     DeskApp.Trace("MOA: None -> Mon");
     _op.StateOfMoa = MoaState.Mon; // begin monitoring
     if (_op.TimeInArea > 0)
     {
         _tm = new Timer(timer_Callback, null, _op.TimeInArea * 1000, Timeout.Infinite);
         DeskApp.Trace(string.Format("MOA: Start Timer {0}", _op.TimeInArea));
     }
     return(true);
 }
예제 #4
0
    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);
    }
예제 #5
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);
 }
예제 #6
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);
    }