I have problem with running the gattlib nordic_uart.c example on an RPi4B+ using Bluez 5.50. The gattlib is cloned and compiled on the RPi according to the gattlib installation instructions.
I am running towards a nrf pheripheral device based on the nordic-uart ble stack, modified to automatically streams its data over ble, once connected.
Next, using the gatttool, I enables the receive notification by sending the following to my nordic device:
char-write-req 0x10 0100
and where data is received as expected:
[E7:76:98:F8:7A:70][LE]> char-write-req 0x10 0100
Characteristic value was written successfully
Notification handle = 0x000f value: 54 2c 31 35 2e 39 38 2c 32 31 2e 38 37 2c 32 30 2e 36 35 2c
Notification handle = 0x000f value: 54 2c 31 35 2e 34 38 2c 32 31 2e 38 37 2c 32 30 2e 36 35 2c
To debug, I modified the gattlib nordic_uart.c example to print the discovered characteristics. The gattlib nordic_uart.c example discovers two characteristics:
Next, the gattlib nordic_uart example enables notification of rx by
// Enable Status Notification
uint16_t enable_notification = 0x0001;
ret= gattlib_write_char_by_handle(m_connection, rx_handle+1 , &enable_notification, sizeof(enable_notification));
if (ret) {
fprintf(stderr, "Failed to write to handle. ErrorNo: %i \n", ret);
return 1;
}
In my case gattlib_write_char_by_handle(...) returns the error:
Failed to write to handle. ErrorNo: 2
ErrorNo 2 is : GATTLIB_NOT_FOUND, which is somehow as expected, since the handle rx_handle+1 probably does not exist. Looking at the output from the gatttools char-desc, I guess rx_handle+1 is ment to be the handle following the rx uuid 6e400003-... (handle 0x0010 to be specific).
Since the gatttool needed an input to handle 0x10 as 0100 and not 0001, I have also tried with
uint16_t enable_notification = 0x0100;
but with the same result.
I am new to the use of the gattlib, so if I have completely missed something, any help pointing me in the right direction of how to use gattlib to enable the rx notification of my datastream from the nordic pheripheral, would be very much appreciated.
I'm a little late in commenting on this. Has this issue been resolved? I am having a lot of challenges receiving any RX notifications. Are there any other workarounds to receive UART data? Many thanks!
I have problem with running the gattlib nordic_uart.c example on an RPi4B+ using Bluez 5.50. The gattlib is cloned and compiled on the RPi according to the gattlib installation instructions.
I am running towards a nrf pheripheral device based on the nordic-uart ble stack, modified to automatically streams its data over ble, once connected.
Using the gatttool everything works as it should:
Next, using the gatttool, I enables the receive notification by sending the following to my nordic device:
and where data is received as expected:
To debug, I modified the gattlib nordic_uart.c example to print the discovered characteristics. The gattlib nordic_uart.c example discovers two characteristics:
Next, the gattlib nordic_uart example enables notification of rx by
In my case gattlib_write_char_by_handle(...) returns the error:
Failed to write to handle. ErrorNo: 2
ErrorNo 2 is : GATTLIB_NOT_FOUND, which is somehow as expected, since the handle rx_handle+1 probably does not exist. Looking at the output from the gatttools char-desc, I guess rx_handle+1 is ment to be the handle following the rx uuid 6e400003-... (handle 0x0010 to be specific).
Since the gatttool needed an input to handle 0x10 as 0100 and not 0001, I have also tried with
uint16_t enable_notification = 0x0100;
but with the same result.
I am new to the use of the gattlib, so if I have completely missed something, any help pointing me in the right direction of how to use gattlib to enable the rx notification of my datastream from the nordic pheripheral, would be very much appreciated.