The only solution is to try to decode the examples locally with node.
This is the ‘master file’ with the payloads. Name it launch_decoder.js
// Trick from: https://stackoverflow.com/a/5809968
var fs = require('fs');
eval(fs.readFileSync("decoder.js")+'');
data = [ 0x02, 0x78, 0x87 ];
input = { fPort:"207", bytes:data };
var result = decodeUplink(input);
console.log(result);
data = [ 0x01, 0x05 ];
input = { fPort:"200", bytes:data };
var result = decodeUplink(input);
console.log(result);
data = [ 0x44, 0x5D, 0x64, 0x06, 0x12, 0x5D, 0x02, 0xAC, 0x02, 0x08, 0x59 ];
input = { fPort:"204", bytes:data };
var result = decodeUplink(input);
console.log(result);
data = [0x39, 0xc0, 0xdd, 0x10, 0x59, 0xf4, 0x00, 0x6b, 0x02, 0x65, 0x90];
input = { fPort:"204", bytes:data };
var result = decodeUplink(input);
console.log(result);
This is the decoder. Name it decoder.js
// https://forum.chirpstack.io/t/decoder-testing/10619/7
// Decode decodes an array of bytes into an object.
// - fPort contains the LoRaWAN fPort number
// - bytes is an array of bytes, e.g. [225, 230, 255, 0]
// The function must return an object, e.g. {"temperature": 22.5}
function decodeUplink(input) {
// return raw un-encrypted payload
// return { data: input };
/*
44 5D 64 06 12 5D 02 AC 02 08 59
445D6406125D02AC020859
"alt": 684,
"battery": "59",
"lat": "48.069016,
"lon": "8.538374",
"temp": 20.8
*/
var decoded = {};
if ( input.fPort == 204){
lat = input.bytes[0] << 16;
lat |= input.bytes[1] << 8;
lat |= input.bytes[2];
lat = lat/8388606 * 90;
if (lat > 90) lat -= 180;
decoded.latitude = lat.toFixed(6);
lon = input.bytes[3] << 16;
lon |= input.bytes[4] << 8;
lon |= input.bytes[5];
lon = lon/8388606 * 180;
if (lat > 180) lon -= 360;
decoded.longitude = lon.toFixed(6);
alt = input.bytes[6] << 8;
alt |= input.bytes[7];
decoded.altitude = alt;
temp = (input.bytes[8] & 0x0F) * 100;
temp += ((input.bytes[9] & 0xF0) >> 4 ) * 10;
temp += input.bytes[9] & 0x0F;
if( input.bytes[8] & 80)
temp /= -10;
else
temp /= 10;
decoded.temp = temp;
bat = ((input.bytes[10] & 0xF0) >> 4) * 10;
bat += input.bytes[10] & 0x0F;
decoded.battery = bat;
decoded.accuracy = 10;
}
else
if (input.fPort == 207 || input.fPort == 205){
temp = (input.bytes[0] & 0x0F) * 100;
temp += ((input.bytes[1] & 0xF0) >> 4 ) * 10;
temp += input.bytes[1] & 0x0F;
if( input.bytes[0] & 80)
temp /= -10;
else
temp /= 10;
decoded.temp = temp;
bat = ((input.bytes[2] & 0xF0) >> 4) * 10;
bat += input.bytes[2] & 0x0F;
decoded.battery = bat;
}
// if port 200 or 208 two bytes firmware version 0103 = 1.0.3 //
else
if (input.fPort == 200 || input.fPort == 208){
if ( input.bytes[1] < 10 )
decoded.firmware = input.bytes[0] + ".0." + input.bytes[1]
else
decoded.firmware = input.bytes[0] + "." + input.bytes[1] << 4; + "." + input.bytes[1];
}
return decoded;
}// function
Run node launch_decoder.js
to see the results.
Put in the data the data from examples and try to have the same results with the decoder.js
.