> ## 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.

# Quickstart

> Get started with Darkgrade Link in minutes

## Basic Usage

```typescript theme={null}
import { Camera } from '@darkgrade/link'

const camera = new Camera()
await camera.connect()

// Control camera settings
await camera.setIso('800')
await camera.setShutterSpeed('1/250')
await camera.setAperture('f/2.8')

// Capture an image
const { data } = await camera.captureImage()

await camera.disconnect()
```

That's it! The `Camera` class automatically detects your camera's brand and uses the appropriate vendor-specific implementation. No configuration needed.

## How It Works

When you call `connect()`, Darkgrade Link:

1. Scans for connected USB devices
2. Identifies the camera's vendor ID
3. Selects the appropriate vendor-specific implementation:
   * **Sony ⍺ Series** → `SonyCamera` with live view, video recording, SDIO
   * **Nikon Z Series** → `NikonCamera` with extended properties
   * **Canon EOS R Series** → `CanonCamera` with remote control
   * **Other PTP Cameras** → `GenericCamera` with standard PTP operations
4. Enables vendor-specific features automatically

## Common Examples

### Camera Settings

```typescript theme={null}
// Get current settings
const currentIso = await camera.getIso()
const currentShutter = await camera.getShutterSpeed()
const currentAperture = await camera.getAperture()

// Set new values
await camera.setIso('1600')
await camera.setShutterSpeed('1/500')
await camera.setAperture('f/4.0')
```

### Event Handling

```typescript theme={null}
// Listen for camera events
camera.on(camera.getInstance().registry.events.ObjectAdded, event => {
    console.log('New object added:', event.ObjectHandle)
})

camera.on(camera.getInstance().registry.events.PropertyChanged, event => {
    console.log('Property changed:', event.PropertyName)
})

// Remove event listeners
camera.off(camera.getInstance().registry.events.ObjectAdded)
```

### Live View

Capture live view frames (Sony & Nikon only):

```typescript theme={null}
const { data: liveViewFrame } = await camera.captureLiveView()
fs.writeFileSync('liveview.jpg', liveViewFrame)
```

### Video Recording

Start and stop video recording (Sony & Canon only):

```typescript theme={null}
await camera.startRecording()
// ... record for some duration ...
await camera.stopRecording()
```

### File Management

List and download files from the camera:

```typescript theme={null}
const objects = await camera.listObjects()

for (const [storageId, storage] of Object.entries(objects)) {
    console.log(`Storage ${storageId}: ${storage.info.storageDescription}`)
    
    for (const [handle, info] of Object.entries(storage.objects)) {
        console.log(`  - ${info.filename} (${info.objectCompressedSize} bytes)`)
        
        // Download a specific object
        const fileData = await camera.getObject(Number(handle), info.objectCompressedSize)
        fs.writeFileSync(info.filename, fileData)
    }
}
```

### Advanced Property Access

Access vendor-specific properties directly:

```typescript theme={null}
const registry = camera.getInstance().registry

// Get property with type safety
const propValue = await camera.get(registry.properties.ExposureIndex)

// Set property
await camera.set(registry.properties.ExposureIndex, '3200')
```

## Advanced Usage

### Using Vendor-Specific Classes

Import vendor-specific camera classes directly:

```typescript theme={null}
import { SonyCamera, NikonCamera, CanonCamera, GenericCamera } from '@darkgrade/link'

const camera = new SonyCamera()
await camera.connect()
```

### Manual Configuration

Specify device filters and logging options:

```typescript theme={null}
import { Camera, VendorIDs } from '@darkgrade/link'

const camera = new Camera({
    device: {
        usb: {
            filters: [{ vendorId: VendorIDs.SONY }], // VendorIDs.NIKON, VendorIDs.CANON
        },
    },
    logger: {
        expanded: true, // Show detailed logging
    },
})

await camera.connect()
```

## Next Steps

* Learn about [PTP](/docs/getting_started/what-is-ptp) - Understanding the protocol
* Check [Feature Compatibility](/docs/getting_started/feature-compatibility) - See what your camera supports
* Explore the [Camera API](/docs/getting_started/camera) - Complete API reference
