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


#1

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.


#2

please help me, i’m really stocked


#3

@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);