summaryrefslogtreecommitdiff
path: root/src/eir.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-10-03 15:18:19 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-10-03 22:41:44 +0300
commit9d8b2330859f377c310a80202059d2c70f8422ac (patch)
treee1287bff83e470e45b4d5c18ba4090c696d843e4 /src/eir.c
parent0e261c73046b430ad3af9fc1762efbc8cf8b2416 (diff)
downloadbluez-9d8b2330859f377c310a80202059d2c70f8422ac.tar.gz
eir: Add support for creating EIR with CoD field
This will be used to create EIR to be send over OOB channel.
Diffstat (limited to 'src/eir.c')
-rw-r--r--src/eir.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/eir.c b/src/eir.c
index 91c431fde..e006a9f6f 100644
--- a/src/eir.c
+++ b/src/eir.c
@@ -278,7 +278,7 @@ static void eir_generate_uuid128(GSList *list, uint8_t *ptr, uint16_t *eir_len)
}
}
-void eir_create(const char *name, int8_t tx_power,
+void eir_create(const char *name, int8_t tx_power, uint32_t cod,
uint8_t *hash, uint8_t *randomizer,
uint16_t did_vendor, uint16_t did_product,
uint16_t did_version, uint16_t did_source,
@@ -292,6 +292,22 @@ void eir_create(const char *name, int8_t tx_power,
gboolean truncated = FALSE;
size_t name_len;
+ if (cod > 0) {
+ uint8_t class[3];
+
+ class[0] = (uint8_t) cod;
+ class[1] = (uint8_t) (cod >> 8);
+ class[2] = (uint8_t) (cod >> 16);
+
+ *ptr++ = 4;
+ *ptr++ = EIR_CLASS_OF_DEV;
+
+ memcpy(ptr, class, sizeof(class));
+ ptr += sizeof(class);
+
+ eir_len += sizeof(class) + 2;
+ }
+
if (hash) {
*ptr++ = 17;
*ptr++ = EIR_SSP_HASH;