1/* Forward & backward compatibility practices must be followed.  This means:
2   a) Never re-use an enum if the semantics are different.
3   b) Never alter the semantic meaning.  If needed, simply deprecate
4      old message/field/enum & start using new one.  If deprecated message
5      is no longer used in code make sure to communicate this to QA.
6   c) Prefer 3-stage migrations if possible: add new message/enum/field & start
7      sending it, make sure QA has switched to new message/enum/field, remove old
8      message/enum/field.
9   Fields should start out required unless they are optional in the code.  They should
10   become optional when deprecated (make sure to update QA automation first to expect the
11   field to be optional) or removed.  Make sure to never re-use field ids unless
12   the field is being resurrected.
13 */
14syntax = "proto2";
15//package audiowear;
16package apollo.lib.apollo_dev_util_lib.proto;
17import "nanopb.proto";
18//import "third_party/nanopb/nanopb.proto";
19
20
21option java_package = "com.google.android.bisto.nano";
22option java_outer_classname = "ApolloQA";
23
24enum ApolloQAMessageType {
25  TRACE = 1;
26  GET_VER_RESPONSE = 2;
27  GET_CODEC_RESPONSE = 3;
28  GET_DSP_STATUS_RESPONSE = 4;
29  FACTORY_PLAY_SOUND = 5;
30  FACTORY_INFO_REQUEST = 6;
31  FACTORY_INFO_RESPONSE = 7;
32}
33enum TraceId {
34  // data[0] = partition# erased.
35  OTA_ERASE_PARTITION = 1;
36  // data[0] = partition# we will write to.
37  // data[1] = expected length we will write to partition
38  OTA_START_PARTITION_WRITE = 2;
39  // data[0] = partition# written
40  // data[1] = actual written length
41  OTA_FINISHED_PARTITION_WRITE = 3;
42  // our custom signature validation has begun
43  OTA_SIGNATURE_START = 4;
44  // our custom signature validation rejected the image
45  OTA_SIGNATURE_FAILURE = 5;
46  // triggering CSR to reboot & apply DFU
47  OTA_TRIGGERING_LOADER = 6;
48  // the CSR loader rejected the image
49  OTA_LOADER_VERIFY_FAILED = 7;
50  // progress update.
51  // data[0] = num bytes received
52  // data[1] = num bytes expected
53  OTA_PROGRESS = 8;
54  OTA_ABORTED = 9;
55  // up to 10: reserved for OTA
56  // data[0] = AvrcpPlayStatus as integer
57  AVRCP_PLAY_STATUS_CHANGE = 10;
58  /* data[0] = new volume level (int16 stored in uint32)
59     data[1] = new volume level in dB (int16 stored in uint32)
60     data[2] = previous volume level (int16 stored in uint32)
61     easy conversion in python:
62       new_volume = ctpyes.c_short(ctypes.c_uint(data[0]).value).value
63       new_volume_db = ctpyes.c_short(ctypes.c_uint(data[1]).value).value
64  */
65  VOLUME_CHANGE = 11;
66  /* data[0] = entry number of command */
67  COMMANDER_RECV_COMMAND = 12;
68  COMMANDER_FINISH_COMMAND = 13;
69  /* currently no information about the rejected command */
70  COMMANDER_REJECT_COMMAND = 14;
71}
72/* Note: FWD_SEEK & REV_SEEK are bit-wise or'ed into the status.
73   Use SEEK_MASK first to read the seek or mask it out to get the other
74   states).  Do not & with individual states for comparison as aside from
75   seek the other states are not a bitwise-mask.
76*/
77enum AvrcpPlayStatus {
78  STOPPED = 0;
79  PLAYING = 1;
80  PAUSED = 2;
81  FWD_SEEK = 8;
82  REV_SEEK = 16;
83  ERROR = 5;
84  /* & this with the status to compare against FWD_SEEK/REV_SEEK.
85     & with the complement of this value to get the other states */
86  SEEK_MASK = 24;
87}
88/* These messages are internal trace-points for QA to do whitebox validation.
89   However, developers should feel free to remove trace-points if they
90   no longer make sense (but communicate to QA to prep this ahead-of-time). */
91message ApolloQATrace {
92  // all messages should have a timestamp field and it will get auto-populated
93  // (no need to set it at the call-site).
94  required uint32 timestamp = 1;
95  // this is the event that occured internally
96  required TraceId id = 2;
97  // this is some optional data that depends on the traceid.
98  // if not documented then no fields will be written.
99  repeated uint32 data = 3 [packed = true, (nanopb).max_count = 5];
100}
101enum PreviousBootStatus {
102  OTA_SUCCESS = 1; /* previous boot OK */
103  OTA_ERROR = 2; /* previous OTA failed */
104}
105//Next ID: 10
106message ApolloQAGetVerResponse {
107  required uint32 timestamp = 1;
108  required uint32 csr_fw_version = 2; // not implemented for now
109  required bool csr_fw_debug_build = 3; // not implemented for now
110  required uint32 vm_build_number = 4;
111  required bool vm_debug_build = 5;
112  required uint32 psoc_version = 6;
113  // the build label sent to AGSA. This should just be an amalgum of the broken-down
114  // info above. Aside from X.Y.Z prefix, do not parse this for anything as it is
115  // free-form text.
116  required string build_label = 7 [(nanopb).max_size = 32];
117  // if not set then info wasn't available.
118  optional PreviousBootStatus last_ota_status = 8;
119  required uint32 charger_version = 9;
120  optional uint32 expected_psoc_version = 10;
121}
122enum ApolloQAA2dpCodec {
123  AAC = 1;
124  SBC = 2;
125}
126message ApolloQAGetCodecResponse {
127  required uint32 timestamp = 1;
128  // if not set then unknown codec (error).
129  optional ApolloQAA2dpCodec codec = 2;
130}
131enum SinkState {
132  LIMBO = 0;
133  CONNECTABLE = 1;
134  DISCOVERABLE = 2;
135  CONNECTED = 3;
136  OUTGOING_CALLS_ESTABLISH = 4;
137  INCOMING_CALLS_ESTABLISH = 5;
138  ACTIVE_CALL_SCO = 6;
139  TEST_MODE = 7;
140  THREE_WAY_CALL_WAITING = 8;
141  THREE_WAY_CALL_ON_HOLD = 9;
142  THREE_WAY_MULTICALL = 10;
143  INCOMING_CALL_ON_HOLD = 11;
144  ACTIVE_CALL_NO_SCO = 12;
145  A2DP_STREAMING = 13;
146  DEVICE_LOW_BATTERY = 14;
147}
148message ApolloQAGetDspStatusResponse {
149  required uint32 timestamp = 1;
150  required bool is_dsp_loaded = 2;
151  required SinkState sink_state = 3;
152  /**
153   * This is a bit-wise mask.
154   * see AudioWearFeatureBits audiowear_plugin_state.h
155   * for the definition.
156   */
157  required uint32 features_active = 4;
158}
159message ApolloQAFactoryPlaySound {
160  enum PromptType {
161    PROMPT_TYPE_BT_CONNECTED = 1;
162    PROMPT_TYPE_IN_EAR = 2;
163  }
164  required PromptType prompt = 1;
165}
166message ApolloQAFactoryInfoRequest {
167}
168message ApolloQAFactoryInfoResponse {
169  required uint32 timestamp = 1;
170  optional int32 crystal_trim = 2 [(nanopb).int_size = IS_16];
171  optional bool crash_dump_exists = 3;
172  optional bool is_developer_mode_enabled = 4;
173  optional bool is_always_connected = 5;
174  optional uint32 hwid = 6;
175}