• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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}
47
48/*
49 * Asks for the nanoapp to provide stats about the provided CHRE sensor type.
50 */
51message SensorInfoCommand {
52  optional uint32 chreSensorType = 1;
53}
54
55/*
56 * Response to a SensorInfoCommand containing data about the requested sensor.
57 */
58message SensorInfoResponse {
59  optional uint32 chreSensorType = 1;
60  optional bool isAvailable = 2;
61}
62
63message Data {
64  oneof data {
65    SensorData sensorData = 1;
66  }
67}
68
69/*
70 * Similar data to structs with naming scheme chreSensor*Data found in
71 * android/system/chre/chre_api/include/chre_api/chre/sensor_types.h
72 */
73message SensorData {
74  optional uint32 chreSensorType = 1;
75  optional uint32 accuracy = 2;
76  repeated SensorDatapoint datapoints = 3;
77}
78
79/*
80 * Similar data to structs with naming scheme chreSensor*SampleData found in
81 * android/system/chre/chre_api/include/chre_api/chre/sensor_types.h except
82 * that timestampDelta has been replaced with timestampInNs which is an
83 * absolute timestamp instead of the delta relative to the last sample.
84 */
85message SensorDatapoint {
86  optional uint64 timestampInNs = 1;
87  repeated float values = 2;
88}
89