You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no need for two different decoders, especially since this creates the chance of error where the actual payload decoding does not match.
Chirpstack v3 calls this function:
// 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]
// - variables contains the device variables e.g. {"calibration": "3.5"} (both the key / value are of type string)
// The function must return an object, e.g. {"temperature": 22.5}
function Decode(fPort, bytes, variables) {
return {};
}
Chirpstack v4 calls this function:
// Decode uplink function.
//
// Input is an object with the following fields:
// - bytes = Byte array containing the uplink payload, e.g. [255, 230, 255, 0]
// - fPort = Uplink fPort.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - data = Object representing the decoded payload.
function decodeUplink(input) {
return {
data: {
temp: 22.5
}
};
}
A single decoder file may contain both functions, which call a single actual decoding code.
Thus a single file will serve for both v3 and v4, allowing MileSight to make changes to a single file and users to use a single file, preventing errors.
The text was updated successfully, but these errors were encountered:
There's no need for two different decoders, especially since this creates the chance of error where the actual payload decoding does not match.
Chirpstack v3 calls this function:
Chirpstack v4 calls this function:
A single decoder file may contain both functions, which call a single actual decoding code.
Thus a single file will serve for both v3 and v4, allowing MileSight to make changes to a single file and users to use a single file, preventing errors.
The text was updated successfully, but these errors were encountered: