Skip to main content

reopen_gige

Function reopen_gige 

Source
pub async fn reopen_gige(
    previous: &DeviceInfo,
    options: &Reopen,
) -> Result<Reopened, GenicamError>
Expand description

Open again a GigE Vision camera that went away: unplugged, power-cycled, or with its heartbeat expired.

previous is the camera’s Discovery ACK from before. The camera is looked for by its MAC address — at its old address first, then by broadcast on Reopen::interface (or every interface) in case it came back with another — and then opened afresh with connect_gige_as, which fetches its XML again. Every failure is retried, with a growing pause, until Reopen::patience runs out: a camera that is still booting does not answer, and one whose old session’s heartbeat has not yet expired refuses the claim. Once open, Reopen::configuration is restored, if given; a value that could not be written is in Reopened::restored, not an error.

A record without a MAC address (DeviceInfo::from_ip) matches whatever camera answers at its address.

The old Camera should be dropped first, or the claim waits for its session, still being kept alive, to give control up.

The patience bounds discovery, connection attempts and their retry pauses. Configuration restoration follows a successful open and uses the camera’s ordinary register timeouts; its failures are reported, never retried as a new connection. Cancelling an open sends a best-effort release for any control it already claimed; a lost release datagram leaves the camera to expire it.

Returns the last error when no further attempt fits, or GenicamError::Timeout if an in-flight attempt consumes the remaining patience.