Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of NFC using Windows Proximity APIs in Rust
// Example of NFC using Windows Proximity APIs
// Tested using Sony RC-S380 (make sure you enable NFP in the driver).
use winrt::*; // import various helper types
use winrt::windows::foundation;
use winrt::windows::networking::proximity;
use std::{thread, time};
const URL: &str = "https://dcoles.net";
fn main() {
let device = proximity::ProximityDevice::get_default().unwrap()
.expect("No default proximity device found");
let url = foundation::Uri::create_uri(&FastHString::new(URL)).unwrap();
device.publish_uri_message(&url).unwrap();
loop {
thread::sleep(time::Duration::from_secs(3600));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment