Skip to content

ryanroe/LoRaPacket

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoRaPacket

LoRa WAN Packet decoder / encoder. For the moment it implements the LoRa WAN v1.0.2 standard.

Install

npm install lorapacket

Usage

Here are a few usage examples, for more please use the full documentation.

Decode data (buffer or string)

var LoRaPacket = require ('lorapacket');

var nwkSKey = getNwkSKey ();
var appSKey = getAppSKey ();

// from Buffer
var bufferData = getPacketBuffer ();

var packet = new LoRaPacket (bufferData, {
    nwkSKey,
    appSKey,
    encoding: 'hex'
});

// from String
var bufferData = getPacketString ();

var packet = new LoRaPacket (bufferData, {
    nwkSKey,
    appSKey,
    encoding: 'hex'
},
{
    encoding: 'base64'
});

Encode data

var LoRaPacket = require ('lorapacket');

var nwkSKey = getNwkSKey ();
var appSKey = getAppSKey ();

var packet = new LoRaPacket ({
        mtype: LoRaPacket.MTYPE.MTYPE_UNCONFIRMEWD_DATA_DOWN,
        devAddr: '010A020A',
        fCtrl:
        {
            adr: 0),
            adrAckReq: 0,
            ack: 0,
            pending: 0,
            fOptsLen: 0
        },
        fCnt: 1,
        fPort: 2,
        frmPayload: new Buffer ('packet buffer')
    }, {
        nwkSKey,
        appSKey,
        encoding: 'hex'
    }
    );

© 2017 Wyliodrin SRL

About

LoRa WAN Packet decoder / encoder

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.8%
  • HTML 0.2%