AP_ADSB: create an enum class for logging

This commit is contained in:
Peter Barker 2023-10-24 20:53:08 +11:00 committed by Peter Barker
parent 40cdb5d01e
commit 37109e649e
2 changed files with 6 additions and 6 deletions

View File

@ -828,17 +828,17 @@ bool AP_ADSB::get_vehicle_by_ICAO(const uint32_t icao, adsb_vehicle_t &vehicle)
*/
void AP_ADSB::write_log(const adsb_vehicle_t &vehicle) const
{
switch (_log) {
case logging::SPECIAL_ONLY:
switch ((Logging)_log) {
case Logging::SPECIAL_ONLY:
if (!is_special_vehicle(vehicle.info.ICAO_address)) {
return;
}
break;
case logging::ALL:
case Logging::ALL:
break;
case logging::NONE:
case Logging::NONE:
default:
return;
}

View File

@ -288,13 +288,13 @@ private:
void push_sample(const adsb_vehicle_t &vehicle);
// logging
AP_Int8 _log;
void write_log(const adsb_vehicle_t &vehicle) const;
enum logging {
enum class Logging {
NONE = 0,
SPECIAL_ONLY = 1,
ALL = 2
};
AP_Enum<Logging> _log;
// reference to backend
AP_ADSB_Backend *_backend[ADSB_MAX_INSTANCES];