Skip to main content

DeviceInfo

Struct DeviceInfo 

Source
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: Ipv4Addr

The 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

Source

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.

Source

pub fn shares_subnet_with_host(&self) -> Option<bool>

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.

Source

pub fn mac_string(&self) -> String

Format the MAC address as AA:BB:CC:DD:EE:FF.

Trait Implementations§

Source§

impl Clone for DeviceInfo

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DeviceInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DeviceInfo

Source§

impl PartialEq for DeviceInfo

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DeviceInfo

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more