Just want the written data

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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?

0 Likes
1 Solution

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),

View solution in original post

0 Likes
6 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

I'll see if one of the developers can respond.

j.t victorz miltmiller

0 Likes
VictorZ_46
Employee
Employee
5 comments on blog 25 sign-ins 250 likes received

you might need to add LEGATTDB_PERM_VARIABLE_LENGTH to your characteristic description.

Anonymous
Not applicable

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?

0 Likes

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),

0 Likes
Anonymous
Not applicable

Thanks! that did it.

Anonymous
Not applicable

Like this?

CHARACTERISTIC_UUID128_WRITABLE (

...

LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE,

LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ | LEGATTDB_PERM_VARIABLE_LENGTH,

...

)

0 Likes