|
fipa_services
|
The task context provides and requires services. It uses an ExecutionEngine to perform its functions. Essential interfaces are operations, data flow ports and properties. These interfaces have been defined using the oroGen specification. In order to modify the interfaces you should (re)use oroGen and rely on the associated workflow. More...
#include <MessageTransportTask.hpp>
Public Member Functions | |
| MessageTransportTask (std::string const &name="fipa_services::MessageTransportTask") | |
| MessageTransportTask (std::string const &name, RTT::ExecutionEngine *engine) | |
| ~MessageTransportTask () | |
| bool | configureHook () |
| bool | startHook () |
| void | updateHook () |
| void | errorHook () |
| void | stopHook () |
| void | cleanupHook () |
Protected Types | |
| typedef std::map< std::string, RTT::base::OutputPortInterface * > | ReceiverPorts |
Protected Member Functions | |
| virtual bool | addReceiver (::std::string const &receiver, bool is_local=false) |
| virtual ::std::vector< ::std::string > | getReceivers () |
| virtual bool | removeReceiver (::std::string const &receiver) |
| bool | addReceiverPort (RTT::base::OutputPortInterface *outputPort, const std::string &name) |
| bool | removeReceiverPort (const std::string &name) |
| void | registerService (std::string receiver) |
| void | deregisterService (std::string receiver) |
| void | serviceAdded (servicediscovery::avahi::ServiceEvent event) |
| void | serviceRemoved (servicediscovery::avahi::ServiceEvent event) |
| void | connectToMTS (const std::string &serviceName, const std::string &ior) |
| bool | deliverLetterLocally (const std::string &receiverName, const fipa::acl::Letter &letter) |
| void | initializeMessageTransport () |
Protected Attributes | |
| boost::mutex | mConnectToMTSMutex |
| boost::shared_mutex | mServiceChangeMutex |
| fipa::services::message_transport::MessageTransport * | mMessageTransport |
| Prevents a simulatenous change of the service. More... | |
| std::string | mInterface |
| std::string | mClientServiceType |
| std::vector< fipa::services::ServiceDirectoryEntry > | mExtraServiceDirectoryEntries |
| ReceiverPorts | mReceivers |
Friends | |
| class | MessageTransportTaskBase |
The task context provides and requires services. It uses an ExecutionEngine to perform its functions. Essential interfaces are operations, data flow ports and properties. These interfaces have been defined using the oroGen specification. In order to modify the interfaces you should (re)use oroGen and rely on the associated workflow.
This oroGen task represents a message transport task to allow to allow for inter-robot communication in a p2p communication network.
Typically this instance will be controlled from the ruby layer (refer to bindings)
Calling the operation 'addReceiver' will trigger the creation of an output port of a predefined name, e.g. 'agent_0'
The client can then connect to this output port and any message addressed to 'agent_0' will be delivered to this port. This agent name
#include <fipa_acl/fipa_acl.h>
fipa::acl::ACLMessage message; message.setPerformative(AclMessage::REQUEST); ... fipa::acl::Letter letter(message, representation::BITEFFICIENT); fipa::SerializedLetter serializedLetter(letter, representation::BITEFFICIENT);
The name of a TaskContext is primarily defined via:
deployment 'deployment_name'
task('custom_task_name','fipa_services::MessageTransportTask')
end
It can be dynamically adapted when the deployment is called with a prefix argument.
|
protected |
| fipa_services::MessageTransportTask::MessageTransportTask | ( | std::string const & | name = "fipa_services::MessageTransportTask" | ) |
TaskContext constructor for MessageTransportTask
| name | Name of the task. This name needs to be unique to make it identifiable via nameservices. |
| initial_state | The initial TaskState of the TaskContext. Default is Stopped state. |
| fipa_services::MessageTransportTask::MessageTransportTask | ( | std::string const & | name, |
| RTT::ExecutionEngine * | engine | ||
| ) |
TaskContext constructor for MessageTransportTask
| name | Name of the task. This name needs to be unique to make it identifiable for nameservices. |
| engine | The RTT Execution engine to be used for this task, which serialises the execution of all commands, programs, state machines and incoming events for a task. |
| fipa_services::MessageTransportTask::~MessageTransportTask | ( | ) |
Default deconstructor of MessageTransportTask
|
protectedvirtual |
|
protected |
Add an output port for a specific receiver, portname and receivername will be identical
| void fipa_services::MessageTransportTask::cleanupHook | ( | ) |
This hook is called by Orocos when the state machine transitions from Stopped to PreOperational, requiring the call to configureHook() before calling start() again.
| bool fipa_services::MessageTransportTask::configureHook | ( | ) |
This hook is called by Orocos when the state machine transitions from PreOperational to Stopped. If it returns false, then the component will stay in PreOperational. Otherwise, it goes into Stopped.
It is meaningful only if the #needs_configuration has been specified in the task context definition with (for example):
task_context "TaskName" do needs_configuration ... end
|
protected |
Connect to another MTS using a known ior
|
protected |
|
protected |
Deregister a service (a receiver) with the distributed service directory.
| void fipa_services::MessageTransportTask::errorHook | ( | ) |
This hook is called by Orocos when the component is in the RunTimeError state, at each activity step. See the discussion in updateHook() about triggering options.
Call recover() to go back in the Runtime state.
|
protected |
|
protected |
Initialize the message transport
|
protected |
Register a service (a receiver) with the distributed service directory.
|
protectedvirtual |
|
protected |
Remove the output port for a specific receiver
|
protected |
Service added callback handler
|
protected |
Service removed callback handler
| bool fipa_services::MessageTransportTask::startHook | ( | ) |
This hook is called by Orocos when the state machine transitions from Stopped to Running. If it returns false, then the component will stay in Stopped. Otherwise, it goes into Running and updateHook() will be called.
| void fipa_services::MessageTransportTask::stopHook | ( | ) |
This hook is called by Orocos when the state machine transitions from Running to Stopped after stop() has been called.
| void fipa_services::MessageTransportTask::updateHook | ( | ) |
This hook is called by Orocos when the component is in the Running state, at each activity step. Here, the activity gives the "ticks" when the hook should be called.
The error(), exception() and fatal() calls, when called in this hook, allow to get into the associated RunTimeError, Exception and FatalError states.
In the first case, updateHook() is still called, and recover() allows you to go back into the Running state. In the second case, the errorHook() will be called instead of updateHook(). In Exception, the component is stopped and recover() needs to be called before starting it again. Finally, FatalError cannot be recovered.
|
friend |
|
protected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
Prevents a simulatenous change of the service.
|
protected |
|
mutableprotected |
1.8.13