Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update to a later meshtastic/rust and switch in available_ble_devices#528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
matthewCmatt wants to merge1 commit intomain
base:main
Choose a base branch
Loading
frombluetooth-discovery
Draft
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 63 additions & 128 deletionssrc-tauri/Cargo.lock
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletionsrc-tauri/Cargo.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ tauri-plugin-store = "2"
tokio-serial = "5.4.4"
tauri-plugin-log = { features = ["colored"] , version = "2" }
chrono = { version = "0.4.34", features = ["serde"] }
meshtastic = { git = "https://github.com/meshtastic/rust.git", rev = "6057294aa6cfa979033299f7f02cfe6ceafddeda", features = ["ts-gen", "bluetooth-le"] }
meshtastic = { git = "https://github.com/lukipuki/meshtastic-rust.git", rev = "71978de0121ed87c5953621d7fbe59f25f68fe13", features = ["ts-gen", "bluetooth-le"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

aspecifically this part@ajmcquilkin

specta = { git = "https://github.com/ajmcquilkin/specta.git", rev = "6a8731d168376e28e163dd9cd328055b11d1af82", version = "1.0.3", features = ["chrono"] }
tauri-plugin-dialog = "2"
tauri-plugin-shell = "2"
Expand Down
4 changes: 4 additions & 0 deletionssrc-tauri/src/device/state.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,6 +184,10 @@ impl MeshDevice {
debug!("Received health metrics, not handling");
trace!("{:?}", health_metrics);
}
protobufs::telemetry::Variant::HostMetrics(host_metrics) => {
debug!("Received host metrics, not handling");
trace!("{:?}", host_metrics);
}
}
}
} else {
Expand Down
56 changes: 12 additions & 44 deletionssrc-tauri/src/ipc/commands/connections.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,49 +47,16 @@ pub async fn get_all_bluetooth() -> Result<Vec<String>, CommandError> {

const SCAN_DURATION: std::time::Duration = std::time::Duration::from_secs(5);

// Initialize Bluetooth manager
let manager = Manager::new()
let devices = meshtastic::utils::stream::available_ble_devices(SCAN_DURATION)
.await
.map_err(|e| e.to_string())?;

// Get available Bluetooth adapters
let adapters = manager.adapters().await
.map_err(|e| e.to_string())?;

let adapter = adapters
.into_iter()
.next()
.ok_or("failed to find adapter")?;

// Start scanning for devices
adapter.start_scan(ScanFilter {
services: vec![MSH_SERVICE],
}).await
.map_err(|e| e.to_string())?;

debug!("Started Bluetooth scan");

// Allow some time for devices to be discovered
time::sleep(SCAN_DURATION).await;

let peripherals = adapter.peripherals().await
.map_err(|e| e.to_string())?;

let mut devices = Vec::new();

for peripheral in peripherals {
if let Ok(Some(props)) = peripheral.properties().await {
if let Some(name) = props.local_name {
devices.push(name);
}
// else skip this peripheral
}
// else skip this peripheral
}

devices.sort();

debug!("Discovered Bluetooth devices: {:?}", devices);
.map_err(|e| format!("Error getting availabled BLE devices: {:?}", e))?
.iter()
.map(|port| match port {
BleId::Name(name) => name.to_string(),
BleId::MacAddress(_) => "".to_string(),
BleId::NameAndMac(name, _) => name.to_string(),
})
.collect();

Ok(devices)
}
Expand DownExpand Up@@ -197,8 +164,9 @@ pub async fn connect_to_bluetooth(

// Create serial connection stream

let stream =
build_ble_stream(&BleId::from_name(&bluetooth_name), Duration::from_secs(5)).await.unwrap();
let stream = build_ble_stream(&BleId::from_name(&bluetooth_name), Duration::from_secs(5))
.await
.unwrap();

// Create and persist new connection

Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp