pub struct BluetoothManager {
pub(crate) adapter: Option<BluetoothAdapter>,
pub(crate) address_to_id: HashMap<String, String>,
pub(crate) service_to_device: HashMap<String, String>,
pub(crate) characteristic_to_service: HashMap<String, String>,
pub(crate) descriptor_to_characteristic: HashMap<String, String>,
pub(crate) cached_devices: HashMap<String, BluetoothDevice>,
pub(crate) cached_services: HashMap<String, BluetoothGATTService>,
pub(crate) cached_characteristics: HashMap<String, BluetoothGATTCharacteristic>,
pub(crate) cached_descriptors: HashMap<String, BluetoothGATTDescriptor>,
pub(crate) allowed_services: HashMap<String, HashSet<String>>,
pub(crate) embedder_proxy: EmbedderProxy,
}Fields§
§adapter: Option<BluetoothAdapter>§address_to_id: HashMap<String, String>§service_to_device: HashMap<String, String>§characteristic_to_service: HashMap<String, String>§descriptor_to_characteristic: HashMap<String, String>§cached_devices: HashMap<String, BluetoothDevice>§cached_services: HashMap<String, BluetoothGATTService>§cached_characteristics: HashMap<String, BluetoothGATTCharacteristic>§cached_descriptors: HashMap<String, BluetoothGATTDescriptor>§allowed_services: HashMap<String, HashSet<String>>§embedder_proxy: EmbedderProxyImplementations§
Source§impl BluetoothManager
impl BluetoothManager
pub fn new( adapter: Option<BluetoothAdapter>, embedder_proxy: EmbedderProxy, ) -> BluetoothManager
Sourcepub(crate) fn start_sync(&mut self, receiver: GenericReceiver<BluetoothRequest>)
pub(crate) fn start_sync(&mut self, receiver: GenericReceiver<BluetoothRequest>)
Synchronous message loop.
Sourcepub(crate) async fn handle_message(&mut self, msg: BluetoothRequest) -> bool
pub(crate) async fn handle_message(&mut self, msg: BluetoothRequest) -> bool
Handle a single message. Returns true if the event loop should exit.
pub(crate) async fn test( &mut self, data_set_name: String, ) -> BluetoothResult<()>
pub(crate) fn remove_ids_from_caches( &mut self, service_ids: Vec<String>, characteristic_ids: Vec<String>, descriptor_ids: Vec<String>, )
pub async fn get_or_create_adapter(&mut self) -> Option<BluetoothAdapter>
pub(crate) async fn get_adapter(&mut self) -> BluetoothResult<BluetoothAdapter>
pub(crate) async fn get_and_cache_devices( &mut self, adapter: &mut BluetoothAdapter, ) -> Vec<BluetoothDevice>
pub(crate) async fn get_device( &mut self, adapter: &mut BluetoothAdapter, device_id: &str, ) -> Option<&BluetoothDevice>
pub(crate) async fn select_device( &mut self, webview_id: WebViewId, devices: Vec<BluetoothDevice>, adapter: &BluetoothAdapter, ) -> Option<String>
pub(crate) fn generate_device_id(&mut self) -> String
pub(crate) fn device_from_service_id( &self, service_id: &str, ) -> Option<BluetoothDevice>
pub(crate) fn device_is_cached(&self, device_id: &str) -> bool
pub(crate) async fn device_matches_filter( &mut self, device_id: &str, filters: &BluetoothScanfilterSequence, ) -> BluetoothResult<bool>
pub(crate) async fn get_and_cache_gatt_services( &mut self, adapter: &mut BluetoothAdapter, device_id: &str, ) -> Vec<BluetoothGATTService>
pub(crate) async fn get_gatt_service( &mut self, adapter: &mut BluetoothAdapter, service_id: &str, ) -> Option<&BluetoothGATTService>
pub(crate) fn service_is_cached(&self, service_id: &str) -> bool
pub(crate) async fn get_and_cache_gatt_characteristics( &mut self, adapter: &mut BluetoothAdapter, service_id: &str, ) -> Vec<BluetoothGATTCharacteristic>
pub(crate) async fn get_gatt_characteristic( &mut self, adapter: &mut BluetoothAdapter, characteristic_id: &str, ) -> Option<&BluetoothGATTCharacteristic>
pub(crate) fn get_characteristic_properties( &self, characteristic: &BluetoothGATTCharacteristic, ) -> Flags
pub(crate) fn characteristic_is_cached(&self, characteristic_id: &str) -> bool
pub(crate) async fn get_and_cache_gatt_descriptors( &mut self, adapter: &mut BluetoothAdapter, characteristic_id: &str, ) -> Vec<BluetoothGATTDescriptor>
pub(crate) async fn get_gatt_descriptor( &mut self, adapter: &mut BluetoothAdapter, descriptor_id: &str, ) -> Option<&BluetoothGATTDescriptor>
Sourcepub(crate) async fn request_device(
&mut self,
options: RequestDeviceoptions,
) -> BluetoothResponseResult
pub(crate) async fn request_device( &mut self, options: RequestDeviceoptions, ) -> BluetoothResponseResult
Sourcepub(crate) async fn gatt_server_connect(
&mut self,
device_id: String,
) -> BluetoothResponseResult
pub(crate) async fn gatt_server_connect( &mut self, device_id: String, ) -> BluetoothResponseResult
Sourcepub(crate) async fn gatt_server_disconnect(
&mut self,
device_id: String,
) -> BluetoothResult<()>
pub(crate) async fn gatt_server_disconnect( &mut self, device_id: String, ) -> BluetoothResult<()>
Sourcepub(crate) async fn get_gatt_children(
&mut self,
id: String,
uuid: Option<String>,
single: bool,
child_type: GATTType,
) -> BluetoothResponseResult
pub(crate) async fn get_gatt_children( &mut self, id: String, uuid: Option<String>, single: bool, child_type: GATTType, ) -> BluetoothResponseResult
Sourcepub(crate) async fn read_value(&mut self, id: String) -> BluetoothResponseResult
pub(crate) async fn read_value(&mut self, id: String) -> BluetoothResponseResult
Sourcepub(crate) async fn write_value(
&mut self,
id: String,
value: Vec<u8>,
) -> BluetoothResponseResult
pub(crate) async fn write_value( &mut self, id: String, value: Vec<u8>, ) -> BluetoothResponseResult
Sourcepub(crate) async fn enable_notification(
&mut self,
id: String,
enable: bool,
) -> BluetoothResponseResult
pub(crate) async fn enable_notification( &mut self, id: String, enable: bool, ) -> BluetoothResponseResult
Sourcepub(crate) fn watch_advertisements(
&mut self,
_device_id: String,
) -> BluetoothResponseResult
pub(crate) fn watch_advertisements( &mut self, _device_id: String, ) -> BluetoothResponseResult
Sourcepub(crate) async fn get_availability(&mut self) -> BluetoothResponseResult
pub(crate) async fn get_availability(&mut self) -> BluetoothResponseResult
Auto Trait Implementations§
impl Freeze for BluetoothManager
impl !RefUnwindSafe for BluetoothManager
impl Send for BluetoothManager
impl Sync for BluetoothManager
impl Unpin for BluetoothManager
impl !UnwindSafe for BluetoothManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert