I've created a characteristic that has the "Write" checkbox checked under it's properties. However, using an app I downloaded to write to a characteristic, the value I want to change it to won't be written. Is there any C code that needs to be implemented?
Solved! Go to Solution.
IDK, I had those permissions before, but after looking at some sample code I ended up using these props/permissions:
LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE
LEGATTDB_PERM_VARIABLE_LENGTH | LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ | LEGATTDB_PERM_RELIABLE_WRITE
And it started writing correctly. I think I was missing the Variable Length permission and that was causing it not to work.
Refer to the document How to Write WICED Smart Applications
You'll find that in order to make make a writable characteristic you must use (for a 16 bit uuid):
CHARACTERISTIC_UUID16_WRITABLE (handle, handle_value, uuid, properties, permission, value_len)
I do have CHARACTERISTIC_UUID16_WRITABLE instead of CHARACTERISTIC_UUID16, and it still wont take the value...
I think you need to format your characteristic to look something like this:
CHARACTERISTIC_UUID128_WRITABLE (HDLC_FIRST_CUSTOM_SERVICE_CHAR1, HDLC_FIRST_CUSTOM_SERVICE_CHAR1_VALUE, __UUID_FIRST_CUSTOM_SERVICE_CHAR1, LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE, LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ, 1), '0',
IDK, I had those permissions before, but after looking at some sample code I ended up using these props/permissions:
LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE
LEGATTDB_PERM_VARIABLE_LENGTH | LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ | LEGATTDB_PERM_RELIABLE_WRITE
And it started writing correctly. I think I was missing the Variable Length permission and that was causing it not to work.