This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SCCD not visible in nrfToolbox

I am trying to implement SCCD on S130 v2 sdk11 but this is not in the scope of the tutorial. I have populated the structure just the same as for CCCD, but I can't have the descriptor shown in nRF toolbox or in my own android app when using getDescriptors (developer.android.com/.../BluetoothGattCharacteristic.html. I have tried to un-re-bond device but it does not help. do I have to use add_descriptor function, ? it is not used for cccd, so I don't use it for sccd. If it is needed, please provide an example as the doc does not really help. I want to use this descriptor in order to activate some hardware peripheral on my device independantly from notifications, as the peripheral is HW ressource, hence unique for all clients.

here is my code (sorry for formatting but I am a newbie on this forum)

ble_gatts_attr_md_t sccd_md;
memset(&sccd_md, 0, sizeof(sccd_md));
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sccd_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sccd_md.write_perm);
    sccd_md.vloc                = BLE_GATTS_VLOC_STACK; 
    sccd_md.rd_auth = 0;
    sccd_md.wr_auth = 0;
    char_md.p_sccd_md           = &sccd_md;  				
    
err_code =  sd_ble_gatts_characteristic_add(p_dss->service_handle,
                                       &char_md,
                                       &attr_char_value,
                                       &p_dss->accelerometer_handles);
  • OK, I got it work as I realized it was linked to the broadcast property of the char metadata.

    char_md.char_props.broadcast = 1;

    I don't know about this broacast thing and if this is suitable to my project...

    Then playing with SCCD I wish to use RFU bits for custom purpose (I understand using a custom descriptor is better approach and I will evaluate this later).

    how can I read descriptor value from application ? do I hve to use sd_ble_gatts_sys_attr_get ?

  • Hi jfDEVmoto,

    I don't think the SCCD would fit with what you planed to do with it. The only defined function that the SCCD would do is defined in the spec is "Broadcast" which means the client enable the value of the characteristic to be added to advertising packet if possible. I guess you already figured it out.

    It's not a good idea to use the RFU bit for your purpose.

    If you want to control a hardware on the server, you can simply create a new proprietary characteristic add to the server att table and use it for your purpose.

    If you still want to use the SCCD, you would need to treat it as a normal descriptor, and use getDescriptors and BluetoothGattDescriptor (on Android) to read/write to it.

  • Thanks for your answer. I agree with your advise, however, is it possible to add a custom descriptor instead of using a custom characteristic ? Then do you confirm the descriptor value can be read with sd_ble_gatts_sys_attr_get ?

    I have currently different services, one of them is sensor service with one characteristic per sensor, than I wish to have one descriptor for each sensor char in order to activate the hardware sensor. I think this is easier for modularity than having a characteristic to activate the hardware sensor. However, having one characteristic to handle all sensors hardware status may be of lower memory overhead but I think it wil be hard to maintain when different versions of the product may have different set of sensor features.

  • I don't think there is an option to add custom proprietary descriptor with BLE. You would need to describe a new characteristic for your use. You can, for example add the Characteristic User Description, but the use of it is to define in text (UTF-8) information about the characteristic. Not for other purpose.

    sd_ble_gatts_sys_attr_get() is only for the CCCD not all the descriptor. You should use sd_ble_gatts_value_get() to read the descriptor value, like any attribute /characteristic value.

    I would suggest to add a characteristic to the same service to handle the hardware. Or you can add one extra byte in the current characteristic to handle that, it's up to your design.

  • Your answer is surprising as I supposed the function sd_ble_gatts_descriptor_add actually allows to create descriptor attributes for one characteristic. I have not tried it yet.

Related