// @file sns_std_type.proto
//
// Defines standard data types used across multiple Sensor API definitions
//
// Copyright (c) 2016-2017 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
syntax = "proto2";
import "nanopb.proto";

// Represents an unique Sensor
message sns_std_suid {
  required fixed64 suid_low = 1;
  required fixed64 suid_high = 2;
}

// Represents an attribute value
// Attribute values may be a single value, array of simple values, or
// an array of complex tuples
message sns_std_attr_value {
  // "data" submessage required to support recursion
  message data {
    option (nanopb_msgopt).no_unions = true;
    oneof value {
      sns_std_attr_value subtype = 1;
      string str = 2;
      float flt = 3;
      sfixed64 sint = 4;
      bool boolean = 5;
    }
  }
  repeated data values = 1;
}

// An individual attribute from a Sensor
message sns_std_attr {
  // A standard list of attributes is available within sns_std_sensor_attr_id
  // Additional attributes may be defined by sensors, using the format:
  // <SENSOR_PROTO_NAME>_ATTRID_<ATTR_NAME> (e.g. SNS_ACCEL_ATTRID_ODR)
  // Additional IDs must fall within the range of 1024-2047
  required int32 attr_id = 1;
  // Attribute value
  required sns_std_attr_value value = 2;
}

// Error codes
enum sns_std_error {
  option (nanopb_enumopt).long_names = false;

  /* No error occurred; success. */
  SNS_STD_ERROR_NO_ERROR = 0;
  /* Unfixable or internal error occurred. */
  SNS_STD_ERROR_FAILED = 1;
  /* This API is not supported or is not implemented. */
  SNS_STD_ERROR_NOT_SUPPORTED = 2;
  /* Message contains invalid data type,
   * e.g., unknown message ID, unknown registry group, or unexpected
   * Sensor UID. */
  SNS_STD_ERROR_INVALID_TYPE = 3;
  /* Catastrophic error; expect no further data */
  SNS_STD_ERROR_INVALID_STATE = 4;
  /* One or more argument values were outside of the valid range */
  SNS_STD_ERROR_INVALID_VALUE = 5;
  /* This operation is not available at this time */
  SNS_STD_ERROR_NOT_AVAILABLE = 6;
  /* This action was rejected due to the current policy settings */
  SNS_STD_ERROR_POLICY = 7;
}

//The enum contains all the processor types supported.
enum sns_std_client_processor {
  option (nanopb_enumopt).long_names = false;

  SNS_STD_CLIENT_PROCESSOR_SSC = 0;
  SNS_STD_CLIENT_PROCESSOR_APSS = 1;
  SNS_STD_CLIENT_PROCESSOR_ADSP = 2;
  SNS_STD_CLIENT_PROCESSOR_MDSP = 3;
  SNS_STD_CLIENT_PROCESSOR_CDSP = 4;
}
