How to Write to the Gatt Database? | Cypress Semiconductor
How to Write to the Gatt Database?
Hello my name is Jonas and is a student in sweden and have recently begun working on a project with PSoC BLE using the PSoC Creator.
I have created a custom Profile and I am testing various ways of sending my data but seem to be having troubles with CyBle_GattWriteAttributeValue().
In the profile I can create several different fields with different variable types.
But the function for the server to write data to the database CyBle_GattWriteAttributeValue gives me a few questions.
It requires several parameters, most notably the variable CYBLE_GATT_HANDLE_VALUE_PAIR_T which handles the data.
This variable handles several data values, as the attributeHandle (where to put stuff?) but also the datafields containing a pointer to the actual data aswell as some information about the data.
This field, seems to only be able to contain a pointer to a uint8 variable?
CYBLE_GATT_HANDLE_VALUE_PAIR_T ->CYBLE_GATT_VALUE_T -> value(uint8).
If I decide I want a field with a uint16 for example, how do I write to this field?
And how do I write to different fields if decide to use more than one?
Perhaps I am misunderstanding something regarding the use of the function or the variable type CYBLE_GATT_HANDLE_VALUE_PAIR_T?
Basic idea of what I am trying to do(but how would i change the.
uint8 bvalue = 10;
handleValue.attrHandle = CYBLE_MEDDELANDE_MED_CHAR_HANDLE;
handleValue.value.len = 1;
handleValue.value.val = &bvalue;
CyBle_GattsWriteAttributeValue(&handleValue, 0, &cyBle_connHandle, CYBLE_GATT_DB_LOCALLY_INITIATED);
Help, discussions or a pointer where to look would be most appreciated.
Best Regards Jonas