This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

question about data transfer



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.

  • Hi Peter.

    I'm working on a similar thing now and I have the same objective [sending 10-20 bytes data]. I read that I could use GATT_WriteLongCharValue() to do it but cannot figure out the code. If you could make your code work, can you please attach it on this thread (or if you don't want to attach, please send it to akshatkharaya@gmail.com)? It'll be a very great help. Thanks.