BAOS SDK
18.2.0
|
The BaosConnection is responsible for creating a TCP/IP stream or a FT 1.2 connection with the baos server. More...
#include <BaosConnection.h>
Public Types | |
typedef std::shared_ptr< BaosConnector > | BaosConnectorPtr |
typedef boost::signals2::signal< void()> | ConnectSignal |
typedef boost::signals2::signal< void()> | DisconnectSignal |
Public Member Functions | |
BaosConnection () | |
Creates a default (disconnected) BaosConnection. More... | |
BaosConnection (const BaosConnection &)=delete | |
BaosConnection & | operator= (const BaosConnection &)=delete |
virtual | ~BaosConnection () |
Destroys the StreamConnection. More... | |
BaosConnectorPtr | getConnector () |
returns the connector throws a NullPointerException exception if the connector is not connected More... | |
void | connectIp (const std::string remoteHost, unsigned char version, bool decodeProtocol=false) |
Connects to a remote IP BAOS device. More... | |
void | connectIp (const BaosDevice &baosDevice, bool decodeProtocol=false) |
Connects to a remote IP BAOS device. More... | |
void | connectIpByName (const std::string &name, bool decodeProtocol=false) |
Connects to a remote IP BAOS device It gets the IP address and protocol version via a KNXnet/IP Search Request/Response. More... | |
void | connectIpByAddress (const std::string &ipAddress, bool decodeProtocol=false) |
Connects to a remote IP BAOS device It gets the protocol version via a KNXnet/IP Search Request/Response. More... | |
void | connectIpNat (const std::string &ipAddress, unsigned short port, unsigned char version, bool decodeProtocol=false) |
Connects to a remote IP BAOS device with NAT. More... | |
void | connectSerial (const std::string &serialDeviceName, bool decodeProtocol=false) |
Connects to a Serial FT1.2 BAOS device. More... | |
void | disconnect () |
Disconnects the connection to a remote device. More... | |
bool | isConnected () const |
Returns true if the connection is established, false otherwise. More... | |
ConnectSignal & | getConnectSignal () |
Returns the connect signal This is invoked when the connector thread is started. More... | |
DisconnectSignal & | getDisconnectSignal () |
Returns the disconnect signal This is invoked when the connector thread is stopped. More... | |
The BaosConnection is responsible for creating a TCP/IP stream or a FT 1.2 connection with the baos server.
The BaosConnection is responsible for creating a TCP/IP socket connection or FT 1.2 connection to the remote BAOS device. For IP it requires the IP Address of the device and for FT 1.2 Serial the name of the serial port. The BaosConnection 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). This may occur if a connection timeout occurs (i.e. no socket activity for a couple of minutes).
typedef std::shared_ptr<BaosConnector> kdrive::baos::BaosConnection::BaosConnectorPtr |
typedef boost::signals2::signal<void ()> kdrive::baos::BaosConnection::ConnectSignal |
typedef boost::signals2::signal<void ()> kdrive::baos::BaosConnection::DisconnectSignal |
BaosConnection::BaosConnection | ( | ) |
Creates a default (disconnected) BaosConnection.
|
delete |
|
virtual |
Destroys the StreamConnection.
If no other hold an reference to the Connector (the normal case), the destructor of Connector will called which closed the TCP/IP socket connection respectively the serial port.
void BaosConnection::connectIp | ( | const std::string | remoteHost, |
unsigned char | version, | ||
bool | decodeProtocol = false |
||
) |
Connects to a remote IP BAOS device.
void BaosConnection::connectIp | ( | const BaosDevice & | baosDevice, |
bool | decodeProtocol = false |
||
) |
Connects to a remote IP BAOS device.
void BaosConnection::connectIpByAddress | ( | const std::string & | ipAddress, |
bool | decodeProtocol = false |
||
) |
Connects to a remote IP BAOS device It gets the protocol version via a KNXnet/IP Search Request/Response.
void BaosConnection::connectIpByName | ( | const std::string & | name, |
bool | decodeProtocol = false |
||
) |
Connects to a remote IP BAOS device It gets the IP address and protocol version via a KNXnet/IP Search Request/Response.
void BaosConnection::connectIpNat | ( | const std::string & | ipAddress, |
unsigned short | port, | ||
unsigned char | version, | ||
bool | decodeProtocol = false |
||
) |
Connects to a remote IP BAOS device with NAT.
void BaosConnection::connectSerial | ( | const std::string & | serialDeviceName, |
bool | decodeProtocol = false |
||
) |
Connects to a Serial FT1.2 BAOS device.
serialDeviceName | is the platform specific device name, e.g. COM1 or /dev/ttyS0 |
void BaosConnection::disconnect | ( | ) |
Disconnects the connection to a remote device.
BaosConnector::Ptr BaosConnection::getConnector | ( | ) |
returns the connector throws a NullPointerException exception if the connector is not connected
BaosConnection::ConnectSignal & BaosConnection::getConnectSignal | ( | ) |
Returns the connect signal This is invoked when the connector thread is started.
BaosConnection::DisconnectSignal & BaosConnection::getDisconnectSignal | ( | ) |
Returns the disconnect signal This is invoked when the connector thread is stopped.
bool BaosConnection::isConnected | ( | ) | const |
Returns true if the connection is established, false otherwise.
|
delete |