Пример #1
0
        private void OnPinStateReceived(PinStateMessage message)
        {
            var handler = PinStateReceived;

            if (handler != null)
            {
                handler(this, new PinStateEventArgs()
                {
                    Pin = message.PinNo, Mode = message.Mode, Value = message.State
                });
            }
        }
Пример #2
0
        /// <summary>
        /// Handler the Pin State Message. Get more information about each pin.
        /// This is called multiple times and we advance to the next step, only after
        /// we have received information about the last pin
        /// </summary>
        public void Handle(PinStateMessage message)
        {
            Pin currentPin = Pins[message.PinNo];

            currentPin.CurrentMode  = message.Mode;
            currentPin.CurrentValue = message.State;

            if (IsInitialized)
            {
                return;
            }

            // Notify others only when we are fully initialized
            OnPinStateReceived(message);

            // here we check to see if we have finished with the PinState Messages
            // and advance to the next step. Test the following:
            if (message.PinNo == Pins.Count - 1)
            {
                AdvanceInitialization();
            }
        }