Code Monkey home page Code Monkey logo

nodegsm's Introduction

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

nodegsm's People

Contributors

stasel avatar

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.