1 of 1 people found this helpful
The UART BLE Central project is a GATT Client. Which means it can perform read and write on the peripheral device and accpet notifications from the peripheral.
So the mobile app peripheral must act as a GATT Server (Receives write from the Cypress Device and sends notifications to the Cypress device).
Instead of sending notifications from the android app, are you trying to send write? If so the write would fail.
You need to send notifications from the android app which will trigger a CYBLE_EVT_GATTC_HANDLE_VALUE_NTF event in the app_ble.c of the UART Central project and is in turn handled by the HandleUartRxTraffic API.
- Madhu Sudhan
This is very insightful information, as I was indeed trying to update with the "WriteNoResponse" CDD2 characteristic and then updating the service. I will modify my code to send updates using Notifcations only which is the "Notify" CDD1 characteristic.
I will keep everyone posted with my progress.
Your counci was superb. That is exactly what I was doing. And your instruction to use the notification characteristic worked perfectly. I can now recieve writechar requests as well as send notifications to the cypress device.
thank you again for your help.
I have a puzzling question for you. Why am able to send notifications from my Peripheral to Central only once?
For some reason right after I connect to the device over BLE. I get a Descriptor Write Request from the Central [1,0] and then I complete the request and send back informaiton by changing my value in the characteritic(CDD1) and send notificaiton, I succesfully get the expected response. However, when I try to send a second notification, it fails. I recieve nothing back. Is this happening because I am no longer getting Descriptor Write requests from the client? Are all notifications handled by the CYBLE_EVT_GATTC_HANDLE_VALUE_NTF event?
Please let me know what you think about this.
Are you waiting for the "onNotificationSent" callback function to be invoked before sending the second notification?
When multiple notifications are to be sent, an application must wait for this callback to be received before sending additional notifications.
Please refer the below code example for an android peripheral device.
Actually you need to refer this file - > ble-test-peripheral-android/Peripheral.java at master · WebBluetoothCG/ble-test-peripheral-android · GitHub
Yes I am waiting for this waiting for the "onNotificationSent" callback. In fact I am adding a delay of 2000ms between each call as I realize there is a delay with the device after each notification. I wonder if the issue is how the device is reading chars from the stack. It is reading this from a function called "scang_num". I wonder if the Char I am sending is not getting matched in here. I am sending this
"1".getbytes() in Java which should equate to . My problem is I am not sure if this being read from the CYBLE_EVT_GATTC_HANDLE_VALUE_NTF handle event anymore, once the connection and descriptor write request has been made.
void scang_num(auto const rom char *sg_string, unsigned char *sg_addr)
unsigned char in_num = 0;
unsigned int ret_num = 0;
printg(sg_string); //print string
putcharg('?'); //print "?"
in_num = getcharg();
if ((in_num >47) && (in_num <58) ) //if ASCII number
ret_num = (ret_num*10) + (unsigned int)(in_num-48);
while ((in_num != 13) & (in_num != 10)); //until EOL
if (ret_num > 255) ret_num = 255; //if greater than 255 set = 255
*sg_addr = (unsigned char) ret_num;
putcharg('\n'); //print carriage return
I figured out the problem... I was not send the "\n" new line feed or "End of statement" command. Everything is working as expected now!