pub struct DeviceManager {
pub devices: Vec<Device>,
/* private fields */
}Expand description
Manages multiple devices: loads JSON configs, connects, dispatches events.
Fields§
§devices: Vec<Device>Implementations§
Source§impl DeviceManager
impl DeviceManager
pub fn new<P: AsRef<Path>>(devices_path: P) -> Self
pub fn with_event_handler(self, handler: SharedEventHandler) -> Self
pub fn set_event_handler(&mut self, handler: SharedEventHandler)
pub fn load_devices(&mut self)
pub fn add_device( &mut self, name: &str, device_type: &str, data: HashMap<String, Value>, )
pub fn assign_event_handler(&mut self)
pub async fn connect_devices(&mut self, force: bool)
pub async fn cancel_connect_tasks(&mut self)
pub async fn disconnect_devices(&mut self)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get_device_names(&self) -> Vec<String>
pub fn get_device(&self, name: &str) -> Option<&Device>
pub fn get_device_mut(&mut self, name: &str) -> Option<&mut Device>
pub fn get_device_info(&self, name: Option<&str>) -> Vec<DeviceInfo>
pub fn any_device_reading(&self) -> bool
pub fn get_serial_number(&self, name: &str) -> Option<String>
pub fn get_device_config(&self, name: &str) -> Option<HashMap<String, Value>>
pub fn get_device_configs(&self) -> HashMap<String, HashMap<String, Value>>
pub async fn start_inventory(&self, name: &str) -> Result<(), String>
pub async fn stop_inventory(&self, name: &str) -> Result<(), String>
pub async fn start_inventory_all(&self) -> HashMap<String, bool>
pub async fn stop_inventory_all(&self) -> HashMap<String, bool>
pub async fn write_epc( &self, name: &str, target_identifier: Option<&str>, target_value: Option<&str>, new_epc: &str, password: &str, ) -> Result<(), String>
pub async fn write_gpo( &self, name: &str, pin: u8, state: bool, control: &str, time_ms: u64, ) -> Result<(), String>
pub fn get_config_examples() -> Vec<&'static str>
pub fn get_config_example(name: &str) -> Option<HashMap<String, Value>>
Auto Trait Implementations§
impl Freeze for DeviceManager
impl !RefUnwindSafe for DeviceManager
impl Send for DeviceManager
impl Sync for DeviceManager
impl Unpin for DeviceManager
impl UnsafeUnpin for DeviceManager
impl !UnwindSafe for DeviceManager
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