linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd 1/3] map_ap.c: Add implementation for map_ap_get*
@ 2012-03-08  8:44 Divya Yadav
  2012-03-08  8:44 ` [PATCH obexd 2/3] MAP: Implement application parameter parsing in get/put requests Divya Yadav
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Divya Yadav @ 2012-03-08  8:44 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Divya Yadav

---
 src/map_ap.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/src/map_ap.c b/src/map_ap.c
index 54e3bcf..dd3ed6b 100644
--- a/src/map_ap.c
+++ b/src/map_ap.c
@@ -246,22 +246,72 @@ uint8_t *map_ap_encode(map_ap_t *ap, size_t *length)
 
 gboolean map_ap_get_u8(map_ap_t *ap, enum map_ap_tag tag, uint8_t *val)
 {
-	return FALSE;
+	struct ap_entry *entry;
+	int offset = find_ap_def_offset(tag);
+
+	if (offset < 0 || ap_defs[offset].type != APT_UINT8)
+		return FALSE;
+
+	entry = g_hash_table_lookup(ap, GINT_TO_POINTER(tag));
+
+	if (!entry)
+		return FALSE;
+
+	*val = entry->val.u8;
+
+	return TRUE;
 }
 
 gboolean map_ap_get_u16(map_ap_t *ap, enum map_ap_tag tag, uint16_t *val)
 {
-	return FALSE;
+	struct ap_entry *entry;
+	int offset = find_ap_def_offset(tag);
+
+	if (offset < 0 || ap_defs[offset].type != APT_UINT16)
+		return FALSE;
+
+	entry = g_hash_table_lookup(ap, GINT_TO_POINTER(tag));
+
+	if (!entry)
+		return FALSE;
+
+	*val = entry->val.u16;
+
+	return TRUE;
 }
 
 gboolean map_ap_get_u32(map_ap_t *ap, enum map_ap_tag tag, uint32_t *val)
 {
-	return FALSE;
+	struct ap_entry *entry;
+	int offset = find_ap_def_offset(tag);
+
+	if (offset < 0 || ap_defs[offset].type != APT_UINT32)
+		return FALSE;
+
+	entry = g_hash_table_lookup(ap, GINT_TO_POINTER(tag));
+
+	if (!entry)
+		return FALSE;
+
+	*val = entry->val.u32;
+
+	return TRUE;
 }
 
 const char *map_ap_get_string(map_ap_t *ap, enum map_ap_tag tag)
 {
-	return NULL;
+	struct ap_entry *entry;
+	int offset = find_ap_def_offset(tag);
+
+	if (offset < 0 || ap_defs[offset].type != APT_STR)
+		return NULL;
+
+	entry = g_hash_table_lookup(ap, GINT_TO_POINTER(tag));
+
+	if (!entry)
+		return NULL;
+
+	return g_strdup(entry->val.str);
 }
 
 gboolean map_ap_set_u8(map_ap_t *ap, enum map_ap_tag tag, uint8_t val)
-- 
1.7.0.4


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

end of thread, other threads:[~2012-03-13 12:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08  8:44 [PATCH obexd 1/3] map_ap.c: Add implementation for map_ap_get* Divya Yadav
2012-03-08  8:44 ` [PATCH obexd 2/3] MAP: Implement application parameter parsing in get/put requests Divya Yadav
2012-03-08  8:44 ` [PATCH obexd 3/3] MAP: Add SetMessageStatus function Divya Yadav
2012-03-08  9:27 ` [PATCH obexd 1/3] map_ap.c: Add implementation for map_ap_get* Slawomir Bochenski
2012-03-13 12:42   ` girish.joshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).