gt06 0.1.0

Parser and stream decoder for the GT06 GPS tracker protocol
Documentation
  • Coverage
  • 34.31%
    35 out of 102 items documented1 out of 1 items with examples
  • Size
  • Source code size: 41.86 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.29 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • SerAbin1/gt06
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • SerAbin1

gt06 (WIP)

This is a port of my JS-based gt06 parser to Rust, with significant AI use. It's more a learning project in my Rust journey than it is a production-ready library — though the original JS-based parser has been running in prod for a while now.

I'll be continuing work on this library as time allows, and will mark 1.0 when I feel it's ready for general use.

What it does

Parses the GT06 GPS tracker protocol: login, location (standard and extended), status, and alarm messages, sent over a raw TCP connection.

  • [Decoder] reassembles messages out of a raw byte stream, buffering partial reads.
  • [parse_packet] parses a single, already-framed packet.
  • [build_ack] builds the acknowledgement packet required for login/status messages.

Example

use gt06::{build_ack, Decoder, Message};

let mut decoder = Decoder::new();

for result in decoder.push(&bytes_from_socket) {
    match result {
        Ok(Message::Login(login)) => {
            let ack = build_ack(0x01, login.serial_number);
            socket.write_all(&ack)?;
        }
        Ok(message) => println!("{message:?}"),
        Err(err) => eprintln!("bad packet: {err}"),
    }
}

License

MIT