blob: 0cb9f894967e08d25743141747b94e36f4a0e82f [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Next min version: 4
module cros.mojom;
import "mojo/camera3.mojom";
import "mojo/camera_metadata.mojom";
enum CameraFacing {
struct CameraResourceCost {
uint32 resource_cost;
struct CameraInfo {
CameraFacing facing;
int32 orientation;
uint32 device_version;
CameraMetadata static_camera_characteristics;
[MinVersion=1] CameraResourceCost? resource_cost;
[MinVersion=1] array<string>? conflicting_devices;
enum CameraDeviceStatus {
enum TorchModeStatus {
// CameraModuleCallbacks is a translation of the camera_module_callbacks_t API
// ( CameraModuleCallbacks is used by the camera HAL to
// inform the client of the various status change of a camera.
// Next method ID: 2
interface CameraModuleCallbacks {
// CameraDeviceStatusChange() is called by the camera HAL to notify the client
// of the new status of the camera device specified by |camera_id|.
CameraDeviceStatusChange@0(int32 camera_id, CameraDeviceStatus new_status);
// TorchModeStatusChange() is called by the camera HAL to notify the client of
// the new status of the torch mode of the flash unit associated with
// |camera_id|.
TorchModeStatusChange@1(int32 camera_id, TorchModeStatus new_status);
// VendorTagOps is a translation of the vendor_tag_ops_t API
// ( This structure contains basic functions for
// enumerating an immutable set of vendor-defined camera metadata tags, and
// querying static information about their structure/type.
// Next method ID: 5
// TODO(hywu): evaluate passing an array of vendor tags along with their
// section names, tag names, and types
interface VendorTagOps {
// Get the number of vendor tags supported on this platform.
GetTagCount@0() => (int32 result);
// Fill an array with all of the supported vendor tags on this platform.
GetAllTags@1() => (array<uint32> tag_array);
// Get the vendor section name for a vendor-specified entry tag.
GetSectionName@2(uint32 tag) => (string? name);
// Get the tag name for a vendor-specified entry tag.
GetTagName@3(uint32 tag) => (string? name);
// Get tag type for a vendor-specified entry tag.
GetTagType@4(uint32 tag) => (int32 type);
// CameraModule is a translation of the camera_module_t API
// ( CameraModule is the interface to interact with a
// camera HAL to query device info and open camera devices.
// Next method ID: 8
interface CameraModule {
// Opens the camera device specified by |camera_id|. On success, the camera
// device is accessible through the |device_ops| returned.
OpenDevice@0(int32 camera_id, Camera3DeviceOps& device_ops_request)
=> (int32 result);
// Gets the number of cameras currently present on the system.
GetNumberOfCameras@1() => (int32 result);
// Gets various info about the camera specified by |camera_id|.
GetCameraInfo@2(int32 camera_id) => (int32 result, CameraInfo? camera_info);
// [Deprecated in version 3]
// Registers the CameraModuleCallbacks interface with the camera HAL.
SetCallbacks@3(CameraModuleCallbacks callbacks) => (int32 result);
// Turns on or off the torch mode of the flash unit associated with the given
// |camera_id|.
SetTorchMode@4(int32 camera_id, bool enabled) => (int32 result);
// Called by the client before any other methods are invoked. The Init()
// method can be used by the camera HAL to perform initialization and other
// one-time operations.
Init@5() => (int32 result);
// Get methods to query for vendor extension metadata tag information. The HAL
// should fill in all the vendor tag operation methods, or leave ops unchanged
// if no vendor tags are defined.
GetVendorTagOps@6(VendorTagOps& vendor_tag_ops_request) => ();
// Registers the CameraModuleCallbacks associated interface with the camera
// HAL. TODO(b/169324225): Migrate all camera HAL clients to use this.
SetCallbacksAssociated@7(associated CameraModuleCallbacks callbacks)
=> (int32 result);