Characteristic of variable-length write

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

cross mob
Anonymous
Not applicable

Hello,

SDK:2.1.1

Hardware:Tag board + iPhone

I want to send 1-22 bytes from iPhone to the Tag board. The length is not fixed, variable.

I have studied the SDK's samples but couldn't the sample for variable length write.

Now, the characteristic setting is like this,

CHARACTERISTIC_UUID128_WRITABLE (HDLC_VSP_VSP_TX,

  HDLC_VSP_VSP_TX_VALUE,

__UUID_VSP_VSP_TX,

LEGATTDB_CHAR_PROP_WRITE_NO_RESPONSE,

LEGATTDB_PERM_WRITE_CMD,

22),

    0x00,...0x00,     //22 of 0x00

And I can get the data in the handler,

int test3_write_handler(LEGATTDB_ENTRY_HDR *p)

{

    UINT8  writtenbyte;

    UINT16 handle   = legattdb_getHandle(p);

    int    len      = legattdb_getAttrValueLen(p);

    UINT8  *attrPtr = legattdb_getAttrValue(p);

    BOOL changed;

...etc...

then I could get the data. But the length is always 22, so there is no length infomation of each packet.

For example, when iPhone send one byte

0x00

then send two bytes

0x00 0x00

then I can not to know what was the second packet.

I found the setting of "LEGATTDB_PERM_VARIABLE_LENGTH" in MMP920732SW-AN103-R application note, P12, table2.

So I think there is a way to get variable length write data, isn't there?

0 Likes
1 Solution
Anonymous
Not applicable

I changed the 5th parameter as " LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_VARIABLE_LENGTH" then I could get the actual length information of the data.

View solution in original post

0 Likes
7 Replies