QRemoteObjectNode Class
A node on a Qt Remote Objects network. More...
| Header: | #include <QRemoteObjectNode> |
| qmake: | QT += remoteobjects |
| Instantiated By: | Node |
| Inherits: | QObject |
| Inherited By: |
Public Types
| enum | ErrorCode { NoError, RegistryNotAcquired, RegistryAlreadyHosted, NodeIsNoServer, ServerAlreadyCreated, …, ListenFailed } |
| typedef | RemoteObjectSchemaHandler |
Properties
- heartbeatInterval : int
- persistedStore : QRemoteObjectAbstractPersistedStore*
- registryUrl : QUrl
Public Functions
| int | heartbeatInterval() const |
| QRemoteObjectAbstractPersistedStore * | persistedStore() const |
| QUrl | registryUrl() const |
| void | setHeartbeatInterval(int interval) |
| void | setPersistedStore(QRemoteObjectAbstractPersistedStore *persistedStore) |
| virtual bool | setRegistryUrl(const QUrl ®istryAddress) |
Signals
| void | heartbeatIntervalChanged(int heartbeatInterval) |
Detailed Description
The QRemoteObjectNode class provides an entry point to a QtRemoteObjects network. A network can be as simple as two nodes, or an arbitrarily complex set of processes and devices.
A QRemoteObjectNode does not have a url that other nodes can connect to, and thus is able to acquire replicas only. It is not able to share source objects (only QRemoteObjectHost and QRemoteObjectRegistryHost Nodes can share).
Nodes may connect to each other directly using connectToNode, or they can use the QRemoteObjectRegistry to simplify connections.
The QRemoteObjectRegistry is a special replica available to every node that connects to the Registry Url. It knows how to connect to every QRemoteObjectSource object on the network.
See also QRemoteObjectHost and QRemoteObjectRegistryHost.
Member Type Documentation
enum QRemoteObjectNode::ErrorCode
This enum type specifies the various error codes associated with QRemoteObjectNode errors:
| Constant | Value | Description |
|---|---|---|
QRemoteObjectNode::NoError | 0 | No error. |
QRemoteObjectNode::RegistryNotAcquired | 1 | The registry could not be acquired. |
QRemoteObjectNode::RegistryAlreadyHosted | 2 | The registry is already defined and hosting Sources. |
QRemoteObjectNode::NodeIsNoServer | 3 | The given QRemoteObjectNode is not a host node. |
QRemoteObjectNode::ServerAlreadyCreated | 4 | The host node has already been initialized. |
QRemoteObjectNode::UnintendedRegistryHosting | 5 | An attempt was made to create a host QRemoteObjectNode and connect to itself as the registry. |
QRemoteObjectNode::OperationNotValidOnClientNode | 6 | The attempted operation is not valid on a client QRemoteObjectNode. |
QRemoteObjectNode::SourceNotRegistered | 7 | The given QRemoteObjectSource is not registered on this node. |
QRemoteObjectNode::MissingObjectName | 8 | The given QObject does not have objectName() set. |
QRemoteObjectNode::HostUrlInvalid | 9 | The given url has an invalid or unrecognized scheme. |
QRemoteObjectNode::ProtocolMismatch | 10 | The client and the server have different protocol versions. |
QRemoteObjectNode::ListenFailed | 11 | Can't listen on the specified host port. |
typedef QRemoteObjectNode::RemoteObjectSchemaHandler
Typedef for a std::function method that can take a QUrl input and is responsible for creating the communications channel between this node and the node hosting the desired Source. As some types of QIODevices (e.g., QSslSocket) require additional steps before the device is ready for use, the method is responsible for calling addClientSideConnection once the connection is fully established.
This typedef was introduced in Qt 5.12.
Property Documentation
heartbeatInterval : int
Heartbeat interval in ms.
The heartbeat (only helpful for socket connections) will periodically send a message to connected nodes to detect whether the connection was disrupted. Qt Remote Objects will try to reconnect automatically if it detects a dropped connection. This function can help with that detection since the client will only detect that the server is unavailable when it tries to send data.
A value of 0 (the default) will disable the heartbeat.
Access functions:
| int | heartbeatInterval() const |
| void | setHeartbeatInterval(int interval) |
Notifier signal:
| void | heartbeatIntervalChanged(int heartbeatInterval) |
persistedStore : QRemoteObjectAbstractPersistedStore*
Allows setting a QRemoteObjectAbstractPersistedStore instance for the node.
Allows replica PROP members with the PERSISTED trait to save their current value when the replica is deleted and restore a stored value the next time the replica is started.
Requires a QRemoteObjectAbstractPersistedStore class implementation to control where and how persistence is handled.
This property was introduced in Qt 5.11.
Access functions:
| QRemoteObjectAbstractPersistedStore * | persistedStore() const |
| void | setPersistedStore(QRemoteObjectAbstractPersistedStore *persistedStore) |
registryUrl : QUrl
This property holds the address of the Registry used by this node.
This is an empty QUrl if there is no registry in use.
Access functions:
| QUrl | registryUrl() const |
| virtual bool | setRegistryUrl(const QUrl ®istryAddress) |