Expand description
§QHYCCD SDK bindings for Rust
This crate provides a safe interface to the QHYCCD SDK for controlling QHYCCD cameras, filter wheels and focusers. The libqhyccd-sys crate provides the raw FFI bindings. It uses tracing for logging and eyre for error handling.
§Example
use qhyccd_rs::Sdk;
let sdk = Sdk::new().expect("SDK::new failed");
let sdk_version = sdk.version().expect("get_sdk_version failed");
println!("SDK version: {:?}", sdk_version);§Simulation Feature
The simulation feature enables development and testing without physical hardware. When enabled,
Sdk::new() automatically provides a simulated camera environment that behaves like real hardware.
§Enabling Simulation
Add the feature to your Cargo.toml:
[dependencies]
qhyccd-rs = { version = "0.1.7", features = ["simulation"] }§Transparent Usage
With simulation enabled, your code works identically for both real and simulated cameras:
use qhyccd_rs::Sdk;
// Same code works with or without the simulation feature
let sdk = Sdk::new().expect("Failed to initialize SDK");
let cameras = sdk.cameras();
println!("Found {} camera(s)", cameras.count());§Default Simulated Camera
When compiled with the simulation feature, Sdk::new() automatically provides:
-
Camera: QHY178M-Simulated (
SIM-QHY178M)- 3072x2048 resolution, 16-bit depth
- Cooler support for temperature control
- Full control API (gain, offset, exposure, etc.)
-
Filter Wheel: 7-position CFW
- Accessible via
Sdk::filter_wheels() - Complete control API support
- Accessible via
§Custom Simulated Cameras
For advanced use cases, use [Sdk::new_simulated()] and [Sdk::add_simulated_camera()]:
use qhyccd_rs::{Sdk, simulation::SimulatedCameraConfig};
let mut sdk = Sdk::new_simulated();
let config = SimulatedCameraConfig::default()
.with_id("CUSTOM-CAM")
.with_filter_wheel(5);
sdk.add_simulated_camera(config);Structs§
- CCDChip
Area - this struct is used in
get_overscan_area,get_effective_area,set_roiandget_roi - CCDChip
Info - Camera sensor info
- Camera
- The representation of a camera. It is constructed by the SDK and can be used to interact with the camera.
- Filter
Wheel - Filter wheels are directly connected to the QHY camera
- Image
Data - the image data coming from the camera in
get_live_frameandget_single_frame - Readout
Mode - used to store readout mode numbers and their descriptions coming from
get_readout_mode_name - SDKVersion
- returned from
SDK::version - Sdk
- The representation of the SDK. It automatically allocates the SDK when constructed and automatically frees resource when deconstructed.
Enums§
- Bayer
Mode - this struct is returned from
is_control_availablewhen used withControl::CamColor - Control
- Controls used in
is_control_availableandset_parameternadget_parameterdocumentation is taken from the QHYCCD SDK here https://www.qhyccd.cn/file/repository/publish/SDK/code/QHYCCD%20SDK_API_EN_V2.3.pdf - QHYError
- Errors that can occur when interacting with the QHYCCD SDK
most functions from the SDK return
u32::MAXon error where it is different, is is noted in the documentation - Stream
Mode - Stream mode used in
set_stream_mode