#[cfg_attr(feature = "c", repr(C))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Talker {
Gps, Glonass, Galileo, BeiDou, NavIc, Qzss, MultiConstellation,
AutopilotGeneral, AutopilotMagnetic,
Dsc, BeaconReceiver, SatelliteComms, RadioTelephoneMfHf, RadioTelephoneVhf, ScanningReceiver,
DirectionFinder, Ecdis, Loran, IntegratedInstrumentation, IntegratedNavigation, Radar,
MagneticCompass, NorthSeekingGyro, NonNorthSeekingGyro,
SonarDepth, ScanningEchosounder,
DopplerVelocity, MagneticSpeedLog, MechanicalSpeedLog,
WeatherInstruments, Transducer, Epirb, EngineRoom, TurnRateIndicator,
AtomicClock, Chronometer, QuartzClock, RadioClock,
Proprietary,
Unknown,
}
impl Talker {
#[must_use]
pub fn parse(s: &str) -> Self {
match s {
"GP" => Talker::Gps,
"GL" => Talker::Glonass,
"GA" => Talker::Galileo,
"GB" | "BD" => Talker::BeiDou,
"GI" => Talker::NavIc,
"GQ" => Talker::Qzss,
"GN" => Talker::MultiConstellation,
"AG" => Talker::AutopilotGeneral,
"AP" => Talker::AutopilotMagnetic,
"CD" => Talker::Dsc,
"CR" => Talker::BeaconReceiver,
"CS" => Talker::SatelliteComms,
"CT" => Talker::RadioTelephoneMfHf,
"CV" => Talker::RadioTelephoneVhf,
"CX" => Talker::ScanningReceiver,
"DF" => Talker::DirectionFinder,
"EC" => Talker::Ecdis,
"EP" => Talker::Epirb,
"ER" => Talker::EngineRoom,
"HC" => Talker::MagneticCompass,
"HE" => Talker::NorthSeekingGyro,
"HN" => Talker::NonNorthSeekingGyro,
"II" => Talker::IntegratedInstrumentation,
"IN" | "SN" => Talker::IntegratedNavigation,
"LC" => Talker::Loran,
"P" => Talker::Proprietary,
"RA" => Talker::Radar,
"SD" => Talker::SonarDepth,
"SS" => Talker::ScanningEchosounder,
"TI" => Talker::TurnRateIndicator,
"VD" => Talker::DopplerVelocity,
"DM" => Talker::MagneticSpeedLog,
"VW" => Talker::MechanicalSpeedLog,
"WI" => Talker::WeatherInstruments,
"YX" => Talker::Transducer,
"ZA" => Talker::AtomicClock,
"ZC" => Talker::Chronometer,
"ZQ" => Talker::QuartzClock,
"ZV" => Talker::RadioClock,
_ => Talker::Unknown,
}
}
#[must_use]
pub fn is_gnss(&self) -> bool {
matches!(
self,
Talker::Gps
| Talker::Glonass
| Talker::Galileo
| Talker::BeiDou
| Talker::NavIc
| Talker::Qzss
| Talker::MultiConstellation
)
}
}