RMW desert 1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
DesertService Class Reference

Public Member Functions

 DesertService (std::string service_name, const rosidl_service_type_support_t *type_supports, rmw_gid_t gid)
 Create a service.
 
bool has_data ()
 Check if there is available data for the current service instance.
 
void read_request (void *req, rmw_service_info_t *req_header)
 Read a request from a client.
 
void send_response (void *res, rmw_request_id_t *req_header)
 Send the response to a client.
 
rmw_gid_t get_gid ()
 Retreive the gid of the current entity.
 
std::string get_service_name ()
 Retreive the service name of the current entity.
 
std::string get_request_type_name ()
 Retreive the request type of the current entity.
 
std::string get_response_type_name ()
 Retreive the response type of the current entity.
 

Constructor & Destructor Documentation

◆ DesertService()

DesertService::DesertService ( std::string  service_name,
const rosidl_service_type_support_t *  type_supports,
rmw_gid_t  gid 
)

Create a service.

Parameters
service_nameName of the service to receive requests and send responses
type_supportsPointer to the message data structure coming from the ROS upper layers
gidGlobal identifier of the entity

Member Function Documentation

◆ get_gid()

rmw_gid_t DesertService::get_gid ( )

Retreive the gid of the current entity.

This function returns the global identifier of the current entity in the rmw format.

Returns
Global identifier of the entity

◆ get_request_type_name()

std::string DesertService::get_request_type_name ( )

Retreive the request type of the current entity.

This function returns a string containing the service request type name of the current entity.

Returns
Type of the service request

◆ get_response_type_name()

std::string DesertService::get_response_type_name ( )

Retreive the response type of the current entity.

This function returns a string containing the service response type name of the current entity.

Returns
Type of the service response

◆ get_service_name()

std::string DesertService::get_service_name ( )

Retreive the service name of the current entity.

This function returns a string containing the service name of the current entity.

Returns
Name of the service

◆ has_data()

bool DesertService::has_data ( )

Check if there is available data for the current service instance.

The has_data function calls the interpret_packets method in RxStream and then verifies if in the map of service packets there is a correspondence with the service name of the current instance.

Returns
True if data is present otherwise false

◆ read_request()

void DesertService::read_request ( void *  req,
rmw_service_info_t *  req_header 
)

Read a request from a client.

The read_request function interprets a transmission with the service name in the current instance deserializing the message using the method from the MessageSerialization namespace. A discrimination is made between C members and C++ members based on the type support.

Parameters
reqPointer to the memory location used to store the request
req_headerPointer to the request header used to store the service sequence identifier

◆ send_response()

void DesertService::send_response ( void *  res,
rmw_request_id_t *  req_header 
)

Send the response to a client.

The send_response function starts a transmission with the sequence identifier in req_header and then serializes the message using the method from the MessageSerialization namespace. A discrimination is made between C members and C++ members based on the type support.

Parameters
resPointer to the response to send
req_headerPointer to the request header used to store the service sequence identifier

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