This package makes use of the nom crate to parse the binary packets.
Further documentation about the nom crate
can be found at the docs.rs page
and at the official github page.
It parses Codec 8, 8-Extended and 16 (aka TCP/UDP Protocol).
It DOES NOT parse Codec 12, 13 and 14 (aka GPRS Protocol), it MAY in the future.
It fails parsing if any of the following checks fail:
```rust let imei_buffer = [0x00, 0x0F, 0x33, 0x35, 0x36, 0x33, 0x30, 0x37, 0x30, 0x34, 0x32, 0x34, 0x34, 0x31, 0x30, 0x31, 0x33 ];
let (rest, imei) = nomteltonika::parser::imei(&imeibuffer).unwrap();
asserteq!(rest, &[]); asserteq!(imei, String::from("356307042441013")); ```
```rust let buffer = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x08, 0x01, 0x00, 0x00, 0x01, 0x6B, 0x40, 0xD8, 0xEA, 0x30, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x05, 0x02, 0x15, 0x03, 0x01, 0x01, 0x01, 0x42, 0x5E, 0x0F, 0x01, 0xF1, 0x00, 0x00, 0x60, 0x1A, 0x01, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xC7, 0xCF ];
let (rest, packet) = nomteltonika::parser::tcppacket(&buffer).unwrap();
assert_eq!(rest, &[]); println!("{packet:#?}"); ```