Documentation (Beta)
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Pass-Through Converter v2

Pass-Through Converter is used when device payload should not be decoded and encoded by Network Server.

Decoder:

function decodeUplink(input){}

    // input object structure:
    // - bytes - int[]
    // - fPort - int
    // - recvTime - Date (needs type check)
    // - tektelicMetadata - Object

    if (input.recvTime instanceof Date) {
        // date operations
    }

    var arr = [];
    for (var i = 0; i < input.bytes.length; ++i) {
        arr.push(input.bytes[i]);
    }
    // output object structure:
    // - data - Object
    // - errors - string[]
    // - warnings - string[]
    // - tektelicMetadata - Object
    return {
        "data": {"bytes":arr},
        "errors": [],
        "warnings": [],
        "tektelicMetadata": input.tektelicMetadata
    };

Encoder:

function encodeDownlink(input){}

    // input object structure:
    // - data - Object (customer-defined)


    // output object structure:
    // - fPort - int
    // - bytes - int[]
    // - errors - string[]
    // - warnings - string[]
    return {
        "fPort": 0,
        "bytes": input.data.bytes, // NOTE: bytes are integers 0..255 (according to Lora Codec API specification)
        "errors": [],
        "warnings": []
    };