Integrate the devices respository (#30974)

Despite the name of this dependency, it only handles bluetooth. Because
it's a separate repository. Integrating it, allows changes here to be
tested more consistently. In addition, it's likely that new bluetooth
libraries will allow removing the majority of the platform-specific code
in this directory.

This is based on the version of this dependency from:
https://github.com/servo/devices/pull/34
This commit is contained in:
Martin Robinson 2024-01-09 10:13:41 +01:00 committed by GitHub
parent fddc4a430f
commit 6a804cd775
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 3880 additions and 27 deletions

View file

@ -8,12 +8,12 @@ use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::string::String;
use device::bluetooth::{
use uuid::Uuid;
use crate::bluetooth::{
BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic, BluetoothGATTDescriptor,
BluetoothGATTService,
};
use uuid::Uuid;
use crate::BluetoothManager;
thread_local!(pub static CACHED_IDS: RefCell<HashSet<Uuid>> = RefCell::new(HashSet::new()));
@ -152,7 +152,7 @@ fn create_device(
name: String,
address: String,
) -> Result<BluetoothDevice, Box<dyn Error>> {
let device = BluetoothDevice::create_mock_device(adapter.clone(), generate_id().to_string())?;
let device = adapter.create_mock_device(generate_id().to_string())?;
device.set_name(Some(name))?;
device.set_address(address)?;
device.set_connectable(true)?;