feat(split): raise status changed events on central

This commit is contained in:
ReFil 2023-11-20 13:03:56 +00:00
parent 2ee76be6fe
commit 6ed14e9634

View file

@ -29,6 +29,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/events/sensor_event.h>
#include <zmk/events/battery_state_changed.h>
#include <zmk/hid_indicators_types.h>
#include <zmk/events/split_peripheral_status_changed.h>
static int start_scanning(void);
@ -712,6 +713,8 @@ static void split_central_connected(struct bt_conn *conn, uint8_t conn_err) {
confirm_peripheral_slot_conn(conn);
split_central_process_connection(conn);
raise_zmk_split_peripheral_status_changed(
(struct zmk_split_peripheral_status_changed){.connected = true});
}
static void split_central_disconnected(struct bt_conn *conn, uint8_t reason) {
@ -728,6 +731,8 @@ static void split_central_disconnected(struct bt_conn *conn, uint8_t reason) {
k_msgq_put(&peripheral_batt_lvl_msgq, &ev, K_NO_WAIT);
k_work_submit(&peripheral_batt_lvl_work);
#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING)
raise_zmk_split_peripheral_status_changed(
(struct zmk_split_peripheral_status_changed){.connected = false});
err = release_peripheral_slot_for_conn(conn);