Пример #1
0
        void TimerHandler(DateTime signal)
        {
            brick.SetLedBody heartBeat = new brick.SetLedBody();
            heartBeat.LED = _state.whichLED;
            
            _state.LEDState = !_state.LEDState; //flip LED

            heartBeat.State = _state.LEDState;

            Activate(Arbiter.Choice(_scribblerPort.SetLED(heartBeat),
                delegate(DefaultUpdateResponseType status)
                {
                    _state.Connected = true;
                },
                delegate(Fault failure)
                {
                    _state.Connected = false;
                    LogError(failure);
                }
            ));

            //re-call ourselves
            Activate(
                Arbiter.Receive(false, TimeoutPort(_state.PauseTime),
                    delegate(DateTime time)
                    {
                        _timerPort.Post(time);
                    }
                )
            );
        }
Пример #2
0
        void TimerHandler(DateTime signal)
        {
            brick.SetLedBody heartBeat = new brick.SetLedBody();
            heartBeat.LED = _state.whichLED;

            _state.LEDState = !_state.LEDState; //flip LED

            heartBeat.State = _state.LEDState;

            Activate(Arbiter.Choice(_scribblerPort.SetLED(heartBeat),
                                    delegate(DefaultUpdateResponseType status)
            {
                _state.Connected = true;
            },
                                    delegate(Fault failure)
            {
                _state.Connected = false;
                LogError("ScribblerHeartBeat failed to connect to base service");
            }
                                    ));

            //re-call ourselves
            Activate(
                Arbiter.Receive(false, TimeoutPort(_state.PauseTime),
                                delegate(DateTime time)
            {
                _timerPort.Post(time);
            }
                                )
                );
        }
Пример #3
0
        public virtual IEnumerator <ITask> AlternateSetSingleHandler(led.SetSingle request)
        {
            //error check
            if (request.Body.Which >= _alternatestate.LEDs[0].LEDVec.Count || request.Body.Which < 0)
            {
                LogError("Improper LED Identifier");
                request.ResponsePort.Post(new Fault());
                yield break;
            }

            //update our state
            _alternatestate.LEDs[0].LEDVec[request.Body.Which].State     = request.Body.State;
            _alternatestate.LEDs[0].LEDVec[request.Body.Which].TimeStamp = DateTime.Now;

            //send message to brick service
            brick.SetLedBody setSingle = new brick.SetLedBody();
            setSingle.LED   = request.Body.Which;
            setSingle.State = request.Body.State;
            _scribblerPort.SetLED(setSingle);

            request.ResponsePort.Post(DefaultUpdateResponseType.Instance);
            yield break;
        }