
// @file sns_hinge_angle.proto
//
// Defines message types for the Hinge Angle Sensor.
//
// Copyright (c) 2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.

syntax = "proto2";
import "nanopb.proto";
import "sns_std_sensor.proto";

// The Hinge Angle Sensor detects the angle between two rigid bodies connected by a hinge
// around which rotation can occur.
// 
// The reference position for Hinge Angle measurement constitues the two rigid bodies being
// parallel to the ground, with surfaces in contact with each other and hinge connecting
// the left edges of the two rigid bodies.
// The rigid body that is located below is defined to be the primary rigid body.
// The rigid body which is located above is defined to be the secondary rigid body. 
// 
// The Hinge Angle Sensor detects the angle going from the primary rigid body to the
// secondary rigid body, measured counter clockwise around the hinge. The maximum range of
// reported angles will be from 0 degrees to 360 degrees.
// 
// A Hinge Angle of 0 degrees is reported when the two rigid bodies have the same surfaces,
// as described in the reference position, in contact with each other. 
// 
// A Hinge Angle of 360 degrees is reported when the two rigid bodies have the opposite
// surfaces, to those described in the reference position, in contact with each other.
// 
// A Hinge Angle of 180 degrees is reported when the two rigid bodies are coplanar.

// Attribute Requirements:
// Hingle Angle Sensor must support the following attributes
// SNS_STD_SENSOR_ATTRID_TYPE: "hinge_angle"
// SNS_STD_SENSOR_ATTRID_STREAM_TYPE: SNS_STD_SENSOR_STREAM_TYPE_ON_CHANGE
// SNS_STD_SENSOR_ATTRID_RESOLUTIONS: the smallest hinge angle in degrees that
//   can be detected by the sensor
// SNS_STD_SENSOR_ATTRID_RANGES: the range of angles detected by the sensor, for
//   example [0,360]

// Request:
// A request message with message id SNS_HINGE_ANGLE_MSGID_SNS_HINGE_ANGLE_CONFIG
// and payload sns_hinge_angle_config is used to enable the Hinge Angle Sensor

// Event:
// Hinge Angle sensor generates an event with message id
// SNS_STD_SENSOR_MSGID_SNS_STD_SENSOR_EVENT and payload sns_std_sensor_event
// when hinge angle change is detected

// Message IDs for HINGE_ANGLE Sensor
enum sns_hinge_angle_msgid {
  option (nanopb_enumopt).long_names = false;

  SNS_HINGE_ANGLE_MSGID_SNS_HINGE_ANGLE_CONFIG = 512;
}


// Request Message
// Used to either request for a new configuration of the Hinge Angle Sensor or
// alter an already existing configuration
message sns_hinge_angle_config
{
  // Ids of the primary and secondary rigid bodies between which hinge angle
  // is to be measured. Ids must match the SNS_STD_SENSOR_ATTRID_RIGID_BODY
  // attributes of the sensors on these rigid bodies that are to be used.
  repeated int32 rigid_body = 1 [(nanopb).max_count = 2];
}


// Event Message
// Uses sns_std_sensor_event message defined in sns_std_sensor.proto
// The data field of the sns_std_sensor_event message contains a 
// single floating point value representing the detected hinge angle
// in degrees
// The status field of the sns_std_sensor_event message contains the 
// accuracy of the detected hinge angle




