Code Monkey home page Code Monkey logo

ax25-rs's Introduction

ax25

crates.io crates.io docs.rs docs.rs

This project aims to provide everything you need to write cross-platform packet radio software in Rust.

The crate ax25 provides:

  • Encode and decode AX.25 frames (currently supporting v2.0)
  • Support for no_std environments

The crate ax25_tnc provides:

  • KISS protocol
  • Connect to TNCs via multiple methods without needing to change your code

Quick Start

Most developers will want to focus on tnc::TncAddress and tnc::Tnc.

  1. Generate or ask the user to supply an address string. This takes the form:
    tnc:tcpkiss:192.168.0.1:8001 or
    tnc:linuxif:vk7ntk-2
  2. Parse this to an address: let addr = string.parse::<TncAddress>()?;
  3. Attempt to open the TNC: let tnc = Tnc::open(&addr)?;
  4. Use send_frame() and receive_frame() to communicate on the radio.
  5. The Tnc can be cloned for multithreaded use.

If your application requires encoding/decoding AX.25 data directly, see the frame module.

Example

This following is one of the included example programs, listen.rs. It is a poor imitation of axlisten.

use ax25_tnc::tnc::{Tnc, TncAddress};
use std::env;
use time::OffsetDateTime;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let args: Vec<String> = env::args().collect();
    if args.len() != 2 {
        println!("Usage: {} <tnc-address>", args[0]);
        println!("where tnc-address is something like");
        println!("  tnc:linuxif:vk7ntk-2");
        println!("  tnc:tcpkiss:192.168.0.1:8001");
        std::process::exit(1);
    }

    let addr = args[1].parse::<TncAddress>()?;
    let tnc = Tnc::open(&addr)?;

    let receiver = tnc.incoming();
    while let Ok(frame) = receiver.recv().unwrap() {
        println!("{}", OffsetDateTime::now_utc());
        println!("{}", frame);
    }
    Ok(())
}

It produces output like the following. Note that it must be run with sudo when using the Linux interface.

$ sudo ./target/debug/examples/listen tnc:linuxif:vk7ntk-2
2020-02-02 21:51:11.017220715 +11:00
Source		VK7NTK-1
Destination	IDENT
Data		"hello this is a test"

The above is the Display implementation for Ax25Frame - full protocol information is available through its fields which are not printed here.

Roadmap

Planned features:

  • Support for serial KISS TNCs (physical, TNC-Pi, Dire Wolf pseudo-tty)
  • Paclen management
  • More convenient send/receive interfaces for messing around with UI frames
  • Direct use of linux axports interfaces without kissattach

ax25-rs's People

Contributors

thombles avatar jlewallen avatar wsh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.