sdkinfo — functions and constants
Facts about the SDK itself, none of which needs a camera.
Three questions, answered without opening anything.
Which build is this? build_info: version, commit, branch,
build type and platform, in one call, which is what a diagnostics
bundle should record. crate::version_string answers the
version alone, for a caller that only wants to print it.
Is there a GPU, and if not, why not? gpu_info. The "why
not" is the half that is hard to get any other way: a
software-only adapter counts as no GPU, and without
GpuInfo::unavailable_reason a caller cannot tell that from a
machine with no adapter at all.
How big is a model's sensor? sensor_dimensions, from the
model alone, which is what you have before a camera is plugged
in. Use it rather than keeping your own table: the SDK held this
one privately until recently, so applications copied it, and a copy
drifts. One application's copy disagreed with the SDK on eleven
models and shipped every one of them.
pub fn build_info() -> Result<BuildInfo>
Which build of the SDK is loaded.
Reads constants compiled into the library: it touches no camera, no file and no network, cannot block, and is safe to call from any thread at any time, including before the first camera is opened.
Put this in whatever a customer sends back. The version alone does
not identify a build: two libraries stamped 12.0.0 can be
different commits, and a commit carrying -dirty says the one
in front of you was never committed at all.
Errors
Returns crate::Status::InvalidArgument if the library does not
recognise this crate's idea of the struct's size, which means the
two were built from different headers.
pub fn gpu_info() -> Result<GpuInfo>
What the SDK found to run the GPU pipeline on.
Needs no camera, and is the call to make before blaming a camera for running the CPU pipeline: a build without GPU support, a machine with no adapter and a machine whose only adapter is a software rasteriser all look identical from the frame rate alone, and want three different answers.
Errors
As build_info.
pub fn sensor_dimensions(device_type: DeviceType) -> Result<SensorDimensions>
A camera model's native sensor size, without a camera.
crate::enumerate reports the size of a camera that is
attached. This answers from the model alone, which is what you
have before one opens: a placeholder for a camera that is not
plugged in, a window layout restored before enumeration ran, a
tile that should not jump to its real size when the camera
connects.
The sensor's size, which is not always the size of the frames
an open camera delivers: a camera opened in a clipped or binned
operation mode streams that mode's shape instead. Size a
placeholder from this, and read crate::Camera::width once it
is open.
Errors
Returns crate::Status::NotSupported for a model this SDK has
no size for, DeviceType::Unknown included. Use
try_sensor_dimensions where that is an ordinary answer rather
than a fault.
It never answers zero for an unknown model. The outputs are left untouched on failure, deliberately: the PI 1 answered 0 × 0 from this table for as long as the table existed, a simulated one streamed 160 × 120 regardless, and nothing anywhere noticed the two disagreed.
pub fn try_sensor_dimensions(device_type: DeviceType) -> Option<SensorDimensions>
sensor_dimensions, or None if the SDK has no size for the
model.
For a caller holding a model it did not choose (a restored layout, a stored configuration) where "this SDK does not know that model" is a case to draw differently rather than a fault to report.
None rather than a zero size, so a caller cannot mistake an
unknown model for a zero-sized one.