Skip to content

TWTG-R-D-B-V/lorawan-payload-codec-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoRaWAN Payload Codec Tools

This project contains tools for TS013-1.0.0 Payload Codec API

The tools are compliant with the LoRaWan definition, except for these known deviations:

  1. In Table 4 the fPort for encodeDownlink is M (mandatory), while the description adds if no error occurred. Therefore we threat fPort for encodeDownlink as Ms (mandatory when successful).
  2. In 6.2.1 Payload Examples the input.bytes and output.bytes are set as an array of numbers. For readability if the JSON example we define them as a hexadecimal string.

Project Requirements

  • Node 18+
  • NPM 8+

Project setup

You need to pull in some libraries first.

> npm install

Tools

Validate examples

This project contains the JSON schema for the examples: here.

To validate all examples (which include bad structures):

> npm run validate-examples -- examples

This will result in the following output:

ValidationError {
  path: [ 1, 'input', 'bytes' ],
  property: 'instance[1].input.bytes',
  message: 'is not of a type(s) string',
  schema: {
    description: 'the uplink/downlink payload expressed in hexadecimal',
    type: 'string'
  },
  instance: [ 1, 2, 3 ],
  name: 'type',
  argument: [ 'string' ],
  stack: 'instance[1].input.bytes is not of a type(s) string'
}
Failed on file: examples/bad/neon-tt-v4_uplink_no-hex-string.json

To validate only the good examples:

> npm run validate-examples -- examples/good

To validate only one bad examples:

> npm run validate-examples -- examples/bad/neon-tt-v4_encode-error_not-an-array.json

Combine into one examples.json

As per specification all examples need to be packed into one examples.json in the root of the codec. This tool takes all the examples from one folder and places them into one file.

> npm run export-examples -- examples/good examples.json

About

Tools to work with LoRaWAN Payload Codec

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors