1syntax = "proto2";
2
3package chre_cross_validation_sensor;
4
5option java_package = "com.google.android.chre.nanoapp.proto";
6option java_outer_classname = "ChreCrossValidationSensor";
7
8// Nanoappp message type can be either host to chre (H2C) or chre to host (C2H)
9enum MessageType {
10  // Reserved for corrupted messages
11  UNDEFINED = 0;
12
13  // H2C: Host telling nanoapp to start collecting sensor data
14  // Payload must be StartCommand message
15  CHRE_CROSS_VALIDATION_START = 1;
16
17  // C2H: Data payload to be validated. This is a batch of data exactly as it
18  // was received from a CHRE API.
19  // Payload must be Data message
20  CHRE_CROSS_VALIDATION_DATA = 2;
21
22  // H2C: Host asking nanoapp for information about a given sensor.
23  // Payload must be SensorInfoCommand message.
24  CHRE_CROSS_VALIDATION_INFO = 3;
25
26  // C2H: Response to a information request for a sensor.
27  // Payload must be a SensorInfoResponse message.
28  CHRE_CROSS_VALIDATION_INFO_RESPONSE = 4;
29}
30
31message StartCommand {
32  oneof command {
33    StartSensorCommand startSensorCommand = 1;
34  }
35}
36
37/*
38 * apSensorType values defined in Sensor class of
39 * android/frameworks/base/core/java/android/hardware/Sensor.java
40 */
41message StartSensorCommand {
42  optional uint32 chreSensorType = 1;
43  optional uint64 intervalInMs = 2;
44  optional uint64 latencyInMs = 3;
45  optional bool isContinuous = 4;
46  optional uint32 sensorIndex = 5;
47}
48
49/*
50 * Asks for the nanoapp to provide stats about the provided CHRE sensor type.
51 */
52message SensorInfoCommand {
53  optional uint32 chreSensorType = 1;
54  // The sensor name given by android.hardware.Sensor#getSensorName()
55  optional bytes sensorName = 2;
56}
57
58/*
59 * Response to a SensorInfoCommand containing data about the requested sensor.
60 */
61message SensorInfoResponse {
62  optional uint32 chreSensorType = 1;
63  optional bool isAvailable = 2;
64  optional uint32 sensorIndex = 3;
65}
66
67message Data {
68  oneof data {
69    SensorData sensorData = 1;
70  }
71}
72
73/*
74 * Similar data to structs with naming scheme chreSensor*Data found in
75 * android/system/chre/chre_api/include/chre_api/chre/sensor_types.h
76 */
77message SensorData {
78  optional uint32 chreSensorType = 1;
79  optional uint32 accuracy = 2;
80  repeated SensorDatapoint datapoints = 3;
81}
82
83/*
84 * Similar data to structs with naming scheme chreSensor*SampleData found in
85 * android/system/chre/chre_api/include/chre_api/chre/sensor_types.h except
86 * that timestampDelta has been replaced with timestampInNs which is an
87 * absolute timestamp instead of the delta relative to the last sample.
88 */
89message SensorDatapoint {
90  optional uint64 timestampInNs = 1;
91  repeated float values = 2;
92}
93