I am a python beginner, I read a lot of related questions, but they all ask us to look heart_rate_collector.py , but heart_rate_collector.py did't not have any example, i really don't understand how to used it.
I am a python beginner, I read a lot of related questions, but they all ask us to look heart_rate_collector.py , but heart_rate_collector.py did't not have any example, i really don't understand how to used it.
Hi,
The pc-ble-driver-py is a python wrapper for the pc-ble-driver, and the heart_rate_collector.py is the included example that demonstrate how to use it. In other words, heart_rate_collector.py is the example.
I did not understand the question other than that, though. What is it you are wondering about? As you mention on_notification, this is a function that is called whenever a notification is received, and it prints the connection handle, the UUID that got notified and the data that was notified (i.e. the received data).
How do I get notification from (uuid:0xfff6) and read data.
I think "on_notification" can only show the data what i gave it(hightlight).
on_notification(self, ble_adapter, conn_handle, uuid, data)
So my question is how to get the 'data'?
I have use "self.adapter.enable_notification(new_conn, self.nus_tx)"
I don't immediately see an issue here. I suggest you take a look at this post, which includes a working script that use NUS, and enables notifications (obviously you need to change the UUID and UUID base for your custom service).
OK thank you for reply
will enable_notification() open the CCCD?'
if it will open CCCD ,will it also open the custom service CCCD?
I mean can I open CCCD manual? Is the write_cmd() function?
Enabling notifications effectively writes to the CCCD, yes. And yes, you can write to it directly without using the enable_notification() function if you like (just look at the implementation of that function in ble_adapter.py).
I have sole the problem, my UUID setting are right, I add a "self.adapter.att_mtu_exchange(new_conn,247)",before
I have sole the problem, my UUID setting are right, I add a "self.adapter.att_mtu_exchange(new_conn,247)",before