Constructor
new Reader()
Internal use only. Use Participant.createReader() or Subscriber.createReader().
Extends:
- See:
-
- QoS.readerDefault() to create a QoS object for a reader
- QoSProvider.getReaderQos() on retreiving an externaly reader QoS policy from a QoSProvider.
Extends
Members
livelinessChangedStatus :module:vortexdds~LivelinessChangedStatus
Get the LivelinessChangedStatus object of the reader.
Type:
qos :module:vortexdds.QoS
The existing QoS policies for the entity.
Type:
- Overrides:
requestedDeadlineMissedStatus :module:vortexdds~RequestedDeadlineMissedStatus
Get the RequestedDeadlineMissedStatus object of the reader.
Type:
requestedIncompatibleQosStatus :module:vortexdds~RequestedIncompatibleQosStatus
Get the RequestedIncompatibleQosStatus object of the reader.
Type:
sampleLostStatus :module:vortexdds~SampleLostStatus
Get the SampleLostStatus object of the reader.
Type:
sampleRejectedStatus :module:vortexdds~SampleRejectedStatus
Get the SampleRejectedStatus object of the reader.
Type:
subscriptionMatchedStatus :module:vortexdds~SubscriptionMatchedStatus
Get the SubscriptionMatchedStatus object of the reader.
Type:
topic :module:vortexdds.Topic
The topic instance with which the reader is associated.
Type:
Methods
createQueryCondition(mask, expression, params) → {module:vortexdds.QueryCondition}
Create a Query Condition.
A query condition may be attached to a Waitset or as part of a conditional read via Reader.takeCond() or Reader.readCond().
Note that DDS resources and memory consumed by conditions cannot be automatically reclaimed by the NodeJS engine. Conditions are automatically deleted when the parent entity is deleted. Otherwise, when your application is finished with a Condition, you may call Condition.delete() to release these DDS resources.
Parameters:
| Name | Type | Description |
|---|---|---|
mask |
module:vortexdds.StateMask | a mask of instance, view and sample state values to accept |
expression |
string | a SQL where expression, with optional parameter substitution markers of the form %n, where n is a number. Parameter numbers start at 0 and must be sequential. |
params |
Array.<string> | an array of string substitutions for parameter markers placed in expression. |
Throws:
-
if the query condition could not be created.
Returns:
createReadCondition(mask) → {module:vortexdds.ReadCondition}
Create a read condition.
A read condition may be attached to a Waitset or as part of a conditional read via Reader.takeCond() or Reader.readCond().
Note that DDS resources and memory consumed by conditions cannot be automatically reclaimed by the NodeJS engine. Conditions are automatically deleted when the parent entity is deleted. Otherwise, when your application is finished with a Condition, you may call Condition.delete() to release these DDS resources.
Parameters:
| Name | Type | Description |
|---|---|---|
mask |
module:vortexdds.StateMask | a mask of instance, view and sample state values to accept |
Returns:
a read condition
createStatusCondition(maskopt) → {module:vortexdds.StatusCondition}
Creates a StatusCondition for use in wait set.
Omitting the mask value results in all entity-appropriate status conditions being enabled.
Note that DDS resources and memory consumed by conditions cannot be automatically reclaimed by the NodeJS engine. Conditions are automatically deleted when the parent entity is deleted. Otherwise, when your application is finished with a Condition, you may call Condition.delete() to release these DDS resources.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mask |
module:vortexdds.StatusMask |
<optional> |
null | mask of StatusMask values of interest |
Throws:
-
if the status mask is invalid
Returns:
delete() → {external:Promise}
Releases the DDS resources associated with the entity and all its 'child' entities.
In some cases, releasing DDS resources can take several seconds. This methods returns a Promise that enables you to do processing after all the resources have been released.
- Overrides:
Returns:
- Type
- external:Promise
read(maxSample) → {external:Array.<module:vortexdds~SampleData>}
Read samples available for the topic.
Note that, in DDS, a 'read' operation returns all published samples available for the topic, whether the Reader has previously seen them or not. If you want to see only changed data, you should use a 'take' operation, instead.
Parameters:
| Name | Type | Description |
|---|---|---|
maxSample |
number | maximum number of samples to read |
Throws:
-
if the read operation fails.
Returns:
an array of sample and info pairs
readCond(maxSample, cond) → {external:Array.<module:vortexdds~SampleData>}
Conditionally Read samples available for the topic according to the supplied ReadCondition or QueryCondition.
Note that, in DDS, a 'read' operation returns all published samples available for the topic, whether the Reader has previously seen them or not. If you want to see only changed data, you should use a 'take' operation, instead.
Parameters:
| Name | Type | Description |
|---|---|---|
maxSample |
number | maximum number of samples to read |
cond |
module:vortexdds.Condition | a condtion with with to filter results |
Throws:
-
if the read operation fails.
Returns:
an array of sample and info pairs
statusChanges() → {module:vortexdds.StatusMask}
Return the DDS communication statuses that have changed since this method was last called.
- Overrides:
Returns:
a mask of statuses that have changed
take(maxSample) → {external:Array.<module:vortexdds~SampleData>}
Take previously unseen samples available for the topic.
Note that, in DDS, a 'take' operation returns only published samples available for the topic not previously seen by this Reader. If you want to see all available samples, you should use a 'read' operation, instead.
Parameters:
| Name | Type | Description |
|---|---|---|
maxSample |
number | maximum number of samples to take |
Throws:
-
if the take operation fails.
Returns:
an array of sample and info pairs
takeCond(maxSample, cond) → {external:Array.<module:vortexdds~SampleData>}
Conditionally take samples not previously seen available for the topic according to the supplied ReadCondition or QueryCondition.
Note that, in DDS, a 'take' operation returns only published samples available for the topic not previously seen by this Reader. If you want to see all available samples, you should use a 'read' operation, instead.
Parameters:
| Name | Type | Description |
|---|---|---|
maxSample |
number | maximum number of samples to take |
cond |
module:vortexdds.Condition | a condtion with with to filter results |
Throws:
-
if the take operation fails.
Returns:
an array of sample and info pairs
waitForHistoricalData(timeout) → {external:Promise.<number>}
Asynchronously wait for historical data to be delivered by the DDS Service.
Returns a Promise to which asynchronous listeners may be attached once historical data has been retrieved. If a timeout or error occurs, the promise is rejected. Otherwise, the promise will resolve with a value of 0.
Parameters:
| Name | Type | Description |
|---|---|---|
timeout |
number | a timeout in nanoseconds how long to wait for historical data before time out |
Returns:
- Type
- external:Promise.<number>