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
public class IOLine
Properties
Label
User definable label for the io line to help when debugging
View Source
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
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
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
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
public int Count { get; }
LowLatchedStatus
Whether this IOLine has had its Low Latch set since the last latch reset
View Source
public bool LowLatchedStatus { get; }
HighLatchedStatus
Whether this IOLine has had its High Latch set since the last latch reset
View Source
public bool HighLatchedStatus { get; }
Fields
LogicalNumber
The IO Line Number from 0 to 15 as defined on the case
View Source
public readonly int LogicalNumber
IONumber
The IO Number from 0 to 15 e.g DOUT2, DIN1, Relay3
View Source
public readonly int IONumber
IODirection
Whether the IO line is an input or an output
View Source
public readonly IODirection IODirection
IOType
Whether the line is digital or analog
View Source
public readonly IOType IOType
_ioLineChangedEvents
List of registered IOLine Change Event handlers
View Source
protected List<IOLineChangedEventHandler> _ioLineChangedEvents
_ioLineRisingEdgeEvents
List of registered IOLine Rising Edge Event handlers
View Source
protected List<IOLineChangedEventHandler> _ioLineRisingEdgeEvents
_ioLineFallingEdgeEvents
List of registered IOLine Falling Edge Event handlers
View Source
protected List<IOLineChangedEventHandler> _ioLineFallingEdgeEvents
_ioLineCountEvents
List of registered IOLine Count Event handlers
View Source
protected List<IOLineChangedEventHandler> _ioLineCountEvents
Methods
ToString()
ToString
View Source
public override string ToString()
Returns
System.String
Describe()
Give a complete summary of the IOLine
View Source
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
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
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
protected void thisIOLineChanged(IOLine line, EDDevice device, IOChangeTypes changeType)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.IOLine | line |
| Brainboxes.IO.EDDevice | device |
| Brainboxes.IO.IOChangeTypes | changeType |
thisIOLineRisingEdge(IOLine, EDDevice, IOChangeTypes)
wrapper function calls all events handlers in the _ioLineRisingEdgeEvents list
View Source
protected void thisIOLineRisingEdge(IOLine line, EDDevice device, IOChangeTypes changeType)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.IOLine | line |
| Brainboxes.IO.EDDevice | device |
| Brainboxes.IO.IOChangeTypes | changeType |
thisIOLineFallingEdge(IOLine, EDDevice, IOChangeTypes)
wrapper function calls all events handlers in the _ioLineFallingEdgeEvents list
View Source
protected void thisIOLineFallingEdge(IOLine line, EDDevice device, IOChangeTypes changeType)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.IOLine | line |
| Brainboxes.IO.EDDevice | device |
| Brainboxes.IO.IOChangeTypes | changeType |
thisIOLineCount(IOLine, EDDevice, IOChangeTypes)
wrapper function calls all events handlers in the _ioLineCountEvents list
View Source
protected void thisIOLineCount(IOLine line, EDDevice device, IOChangeTypes changeType)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.IOLine | line |
| Brainboxes.IO.EDDevice | device |
| Brainboxes.IO.IOChangeTypes | changeType |
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
public void SubscribeToDeltaEvent(ref AIOLineChangedEventHandler function, double delta)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
System.Double | delta |
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
[Obsolete("SubscribeToTargetEvents is deprecated. Replaced by SubscribeToTargetEvent")]
public void SubscribeToTargetEvents(ref AIOLineChangedEventHandler function, double target)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
System.Double | target |
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
public void SubscribeToTargetEvent(ref AIOLineChangedEventHandler function, double target)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
System.Double | target |
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
[Obsolete("SubscribeToTargetRangeEvents is deprecated. Replaced by SubscribeToTargetRangeEvent")]
public void SubscribeToTargetRangeEvents(ref AIOLineChangedEventHandler function, double target, double delta)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
System.Double | target |
System.Double | delta |
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
public void SubscribeToTargetRangeEvent(ref AIOLineChangedEventHandler function, double target, double delta)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
System.Double | target |
System.Double | delta |
UnsubscribeToDeltaEvent(ref AIOLineChangedEventHandler)
Unsubscribe a registered delta event with this handler to stop being notified when this event is triggered
View Source
public void UnsubscribeToDeltaEvent(ref AIOLineChangedEventHandler function)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
UnsubscribeToTargetEvents(ref AIOLineChangedEventHandler)
Unsubscribe a registered target event with this handler to stop being notified when this event is triggered
View Source
[Obsolete("UnsubscribeToTargetEvents is deprecated. Replaced with UnsubscribeToTargetEvent.")]
public void UnsubscribeToTargetEvents(ref AIOLineChangedEventHandler function)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
UnsubscribeToTargetEvent(ref AIOLineChangedEventHandler)
Unsubscribe a registered target event with this handler to stop being notified when this event is triggered
View Source
public void UnsubscribeToTargetEvent(ref AIOLineChangedEventHandler function)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
UnsubscribeToTargetRangeEvents(ref AIOLineChangedEventHandler)
Unsubscribe a registered target range event with this handler to stop being notified when this event is triggered
View Source
[Obsolete("UnsubscribeToTargetRangeEvents is deprecated. Replaced with UnsubscribeToTargetRangeEvent.")]
public void UnsubscribeToTargetRangeEvents(ref AIOLineChangedEventHandler function)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
UnsubscribeToTargetRangeEvent(ref AIOLineChangedEventHandler)
Unsubscribe a registered target range event with this handler to stop being notified when this event is triggered
View Source
public void UnsubscribeToTargetRangeEvent(ref AIOLineChangedEventHandler function)
Parameters
| Type | Name |
|---|---|
| Brainboxes.IO.AIOLineChangedEventHandler | function |
Events
IOLineChanged
register an event for this IOLine
View Source
public event IOLineChangedEventHandler IOLineChanged
Event Type
Brainboxes.IO.IOLineChangedEventHandler
IOLineRisingEdge
register a rising edge event for this IOLine
View Source
public event IOLineChangedEventHandler IOLineRisingEdge
Event Type
Brainboxes.IO.IOLineChangedEventHandler
IOLineFallingEdge
register a rising edge event for this IOLine
View Source
public event IOLineChangedEventHandler IOLineFallingEdge
Event Type
Brainboxes.IO.IOLineChangedEventHandler
IOLineCount
register a count event for this IOLine
View Source
public event IOLineChangedEventHandler IOLineCount