Skip to main content

Class ESDevice

Base class for Brainboxes Ethernet-to-Serial devices (part numbers starting "ES-XXX"). Provides network-accessible serial ports via the Brainboxes.IO.ESDevice.Ports collection.

Assembly: Brainboxes.IO.dll​
View Source​
Declaration
public class ESDevice : Device<IConnection, ISerialProtocol>, IDevice<IConnection, ISerialProtocol>, IDisposable, IESDevice

Inheritance: System.Object -> Brainboxes.IO.Device<Brainboxes.IO.IConnection,Brainboxes.IO.ISerialProtocol>

Derived:

Expand

Implements:
Brainboxes.IO.IDevice<Brainboxes.IO.IConnection,Brainboxes.IO.ISerialProtocol>, System.IDisposable, Brainboxes.IO.IESDevice

Properties​

Ports​

List of Brainboxes Serial Ports on this Ethernet to Serial Device

View Source​
Declaration
public IList<BBSerialPort> Ports { get; }

Protocol​

Get/Set the Serial Protocol Used when communicating with all Serial ports of device

View Source​
Declaration
public override ISerialProtocol Protocol { get; set; }

IsConnected​

If there is an active connection from this instance to any of the serial ports attached to the ES device

View Source​
Declaration
public override bool IsConnected { get; }

IsAvailable​

Whether the connection to this Brainboxes Device is available, e.g. online or offline​. In case of network TCP connection: this is if the device is pingable on the network. In case of serial connection: this is if the device COM port is listed on the system and not open by another process.

View Source​
Declaration
public override bool IsAvailable { get; }

Fields​

_ports​

List of serial ports on Ethernet to Serial Device indexed by port number

View Source​
Declaration
protected IList<BBSerialPort> _ports

NumberOfPorts​

Number of Serial Ports on Brainboxes Ethernet to Serial Device

View Source​
Declaration
public readonly int NumberOfPorts

PortType​

The type of Serial ports on the Brainboxes Ethernet to Serial Port Either RS232 or RS422/485

View Source​
Declaration
public readonly BBSerialPortType PortType

IPAddress​

The IP address of the Brainboxes Ethernet to Serial Device

View Source​
Declaration
public string IPAddress

_pingTimeout​

The ping timeout used when determining if the device is available on the network

View Source​
Declaration
protected int _pingTimeout

_ping​

ping class used to determine whether end point is available when it is not already connected to

View Source​
Declaration
protected Ping _ping

Methods​

_initPorts()​

Initialized the serial ports on the Ethernet to Serial device using the predefined properties NumberOfPorts and PortType

View Source​
Declaration
protected void _initPorts()

_initPorts(string, ISerialProtocol)​

View Source​
Declaration
protected void _initPorts(string ipAddress, ISerialProtocol protocol)
Parameters​
TypeName
System.StringipAddress
Brainboxes.IO.ISerialProtocolprotocol

_initPorts(string, int, int)​

View Source​
Declaration
protected void _initPorts(string ipAddress, int port1PortNumber = 9001, int timeout = 2000)
Parameters​
TypeName
System.StringipAddress
System.Int32port1PortNumber
System.Int32timeout

_initPorts(List<IConnection>)​

View Source​
Declaration
protected void _initPorts(List<IConnection> connections)
Parameters​
TypeName
System.Collections.Generic.List<Brainboxes.IO.IConnection>connections

_initPorts(List<IConnection>, List<ISerialProtocol>)​

View Source​
Declaration
protected void _initPorts(List<IConnection> connections, List<ISerialProtocol> protocols)
Parameters​
TypeName
System.Collections.Generic.List<Brainboxes.IO.IConnection>connections
System.Collections.Generic.List<Brainboxes.IO.ISerialProtocol>protocols

Connect()​

Connect the To All the serial ports on the brainboxes device

View Source​
Declaration
public override void Connect()

Disconnect()​

Disconnect from all the serial ports on the Brainboxes Device

View Source​
Declaration
public override void Disconnect()

ToString()​

Returns a short description of the Brainboxes Ethernet to Serial Product

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

System.String

Create(string, int, int)​

Connects to the IP Address given and determines what kind of Brainboxes Ethernet to Serial Device is there, creates the object and returns it

View Source​
Declaration
public static ESDevice Create(string ipAddress, int port1PortNumber = 9001, int timeout = 2000)
Returns​

Brainboxes.IO.ESDevice

Parameters​
TypeName
System.StringipAddress
System.Int32port1PortNumber
System.Int32timeout

Create(string, ISerialProtocol)​

Connects to the IP Address provided and determines what kind of Brainboxes Ethernet to Serial Device is present, creates the object and sets all serial ports to use the provided protocol

View Source​
Declaration
public static ESDevice Create(string ipAddress, ISerialProtocol protocol)
Returns​

Brainboxes.IO.ESDevice

Parameters​
TypeName
System.StringipAddress
Brainboxes.IO.ISerialProtocolprotocol

Events​

_deviceStatusChangedEvent​

The event which describes when a device status change occurs

View Source​
Declaration
protected event DeviceStatusChangedEventHandler<IConnection, ISerialProtocol> _deviceStatusChangedEvent
Event Type​

Brainboxes.IO.DeviceStatusChangedEventHandler<Brainboxes.IO.IConnection,Brainboxes.IO.ISerialProtocol>

DeviceStatusChangedEvent​

Event When the status of the devices connection changes for example goes from Disconnected to Connected or from Available to Unavailable

View Source​
Declaration
public event DeviceStatusChangedEventHandler<IConnection, ISerialProtocol> DeviceStatusChangedEvent
Event Type​

Brainboxes.IO.DeviceStatusChangedEventHandler<Brainboxes.IO.IConnection,Brainboxes.IO.ISerialProtocol>

Implements​

  • Brainboxes.IO.IDevice<Brainboxes.IO.IConnection,Brainboxes.IO.ISerialProtocol>
  • System.IDisposable
  • Brainboxes.IO.IESDevice