This commit is contained in:
Anton Palgunov 2020-07-08 14:24:30 +01:00
commit e52db1ac8e
No known key found for this signature in database
GPG Key ID: 2F082FC6B31FC9F1
4 changed files with 80 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

55
Cargo.lock generated Normal file
View File

@ -0,0 +1,55 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "blurz"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1bc2df4d0f1d373b324672d9966aca3f5ba1f03d69edad6240144774539ea59"
dependencies = [
"dbus",
"hex",
]
[[package]]
name = "dbus"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48b5f0f36f1eebe901b0e6bee369a77ed3396334bf3f09abd46454a576f71819"
dependencies = [
"libc",
"libdbus-sys",
]
[[package]]
name = "hex"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
[[package]]
name = "libc"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701"
[[package]]
name = "libdbus-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc12a3bc971424edbbf7edaf6e5740483444db63aa8e23d3751ff12a30f306f0"
dependencies = [
"pkg-config",
]
[[package]]
name = "pkg-config"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
[[package]]
name = "sony-fastconnect"
version = "0.1.0"
dependencies = [
"blurz",
]

10
Cargo.toml Normal file
View File

@ -0,0 +1,10 @@
[package]
name = "sony-fastconnect"
version = "0.1.0"
authors = ["Anton Palgunov <toxblh@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
blurz = "0.4.0"

14
src/main.rs Normal file
View File

@ -0,0 +1,14 @@
use blurz::BluetoothSession;
use blurz::BluetoothDevice;
fn main() {
let path = "/org/bluez/hci0/dev_70_26_05_10_48_04";
let session = BluetoothSession::create_session(None).unwrap();
let device = BluetoothDevice::new(&session, path.to_string());
match device.connect(2_000) {
Ok(_) => println!("Connected!"),
Err(e) => println!("Error {}", e)
}
}