Constructor
new Participant(domainIdopt, qosopt)
Create a Participant instance.
Extends:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
domainId |
number |
<optional> |
An integer between 0 and 230. Must match the value specified in the OSPL configuration file referenced by the OSPL_CONFIG environment variable. |
|
qos |
module:vortexdds.QoS |
<optional> |
QoS.participantDefault() | A QoS object. Uses the QoS.participantDefault() if qos is not provided. Note that there is no functional difference between passing no argument and passing in null for qos while creating a participant. |
Throws:
-
if a participant cannot be created.
Extends
Members
qos :module:vortexdds.QoS
The existing QoS policies for the entity.
Type:
- Overrides:
Methods
createPublisher(qosopt) → {module:vortexdds.Publisher}
Creates a DDS Publisher owned by this participant.
Typically, you create a Publisher in order specify one or more 'partitions' to which publisher-owned writers will publish data. Partitions are specified via the partition policy of a QoS object.
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.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
qos |
module:vortexdds.QoS |
<optional> |
QoS.publisherDefault() | quality-of-service policies for the publisher. Uses the QoS.publisherDefault() if qos is not provided. Note that there is no functional difference between passing no argument and passing in null for qos while creating a publisher. |
Throws:
-
if the publisher cannot be created
Returns:
the Publisher instance
Example
// specify a partition policy via a QoS object
const dds = require('vortexdds');
const dp = somePreviouslyCreatedParticipant;
const qos = dds.QoS.publisherDefault();
qos.partition = { names: ['part1', 'part2']};
// Assuming dp is a Participant instance
const pub = dp.createPublisher(qos);
// ... use 'pub' object
createReader(topic, qosopt, listeneropt) → {module:vortexdds.Reader}
Creates a Reader for a topic on the 'default subscriber' of the participant.
Similar to Subscriber.createReader() except that a Reader created based in QoS properties of the 'default subscriber' for the domain.
The reader belongs to the participant from which it is created, and is automatically deleted when the participant is deleted.
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.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
topic |
module:vortexdds.Topic | the topic from which data will be read |
||
qos |
module:vortexdds.QoS |
<optional> |
QoS.readerDefault() | quality-of-service policies for the reader. If no argument is provided, then QoS.readerDefault() is used, whereas passing in a null value results in the topic's qos to be used. |
listener |
module:vortexdds~ReaderListener |
<optional> |
null | an object defining listener callbacks for the reader |
Throws:
-
if the reader cannot be created
Returns:
the Reader instance
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:
createSubscriber(qosopt) → {module:vortexdds.Subscriber}
Creates a DDS Subscriber owned by this participant.
Typically, you create a Publisher in order specify one or more 'partitions' to which publisher-owned writers will publish data. Partitions are specified via the partition policy of a QoS object.
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.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
qos |
module:vortexdds.QoS |
<optional> |
QoS.subscriberDefault() | quality-of-service policies for the subscriber. Uses the QoS.subscriberDefault() if qos is not provided. Note that there is no functional difference between passing no argument and passing in null for qos while creating a subscriber. |
Throws:
-
if the subscriber cannot be created
Returns:
the Subscriber instance
Example
// specify a partition policy via a QoS object
const dds = require('vortexdds');
const dp = somePreviouslyCreatedParticipant;
const qos = dds.QoS.subscriberDefault();
qos.partition = { names: ['part1', 'part2']};
// Assuming dp is a Participant instance
const sub = dp.createSubscriber(qos);
// ... use 'sub' object
createTopic(topicName, typeSupport, qosopt, listeneropt) → {module:vortexdds.Topic}
Creates a DDS Topic of the given name and type.
Type information is encoded in a TypeSupport object, typically returned by importIDL().
Topic creatation can fail if the DDS domain already has an identically named topic, but with different QoS or type information.
The topic belongs to the participant from which it is created, and is automatically deleted when the participant is deleted.
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.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
topicName |
string | a valid DDS topic name |
||
typeSupport |
module:vortexdds.TypeSupport | a object defining the data type associated with the topic |
||
qos |
module:vortexdds.QoS |
<optional> |
QoS.topicDefault() | a specification of the quality-of-service properties for the topic. Uses the QoS.topicDefault() if qos is not provided. Note that there is no functional difference between passing no argument and passing in null for qos while creating a topic. |
listener |
module:vortexdds~TopicListener |
<optional> |
null | an object defining listener callbacks for the topic |
Throws:
-
if the topic already exists, but with different type or QoS parameters
Returns:
a topic instnace
createWriter(topic, qosopt, listeneropt) → {module:vortexdds.Writer}
Creates a Reader for a topic on the 'default publisher' of the participant.
Similar to Publisher.createWriter() except that a Writer created based in QoS properties of the 'default publisher' for the domain.
The writer belongs to the participant from which it is created, and is automatically deleted when the participant is deleted.
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.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
topic |
module:vortexdds.Topic | the topic to which data will be written |
||
qos |
module:vortexdds.QoS |
<optional> |
QoS.writerDefault() | quality-of-service policies for the writer. If no argument is provided, then QoS.writerDefault() is used, whereas passing in a null value results in the topic's qos to be used. |
listener |
module:vortexdds~WriterListener |
<optional> |
null | an object defining listener callbacks for the writer |
Throws:
-
if the writer cannot be created
Returns:
the Writer instance
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
findTopic(topicName) → {external:Promise.<module:vortexdds.Topic>}
Asyncrhonously search for an existing DDS topic.
Return a Promise, whose resolved value is the found topic. The Promise is rejected if the topic cannot be found or another error occurs.
Parameters:
| Name | Type | Description |
|---|---|---|
topicName |
string | the name of topic to find |
Returns:
a promise that resolves to the desired topic
Example
const dds = require('vortexdds');
const dp = someAlreadyCreatedParticipant;
dp.findTopic('MyTopic')
.then(topic => {
// do something with the found topic
})
.catch(err => {
// process any exception
})
.then(_ => {
// cleanup: do any processing necessary after both
// success and failure
});
getBuiltinSubscriber() → {module:vortexdds.Subscriber}
Creates the builtin subscriber on this participant.
Returns:
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