Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Codec Uplink Decoder

Code Block
languagejs
function Decode(fPort, bytes) {
  switch (fPort) {
    case 1:
      {
        var output = {};

        output.DEV_EUI = LoRaObject.devEUI;
        output.RSSI = LoRaObject.rxInfo[0].rssi;
        output.SNR = LoRaObject.rxInfo[0].loRaSNR;
        output.Data = LoRaObject.data;
        output.ADR = LoRaObject.txInfo.adr;
        output.coderate = LoRaObject.txInfo.codeRate;
        output.FCnt = LoRaObject.fCnt;
        output.Port = LoRaObject.fPort;
        output.Frequency = LoRaObject.txInfo.frequency;
        output.Modulation = LoRaObject.txInfo.dataRate.modulation;
        output.Bandwidth = LoRaObject.txInfo.dataRate.bandwidth;
        output.SpreadingFactor = LoRaObject.txInfo.dataRate.spreadFactor;

        output.Ambient_Temperature = bytes[0] * 0.25;
        output.PIR_Status = bytes[1]>>5 & 0x01;
        output.Energy_Storage_Low = bytes[1]>>4 & 0x01;
        output.Radio_Communication_Error = bytes[1]>>3 & 0x01;
        output.Radio_Signal_Strength = bytes[1]>>2 & 0x01;
        output.PIR_Sesnor_Failure = bytes[1]>>1 & 0x01;
        output.Ambient_Temperature_Failure = bytes[1] & 0x01;
        output.Storage_Voltage = Number((bytes[2]*0.02).toFixed(2));
        output.Set_Point_Temperature_Value = bytes[3];

        return output;
      }
    default:
      return {
        errors: ['unknown FPort'],
      };
  }
}

mlrtps_codec.pngImage Added

mlrtps_packet.pngImage Added

mlrtps_bacnet.pngImage Added

mlrtps_bacnet_explorer.pngImage Added