New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

netrigctl-node

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

netrigctl-node

A Node.js client for rigctld, the Hamlib TCP server for controlling amateur radio transceivers.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

netrigctl-node

This project is a Node.js class designed to interface with rigctld, the Hamlib TCP server for controlling amateur radio transceivers.

Features

  • TCP connection to rigctld.
  • Command queuing mechanism to handle sequential commands.
  • Support for various rigctld commands (get_freq, set_freq, get_mode, set_mode, get_level, set_level, etc.).
  • Event emitters for connection status (connect, end, close, error) and successful dump state parsing (dumpStateParsed).

Installation

npm install netrigctl-node

Then, in your code:

const { RigClient } = require('netrigctl-node'); // Adjust the path as needed

Make sure you have rigctld running and accessible from the host where your Node.js application is running.

Usage

  • Instantiate the client:

    const rigClient = new RigClient('your_rigctld_host', 4532); // Replace with your host and port
    
  • Set up event listeners:

    Listen for the dumpStateParsed event before sending commands that rely on rig capabilities.

    rigClient.on('dumpStateParsed', async (dumpState) => {
        //console.log('Dump State Parsing Complete:', dumpState);
        // Now you can access and use the parsed data in the dumpState object
        // e.g., console.log(dumpState.rxRanges);
    
        try {
            const freq = await rigClient.get_freq();
            console.log('Current Frequency:', freq);
    
            const pttStatus = await rigClient.get_ptt();
            console.log('Current PTT Status:', pttStatus);
    
            await rigClient.set_freq(14270000);
            console.log('Set frequency to 14.27 MHz');
    
            const newFreq = await rigClient.get_freq();
            console.log('New Frequency:', newFreq);
    
            await rigClient.set_mode('USB', 3000);
            console.log('Set mode to USB 3000');
    
            const { mode, passband } = await rigClient.get_mode();
            console.log('Current Mode:', mode, 'Passband:', passband);
    
            const  nr  = await rigClient.get_level('NR');
            console.log('Current NR:', nr);
    
    
        } catch (error) {
            console.error('Command execution error:', error);
        } finally {
             rigClient.disconnect(); // Disconnect when done
        }
    });
    
    rigClient.on('error', (err) => {
        console.error('RigClient Error:', err);
    });
    
    rigClient.on('close', (hadError) => {
        console.log('RigClient connection closed.');
    });
    
  • Connect to rigctld:

    rigClient.connect()
        .then(() => console.log('Connected to rigctld'))
        .catch(err => console.error('Connection failed:', err));
    
  • Disconnect:

    rigClient.disconnect();
    

Command Timeout

Commands queued via queueCommand have a default timeout of 10 seconds. If a response is not received within this time, the command's Promise will be rejected with a timeout error. You can specify a different timeout when calling queueCommand (although the public methods like get_freq do not currently expose this option, it's available internally).

Dump State Parsing

The RigClient automatically parses the \dump_state output into a structured object available via rigClient.getDumpStateData() after the dumpStateParsed event. This data includes supported frequency ranges, modes, filters, and capability bitmasks, which are used internally for the checkCapability method.

Error Handling

Errors (connection errors, rigctld errors, command timeouts) are emitted via the 'error' event and also cause the specific command's Promise to be rejected.

Keywords

hamlib

FAQs

Package last updated on 25 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts