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.

BLE Multiple instances of a characteristic value

Hello,

I'm reading some charateristic values from my firmware that is based on the SimpleBLEPeripheral project. The device is connecting to the Android BLE example.

Now, I've seen that it is possible to read from multiple instances of the same characteristics. I have a general set of paramaters in my firmware. By modifying the simpleProfileAttrTbl to include a pointer to the first element of my parameter list, I can successfully read this first value in the app.

I would like to use this instance feature to read the rest of the parameters in the list. How does this plug into the SimpleGattProfile? When the app is asking for the characteristic, I will receive a call to simpleProfile_ReadAttrCB, but there is no InstanceID parameter. There is an offset parameter included, but is this not only for sub-indexing big charateristic values?

And how will I choose what instanceID to read from Android? As far as I see I can only read the instanceID, but not write it.

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

  • Hi Johan,

    Johan Wallström said:
    Now, I've seen that it is possible to read from multiple instances of the same characteristics

    Where have you seen that? it would be very interesting to know, as I have not heard about that before.

    Best Regards

    Joakim

  • So I was looking at the Android docs and it is a bit vague but I got the impression from this and a few similar pieces of text:

    public int getInstanceId ()
    
    Added in API level 18
    Returns the instance ID for this characteristic.
    
    If a remote device offers multiple characteristics with the same UUID, the instance ID is used to distuinguish between characteristics.
    
    Returns
    Instance ID of this characteristic