mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Apply the new device crate changes
This commit is contained in:
parent
35b206ad2d
commit
4eec2c6ddc
3 changed files with 29 additions and 10 deletions
|
@ -312,6 +312,17 @@ impl BluetoothManager {
|
|||
device_id
|
||||
}
|
||||
|
||||
fn device_from_service_id(&self, service_id: &str) -> Option<BluetoothDevice> {
|
||||
let device_id = match self.service_to_device.get(service_id) {
|
||||
Some(id) => id,
|
||||
None => return None,
|
||||
};
|
||||
match self.cached_devices.get(device_id) {
|
||||
Some(d) => Some(d.clone()),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
// Service
|
||||
|
||||
fn get_and_cache_gatt_services(&mut self,
|
||||
|
@ -617,11 +628,15 @@ impl BluetoothManager {
|
|||
Some(a) => a,
|
||||
None => return drop(sender.send(Err(BluetoothError::Type(ADAPTER_ERROR.to_string())))),
|
||||
};
|
||||
let device = match self.device_from_service_id(&service_id) {
|
||||
Some(device) => device,
|
||||
None => return drop(sender.send(Err(BluetoothError::NotFound))),
|
||||
};
|
||||
let primary_service = match self.get_gatt_service(&mut adapter, &service_id) {
|
||||
Some(s) => s,
|
||||
None => return drop(sender.send(Err(BluetoothError::NotFound))),
|
||||
};
|
||||
let services = primary_service.get_includes().unwrap_or(vec!());
|
||||
let services = primary_service.get_includes(device).unwrap_or(vec!());
|
||||
for service in services {
|
||||
if let Ok(service_uuid) = service.get_uuid() {
|
||||
if uuid == service_uuid {
|
||||
|
@ -644,11 +659,15 @@ impl BluetoothManager {
|
|||
Some(a) => a,
|
||||
None => return drop(sender.send(Err(BluetoothError::Type(ADAPTER_ERROR.to_string())))),
|
||||
};
|
||||
let device = match self.device_from_service_id(&service_id) {
|
||||
Some(device) => device,
|
||||
None => return drop(sender.send(Err(BluetoothError::NotFound))),
|
||||
};
|
||||
let primary_service = match self.get_gatt_service(&mut adapter, &service_id) {
|
||||
Some(s) => s,
|
||||
None => return drop(sender.send(Err(BluetoothError::NotFound))),
|
||||
};
|
||||
let services = primary_service.get_includes().unwrap_or(vec!());
|
||||
let services = primary_service.get_includes(device).unwrap_or(vec!());
|
||||
let mut services_vec = vec!();
|
||||
for service in services {
|
||||
if let Ok(service_uuid) = service.get_uuid() {
|
||||
|
|
8
components/servo/Cargo.lock
generated
8
components/servo/Cargo.lock
generated
|
@ -217,7 +217,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "blurz"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"dbus 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -515,10 +515,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "device"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/devices#6d40b1412fb496b0d9434ee2f46e9dfc4dc67ae7"
|
||||
source = "git+https://github.com/servo/devices#4a6ab4be0de229fafa6aa3657a5702646832ba08"
|
||||
dependencies = [
|
||||
"blurdroid 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"blurz 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"blurz 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2905,7 +2905,7 @@ dependencies = [
|
|||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
||||
"checksum blurdroid 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5fce4ea3366b583e9d49e1aa3a42252e53b42911bccd06f31c3e81c48ccfc79e"
|
||||
"checksum blurz 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96134f6ac62fa6925761dbdb4096617d65d7c1d383d90e5c2d4c489919f773dc"
|
||||
"checksum blurz 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d49796c8d5a1b5f6b2b8686e46ed4ab842987c477f765b69f1d3e8df6072608"
|
||||
"checksum brotli 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "bff2d5511b5ba5840f46cc3f9c0c3ab09db20e9b9a4db344ef7df3fb547a627a"
|
||||
"checksum browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)" = "<none>"
|
||||
"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
|
||||
|
|
8
ports/cef/Cargo.lock
generated
8
ports/cef/Cargo.lock
generated
|
@ -188,7 +188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "blurz"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"dbus 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -470,10 +470,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "device"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/devices#6d40b1412fb496b0d9434ee2f46e9dfc4dc67ae7"
|
||||
source = "git+https://github.com/servo/devices#4a6ab4be0de229fafa6aa3657a5702646832ba08"
|
||||
dependencies = [
|
||||
"blurdroid 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"blurz 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"blurz 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2763,7 +2763,7 @@ dependencies = [
|
|||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
||||
"checksum blurdroid 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5fce4ea3366b583e9d49e1aa3a42252e53b42911bccd06f31c3e81c48ccfc79e"
|
||||
"checksum blurz 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96134f6ac62fa6925761dbdb4096617d65d7c1d383d90e5c2d4c489919f773dc"
|
||||
"checksum blurz 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d49796c8d5a1b5f6b2b8686e46ed4ab842987c477f765b69f1d3e8df6072608"
|
||||
"checksum brotli 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "bff2d5511b5ba5840f46cc3f9c0c3ab09db20e9b9a4db344ef7df3fb547a627a"
|
||||
"checksum browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)" = "<none>"
|
||||
"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue