blob: d7bf589822aae147e11ccc7e7d7b05b60dec3dfb [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.camera.gym;
/// CommandError is the return status for the transactions between the camera-gym CLI front end and
/// the instance of camera-gym running.
type CommandError = strict enum {
OUT_OF_RANGE = 1; // Argument value out of range
};
/// "set-config" command shall call SetCurrentConfiguration for current camera.
type SetConfigCommand = struct {
config_id uint32; // Which configuration?
async bool; // Do not wait until operation completes before returning
};
/// "add-stream" command shall add the specified stream to the collage.
type AddStreamCommand = struct {
stream_id uint32; // Which stream?
async bool; // Do not wait until operation completes before returning
};
/// "set-crop" command shall set the crop region for the specified stream.
type SetCropCommand = struct {
stream_id uint32; // Which stream?
x float32; // Crop region
y float32; // Crop region
width float32; // Crop region
height float32; // Crop region
async bool; // Do not wait until operation completes before returning
};
/// "set-resolution" command shall set the output resolution for the specified stream.
type SetResolutionCommand = struct {
stream_id uint32; // Which stream?
width uint32; // New resolution
height uint32; // New resolution
async bool; // Do not wait until operation completes before returning
};
/// "set-description" command shall turn on or off the text description on displayed streams
type SetDescriptionCommand = struct {
enable bool;
};
/// "capture-frame" command shall attempt to capture a frame in the specified stream
type CaptureFrameCommand = struct {
stream_id uint32; // Which stream?
};
type Command = strict union {
1: set_config SetConfigCommand;
2: add_stream AddStreamCommand;
3: set_crop SetCropCommand;
4: set_resolution SetResolutionCommand;
5: set_description SetDescriptionCommand;
6: capture_frame CaptureFrameCommand;
};
@discoverable
closed protocol Controller {
// SendCommand sends a single Command to camera-gym to execute.
//
// The error return indicates the reason for failure of execution.
strict SendCommand(struct {
command Command;
}) -> () error CommandError;
};