Skip to content

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)

varLoRaPacket=require('lorapacket');varnwkSKey=getNwkSKey();varappSKey=getAppSKey();// from BuffervarbufferData=getPacketBuffer();varpacket=newLoRaPacket(bufferData,{
nwkSKey,
appSKey,encoding: 'hex'});// from StringvarbufferData=getPacketString();varpacket=newLoRaPacket(bufferData,{
nwkSKey,
appSKey,encoding: 'hex'},{encoding: 'base64'});

Encode data

varLoRaPacket=require('lorapacket');varnwkSKey=getNwkSKey();varappSKey=getAppSKey();varpacket=newLoRaPacket({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: newBuffer('packet buffer')},{
nwkSKey,
appSKey,encoding: 'hex'});

© 2017 Wyliodrin SRL

About

LoRa WAN Packet decoder / encoder

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages