Skip to content

wendevlin/NodeGSM

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeJS GSM API

npm

A simple and easy to use NodeJS API to communicate with serial GSM Modems.

Features

  • Read device information: serial, manufacturer, model.
  • Read network information: Carrier, signal strength, subscriber id.
  • Read and send SMS Messages.
  • Add, Read and modify SIM card contacts.
  • Make calls (without audio).

Requirements

  • Connected USB GSM Modem
  • Working SIM Card
  • NodeJS 11 and later

Installation

npm install nodegsm

Usage

const GSM = require("nodegsm")
const gsm = new GSM("/dev/gsmmodem")
await gsm.connect()

const manufacturer = await gsm.getManufacturerInformation()) 
console.log(manufacturer) // QUALCOMM INCORPORATED

const unreadMessages = await gsm.readSMS(GSM.MessageStorage.sim, GSM.MessageFilter.unread)
console.log(unreadMessages) // List of unread SMS messages

await gsm.sendSMS("+31111222333","Hello from NodeJS")

Dependencies

Resources

Testing the modem

Method 1: Using regular bash

Terminal window 1 will read

$ cat /dev/gsmmodem

OK

Manufacturer: QUALCOMM INCORPORATED
Model: +CGMM:HSPA MODEM
Revision: +CGMR:V1.2
IMEI: 869478036086138
+GCAP: +CGSM,+DS,+ES

OK

Terminal window 2 will write

$ echo "AT" > /dev/gsmmodem
$ echo "ATI" > /dev/gsmmodem

Method 2: Using cu

$ apt install cu
$ cu -l /dev/gsmmodem

AT

OK

ATI

Manufacturer: QUALCOMM INCORPORATED
Model: +CGMM:HSPA MODEM
Revision: +CGMR:V1.2
IMEI: 869478036086138
+GCAP: +CGSM,+DS,+ES

OK

About

Modem GSM API for NodeJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%