Bluetooth.CHAR_NOTIFY_EVENT When triggered
-
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
-
@Little-Freak
https://docs.pycom.io/firmwareapi/pycom/network/bluetooth/gattscharacteristic/#characteristiccallbacktriggernone-handlernone-argnone
-
@Gijs where can i find a documentation, where the trigger is discribed?
-
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
-
@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)
-
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 whetherConnected to FiPy 45
is printed on the Client?Im not sure what you mean with
char.read()
?
-
@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
-
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