Skip to content

Commit

Permalink
wip add nic_info msg, update cellular_status
Browse files Browse the repository at this point in the history
  • Loading branch information
asimopunov committed Jan 27, 2023
1 parent 096a284 commit 21784b5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/mavsdk/plugins/telemetry/telemetry_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ void TelemetryImpl::process_cellular_status(const mavlink_message_t& message)
mavlink_msg_cellular_status_decode(&message, &cell_status);

Telemetry::CellularStatus new_cell_status;
new_cell_status.id = cell_status.id;
new_cell_status.instance_number = cell_status.id;
new_cell_status.status = cell_status.status;
new_cell_status.failure_reason = cell_status.failure_reason;
new_cell_status.type = cell_status.type;
Expand All @@ -1273,6 +1273,18 @@ void TelemetryImpl::process_cellular_status(const mavlink_message_t& message)
new_cell_status.mnc = cell_status.mnc;
new_cell_status.lac = cell_status.lac;

new_cell_status.download_rate = cell_status.download_rate;
new_cell_status.upload_rate = cell_status.upload_rate;
new_cell_status.bit_error_rate = cell_status.ber;
new_cell_status.rx_level = cell_status.rx_level;
new_cell_status.tx_level = cell_status.tx_level;
new_cell_status.signal_to_noise = cell_status.signal_to_noise;
new_cell_status.cell_tower_id = cell_status.cell_tower_id;
new_cell_status.band_number = cell_status.band_number;
new_cell_status.band_frequency = cell_status.band_frequency;
new_cell_status.arfcn = cell_status.arfcn;


set_cellular_status(new_cell_status);

{
Expand Down
27 changes: 26 additions & 1 deletion src/mavsdk/plugins/telemetry_server/telemetry_server_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ TelemetryServerImpl::publish_cellular_status(TelemetryServer::CellularStatus cel
static_cast<uint8_t>(cellular_status.instance_number),
cellular_status.download_rate,
cellular_status.upload_rate,
cellular_status.ber,
cellular_status.bit_error_rate,
cellular_status.rx_level,
cellular_status.tx_level,
cellular_status.signal_to_noise,
Expand All @@ -240,6 +240,31 @@ TelemetryServerImpl::publish_cellular_status(TelemetryServer::CellularStatus cel
TelemetryServer::Result::Unsupported;
}

TelemetryServer::Result
TelemetryServerImpl::publish_nic_info(TelemetryServer::NicInfo nic_info)
{
mavlink_message_t msg;

nic_info.nic_model_name.resize(sizeof(mavlink_nic_info_t::nic_model));

mavlink_msg_nic_info_pack(
_server_component_impl->get_own_system_id(),
_server_component_impl->get_own_component_id(),
&msg,
static_cast<uint8_t>(nic_info.instance_number),
static_cast<uint8_t>(nic_info.nic_id),
nic_info.nic_model_name.data(),
nic_info.imei,
nic_info.iccid,
nic_info.imsi,
nic_info.firmware_version);

add_msg_cache(MAVLINK_MSG_ID_NIC_INFO, msg);

return _server_component_impl->send_message(msg) ? TelemetryServer::Result::Success :
TelemetryServer::Result::Unsupported;
}

TelemetryServer::Result
TelemetryServerImpl::publish_status_text(TelemetryServer::StatusText status_text)
{
Expand Down
3 changes: 3 additions & 0 deletions src/mavsdk/plugins/telemetry_server/telemetry_server_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class TelemetryServerImpl : public ServerPluginImplBase {
TelemetryServer::Result
publish_cellular_status(TelemetryServer::CellularStatus cellular_status);

TelemetryServer::Result
publish_nic_info(TelemetryServer::NicInfo nic_info);

TelemetryServer::Result publish_odometry(TelemetryServer::Odometry odometry);

TelemetryServer::Result
Expand Down

0 comments on commit 21784b5

Please sign in to comment.