OpenJAUS Tutorials
JAUS Components
JAUS Messaging
| Tutorial: Supporting Outgoing Service Connections |
|
|
|
| Written by Tom Galluzzo |
|
Outgoing service connections allow a component to publish messages to subscribing components on a periodic basis. This capability is somewhat harder to implement than incoming service connections because the publishing component is required to setup each outgoing message according to the way it was requested. For example, if the requesting component wishes to receive a report global pose message with a presence vector containing only latitude and longitude, then the publishing component must send a message with only those two fields. Since each subscribing component may require different data, each outgoing message must be setup according to the subscriber's request. The first step in supporting an outgoing service connection is to add the command code of the outgoing message to the component's list of supported messages. This will allow subscribe setup requests for that specific message to be confirmed. Without this step the component will automatically reject any service connection requests. The ojCmptAddSupportedSc() function is used for this step. The example below shows how this would be done for the report global pose message.
After a subscribing component requests a service connection and the request is confirmed, the service connection is considered active. The sending component can test if the any service connections are active by using the ojCmptIsOutgoingScActive() function. This function will retern true if any connections are active.
If the outgoing service connection is active then the sending component is required to send the requested messages. This is done by retrieving a link list of ServiceConnecton data structures. Each structure contains the necessary information for setting up each outgoing message. This includes the subscriber's address, the message presence vector and its sequence number. Once the sending component has this information, it is ready to send the message with the corresponding information. The example below shows how the list is obtained with the ojCmptGetScSendList() and then how each message is setup and sent. After this process is complete the sending component is required to destroy the link list ojCmptDestroySendList().
If the sending component wishes to cancel its support for a specific service connection message, it must call the ojCmptRemoveSupportedSc() function. Before the component is destroyed this function must be explicitly called for each supported service connection command code.
|




0 Comments