Skip to content

Library to allow Node.JS to interface with the native AX25 networking stack in Linux

License

Notifications You must be signed in to change notification settings

mjlocat/unix-ax25-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unix-ax25

This package allows Node.JS applications to use the native AX25 networking in the Linux kernel. This is very much a work in progress.

Prerequisites

  1. Working AX25 setup, including configured axports file
  2. libax25 headers (can usually be found in the libax25-dev package)

Building

npm run build

Import

You can import this package as follows:

const UnixAX25 = require('unix-ax25');

or

import UnixAX25 from 'unix-ax25';

Interface

This package creates a class that inherits from EventEmitter

new UnixAX25()

The constructor requires no arguments. It will create an instance of this class and open the AX25 socket.

const ax25 = new UnixAX25();

startUIListener(timeout)

Start listening for data on the AX25 socket. Specify an amount of time to wait before trying again in milliseconds. It will keep listening for AX25 packets until stopUIListener() is called.

ax25.startUIListener(500); // Wait half a second between read attempts

stopUIListener()

Stop listening for AX25 packets

ax25.stopUIListener();

Events

As this class inherits from EventEmitter, you can subscribe to events.

data

Subscribe to the data event to receive a packet in the following format:

{
  from: String,       // The callsign and SSID sending the packet
  to: String,         // The callsign and SSID the packet is sent to
  via: [{
    digi: String,     // The callsign and SSID of specified digipeters
    repeated: Boolean // If true, the specified digipeter has repeated this packet
  }],
  received: Date,     // The date/time the packet was received
  data: String        // The payload of the packet
}

Example:

ax25.on('data', (packet) => {
  console.log(`Received from: ${packet.from}`);
  console.log(`Sent to: ${packet.to}`);
  console.log(`Payload: ${packet.data}`);
});

Example

A quick example similar to the listen utility from the ax25-apps package can be found in src/listen.js.

node src/listen.js

About

Library to allow Node.JS to interface with the native AX25 networking stack in Linux

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published