pub struct Uhppoted { /* private fields */ }Implementations§
Source§impl Uhppoted
impl Uhppoted
Sourcepub fn new(bind: SocketAddr, broadcast: Ipv4Addr, timeout: Duration) -> Uhppoted
pub fn new(bind: SocketAddr, broadcast: Ipv4Addr, timeout: Duration) -> Uhppoted
Create a new Uhppote struct
Example:
use uhppote_rs::Uhppoted;
let uhppoted = UUhppoted::new(
"0.0.0.0:0".parse().unwrap(),
"255.255.255.255".parse().unwrap(),
Duration::new(5, 0),
Vec::new(),
false,
)Sourcepub fn get_device_configs(&self) -> Result<Vec<DeviceConfig>>
pub fn get_device_configs(&self) -> Result<Vec<DeviceConfig>>
Get all the available DeviceConfigs on the local network. This broadcasts a discovery message
and waits Uhppoted::timeout for responses.
Sourcepub fn get_devices(&self) -> Result<Vec<Device<'_>>>
pub fn get_devices(&self) -> Result<Vec<Device<'_>>>
Get all the available Devices on the local network. This broadcasts a discovery message
and waits Uhppoted::timeout for responses.
Sourcepub fn get_device(&self, id: u32, ip_address: Option<Ipv4Addr>) -> Device<'_>
pub fn get_device(&self, id: u32, ip_address: Option<Ipv4Addr>) -> Device<'_>
Get a Device by its device ID. This does not check if the device actually exists, but
merely represents a device to interact with.
When ip_address is specified, communication will happen directly with the device. Otherwise,
communication to the device will happen via local network broadcast.
Specify an ip_address when the device is not on the local network.
Sourcepub fn listen(&self, address: SocketAddr, handler: fn(Status)) -> Result<()>
pub fn listen(&self, address: SocketAddr, handler: fn(Status)) -> Result<()>
Listen for incoming Status messages from the UHPPOTE system on a specific address.
Example:
use uhppote_rs::Uhppoted;
let uhppoted = Uhppoted::default();
let device = uhppoted.get_device(423196779);
let listener_address: SocketAddr = "192.168.0.10:12345".parse().unwrap();
device.set_listener(listener_address).unwrap();
uhppoted.listen(listener_address, |status| {
println!("{:?}", status);
});Trait Implementations§
Auto Trait Implementations§
impl Freeze for Uhppoted
impl RefUnwindSafe for Uhppoted
impl Send for Uhppoted
impl Sync for Uhppoted
impl Unpin for Uhppoted
impl UnwindSafe for Uhppoted
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