Closed ivogeorg closed 2 years ago
The Adafruit RockBLOCK library limits the text to send to 120 bytes (len(text) > 120
). When a message is sent adhering to this length, it appears normally as text: 2022-01-22 14:38:29,8.71,7.21,26600,35.9,843.61...
. If this limit is removed, for example to allow the stated outgoing length of 340, the message arrives unencoded (ASCII character codes in hex, appended together with no spaces): 323032322d30312d32322031343a34313a35392c372e38342c362e38372c3135323631302c33382e31392c3834332e353...
.
The non-encoding is evident in this view...
Interestingly enough, the email with the message contains both the unencoded hex data and the encoded text.
The format in which the message is sent is just a hex string. To decode it to a Python string, use the following code:
message = "323032322d30312d32322031343a34323a35342c372e372c362e392c33313935392c33382e33352c3834332e362c313531392e31382c2d302e32332c322e38382c2d392e34382c302e30322c2d302e30322c2d302e302c342e30352c362e332c2d35352e36352c342e39382c3735332e382c332e37372c32392e320a"
enc_string = bytes.fromhex(message)
dec_string = enc_string.decode("ascii")
print(dec_string)
# 2022-01-22 14:42:54,7.7,6.9,31959,38.35,843.6,1519.18,-0.23,2.88,-9.48,0.02,-0.02,-0.0,4.05,6.3,-55.65,4.98,753.8,3.77,29.2
Hack in /usr/local/lib/python3.9/dist-packages/adafruit_rockblock.py
: changed enforced byte limit for text in text_out
setter. To remove/improve in #76.
Description
blinka
library.Knowledge
Deliverables