Skip to content

Conversation

piotrnarajowski
Copy link
Contributor

@piotrnarajowski piotrnarajowski commented Jul 25, 2025

Add support for Characteristic Extended Properties descriptor. For each characteristic that has reliable/auxiliary flags set an instance of Extended Properties descriptor will be registred.
Note: this is needed for host qualification test case GATT/SR/GAS/BV-02-C and can be tested with #2098
image

@github-actions github-actions bot added host size/M Medium PR labels Jul 25, 2025
@piotrnarajowski piotrnarajowski force-pushed the chrc-ext-prop branch 2 times, most recently from d083506 to 0a00cde Compare August 4, 2025 08:41
@piotrnarajowski piotrnarajowski changed the title [WIP] nimble/host: add support for Extended Properties descriptor nimble/host: add support for Characteristic Extended Properties descriptor Aug 4, 2025
@piotrnarajowski piotrnarajowski force-pushed the chrc-ext-prop branch 2 times, most recently from a7f42ba to 8b48638 Compare August 4, 2025 09:39
@piotrnarajowski piotrnarajowski marked this pull request as ready for review August 4, 2025 09:40
@piotrnarajowski piotrnarajowski marked this pull request as draft August 4, 2025 10:00
@piotrnarajowski piotrnarajowski marked this pull request as ready for review August 4, 2025 10:09
Comment on lines 825 to 855
static int
ble_gatts_cep_access_cb(uint16_t conn_handle, uint16_t attr_handle,
struct ble_gatt_access_ctxt *ctxt, void *arg)
{
uint16_t prop = POINTER_TO_UINT(arg);

if (ctxt->op != BLE_GATT_ACCESS_OP_READ_DSC) {
return BLE_ATT_ERR_WRITE_NOT_PERMITTED;
}

os_mbuf_append(ctxt->om, &prop, sizeof(prop));

return 0;
}

static int
ble_gatts_cep_access(uint16_t conn_handle, uint16_t attr_handle,
uint8_t att_op, uint16_t offset, struct os_mbuf **om,
void *arg)
{
struct ble_gatt_access_ctxt gatt_ctxt;
int rc;

gatt_ctxt.op = ble_gatts_dsc_op(att_op);

ble_gatts_dsc_inc_stat(gatt_ctxt.op);
rc = ble_gatts_val_access(conn_handle, attr_handle, offset, &gatt_ctxt,
om, ble_gatts_cep_access_cb, arg);

return rc;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether you need a call ble_gatts_val_access here. It's because you can handle the access request in place:

static int
ble_gatts_cep_access(uint16_t conn_handle, uint16_t attr_handle,
                     uint8_t att_op, uint16_t offset, struct os_mbuf **om,
                     void *arg)
{
    uint16_t prop = POINTER_TO_UINT(arg);
    uint8_t *buf;

    ble_gatts_dsc_inc_stat(gatt_ctxt.op);

    if (att_op != BLE_ATT_ACCESS_OP_READ) {
        return BLE_ATT_ERR_WRITE_NOT_PERMITTED;
    }

   buf = os_mbuf_extend(*om, 2);
   if (buf == NULL) {
       return BLE_ATT_ERR_INSUFFICIENT_RES;
   }
   put_le16(buf, prop);

    return 0;
}

should work for you (I believe :P). Note the put_le16 is used to ensure correct endianess

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MariuszSkamra updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 848 to 849
gatt_ctxt.op = ble_gatts_dsc_op(att_op);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gatt_ctxt.om is not set but referenced in ble_gatts_cep_access_cb

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

…iptor

Add support for Characteristic Extended Properties descriptor.
For each characteristic that has reliable/auxiliary write flags set
an instance of Extended Properties descriptor will be registred.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants