From the documentation:
/** Event parameter type is CYBLE_GATTS_CHAR_VAL_READ_REQ_T. It is triggered on server side
when client sends read request and when characteristic has CYBLE_GATT_DB_ATTR_CHAR_VAL_RD_EVENT
property set. This event could be ignored by application unless it need to response by error response which
needs to be set in gattErrorCode field of event parameter. */
So, you should be able to merely return from the event in the callback and everything should work.
I wish. When I use CySmart, I always get 0 when I do a read.
When I use my custom android app, it seems to get whatever I last wrote, but it won't read the default value....
What do you mean by "default value"? The value that the program initializes the DB to? Or is there some other default value that you are setting on bootup/during runtime that you expect it to return?
In order to make the characteristic readable, it depends on the BLE settings for the BLE component in the schematic document (double click it to bring up the GATT settings and profile/services)
Try looking at the sample GATT server project here: https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days/Day006_Central_IAS
Yes, there is a value that is set at boot-up time. My plan is to store some user data in non-volatile flash so that the device will start up with some user configurable settings from the previous session at each new boot. I think there has to be a way to make those settings visible to the user after the device boots up.
I have set it to be readable in the schematic component and it actually does appear that once the characteristic has been written via bluetooth, it can be read back via bluetooth. However, if the device generates a new value at boot up or at any other time, I don't see how to make that new value readable.
Use the following function: CYBLE_GATT_ERR_CODE_T CyBle_GattsWriteAttributeValue(handlevaluepair, offset, connhandle, flags)
It should allow you to write values to the GATT DB once the CyBle_Start() has initialized the BLE stack. Try using it to write all of the default values at bootup; Setting the default values in the BLE component GUI should also work, but it sounds like you want a programmatically changeable value at bootup rather than a compile-time constant put into the default value.