pub struct Peripheral { /* private fields */ }Expand description
A local GATT server.
Implementations§
Source§impl Peripheral
impl Peripheral
Sourcepub fn new() -> (Self, Requests)
pub fn new() -> (Self, Requests)
Open the peripheral role, returning the handle and its request stream.
Sourcepub fn with_restoration(_restoration: Restoration) -> (Self, Requests)
pub fn with_restoration(_restoration: Restoration) -> (Self, Requests)
Windows preserves nothing across a restart; the identifier is ignored.
pub async fn availability(&self) -> Result<(), Availability>
Sourcepub async fn publish(&self, service: Service) -> Result<PublishedService>
pub async fn publish(&self, service: Service) -> Result<PublishedService>
Publish a service.
Each service gets its own GattServiceProvider, because on Windows the
provider is also what advertises it.
Sourcepub fn unpublish_all(&self)
pub fn unpublish_all(&self)
Remove every published service.
Sourcepub async fn start_advertising(&self, _advertising: Advertising) -> Result<()>
pub async fn start_advertising(&self, _advertising: Advertising) -> Result<()>
Start advertising every published service.
Windows advertises the machine’s Bluetooth name, so
Advertising::local_name has no
effect here; the service UUIDs come from what was published.
pub fn stop_advertising(&self)
Sourcepub fn is_advertising(&self) -> bool
pub fn is_advertising(&self) -> bool
Whether the radio is currently advertising.
Sourcepub async fn publish_l2cap_channel(
&self,
_encryption_required: bool,
) -> Result<Psm>
pub async fn publish_l2cap_channel( &self, _encryption_required: bool, ) -> Result<Psm>
Not available: Windows exposes no L2CAP channel API at all.
pub async fn unpublish_l2cap_channel(&self, _psm: Psm) -> Result<()>
Sourcepub async fn restored_state(&self) -> Option<RestoredPeripheral>
pub async fn restored_state(&self) -> Option<RestoredPeripheral>
Always None: Windows preserves nothing across a restart.
Trait Implementations§
Source§impl Clone for Peripheral
impl Clone for Peripheral
Auto Trait Implementations§
impl Freeze for Peripheral
impl RefUnwindSafe for Peripheral
impl Send for Peripheral
impl Sync for Peripheral
impl Unpin for Peripheral
impl UnsafeUnpin for Peripheral
impl UnwindSafe for Peripheral
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