Conduit AEP + RN2483 base64 decoding problem
Home › Forums › Conduit: AEP Model › Conduit AEP + RN2483 base64 decoding problem
- This topic has 4 replies, 2 voices, and was last updated 9 years ago by
Radim Malinowski.
-
AuthorPosts
-
January 18, 2017 at 2:21 am #16364
Radim Malinowski
ParticipantHello,
I am facing the problem during decoding Base64 data received from Microchip RN2483.
When I send byte with value higher than 0x7F I get 0xef or 0xbf or 0xbd value in NodeRed message payload.
Example
RN2483: mac tx cnf 25 AABBCC
Conduit “up” topic output: {“chan”:7,”cls”:0,”codr”:”4/5″,”data”:”qrvM”,”datr”:”SF7BW125″,”freq”:”869.9″,”lsnr”:”9″,”mhdr”:”8001000000000b00″,”modu”:”LORA”,”opts”:””,”port”:25,”rfch”:1,”rssi”:-93,”seqn”:11,”size”:4,”timestamp”:”2017-01-18T08:46:42.811087Z”,”tmst”:4164092996} (received data are correct – Base64 encoding)
Conduit Node-Red msg payload decoded to hex:
efbfbd (wrong data)*function used to decode:
var payloadRawData = new Buffer(msg.payload);
msg.payload = payloadRawData[0].toString(16) + payloadRawData[1].toString(16) + payloadRawData[2].toString(16);
return msg;Any idea what could be wrong?
Best regards
Radim MalinowskiJanuary 23, 2017 at 10:02 am #16434Radim Malinowski
ParticipantIs there anyone who could help? Thank you?
Best regards
Radim MalinowskiJanuary 23, 2017 at 11:55 am #16435Peter Ferland
BlockedDo you see any different output if instead of:
var payloadRawData = new Buffer(msg.payload);
You use
var payloadRawData = new Buffer(msg.payload, 'base64');January 25, 2017 at 3:21 am #16463Radim Malinowski
ParticipantHello Peter,
yes I do. When
var payloadRawData = new Buffer(msg.payload, 'base64');is used the attempts to convert payloadRawData to stringmsg.payload = payloadRawData[0].toString(16) + payloadRawData[1].toString(16) + payloadRawData[2].toString(16);returns error TypeError: Cannot call method ‘toString’ of undefined.
I am not sure but I think that NodeRed msg.payload is not base64 encoded. The important information I need to know to solve this issue is how the LoRa received packet is proccessed before data is visible in the NodeRed envoronment (whole chain). Is it possible to send me this information?
One more note. Bassically every byte above the scope of ASCCI table (0x00 – 0x7F) is received wrong in the NodeRed.
Thank you.
Best regards,
Radim Malinowski-
This reply was modified 9 years ago by
Radim Malinowski.
January 25, 2017 at 5:31 am #16465Radim Malinowski
ParticipantHello again,
I have already found a solution. NodeRed LORA input node is configurable regarding to the received data type (did not know). Data type is either UTF-8 or Bytes. After I set data type to Bytes everything seems to work properly.
Have a nice day.
Best regards,
Radim Malinowski -
This reply was modified 9 years ago by
-
AuthorPosts
- You must be logged in to reply to this topic.