Skip to content

Commit

Permalink
Merge pull request #1732 from mavlink/chep-main
Browse files Browse the repository at this point in the history
Plugin/transponder: add tslc in AdsbVehicle struct
  • Loading branch information
julianoes authored Apr 7, 2022
2 parents 656d0c3 + e15d443 commit 790e793
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 47 deletions.
2 changes: 1 addition & 1 deletion proto
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class Transponder : public PluginBase {
std::string callsign{}; /**< @brief The callsign */
AdsbEmitterType emitter_type{}; /**< @brief ADSB emitter type. */
uint32_t squawk{}; /**< @brief Squawk code. */
uint32_t tslc_s{}; /**< @brief Time Since Last Communication in seconds. */
};

/**
Expand Down
3 changes: 2 additions & 1 deletion src/mavsdk/plugins/transponder/transponder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool operator==(const Transponder::AdsbVehicle& lhs, const Transponder::AdsbVehi
((std::isnan(rhs.vertical_velocity_m_s) && std::isnan(lhs.vertical_velocity_m_s)) ||
rhs.vertical_velocity_m_s == lhs.vertical_velocity_m_s) &&
(rhs.callsign == lhs.callsign) && (rhs.emitter_type == lhs.emitter_type) &&
(rhs.squawk == lhs.squawk);
(rhs.squawk == lhs.squawk) && (rhs.tslc_s == lhs.tslc_s);
}

std::ostream& operator<<(std::ostream& str, Transponder::AdsbVehicle const& adsb_vehicle)
Expand All @@ -76,6 +76,7 @@ std::ostream& operator<<(std::ostream& str, Transponder::AdsbVehicle const& adsb
str << " callsign: " << adsb_vehicle.callsign << '\n';
str << " emitter_type: " << adsb_vehicle.emitter_type << '\n';
str << " squawk: " << adsb_vehicle.squawk << '\n';
str << " tslc_s: " << adsb_vehicle.tslc_s << '\n';
str << '}';
return str;
}
Expand Down
1 change: 1 addition & 0 deletions src/mavsdk/plugins/transponder/transponder_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void TransponderImpl::process_transponder(const mavlink_message_t& message)
adsbVehicle.callsign = local_adsb_vehicle.callsign;
adsbVehicle.emitter_type = Transponder::AdsbEmitterType(local_adsb_vehicle.emitter_type);
adsbVehicle.squawk = local_adsb_vehicle.squawk;
adsbVehicle.tslc_s = local_adsb_vehicle.tslc;

set_transponder(adsbVehicle);

Expand Down
115 changes: 70 additions & 45 deletions src/mavsdk_server/src/generated/transponder/transponder.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions src/mavsdk_server/src/generated/transponder/transponder.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ class TransponderServiceImpl final : public rpc::transponder::TransponderService

rpc_obj->set_squawk(adsb_vehicle.squawk);

rpc_obj->set_tslc_s(adsb_vehicle.tslc_s);

return rpc_obj;
}

Expand Down Expand Up @@ -193,6 +195,8 @@ class TransponderServiceImpl final : public rpc::transponder::TransponderService

obj.squawk = adsb_vehicle.squawk();

obj.tslc_s = adsb_vehicle.tslc_s();

return obj;
}

Expand Down

0 comments on commit 790e793

Please sign in to comment.