Skip to content

Instantly share code, notes, and snippets.

@mastier
Created July 1, 2017 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mastier/1d874dc5ce2acca5d7672c7171b71464 to your computer and use it in GitHub Desktop.
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
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