Documentation Index
Fetch the complete documentation index at: https://darkgrade.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Import
import { Camera } from '@packages/link/src/camera'
Constructor
constructor(options?: CameraOptions)
Parameters
| Parameter | Type | Required | Description |
|---|
| options | CameraOptions | | Optional configuration for the camera instance. |
| options.logger | Partial<LoggerConfig> | | Logger configuration for debugging and logging. |
| options.device | DeviceDescriptor | | Device descriptor for the camera. If provided, the appropriate vendor-specific implementation will be selected automatically. |
Methods
connect
Connect to a camera device.
async connect(device?: DeviceDescriptor): Promise<void>
| Parameter | Type | Required | Description |
|---|
| device | DeviceDescriptor | | Optional device descriptor. If not provided, uses the device from the constructor options. |
disconnect
Disconnect from the camera device.
async disconnect(): Promise<void>
send
Send a PTP operation to the camera.
async send(
operation: OperationDefinition,
params: any,
data?: Uint8Array,
maxDataLength?: number
): Promise<any>
| Parameter | Type | Required | Description |
|---|
| operation | OperationDefinition | ✓ | The operation definition to send. |
| params | any | ✓ | Parameters for the operation. |
| data | Uint8Array | | Optional data payload. |
| maxDataLength | number | | Optional maximum data length. |
get
Get a camera property value.
async get(property: PropertyDefinition): Promise<any>
| Parameter | Type | Required | Description |
|---|
| property | PropertyDefinition | ✓ | The property definition to get. |
set
Set a camera property value.
async set(
property: PropertyDefinition,
value: any
): Promise<void>
| Parameter | Type | Required | Description |
|---|
| property | PropertyDefinition | ✓ | The property definition to set. |
| value | any | ✓ | The value to set. |
Register an event handler.
on(
event: EventDefinition,
handler: function
): void
| Parameter | Type | Required | Description |
|---|
| event | EventDefinition | ✓ | The event definition to listen for. |
| handler | function | ✓ | The handler function to call when the event occurs. |
off
Unregister an event handler.
off(
event: EventDefinition,
handler?: function
): void
| Parameter | Type | Required | Description |
|---|
| event | EventDefinition | ✓ | The event definition to stop listening for. |
| handler | function | | Optional handler function. If not provided, all handlers for the event are removed. |
getAperture
Get the current aperture value.
async getAperture(): Promise<string>
setAperture
Set the aperture value.
async setAperture(value: string): Promise<void>
| Parameter | Type | Required | Description |
|---|
| value | string | ✓ | The aperture value to set. |
getShutterSpeed
Get the current shutter speed value.
async getShutterSpeed(): Promise<string>
setShutterSpeed
Set the shutter speed value.
async setShutterSpeed(value: string): Promise<void>
| Parameter | Type | Required | Description |
|---|
| value | string | ✓ | The shutter speed value to set. |
getIso
Get the current ISO value.
async getIso(): Promise<string>
setIso
Set the ISO value.
async setIso(value: string): Promise<void>
| Parameter | Type | Required | Description |
|---|
| value | string | ✓ | The ISO value to set. |
captureImage
Capture an image from the camera.
async captureImage(params?: object)
| Parameter | Type | Required | Description |
|---|
| params | object | | Capture parameters. |
| params.includeInfo | boolean | | Whether to include object info in the response. Defaults to true. |
| params.includeData | boolean | | Whether to include image data in the response. Defaults to true. |
captureLiveView
Capture a live view frame from the camera.
async captureLiveView(params?: object)
| Parameter | Type | Required | Description |
|---|
| params | object | | Live view capture parameters. |
| params.includeInfo | boolean | | Whether to include object info in the response. Defaults to true. |
| params.includeData | boolean | | Whether to include image data in the response. Defaults to true. |
startRecording
Start video recording.
async startRecording(): Promise<void>
stopRecording
Stop video recording.
async stopRecording(): Promise<void>
listObjects
List all objects stored on the camera.
async listObjects(): Promise<object>
getObject
Retrieve an object from the camera.
async getObject(
objectHandle: number,
objectSize: number
): Promise<Uint8Array>
| Parameter | Type | Required | Description |
|---|
| objectHandle | number | ✓ | The handle of the object to retrieve. |
| objectSize | number | ✓ | The size of the object in bytes. |
Exports
The module also exports the vendor-specific camera implementations:
CanonCamera
GenericCamera
NikonCamera
SonyCamera
These can be imported directly if you need vendor-specific functionality:
import { SonyCamera } from '@packages/link/src/camera'
import { GenericCamera } from '@packages/link/src/camera'