Skip to content

A pluggable, lightweight, and fast TCP server framework for Teltonika GPS devices.

Notifications You must be signed in to change notification settings

daim2k5/argo-teltonika

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Argo

A pluggable, lightweight, and fast TCP server framework for Teltonika GPS devices.

Features

  • Logging via the log crate.

  • Exposed by the Plugin trait:

    • Filtering connection based on IMEI.
    • Connect, Disconnect & TeltonikaEvent handlers.

Examples

use std::io;

use argo_teltonika::{Argo, DebugPlugin, Plugin, TeltonikaEvent};

struct CounterPlugin {
    count: usize,
}

impl Plugin for CounterPlugin {
    fn can_teltonika_connect(&mut self, imei: &str) -> bool {
        log::info!("{} can connect", imei);
        true
    }

    fn on_teltonika_connected(&mut self, imei: &str) {
        self.count += 1;
        log::info!("{} connected {}", imei, self.count);
    }

    fn on_teltonika_disconnected(&mut self, imei: &str) {
        log::info!("{} disconnected {}", imei, self.count);
        self.count -= 1;
    }

    fn on_teltonika_event(&mut self, imei: &str, _event: &TeltonikaEvent) {
        log::info!("{} sent an event, current connections: {}", imei, self.count);
    }
}

fn main() -> io::Result<()> {
    std::panic::set_hook(Box::new(|panic_info| {
        log::error!("{}", panic_info);
    }));

    env_logger::init();
    let mut app = Argo::new("127.0.0.1:56552");

    app.add_plugin(DebugPlugin);
    app.add_plugin(CounterPlugin { count: 0 });
    app.run()?;
    Ok(())
}

Further examples can be found in the examples folder.

About

A pluggable, lightweight, and fast TCP server framework for Teltonika GPS devices.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 98.7%
  • Shell 1.3%