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
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
Brainboxes.IO.ES246, Brainboxes.IO.ES257, Brainboxes.IO.ES279, Brainboxes.IO.ES313, Brainboxes.IO.ES320, Brainboxes.IO.ES346, Brainboxes.IO.ES357, Brainboxes.IO.ES413, Brainboxes.IO.ES420, Brainboxes.IO.ES446, Brainboxes.IO.ES457, Brainboxes.IO.ES511, Brainboxes.IO.ES522, Brainboxes.IO.ES551, Brainboxes.IO.ES571, Brainboxes.IO.ES701, Brainboxes.IO.ES842
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
public IList<BBSerialPort> Ports { get; }
Protocol
Get/Set the Serial Protocol Used when communicating with all Serial ports of device
View Source
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
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
public override bool IsAvailable { get; }
Fields
_ports
List of serial ports on Ethernet to Serial Device indexed by port number
View Source
protected IList<BBSerialPort> _ports
NumberOfPorts
Number of Serial Ports on Brainboxes Ethernet to Serial Device
View Source
public readonly int NumberOfPorts
PortType
The type of Serial ports on the Brainboxes Ethernet to Serial Port Either RS232 or RS422/485
View Source
public readonly BBSerialPortType PortType
IPAddress
The IP address of the Brainboxes Ethernet to Serial Device
View Source
public string IPAddress
_pingTimeout
The ping timeout used when determining if the device is available on the network
View Source
protected int _pingTimeout
_ping
ping class used to determine whether end point is available when it is not already connected to
View Source
protected Ping _ping
Methods
_initPorts()
Initialized the serial ports on the Ethernet to Serial device using the predefined properties NumberOfPorts and PortType
View Source
protected void _initPorts()
_initPorts(string, ISerialProtocol)
View Source
protected void _initPorts(string ipAddress, ISerialProtocol protocol)
Parameters
| Type | Name |
|---|---|
System.String | ipAddress |
| Brainboxes.IO.ISerialProtocol | protocol |
_initPorts(string, int, int)
View Source
protected void _initPorts(string ipAddress, int port1PortNumber = 9001, int timeout = 2000)
Parameters
| Type | Name |
|---|---|
System.String | ipAddress |
System.Int32 | port1PortNumber |
System.Int32 | timeout |
_initPorts(List<IConnection>)
View Source
protected void _initPorts(List<IConnection> connections)
Parameters
| Type | Name |
|---|---|
System.Collections.Generic.List<Brainboxes.IO.IConnection> | connections |
_initPorts(List<IConnection>, List<ISerialProtocol>)
View Source
protected void _initPorts(List<IConnection> connections, List<ISerialProtocol> protocols)
Parameters
| Type | Name |
|---|---|
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
public override void Connect()
Disconnect()
Disconnect from all the serial ports on the Brainboxes Device
View Source
public override void Disconnect()
ToString()
Returns a short description of the Brainboxes Ethernet to Serial Product
View Source
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
public static ESDevice Create(string ipAddress, int port1PortNumber = 9001, int timeout = 2000)
Returns
Parameters
| Type | Name |
|---|---|
System.String | ipAddress |
System.Int32 | port1PortNumber |
System.Int32 | timeout |
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
public static ESDevice Create(string ipAddress, ISerialProtocol protocol)
Returns
Parameters
| Type | Name |
|---|---|
System.String | ipAddress |
| Brainboxes.IO.ISerialProtocol | protocol |
Events
_deviceStatusChangedEvent
The event which describes when a device status change occurs
View Source
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
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