aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-01-17 22:06:27 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-01-17 22:06:27 +0200
commit4b98e3cfcb03790c9c452990b054868782b9481d (patch)
tree68355c2ac0820159c59dadd9d6d5ec7b8c8ceb48
parentebaedcad5fddca4936022db57eee54a91cc5b49a (diff)
downloadbluez-4b98e3cfcb03790c9c452990b054868782b9481d.tar.gz
bluez-4b98e3cfcb03790c9c452990b054868782b9481d.tar.xz
bluez-4b98e3cfcb03790c9c452990b054868782b9481d.zip
eir: Add eir_append_data function
-rw-r--r--src/eir.c11
-rw-r--r--src/eir.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/src/eir.c b/src/eir.c
index aba05862..913a038d 100644
--- a/src/eir.c
+++ b/src/eir.c
@@ -358,3 +358,14 @@ gboolean eir_has_data_type(uint8_t *data, size_t len, uint8_t type)
return FALSE;
}
+
+size_t eir_append_data(uint8_t *eir, size_t eir_len, uint8_t type,
+ uint8_t *data, size_t data_len)
+{
+ eir[eir_len++] = sizeof(type) + data_len;
+ eir[eir_len++] = type;
+ memcpy(&eir[eir_len], data, data_len);
+ eir_len += data_len;
+
+ return eir_len;
+}
diff --git a/src/eir.h b/src/eir.h
index 4e6a05f6..5d70f4d1 100644
--- a/src/eir.h
+++ b/src/eir.h
@@ -55,3 +55,6 @@ void eir_create(const char *name, int8_t tx_power, uint16_t did_vendor,
GSList *uuids, uint8_t *data);
gboolean eir_has_data_type(uint8_t *data, size_t len, uint8_t type);
+
+size_t eir_append_data(uint8_t *eir, size_t eir_len, uint8_t type,
+ uint8_t *data, size_t data_len);