Click or drag to resize

Connection Class

Abstract base Connection class
Inheritance Hierarchy

Namespace: Brainboxes.IO
Assembly: Brainboxes.IO (in Brainboxes.IO.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public abstract class Connection : IConnection, 
	IDisposable

The Connection type exposes the following members.

Properties
 NameDescription
Public propertyIsAvailable 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.
Public propertyIsConnected Whether this connection instance to a Brainboxes Device is active
Public propertyStream The Connections underlying stream class
Public propertyTimeout The timeout for Stream reads and writes, and connection availability test
Top
Methods
 NameDescription
Public methodConnect Connect to the ED Device
Public methodStatic memberCode exampleCreate Supply a connection IP address or com port and the correct IConnection concrete class will be created and returned
Example
IConnection c1 = Connection.Create("192.168.0.5"); // returns a TCPConnection class IConnection c2 = Connection.Create("COM6", 9600); //returns a SerialConnection class with the baud rate set to 9600
Public methodDisconnect Disconnect from the ED Device
Public methodDispose Dispose of this Brainboxes device
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToString ToString
(Overrides ObjectToString)
Top
Events
 NameDescription
Public eventConnectionStatusChangedEvent 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 on-line to off-line * or for example for a SerialConnection when the COM name is no longer present or in use by another program
Top
See Also