public void OnDigitalInputEvent(DigitalInputDevice digitalinputdevice) { if (DigitalInputEvent != null) { DigitalInputEvent.Invoke(digitalinputdevice); } }
internal protected void OnSeaIoDigitalInput <T>(object sender, DigitalInput digitalInput) where T : class { var type = sender.GetType(); if (type == typeof(SeaLevel420)) { var seaio = (SeaLevel420)sender; var seaioIndex = SeaLevel420.IndexOf(seaio); var digitalinputindex = seaio.DigitalInput.IndexOf(digitalInput); DigitalInputEvent?.Invoke(seaio, seaioIndex, digitalinputindex, digitalInput); } else if (type == typeof(SeaLevel410)) { var seaio410 = (SeaLevel410)sender; var seaio410Index = SeaLevel410.IndexOf(seaio410); //var digitalinputindex = seaio410.DigitalInput.IndexOf(digitalInput); } }
void Update() { byte[] bytes = myDevice.readQueue(); if (bytes != null && bytes.Length > 0) { foreach (byte b in bytes) { incoming.Enqueue(b); } } Event evt = ProcessQueue(); if (evt != null) { if (evt.Type == EventTypes.AnalogValue) { AnalogEvent analog = evt as AnalogEvent; AnalogInputs[analog.AnalogInput].Value = analog.AnalogValue; if (AnalogInputEvent != null) { AnalogInputEvent.Invoke(this, new AnalogInputChangedArgs(analog)); } } else if (evt.Type == EventTypes.InputChanged) { InputEvent input = evt as InputEvent; Debug.Log("Digital: " + input.DigitalInput.ToString() + " " + input.State); DigitalInputs[input.DigitalInput].State = input.State; if (DigitalInputEvent != null) { DigitalInputEvent.Invoke(this, new DigitalInputChangedArgs(input)); } } } }
protected virtual void OnDigitalInputEvent(DigitalInput digitalinput) { DigitalInputEvent?.Invoke(digitalinput); }