Skip to main content

Import

import { Camera } from '@packages/fuse/src/camera'

Constructor

constructor(options?: CameraOptions)

Parameters

ParameterTypeRequiredDescription
optionsCameraOptionsOptional configuration for the camera instance.
options.loggerPartial<LoggerConfig>Logger configuration for debugging and logging.
options.deviceDeviceDescriptorDevice 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>
ParameterTypeRequiredDescription
deviceDeviceDescriptorOptional 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>
ParameterTypeRequiredDescription
operationOperationDefinitionThe operation definition to send.
paramsanyParameters for the operation.
dataUint8ArrayOptional data payload.
maxDataLengthnumberOptional maximum data length.

get

Get a camera property value.
async get(property: PropertyDefinition): Promise<any>
ParameterTypeRequiredDescription
propertyPropertyDefinitionThe property definition to get.

set

Set a camera property value.
async set(
  property: PropertyDefinition,
  value: any
): Promise<void>
ParameterTypeRequiredDescription
propertyPropertyDefinitionThe property definition to set.
valueanyThe value to set.

on

Register an event handler.
on(
  event: EventDefinition,
  handler: function
): void
ParameterTypeRequiredDescription
eventEventDefinitionThe event definition to listen for.
handlerfunctionThe handler function to call when the event occurs.

off

Unregister an event handler.
off(
  event: EventDefinition,
  handler?: function
): void
ParameterTypeRequiredDescription
eventEventDefinitionThe event definition to stop listening for.
handlerfunctionOptional 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>
ParameterTypeRequiredDescription
valuestringThe 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>
ParameterTypeRequiredDescription
valuestringThe 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>
ParameterTypeRequiredDescription
valuestringThe ISO value to set.

captureImage

Capture an image from the camera.
async captureImage(params?: object)
ParameterTypeRequiredDescription
paramsobjectCapture parameters.
params.includeInfobooleanWhether to include object info in the response. Defaults to true.
params.includeDatabooleanWhether to include image data in the response. Defaults to true.

captureLiveView

Capture a live view frame from the camera.
async captureLiveView(params?: object)
ParameterTypeRequiredDescription
paramsobjectLive view capture parameters.
params.includeInfobooleanWhether to include object info in the response. Defaults to true.
params.includeDatabooleanWhether 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>
ParameterTypeRequiredDescription
objectHandlenumberThe handle of the object to retrieve.
objectSizenumberThe 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/fuse/src/camera'
import { GenericCamera } from '@packages/fuse/src/camera'