// Copyright (c) 2022 Boston Dynamics, Inc.  All rights reserved.
//
// Downloading, reproducing, distributing or otherwise using the SDK Software
// is subject to the terms and conditions of the Boston Dynamics Software
// Development Kit License (20191101-BDSDK-SL).

syntax = "proto3";

package bosdyn.api.spot_cam;

option java_outer_classname = "CompositorProto";

import "bosdyn/api/header.proto";
import "bosdyn/api/spot_cam/camera.proto";
import "google/protobuf/wrappers.proto";

// A "Screen" represents a particular layout of camera images
// used by the video stream.
message ScreenDescription {
    // Unique identifer for a screen.
    string name = 1;
}

// Request the current screen in use.
message GetScreenRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;

}

// Specify which screen is currently being displayed in the video stream.
message GetScreenResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
    // Identifier of the current screen.
    string name = 2;
}

// Request information about the current cameras in the video stream.
message GetVisibleCamerasRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;

}

// Description of the parameters and locations of each camera in the
// current video stream.
message GetVisibleCamerasResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;

    // The location and camera parameters for a single camera.
    message Stream {
        // The location of a sub-image within a larger image.
        message Window {
            int32 xoffset=1;
            int32 yoffset=2;
            //The image should be cropped out of the stream at this
            //resolution, and then scaled to the resolution described
            //in the 'camera' member, below.  once that scaling takes
            //place, the intrinsics will be valid.
            int32 width=3;
            int32 height=4;
        }
        // The location of this camera stream within the larger stream.
        Window window=1;
        // The name field in this camera member is of the form 'c:w',
        // where c is the name of the camera and w is the name of the
        // window that's projecting it.
        bosdyn.api.spot_cam.Camera camera=2;
    }
    // List of all camera streams visible in the current video stream.
    repeated Stream streams=2;
}

// Request the different screen layouts available.
message ListScreensRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;

}

// Response with all screen layouts available.
message ListScreensResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
    // List of all screen layouts that can be selected.
    repeated ScreenDescription screens = 2;
}

// Switch the camera layout in the video stream to the one specified.
message SetScreenRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;

    // Identifier as specified in ListScreensResponse.
    string name = 2;
}

// Result of setting the camera layout.
message SetScreenResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
    // Identifier of the screen used.
    string name = 2;
}

//the colormap is a mapping of radiometric data to color, to make the images easier for people to look at in real time.
message IrColorMap {
    enum ColorMap {
        COLORMAP_UNKNOWN = 0;
        //the greyscale colormap maps the minimum value (defined below) to black and the maximum value (defined below) to white
        COLORMAP_GREYSCALE = 1;
        //the jet colormap uses blues for values closer to the minimum, and red values for values closer to the maximum.
        COLORMAP_JET = 2;
        //the inferno colormap maps the minimum value to black and the maximum value to light yellow RGB(252, 252, 164). It is also
        //easier to view by those with color blindness
        COLORMAP_INFERNO = 3;
        //the turbo colormap uses blues for values closer to the minumum, red values for values closer to the maximum,
        //and addresses some short comings of the jet color map such as false detail, banding and color blindness
        COLORMAP_TURBO = 4;
    }
    ColorMap colormap = 1;

    message ScalingPair {
        //the minimum value to do color mapping, in degrees Celsius
        double min = 1;
        //the maximum value to do color mapping, in degrees Celsius
        double max = 2;
    }
    ScalingPair scale = 2;

    //if auto_scale is true, then the min and max values are derived from the data itself, and the settings
    //above are ignored
    google.protobuf.BoolValue auto_scale = 3;
}

message SetIrColormapRequest {
    bosdyn.api.RequestHeader header = 1;
    IrColorMap map = 2;
}

message SetIrColormapResponse {
    bosdyn.api.ResponseHeader header = 1;
}

message GetIrColormapRequest {
    bosdyn.api.RequestHeader header = 1;
}

message GetIrColormapResponse {
    bosdyn.api.ResponseHeader header = 1;
    IrColorMap map = 2;
}

//the ir meter overlay allows for pixel-accurate measurements to be taken and displayed to the user
message IrMeterOverlay {
    //If enable isn't true, don't overlay any IR meter
    bool enable = 1;

    //these coordinates, normalized from 0-1, are within the ir camera 'window'
    //note: if the coordinates lie within an 'invalid' region of the window, then
    //the meter will be disabled.
    message NormalizedCoordinates {
        double x = 1;
        double y = 2;
    }
    NormalizedCoordinates coords = 2;
}

message SetIrMeterOverlayRequest {
    bosdyn.api.RequestHeader header = 1;
    IrMeterOverlay overlay = 2;
}

message SetIrMeterOverlayResponse {
    bosdyn.api.ResponseHeader header = 1;
}
