Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    bluetooth.service and characteristic correlation

    Scheduled Pinned Locked Moved MicroPython
    ble
    2 Posts 2 Posters 1.0k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      misterlisty
      last edited by misterlisty

      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)
      
      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jmarcelino @misterlisty
        last edited by

        @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

        1 Reply Last reply Reply Quote 0

        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
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom