diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2014-03-25 11:42:59 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-03-25 17:24:01 +0200 |
commit | f1956438cc6038eef324b3adf8e446f1b84dfb2f (patch) | |
tree | aeb189381de5fee90606f16464c1a84b18480f18 /attrib | |
parent | 22a0f404fd1c49d61a553b694fa0ed7c48f016a1 (diff) | |
download | bluez-f1956438cc6038eef324b3adf8e446f1b84dfb2f.tar.gz |
gatt: Move Characteristic properties to attrib/gatt.h
Properties are defined by GATT specification. This patch moves and
renames the defines related to Characteristic properties bits from
attrib/att.h to attrib/gatt.h
Diffstat (limited to 'attrib')
-rw-r--r-- | attrib/att.h | 10 | ||||
-rw-r--r-- | attrib/gatt-service.c | 12 | ||||
-rw-r--r-- | attrib/gatt.h | 18 |
3 files changed, 24 insertions, 16 deletions
diff --git a/attrib/att.h b/attrib/att.h index 28bc94445..800332dfb 100644 --- a/attrib/att.h +++ b/attrib/att.h @@ -75,16 +75,6 @@ #define ATT_ECODE_TIMEOUT 0x81 #define ATT_ECODE_ABORTED 0x82 -/* Characteristic Property bit field */ -#define ATT_CHAR_PROPER_BROADCAST 0x01 -#define ATT_CHAR_PROPER_READ 0x02 -#define ATT_CHAR_PROPER_WRITE_WITHOUT_RESP 0x04 -#define ATT_CHAR_PROPER_WRITE 0x08 -#define ATT_CHAR_PROPER_NOTIFY 0x10 -#define ATT_CHAR_PROPER_INDICATE 0x20 -#define ATT_CHAR_PROPER_AUTH 0x40 -#define ATT_CHAR_PROPER_EXT_PROPER 0x80 - #define ATT_MAX_VALUE_LEN 512 #define ATT_DEFAULT_L2CAP_MTU 48 #define ATT_DEFAULT_LE_MTU 23 diff --git a/attrib/gatt-service.c b/attrib/gatt-service.c index 3e70c5036..874552bc5 100644 --- a/attrib/gatt-service.c +++ b/attrib/gatt-service.c @@ -91,8 +91,8 @@ static GSList *parse_opts(gatt_option opt1, va_list args) case GATT_OPT_CHR_PROPS: info->props = va_arg(args, int); - if (info->props & (ATT_CHAR_PROPER_NOTIFY | - ATT_CHAR_PROPER_INDICATE)) + if (info->props & (GATT_CHR_PROP_NOTIFY | + GATT_CHR_PROP_INDICATE)) /* client characteristic configuration */ info->num_attrs += 1; @@ -156,7 +156,7 @@ static int att_read_req(int authorization, int authentication, uint8_t props) else if (authentication == GATT_CHR_VALUE_READ || authentication == GATT_CHR_VALUE_BOTH) return ATT_AUTHENTICATION; - else if (!(props & ATT_CHAR_PROPER_READ)) + else if (!(props & GATT_CHR_PROP_READ)) return ATT_NOT_PERMITTED; return ATT_NONE; @@ -170,8 +170,8 @@ static int att_write_req(int authorization, int authentication, uint8_t props) else if (authentication == GATT_CHR_VALUE_WRITE || authentication == GATT_CHR_VALUE_BOTH) return ATT_AUTHENTICATION; - else if (!(props & (ATT_CHAR_PROPER_WRITE | - ATT_CHAR_PROPER_WRITE_WITHOUT_RESP))) + else if (!(props & (GATT_CHR_PROP_WRITE | + GATT_CHR_PROP_WRITE_WITHOUT_RESP))) return ATT_NOT_PERMITTED; return ATT_NONE; @@ -262,7 +262,7 @@ static gboolean add_characteristic(struct btd_adapter *adapter, *info->value_handle = a->handle; /* client characteristic configuration descriptor */ - if (info->props & (ATT_CHAR_PROPER_NOTIFY | ATT_CHAR_PROPER_INDICATE)) { + if (info->props & (GATT_CHR_PROP_NOTIFY | GATT_CHR_PROP_INDICATE)) { uint8_t cfg_val[2]; bt_uuid16_create(&bt_uuid, GATT_CLIENT_CHARAC_CFG_UUID); diff --git a/attrib/gatt.h b/attrib/gatt.h index 4fea3eb94..a11e4734d 100644 --- a/attrib/gatt.h +++ b/attrib/gatt.h @@ -24,6 +24,24 @@ #include <bluetooth/sdp.h> +/* + * GATT Characteristic Property bit field + * Reference: Core SPEC 4.1 page 2183 (Table 3.5: Characteristic Properties + * bit field) defines how the Characteristic Value can be used, or how the + * characteristic descriptors (see Section 3.3.3 - page 2184) can be accessed. + * In the core spec, regular properties are included in the characteristic + * declaration, and the extended properties are defined as descriptor. + */ + +#define GATT_CHR_PROP_BROADCAST 0x01 +#define GATT_CHR_PROP_READ 0x02 +#define GATT_CHR_PROP_WRITE_WITHOUT_RESP 0x04 +#define GATT_CHR_PROP_WRITE 0x08 +#define GATT_CHR_PROP_NOTIFY 0x10 +#define GATT_CHR_PROP_INDICATE 0x20 +#define GATT_CHR_PROP_AUTH 0x40 +#define GATT_CHR_PROP_EXT_PROP 0x80 + /* Client Characteristic Configuration bit field */ #define GATT_CLIENT_CHARAC_CFG_NOTIF_BIT 0x0001 #define GATT_CLIENT_CHARAC_CFG_IND_BIT 0x0002 |