1use Callsign;
2
3#[derive(Debug, Eq, PartialEq, thiserror::Error)]
4pub enum DecodeError {
5 #[error("Invalid Callsign: {0:?}")]
6 InvalidCallsign(Vec<u8>),
7 #[error("Invalid Via: {0:?}")]
8 InvalidVia(Vec<u8>),
9 #[error("Invalid Timestamp: {0:?}")]
10 InvalidTimestamp(Vec<u8>),
11 #[error("Unsupported Position Format: {0:?}")]
12 UnsupportedPositionFormat(Vec<u8>),
13 #[error("Invalid Position: {0:?}")]
14 InvalidPosition(Vec<u8>),
15 #[error("Invalid Latitude: {0:?}")]
16 InvalidLatitude(Vec<u8>),
17 #[error("Invalid Longitude: {0:?}")]
18 InvalidLongitude(Vec<u8>),
19 #[error("Invalid Packet: {0:?}")]
20 InvalidPacket(Vec<u8>),
21 #[error("Invalid Message Destination: {0:?}")]
22 InvalidMessageDestination(Vec<u8>),
23 #[error("Invalid Message ID: {0:?}")]
24 InvalidMessageId(Vec<u8>),
25 #[error("Invalid Compressed cs: {0:?}")]
26 InvalidCs([u8; 2]),
27 #[error("Invalid Mic-E destination address: {0:}")]
28 InvalidMicEDestination(Callsign),
29 #[error("Invalid Mic-E information field: {0:?}")]
30 InvalidMicEInformation(Vec<u8>),
31}
32
33#[derive(Debug, thiserror::Error)]
34pub enum EncodeError {
35 #[error("Callsign can't be encoded: {0:}")]
36 InvalidCallsign(Callsign),
37 #[error("Invalid Latitude: {0}")]
38 InvalidLatitude(f64),
39 #[error("Invalid Longitude: {0}")]
40 InvalidLongitude(f64),
41 #[error("Invalid Aprs Data")]
42 InvalidData,
43 #[error("Invalid Message Addressee: {0:?}")]
44 InvalidMessageAddressee(Vec<u8>),
45 #[error("Compressed altitude requires the nmea source to be gga")]
46 NonGgaAltitude,
47 #[error(transparent)]
48 Write(#[from] std::io::Error),
49}