Code Monkey home page Code Monkey logo

rtljs's Introduction

RTLjs

Node.js interface for librtlsdr, using FFI-NAPI

Works with modern versions of node (v14-16 etc.), unlike alternate packages on NPM

Only tested on Linux, but if you ask me, I can very easily add windows/macos support.

Installation

Prerequisites

This module requires librtlsdr. This package in turn requires libusb.

Librtlsdr is a package on most package repositories.

Linux:

sudo apt-get install librtlsdr-dev

Windows:

you will need to install librtlsdr on your machine. DLLs are availble on the librtlsdr wiki. These will need to be inserted into a system path folder so that ffi-napi can access them.

Package

npm i rtljs

Usage

The package is written in ts and compiled to js, so ts typings are automatically provided with the package.

Using ES:

import * as rtljs from "rtljs";

Node require():

const rtljs = require("rtljs");

Sample Usage:

console.log(rtljs.getDeviceCount()); // 1
console.log(rtljs.getDeviceName(0)); // Generic RTL R820T2

let device = rtljs.open(0);
device.setCenterFreq(1090 * rtljs.mhz); // 1090000000

// raw IQ data
device.resetBuffer(); // reset buffer to prevent communication data from appearing as radio data
let data = device.readSync(512); // read 512b
console.log(JSON.stringify(data)); // [128, 127, 128... etc

rtljs.close(device);

Common Fixes

Nothing happening when i use readSync/Async, program just hangs

remember to use device.resetBuffer() before using read commands

Can't access device

you probably forgot to use close() in your code to end the device when the program ended. Reset your usb ports and this should now work fine.

API

TSDoc API available at https://arkanic.github.io/rtljs/

Examples are available here

Broken Stuff

Easy Fixes:

  • There are no bias functions at the moment

??wtf??:

  • cancelAsync refuses to work, likely some obscure multithreading error with ffi-napi (which happens to hate multithreading)

About

Made by Arkanic

MIT License

rtljs's People

Contributors

arkanic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rtljs's Issues

Error when start code.

Hello, I try to run code with rtljs but wehn run code send this error message:
Error: Dynamic Linking Error: Win32 error 126
at new DynamicLibrary (C:\Users\geopa\Desktop\sdr\node_modules\ffi-napi\lib\dynamic_library.js:75:11)
at Object.Library (C:\Users\geopa\Desktop\sdr\node_modules\ffi-napi\lib\library.js:47:10)
at Object. (C:\Users\geopa\Desktop\sdr\node_modules\rtljs\lib\baremetal.js:26:40)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\geopa\Desktop\sdr\node_modules\rtljs\lib\rtlsdr-static.js:27:30)

I have v16.17.0 version node.js.

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.