-
Notifications
You must be signed in to change notification settings - Fork 446
nimble/host: add support for Characteristic Extended Properties descriptor #2088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
d083506
to
0a00cde
Compare
a7f42ba
to
8b48638
Compare
nimble/host/src/ble_gatts.c
Outdated
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; | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MariuszSkamra updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
nimble/host/src/ble_gatts.c
Outdated
gatt_ctxt.op = ble_gatts_dsc_op(att_op); | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
8b48638
to
d70c47e
Compare
…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.
Fix coding style
d70c47e
to
530fc9e
Compare
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