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.

BLOB write

Any example on how to do a Blob write from TI example code ?

  • Hi

    That was a short answer, can you provide any futher help on how to send more than 20 bytes ?

    Some code example please, thanks

    BR

    Christian

  • yes

    http://e2e.ti.com/support/wireless_connectivity/f/538/p/221165/1127239.aspx#1127239

    Edit: I pointed you to an example of a blob read, but blob writes work the same way roughly. The difference will be :

         VOID osal_memcpy(  (pAttr->pValue)+offset, pValue, len ); //write to the chearcteristic

  • Hi

    No matter how i put the offset only 22bytes are transmittet from the Sensor TAG to the iPhone using Read command.

    Project: SensorTAG.

    defined value:

    static uint8 magnetometerData[] = "Abc01:85306d11-5a3a-43    ABCDEFG"; // 33 bytes

    Function:

    static uint8 magnetometer_ReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,
                                uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen )

    { .........

     switch ( uuid )
      {

    case MAGNETOMETER_DATA_UUID:

    *pLen = MAGNETOMETER_DATA_LEN;
          osal_memcpy( pValue, pAttr->pValue, MAGNETOMETER_DATA_LEN );

    iPhone received:

    Abc01:85306d11-5a3a-43

    If i replace function call with:

    offset = 5;

    osal_memcpy( pValue, pAttr->pValue+offset, MAGNETOMETER_DATA_LEN );

    I only loose the first 5 characters and the next 22 bytse are send to iPhone.

    iPhone received:

    :85306d11-5a3a-43   A

    Is the offset at the right location ?

    How is the Read function (static uint8 magnetometer_ReadAttrCB( ...) ) called more than one time if it only transmits 22 bytes at each function call ?

    Function call:

     CONST gattServiceCBs_t magnetometerCBs ={
      magnetometer_ReadAttrCB,  // Read callback function pointer
      magnetometer_WriteAttrCB, // Write callback function pointer
      NULL                      // Authorization callback function pointer
    };

  • What is MAGNETOMETER_DATA_LEN?

    Edit: I'm going to assume its greater than 22 which is bad because you are using osal_memcpy() to put more than 22 bytes in a variable that's only 22 bytes in size. Also pLen should be set to 20 until you are done. Blob reads transfer 20 bytes at a time. This number varries depending on the MTU. Sending less than 20 is the indicator that you are done. This may mean sending a packet with a data length of 0 at the end. Your read callback will be triggered for each successive 20 byte chunk. You to don't need to keep track of where you are because the offset should be +=20 each time

    Could you send me your .c file that includes your read calback (and the .h file)? I think you are only sending out 1 packet and I have never managed to get one packet to send more than 19 bytes at a time. I'd be really interested to recreate what you are doing

  • Hi Peter

    Thanks for your extedded help

    #define MAGNETOMETER_DATA_LEN           22

    It is 22  bytes.

    Do you have an e-mail i would be happy to send you the code and src files.

    I have one more question on top of this, any help here would be nice, thanks a lot :-)

    http://e2e.ti.com/support/wireless_connectivity/f/538/t/370527.aspx

    Thanks

    Christian