diff options
author | Pete Johanson <peter@peterjohanson.com> | 2020-09-13 22:43:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-13 22:43:45 -0400 |
commit | 160f296bfb562ca0596630f84c4121920ea3c304 (patch) | |
tree | 63218f4af1b20108af667de8e346d204076064bb /app/include | |
parent | 304603240f7ba16f67912a0031c64fb9ae4e8279 (diff) | |
parent | 4658999e31865e54d02955c500c716385e6c69d8 (diff) |
Merge pull request #133 from petejohanson/bluetooth/ident-management
feat(bluetooth): Proper basic bond management, new `bt` behavior for resetting bond to host.
Diffstat (limited to 'app/include')
-rw-r--r-- | app/include/dt-bindings/zmk/bt.h | 21 | ||||
-rw-r--r-- | app/include/zmk/ble.h | 13 | ||||
-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, 72 insertions, 0 deletions
diff --git a/app/include/dt-bindings/zmk/bt.h b/app/include/dt-bindings/zmk/bt.h new file mode 100644 index 0000000..bf8b4f5 --- /dev/null +++ b/app/include/dt-bindings/zmk/bt.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2020 Peter Johanson <peter@peterjohanson.com> + * + * SPDX-License-Identifier: MIT + */ + +#define BT_CLR_CMD 0 +#define BT_NXT_CMD 1 +#define BT_PRV_CMD 2 +#define BT_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_CLR BT_CLR_CMD 0 +#define BT_NXT BT_NXT_CMD 0 +#define BT_PRV BT_PRV_CMD 0 +#define BT_SEL BT_SEL_CMD
\ No newline at end of file diff --git a/app/include/zmk/ble.h b/app/include/zmk/ble.h index d0aaa96..1cf71a7 100644 --- a/app/include/zmk/ble.h +++ b/app/include/zmk/ble.h @@ -7,6 +7,19 @@ #pragma once #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); + +#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) +void zmk_ble_set_peripheral_addr(bt_addr_le_t *addr); +#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) */
\ No newline at end of file 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); |