I am writing a Linux application using the gattlib library in python3 to send and receive user inputted data between a BlueSnap DB9 BLE adapter and my Linux device. I have been able to successfully send a String of data to the adapter from my device and seen the output on the adapter's terminal, but I am having issues receiving data from the adapter.
I am following this example for reading and writing data using the gattlib library. I can write data using the write_cmd and write_by_handle functions but I am unable to read data or enable notifications with gattlib using any of the read functions mentioned there. Notifications don't appear to be enabled when using gattlib because the on_notification function I overwrote doesn't print out the print statement I added there.
I have determined that the handles for writing and reading data are 0x0043 and 0x0046, respectively. Here are the UUIDs for writing and reading that serialio provided to me: UUIDs.
When using bluetoothctl, after selecting the characteristic, I am able to write data to the adapter. Only after enabling notifications on bluetoothctl, only then am I able to read data as well. Once I disable notifications, attempting to read manually prints out all 0s instead of the data I want to read. What is the proper way to select a characteristic and enable notifications using gattlib in python3?
UPDATE: I was able to get notifications enabled. I ran hcidump on both bluetoothctl and my python code and determined the handle I had used for enabling notifications was incorrect. The correct handle for enabling notifications is 0x0047. Once I realized this mistake, I ran enable_notifications using the correct handle and set both parameters to True and was able to enable notifications and see incoming data on my device's terminal as I typed it on my adapter's terminal.
                        
Not using
gattlibbut here is an example of using the Python3 D-Bus bindings and the GLib event loop to read, write and get notifications from GATT characteristics.