DcmiController Class
Package: GHIElectronics.Endpoint.Devices.Camera
Namespace: GHIElectronics.Endpoint.Devices.Camera
Base controller for the board's parallel camera-interface port. Reserves the camera data and sync pins, drives the pixel clock, loads the backing kernel module, and exposes single-frame capture and streaming. Concrete sensor drivers derive from this type.
class DcmiController : public IDisposable {};
Nested Types
| Type | Kind | Summary |
|---|---|---|
| DcmiController.FrameReceivedEventHandler | Delegate | Handler for a single captured frame from the sensor. |
Constructors
DcmiController(string devicePath)
DcmiController(const std::string& devicePath);
Reserves the camera-interface pins, starts the pixel clock, and loads the backing capture driver. The V4L2 node is not opened until DcmiController.Open is called.
| Parameter | Type | Description |
|---|---|---|
devicePath | string | V4L2 device node for the capture, defaulting to /dev/video0. |
Properties
Height
int32_t Height() const;
Frame height in pixels, taken from the last applied DcmiController.Setting.
Returns int
IsVideoStreaming
bool IsVideoStreaming() const;
true while DcmiController.VideoStreamStart is delivering frames via DcmiController.FrameReceived.
Returns bool
Setting
CameraConfiguration Setting() const;
void Setting(CameraConfiguration value);
Resolution, pixel format and frame rate for subsequent captures. Assigning a value re-initializes the native device at the new size, FPS and JPEG quality, and reallocates the internal frame buffer.
Returns CameraConfiguration
Width
int32_t Width() const;
Frame width in pixels, taken from the last applied DcmiController.Setting.
Returns int
Methods
Capture()
std::vector<uint8_t> Capture();
Captures a single frame synchronously and returns it in the format set by CameraConfiguration.ImageFormat. Throws if DcmiController.Setting is unset, the device is not open, or a video stream is already running.
Returns byte[]: Frame bytes, or null if the sensor returned no valid JPEG.
Close()
void Close();
Stops streaming (if active) and closes the V4L2 device. Safe to call when already closed.
Dispose()
void Dispose();
Closes the device, releases the camera-interface pins, stops the pixel clock and unloads the backing capture driver.
Dispose(bool disposing)
void Dispose(bool disposing);
Releases held resources. See DcmiController.Dispose.
| Parameter | Type | Description |
|---|---|---|
disposing | bool | true when called from DcmiController.Dispose; false from a finalizer. |
GetResolution()
std::vector<std::string> GetResolution();
Lists every WIDTHxHEIGHT resolution the capture driver reports from v4l2-ctl --list-formats-ext, or null if none are found.
Returns string[]
Open()
void Open();
Opens the V4L2 device for capture. Throws if the device is already open or the node does not exist.
VideoStreamStart()
void VideoStreamStart();
Begins continuous capture on a background task; each frame is delivered through DcmiController.FrameReceived. Throws if DcmiController.Setting is unset or the device is not open. Call DcmiController.VideoStreamStop to end streaming.
VideoStreamStop()
void VideoStreamStop();
Signals the streaming worker to stop and blocks until it has exited.
Events
FrameReceived
Core::Event<...> FrameReceived;
Fires on the streaming worker thread for every frame captured by DcmiController.VideoStreamStart. Not raised by DcmiController.Capture.