Created
June 14, 2017 09:28
-
-
Save electronut/8921d2ed70ad17bdfb593db7902895e1 to your computer and use it in GitHub Desktop.
Process BLE UUID to code format...
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
""" | |
process_uid.py | |
eg. | |
Input: 80c4a66b-ddb7-46e3-87bc-ae7053faf6ee | |
Output: 0xee,0xf6,0xfa,0x53,0x70,0xae,0xbc,0x87,0xe3,0x46,0xb7,0xdd,0x6b,0xa6,0xc4,0x80 | |
electronut.in | |
""" | |
import sys | |
if (len(sys.argv) < 2): | |
print("missing args!") | |
exit(0) | |
# expecting something like "80c4a66b-ddb7-46e3-87bc-ae7053faf6ee" | |
a = sys.argv[1] | |
a = a.replace("-","") | |
b = [a[i:i+2] for i in range(0, len(a), 2)][::-1] | |
c = ",".join(["0x%s" % x for x in b]) | |
print(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment