- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there guys,
Trying to write a vendor specific profile with a vendor specific service that contains two writable characteristics which will pipe any written data out the uart upon write. I have my pass to uart function occurring in the smart wizard generated functions which are called by the write handler.
Example:
// It will be called at the write handler and should return TRUE if any persistent value is changed
BOOL on_write_service_characteristic(int len, UINT8 *attrPtr)
The problem that I am running into is that the ENTIRE characteristic is being passed via the attrPtr, not just the data that was just written to it. So for example if the characteristic previously contained the data "this is a very long string" and the data "hello" is written, the attrPtr will contain "hellos very long string" and len will be the value 26 instead of the 5 that I wanted.
How can I get just a pointer to the data written and it's length, NOT the entire characteristic?
Solved! Go to Solution.
- Tags:
- 851495
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Right, something like that
CHARACTERISTIC_UUID128_WRITABLE (HDLC_ , HDLC_VALUE, __UUID_,
LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE | LEGATTDB_CHAR_PROP_INDICATE,
LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ LEGATTDB_PERM_VARIABLE_LENGTH, 20),
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you might need to add LEGATTDB_PERM_VARIABLE_LENGTH to your characteristic description.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi guys, thanks for responding. I'm sorry Victor but I am not quite understanding what you mean by characteristic description. Do you mean in I need to add this flag to the CHARACTERISTIC_UUID128_WRITABLE field in the projectname_db.c which is generated by the wizard?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Right, something like that
CHARACTERISTIC_UUID128_WRITABLE (HDLC_ , HDLC_VALUE, __UUID_,
LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE | LEGATTDB_CHAR_PROP_INDICATE,
LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ LEGATTDB_PERM_VARIABLE_LENGTH, 20),
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks! that did it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Like this?
CHARACTERISTIC_UUID128_WRITABLE (
...
LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE,
LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ | LEGATTDB_PERM_VARIABLE_LENGTH,
...
)