Skip to content
Draft
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: 3 additions & 0 deletions src/bluetooth/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ use crate::linux::bluetooth;
#[cfg(target_os="macos")]
use crate::macos::bluetooth;

#[cfg(target_os="windows")]
use crate::windows::bluetooth;

pub use bluetooth::*;
3 changes: 2 additions & 1 deletion src/fsm/sender_fsm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg(target_os="linux")]
#![cfg(any(target_os = "linux", target_os = "windows"))]

use dialoguer::{Select, theme::ColorfulTheme};
use std::time::Duration;

Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use utils::cli::{Cli, Commands};
mod tunnel;
mod linux;
mod macos;
mod windows;
mod crypto;
use tokio::signal;

Expand Down
3 changes: 3 additions & 0 deletions src/tunnel/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ use crate::linux::connection;
#[cfg(target_os = "macos")]
use crate::macos::connection;

#[cfg(target_os = "windows")]
use crate::windows::connection;

pub use connection::*;
4 changes: 4 additions & 0 deletions src/tunnel/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ use crate::linux::transfer;
#[cfg(target_os = "macos")]
use crate::macos::transfer;

#[cfg(target_os="windows")]
use crate::windows::transfer;


pub use transfer::*;
28 changes: 28 additions & 0 deletions src/windows/bluetooth.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use std::error::Error;
use std::time::{Duration, Instant};
use tokio::time::sleep;

#[derive(Clone, Debug)]


impl AdapterController {
pub async fn initialize() -> Result<Self> {}

pub async fn scan_devices(
&self,
timeout_secs: Duration,
) -> Result<Vec<>, Box<dyn std::error::Error>> {}

pub async fn serve_gatt(
&self,
key_data: Vec<u8>,
expected_mac: String,
) -> Result<(), Box<dyn std::error::Error>> {}
}

pub async fn receive_fling_key() -> Result<Vec<u8>, Box<dyn Error>> {
}

pub fn get_bluetooth_mac() -> Option<String> {

}
15 changes: 15 additions & 0 deletions src/windows/connection.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::{process::Command, time::Duration};
use tokio::time::sleep;

/// Launches a Wi-Fi Direct access point using hostapd and sets up DHCP
pub async fn create_wifi_direct_network(ssid: &str, password: &str) -> Result<String, String> {}

/// Waits up to 30 seconds for a client to join the AP
pub async fn wait_for_receiver() -> Result<String, String> {}

pub async fn cleanup_wifi() {}

///Joins a Full AP network controlled by sender
pub fn join_wifi_direct_network(ssid: &str, password: &str) -> bool {}


4 changes: 4 additions & 0 deletions src/windows/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#![cfg(target_os="windows")]
pub mod transfer;
pub mod connection;
pub mod bluetooth;
18 changes: 18 additions & 0 deletions src/windows/transfer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use indicatif::{ProgressBar, ProgressStyle};
use std::path::Path;
use std::process::Stdio;
use std::time::Instant;
use tokio::{
fs::File,
io::{AsyncReadExt, AsyncWriteExt, BufReader},
net::TcpListener,
process::Command,
time::{Duration},
};

const PORT: u16 = 8080;
const BUF_SIZE: usize = 1024 * 1024;

pub async fn send_file(filepath: &str) -> Result<(), String> {}

pub async fn receive_file(output_dir: &str) -> Result<(), String> {}