Skip to main content
Version: v2.0.0

Class IOLine

Represents a single IO line (digital or analog, input or output) on a Brainboxes Brainboxes.IO.EDDevice. Access IO lines via the Brainboxes.IO.EDDevice.Inputs, Brainboxes.IO.EDDevice.Outputs, or Brainboxes.IO.EDDevice.IOLines collections.

Assembly: Brainboxes.IO.dll​
View Source​
Declaration
public class IOLine

Properties​

Label​

User definable label for the io line to help when debugging

View Source​
Declaration
public string Label { get; set; }

MostRecentChangeType​

The most recent type of change to occur to the IOLine examples: a. if the previous value seen was 1 and the current value is 0 then the change type will be IOChangeType.FallingEdge. b. if the device has just been turned on then the change type will be IOChangeType.Undefined c. if the line has gone from 1 to 0 and back to 1 within the Brainboxes.IO.EDDevice.IOLineCacheTimeout the change type will be IOChangeType.Latched d. if the line has not changed within the last Brainboxes.IO.EDDevice.IOLineCacheTimeout the change type will be IOChangeType.NoChange

The method will only return meaningful results if there are event handlers attached to the EDDevice

View Source​
Declaration
public IOChangeTypes MostRecentChangeType { get; }

Value​

The current digital state of this IO line. For inputs: HIGH (1) or LOW (0). For outputs/relays: CLOSED (1) or OPEN (0). Only output lines can be set; setting an input throws System.InvalidOperationException.

View Source​
Declaration
public int Value { get; set; }

AValue​

The current analog value of this IO line, in the units determined by the device's Brainboxes.IO.AnalogDataFormat configuration (e.g. volts, milliamps, or temperature). Only analog output lines can be set; setting an analog input throws System.InvalidOperationException.

View Source​
Declaration
public double AValue { get; set; }

Count​

Get the count of the input, that is the number of times the input has latched since the counter has been reset. Use Brainboxes.IO.IOLine.ClearCount() to reset.

View Source​
Declaration
public int Count { get; }

LowLatchedStatus​

Whether this IOLine has had its Low Latch set since the last latch reset

View Source​
Declaration
public bool LowLatchedStatus { get; }

HighLatchedStatus​

Whether this IOLine has had its High Latch set since the last latch reset

View Source​
Declaration
public bool HighLatchedStatus { get; }

Fields​

LogicalNumber​

The IO Line Number from 0 to 15 as defined on the case

View Source​
Declaration
public readonly int LogicalNumber

IONumber​

The IO Number from 0 to 15 e.g DOUT2, DIN1, Relay3

View Source​
Declaration
public readonly int IONumber

IODirection​

Whether the IO line is an input or an output

View Source​
Declaration
public readonly IODirection IODirection

IOType​

Whether the line is digital or analog

View Source​
Declaration
public readonly IOType IOType

_ioLineChangedEvents​

List of registered IOLine Change Event handlers

View Source​
Declaration
protected List<IOLineChangedEventHandler> _ioLineChangedEvents

_ioLineRisingEdgeEvents​

List of registered IOLine Rising Edge Event handlers

View Source​
Declaration
protected List<IOLineChangedEventHandler> _ioLineRisingEdgeEvents

_ioLineFallingEdgeEvents​

List of registered IOLine Falling Edge Event handlers

View Source​
Declaration
protected List<IOLineChangedEventHandler> _ioLineFallingEdgeEvents

_ioLineCountEvents​

List of registered IOLine Count Event handlers

View Source​
Declaration
protected List<IOLineChangedEventHandler> _ioLineCountEvents

Methods​

ToString()​

ToString

View Source​
Declaration
public override string ToString()
Returns​

System.String

Describe()​

Give a complete summary of the IOLine

View Source​
Declaration
public string Describe()
Returns​

System.String

Toggle()​

If the line is an output this function will invert the state of the line e.g. if the line was closed (1) it will become open (0) or if the line was open (0) it will become closed (1) only valid for Digital outputs

View Source​
Declaration
public int Toggle()
Returns​

System.Int32: The new line Value, 1 or 0

Exceptions​

System.InvalidOperationException
Thrown when the line is not a digital output.

ClearCount()​

Clear the count currently recorded on the line

View Source​
Declaration
public void ClearCount()
Exceptions​

System.InvalidOperationException
Thrown when the line is an output.

thisIOLineChanged(IOLine, EDDevice, IOChangeTypes)​

wrapper function calls all events handlers in the _ioLineChangedEvents list

View Source​
Declaration
protected void thisIOLineChanged(IOLine line, EDDevice device, IOChangeTypes changeType)
Parameters​
TypeName
Brainboxes.IO.IOLineline
Brainboxes.IO.EDDevicedevice
Brainboxes.IO.IOChangeTypeschangeType

thisIOLineRisingEdge(IOLine, EDDevice, IOChangeTypes)​

wrapper function calls all events handlers in the _ioLineRisingEdgeEvents list

View Source​
Declaration
protected void thisIOLineRisingEdge(IOLine line, EDDevice device, IOChangeTypes changeType)
Parameters​
TypeName
Brainboxes.IO.IOLineline
Brainboxes.IO.EDDevicedevice
Brainboxes.IO.IOChangeTypeschangeType

thisIOLineFallingEdge(IOLine, EDDevice, IOChangeTypes)​

wrapper function calls all events handlers in the _ioLineFallingEdgeEvents list

View Source​
Declaration
protected void thisIOLineFallingEdge(IOLine line, EDDevice device, IOChangeTypes changeType)
Parameters​
TypeName
Brainboxes.IO.IOLineline
Brainboxes.IO.EDDevicedevice
Brainboxes.IO.IOChangeTypeschangeType

thisIOLineCount(IOLine, EDDevice, IOChangeTypes)​

wrapper function calls all events handlers in the _ioLineCountEvents list

View Source​
Declaration
protected void thisIOLineCount(IOLine line, EDDevice device, IOChangeTypes changeType)
Parameters​
TypeName
Brainboxes.IO.IOLineline
Brainboxes.IO.EDDevicedevice
Brainboxes.IO.IOChangeTypeschangeType

SubscribeToDeltaEvent(ref AIOLineChangedEventHandler, double)​

Register an event with this handler to be notified when the state of this AIOLine changes over the delta value specified

View Source​
Declaration
public void SubscribeToDeltaEvent(ref AIOLineChangedEventHandler function, double delta)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction
System.Doubledelta

SubscribeToTargetEvents(ref AIOLineChangedEventHandler, double)​

Register an event with this handler to be notified when the state of this AIOLine goes over the value specified and below the value specified

View Source​
Declaration
[Obsolete("SubscribeToTargetEvents is deprecated. Replaced by SubscribeToTargetEvent")]
public void SubscribeToTargetEvents(ref AIOLineChangedEventHandler function, double target)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction
System.Doubletarget

SubscribeToTargetEvent(ref AIOLineChangedEventHandler, double)​

Register an event with this handler to be notified when the state of this AIOLine goes over the value specified and below the value specified

View Source​
Declaration
public void SubscribeToTargetEvent(ref AIOLineChangedEventHandler function, double target)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction
System.Doubletarget

SubscribeToTargetRangeEvents(ref AIOLineChangedEventHandler, double, double)​

Register an event with this handler to be notified when the state of this AIOLine changes more than the specified delta value away from the specified target value

View Source​
Declaration
[Obsolete("SubscribeToTargetRangeEvents is deprecated. Replaced by SubscribeToTargetRangeEvent")]
public void SubscribeToTargetRangeEvents(ref AIOLineChangedEventHandler function, double target, double delta)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction
System.Doubletarget
System.Doubledelta

SubscribeToTargetRangeEvent(ref AIOLineChangedEventHandler, double, double)​

Register an event with this handler to be notified when the state of this AIOLine changes more than the specified delta value away from the specified target value

View Source​
Declaration
public void SubscribeToTargetRangeEvent(ref AIOLineChangedEventHandler function, double target, double delta)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction
System.Doubletarget
System.Doubledelta

UnsubscribeToDeltaEvent(ref AIOLineChangedEventHandler)​

Unsubscribe a registered delta event with this handler to stop being notified when this event is triggered

View Source​
Declaration
public void UnsubscribeToDeltaEvent(ref AIOLineChangedEventHandler function)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction

UnsubscribeToTargetEvents(ref AIOLineChangedEventHandler)​

Unsubscribe a registered target event with this handler to stop being notified when this event is triggered

View Source​
Declaration
[Obsolete("UnsubscribeToTargetEvents is deprecated. Replaced with UnsubscribeToTargetEvent.")]
public void UnsubscribeToTargetEvents(ref AIOLineChangedEventHandler function)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction

UnsubscribeToTargetEvent(ref AIOLineChangedEventHandler)​

Unsubscribe a registered target event with this handler to stop being notified when this event is triggered

View Source​
Declaration
public void UnsubscribeToTargetEvent(ref AIOLineChangedEventHandler function)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction

UnsubscribeToTargetRangeEvents(ref AIOLineChangedEventHandler)​

Unsubscribe a registered target range event with this handler to stop being notified when this event is triggered

View Source​
Declaration
[Obsolete("UnsubscribeToTargetRangeEvents is deprecated. Replaced with UnsubscribeToTargetRangeEvent.")]
public void UnsubscribeToTargetRangeEvents(ref AIOLineChangedEventHandler function)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction

UnsubscribeToTargetRangeEvent(ref AIOLineChangedEventHandler)​

Unsubscribe a registered target range event with this handler to stop being notified when this event is triggered

View Source​
Declaration
public void UnsubscribeToTargetRangeEvent(ref AIOLineChangedEventHandler function)
Parameters​
TypeName
Brainboxes.IO.AIOLineChangedEventHandlerfunction

Events​

IOLineChanged​

register an event for this IOLine

View Source​
Declaration
public event IOLineChangedEventHandler IOLineChanged
Event Type​

Brainboxes.IO.IOLineChangedEventHandler

IOLineRisingEdge​

register a rising edge event for this IOLine

View Source​
Declaration
public event IOLineChangedEventHandler IOLineRisingEdge
Event Type​

Brainboxes.IO.IOLineChangedEventHandler

IOLineFallingEdge​

register a rising edge event for this IOLine

View Source​
Declaration
public event IOLineChangedEventHandler IOLineFallingEdge
Event Type​

Brainboxes.IO.IOLineChangedEventHandler

IOLineCount​

register a count event for this IOLine

View Source​
Declaration
public event IOLineChangedEventHandler IOLineCount
Event Type​

Brainboxes.IO.IOLineChangedEventHandler