|
waterlinkedsonar
C++ client library for the Water Linked Sonar 3D-15
|
Client for the Sonar 3D-15 integration API. More...
#include <waterlinkedsonar/client.hpp>
Public Member Functions | |
| SonarClient (std::unique_ptr< HttpTransport > transport) | |
| Fetches /about to verify connectivity and capture the firmware version. | |
| 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. | |
| ~SonarClient () | |
| SonarClient (SonarClient &&) noexcept | |
| SonarClient & | operator= (SonarClient &&) noexcept |
| SonarClient (const SonarClient &)=delete | |
| SonarClient & | operator= (const SonarClient &)=delete |
| const std::string & | firmware_version () const |
| Firmware version captured at construction, e.g. "1.8.0". | |
| About | about () |
| Device identity from GET /about. | |
| Status | status () |
| Subsystem health from GET /status. | |
| double | temperature () |
| Water temperature at the sonar in degrees Celsius. | |
| bool | acoustics_enabled () |
| Whether acoustic imaging is on, from GET /acoustics/enabled. | |
| void | set_acoustics_enabled (bool enabled) |
| Turns acoustic imaging on or off via POST /acoustics/enabled. | |
| Range | range () |
| Imaging range limits in meters from GET /acoustics/range. | |
| void | set_range (Range range) |
| Sets imaging range limits via POST /acoustics/range. | |
| double | speed_of_sound () |
| Speed of sound in m/s from GET /acoustics/speed_of_sound; 0.0 means the sonar computes it from salinity and temperature. | |
| void | set_speed_of_sound (double speed) |
| Sets the speed of sound via POST /acoustics/speed_of_sound. | |
| AcousticsMode | mode () |
| Imaging mode from GET /acoustics/mode. Firmware 1.7.0 or newer. | |
| void | set_mode (AcousticsMode mode) |
| Sets the imaging mode via POST /acoustics/mode. Firmware 1.7.0 or newer. | |
| Salinity | salinity () |
| Water salinity from GET /acoustics/salinity. Firmware 1.7.0 or newer. | |
| void | set_salinity (Salinity salinity) |
| Sets the water salinity via POST /acoustics/salinity. | |
| UdpConfig | udp_config () |
| UDP configuration from GET /udp. | |
| void | set_udp_config (const UdpConfig &config) |
| Sets UDP configuration via POST /udp. | |
| bool | imu_batch_enabled () |
| Whether IMU batch output is on, from GET /output/imu-batch/enabled. | |
| void | set_imu_batch_enabled (bool enabled) |
| Turns IMU batch output on or off via POST /output/imu-batch/enabled. | |
| TimeStatus | time_status () |
| Device clock state from GET /time/status. 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. | |
| std::string | ntp_address () |
| NTP server address from GET /time/ntp. Firmware 1.7.1 or newer. | |
| void | set_ntp_address (const std::string &address) |
| Sets the NTP server address via POST /time/ntp. Firmware 1.7.1 or newer. | |
| 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-sync. | |
Client for the Sonar 3D-15 integration API.
Synchronous and not thread-safe; one caller at a time. All methods throw HttpError on transport failure or unexpected HTTP status, and ProtocolError on a response body the client cannot interpret. Methods gated on firmware throw VersionError before any network traffic when the device firmware (captured at construction) is too old.
|
explicit |
Fetches /about to verify connectivity and capture the firmware version.
| VersionError | if the firmware is older than 1.5.1, the first release with this API. |
|
explicit |
Connects through a CurlTransport to ip on port, with timeout per request.
| waterlinked::sonar::SonarClient::~SonarClient | ( | ) |
|
noexcept |
|
delete |
| About waterlinked::sonar::SonarClient::about | ( | ) |
Device identity from GET /about.
| bool waterlinked::sonar::SonarClient::acoustics_enabled | ( | ) |
Whether acoustic imaging is on, from GET /acoustics/enabled.
|
inline |
Firmware version captured at construction, e.g. "1.8.0".
| ForceSyncResult waterlinked::sonar::SonarClient::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-sync.
Firmware 1.7.1 or newer.
| timeout | Device-side sync timeout; the HTTP request is held open slightly longer. |
| ForceSyncOngoingError | if another force-sync is running. |
| bool waterlinked::sonar::SonarClient::imu_batch_enabled | ( | ) |
Whether IMU batch output is on, from GET /output/imu-batch/enabled.
Firmware 1.8.0 or newer.
| AcousticsMode waterlinked::sonar::SonarClient::mode | ( | ) |
Imaging mode from GET /acoustics/mode. Firmware 1.7.0 or newer.
| std::string waterlinked::sonar::SonarClient::ntp_address | ( | ) |
NTP server address from GET /time/ntp. Firmware 1.7.1 or newer.
|
delete |
|
noexcept |
| Range waterlinked::sonar::SonarClient::range | ( | ) |
Imaging range limits in meters from GET /acoustics/range.
| Salinity waterlinked::sonar::SonarClient::salinity | ( | ) |
Water salinity from GET /acoustics/salinity. Firmware 1.7.0 or newer.
| void waterlinked::sonar::SonarClient::set_acoustics_enabled | ( | bool | enabled | ) |
Turns acoustic imaging on or off via POST /acoustics/enabled.
| void waterlinked::sonar::SonarClient::set_imu_batch_enabled | ( | bool | enabled | ) |
Turns IMU batch output on or off via POST /output/imu-batch/enabled.
Firmware 1.8.0 or newer.
| void waterlinked::sonar::SonarClient::set_mode | ( | AcousticsMode | mode | ) |
Sets the imaging mode via POST /acoustics/mode. Firmware 1.7.0 or newer.
| void waterlinked::sonar::SonarClient::set_ntp_address | ( | const std::string & | address | ) |
Sets the NTP server address via POST /time/ntp. Firmware 1.7.1 or newer.
| void waterlinked::sonar::SonarClient::set_range | ( | Range | range | ) |
Sets imaging range limits via POST /acoustics/range.
| void waterlinked::sonar::SonarClient::set_salinity | ( | Salinity | salinity | ) |
Sets the water salinity via POST /acoustics/salinity.
Firmware 1.7.0 or newer.
| void waterlinked::sonar::SonarClient::set_speed_of_sound | ( | double | speed | ) |
Sets the speed of sound via POST /acoustics/speed_of_sound.
| speed | m/s; 0.0 enables automatic calculation from salinity and temperature. |
| void waterlinked::sonar::SonarClient::set_time_manual | ( | std::chrono::system_clock::time_point | now | ) |
Sets the device clock via POST /time/manual.
Firmware 1.7.1 or newer.
| now | Time to set. |
| TimeAlreadySynchronizedError | if the device is NTP-synchronized. |
| void waterlinked::sonar::SonarClient::set_udp_config | ( | const UdpConfig & | config | ) |
Sets UDP configuration via POST /udp.
| double waterlinked::sonar::SonarClient::speed_of_sound | ( | ) |
Speed of sound in m/s from GET /acoustics/speed_of_sound; 0.0 means the sonar computes it from salinity and temperature.
| Status waterlinked::sonar::SonarClient::status | ( | ) |
Subsystem health from GET /status.
Firmware 1.7.0 or newer; time entry present from 1.7.1.
| double waterlinked::sonar::SonarClient::temperature | ( | ) |
Water temperature at the sonar in degrees Celsius.
| TimeStatus waterlinked::sonar::SonarClient::time_status | ( | ) |
Device clock state from GET /time/status. Firmware 1.7.1 or newer.
| UdpConfig waterlinked::sonar::SonarClient::udp_config | ( | ) |
UDP configuration from GET /udp.