Created
July 1, 2017 11:37
-
-
Save mastier/1d874dc5ce2acca5d7672c7171b71464 to your computer and use it in GitHub Desktop.
Calculates text response from Huawei E3372 modem SMS in text mode (AT+CMGF=1) to readable one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def huawei_sms2txt(bytes): | |
""" | |
Calculates text response from Huawei E3372 modem SMS in text mode (AT+CMGF=1) | |
to readable one | |
""" | |
return ''.join([ | |
y for e,y in enumerate(chr(int(x,16)) | |
for x in re.findall(r'\w{2}', bytes)) if e % 2 != 0]) | |
if __name__ == "__main__": | |
huawei_sms2txt(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment