LoRaWAN packet decoder

A frontend towards lora-packet.

 
Assuming base64-encoded packet
YCkuASYgAwDQNni9

Message Type = Data
  PHYPayload = 60292E0126200300D03678BD

( PHYPayload = MHDR[1] | MACPayload[..] | MIC[4] )
        MHDR = 60
  MACPayload = 292E0126200300
         MIC = D03678BD

( MACPayload = FHDR | FPort | FRMPayload )
        FHDR = 292E0126200300
       FPort = 
  FRMPayload = 

      ( FHDR = DevAddr[4] | FCtrl[1] | FCnt[2] | FOpts[0..15] )
     DevAddr = 26012E29 (Big Endian)
       FCtrl = 20
        FCnt = 0003 (Big Endian)
       FOpts = 

Message Type = Unconfirmed Data Down
   Direction = down
        FCnt = 3
   FCtrl.ACK = true
   FCtrl.ADR = false

Note that erroneous packets are likely to show incorrect results: lora-packet can also validate the packet's integrity and decrypt the payload if you know the node's secrets. Or to install it as a command line utility:

  • install Node.js and npm
  • run: npm install -g lora-packet
  • run: lora-packet-decode --base64 ADFGUkFEshgAdAoAAACyGADXQ5rzpZs=
    or lora-packet-decode --hex 003146524144B21800740A000000B21800D7439AF3A59B (beware that removing leading zeroes affects proper decoding)