summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Johanson <peter@peterjohanson.com>2020-10-16 00:48:53 -0400
committerPete Johanson <peter@peterjohanson.com>2020-10-16 00:48:53 -0400
commit818f0a1f91020f3315ae09f70ddda6f8362fab98 (patch)
tree15d9a458c4e8561b69e924393e6289fb4534bff9
parent204d1300ba6b13041e9a69cc297c06ac189f1f0d (diff)
fix(bluetooth): Advertise name + appearance.
* Properly put device name and GAP appearance in advertising packets, for proper display in macOS, Android, etc. * Closes #124
-rw-r--r--app/src/ble.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/src/ble.c b/app/src/ble.c
index 8cc42bc..ddc92e9 100644
--- a/app/src/ble.c
+++ b/app/src/ble.c
@@ -54,13 +54,18 @@ enum advertising_type {
#define CURR_ADV(adv) (adv << 4)
#define ZMK_ADV_CONN_NAME \
- BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_USE_NAME, \
- BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL)
+ BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, BT_GAP_ADV_FAST_INT_MIN_2, \
+ BT_GAP_ADV_FAST_INT_MAX_2, NULL)
static struct zmk_ble_profile profiles[PROFILE_COUNT];
static u8_t active_profile;
+#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
+#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
+
static const struct bt_data zmk_ble_ad[] = {
+ BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
+ BT_DATA_BYTES(BT_DATA_GAP_APPEARANCE, 0xC1, 0x03),
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
BT_DATA_BYTES(BT_DATA_UUID16_SOME,
#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)