npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

modem-serial

v0.2.4

Published

Communication module for serial modems control: This NodeJS utility aims to make it easy to interact with USB dongles, providing functions to get info, connect, make calls with just an API call.

Downloads

6

Readme

Modem Serial

This NodeJS utility aims to make it easy to interact with USB dongles, providing functions to get info, connect, make calls with just a function. This module will take care of all communications with the device.

IMPORTANT NOTE: This module its in a very early alpha version. I do not recommend using it in production environments.

How to use it

1. Installation

To install it, you just have to install it as a normal npm module:

npm install modem-serial

2. Initialization

In order to initialize de device and the module, you must require it and use the constructor passing as argument the route to your device:

var USBSerial = require('modem-serial');
var usb = USBSerial('/dev/ttyUSB0');

3. API functions

isOpen()

It returns true if the device is still open for writes.

getInfo()

It returns all the information gotten by the moment of the device.

getCallInfo()

It returns the current/last call info.

setTTL(ttl)

Sets ttl milliseconds between each full radio info update.

setDefaultDuration(duration)

Sets default duration seconds for outgoing & incoming calls in which duration is not indicated (default: 90 seconds).

call(number, duration)

It calls the specified number and will hangup after duration seconds.

answer(duration, timeout)

Expects an incoming call in timeout seconds and will hangup after duration seconds.

hangup()

Hangups current call.

destroy()

Closes connection.

restart()

Restarts device. Will cause unplugs from system.

connect(err, callback)

NOT WORKING AT THIS TIME. It will in future releases It executes the connection process for this model.

4. Events

Functions to catch events.

getNotified(callback)

If you want to be notified when some info has changed, you can call the getNotified function, using as callback, the function you want to execute when something has changed.

usb.getNotified(function (field, oldValue, newValue) {
  console.log('%s changed from %s to %s', field, oldValue, newValue);
  console.log(usb.getInfo());
});

onCallStatusChange(callback)

This event is called when the call status has changed.

usb.onCallStatusChange(function (status, ts) {
	debug('[%d] Call is in status: %s', ts, status);
	debug(usb.getCallInfo());
});

Supported Models

By the moment, I have tried only with some Huawei models. As soon as new devices are tested, this list will be updated.

Help is really welcome :smiley:

| Manufacturer | Model | Comments | |:---|:---|---| |Huawei| E173u | Signal Quality parameters are not provided by this device (only RSSI)IMPORTANT: Firmware version 11.126.16.00.00 doesn't work correctly with ATH command (hangup). Consider updating firmware. | |QualComm| BU580 | Features working: provider and RSSI information and call actions. |

Testing

To test this module, run the command:

npm test

This, by default, will try to open the device in /dev/cu.HUAWEIMobile-Pcui. If your modem linked with other name (pe: /dev/ttyUSB0), call it using:

DEV=/dev/ttyUSB0 npm test

If you want to test the outgoing calling function, just add a NUMBER environment variable

NUMBER=XXXXXX npm test

To-Do's

  • Get endingStatus and hangupCause for CDMA