feat(bluetooth-hid): 支持经典蓝牙 HID 后端

This commit is contained in:
mofeng-git
2026-09-06 11:15:45 +08:00
parent 3014edffbb
commit 2c19208094
33 changed files with 2792 additions and 60 deletions

View File

@@ -5,7 +5,7 @@ use crate::error::Result;
use crate::web::state::UsbApiState;
use super::types::HidConfigUpdate;
use super::usb_update::{stage_hid_config_update, update_usb_config};
use super::usb_update::{stage_hid_config_update, update_usb_config_with_reset};
pub async fn get_hid_config(State(state): State<UsbApiState>) -> Json<HidConfig> {
Json(state.config.get().hid.clone())
@@ -15,7 +15,8 @@ pub async fn update_hid_config(
State(state): State<UsbApiState>,
Json(req): Json<HidConfigUpdate>,
) -> Result<Json<HidConfig>> {
let config = update_usb_config(&state, move |staged| {
let reset = req.bluetooth_reset_pairing.unwrap_or(false);
let config = update_usb_config_with_reset(&state, reset, move |staged| {
stage_hid_config_update(&mut staged.hid, &req)
})
.await?;