The connection object.
The central point of the RCM C++ library is the connection object that represents a connection with a single RCM radio module. The connection is represented by rcm::Connection class
The connection object is usually defined by the user. Each instance represents a single RCM radio module (usually there is only one in the system).
Opening the connection using port name.
The easiest method is to use the constructor that allows to specify the system name for the serial port used for communication with the radio module. The following example illustrates the idea:
Opening the connection using native HAL interface.
Another way to open the connection is to provide the IODevice handle of the serial port, used for communication with the radio module. The following example shows how this can be done.
Opening virtual connection.
In addition, the RCM C++ library provides a convenient way of working with virtual connections. In order to create a virtual connection, simply use the "virtual" keyword as serial port name during rcm::Connection object construction.
The RCM library makes full use of an operating system supported by HALFRED Hardware Abstraction Layer. Constructing the rcm::Connection object causes two new threads to run - one that handles the underlying SCOM protocol, and the other one that handles message filtering.
All C++ API calls use exceptions to signal connection errors. This applies also to rcm::Connection construction. A proper way to initialize the object is to enclose it with a try..catch block in order to catch a dedicated exception, represented by the rcm::exception class, as shown in the example below:
Once we have the connection object, we can start using the RCM C++ library API.
Generated on Thu Feb 22 2018 13:14:54 for RCM API C++ Library by 188.8.131.52