|
waterlinkedsonar
C++ client library for the Water Linked Sonar 3D-15
|
Blocking client for the integration API (https://docs.waterlinked.com/sonar-3d/sonar-3d-15-api/). More...
#include <waterlinkedsonar/http/client.hpp>
Public Member Functions | |
| 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. | |
| ~SonarClient () | |
| Closes the connection. | |
| SonarClient (SonarClient &&other) noexcept | |
Takes over the connection of other, which may only be destroyed or assigned to afterwards. | |
| SonarClient & | operator= (SonarClient &&other) noexcept |
| Same as the move constructor. | |
| SonarClient (const SonarClient &)=delete | |
| SonarClient & | operator= (const SonarClient &)=delete |
| const std::string & | firmware_version () const noexcept |
| Firmware release read at construction, e.g. "1.8.0". | |
| About | about () |
| Device identity. | |
| Status | status () |
| Subsystem health. Requires firmware 1.7.0. | |
| double | temperature () |
| Water temperature at the sonar in degrees Celsius. | |
| bool | acoustics_enabled () |
| Whether acoustic imaging is on. | |
| void | set_acoustics_enabled (bool enabled) |
| Turns acoustic imaging on or off. | |
| Range | range () |
| Imaging range limits. | |
| void | set_range (Range range) |
| Sets the imaging range limits. | |
| double | speed_of_sound () |
| Speed of sound in m/s; 0 means the sonar derives it from salinity and temperature. | |
| void | set_speed_of_sound (double speed) |
| Sets the speed of sound in m/s; 0 derives it from salinity and temperature. | |
| AcousticsMode | mode () |
| Imaging mode. Requires firmware 1.7.0. | |
| void | set_mode (AcousticsMode mode) |
| Sets the imaging mode. Requires firmware 1.7.0. | |
| Salinity | salinity () |
| Water salinity. Requires firmware 1.7.0. | |
| void | set_salinity (Salinity salinity) |
| Sets the water salinity. Requires firmware 1.7.0. | |
| UdpConfig | udp_config () |
| Destination of the UDP stream. | |
| void | set_udp_config (const UdpConfig &config) |
| Sets the destination of the UDP stream. | |
| bool | imu_batch_enabled () |
| Whether IMU batches are sent. Requires firmware 1.8.0. | |
| void | set_imu_batch_enabled (bool enabled) |
| Turns IMU batch output on or off. Requires firmware 1.8.0. | |
| TimeStatus | time_status () |
| State of the device clock. Requires firmware 1.7.1. | |
| void | set_time_manual (std::chrono::system_clock::time_point time) |
| Sets the device clock, rounded down to microseconds. | |
| std::string | ntp_address () |
| NTP server address, or "auto". Requires firmware 1.7.1. | |
| void | set_ntp_address (const std::string &address) |
| Sets the NTP server address, or "auto". Requires firmware 1.7.1. | |
| ForceSyncResult | force_sync_ntp (std::chrono::duration< double > timeout) |
| Makes the device sync its clock with the NTP server and waits for the outcome. | |
Blocking client for the integration API (https://docs.waterlinked.com/sonar-3d/sonar-3d-15-api/).
Not thread-safe. Every method that contacts the device throws HttpError when a request fails or the device answers with a non-2xx status, and ProtocolError when the response body does not match the API. Methods that need newer firmware than the device runs throw VersionError without contacting the device.
|
explicit |
Connects to the sonar and reads its firmware version.
| host | IP address or hostname of the sonar. |
| port | Port of the HTTP API. |
| timeout | Limit for each request. |
| HttpError | if the request fails or returns a non-2xx status. |
| ProtocolError | if the response does not match the API or the firmware version is not "major.minor.patch". |
| VersionError | if the firmware is older than 1.5.1. |
| ForceSyncResult waterlinked::sonar::SonarClient::force_sync_ntp | ( | std::chrono::duration< double > | timeout | ) |
Makes the device sync its clock with the NTP server and waits for the outcome.
Requires firmware 1.7.1.
| timeout | Time the device spends on the sync. The request is allowed this much longer than the client's request timeout. |
| ForceSyncOngoingError | if another force-sync is running. |
| void waterlinked::sonar::SonarClient::set_time_manual | ( | std::chrono::system_clock::time_point | time | ) |
Sets the device clock, rounded down to microseconds.
Requires firmware 1.7.1.
| TimeAlreadySynchronizedError | if the clock is NTP-synchronized. |