4#ifndef WATERLINKEDSONAR_HTTP_CLIENT_HPP
5#define WATERLINKEDSONAR_HTTP_CLIENT_HPP
14namespace waterlinked::sonar {
17inline constexpr const char*
DEFAULT_IP =
"192.168.194.96";
43 const std::string& host, std::uint16_t port = 80,
44 std::chrono::milliseconds timeout = std::chrono::seconds(5));
58 return firmware_version_;
138 void require_firmware(
const char* operation,
const char* min_version)
const;
140 std::unique_ptr<detail::HttpTransport> transport_;
141 std::string firmware_version_;
Blocking client for the integration API (https://docs.waterlinked.com/sonar-3d/sonar-3d-15-api/).
Definition client.hpp:31
ForceSyncResult force_sync_ntp(std::chrono::duration< double > timeout)
Makes the device sync its clock with the NTP server and waits for the outcome.
void set_imu_batch_enabled(bool enabled)
Turns IMU batch output on or off. Requires firmware 1.8.0.
void set_mode(AcousticsMode mode)
Sets the imaging mode. Requires firmware 1.7.0.
Status status()
Subsystem health. Requires firmware 1.7.0.
Range range()
Imaging range limits.
SonarClient(SonarClient &&other) noexcept
Takes over the connection of other, which may only be destroyed or assigned to afterwards.
UdpConfig udp_config()
Destination of the UDP stream.
void set_ntp_address(const std::string &address)
Sets the NTP server address, or "auto". Requires firmware 1.7.1.
TimeStatus time_status()
State of the device clock. Requires firmware 1.7.1.
void set_salinity(Salinity salinity)
Sets the water salinity. Requires firmware 1.7.0.
double temperature()
Water temperature at the sonar in degrees Celsius.
std::string ntp_address()
NTP server address, or "auto". Requires firmware 1.7.1.
void set_time_manual(std::chrono::system_clock::time_point time)
Sets the device clock, rounded down to microseconds.
~SonarClient()
Closes the connection.
SonarClient(const std::string &host, std::uint16_t port=80, std::chrono::milliseconds timeout=std::chrono::seconds(5))
Connects to the sonar and reads its firmware version.
void set_udp_config(const UdpConfig &config)
Sets the destination of the UDP stream.
void set_speed_of_sound(double speed)
Sets the speed of sound in m/s; 0 derives it from salinity and temperature.
About about()
Device identity.
SonarClient & operator=(SonarClient &&other) noexcept
Same as the move constructor.
AcousticsMode mode()
Imaging mode. Requires firmware 1.7.0.
void set_acoustics_enabled(bool enabled)
Turns acoustic imaging on or off.
void set_range(Range range)
Sets the imaging range limits.
const std::string & firmware_version() const noexcept
Firmware release read at construction, e.g. "1.8.0".
Definition client.hpp:57
bool acoustics_enabled()
Whether acoustic imaging is on.
Salinity salinity()
Water salinity. Requires firmware 1.7.0.
double speed_of_sound()
Speed of sound in m/s; 0 means the sonar derives it from salinity and temperature.
bool imu_batch_enabled()
Whether IMU batches are sent. Requires firmware 1.8.0.
constexpr const char * DEFAULT_IP
Factory default IP address of the sonar.
Definition client.hpp:17
Exceptions thrown by SonarClient.
Device identity.
Definition types.hpp:15
Outcome of a forced NTP sync.
Definition types.hpp:84
Imaging range limits in meters.
Definition types.hpp:55
Health of the device subsystems.
Definition types.hpp:35
State of the device clock.
Definition types.hpp:75
Destination of the sonar's UDP stream.
Definition types.hpp:61
Data types of the Sonar 3D-15 HTTP API.
AcousticsMode
Imaging mode, which sets the field of view and the image rate.
Definition types.hpp:43
Salinity
Water salinity used by the automatic speed of sound.
Definition types.hpp:49