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:
- In
Table 4thefPortforencodeDownlinkisM(mandatory), while the description addsif no error occurred. Therefore we threatfPortforencodeDownlinkasMs(mandatory when successful). - In
6.2.1 Payload Examplestheinput.bytesandoutput.bytesare set as an array of numbers. For readability if the JSON example we define them as a hexadecimal string.
- Node 18+
- NPM 8+
You need to pull in some libraries first.
> npm installThis project contains the JSON schema for the examples: here.
To validate all examples (which include bad structures):
> npm run validate-examples -- examplesThis 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.jsonTo validate only the good examples:
> npm run validate-examples -- examples/goodTo validate only one bad examples:
> npm run validate-examples -- examples/bad/neon-tt-v4_encode-error_not-an-array.jsonAs 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