Passing Strings over BLE

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RoSy_3754371
Level 1
Level 1
First like given

I am attempting develop a project that passes temperature and humidity data from one PSoC 6 device to another, with the data in the form of strings.

To achieve this i have added extra functionality to the Find Me project. Currently, I have created a custom service for a peripheral device that reads "Hello World" from the PSoC to the CySmart Android Application.

I want to send a byte (eventually evolving into a string for UART output) in the opposite direction that will simply light an LED (or something else). I have ran into a wall and am not sure how to develop the write event handler.

Any help would be appreciated, I understand this might be a rudimentary task but I just can  not figure out what I am meant to do next. 

Thanks

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

You can send strings over BLE without any problem. But to design this application you have to decide which is going to be Central, peripheral, Client and Server. I recommend you to use the Peripheral + Server combination for the device which is going to be connected to sensors.

The BLE Find me code example that you are using is a Peripheral as well as Server. As f now you are able to read the String data from the Mobile phone. Great !!

To initiate the data transfer in the reverse direction, you have to enable the notification for the string characteristic. After enabling the notification, you will get another Client Characteristic configuration descriptor. You can enable the notifications in the client characteristic configuration descriptor (CCCD).

One you have done this you can use the API Cy_BLE_GATTS_SendNotification() whenever you want to initiate the transaction from the peripheral.

Please find the attached project where the notifications are sent upon triggering the button interrupt on the peripheral side.

Thanks

Ganesh

View solution in original post

1 Reply
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

You can send strings over BLE without any problem. But to design this application you have to decide which is going to be Central, peripheral, Client and Server. I recommend you to use the Peripheral + Server combination for the device which is going to be connected to sensors.

The BLE Find me code example that you are using is a Peripheral as well as Server. As f now you are able to read the String data from the Mobile phone. Great !!

To initiate the data transfer in the reverse direction, you have to enable the notification for the string characteristic. After enabling the notification, you will get another Client Characteristic configuration descriptor. You can enable the notifications in the client characteristic configuration descriptor (CCCD).

One you have done this you can use the API Cy_BLE_GATTS_SendNotification() whenever you want to initiate the transaction from the peripheral.

Please find the attached project where the notifications are sent upon triggering the button interrupt on the peripheral side.

Thanks

Ganesh