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
public interface IIOProtocol : IProtocol
Properties
IOCounterUpdateDirection
Indicates whether the input counter increments on a rising edge or falling edge transition.
View Source
IOChangeTypes IOCounterUpdateDirection { get; }
DeviceName
The cached name of the device as reported by the device firmware.
View Source
string DeviceName { get; set; }
Methods
SendCommand(string)
Send a raw command string using the underlying protocol and return the response.
View Source
string SendCommand(string command)
Returns
System.String: The response string from the device, or null if the command expects no response.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | command | The 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
[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
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
[Obsolete("SetAllOutputLineStates is deprecated. Replaced by SetAllDigitalOutputLineStates")]
void SetAllOutputLineStates(int states, int numberOfOutputs)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | states | Bitmask 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
void SetAllDigitalOutputLineStates(int states, int numberOfOutputs)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | states | Bitmask 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
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
| Type | Name | Description |
|---|---|---|
System.Int32 | numberOfInputs | The 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
double[] GetAllAnalogOutputLineStates(int numberOfOutputs = 4)
Returns
System.Double[]: An array of analog values indexed by line number.
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | numberOfOutputs | The 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
[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
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based digital input line number. |
GetDigitalInputLineCount(int)
Reads the input counter value of the specified digital input line.
View Source
int GetDigitalInputLineCount(int line)
Returns
System.Int32: The current counter value (16-bit or 32-bit depending on Brainboxes.IO.CounterMode).
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based digital input line number. |
ClearLineCount(int)
Clears (resets to zero) the input counter of the specified digital input line.
View Source
[Obsolete("ClearLineCount is deprecated. Replaced by ClearDigitalInputLineCount")]
void ClearLineCount(int line)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based digital input line number. |
ClearDigitalInputLineCount(int)
Clears (resets to zero) the input counter of the specified digital input line.
View Source
void ClearDigitalInputLineCount(int line)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based digital input line number. |
SetOutputLineState(int, int)
Set the state of an individual digital output line.
View Source
[Obsolete("SetOutputLineState is deprecated. Replaced by SetDigitalOutputLineState")]
void SetOutputLineState(int line, int value)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based digital output line number. |
System.Int32 | value | The 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
void SetDigitalOutputLineState(int line, int value)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based digital output line number. |
System.Int32 | value | The 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
void SetAnalogOutputLineState(int line, double value)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based analog output line number. |
System.Double | value | The 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
[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
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based digital line number. |
System.Boolean | isInput | If true, reads an input line; if false, reads an output line. |
GetDigitalLineState(int, bool)
Get the state of an individual digital line.
View Source
int GetDigitalLineState(int line, bool isInput = true)
Returns
System.Int32: The digital line state: 0 for low/open, 1 for high/closed.
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based digital line number. |
System.Boolean | isInput | If 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
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
| Type | Name | Description |
|---|---|---|
System.Int32 | line | Zero-based analog line number. |
System.Int32 | numberOfLines | Total number of analog lines on the device. Defaults to 8. |
System.Boolean | isInput | If 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
[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
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
[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
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
[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
void ClearAllLatchedDigitalInputs()
GetDeviceName()
Queries the device for its name, bypassing any cached value.
View Source
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
void GetDeviceConfiguration()
SetDeviceConfiguration(int, int, IOChangeTypes, CounterMode, bool)
Sets configuration parameters for a digital IO device.
View Source
void SetDeviceConfiguration(int newAddress, int newBaudRate, IOChangeTypes ioCounterUpdateDirection, CounterMode counterMode, bool checksum)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | newAddress | The new ASCII/Modbus address for the device (0-255). |
System.Int32 | newBaudRate | The new baud rate (e.g. 9600, 115200). |
| Brainboxes.IO.IOChangeTypes | ioCounterUpdateDirection | Whether the input counter increments on Brainboxes.IO.IOChangeTypes.RisingEdge or Brainboxes.IO.IOChangeTypes.FallingEdge. |
| Brainboxes.IO.CounterMode | counterMode | The counter bit width: 16-bit or 32-bit. |
System.Boolean | checksum | Whether 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
void SetDeviceConfiguration(int newAddress, int newBaudRate, AnalogDataFormat newAnalogDataFormat, bool newFilterSettings, bool newModuleSettings, bool newChecksum, TemperatureUnit temperatureUnit)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | newAddress | The new ASCII/Modbus address for the device (0-255). |
System.Int32 | newBaudRate | The new baud rate (e.g. 9600, 115200). |
| Brainboxes.IO.AnalogDataFormat | newAnalogDataFormat | The analog data format: Brainboxes.IO.AnalogDataFormat.Engineering, Brainboxes.IO.AnalogDataFormat.FullScaleRange, or Brainboxes.IO.AnalogDataFormat.Hexadecimal. |
System.Boolean | newFilterSettings | Whether to enable input filtering. |
System.Boolean | newModuleSettings | Whether to enable module-specific settings. |
System.Boolean | newChecksum | Whether to enable checksum validation on commands. |
| Brainboxes.IO.TemperatureUnit | temperatureUnit | The 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
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
void Restart()
Exceptions
System.NotImplementedException
Thrown by Brainboxes.IO.ModbusTCPProtocol — restart is only supported via the ASCII protocol.