pub struct OheaLock<T: Transport> { /* private fields */ }Expand description
Implementations§
Source§impl<T: Transport> OheaLock<T>
impl<T: Transport> OheaLock<T>
Sourcepub const fn new(transport: T) -> Self
pub const fn new(transport: T) -> Self
Create a new OheaLock instance with the given transport.
Sourcepub fn transport_mut(&mut self) -> &mut T
pub fn transport_mut(&mut self) -> &mut T
Get a mutable reference to the underlying transport.
Sourcepub async fn initialize(&mut self) -> Result<()>
pub async fn initialize(&mut self) -> Result<()>
Initialize the session with the lock.
This sends the initialization command to the command register. Should be called after connecting to a newly paired device.
§Errors
Returns an error if the write fails.
Sourcepub async fn get_lock_state(&self) -> Result<LockState>
pub async fn get_lock_state(&self) -> Result<LockState>
Sourcepub async fn get_lock_position(&self) -> Result<u8>
pub async fn get_lock_position(&self) -> Result<u8>
Get the current lock position.
This may differ from lock state during transitions.
§Errors
Returns an error if the read fails.
Sourcepub async fn set_lock_state(&self, state: LockState) -> Result<()>
pub async fn set_lock_state(&self, state: LockState) -> Result<()>
Sourcepub async fn get_battery_level(&self) -> Result<u8>
pub async fn get_battery_level(&self) -> Result<u8>
Sourcepub async fn get_firmware_version(&self) -> Result<String>
pub async fn get_firmware_version(&self) -> Result<String>
Get the firmware version string.
§Errors
Returns an error if the read fails or the response is not valid UTF-8.
Sourcepub async fn get_device_name(&self) -> Result<String>
pub async fn get_device_name(&self) -> Result<String>
Get the device name.
First attempts to read from the Device Name characteristic (0x2A00). Falls back to the local name from advertising data if the characteristic is not available.
§Errors
Returns an error if both methods fail.
Sourcepub async fn get_device_info(&self) -> Result<DeviceInfo>
pub async fn get_device_info(&self) -> Result<DeviceInfo>
Sourcepub async fn get_status(&self) -> Result<u8>
pub async fn get_status(&self) -> Result<u8>
Sourcepub async fn subscribe_lock_state(&self) -> Result<()>
pub async fn subscribe_lock_state(&self) -> Result<()>
Sourcepub async fn subscribe_status(&self) -> Result<()>
pub async fn subscribe_status(&self) -> Result<()>
Sourcepub async fn subscribe_battery_level(&self) -> Result<()>
pub async fn subscribe_battery_level(&self) -> Result<()>
Sourcepub async fn unsubscribe_all(&self) -> Result<()>
pub async fn unsubscribe_all(&self) -> Result<()>
Auto Trait Implementations§
impl<T> Freeze for OheaLock<T>where
T: Freeze,
impl<T> RefUnwindSafe for OheaLock<T>where
T: RefUnwindSafe,
impl<T> Send for OheaLock<T>
impl<T> Sync for OheaLock<T>
impl<T> Unpin for OheaLock<T>where
T: Unpin,
impl<T> UnsafeUnpin for OheaLock<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for OheaLock<T>where
T: UnwindSafe,
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