Skip to main content

Interface IConnection

Interface describing a connection to a Brainboxes device.

Assembly: Brainboxes.IO.dll​
View Source​
Declaration
public interface IConnection : IDisposable

Properties​

IsConnected​

Whether the Brainboxes Device has an active connection from this connection instance

View Source​
Declaration
bool IsConnected { get; }

IsAvailable​

Whether this connection to a 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
bool IsAvailable { get; }

Timeout​

Timeout for Reads and Writes

View Source​
Declaration
int Timeout { get; set; }

Stream​

The Connections underlying stream which it exposes once a connection has been initiated

View Source​
Declaration
Stream Stream { get; }

Methods​

Connect()​

Connect to a Brainboxes Device

View Source​
Declaration
void Connect()

Disconnect()​

Disconnect from a Brainboxes Device

View Source​
Declaration
void Disconnect()

Events​

ConnectionStatusChangedEvent​

When the status of the connection changes this event is raised e.g. when IsConnected changes from false to true or when IsAvailable changes:

  • for example for a TCPConnection if the IP address is goes from online to offline
  • or for example for a SerialConnection when the COM name is no longer present or in use by another program
View Source​
Declaration
event ConnectionStatusChangedEventHandler ConnectionStatusChangedEvent
Event Type​

Brainboxes.IO.ConnectionStatusChangedEventHandler