waterlinkedsonar
C++ client library for the Water Linked Sonar 3D-15
Loading...
Searching...
No Matches
curl_transport.hpp
Go to the documentation of this file.
1
3
4#ifndef WATERLINKEDSONAR_CURL_TRANSPORT_HPP
5#define WATERLINKEDSONAR_CURL_TRANSPORT_HPP
6
7#include <chrono>
8#include <cstdint>
9#include <memory>
10#include <optional>
11#include <string>
13
14namespace waterlinked::sonar {
15
17class CurlTransport final : public HttpTransport {
18 public:
22 CurlTransport(const std::string& ip, std::uint16_t port,
23 std::chrono::milliseconds timeout);
24 ~CurlTransport() override;
25
26 CurlTransport(const CurlTransport&) = delete;
28
29 Response get(const std::string& path) override;
30 Response post(const std::string& path, const std::string& json_body,
31 std::optional<std::chrono::milliseconds> timeout_override =
32 std::nullopt) override;
33
34 private:
35 struct Impl;
36 std::unique_ptr<Impl> impl_;
37};
38
39} // namespace waterlinked::sonar
40
41#endif // WATERLINKEDSONAR_CURL_TRANSPORT_HPP
libcurl easy-interface transport: one handle, blocking, not thread-safe.
Definition curl_transport.hpp:17
Response get(const std::string &path) override
Issues a GET request to the given path.
CurlTransport(const CurlTransport &)=delete
CurlTransport(const std::string &ip, std::uint16_t port, std::chrono::milliseconds timeout)
Connects to ip on port; each request times out after timeout.
Response post(const std::string &path, const std::string &json_body, std::optional< std::chrono::milliseconds > timeout_override=std::nullopt) override
Issues a POST request with a JSON body.
CurlTransport & operator=(const CurlTransport &)=delete
Blocking HTTP transport.
Definition http_transport.hpp:17
Blocking HTTP transport interface for the Sonar 3D-15 API.
Definition client.hpp:14
Definition http_transport.hpp:19