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

    How to notify other BLE devices from Wipy

    Scheduled Pinned Locked Moved WiPy 2&3
    wipy 2.0gattcconnectionble send dataother
    2 Posts 2 Posters 923 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.
    • J Offline
      jmahesh
      last edited by jmahesh

      I have a bluetooth device to which I need to send notification.

      I have connected to a particular service and listed all the characteristic of that service.

      chars = service.characteristics()
      for char in chars:
      if (char.properties() & Bluetooth.PROP_READ):
      print('char if {} value = {}'.format(char.uuid(), char.read()))
      if (char.properties() and Bluetooth.PROP_NOTIFY):
      Need to send notification in this part
      char.write("b'\x01\x18'")

      I would like to know how to notify a device. When using .write I am getting an OSError.

      OSError: the requested operation failed

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jmarcelino @jmahesh
        last edited by jmarcelino

        @jmahesh
        You are connecting to GATT Server as client, so what you can do is request the server send you notifications. You can't send notifications as a client. Bluetooth.PROP_NOTIFY means you can request notifications on that characteristic.

        I'm guessing that characteristic is not writable (read only) hence you get that error?

        If what you want is to be notified by the Server (e.g. when the value changes) use the char.callback(trigger=Bluetooth.CHAR_NOTIFY_EVENT, handler=YourHandlerFunct, arg=YourOptionalArgument)

        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