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.CHAR_NOTIFY_EVENT When triggered

    Scheduled Pinned Locked Moved LoPy
    8 Posts 3 Posters 69 Views 3 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.
    • L Offline
      Little Freak
      last edited by

      Hey, I am trying this Tutorial https://docs.pycom.io/tutorials/networks/ble/callback/ and it doesn't execute the char_notify_callback function in the client.

      So my question is, when does the Bluetooth.CHAR_NOTIFY_EVENT get triggered?
      Where can I find the source code of the network lib?

      I use 2 LoPys, one of them is the client and the other one the server

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by

        Could you perhaps add some print statements to see where the code stops?

        When trying this example, I did have some difficulty syncing both devices up (with correct connection / disconnection status) But was able to make it work

        L 1 Reply Last reply Reply Quote 0
        • L Offline
          Little Freak @Gijs
          last edited by

          @Gijs in the client I never get in the char_notify_callback method and also never send a read request.
          If I try a char.read() after the line, where I call the Callback method, then I get this error:

          Unhandled exception in callback handler
          TypeError: function takes 2 positional arguments but 1 were given

          1 Reply Last reply Reply Quote 0
          • G Offline
            Gijs
            last edited by

            Are you running the same firmware on both devices, I tried with the latest stable release, 1.20.2.r4. Also, could you check whether the conn_cb is triggered on the Server device, and whether Connected to FiPy 45 is printed on the Client?

            Im not sure what you mean with char.read()?

            L 1 Reply Last reply Reply Quote 0
            • L Offline
              Little Freak @Gijs
              last edited by

              @Gijs An update fixed my problem, thank you.
              Do you know, when this in the server is triggered?

              chr1.callback(trigger=(Bluetooth.CHAR_READ_EVENT | Bluetooth.CHAR_SUBSCRIBE_EVENT), handler=chr1_handler)

              1 Reply Last reply Reply Quote 0
              • G Offline
                Gijs
                last edited by

                When you read the characteristic. The actual reading is done at conn.services(), but we later register the callback on the Client side. a CHAR_READ_EVENT triggers the callback on the server side to send data

                L 1 Reply Last reply Reply Quote 0
                • L Offline
                  Little Freak @Gijs
                  last edited by

                  @Gijs where can i find a documentation, where the trigger is discribed?

                  L 1 Reply Last reply Reply Quote 0
                  • L Offline
                    livius @Little Freak
                    last edited by

                    @Little-Freak
                    https://docs.pycom.io/firmwareapi/pycom/network/bluetooth/gattscharacteristic/#characteristiccallbacktriggernone-handlernone-argnone

                    think about people first, then computers

                    1 Reply Last reply Reply Quote 1

                    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