summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorChristopher Collins <ccollins@apache.org>2016-05-09 17:40:29 -0700
committerChristopher Collins <ccollins@apache.org>2016-05-09 17:40:50 -0700
commit7ce7eb1438c7a448da4ab799e5f36e65166748fb (patch)
tree29206d784a8189f074c666776fefed7ae2831f5e /net
parent72007b575dc439cd6e941d1b2c7904964c0ec847 (diff)
BLE host - only include eddystone if specified.
Diffstat (limited to 'net')
-rw-r--r--net/nimble/host/include/host/ble_eddystone.h2
-rw-r--r--net/nimble/host/src/ble_eddystone.c12
-rw-r--r--net/nimble/include/nimble/nimble_opt.h8
3 files changed, 20 insertions, 2 deletions
diff --git a/net/nimble/host/include/host/ble_eddystone.h b/net/nimble/host/include/host/ble_eddystone.h
index 89d62c12..d4f97bde 100644
--- a/net/nimble/host/include/host/ble_eddystone.h
+++ b/net/nimble/host/include/host/ble_eddystone.h
@@ -23,7 +23,7 @@
#include <inttypes.h>
struct ble_hs_adv_fields;
-#define BLE_EDDYSTONE_MAX_UUIDS16 3
+#define BLE_EDDYSTONE_MAX_UUIDS16 3
#define BLE_EDDYSTONE_URL_MAX_LEN 17
#define BLE_EDDYSTONE_URL_SCHEME_HTTP_WWW 0
diff --git a/net/nimble/host/src/ble_eddystone.c b/net/nimble/host/src/ble_eddystone.c
index 453094a0..98ce4ab3 100644
--- a/net/nimble/host/src/ble_eddystone.c
+++ b/net/nimble/host/src/ble_eddystone.c
@@ -69,6 +69,8 @@ static int
ble_eddystone_set_adv_data_gen(struct ble_hs_adv_fields *adv_fields,
uint8_t svc_data_len)
{
+ int rc;
+
if (adv_fields->num_uuids16 > BLE_EDDYSTONE_MAX_UUIDS16) {
return BLE_HS_EINVAL;
}
@@ -115,6 +117,10 @@ ble_eddystone_set_adv_data_gen(struct ble_hs_adv_fields *adv_fields,
int
ble_eddystone_set_adv_data_uid(struct ble_hs_adv_fields *adv_fields, void *uid)
{
+#if !NIMBLE_OPT_EDDYSTONE
+ return BLE_HS_ENOTSUP;
+#endif
+
void *svc_data;
int rc;
@@ -143,7 +149,7 @@ ble_eddystone_set_adv_data_uid(struct ble_hs_adv_fields *adv_fields, void *uid)
* @param url_suffix The suffix of the URL; one of the
* BLE_EDDYSTONE_URL_SUFFIX values; use
* BLE_EDDYSTONE_URL_SUFFIX_NONE if the suffix
- * is embeded in the body argument.
+ * is embedded in the body argument.
*
* @return 0 on success; BLE_HS_E... on failure.
*/
@@ -152,6 +158,10 @@ ble_eddystone_set_adv_data_url(struct ble_hs_adv_fields *adv_fields,
uint8_t url_scheme, char *url_body,
uint8_t url_body_len, uint8_t url_suffix)
{
+#if !NIMBLE_OPT_EDDYSTONE
+ return BLE_HS_ENOTSUP;
+#endif
+
uint8_t *svc_data;
int8_t tx_pwr;
int url_len;
diff --git a/net/nimble/include/nimble/nimble_opt.h b/net/nimble/include/nimble/nimble_opt.h
index 1587015b..024f289e 100644
--- a/net/nimble/include/nimble/nimble_opt.h
+++ b/net/nimble/include/nimble/nimble_opt.h
@@ -188,6 +188,14 @@
#define NIMBLE_OPT_ATT_SVR_INDICATE 1
#endif
+
+/** HOST: Miscellaneous features. */
+
+#ifndef NIMBLE_OPT_EDDYSTONE
+#define NIMBLE_OPT_EDDYSTONE 1
+#endif
+
+
/*** CONTROLLER ***/
/*