capo.proto 5.3 KB

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