If you have access to process the received data, then you can add one byte(say byte0) which carries the size of the rest payload. From my experience, once you declare the size of the characteristic value in the gattdb, the stack sends the PDU of that size.
I think LEGATTDB_PERM_VARIABLE_LENGTH can solve your issue, I had same issue with yours ever.
Thank you for the reply.
I am making a kind of UART dongle via BLE, so I can not to add the length byte.
I think LEGATTDB_PERM_VARIABLE_LENGTH can solve too, but there is no infomation to use the setting.
I set it in my cord, but I doesn't work.
I set LEGATTDB_PERM_VARIABLE_LENGTH like this.
CHARACTERISTIC_UUID128_WRITABLE needs 6 auguments so I have to add some length number like "16".
If I set like this, the write will not fire at all. If I change from LEGATTDB_PERM_VARIABLE_LENGTH to LEGATTDB_PERM_VARIABLE_LENGTH, I can get the write data.
Is there a document for LEGATTDB_PERM_VARIABLE_LENGTH?
From the new thread you added here: How to use "LEGATTDB_PERM_VARIABLE_LENGTH"
Hardware:Tag board + iPhone
I want to send variable data from client(iPhone) to the tag-board.
I have checked some samples and documents, and I found a description of setting "LEGATTDB_PERM_VARIABLE_LENGTH" in MMP920732SW-AN103-R application note, P12, table2.
Does any body know how to set this setting?
The samples just have the setting function CHARACTERISTIC_UUID128_WRITABLE () for write characteristic, and it need the length information like this.
It sets the data length, so the length is always 16 or something even iPhone sent other length data.
I want to like this,
When I sent data
then I want to get two byte of 0x00.
When I sent
0x00 0x00 0x00
then I want to get three byte of 0x00.
I changed the setting LEGATTDB_PERM_WRITE_CMD to LEGATTDB_PERM_VARIABLE_LENGTH.
I want to get 16byte data paket, so I can not add a length data in the data.
I think the 5th parameter requires LEGATTDB_PERM_WRITE_CMD to be written.
So please try "LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ".
I didn't test this, but hope it works.
dmiya, thank you for reply, but it doesn't work.
The problem is the "length". The Broadcom firmware seems to have no infomation of the length when WRTTE was ocurred.
You mentioned the 5th parameter but the "CHARACTERISTIC_UUID128_WRITABLE (" have 6th parameter.
I want to send a "variable" data. Not fixed length data.
I have to say again.
I want to send,
these are different packet length. Variable.
"CHARACTERISTIC_UUID128_WRITABLE ()" has 6th parameter and it's the length of the received data structure.
Because the length is fixed, I couldn't get the infomation of the data length.
For example, I set the 5th and 6th parameter as
3) LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ,16
"16" is the max hardware buffer length of the BCM20737S. And i sent some data from iPhone.
2) doesn't work at all. If I set this and do "write", nothing happened.
1) and 2) can get data but can't get the length at all.
When I send two byte of 0xFF 0xFF, then the result is
0xFF 0xFF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
then I send one byte of 0xAA then the result is
0xAA 0xFF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
The previous data is remained and just the first byte is overwritten.
I want to receive the data when I send 0xFF 0xFF, it's just 0xFF 0xFF.
When I make the project that include Write characteristic, the SDK make xx_db.c automatically, and it has the write call-back. I checked it and it's like this,
BOOL __write_handler(UINT16 handle, int len, UINT8 *attrPtr)
the "int len" is always 16 when I set the 6th parameter as 16, so the "len" is not the received length.
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.