BAOS .net SDK  18.2.0
Public Member Functions | Protected Member Functions | List of all members
kdrive::baos::bindings::StreamConnection Class Reference

The StreamConnection is responsible for creating a TCP/IP stream connection with the baos server More...

#include <StreamConnection.h>

Public Member Functions

 StreamConnection ()
 Constructor. More...
 
 ~StreamConnection ()
 Destructor cleans up unmanaged and managed resources. More...
 
void connect (System::String^remoteHost, unsigned char protocol, bool decodeProtocol)
 Connects to the remote device. More...
 
void connect (System::String^remoteHost)
 Connects to the remote device. More...
 
void connect (System::String^remoteHost, bool decodeProtocol)
 Connects to the remote device. More...
 
void connectByName (System::String^name)
 Enumerates the network and finds all available BAOS devices. More...
 
void connectByName (System::String^name, bool decodeProtocol)
 Enumerates the network and finds all available BAOS devices. More...
 
void connectNat (System::String^remoteHost, unsigned short port, unsigned char protocol, bool decodeProtocol)
 Connects to a remote IP BAOS device with NAT More...
 
void disconnect ()
 Disconnects the connection More...
 
bool isConnected ()
 Returns true if the connection is available false otherwise More...
 
unmanaged::ConnectorPtr getConnector ()
 Returns the unmanaged (shared) connector pointer. More...
 

Protected Member Functions

 !StreamConnection ()
 Finalizer (non-deterministic destructor) cleans up unmanaged resources. More...
 

Detailed Description

The StreamConnection is responsible for creating a TCP/IP stream connection with the baos server

The StreamConnection is responsible for creating a TCP/IP socket connection to the remote BAOS device. It requires the IP Address of the device. The StreamConnection is a wrapper around the Connector which is used throughout the baos rpc library.

It implements a connect and a disconnect signal. These signals are invoked when the stream connection is connector and disconnected respectively. Note: a stream connection can be auto-disconnected if the tcp/ip connection is terminated by the remote peer (baos device).

Note
It's recommended that you release the connection with disconnect or Dispose if you do not more need it.
// C# sample
StreamConnection streamConnection = null;
try
{
StreamConnection streamConnection = new StreamConnection();
streamConnection.connectByName("Baos-Sample");
// ...
streamConnection.disconnect();
}
catch (kdrive.KdriveException exception)
{
Console.WriteLine(exception.Message);
}
finally
{
if (streamConnection != null)
{
streamConnection.Dispose();
}
}

Constructor & Destructor Documentation

kdrive::baos::bindings::StreamConnection::StreamConnection ( )

Constructor.

There are no parameters.

kdrive::baos::bindings::StreamConnection::~StreamConnection ( )

Destructor cleans up unmanaged and managed resources.

kdrive::baos::bindings::StreamConnection::!StreamConnection ( )
protected

Finalizer (non-deterministic destructor) cleans up unmanaged resources.

Member Function Documentation

void kdrive::baos::bindings::StreamConnection::connect ( System::String^  remoteHost,
unsigned char  protocol,
bool  decodeProtocol 
)

Connects to the remote device.

Parameters
remoteHostThe remote is the IP Address of the device.
protocolThe protocol is the BAOS protocol version:
decodeProtocolIndicates whether the packet trace is enabled, if true use in conjunction with the logger
Note
This function does perform enumeration, if the protocol version is unknown, to determine the protocol version
void kdrive::baos::bindings::StreamConnection::connect ( System::String^  remoteHost)

Connects to the remote device.

Parameters
remoteHostRemote Host is the IP Address of the device. Tip: you can find this address with the NetnNode Client Application when you select Open Port - Knx via Ip Tunnelling.
Note
This function performs device enumeration to determine the protocol version
void kdrive::baos::bindings::StreamConnection::connect ( System::String^  remoteHost,
bool  decodeProtocol 
)

Connects to the remote device.

Parameters
remoteHostThe remote is the IP Address of the device.
decodeProtocolIndicates whether the packet trace is enabled, if true use in conjunction with the logger
Note
This function does perform enumeration, if the protocol version is unknown, to determine the protocol version
void kdrive::baos::bindings::StreamConnection::connectByName ( System::String^  name)

Enumerates the network and finds all available BAOS devices.

Selects the device that matches the specified name and opens a connection to it.

Parameters
nameThe device friendly name. (Which you can set with the ETS)

This auto-select the BAOS protocol.

void kdrive::baos::bindings::StreamConnection::connectByName ( System::String^  name,
bool  decodeProtocol 
)

Enumerates the network and finds all available BAOS devices.

Selects the device that matches the specified name and opens a connection to it.

Parameters
nameThe device friendly name. (Which you can set with the ETS)
decodeProtocolIndicates whether the packet trace is enabled, if true use in conjunction with the logger

This auto-select the BAOS protocol.

void kdrive::baos::bindings::StreamConnection::connectNat ( System::String^  remoteHost,
unsigned short  port,
unsigned char  protocol,
bool  decodeProtocol 
)

Connects to a remote IP BAOS device with NAT

Parameters
remoteHostRemote Host is the IP Address of the device. Tip: you can find this address with the NetnNode Client Application when you select Open Port - Knx via Ip Tunnelling.
portThe port associated with the connection. The default port of the BAOS TCP protocol is 12004
protocolThe protocol is the BAOS protocol version:
decodeProtocolIndicates whether the packet trace is enabled, if true use in conjunction with the logger

This function does perform enumeration, if the protocol version is unknown, to determine the protocol version

void kdrive::baos::bindings::StreamConnection::disconnect ( )

Disconnects the connection

unmanaged::ConnectorPtr kdrive::baos::bindings::StreamConnection::getConnector ( )

Returns the unmanaged (shared) connector pointer.

Used by the managed C++ implementation

bool kdrive::baos::bindings::StreamConnection::isConnected ( )

Returns true if the connection is available false otherwise


The documentation for this class was generated from the following file: