OpenCurves
0.9
|
Specifies a real time communication specification, messaging and buffer setup. More...
#include <realtimecommspec.h>
Public Member Functions | |
RealTimeCommSpec () | |
Create an empty comm-spec. | |
~RealTimeCommSpec () | |
Destroy the comm-spec. Only deletes the wrapped classes (no disconnect). | |
void | setConnection (RealTimeConnection *connection) |
Set the connection details, deleting and replacing any existing connection. More... | |
RealTimeConnection * | connection () const |
Access the connection. More... | |
void | setConnectMessage (RTMessage *msg) |
Set the connection message, deleting and replacing any existing connection message. More... | |
const RTMessage * | connectMessage () const |
Access the current connection message. More... | |
void | setDisconnectMessage (RTMessage *msg) |
Set the disconnect message, deleting and replacing any existing disconnect message. More... | |
const RTMessage * | disconnectMessage () const |
Access the current disconnect message. More... | |
void | setIncomingMessage (RTMessage *msg) |
Set details of the expected incoming messages deleting and replacing any such existing specification. More... | |
RTMessage * | incomingMessage () const |
Access the current disconnect message. More... | |
void | setBufferSize (unsigned size) |
Set the requested plot buffer size for incoming data. More... | |
unsigned | bufferSize () const |
Access the requested buffer size for incoming sample data buffering. More... | |
void | setTimeColumn (unsigned columnNumber) |
Set the expected time column number. More... | |
unsigned | timeColumn () const |
Access the time column. More... | |
void | setTimeScale (double scale) |
Sets the time scaling value. More... | |
double | timeScale () const |
Access the time scale value. More... | |
void | disconnect () |
Send disconnect message and disconnect the connection. More... | |
Specifies a real time communication specification, messaging and buffer setup.
The specification collates the RealTimeConnection
and the RTMessage
definitions to use with the connection. It also includes expected timing details for the incoming data series.
The messaging may include three messages:
The comm-spec may represent either a binary or text-based connection, but this depends entirely on the RTMessage
objects belonging to the comm-spec. The two primary implementations are RTBinaryMessage
and RTStringMessage
.
This object only serves to collate these messages and the connection, but does not manage the messaging, except that as a convenience, the disconnect()
function sends the disconnectMessage()
and calls disconnect on the connection.
The code managing the connection communications is responsible for sending the connectMessage()
message and processing incoming data using incommingMessage()
.
|
inline |
Access the requested buffer size for incoming sample data buffering.
|
inline |
Access the connection.
Must not be null for a valid and complete comm-spec.
|
inline |
Access the current connection message.
May be null.
void RealTimeCommSpec::disconnect | ( | ) |
Send disconnect message and disconnect the connection.
This is a convenience function for managing disconnection. Before disconnecting, this function sends the disconnectMessage()
if a valid message has been associated with the comm-spec. The RealTimeConnection::disconnect()
message is then called.
The function does nothing if there is no connection or if RealTimeConnection::isConnected()
returns false.
|
inline |
Access the current disconnect message.
May be null.
|
inline |
Access the current disconnect message.
Must not be null for a valid and complete comm-spec.
|
inline |
Set the requested plot buffer size for incoming data.
This controls the number of samples to store before discarding the oldest sample.
The comm-spec only holds this information and does not apply it. It is used by @ PlotInstance objects to manage a ring buffer of this size.
size | The requested buffer size in data samples. |
void RealTimeCommSpec::setConnection | ( | RealTimeConnection * | connection | ) |
Set the connection details, deleting and replacing any existing connection.
connection | The new connection |
void RealTimeCommSpec::setConnectMessage | ( | RTMessage * | msg | ) |
Set the connection message, deleting and replacing any existing connection message.
The connection message must be sent on establishing a connection. For example, this may be used to request data streaming begin over the connection.
msg | The new connection message. |
void RealTimeCommSpec::setDisconnectMessage | ( | RTMessage * | msg | ) |
Set the disconnect message, deleting and replacing any existing disconnect message.
The connection message must be sent priori to disconnecting. For example, this may be used to request data streaming begin over the connection. The disconnect()
function may be used as a convenience.
msg | The new disconnect message. |
void RealTimeCommSpec::setIncomingMessage | ( | RTMessage * | msg | ) |
Set details of the expected incoming messages deleting and replacing any such existing specification.
The incoming message handles incoming data, converting incoming data to time series values. See implementations of RTMessage
for details.
msg | The new incoming data message. |
|
inline |
Set the expected time column number.
This identifies the time column for incoming data. It is a one-based index with a zero value indicating there is no time column.
columnNumber | The one-based index for the time column. |
|
inline |
Sets the time scaling value.
All values in the time column are multiplied by this scale before publishing the actual time value. For example, this may be used to convert from a microsecond timestamp to seconds by setting the value to 1e-6.
scale | The time scaling multiplier. Must not be zero. |
|
inline |
Access the time column.
|
inline |