LoraPacket decoder
Python library for decoding LoraWAN 1.0. protocol messages
Example usage
The RAW HTTP response data of the LoraWAN concentrator containing the data RAW_LORA_DATA = 'HTTP/1.1 200 OK Date: Mon, 27 Jul 2009 12:28:53 GMT Server: Apache/2.2.14 (Win32) Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT Content-Length: 88 Content-Type: text/html Connection: Closed <?xml version="1.0" encoding="UTF-8"?>2015-06-04T22:25:04.417+02:0000000000ABBA00051010074696d0ded3b347834b034b91000000065-76.0000009.5000007G1LC312900000b52.0701184.4787492900000b-76.0000009.500000100000571{"alr":{"pro":"MC/IOT","ver":"1"}}'
Define a format for the package. This can also be done after initialization of the decoder class, for example if you wish to select for format based on UID, customerID or customerData LPformat = loraPayLoad()
Define format items as , , LPformat.addItem('TEMP', 1, 'INT') # Add item TEMP that is represented in the first byte as an integer in the payload LPformat.addItem('HUM', 1, 'INT') # Add item HUM that is represented in the second byte as an integer in the payload
Define a new loraPacketDecoder class Lp = loraPacketDecoder(RAW_LORA_DATA, LPformat)
## Lp.setFormat(LPformat) # for setting the format after initialization
Print the received data using the format
for (key, value) in lpD.getPayloadItems().iteritems():
print key, value