RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
rtctk::componentFramework::CommandRequestor Class Reference

Extendable class that allows to send commands to components using MAL. More...

#include <rtctk/componentFramework/commandRequestor.hpp>

Inheritance diagram for rtctk::componentFramework::CommandRequestor:
MyCommandRequestor

Public Member Functions

 CommandRequestor (const elt::mal::Uri &uri, std::optional< std::chrono::milliseconds > timeout=std::nullopt)
 Create a new CommandRequestor object.
 
virtual ~CommandRequestor ()=default
 
std::string SendCommandSync (const std::string &id, const std::string &args)
 Send synchronous command to a component.
 
elt::mal::future< std::string > SendCommandAsync (const std::string &id, const std::string &args)
 Send asynchronous command to a component.
 

Protected Member Functions

template<typename T >
std::unique_ptr< T > MakeInterface (const std::string &name)
 Make a new MAL interface.
 
void RegisterCommand (const std::string &id, std::function< elt::mal::future< std::string >(const std::string &)> fun)
 Register a new command.
 

Detailed Description

Extendable class that allows to send commands to components using MAL.

Constructor & Destructor Documentation

◆ CommandRequestor()

rtctk::metadataCollector::CommandRequestor::CommandRequestor ( const elt::mal::Uri & uri,
std::optional< std::chrono::milliseconds > timeout = std::nullopt )
explicit

Create a new CommandRequestor object.

Parameters
uriip and port of the component
timeouttimeout for requests in milliseconds

◆ ~CommandRequestor()

virtual rtctk::componentFramework::CommandRequestor::~CommandRequestor ( )
virtualdefault

Member Function Documentation

◆ MakeInterface()

template<typename T >
std::unique_ptr< T > rtctk::componentFramework::CommandRequestor::MakeInterface ( const std::string & name)
inlineprotected

Make a new MAL interface.

Template Parameters
Ttype of the MAL interface
Parameters
nameidentifyer of the MAL interface

◆ RegisterCommand()

void rtctk::componentFramework::CommandRequestor::RegisterCommand ( const std::string & id,
std::function< elt::mal::future< std::string >(const std::string &)> fun )
protected

Register a new command.

Parameters
ididentifyer of the command
funfunction that executes the command using the async MAL interface

◆ SendCommandAsync()

elt::mal::future< std::string > rtctk::componentFramework::CommandRequestor::SendCommandAsync ( const std::string & id,
const std::string & args )

Send asynchronous command to a component.

Parameters
ididentifyer of the command
argscommand arguments a serialised string

◆ SendCommandSync()

std::string rtctk::componentFramework::CommandRequestor::SendCommandSync ( const std::string & id,
const std::string & args )

Send synchronous command to a component.

Parameters
ididentifyer of the command
argscommand arguments a serialised string

The documentation for this class was generated from the following files: