feat(ble): Support perhipheral battery levels.

* Add ability to fetch and report peripheral battery levels
  on split centrals.
* Add additional support for adding a new Battery Level
  service to split centrals that exposes fetched peripheral
  battery levels to connected hosts.

Co-authored-by: Peter Johanson <peter@peterjohanson.com>
This commit is contained in:
Gabor Hornyak
2022-03-29 21:20:52 +00:00
committed by Pete Johanson
parent d35311af97
commit 0e2f94b73b
9 changed files with 299 additions and 21 deletions

View File

@@ -16,12 +16,36 @@ config ZMK_SPLIT_ROLE_CENTRAL
select BT_GATT_AUTO_DISCOVER_CCC
select BT_SCAN_WITH_IDENTITY
# Bump this value needed for concurrent GATT discovery of splits
config BT_L2CAP_TX_BUF_COUNT
default 5 if ZMK_SPLIT_ROLE_CENTRAL
if ZMK_SPLIT_ROLE_CENTRAL
config ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS
int "Number of peripherals that will connect to the central."
default 1
menuconfig ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING
bool "Fetch Peripheral Battery Level Info"
help
Adds internal support for fetching the battery levels from peripherals
and generating events in the ZMK eventing system.
if ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING
config ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_QUEUE_SIZE
int "Max number of battery level events to queue when received from peripherals"
default ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS
config ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY
bool "Proxy Peripheral Battery Level Info"
help
Adds support for reporting the battery levels of connected split
peripherals through an additional Battery Level service.
endif
config ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE
int "Max number of key position state events to queue when received from peripherals"
default 5