netget/server/bluetooth_ble_weight_scale/
mod.rs1pub mod actions;
3use anyhow::Result;
4use std::sync::Arc;
5use tokio::sync::mpsc;
6
7pub struct BluetoothBleWeightScale;
8impl BluetoothBleWeightScale {
9 #[cfg(all(unix, feature = "bluetooth"))]
10 pub async fn spawn_with_llm_actions(
11 device_name: String,
12 llm: crate::llm::ollama_client::OllamaClient,
13 state: Arc<crate::state::app_state::AppState>,
14 tx: mpsc::UnboundedSender<String>,
15 id: crate::state::ServerId,
16 inst: String,
17 ) -> Result<std::net::SocketAddr> {
18 crate::server::bluetooth_ble::BluetoothBle::spawn_with_llm_actions(
19 device_name,
20 llm,
21 state,
22 tx,
23 id,
24 {
25 let inst = inst.trim().trim_end_matches('.').trim();
31 if inst.is_empty() {
32 "Configure as a BLE Weight Scale Service (0x181D).".to_string()
33 } else {
34 format!("{inst}. Configure as a BLE Weight Scale Service (0x181D).")
35 }
36 },
37 )
38 .await
39 }
40}
41#[cfg(any(all(unix, not(feature = "bluetooth")), not(unix)))]
42impl BluetoothBleWeightScale {
43 pub async fn spawn_with_llm_actions(
44 _: String,
45 _: crate::llm::ollama_client::OllamaClient,
46 _: Arc<crate::state::app_state::AppState>,
47 _: mpsc::UnboundedSender<String>,
48 _: crate::state::ServerId,
49 _: String,
50 ) -> Result<std::net::SocketAddr> {
51 anyhow::bail!("BLE weight-scale not enabled")
52 }
53}
54
55pub const WEIGHT_SCALE_SERVICE: u16 = 0x181D;
56pub const WEIGHT_MEASUREMENT: u16 = 0x2A9D;