Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.
/ gsm.ts Public archive
forked from paintenzero/node-gsm-modem

node module to control GSM modem connected to serial port

Notifications You must be signed in to change notification settings

0xF6/gsm.ts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-gsm-modem

NodeJS module to control GSM modem connected to serial port.

Thanks to

Emil Sedgh for PDU.js. I had to change it though.

Chris Williams for node-serialport

vchatterji for contributing to the module

Usage

Install using npm:

npm install --save gsm-modem

Require the module:

var Modem = require('gsm-modem');

Connect to the modem:

var modem1 = new Modem({
    ports : ['/dev/ttyUSB0', '/dev/ttyUSB1', '/dev/ttyUSB2']
});
modem1.connect(function (err) {
    if (err) {
        console.error('Error connecting modem: ', err);
        return;
    }
    // Start giving commands here...
}

Connect options

ports: Array of serial ports to search for a modem. The module will try to connect to every ports specified and send AT command. The first port modem answers to will be used as data/command port, others will be used for listening only. Default: [/dev/ttyUSB0,/dev/ttyUSB1,/dev/ttyUSB2]

debug: boolean if the module should output all data it sends/receives. Default: false

auto_hangup: boolean indicating whether modem should send ATH (hangup) command when incoming call is received. Default: false

commandTimeout: milliseconds, how long to wait for response on any AT command. Default: 15000

ussdTimeout: milliseconds, how long to wait for USSD after sending the command. Default: 15000

forever: boolean, indicated whether module should run in daemon mode automatically handling modem connects and disconnects. Default: false

API

See wiki page.

Checked on modems

  • Huawei 3121S
  • Huawei E171 / E173
  • Huawei E1550
  • Huawei K3765
  • ZTE MF656A
  • ZTE MF180
  • Wavecom WISMO2C

TODO

  • 8bit encoding
  • Text mode

About

node module to control GSM modem connected to serial port

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • TypeScript 100.0%