You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "Christopher Collins (JIRA)" <ji...@apache.org> on 2016/05/02 23:14:12 UTC
[jira] [Created] (MYNEWT-291) BLE Host - Split GATT attribute
access function into more specific events
Christopher Collins created MYNEWT-291:
------------------------------------------
Summary: BLE Host - Split GATT attribute access function into more specific events
Key: MYNEWT-291
URL: https://issues.apache.org/jira/browse/MYNEWT-291
Project: Mynewt
Issue Type: Bug
Components: Nimble
Reporter: Christopher Collins
Assignee: Christopher Collins
Fix For: 0.9.0
Nimble notifies the app that a characteristic or descriptor is being accessed via an access callback. The access callback takes a context parameter which points to an instance of the following union:
{noformat}
union ble_gatt_access_ctxt {
struct {
const struct ble_gatt_chr_def *chr;
void *data;
int len;
} chr_access;
struct {
const struct ble_gatt_dsc_def *dsc;
void *data;
int len;
} dsc_access;
};
{noformat}
This is problematic because the user may wish to point the _data_ fields to read-only data, requiring them to "cast away const." This looks questionable in code, and is difficult to document in the user guide with a straight face.
Instead, we should change the union to the following:
union ble_gatt_access_ctxt {
struct {
const struct ble_gatt_chr_def *chr;
const void *data;
int len;
} chr_read;
struct {
const struct ble_gatt_chr_def *chr;
void *data;
int len;
} chr_write;
struct {
const struct ble_gatt_dsc_def *dsc;
const void *data;
int len;
} dsc_read;
struct {
const struct ble_gatt_dsc_def *dsc;
void *data;
int len;
} dsc_write;
};
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)