BAOS SDK  18.2.0
Public Types | Public Member Functions | List of all members
kdrive::baos::BaosConnection Class Reference

The BaosConnection is responsible for creating a TCP/IP stream or a FT 1.2 connection with the baos server. More...

#include <BaosConnection.h>

Inheritance diagram for kdrive::baos::BaosConnection:
kdrive::baos::ScopedBaosConnection kdrive::baos::ScopedSerialBaosConnection kdrive::baos::StreamConnection

Public Types

typedef std::shared_ptr< BaosConnectorBaosConnectorPtr
 
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
 
BaosConnectionoperator= (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...
 
ConnectSignalgetConnectSignal ()
 Returns the connect signal This is invoked when the connector thread is started. More...
 
DisconnectSignalgetDisconnectSignal ()
 Returns the disconnect signal This is invoked when the connector thread is stopped. More...
 

Detailed Description

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).

See also
BaosHeartbeat

Member Typedef Documentation

typedef boost::signals2::signal<void ()> kdrive::baos::BaosConnection::ConnectSignal
typedef boost::signals2::signal<void ()> kdrive::baos::BaosConnection::DisconnectSignal

Constructor & Destructor Documentation

BaosConnection::BaosConnection ( )

Creates a default (disconnected) BaosConnection.

kdrive::baos::BaosConnection::BaosConnection ( const BaosConnection )
delete
BaosConnection::~BaosConnection ( )
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.

Member Function Documentation

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.

Parameters
serialDeviceNameis the platform specific device name, e.g. COM1 or /dev/ttyS0
void BaosConnection::disconnect ( )

Disconnects the connection to a remote device.

Examples:
BaosEventListener.cpp.
BaosConnector::Ptr BaosConnection::getConnector ( )

returns the connector throws a NullPointerException exception if the connector is not connected

Examples:
BaosDatapointDescription.cpp, BaosEventListener.cpp, BaosLightSwitcher.cpp, BaosMultiConnector.cpp, and BaosMultiThreaded.cpp.
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.

BaosConnection& kdrive::baos::BaosConnection::operator= ( const BaosConnection )
delete

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