Conduit AEP + RN2483 base64 decoding problem

Home Forums Conduit: AEP Model Conduit AEP + RN2483 base64 decoding problem

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #16364
    Radim Malinowski
    Participant

    Hello,

    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 Malinowski

    #16434
    Radim Malinowski
    Participant

    Is there anyone who could help? Thank you?

    Best regards
    Radim Malinowski

    #16435
    Peter Ferland
    Blocked

    Do you see any different output if instead of:
    var payloadRawData = new Buffer(msg.payload);
    You use
    var payloadRawData = new Buffer(msg.payload, 'base64');

    #16463
    Radim Malinowski
    Participant

    Hello Peter,

    yes I do. When var payloadRawData = new Buffer(msg.payload, 'base64'); is used the attempts to convert payloadRawData to string

    msg.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

    #16465
    Radim Malinowski
    Participant

    Hello 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.