pub struct DeviceInfo {
pub ip: Ipv4Addr,
pub mac: [u8; 6],
pub model: Option<String>,
pub manufacturer: Option<String>,
pub version: Option<String>,
pub serial: Option<String>,
pub user_name: Option<String>,
pub local_ip: Option<Ipv4Addr>,
pub subnet: Option<Ipv4Addr>,
pub gateway: Option<Ipv4Addr>,
pub local_netmask: Option<Ipv4Addr>,
}Expand description
Information returned by GVCP discovery packets.
Build one with DeviceInfo::from_ip and the fields you have
(DeviceInfo { model, ..DeviceInfo::from_ip(ip) }).
Fields§
§ip: Ipv4AddrThe camera’s current IPv4 address.
mac: [u8; 6]The camera’s MAC address.
model: Option<String>Model name (Discovery ACK offset 104).
manufacturer: Option<String>Manufacturer name (Discovery ACK offset 72).
version: Option<String>Device version string (Discovery ACK offset 136).
serial: Option<String>Serial number as printed on the device (Discovery ACK offset 216).
user_name: Option<String>User-programmable device name (Discovery ACK offset 232).
local_ip: Option<Ipv4Addr>The host address the Discovery ACK arrived at: the local IPv4 of the
discovery socket, which names both the interface and, on a NIC with
several addresses, which of them reached the device. None for a
record discovery did not make. A broadcast meant for this device, such
as force_ip, has to leave from it (Iface::from_ipv4).
subnet: Option<Ipv4Addr>The camera’s current subnet mask (Discovery ACK offset 52).
gateway: Option<Ipv4Addr>The camera’s current default gateway (Discovery ACK offset 68).
local_netmask: Option<Ipv4Addr>The netmask of the host address in local_ip.
Implementations§
Source§impl DeviceInfo
impl DeviceInfo
Sourcepub fn from_ip(ip: Ipv4Addr) -> Self
pub fn from_ip(ip: Ipv4Addr) -> Self
A minimal record for a device addressed directly by IP.
Used when the caller names a camera by address and there is no Discovery ACK to populate the identity fields.
Whether the camera and the host address that heard it are on one
subnet, by both masks: the camera’s address inside the host’s network,
and the host’s inside the camera’s. None when either side’s address
or mask is unknown.
A camera that answers discovery but fails this is configured for
another network. It answered a broadcast, but cannot be reached by
unicast — every connection to it fails — until its address is changed
(force_ip) or the host joins its network.
Sourcepub fn mac_string(&self) -> String
pub fn mac_string(&self) -> String
Format the MAC address as AA:BB:CC:DD:EE:FF.