waterlinkedsonar
C++ client library for the Water Linked Sonar 3D-15
Loading...
Searching...
No Matches
client.hpp
Go to the documentation of this file.
1
3
4#ifndef WATERLINKEDSONAR_CLIENT_HPP
5#define WATERLINKEDSONAR_CLIENT_HPP
6
7#include <chrono>
8#include <cstdint>
9#include <memory>
10#include <string>
13
15
24 public:
29 explicit SonarClient(std::unique_ptr<HttpTransport> transport);
30
33 explicit SonarClient(
34 const std::string& ip, std::uint16_t port = 80,
35 std::chrono::milliseconds timeout = std::chrono::seconds(5));
36
39 SonarClient& operator=(SonarClient&&) noexcept;
40 SonarClient(const SonarClient&) = delete;
41 SonarClient& operator=(const SonarClient&) = delete;
42
44 [[nodiscard]] const std::string& firmware_version() const {
45 return firmware_version_;
46 }
47
54 double temperature();
55
59 void set_acoustics_enabled(bool enabled);
60
65
73 void set_speed_of_sound(double speed);
74
79
85
89 void set_udp_config(const UdpConfig& config);
90
96 void set_imu_batch_enabled(bool enabled);
97
100
105 void set_time_manual(std::chrono::system_clock::time_point now);
106
108 std::string ntp_address();
110 void set_ntp_address(const std::string& address);
111
119 ForceSyncResult force_sync_ntp(std::chrono::seconds timeout);
120
121 private:
122 void require_firmware(const char* what, const char* min_version) const;
123
124 std::unique_ptr<HttpTransport> transport_;
125 std::string firmware_version_;
126};
127
128} // namespace waterlinked::sonar
129
130#endif // WATERLINKEDSONAR_CLIENT_HPP
Client for the Sonar 3D-15 integration API.
Definition client.hpp:23
void set_imu_batch_enabled(bool enabled)
Turns IMU batch output on or off via POST /output/imu-batch/enabled.
SonarClient(SonarClient &&) noexcept
void set_mode(AcousticsMode mode)
Sets the imaging mode via POST /acoustics/mode. Firmware 1.7.0 or newer.
Status status()
Subsystem health from GET /status.
Range range()
Imaging range limits in meters from GET /acoustics/range.
SonarClient(const std::string &ip, std::uint16_t port=80, std::chrono::milliseconds timeout=std::chrono::seconds(5))
Connects through a CurlTransport to ip on port, with timeout per request.
UdpConfig udp_config()
UDP configuration from GET /udp.
void set_ntp_address(const std::string &address)
Sets the NTP server address via POST /time/ntp. Firmware 1.7.1 or newer.
TimeStatus time_status()
Device clock state from GET /time/status. Firmware 1.7.1 or newer.
void set_salinity(Salinity salinity)
Sets the water salinity via POST /acoustics/salinity.
double temperature()
Water temperature at the sonar in degrees Celsius.
std::string ntp_address()
NTP server address from GET /time/ntp. Firmware 1.7.1 or newer.
void set_time_manual(std::chrono::system_clock::time_point now)
Sets the device clock via POST /time/manual.
void set_udp_config(const UdpConfig &config)
Sets UDP configuration via POST /udp.
void set_speed_of_sound(double speed)
Sets the speed of sound via POST /acoustics/speed_of_sound.
About about()
Device identity from GET /about.
ForceSyncResult force_sync_ntp(std::chrono::seconds timeout)
Triggers an NTP sync and blocks up to timeout while the device attempts it via POST /time/ntp/force-s...
AcousticsMode mode()
Imaging mode from GET /acoustics/mode. Firmware 1.7.0 or newer.
void set_acoustics_enabled(bool enabled)
Turns acoustic imaging on or off via POST /acoustics/enabled.
void set_range(Range range)
Sets imaging range limits via POST /acoustics/range.
bool acoustics_enabled()
Whether acoustic imaging is on, from GET /acoustics/enabled.
Salinity salinity()
Water salinity from GET /acoustics/salinity. Firmware 1.7.0 or newer.
double speed_of_sound()
Speed of sound in m/s from GET /acoustics/speed_of_sound; 0.0 means the sonar computes it from salini...
SonarClient(std::unique_ptr< HttpTransport > transport)
Fetches /about to verify connectivity and capture the firmware version.
const std::string & firmware_version() const
Firmware version captured at construction, e.g. "1.8.0".
Definition client.hpp:44
bool imu_batch_enabled()
Whether IMU batch output is on, from GET /output/imu-batch/enabled.
Blocking HTTP transport interface for the Sonar 3D-15 API.
Definition client.hpp:14
AcousticsMode
Imaging mode: low frequency gives a 90x40 degree field of view at 5 Hz, high frequency 40x40 degrees ...
Definition types.hpp:58
Salinity
Water salinity, used by the sonar's automatic speed of sound.
Definition types.hpp:61
Device identity from GET /about.
Definition types.hpp:26
Outcome of a forced NTP sync.
Definition types.hpp:88
Imaging range limits in meters.
Definition types.hpp:64
Subsystem health from GET /status.
Definition types.hpp:48
Device clock state from GET /time/status.
Definition types.hpp:80
How the sonar streams data, from GET/POST /udp.
Definition types.hpp:70
Type definitions for the Sonar 3D-15 integration API.