waterlinkedsonar
C++ client library for the Water Linked Sonar 3D-15
Loading...
Searching...
No Matches
Public Member Functions | List of all members
waterlinked::sonar::SonarClient Class Reference

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
 
SonarClientoperator= (SonarClient &&) noexcept
 
 SonarClient (const SonarClient &)=delete
 
SonarClientoperator= (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SonarClient() [1/4]

waterlinked::sonar::SonarClient::SonarClient ( std::unique_ptr< HttpTransport transport)
explicit

Fetches /about to verify connectivity and capture the firmware version.

Exceptions
VersionErrorif the firmware is older than 1.5.1, the first release with this API.

◆ SonarClient() [2/4]

waterlinked::sonar::SonarClient::SonarClient ( const std::string &  ip,
std::uint16_t  port = 80,
std::chrono::milliseconds  timeout = std::chrono::seconds(5) 
)
explicit

Connects through a CurlTransport to ip on port, with timeout per request.

◆ ~SonarClient()

waterlinked::sonar::SonarClient::~SonarClient ( )

◆ SonarClient() [3/4]

waterlinked::sonar::SonarClient::SonarClient ( SonarClient &&  )
noexcept

◆ SonarClient() [4/4]

waterlinked::sonar::SonarClient::SonarClient ( const SonarClient )
delete

Member Function Documentation

◆ about()

About waterlinked::sonar::SonarClient::about ( )

Device identity from GET /about.

◆ acoustics_enabled()

bool waterlinked::sonar::SonarClient::acoustics_enabled ( )

Whether acoustic imaging is on, from GET /acoustics/enabled.

◆ firmware_version()

const std::string & waterlinked::sonar::SonarClient::firmware_version ( ) const
inline

Firmware version captured at construction, e.g. "1.8.0".

◆ force_sync_ntp()

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.

Parameters
timeoutDevice-side sync timeout; the HTTP request is held open slightly longer.
Returns
Whether the sync completed, plus the resulting time status.
Exceptions
ForceSyncOngoingErrorif another force-sync is running.

◆ imu_batch_enabled()

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.

◆ mode()

AcousticsMode waterlinked::sonar::SonarClient::mode ( )

Imaging mode from GET /acoustics/mode. Firmware 1.7.0 or newer.

◆ ntp_address()

std::string waterlinked::sonar::SonarClient::ntp_address ( )

NTP server address from GET /time/ntp. Firmware 1.7.1 or newer.

◆ operator=() [1/2]

SonarClient & waterlinked::sonar::SonarClient::operator= ( const SonarClient )
delete

◆ operator=() [2/2]

SonarClient & waterlinked::sonar::SonarClient::operator= ( SonarClient &&  )
noexcept

◆ range()

Range waterlinked::sonar::SonarClient::range ( )

Imaging range limits in meters from GET /acoustics/range.

◆ salinity()

Salinity waterlinked::sonar::SonarClient::salinity ( )

Water salinity from GET /acoustics/salinity. Firmware 1.7.0 or newer.

◆ set_acoustics_enabled()

void waterlinked::sonar::SonarClient::set_acoustics_enabled ( bool  enabled)

Turns acoustic imaging on or off via POST /acoustics/enabled.

◆ set_imu_batch_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.

◆ set_mode()

void waterlinked::sonar::SonarClient::set_mode ( AcousticsMode  mode)

Sets the imaging mode via POST /acoustics/mode. Firmware 1.7.0 or newer.

◆ set_ntp_address()

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.

◆ set_range()

void waterlinked::sonar::SonarClient::set_range ( Range  range)

Sets imaging range limits via POST /acoustics/range.

◆ set_salinity()

void waterlinked::sonar::SonarClient::set_salinity ( Salinity  salinity)

Sets the water salinity via POST /acoustics/salinity.

Firmware 1.7.0 or newer.

◆ set_speed_of_sound()

void waterlinked::sonar::SonarClient::set_speed_of_sound ( double  speed)

Sets the speed of sound via POST /acoustics/speed_of_sound.

Parameters
speedm/s; 0.0 enables automatic calculation from salinity and temperature.

◆ set_time_manual()

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.

Parameters
nowTime to set.
Exceptions
TimeAlreadySynchronizedErrorif the device is NTP-synchronized.

◆ set_udp_config()

void waterlinked::sonar::SonarClient::set_udp_config ( const UdpConfig config)

Sets UDP configuration via POST /udp.

◆ speed_of_sound()

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()

Status waterlinked::sonar::SonarClient::status ( )

Subsystem health from GET /status.

Firmware 1.7.0 or newer; time entry present from 1.7.1.

◆ temperature()

double waterlinked::sonar::SonarClient::temperature ( )

Water temperature at the sonar in degrees Celsius.

◆ time_status()

TimeStatus waterlinked::sonar::SonarClient::time_status ( )

Device clock state from GET /time/status. Firmware 1.7.1 or newer.

◆ udp_config()

UdpConfig waterlinked::sonar::SonarClient::udp_config ( )

UDP configuration from GET /udp.


The documentation for this class was generated from the following file: