<br />

Added: 7

## **PROTOCOLS**

## Controller

*Defined in [fuchsia.camera2.hal/hal.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2.hal/hal.fidl;l=46)*

This is the interface to the camera driver
which allows setting up a given configuration
and setting up a stream.

<br />

### CreateStream

Set a particular configuration and create the requested stream.
`config_index` : Configuration index from the vector which needs to be applied.
`stream_index` : Stream index from the vector of streams provided within a config.
`stream` : Stream channel for the stream requested
`image_format_index` : Image format index which needs to be set up upon creation.
If there is already an active configuration which is different than the one
which is requested to be set, then the HAL will be closing all existing streams
and honor this new setup call.
If the new stream requested is already part of the existing running configuration
the HAL will just be creating this new stream while the other stream still exists as is.

#### Request

| Name | Type |
|---|---|
| `config_index` | `uint32` |
| `stream_index` | `uint32` |
| `image_format_index` | `uint32` |
| `stream` | `server_end:https://fuchsia.dev/reference/fuchsia.camera2//https://fuchsia.dev/reference/fuchsia.camera2#Stream` |

### DisableStreaming

#### Request

\<EMPTY\>

### EnableStreaming

Enable/Disable Streaming

#### Request

\<EMPTY\>

### GetDeviceInfo

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `info` | `https://fuchsia.dev/reference/fuchsia.camera2//https://fuchsia.dev/reference/fuchsia.camera2#DeviceInfo` |

### GetNextConfig

Returns the next available configuration which the camera driver supports.
Returns ZX_ERR_STOP if no new configurations are available.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `config` | `https://fuchsia.dev/reference/fidl/fuchsia.camera2.hal#Config?` |
| `status` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Result` |

## **STRUCTS**

### Config

*Defined in [fuchsia.camera2.hal/hal.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2.hal/hal.fidl;l=37)*

Represents one configuration

<br />

| Field | Type | Description | Default |
|---|---|---|---|
| `stream_configs` | `vector<https://fuchsia.dev/reference/fidl/fuchsia.camera2.hal#StreamConfig>:64` |   | No default |

### StreamConfig

*Defined in [fuchsia.camera2.hal/hal.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2.hal/hal.fidl;l=18)*

Represents one stream within a particular configuration.

<br />

| Field | Type | Description | Default |
|---|---|---|---|
| `frame_rate` | `https://fuchsia.dev/reference/fuchsia.camera2//https://fuchsia.dev/reference/fuchsia.camera2#FrameRate` |   | No default |
| `constraints` | `https://fuchsia.dev/reference/fuchsia.sysmem//https://fuchsia.dev/reference/fuchsia.sysmem#BufferCollectionConstraints` | `constraints` should allow for all the image formats listed in image_formats. | No default |
| `properties` | `https://fuchsia.dev/reference/fuchsia.camera2//https://fuchsia.dev/reference/fuchsia.camera2#StreamProperties` | Properties of the stream: | No default |
| `image_formats` | `vector<https://fuchsia.dev/reference/fuchsia.sysmem//https://fuchsia.dev/reference/fuchsia.sysmem#ImageFormat_2>:256` | We need to specify both the constraints \& the image formats because there are fixed set of resolutions supported by the Camera Controller so a range within the `constraints` won't be sufficient. Some streams support multiple resolutions for same configuration We would need to change the resolution runtime, without stopping the streaming. This provides a list of resolutions a stream would be providing. At least one format must be provided. | No default |

## **CONSTANTS**

| Name | Value | Type | Description |
|---|---|---|---|
| [MAX_CONFIGURATIONS](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2.hal/hal.fidl;l=12) | `256` | `uint64` | Maximum number of configurations per device. |
| [MAX_STREAMS](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.camera2.hal/hal.fidl;l=15) | `64` | `uint64` | Maximum number of streams per config. |