Base64 Payload codec ( B-L072Z-LRWAN1 end node )

Hello everyone,

  • i use B-L072Z-LRWAN1 with " I-CUBE-LRWAN" software.

  • when i use the “AT slave exemple”, i can receive the right data from my nod to my php page that decode the JSON array and then i use this function to decode the base64 :

    $payload = file_get_contents(‘php://input’);
    $var = json_decode($payload,true);
    .
    .
    .
    $data64 = $var[‘data’];
    $data = base64_decode($data64); // decode function

    But when i use the " End_Node exemple " , i can’t decode the data with my php function that i had present, i have this result :

I noticed that in the" end-node program" there is a function that does this before sending the data :

temperature = 20; /* in °C * 100 /
pressure = 30; /
in hPa / 10 /
humidity = 40; /
in %*10 */
uint32_t i = 0;
AppData.Buff[i++] = AppLedStateOn;
AppData.Buff[i++] = ( pressure >> 8 ) & 0xFF;
AppData.Buff[i++] = pressure & 0xFF;
AppData.Buff[i++] = ( temperature >> 8 ) & 0xFF;
AppData.Buff[i++] = temperature & 0xFF;
AppData.Buff[i++] = ( humidity >> 8 ) & 0xFF;
AppData.Buff[i++] = humidity & 0xFF;
AppData.BuffSize = i;
LORA_send( &AppData, LORAWAN_DEFAULT_CONFIRM_MSG_STATE);

I have read all the other topic on the forum, but I have not found an answer to my need, please help me, thanks.

please help me, i’m really stocked

@brocaar ! can you please help to decode the data stored from this :

temperature = 20; /* in °C * 100 /
pressure = 30; /
in hPa / 10 /
humidity = 40; /
in %*10 */
uint32_t i = 0;
AppData.Buff[i++] = AppLedStateOn;
AppData.Buff[i++] = ( pressure >> 8 ) & 0xFF;
AppData.Buff[i++] = pressure & 0xFF;
AppData.Buff[i++] = ( temperature >> 8 ) & 0xFF;
AppData.Buff[i++] = temperature & 0xFF;
AppData.Buff[i++] = ( humidity >> 8 ) & 0xFF;
AppData.Buff[i++] = humidity & 0xFF;
AppData.BuffSize = i;
LORA_send( &AppData, LORAWAN_DEFAULT_CONFIRM_MSG_STATE);

Did you get any solution to this problem? I’m with the same. Could u please help-me?

I got a solution to the problem. All the examples that ST provide the data sent from the sensors are in HEX, that is, you have to decode the base64 to HEX and find out which HEX is your data, in my case it was the fourth.