- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using a donlge cysmart module with C#, I would like to know how can I see the info read. This is the part of the code I'm using to read the characteristic:
err = GattClient.ReadCharacteristicByUUID(new CyReadCharacteristicByUUIDInfo(uuid, startHandle, endHandle));
But I don't know how to read the characteristic itself.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you configure the BLE Component to add different services and characteristics, handles to each of them are generated in the file BLE_config.h usually. Its not clear which device you are using.
Lets say you configure the BLE component with the following settings:
Then the following macros will be generated for you:
#define CY_BLE_CAPSERV_SERVICE_HANDLE (0x0010u) /* Handle of CAPSERV service */
#define CY_BLE_CAPSERV_LED_DECL_HANDLE (0x0011u) /* Handle of LED characteristic declaration */
#define CY_BLE_CAPSERV_LED_CHAR_HANDLE (0x0012u) /* Handle of LED characteristic */
#define CY_BLE_CAPSERV_LED_LEDCCCD_DESC_HANDLE (0x0013u) /* Handle of ledCCCD descriptor */
#define CY_BLE_CAPSERV_FAN_DECL_HANDLE (0x0014u) /* Handle of FAN characteristic declaration */
#define CY_BLE_CAPSERV_FAN_CHAR_HANDLE (0x0015u) /* Handle of FAN characteristic */
So, in CySmart C# Application when using the API ReadCharacteristicByUUID here's how you would call it:
GattClient.ReadCharacteristicByUUID(new CyReadCharacteristicByUUIDInfo(<UUID>, 0x0012, 0x0013));
You need to then implement a GattCallback in this way:
class GattClientCb : CyGattClientCallback{
public override void OnCharacteristicReadByUUID(CyReadCharacteristicByUUIDResult result, CyStatus status)
{
// Do something with the result
}
}
You can find some CySmart examples attached for reference. Hope this helps
Regards,
Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just saw on the API Reference Guide that I can use:
virtual void OnCharacteristicReadByUUID (CyReadCharacteristicByUUIDResult result, CyStatus status)[virtual]
But I'm not sure how to use this function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you configure the BLE Component to add different services and characteristics, handles to each of them are generated in the file BLE_config.h usually. Its not clear which device you are using.
Lets say you configure the BLE component with the following settings:
Then the following macros will be generated for you:
#define CY_BLE_CAPSERV_SERVICE_HANDLE (0x0010u) /* Handle of CAPSERV service */
#define CY_BLE_CAPSERV_LED_DECL_HANDLE (0x0011u) /* Handle of LED characteristic declaration */
#define CY_BLE_CAPSERV_LED_CHAR_HANDLE (0x0012u) /* Handle of LED characteristic */
#define CY_BLE_CAPSERV_LED_LEDCCCD_DESC_HANDLE (0x0013u) /* Handle of ledCCCD descriptor */
#define CY_BLE_CAPSERV_FAN_DECL_HANDLE (0x0014u) /* Handle of FAN characteristic declaration */
#define CY_BLE_CAPSERV_FAN_CHAR_HANDLE (0x0015u) /* Handle of FAN characteristic */
So, in CySmart C# Application when using the API ReadCharacteristicByUUID here's how you would call it:
GattClient.ReadCharacteristicByUUID(new CyReadCharacteristicByUUIDInfo(<UUID>, 0x0012, 0x0013));
You need to then implement a GattCallback in this way:
class GattClientCb : CyGattClientCallback{
public override void OnCharacteristicReadByUUID(CyReadCharacteristicByUUIDResult result, CyStatus status)
{
// Do something with the result
}
}
You can find some CySmart examples attached for reference. Hope this helps
Regards,
Dheeraj