Socket
Socket
Sign inDemoInstall

quipu

Package Overview
Dependencies
173
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    quipu

This modules provides SMS and 3G functionnalities in node.js.


Version published
Maintainers
1
Created

Readme

Source

Quipu

This modules provides SMS and 3G functionnalities in node.js.

From Wikipedia article: "A quipu usually consisted of colored, spun, and plied thread or strings made from cotton or camelid fiber. For the Inca, the system aided in collecting data and keeping records, ranging from monitoring tax obligations, properly collecting census records, calendrical information, and military organization."

Getting started

After creating a file called myPINcode.js containing module.exports = xxxx; your pin code, you can use the library as follows:

var quipu = require("./index.js");

// initilize the device
var yourNumber = "336........";
var devices = {
    modem: "/dev/ttyUSB0",
    sms: "/dev/ttyUSB2"
};

quipu.handle("initialize", devices);

// sending a SMS
quipu.sendSMS("Hello from quipu.", yourNumber);

// receiving SMS
quipu.on("smsReceived", function(sms){
    console.log(sms);       
});

// spawning a 3G connexion and closing it after 30 seconds
quipu.handle("open3G");

setTimeout(function(){
    quipu.handle("close3G");
}, 30000)


// open a reverse ssh tunnel towards "kerrigan" (must be set in your ~/.ssh/config)
quipu.handle("openTunnel", 2222, 9632, "kerrigan");

setTimeout(function(){
    quipu.handle("closeTunnel");
}, 30000)

Behind the scene, there is a final state machine (FSM) with the following states:

  • uninitialized: quipu was just turned on, nothing's happening.
  • initialized: quipu has its sms and modem ports open. It is then capable of receiving/sending sms, and opening a 3G connection.
  • 3G_connected: quipu is now connected to internet via a 3G connection.
  • tunnelling: quipu has a ssh connection opened with some remote server.

States of quipu

Compressing messages

If you're using the SMS protocol, you may have some troubles sending some messages, because of the size (160 characters) or some characters, such as curly braces. The file parser.js provides and encode and decode functions that can help you, for example, passing json objects through the air:

// to send encoded, as sms don't like curly braces and other stuff
var parser = require("./parser.js")

parser.encode(devices)
    .then(function(msg){
        quipu.sendSMS(msg, yourNumber);
    })
    .catch(function(err){
        console.log(err);
    });
// and to decode use 
quipu.on("smsReceived", function(sms){
    parser.decode(sms.body)
        .then(function(object){
            console.log(object);
        })      
});

Compatibility

This project has been developped and tested for the following 3G devices:

References

AT commands:

SMS format:

PPP:

FAQs

Last updated on 08 Oct 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc