Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/4] Add static Device Appearance Characteristic
@ 2011-02-16 23:07 Claudio Takahasi
  2011-02-16 23:07 ` [PATCH 2/4] Update Device Appearance Characteristic based on device class Claudio Takahasi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Claudio Takahasi @ 2011-02-16 23:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Declaration and definition of the Device Appearance Characteristic
defined in the GAP Characteristics for Low Energy section: Bluetooth
Core Specification, Volume 3, Part C, section 12.2.
---
 src/attrib-server.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/attrib-server.c b/src/attrib-server.c
index 85b39a8..fe5d68c 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -799,6 +799,7 @@ static void register_core_services(void)
 	uint8_t atval[256];
 	uuid_t uuid;
 	int len;
+	uint16_t appearance = 0x0000;
 
 	/* GAP service: primary service definition */
 	sdp_uuid16_create(&uuid, GATT_PRIM_SVC_UUID);
@@ -818,8 +819,17 @@ static void register_core_services(void)
 	attrib_db_add(0x0006, &uuid, ATT_NONE, ATT_NOT_PERMITTED,
 					(uint8_t *) main_opts.name, len);
 
-	/* TODO: Implement Appearance characteristic. It is mandatory for
-	 * Peripheral/Central GAP roles. */
+	/* GAP service: device appearance characteristic */
+	sdp_uuid16_create(&uuid, GATT_CHARAC_UUID);
+	atval[0] = ATT_CHAR_PROPER_READ;
+	att_put_u16(0x0008, &atval[1]);
+	att_put_u16(GATT_CHARAC_APPEARANCE, &atval[3]);
+	attrib_db_add(0x0007, &uuid, ATT_NONE, ATT_NOT_PERMITTED, atval, 5);
+
+	/* GAP service: device appearance attribute */
+	sdp_uuid16_create(&uuid, GATT_CHARAC_APPEARANCE);
+	att_put_u16(appearance, &atval[0]);
+	attrib_db_add(0x0008, &uuid, ATT_NONE, ATT_NOT_PERMITTED, atval, 2);
 
 	/* GATT service: primary service definition */
 	sdp_uuid16_create(&uuid, GATT_PRIM_SVC_UUID);
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-17 18:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16 23:07 [PATCH 1/4] Add static Device Appearance Characteristic Claudio Takahasi
2011-02-16 23:07 ` [PATCH 2/4] Update Device Appearance Characteristic based on device class Claudio Takahasi
2011-02-16 23:07 ` [PATCH 3/4] Update the Device Name characteristic when the local name has changed Claudio Takahasi
2011-02-16 23:07 ` [PATCH 4/4] Fix Device Name Characteristic Claudio Takahasi
2011-02-17 18:36 ` [PATCH 1/4] Add static Device Appearance Characteristic Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox