- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to connect to a Peripheral from a Central, write a value to a custom service characteristic and disconnect. I looked into the Day 6 sample ( from 100 projects in 100 days) and it looks like it's close to what I need.but it uses the Alert service and CyBle_IascSetCharacteristicValue() API. In my case there is a custom service and a characteristic (4 bytes)
Questions
1. What API should be used to write a custom service characteristic with known UUID of both?
2. The code in day 6 sample calls CyBle_GattcStartDiscovery. In my case, with UUID of the service and characteristic known, is there a need for that?
Thank you
Andy
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Can you look at this project:https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days/Day020_BLE...
This uses custome characteristic for sending data.
You can also have a look at the Application Note:http://www.cypress.com/documentation/application-notes/an91162-creating-ble-custom-profile
AN91162 - Creating a BLE Custom Profile
Thanks,
Hima
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Can you look at this project:https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days/Day020_BLE...
This uses custome characteristic for sending data.
You can also have a look at the Application Note:http://www.cypress.com/documentation/application-notes/an91162-creating-ble-custom-profile
AN91162 - Creating a BLE Custom Profile
Thanks,
Hima
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. You will want to use the function CyBle_GattcWriteCharacteristicValue(cyBle_connHandle, ptrattrWriteStructure)
Where ptrattrWriteStructure is a pointer to a structure of type CYBLE_GATTC_WRITE_REQ_T
And the following 3 parts of the structure need to be written for it to work correctly:
ptrattrWriteStructure.attrHandle = uint16 serviceHandle; (0-x where x is the first byte of the service that you are referring to. The length iirc)
ptrattrWriteStructure.value.val = uint8 data[]; pointer to uint 8 array
ptrattrWriteStructure.value.len = uint8 dataLength; single byte length of uint 8 pointer array
2. Cyble_GattcStartDiscovery() is only needed to determine the handle value of the service for use as the parameter above. If you have a constant profile/services for the GATTDB, then the handle will never change (It is compile-time-constant), and thus you can use a hardcoded handle value if you don't have need for changing the UUID or handle values of the device.