OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::DeviceBusyException

The camera would not carry the operation out, and may next time.

A subclass of DeviceException, so every existing catch ([DeviceException](/documentation/sdks/otc-sdk/v12.0/api/classes/optris.sdk.deviceexception) &) keeps catching it. Catch this one first to tell it from a device that is gone.

The distinction it exists for: an operation mode switch that comes back as a configuration error tells the reader to check the mode they asked for. On an Xi 400 that is exactly the wrong place to look -- the camera accepts the mode, and the V4L2 ioctl returns EIO because the previous stream has not finished tearing down. The SDK retries that four times over five seconds; when all four fail the honest answer is "not now", not "not valid".

Retrying is reasonable. It is the one SdkException here where repeating the same call unchanged is a sensible response.

What raises it: What raises it Not only an operation-mode switch: - An open refused on a claim. Imager::Create() and every overload of it, and Imager::Reconnect(), raise this when another program holds the camera, and when this application holds it and is not handing it back. Guard an open for it. - An open whose stream would not start in its video format, with nothing holding the camera at all. - An operation-mode switch whose format change fails, which is the case above.

Which of them, and this is the part to act on: Which of them, and this is the part to act on reason() says, as a closed enum. Three conditions arrive as this one type and they want different answers from an application: another program has it is worth telling an operator about and worth retrying; you already have it open is the application's own bug and retrying cannot help; the format would not come up means the camera is free, so showing it as in use is simply wrong. Never match English in message() to tell them apart.

detail() carries the holder and the claim file beside the reason. Both are empty when the SDK cannot name them, never a guess.

Crosses the C ABI as OPTRIS_SDK_ERROR_BUSY, with the detail filled in by optris_sdk_last_busy_report(), and reaches C# as DeviceBusyException with Reason, Holder and ClaimPath.

Inherits from optris::sdk::DeviceException.

Public functions

DeviceBusyException

DeviceBusyException(std::string message, std::string serial, DeviceBusyDetail detail)

Construct carrying what refused.

Parameters

Name Description
message What went wrong, naming the specifics.
serial The camera's serial number, or empty.
detail Which condition refused, and what it knew.

reason

auto reason() const -> DeviceBusyReason

Which condition refused. DeviceBusyReason::kUnknown when the refusal did not say, which is not the same as any answer.

detail

auto detail() const -> const DeviceBusyDetail &

The reason plus the holder and the claim file, where known.

DeviceException

DeviceException(std::string message, std::string serial="")

Construct, naming the camera when it is known.

Parameters

Name Description
message What went wrong.
serial The camera's serial number, or empty when the failure happened before any camera was identified.