DeviceManager

Struct DeviceManager 

Source
pub struct DeviceManager { /* private fields */ }

Implementations§

Source§

impl DeviceManager

Source

pub async fn create(base_path: &str, config: ManagerConfig) -> Result<Self>

First-time setup: creates directory structure, bootstraps CA, creates controller user, and saves config.

Source

pub async fn load(base_path: &str) -> Result<Self>

Load an existing device manager from a previously created base directory.

Source

pub async fn commission( &self, address: &str, pin: u32, node_id: u64, name: &str, ) -> Result<Connection>

Commission a device and save it to the registry. Returns an authenticated connection ready for commands.

Source

pub async fn connect(&self, node_id: u64) -> Result<Connection>

Connect to a previously commissioned device by node ID. If the stored address fails, automatically re-discovers the device via operational mDNS.

Source

pub async fn connect_by_name(&self, name: &str) -> Result<Connection>

Connect to a previously commissioned device by friendly name. If the stored address fails, automatically re-discovers the device via operational mDNS.

Source

pub async fn commission_with_code( &self, pairing_code: &str, node_id: u64, name: &str, ) -> Result<Connection>

Commission a device using a manual pairing code. Decodes the pairing code to extract the discriminator, discovers the device via commissionable mDNS, then commissions it. Returns an authenticated connection.

Source

pub async fn discover_device( &self, node_id: u64, timeout: Duration, ) -> Result<String>

Discover the current address of a commissioned device via operational mDNS. Returns as soon as the device is found (no fixed timeout wait). Updates the stored address in the registry and returns the new address.

Source

pub fn list_devices(&self) -> Result<Vec<Device>>

List all registered devices.

Source

pub fn get_device(&self, node_id: u64) -> Result<Option<Device>>

Get a device by node ID.

Source

pub fn get_device_by_name(&self, name: &str) -> Result<Option<Device>>

Get a device by friendly name.

Source

pub fn remove_device(&self, node_id: u64) -> Result<()>

Remove a device from the registry.

Source

pub fn rename_device(&self, node_id: u64, name: &str) -> Result<()>

Rename a device in the registry.

Source

pub fn update_device_address(&self, node_id: u64, address: &str) -> Result<()>

Update the stored address for a device.

Source

pub fn mdns(&self) -> &Arc<MdnsService>

Get a reference to the shared mDNS service.

Source

pub fn controller(&self) -> &Arc<Controller>

Get a reference to the underlying controller.

Source

pub fn transport(&self) -> &Arc<Transport>

Get a reference to the underlying transport.

Source

pub fn certmanager(&self) -> &Arc<dyn CertManager>

Get a reference to the certificate manager.

Source

pub fn config(&self) -> &ManagerConfig

Get the config.

Source

pub fn base_path(&self) -> &str

Get the base path.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V