Skip to content

Commit

Permalink
commit auto-generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
potaito committed Jan 25, 2023
1 parent 86a9f5d commit 24a2abe
Show file tree
Hide file tree
Showing 15 changed files with 8,141 additions and 2,023 deletions.
Binary file removed build/default/src/mavsdk_server/src/mavsdk_server
Binary file not shown.
82 changes: 82 additions & 0 deletions src/mavsdk/plugins/telemetry/include/plugins/telemetry/telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,44 @@ class Telemetry : public PluginBase {
*/
friend std::ostream& operator<<(std::ostream& str, Telemetry::RcStatus const& rc_status);

/**
* @brief Cellular modem status type.
*/
struct CellularStatus {
uint32_t id{}; /**< @brief (actually uint8_t) */
uint32_t status{}; /**< @brief (actually uint8_t) */
uint32_t failure_reason{}; /**< @brief (actually uint8_t) */
uint32_t type{}; /**< @brief(actually uint8_t) */
uint32_t quality{}; /**< @brief Signal strength */
uint32_t mcc{}; /**< @brief (actually uint16_t) */
uint32_t mnc{}; /**< @brief (actually uint16_t) */
uint32_t lac{}; /**< @brief (actually uint16_t) */
uint32_t slot_number{}; /**< @brief(actually uint8_t) */
uint32_t rx_level{}; /**< @brief(actually uint8_t) */
uint32_t signal_to_noise{}; /**< @brief(actually uint8_t) */
uint32_t band_number{}; /**< @brief(actually uint8_t) */
uint32_t arfcn{}; /**< @brief */
std::string cell_id{}; /**< @brief char[9] */
float download_rate{}; /**< @brief */
float upload_rate{}; /**< @brief */
};

/**
* @brief Equal operator to compare two `Telemetry::CellularStatus` objects.
*
* @return `true` if items are equal.
*/
friend bool
operator==(const Telemetry::CellularStatus& lhs, const Telemetry::CellularStatus& rhs);

/**
* @brief Stream operator to print information about a `Telemetry::CellularStatus`.
*
* @return A reference to the stream.
*/
friend std::ostream&
operator<<(std::ostream& str, Telemetry::CellularStatus const& cellular_status);

/**
* @brief StatusText information type.
*/
Expand Down Expand Up @@ -1503,6 +1541,33 @@ class Telemetry : public PluginBase {
*/
RcStatus rc_status() const;

/**
* @brief Callback type for subscribe_cellular_status.
*/
using CellularStatusCallback = std::function<void(CellularStatus)>;

/**
* @brief Handle type for subscribe_cellular_status.
*/
using CellularStatusHandle = Handle<CellularStatus>;

/**
* @brief Subscribe to 'Cellular status' updates.
*/
CellularStatusHandle subscribe_cellular_status(const CellularStatusCallback& callback);

/**
* @brief Unsubscribe from subscribe_cellular_status
*/
void unsubscribe_cellular_status(CellularStatusHandle handle);

/**
* @brief Poll for 'CellularStatus' (blocking).
*
* @return One CellularStatus update.
*/
CellularStatus cellular_status() const;

/**
* @brief Callback type for subscribe_status_text.
*/
Expand Down Expand Up @@ -2136,6 +2201,23 @@ class Telemetry : public PluginBase {
*/
Result set_rate_rc_status(double rate_hz) const;

/**
* @brief Set rate to 'Cellular status' updates.
*
* This function is non-blocking. See 'set_rate_cellular_status' for the blocking counterpart.
*/
void set_rate_cellular_status_async(double rate_hz, const ResultCallback callback);

/**
* @brief Set rate to 'Cellular status' updates.
*
* This function is blocking. See 'set_rate_cellular_status_async' for the non-blocking
* counterpart.
*
* @return Result of request.
*/
Result set_rate_cellular_status(double rate_hz) const;

/**
* @brief Set rate to 'actuator control target' updates.
*
Expand Down
66 changes: 66 additions & 0 deletions src/mavsdk/plugins/telemetry/telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using RawGps = Telemetry::RawGps;
using Battery = Telemetry::Battery;
using Health = Telemetry::Health;
using RcStatus = Telemetry::RcStatus;
using CellularStatus = Telemetry::CellularStatus;
using StatusText = Telemetry::StatusText;
using ActuatorControlTarget = Telemetry::ActuatorControlTarget;
using ActuatorOutputStatus = Telemetry::ActuatorOutputStatus;
Expand Down Expand Up @@ -325,6 +326,22 @@ Telemetry::RcStatus Telemetry::rc_status() const
return _impl->rc_status();
}

Telemetry::CellularStatusHandle
Telemetry::subscribe_cellular_status(const CellularStatusCallback& callback)
{
return _impl->subscribe_cellular_status(callback);
}

void Telemetry::unsubscribe_cellular_status(CellularStatusHandle handle)
{
_impl->unsubscribe_cellular_status(handle);
}

Telemetry::CellularStatus Telemetry::cellular_status() const
{
return _impl->cellular_status();
}

Telemetry::StatusTextHandle Telemetry::subscribe_status_text(const StatusTextCallback& callback)
{
return _impl->subscribe_status_text(callback);
Expand Down Expand Up @@ -692,6 +709,16 @@ Telemetry::Result Telemetry::set_rate_rc_status(double rate_hz) const
return _impl->set_rate_rc_status(rate_hz);
}

void Telemetry::set_rate_cellular_status_async(double rate_hz, const ResultCallback callback)
{
_impl->set_rate_cellular_status_async(rate_hz, callback);
}

Telemetry::Result Telemetry::set_rate_cellular_status(double rate_hz) const
{
return _impl->set_rate_cellular_status(rate_hz);
}

void Telemetry::set_rate_actuator_control_target_async(
double rate_hz, const ResultCallback callback)
{
Expand Down Expand Up @@ -1062,6 +1089,45 @@ std::ostream& operator<<(std::ostream& str, Telemetry::RcStatus const& rc_status
return str;
}

bool operator==(const Telemetry::CellularStatus& lhs, const Telemetry::CellularStatus& rhs)
{
return (rhs.id == lhs.id) && (rhs.status == lhs.status) &&
(rhs.failure_reason == lhs.failure_reason) && (rhs.type == lhs.type) &&
(rhs.quality == lhs.quality) && (rhs.mcc == lhs.mcc) && (rhs.mnc == lhs.mnc) &&
(rhs.lac == lhs.lac) && (rhs.slot_number == lhs.slot_number) &&
(rhs.rx_level == lhs.rx_level) && (rhs.signal_to_noise == lhs.signal_to_noise) &&
(rhs.band_number == lhs.band_number) && (rhs.arfcn == lhs.arfcn) &&
(rhs.cell_id == lhs.cell_id) &&
((std::isnan(rhs.download_rate) && std::isnan(lhs.download_rate)) ||
rhs.download_rate == lhs.download_rate) &&
((std::isnan(rhs.upload_rate) && std::isnan(lhs.upload_rate)) ||
rhs.upload_rate == lhs.upload_rate);
}

std::ostream& operator<<(std::ostream& str, Telemetry::CellularStatus const& cellular_status)
{
str << std::setprecision(15);
str << "cellular_status:" << '\n' << "{\n";
str << " id: " << cellular_status.id << '\n';
str << " status: " << cellular_status.status << '\n';
str << " failure_reason: " << cellular_status.failure_reason << '\n';
str << " type: " << cellular_status.type << '\n';
str << " quality: " << cellular_status.quality << '\n';
str << " mcc: " << cellular_status.mcc << '\n';
str << " mnc: " << cellular_status.mnc << '\n';
str << " lac: " << cellular_status.lac << '\n';
str << " slot_number: " << cellular_status.slot_number << '\n';
str << " rx_level: " << cellular_status.rx_level << '\n';
str << " signal_to_noise: " << cellular_status.signal_to_noise << '\n';
str << " band_number: " << cellular_status.band_number << '\n';
str << " arfcn: " << cellular_status.arfcn << '\n';
str << " cell_id: " << cellular_status.cell_id << '\n';
str << " download_rate: " << cellular_status.download_rate << '\n';
str << " upload_rate: " << cellular_status.upload_rate << '\n';
str << '}';
return str;
}

bool operator==(const Telemetry::StatusText& lhs, const Telemetry::StatusText& rhs)
{
return (rhs.type == lhs.type) && (rhs.text == lhs.text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,44 @@ class TelemetryServer : public ServerPluginBase {
*/
friend std::ostream& operator<<(std::ostream& str, TelemetryServer::RcStatus const& rc_status);

/**
* @brief Cellular modem status type.
*/
struct CellularStatus {
uint32_t id{}; /**< @brief (actually uint8_t) */
uint32_t status{}; /**< @brief (actually uint8_t) */
uint32_t failure_reason{}; /**< @brief (actually uint8_t) */
uint32_t type{}; /**< @brief(actually uint8_t) */
uint32_t quality{}; /**< @brief Signal strength */
uint32_t mcc{}; /**< @brief (actually uint16_t) */
uint32_t mnc{}; /**< @brief (actually uint16_t) */
uint32_t lac{}; /**< @brief (actually uint16_t) */
uint32_t slot_number{}; /**< @brief(actually uint8_t) */
uint32_t rx_level{}; /**< @brief(actually uint8_t) */
uint32_t signal_to_noise{}; /**< @brief(actually uint8_t) */
uint32_t band_number{}; /**< @brief(actually uint8_t) */
uint32_t arfcn{}; /**< @brief */
std::string cell_id{}; /**< @brief char[9] */
float download_rate{}; /**< @brief */
float upload_rate{}; /**< @brief */
};

/**
* @brief Equal operator to compare two `TelemetryServer::CellularStatus` objects.
*
* @return `true` if items are equal.
*/
friend bool operator==(
const TelemetryServer::CellularStatus& lhs, const TelemetryServer::CellularStatus& rhs);

/**
* @brief Stream operator to print information about a `TelemetryServer::CellularStatus`.
*
* @return A reference to the stream.
*/
friend std::ostream&
operator<<(std::ostream& str, TelemetryServer::CellularStatus const& cellular_status);

/**
* @brief StatusText information type.
*/
Expand Down Expand Up @@ -971,6 +1009,15 @@ class TelemetryServer : public ServerPluginBase {
*/
Result publish_battery(Battery battery) const;

/**
* @brief Publish to 'cellular_status' updates.
*
* This function is blocking.
*
* @return Result of request.
*/
Result publish_cellular_status(CellularStatus cellular_status) const;

/**
* @brief Publish to 'status text' updates.
*
Expand Down
36 changes: 26 additions & 10 deletions src/mavsdk/plugins/telemetry_server/telemetry_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ TelemetryServer::Result TelemetryServer::publish_battery(Battery battery) const
return _impl->publish_battery(battery);
}

TelemetryServer::Result
TelemetryServer::publish_cellular_status(CellularStatus cellular_status) const
{
return _impl->publish_cellular_status(cellular_status);
}

TelemetryServer::Result TelemetryServer::publish_status_text(StatusText status_text) const
{
return _impl->publish_status_text(status_text);
Expand Down Expand Up @@ -340,29 +346,39 @@ std::ostream& operator<<(std::ostream& str, TelemetryServer::RcStatus const& rc_
bool operator==(
const TelemetryServer::CellularStatus& lhs, const TelemetryServer::CellularStatus& rhs)
{
return (rhs.status == lhs.status) && (rhs.failure_reason == lhs.failure_reason) &&
(rhs.type == lhs.type) && (rhs.quality == lhs.quality) && (rhs.mcc == lhs.mcc) &&
(rhs.mnc == lhs.mnc) && (rhs.lac == lhs.lac) &&
((std::isnan(rhs.signal_strength_percent) && std::isnan(lhs.signal_strength_percent)) ||
rhs.signal_strength_percent == lhs.signal_strength_percent) &&
(rhs.is_available == lhs.is_available) &&
(rhs.was_available_once == lhs.was_available_once);
return (rhs.id == lhs.id) && (rhs.status == lhs.status) &&
(rhs.failure_reason == lhs.failure_reason) && (rhs.type == lhs.type) &&
(rhs.quality == lhs.quality) && (rhs.mcc == lhs.mcc) && (rhs.mnc == lhs.mnc) &&
(rhs.lac == lhs.lac) && (rhs.slot_number == lhs.slot_number) &&
(rhs.rx_level == lhs.rx_level) && (rhs.signal_to_noise == lhs.signal_to_noise) &&
(rhs.band_number == lhs.band_number) && (rhs.arfcn == lhs.arfcn) &&
(rhs.cell_id == lhs.cell_id) &&
((std::isnan(rhs.download_rate) && std::isnan(lhs.download_rate)) ||
rhs.download_rate == lhs.download_rate) &&
((std::isnan(rhs.upload_rate) && std::isnan(lhs.upload_rate)) ||
rhs.upload_rate == lhs.upload_rate);
}

std::ostream& operator<<(std::ostream& str, TelemetryServer::CellularStatus const& cellular_status)
{
str << std::setprecision(15);
str << "cellular_status:" << '\n' << "{\n";
str << " id: " << cellular_status.id << '\n';
str << " status: " << cellular_status.status << '\n';
str << " failure_reason: " << cellular_status.failure_reason << '\n';
str << " type: " << cellular_status.type << '\n';
str << " quality: " << cellular_status.quality << '\n';
str << " mcc: " << cellular_status.mcc << '\n';
str << " mnc: " << cellular_status.mnc << '\n';
str << " lac: " << cellular_status.lac << '\n';
str << " signal_strength_percent: " << cellular_status.signal_strength_percent << '\n';
str << " is_available: " << cellular_status.is_available << '\n';
str << " was_available_once: " << cellular_status.was_available_once << '\n';
str << " slot_number: " << cellular_status.slot_number << '\n';
str << " rx_level: " << cellular_status.rx_level << '\n';
str << " signal_to_noise: " << cellular_status.signal_to_noise << '\n';
str << " band_number: " << cellular_status.band_number << '\n';
str << " arfcn: " << cellular_status.arfcn << '\n';
str << " cell_id: " << cellular_status.cell_id << '\n';
str << " download_rate: " << cellular_status.download_rate << '\n';
str << " upload_rate: " << cellular_status.upload_rate << '\n';
str << '}';
return str;
}
Expand Down
Loading

0 comments on commit 24a2abe

Please sign in to comment.