Class: Reader

vortexdds~Reader()

Represents a DDS data reader.

A reader may be owned by either a Participant or Subscriber. Using a Subscriber to create a Reader allows the reader to benefit from quality-of-service policies assigned the the Subscriber, in particular the QoS.partition policy.

Class instances are created by the Participant.createReader() or Subscriber.createReader() methods.

Note that DDS resources and memory consumed by DDS entities cannot be automatically reclaimed by the NodeJS engine. Once your application is finished with an Entity, you must call delete() to release these DDS resources.

Constructor

new Reader()

Extends:
See:

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.

Type
module:vortexdds.DDSError
Returns:
Type
module:vortexdds.QueryCondition

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

Type
module:vortexdds.ReadCondition

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

Overrides:
Throws:

if the status mask is invalid

Type
module:vortexdds.DDSError
Returns:
Type
module:vortexdds.StatusCondition

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.

Type
module:vortexdds.DDSError
Returns:

an array of sample and info pairs

Type
external:Array.<module:vortexdds~SampleData>

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.

Type
module:vortexdds.DDSError
Returns:

an array of sample and info pairs

Type
external:Array.<module:vortexdds~SampleData>

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

Type
module:vortexdds.StatusMask

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.

Type
module:vortexdds.DDSError
Returns:

an array of sample and info pairs

Type
external:Array.<module:vortexdds~SampleData>

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.

Type
module:vortexdds.DDSError
Returns:

an array of sample and info pairs

Type
external:Array.<module:vortexdds~SampleData>

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>