Hi all,
I'm using SimpleBLECentral and SimpleBLEPeripheral projects. I want to send 20 bytes of data between central and peripheral device (bidirectional).The transfer from peripheral to central is OK.
central side:
#define LENGHT 20
write:
uint8 simpleBLECharValarray[LENGHT]= {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9};
attWriteReq_t req;
req.handle = simpleBLECharHdl;
req.len = LENGHT;
int i;
for (i=0;i<LENGHT;i++)
req.value[i] = simpleBLECharValarray[i];
req.sig = 0;
req.cmd = 0;
status = GATT_WriteCharValue( simpleBLEConnHandle, &req, simpleBLETaskId );
( it is enough)
Questions:
When I set req.len = LENGHT I got the following error mesage: 0x0D The attribute value length is invalid for the operation , and the transfer from central to peripheral doesn't work . If I leave req.len =1 (default value), first byte of simpleBLECharValarray will be transferred only.
I found about attWriteReq_t the following details:
| uint16 | handle |
| Handle of the attribute to be written (must be first field). it is OK |
|
| uint8 | len |
| Length of value. Which value? |
|
| uint8 | value [ATT_MTU_SIZE-3] , it is OK |
| Value of the attribute to be written. |
|
| uint8 | sig |
| Authentication Signature status (not included (0). |
|
| uint8 | cmd |
|
Command Flag.
I think, it can be set using uint8 len but it isn't right/doesn't work. So, Why doesn't work the transfer ( more than 1 byte) from central to peripheral? How can I set the lenght ? Can you recommend any other method to send 20 bytes of data from central device?
Thanks. |
|