Skip to main content

Interface IIOProtocol

Defines the command interface for Brainboxes Remote IO devices (ED-series). Provides methods for reading and writing digital and analog IO lines, managing input counters and latches, and configuring device settings.

Assembly: Brainboxes.IO.dll
View Source
Declaration
public interface IIOProtocol : IProtocol

Properties

IOCounterUpdateDirection

Indicates whether the input counter increments on a rising edge or falling edge transition.

View Source
Declaration
IOChangeTypes IOCounterUpdateDirection { get; }

DeviceName

The cached name of the device as reported by the device firmware.

View Source
Declaration
string DeviceName { get; set; }

Methods

SendCommand(string)

Send a raw command string using the underlying protocol and return the response.

View Source
Declaration
string SendCommand(string command)
Returns

System.String: The response string from the device, or null if the command expects no response.

Parameters
TypeNameDescription
System.StringcommandThe protocol-specific command string to send to the device.
Exceptions

System.InvalidOperationException
The device is not connected. System.TimeoutException
No response was received within the timeout period.

GetAllLineStates()

Get all digital line states as a bitmask integer.

View Source
Declaration
[Obsolete("GetAllLineStates is deprecated. Replaced by GetAllDigitalLineStates")]
int GetAllLineStates()
Returns

System.Int32: An integer where each bit represents the state of the corresponding digital IO line (bit 0 = line 0, bit 1 = line 1, etc.). A set bit (1) indicates high/closed, a clear bit (0) indicates low/open.

GetAllDigitalLineStates()

Get all digital line states as a bitmask integer.

View Source
Declaration
int GetAllDigitalLineStates()
Returns

System.Int32: An integer where each bit represents the state of the corresponding digital IO line (bit 0 = line 0, bit 1 = line 1, etc.). A set bit (1) indicates high/closed, a clear bit (0) indicates low/open.

SetAllOutputLineStates(int, int)

Set all digital output line states simultaneously using a bitmask integer.

View Source
Declaration
[Obsolete("SetAllOutputLineStates is deprecated. Replaced by SetAllDigitalOutputLineStates")]
void SetAllOutputLineStates(int states, int numberOfOutputs)
Parameters
TypeNameDescription
System.Int32statesBitmask where each bit represents the desired state of the corresponding output line
(1 = high/closed, 0 = low/open). |

| System.Int32 | numberOfOutputs | The number of digital output lines on the device (e.g. 8 for ED-588). |

SetAllDigitalOutputLineStates(int, int)

Set all digital output line states simultaneously using a bitmask integer.

View Source
Declaration
void SetAllDigitalOutputLineStates(int states, int numberOfOutputs)
Parameters
TypeNameDescription
System.Int32statesBitmask where each bit represents the desired state of the corresponding output line
(1 = high/closed, 0 = low/open). |

| System.Int32 | numberOfOutputs | The number of digital output lines on the device (e.g. 8 for ED-588). |

GetAllAnalogInputLineStates(int)

Gets the state of all analog input lines on the device.

View Source
Declaration
double[] GetAllAnalogInputLineStates(int numberOfInputs = 8)
Returns

System.Double[]: An array of analog values indexed by line number. Disabled or unavailable lines return double.NaN.

Parameters
TypeNameDescription
System.Int32numberOfInputsThe number of analog input lines to read. Defaults to 8.

GetAllAnalogOutputLineStates(int)

Gets the state of all analog output lines on the device.

View Source
Declaration
double[] GetAllAnalogOutputLineStates(int numberOfOutputs = 4)
Returns

System.Double[]: An array of analog values indexed by line number.

Parameters
TypeNameDescription
System.Int32numberOfOutputsThe number of analog output lines to read. Defaults to 4.

GetLineCount(int)

Reads the input counter value of the specified digital input line.

View Source
Declaration
[Obsolete("GetLineCount is deprecated. Replaced by GetDigitalInputLineCount")]
int GetLineCount(int line)
Returns

System.Int32: The current counter value (16-bit or 32-bit depending on Brainboxes.IO.CounterMode).

Parameters
TypeNameDescription
System.Int32lineZero-based digital input line number.

GetDigitalInputLineCount(int)

Reads the input counter value of the specified digital input line.

View Source
Declaration
int GetDigitalInputLineCount(int line)
Returns

System.Int32: The current counter value (16-bit or 32-bit depending on Brainboxes.IO.CounterMode).

Parameters
TypeNameDescription
System.Int32lineZero-based digital input line number.

ClearLineCount(int)

Clears (resets to zero) the input counter of the specified digital input line.

View Source
Declaration
[Obsolete("ClearLineCount is deprecated. Replaced by ClearDigitalInputLineCount")]
void ClearLineCount(int line)
Parameters
TypeNameDescription
System.Int32lineZero-based digital input line number.

ClearDigitalInputLineCount(int)

Clears (resets to zero) the input counter of the specified digital input line.

View Source
Declaration
void ClearDigitalInputLineCount(int line)
Parameters
TypeNameDescription
System.Int32lineZero-based digital input line number.

SetOutputLineState(int, int)

Set the state of an individual digital output line.

View Source
Declaration
[Obsolete("SetOutputLineState is deprecated. Replaced by SetDigitalOutputLineState")]
void SetOutputLineState(int line, int value)
Parameters
TypeNameDescription
System.Int32lineZero-based digital output line number.
System.Int32valueThe desired state: 0 for low/open/off, 1 for high/closed/on.

SetDigitalOutputLineState(int, int)

Set the state of an individual digital output line.

View Source
Declaration
void SetDigitalOutputLineState(int line, int value)
Parameters
TypeNameDescription
System.Int32lineZero-based digital output line number.
System.Int32valueThe desired state: 0 for low/open/off, 1 for high/closed/on.

SetAnalogOutputLineState(int, double)

Set the value of an individual analog output line.

View Source
Declaration
void SetAnalogOutputLineState(int line, double value)
Parameters
TypeNameDescription
System.Int32lineZero-based analog output line number.
System.DoublevalueThe analog value to set (range depends on device and Brainboxes.IO.AnalogDataFormat).

GetLineState(int, bool)

Get the state of an individual digital line.

View Source
Declaration
[Obsolete("GetLineState is deprecated. Replaced by GetDigitalLineState")]
int GetLineState(int line, bool isInput = true)
Returns

System.Int32: The digital line state: 0 for low/open, 1 for high/closed.

Parameters
TypeNameDescription
System.Int32lineZero-based digital line number.
System.BooleanisInputIf true, reads an input line; if false, reads an output line.

GetDigitalLineState(int, bool)

Get the state of an individual digital line.

View Source
Declaration
int GetDigitalLineState(int line, bool isInput = true)
Returns

System.Int32: The digital line state: 0 for low/open, 1 for high/closed.

Parameters
TypeNameDescription
System.Int32lineZero-based digital line number.
System.BooleanisInputIf true (default), reads an input line; if false, reads an output line.

GetAnalogLineState(int, int, bool)

Get the value of an individual analog line.

View Source
Declaration
double GetAnalogLineState(int line, int numberOfLines = 8, bool isInput = true)
Returns

System.Double: The analog value, or double.NaN if the line is disabled.

Parameters
TypeNameDescription
System.Int32lineZero-based analog line number.
System.Int32numberOfLinesTotal number of analog lines on the device. Defaults to 8.
System.BooleanisInputIf true (default), reads an input line; if false, reads an output line.

GetAllLatchedHighInputStates()

Get all latched-high digital input states as a bitmask. A latched-high state indicates the input transitioned from low to high since the last read or clear.

View Source
Declaration
[Obsolete("GetAllLatchedHighInputStates is deprecated. Replaced by GetAllLatchedHighDigitalInputStates")]
int GetAllLatchedHighInputStates()
Returns

System.Int32: Bitmask where each set bit indicates the corresponding input line was latched high.

GetAllLatchedHighDigitalInputStates()

Get all latched-high digital input states as a bitmask. A latched-high state indicates the input transitioned from low to high since the last read or clear.

View Source
Declaration
int GetAllLatchedHighDigitalInputStates()
Returns

System.Int32: Bitmask where each set bit indicates the corresponding input line was latched high.

GetAllLatchedLowInputStates()

Get all latched-low digital input states as a bitmask. A latched-low state indicates the input transitioned from high to low since the last read or clear.

View Source
Declaration
[Obsolete("GetAllLatchedLowInputStates is deprecated. Replaced by GetAllLatchedLowDigitalInputStates")]
int GetAllLatchedLowInputStates()
Returns

System.Int32: Bitmask where each set bit indicates the corresponding input line was latched low.

GetAllLatchedLowDigitalInputStates()

Get all latched-low digital input states as a bitmask. A latched-low state indicates the input transitioned from high to low since the last read or clear.

View Source
Declaration
int GetAllLatchedLowDigitalInputStates()
Returns

System.Int32: Bitmask where each set bit indicates the corresponding input line was latched low.

ClearAllLatchedInputs()

Clear all latched digital input states, resetting them so new transitions can be detected.

View Source
Declaration
[Obsolete("ClearAllLatchedInputs is deprecated. Replaced by ClearAllLatchedDigitalInputs")]
void ClearAllLatchedInputs()

ClearAllLatchedDigitalInputs()

Clear all latched digital input states, resetting them so new transitions can be detected.

View Source
Declaration
void ClearAllLatchedDigitalInputs()

GetDeviceName()

Queries the device for its name, bypassing any cached value.

View Source
Declaration
string GetDeviceName()
Returns

System.String: The device name string as reported by the firmware (e.g. "ED-588").

GetDeviceConfiguration()

Queries the device for its configuration settings and caches them locally (address, baud rate, counter mode, analog data format, etc.).

View Source
Declaration
void GetDeviceConfiguration()

SetDeviceConfiguration(int, int, IOChangeTypes, CounterMode, bool)

Sets configuration parameters for a digital IO device.

View Source
Declaration
void SetDeviceConfiguration(int newAddress, int newBaudRate, IOChangeTypes ioCounterUpdateDirection, CounterMode counterMode, bool checksum)
Parameters
TypeNameDescription
System.Int32newAddressThe new ASCII/Modbus address for the device (0-255).
System.Int32newBaudRateThe new baud rate (e.g. 9600, 115200).
Brainboxes.IO.IOChangeTypesioCounterUpdateDirectionWhether the input counter increments on Brainboxes.IO.IOChangeTypes.RisingEdge or Brainboxes.IO.IOChangeTypes.FallingEdge.
Brainboxes.IO.CounterModecounterModeThe counter bit width: 16-bit or 32-bit.
System.BooleanchecksumWhether to enable checksum validation on commands.
Exceptions

System.NotImplementedException
Thrown by Brainboxes.IO.ModbusTCPProtocol — device configuration is only supported via the ASCII protocol.

SetDeviceConfiguration(int, int, AnalogDataFormat, bool, bool, bool, TemperatureUnit)

Sets configuration parameters for an analog IO device.

View Source
Declaration
void SetDeviceConfiguration(int newAddress, int newBaudRate, AnalogDataFormat newAnalogDataFormat, bool newFilterSettings, bool newModuleSettings, bool newChecksum, TemperatureUnit temperatureUnit)
Parameters
TypeNameDescription
System.Int32newAddressThe new ASCII/Modbus address for the device (0-255).
System.Int32newBaudRateThe new baud rate (e.g. 9600, 115200).
Brainboxes.IO.AnalogDataFormatnewAnalogDataFormatThe analog data format: Brainboxes.IO.AnalogDataFormat.Engineering, Brainboxes.IO.AnalogDataFormat.FullScaleRange, or Brainboxes.IO.AnalogDataFormat.Hexadecimal.
System.BooleannewFilterSettingsWhether to enable input filtering.
System.BooleannewModuleSettingsWhether to enable module-specific settings.
System.BooleannewChecksumWhether to enable checksum validation on commands.
Brainboxes.IO.TemperatureUnittemperatureUnitThe temperature unit for thermocouple/RTD devices: Brainboxes.IO.TemperatureUnit.Celsius, Brainboxes.IO.TemperatureUnit.Fahrenheit, or Brainboxes.IO.TemperatureUnit.Kelvin.
Exceptions

System.NotImplementedException
Thrown by Brainboxes.IO.ModbusTCPProtocol — device configuration is only supported via the ASCII protocol.

ResetToFactoryDefaultSettings()

Resets the device to its factory default settings. The device will restart. Any cached state should be cleared after calling this method.

View Source
Declaration
void ResetToFactoryDefaultSettings()
Exceptions

System.NotImplementedException
Thrown by Brainboxes.IO.ModbusTCPProtocol — factory reset is only supported via the ASCII protocol.

Restart()

Restarts the device. The connection will be temporarily lost and re-established.

View Source
Declaration
void Restart()
Exceptions

System.NotImplementedException
Thrown by Brainboxes.IO.ModbusTCPProtocol — restart is only supported via the ASCII protocol.