OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Rust API referencev12.0

network_setting — functions and constants

What a network camera says about itself, and setting its address by broadcast.

Every Optris network camera answers the discovery broadcast with one record about itself. get_network_discovery_info returns the whole of the last one this process heard, including the camera's MAC address and whether it can be configured by broadcast. configure_network_by_broadcast sets the address of the camera with a given MAC address without knowing the address it has now.

Mirrors GetNetworkDiscoveryInfo() and ConfigureNetworkByBroadcast() in C++ and optris_sdk_get_network_discovery_info() / optris_sdk_configure_network_by_broadcast() in C.

pub fn configure_network_by_broadcast(

Set the network address of a camera by its MAC address, by broadcast, without knowing the address it has now.

The request reaches every camera on this network segment (it does not cross a router); only the camera with the given MAC address acts on it, and that camera answers by broadcast, so the answer arrives whatever subnet the camera is in. Only cameras whose NetworkDiscoveryInfo::protocol_version is 1001 or later understand it. No camera is opened or claimed.

Errors

crate::Status::Configuration if the MAC address, an address, the mask or the gateway is not one, or attempts is 0; nothing was sent. crate::Status::Device if the request could not be sent, or OTC_SDK_NO_HARDWARE is set.

Examples

# fn main() -> optris_sdk::Result<()> {
use optris_sdk::{configure_network_by_broadcast, BroadcastConfigStatus, BroadcastNetworkConfig};

let reply = configure_network_by_broadcast(&BroadcastNetworkConfig::new(
    "9C:43:1E:70:40:3E",
    "10.0.2.213",
    "255.255.240.0",
))?;
if reply.status == BroadcastConfigStatus::Taken {
    println!("taken, {:?}", reply.effect);
}
# Ok(())
# }

pub fn get_network_discovery_info(serial: &str) -> Result<Option<NetworkDiscoveryInfo>>

What the camera with this serial said the last time it answered discovery in this process.

Any discovery fills it in: crate::enumerate_with with the network included, a device monitor watching the network, crate::probe_network. Nothing is sent by this call.

Errors

Returns crate::Status::InvalidArgument if serial contains a NUL.