diff options
author | Pete Johanson <peter@peterjohanson.com> | 2020-09-08 23:26:00 -0400 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2020-09-13 22:33:29 -0400 |
commit | 39f980a06dac1769e4f09abaf19d3ccbb4b34e67 (patch) | |
tree | 01ca7749443822591e62087bcade5d321974defd /app/include | |
parent | e88d0833c5f8ddd2b8a9b93ab7b6d03c141f8463 (diff) |
feat(bluetooth): Add back profiles, split fixes.
* Add back in profiles, not using Zephyr
BT identity infrastructure.
* Restore additional `&bt` commands for profile
operations.
* Fix for split pairing and subscriptions, since
Zephyr persists subscriptions across connects.
* Remove keymap from peripheral builds, reduces
firmware size, and avoids unneeded attempts
to send HID data.
Diffstat (limited to 'app/include')
-rw-r--r-- | app/include/dt-bindings/zmk/bt.h | 11 | ||||
-rw-r--r-- | app/include/zmk/ble.h | 9 | ||||
-rw-r--r-- | app/include/zmk/ble/profile.h | 16 | ||||
-rw-r--r-- | app/include/zmk/events/ble-active-profile-changed.h | 22 |
4 files changed, 54 insertions, 4 deletions
diff --git a/app/include/dt-bindings/zmk/bt.h b/app/include/dt-bindings/zmk/bt.h index 24d27ae..b2899ab 100644 --- a/app/include/dt-bindings/zmk/bt.h +++ b/app/include/dt-bindings/zmk/bt.h @@ -4,11 +4,18 @@ * SPDX-License-Identifier: MIT */ -#define BT_CLEAR_BONDS_CMD 0 +#define BT_CLEAR_BONDS_CMD 0 +#define BT_PROF_NEXT_CMD 1 +#define BT_PROF_PREV_CMD 2 +#define BT_PROF_SEL_CMD 3 +// #define BT_FULL_RESET_CMD 4 /* Note: Some future commands will include additional parameters, so we defines these aliases up front. */ -#define BT_CLEAR_BONDS BT_CLEAR_BONDS_CMD 0
\ No newline at end of file +#define BT_CLEAR_BONDS BT_CLEAR_BONDS_CMD 0 +#define BT_PROF_NEXT BT_PROF_NEXT_CMD 0 +#define BT_PROF_PREV BT_PROF_PREV_CMD 0 +#define BT_PROF_SEL BT_PROF_SEL_CMD
\ No newline at end of file diff --git a/app/include/zmk/ble.h b/app/include/zmk/ble.h index 62d476e..1cf71a7 100644 --- a/app/include/zmk/ble.h +++ b/app/include/zmk/ble.h @@ -6,11 +6,16 @@ #pragma once -#include <bluetooth/addr.h> #include <zmk/keys.h> - +#include <zmk/ble/profile.h> int zmk_ble_clear_bonds(); +int zmk_ble_prof_next(); +int zmk_ble_prof_prev(); +int zmk_ble_prof_select(u8_t index); + +bt_addr_le_t *zmk_ble_active_profile_addr(); +char *zmk_ble_active_profile_name(); int zmk_ble_unpair_all(); bool zmk_ble_handle_key_user(struct zmk_key_event *key_event); diff --git a/app/include/zmk/ble/profile.h b/app/include/zmk/ble/profile.h new file mode 100644 index 0000000..9a79c6d --- /dev/null +++ b/app/include/zmk/ble/profile.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2020 Peter Johanson <peter@peterjohanson.com> + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include <bluetooth/addr.h> + +#define ZMK_BLE_PROFILE_NAME_MAX 15 + +struct zmk_ble_profile { + char name[ZMK_BLE_PROFILE_NAME_MAX]; + bt_addr_le_t peer; +}; diff --git a/app/include/zmk/events/ble-active-profile-changed.h b/app/include/zmk/events/ble-active-profile-changed.h new file mode 100644 index 0000000..c464236 --- /dev/null +++ b/app/include/zmk/events/ble-active-profile-changed.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020 Peter Johanson <peter@peterjohanson.com> + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include <zephyr.h> +#include <zmk/event-manager.h> +#include <device.h> + +#include <zmk/ble/profile.h> + + +struct ble_active_profile_changed { + struct zmk_event_header header; + u8_t index; + struct zmk_ble_profile *profile; +}; + +ZMK_EVENT_DECLARE(ble_active_profile_changed); |