Skip to main content

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(IDisposable): ...

Nested Types​

TypeKindSummary
DcmiController.FrameReceivedEventHandlerDelegateHandler for a single captured frame from the sensor.

Constructors​

DcmiController(string devicePath)​

def __init__(self, devicePath: str):

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.

ParameterTypeDescription
devicePathstringV4L2 device node for the capture, defaulting to /dev/video0.

Properties​

Height​

Height: int # @property

Frame height in pixels, taken from the last applied DcmiController.Setting.

Returns int

IsVideoStreaming​

IsVideoStreaming: bool # @property

true while DcmiController.VideoStreamStart is delivering frames via DcmiController.FrameReceived.

Returns bool

Setting​

Setting: CameraConfiguration # @property / @setter

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​

Width: int # @property

Frame width in pixels, taken from the last applied DcmiController.Setting.

Returns int

Methods​

Capture()​

def Capture(self) -> list[int]:

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()​

def Close(self) -> None:

Stops streaming (if active) and closes the V4L2 device. Safe to call when already closed.

Dispose()​

def Dispose(self) -> None:

Closes the device, releases the camera-interface pins, stops the pixel clock and unloads the backing capture driver.

Dispose(bool disposing)​

def Dispose(self, disposing: bool) -> None:

Releases held resources. See DcmiController.Dispose.

ParameterTypeDescription
disposingbooltrue when called from DcmiController.Dispose; false from a finalizer.

GetResolution()​

def GetResolution(self) -> list[str]:

Lists every WIDTHxHEIGHT resolution the capture driver reports from v4l2-ctl --list-formats-ext, or null if none are found.

Returns string[]

Open()​

def Open(self) -> None:

Opens the V4L2 device for capture. Throws if the device is already open or the node does not exist.

VideoStreamStart()​

def VideoStreamStart(self) -> None:

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()​

def VideoStreamStop(self) -> None:

Signals the streaming worker to stop and blocks until it has exited.

Events​

FrameReceived​

FrameReceived # += / -= handler

Fires on the streaming worker thread for every frame captured by DcmiController.VideoStreamStart. Not raised by DcmiController.Capture.