pub struct Peripheral { /* private fields */ }Expand description
A local GATT server, published through bluetoothd.
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)
Linux has no state restoration; this is Peripheral::new.
Sourcepub async fn availability(&self) -> Result<(), Availability>
pub async fn availability(&self) -> Result<(), Availability>
Why the peripheral role is not usable, if it is not.
Sourcepub async fn publish(&self, service: Service) -> Result<PublishedService>
pub async fn publish(&self, service: Service) -> Result<PublishedService>
Publish a service into the local GATT database.
The first call registers the application with BlueZ; later ones
re-register it, because GattManager1 has no way to add a service to an
application it has already walked.
Sourcepub fn unpublish_all(&self)
pub fn unpublish_all(&self)
Withdraw every published service.
Sourcepub async fn start_advertising(&self, advertising: Advertising) -> Result<()>
pub async fn start_advertising(&self, advertising: Advertising) -> Result<()>
Start advertising.
Sourcepub fn stop_advertising(&self)
pub fn stop_advertising(&self)
Stop advertising.
pub fn is_advertising(&self) -> bool
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 through BlueZ’s GATT manager.
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>
Linux preserves nothing across a relaunch.
Trait Implementations§
Source§impl Clone for Peripheral
impl Clone for Peripheral
Auto Trait Implementations§
impl !RefUnwindSafe for Peripheral
impl !UnwindSafe for Peripheral
impl Freeze for Peripheral
impl Send for Peripheral
impl Sync for Peripheral
impl Unpin for Peripheral
impl UnsafeUnpin 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