tauri_plugin_bluetooth_manager/
models.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Deserialize, Serialize)]
4#[serde(rename_all = "camelCase")]
5pub struct PingRequest {
6    pub value: Option<String>,
7}
8
9#[derive(Debug, Clone, Default, Deserialize, Serialize)]
10#[serde(rename_all = "camelCase")]
11pub struct PingResponse {
12    pub value: Option<String>,
13}
14
15#[derive(Serialize, Debug, Clone)]
16pub struct AdapterInfo {
17    pub path: String,
18    pub address: String, // MAC address
19    pub name: String,
20    pub alias: String,
21    pub class: u32, // Class of device
22    pub powered: bool,
23    pub discoverable: bool,
24    pub discoverable_timeout: u32,
25    pub pairable: bool,
26    pub pairable_timeout: u32,
27    pub discovering: bool,
28    pub uuids: Vec<String>,
29    pub modalias: Option<String>, // Ejemplo: "usb:v1D6Bp0246d0540"
30}
31
32#[derive(Serialize, Debug, Clone)]
33pub struct DeviceInfo {
34    pub path: String,
35    pub address: String, // MAC address
36    pub name: Option<String>,
37    pub alias: Option<String>,
38    pub class: Option<u32>,
39    pub appearance: Option<u16>,
40    pub icon: Option<String>,
41    pub paired: bool,
42    pub trusted: bool,
43    pub blocked: bool,
44    pub legacy_pairing: bool,
45    pub rssi: Option<i16>,
46    pub tx_power: Option<i16>, // TxPower
47    pub connected: bool,
48    pub uuids: Vec<String>,
49    pub adapter: String, // ObjectPath del adaptador al que pertenece
50    pub services_resolved: bool,
51    // Podríamos añadir `manufacturer_data: Option<HashMap<u16, Vec<u8>>>`
52    // y `service_data: Option<HashMap<String, Vec<u8>>>` si es necesario.
53}
54
55#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
56pub struct BluetoothChange {
57    pub change_type: String,
58    pub data: serde_json::Value,
59}