|
| 1 | +package nmea |
| 2 | + |
| 3 | +const ( |
| 4 | + // TypePGRMT type for PGRMT sentences |
| 5 | + TypePGRMT = "GRMT" |
| 6 | + // PassPGRMT Self-Test Passed |
| 7 | + PassPGRMT = "P" |
| 8 | + // FailPGRMT Self-Test Failed |
| 9 | + FailPGRMT = "F" |
| 10 | + // DataRetainedPGRMT Data Retained |
| 11 | + DataRetainedPGRMT = "R" |
| 12 | + // DataLostPGRMT Data Lost |
| 13 | + DataLostPGRMT = "L" |
| 14 | + // DataCollectingPGRMT Data Collecting |
| 15 | + DataCollectingPGRMT = "C" |
| 16 | +) |
| 17 | + |
| 18 | +// PGRMT is Sensor Status Information (Garmin proprietary sentence) |
| 19 | +// https://developer.garmin.com/downloads/legacy/uploads/2015/08/190-00684-00.pdf |
| 20 | +// $PGRMT,<0>,<1>,<2>,<3>,<4>,<5>,<6>,<7>,<8>*hh<CR><LF> |
| 21 | +// Format: $PGRMT,xxxxxxxxxx,A,A,A,A,A,A,N,A*hh<CR><LF> |
| 22 | +// Example: $PGRMT,GPS24xd-HVS VER 2.30,,,,,,,,*10 |
| 23 | +type PGRMT struct { |
| 24 | + BaseSentence |
| 25 | + ModelAndFirmwareVersion string |
| 26 | + ROMChecksumTest string // "P" = pass, "F" = fail |
| 27 | + ReceiverFailureDiscrete string // "P" = pass, "F" = fail |
| 28 | + StoredDataLost string // "R" = retained, "L" = lost |
| 29 | + RealtimeClockLost string // "R" = retained, "L" = lost |
| 30 | + OscillatorDriftDiscrete string // "P" = pass, "F" = fail |
| 31 | + DataCollectionDiscrete string // "C" = collecting, "" = not collecting |
| 32 | + SensorTemperature float64 // Degrees C |
| 33 | + SensorConfigurationData string // "R" = retained, "L" = lost |
| 34 | +} |
| 35 | + |
| 36 | +// newPGRMT constructor |
| 37 | +func newPGRMT(s BaseSentence) (Sentence, error) { |
| 38 | + p := NewParser(s) |
| 39 | + p.AssertType(TypePGRMT) |
| 40 | + |
| 41 | + return PGRMT{ |
| 42 | + BaseSentence: s, |
| 43 | + ModelAndFirmwareVersion: p.String(0, "product, model and software version"), |
| 44 | + ROMChecksumTest: p.EnumString(1, "rom checksum test", PassPGRMT, FailPGRMT), |
| 45 | + ReceiverFailureDiscrete: p.EnumString(2, "receiver failure discrete", PassPGRMT, FailPGRMT), |
| 46 | + StoredDataLost: p.EnumString(3, "stored data lost", DataRetainedPGRMT, DataLostPGRMT), |
| 47 | + RealtimeClockLost: p.EnumString(4, "realtime clock lost", DataRetainedPGRMT, DataLostPGRMT), |
| 48 | + OscillatorDriftDiscrete: p.EnumString(5, "oscillator drift discrete", PassPGRMT, FailPGRMT), |
| 49 | + DataCollectionDiscrete: p.EnumString(6, "data collection discrete", DataCollectingPGRMT), |
| 50 | + SensorTemperature: p.Float64(7, "sensor temperature in degrees celsius"), |
| 51 | + SensorConfigurationData: p.EnumString(8, "sensor configuration data", DataRetainedPGRMT, DataLostPGRMT), |
| 52 | + }, p.Err() |
| 53 | +} |
0 commit comments