dqg2269 2019-01-22 14:07
浏览 77

Base64有效载荷编解码器(B-L072Z-LRWAN1端节点)

  • I use the node B-L072Z-LRWAN1 with " I-CUBE-LRWAN" software.
  • I created my own lorawan network thanks to the project loraserver.io, all of lora server and lora app server are coded by go language, so Go by default encodes a byte array to base64 when encoding an object to JSON.

  • 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 : result of decoding of two exemple

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

#define LORAWAN_APP_DATA_BUFF_SIZE            64
static uint8_t AppDataBuff[LORAWAN_APP_DATA_BUFF_SIZE];
lora_AppData_t AppData={ AppDataBuff,  0 ,0 };
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);

this topic isfor those who know how data is encoded in both version of " I-CUBE-LRWAN"

Thanks for your help :).

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图