FRMPayload to Bytes

Hello at all

I have a question to understand the whole process of data transfer…

My Node sends a Lora Package to the Gateway with the following data:


i use the webside to decode this package.
This image shows the decoding:

this shows that the FRMPayload is CC64465B1EA090AAAAAE119C

on LoraAppServer i see the following:

this shows under frmPayload bytes: zGRGWx6gkKqqrhGc

So how does it work that “CC64465B1EA090AAAAAE119C” becomes “zGRGWx6gkKqqrhGc”?

Thanks and regards,

Packets or their payloads often contain binary data of unknown meaning. For transmission through textual protocols such as json-over-mqtt they are often base64 encoded.

I’ve always thought displaying the base64 coding, and not hex made the web interface less usable. It would be wonderful if there were an option somewhere to switch it.

thx @cstratton

maybe a next question :slight_smile:

i now have the bytes “zGRGWx6gkKqqrhGczGRGWx6gkKqqrhGc”

this goes to the application and will be decoded by the 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]
// The function must return an object, e.g. {“temperature”: 22.5}

Here is written that the bytes is a array of bytes (numbers)… how does this work:

from “zGRGWx6gkKqqrhGczGRGWx6gkKqqrhGc” to "[some,numbers,here]?


It’s been a while since I’ve worked with them, but I believe the in-server javascript decoder is fed a binary vector, not a base64 representation. You probably want to look for some examples, especially of how to decode different data types, ie, big/little endian signed/unsigned 8/16/32 bit etc. Note it is very easy to get this code wrong in subtle ways that only show up some of the time (classic would be mistakenly sign extending low bytes)

In contrast if you have something running as a distinct program receiving data via mqtt, that would get the base64 encoded version.

@sil please see: This question has been posted a few times in different topics. I believe I have posted a code example somewhere to convert from HEX <> base64 + how to use the JS codec.