Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Edit `~/.config/nmrs/style.css` to customize the interface. There are also pre-d
- [ ] Any
- [X] Wired
- [ ] ADSL
- [ ] Bluetooth
- [X] Bluetooth
- [ ] Bond
- [ ] Bridge
- [ ] Dummy
Expand Down Expand Up @@ -202,7 +202,7 @@ Edit `~/.config/nmrs/style.css` to customize the interface. There are also pre-d
- [ ] DNS Manager
- [ ] PPP
- [ ] Secret Agent
- [ ] VPN Connection
- [X] VPN Connection (WireGuard)
- [ ] VPN Plugin
- [ ] Wi-Fi P2P
- [ ] WiMAX NSP
Expand Down
2 changes: 1 addition & 1 deletion nmrs-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ categories = ["gui"]
publish = false

[dependencies]
nmrs = { path = "../nmrs", version = "1.1.0" }
nmrs = { version = "2.0.0-dev", path = "../nmrs"}
gtk = { version = "0.10.3", package = "gtk4" }
glib = "0.21.5"
tokio = { version = "1.48.0", features = ["full"] }
Expand Down
3 changes: 2 additions & 1 deletion nmrs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nmrs"
version = "1.2.0"
version = "2.0.0-dev"
authors = ["Akrm Al-Hakimi <alhakimiakrmj@gmail.com>"]
edition.workspace = true
rust-version = "1.78.0"
Expand All @@ -21,6 +21,7 @@ thiserror.workspace = true
uuid.workspace = true
futures.workspace = true
futures-timer.workspace = true
async-trait = "0.1.89"

[dev-dependencies]
tokio.workspace = true
Expand Down
17 changes: 17 additions & 0 deletions nmrs/examples/bluetooth.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// List Bluetooth devices using NetworkManager
use nmrs::{NetworkManager, Result};

#[tokio::main]
async fn main() -> Result<()> {
let nm = NetworkManager::new().await?;

println!("Scanning for Bluetooth devices...");
let devices = nm.list_bluetooth_devices().await?;

// List bluetooth devices
for d in devices {
println!("{d}");
}

Ok(())
}
57 changes: 57 additions & 0 deletions nmrs/examples/bluetooth_connect.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/// Connect to a Bluetooth device using NetworkManager.
use nmrs::models::BluetoothIdentity;
use nmrs::{NetworkManager, Result};
#[tokio::main]
async fn main() -> Result<()> {
let nm = NetworkManager::new().await?;

println!("Scanning for Bluetooth devices...");
let devices = nm.list_bluetooth_devices().await?;

if devices.is_empty() {
println!("No Bluetooth devices found.");
println!("\nMake sure:");
println!(" 1. Bluetooth is enabled");
println!(" 2. Device is paired (use 'bluetoothctl')");
return Ok(());
}

// This will print all devices that have been explicitly paired using
// `bluetoothctl pair <MAC_ADDRESS>`
println!("\nAvailable Bluetooth devices:");
for (i, device) in devices.iter().enumerate() {
println!(" {}. {}", i + 1, device);
}

// Connect to the first device in the list
if let Some(device) = devices.first() {
println!("\nConnecting to: {}", device);

let settings = BluetoothIdentity {
bdaddr: device.bdaddr.clone(),
bt_device_type: device.bt_caps.into(),
};

let name = device
.alias
.as_ref()
.or(device.name.as_ref())
.map(|s| s.as_str())
.unwrap_or("Bluetooth Device");

match nm.connect_bluetooth(name, &settings).await {
Ok(_) => println!("✓ Successfully connected to {name}"),
Err(e) => {
eprintln!("✗ Failed to connect: {}", e);
return Ok(());
}
}

/* match nm.forget_bluetooth(name).await {
Ok(_) => println!("Disconnected {name}"),
Err(e) => eprintln!("Failed to forget: {e}"),
}*/
}

Ok(())
}
1 change: 1 addition & 0 deletions nmrs/examples/vpn_connect.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// Connect to a WireGuard VPN using NetworkManager and print the assigned IP address.
use nmrs::{NetworkManager, VpnCredentials, VpnType, WireGuardPeer};

#[tokio::main]
Expand Down
1 change: 1 addition & 0 deletions nmrs/examples/wifi_scan.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// Scan for available WiFi networks and print their SSIDs and signal strengths.
use nmrs::NetworkManager;

#[tokio::main]
Expand Down
Loading
Loading