pub struct Manager<'a>(_);
Expand description
Allows several callbacks to be registered for different devices.
Manager::new("FF:FF:C3:17:01:01", Box::new(toggle_reading_light))
.add("FF:FF:C3:17:01:02", Box::new(wake_up_tv))
.start()
Implementations§
source§impl<'a> Manager<'a>
impl<'a> Manager<'a>
pub fn new() -> Self
sourcepub fn add(self, button_mac_address: &'a str, callback: BoxedCallback) -> Self
pub fn add(self, button_mac_address: &'a str, callback: BoxedCallback) -> Self
Adds an additional callback to the given MAC address.
sourcepub fn start(self)
pub fn start(self)
Starts listening to events on the MAC addresses provided via new
and add
.
This method is blocking: all the specified callbacks will run in parallel, but it is up to
the caller to execute start
within a new thread or use another async mechanism if the
computation should continue.