netget/server/bluetooth_ble_data_stream/
mod.rs1pub mod actions;
3use anyhow::Result;
4use std::sync::Arc;
5use tokio::sync::mpsc;
6
7pub struct BluetoothBleDataStream;
8impl BluetoothBleDataStream {
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 const SENTENCE: &str = "Configure as a BLE data streaming service with custom GATT \
24 characteristics for real-time sensor data.";
25 let inst = inst.trim().trim_end_matches('.').trim();
26 let instruction = if inst.is_empty() {
27 SENTENCE.to_string()
28 } else {
29 format!("{inst}. {SENTENCE}")
30 };
31 crate::server::bluetooth_ble::BluetoothBle::spawn_with_llm_actions(
32 device_name,
33 llm,
34 state,
35 tx,
36 id,
37 instruction,
38 )
39 .await
40 }
41}
42#[cfg(any(all(unix, not(feature = "bluetooth")), not(unix)))]
43impl BluetoothBleDataStream {
44 pub async fn spawn_with_llm_actions(
45 _: String,
46 _: crate::llm::ollama_client::OllamaClient,
47 _: Arc<crate::state::app_state::AppState>,
48 _: mpsc::UnboundedSender<String>,
49 _: crate::state::ServerId,
50 _: String,
51 ) -> Result<std::net::SocketAddr> {
52 anyhow::bail!("BLE data-stream not enabled")
53 }
54}