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.

Long, Notify Characteristic



Hello,


I have come across lots of information on the forum concerning data throughput and have not had much luck fixing my firmware. My goal is to transmit a 54 byte characteristic in 18 byte segments.

Background:
My firmware is based off of SimpleBLEPeripheral. It uses performPeriodicTask to collect data and send it to an iOS device. The function setParameter is called on the profile object, which calls GATTServApp_ProcessCharCfg. This triggers the ReadAttrCB which is my last contact with the data before it is sent to the iOS device. An iOS device subscribes to the characteristic's updates. Right now we are only using the notify operation. Do we have to use the read one instead?

Offset > 0
I have come across the fixes for the offset which are already implemented in my firmware. This is not the issue as offset is always 0 in my CB.

Solution Query:
I am wondering if there is a function that can be used to replace GATTServApp_ProcessCharCfg which will allow me to send a larger characteristic (54 bytes). If you can suggest a solution, please let me know where to place it in the simpleBLEPeripheral application.

Attempt 1:
I have not had any luck with GATT_WriteLongCharValue with the following code. I suspect I need to have a better way of finding the connHandle, but I am unsure of where I am first given access to the connHandle. I have tried to extract it from my Attribute Table with no luck. I am using INVALID_TASK_ID because the legacy code I was provided works with this option in GATTServApp_ProcessCharCfg.


gattPrepareWriteReq_t writeReq;
writeReq.handle = 0;
writeReq.len = IMU_CHAR_LEN; // 54
writeReq.offset = 0;
writeReq.pValue = IMU_Char_Val; // array of 54 bytes

GATT_WriteLongCharValue(0x00, &writeReq, INVALID_TASK_ID);

2:
I have also tried setting up a larger characteristic value and sending the data with GATTServApp_ProcessCharCfg. This will send the first 18 bytes only. My ideal solution would modify my call to GATTServApp_ProcessCharCfg in a way that sends the larger characteristic.

Thanks for any help you may offer,

Mark

p.s.

the error I get back from GATT_WriteLongCharValue is blePending

  • Solution Query:
    I am wondering if there is a function that can be used to replace GATTServApp_ProcessCharCfg which will allow me to send a larger characteristic (54 bytes). If you can suggest a solution, please let me know where to place it in the simpleBLEPeripheral application.

    - BT spec defines ClientCharCfg for push items, like GATT notificications and GATT indications.  Not/Ind are max 1 packet.

    You can setup your own custom flag (GATT Characteristic) to to initiate long writes.  The long read writes use req/resp and only go over one at a time, so it will take more intervals to achieve data transfer, but you can uses the offset param.

    Most applications will just sent notifications with custom Identifier and take advantage of the fact that BLE will always send them in order. 

    Br,

    -Greg

  • Hi Greg,


    This is all very helpful, thank you. I am having trouble understanding what you meant by the following: "... only go over one at a time, so it will take more intervals to achieve data transfer."

    When you say "...only go over one at a time...", what exactly is going one at a time? I'm guessing you mean 20 byte packets. And what is the implication by saying it takes more intervals?


    "Most applications will just sent notifications with custom Identifier and take advantage of the fact that BLE will always send them in order." I tried this solution and seemed to be dropping packets. I call GATTServApp_ProcessCharCfg three times in a row for three different characteristics and occasionally receive data out of order or drop packets (still haven't tested which one. On the to-do list). Should I be waiting on a callback event before I call the function a second or third time? It sounds like this is what I want to do.

    Best,
    Mark