bluetooth.service and characteristic correlation
-
This is my code to set BLE settings..i do not see how these values relate to what my mobile app detects...see image
https://www.dropbox.com/s/ojsv2y2abxxspn9/tempFileForShare_20171130-235653.jpg?dl=0
bluetooth.set_advertisement(name=devicename, service_uuid=b'1234567890123456') bluetooth.callback(trigger=Bluetooth.CLIENT_CONNECTED | Bluetooth.CLIENT_DISCONNECTED, handler=conn_cb) bluetooth.advertise(True) srv1 = bluetooth.service(uuid=b'1234567890123456', isprimary=True) chr1 = srv1.characteristic(uuid=b'ab34567890123456', value=5) char1_read_counter = 0 char1_cb = chr1.callback(trigger=Bluetooth.CHAR_WRITE_EVENT | Bluetooth.CHAR_READ_EVENT, handler=char1_cb_handler) srv2 = bluetooth.service(uuid=1234, isprimary=True) chr2 = srv2.characteristic(uuid=4567, value=0x1234) char2_read_counter = 0xF0 char2_cb = chr2.callback(trigger=Bluetooth.CHAR_READ_EVENT, handler=char2_cb_handler) -
@misterlisty
When you do this:b'1234567890123456')
You're creating a list of bytes based on the ASCII value of each digit (1 = 0x31, 2=0x32 3=0x33 etc)
Your phone however shows you the hexadecimal representation of each byte. It also has a different byte ordering but you can see the b'123...' in "...33-3231" - it's just in reverse order
See my previous post on how to produce services that look as you expect:
https://forum.pycom.io/post/3279
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login