RMW desert 1.0
Loading...
Searching...
No Matches
DesertClient.h
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (C) 2024 Davide Costa *
3 * *
4 * This file is part of RMW desert. *
5 * *
6 * RMW desert is free software: you can redistribute it and/or modify it *
7 * under the terms of the GNU General Public License as published by the *
8 * Free Software Foundation, either version 3 of the License, or any *
9 * later version. *
10 * *
11 * RMW desert is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with RMW desert. If not, see <http://www.gnu.org/licenses/>. *
18 ****************************************************************************/
19
33#ifndef DESERT_CLIENT_H_
34#define DESERT_CLIENT_H_
35
38#include "rosidl_typesupport_introspection_cpp/identifier.hpp"
39#include "rosidl_typesupport_introspection_c/identifier.h"
40#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
41#include "rosidl_typesupport_introspection_c/message_introspection.h"
42#include "rosidl_typesupport_introspection_cpp/service_introspection.hpp"
43#include "rosidl_typesupport_introspection_c/service_introspection.h"
44#include "rosidl_typesupport_introspection_cpp/field_types.hpp"
45#include "rosidl_typesupport_introspection_c/field_types.h"
46
47#include "rosidl_runtime_c/service_type_support_struct.h"
48
49#include "rmw/types.h"
50
51#include <vector>
52#include <string>
53#include <regex>
54
57#include "CBorStream.h"
59
61{
62 public:
70 DesertClient(std::string service_name, const rosidl_service_type_support_t * type_supports, rmw_gid_t gid);
71
81 bool has_data();
92 void send_request(const void * req, int64_t * sequence_id);
103 void read_response(void * res, rmw_service_info_t * req_header);
104
112 rmw_gid_t get_gid();
120 std::string get_service_name();
128 std::string get_request_type_name();
136 std::string get_response_type_name();
137
138
139 private:
140 uint8_t _id;
141 rmw_gid_t _gid;
142 std::string _name;
143 cbor::TxStream _request_data_stream;
144 cbor::RxStream _response_data_stream;
145
146 int64_t _sequence_id;
147
148 int _c_cpp_identifier;
149 const void * _service;
150
151 const void * get_service(const rosidl_service_type_support_t * service_type_support);
152 const rosidl_service_type_support_t * get_service_type_support(const rosidl_service_type_support_t * type_supports);
153
154};
155
156#endif
Classes used to convert data types into a CBOR encoded stream.
Namespace containing serialization functions.
Definition DesertClient.h:61
std::string get_response_type_name()
Retreive the response type of the current entity.
Definition DesertClient.cpp:94
void send_request(const void *req, int64_t *sequence_id)
Send a request to the service.
Definition DesertClient.cpp:38
void read_response(void *res, rmw_service_info_t *req_header)
Read a response from the service.
Definition DesertClient.cpp:20
rmw_gid_t get_gid()
Retreive the gid of the current entity.
Definition DesertClient.cpp:61
std::string get_request_type_name()
Retreive the request type of the current entity.
Definition DesertClient.cpp:71
bool has_data()
Check if there is available data for the current client instance.
Definition DesertClient.cpp:14
std::string get_service_name()
Retreive the service name of the current entity.
Definition DesertClient.cpp:66
Definition CBorStream.h:244
Definition CBorStream.h:87