• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1syntax = "proto3";
2
3package capo;
4
5// The message types used in capo nanoapp. Some of them are H2C
6// (Host-To-CHRE) and others are C2H (CHRE-To-Host). One message type must be
7// either H2C or C2H. Each message type can choose to have payload or not.
8enum MessageType {
9  // Explicitly prevents 0 from being used as a valid message type.
10  // Doing so protects from obscure bugs caused by default-initialized values.
11  INVALID = 0;
12
13  // Detector configuration related message start from 100.
14  // Signal for host to acknowledge the notification.
15  // It contains AckNotification payload.
16  ACK_NOTIFICATION = 100;
17
18  // Signal to enable the carried position detector for device. No payload.
19  ENABLE_DETECTOR = 101;
20
21  // Signal to disable the carried position detector for device. No payload.
22  DISABLE_DETECTOR = 102;
23
24  // Signal to request most recent carried position detector state. No payload.
25  REQUEST_UPDATE = 103;
26
27  // Signal to force carried position detector to refresh state. No payload.
28  FORCE_UPDATE = 104;
29
30  // Configure the detector with desired parameters. ConfigureDetector payload.
31  CONFIGURE_DETECTOR = 105;
32
33  // Position Detection related message start from 200.
34  // Signal while carried position of device detected.
35  // It contains PositionDetected payload.
36  POSITION_DETECTED = 200;
37}
38
39// Notification Type.
40enum NotificationType {
41  // Explicitly prevents 0 from being used as a valid notification type.
42  // Doing so protects from obscure bugs caused by default-initialized values.
43  INVALID_NOTIFICATION = 0;
44
45  // Notification of enabling the carried position detector for device.
46  ENABLE_NOTIFICATION = 1;
47
48  // Notification of disabling the carried position detector for device.
49  DISABLE_NOTIFICATION = 2;
50
51  // Notification of request update from the carried position detector.
52  REQUEST_UPDATE_NOTIFICATION = 3;
53
54  // Notification of force update from the carried position detector.
55  FORCE_UPDATE_NOTIFICATION = 4;
56
57  // Notification of configure message.
58  CONFIGURE_NOTIFICATION = 5;
59}
60
61// This message type used for host to acknowledge the notification.
62message AckNotification {
63  // Sent a notification type for host to acknowledge.
64  NotificationType notification_type = 1;
65}
66
67// Position type.
68enum PositionType {
69  // Explicitly prevents 0 from being used as a valid carried position type.
70  // Doing so protects from obscure bugs caused by default-initialized values.
71  UNKNOWN = 0;
72
73  // Carried position while device is in motion.
74  IN_MOTION = 1;
75
76  // Carried position while device is on table and faces up.
77  ON_TABLE_FACE_UP = 2;
78
79  // Carried position while device is on table and faces down.
80  ON_TABLE_FACE_DOWN = 3;
81
82  // Carried position while device is stationary in unknown orientation.
83  STATIONARY_UNKNOWN = 4;
84}
85
86// This message type used to notify host a position was a detected.
87message PositionDetected {
88  // Sent a position type that is defined in PositionTypes.
89  PositionType position_type = 1;
90}
91
92// Predefined configurations for detector.
93enum ConfigPresetType {
94  // Explicitly prevents 0 from being used as a valid type.
95  // Doing so protects from obscure bugs caused by default-initialized values.
96  CONFIG_PRESET_UNSPECIFIED = 0;
97
98  // Default preset.
99  CONFIG_PRESET_DEFAULT = 1;
100
101  // Preset for sticky-stationary behavior.
102  CONFIG_PRESET_STICKY_STATIONARY = 2;
103}
104
105message ConfigureDetector {
106  // Ref: cs/location/lbs/contexthub/nanoapps/motiondetector/motion_detector.h
107  message ConfigData {
108    // These algo parameters are exposed to enable tuning via server flags.
109    // The amount of time that the algorithm's computed stillness confidence
110    // must exceed still_confidence_threshold before entering the stationary
111    // state. Increasing this value will make the algorithm take longer to
112    // transition from the in motion state to the stationary state.
113    uint64 still_time_threshold_nanosecond = 1;
114
115    // The amount of time in which the variance should be averaged. Increasing
116    // this value will effectively smooth the input data, making the algorithm
117    // less likely to transition between states.
118    uint32 window_width_nanosecond = 2;
119
120    // The required confidence that the device is in motion before entering the
121    // motion state. Valid range is [0.0, 1.0], where 1.0 indicates that the
122    // algorithm must be 100% certain that the device is moving before entering
123    // the motion state. If the Instant Motion sensor is triggered, this value
124    // is ignored and the algorithm is immediately transitioned into the in
125    // motion state.
126    float motion_confidence_threshold = 3;
127
128    // The required confidence that the device is stationary before entering the
129    // stationary state. Valid range is [0.0, 1.0], where 1.0 indicates that the
130    // algorithm must be 100% certain that the device is stationary before
131    // entering the stationary state.
132    float still_confidence_threshold = 4;
133
134    // The variance threshold for the StillnessDetector algorithm. Increasing
135    // this value causes the algorithm to be less likely to detect motion.
136    float var_threshold = 5;
137
138    // The variance threshold delta for the StillnessDetector algorithm about
139    // which the stationary confidence is calculated. Valid range is
140    // [0.0, var_threshold].
141    float var_threshold_delta = 6;
142  }
143
144  oneof type {
145    ConfigPresetType preset_type = 1;
146    ConfigData config_data = 2;
147  }
148}
149