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

    bluetooth.set_advertisement(name=devicename, service_uuid=b'1234567890123456')
    bluetooth.callback(trigger=Bluetooth.CLIENT_CONNECTED | Bluetooth.CLIENT_DISCONNECTED, handler=conn_cb)
    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:


    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:


Pycom on Twitter