1// Copyright (C) 2019 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15namespace chre.power_test; 16 17/// Indicates which of the following messages is being sent to / from the 18/// nanoapp. Use uint as the base type to match the message type in 19/// chreMessageFromHostData. 20enum MessageType : uint { 21 UNSPECIFIED = 0, 22 /// Should be used with TimerMessage 23 TIMER_TEST, 24 /// Should be used with WifiScanMessage 25 WIFI_SCAN_TEST, 26 /// Should be used with GnssLocationMessage 27 GNSS_LOCATION_TEST, 28 /// Should be used with CellQueryMessage 29 CELL_QUERY_TEST, 30 /// Should be used with AudioRequestMessage 31 AUDIO_REQUEST_TEST, 32 /// Should be used with SensorRequestMessage 33 SENSOR_REQUEST_TEST, 34 /// Should be used with BreakItMessage 35 BREAK_IT_TEST, 36 /// Should be used with NanoappResponseMessage 37 NANOAPP_RESPONSE, 38 /// Should be used with GnssMeasurementMessage 39 GNSS_MEASUREMENT_TEST, 40 /// Should be used with WifiNanSubMessage 41 WIFI_NAN_SUB, 42 /// Should be used with WifiNanSubCancelMessage 43 WIFI_NAN_SUB_CANCEL, 44 /// Should be used with WifiNanSubResponseMessage 45 WIFI_NAN_SUB_RESP, 46} 47 48/// Represents a message to ask the nanoapp to create a timer that wakes up at 49/// the given interval 50table TimerMessage { 51 enable:bool; 52 wakeup_interval_ns:ulong; 53} 54 55/// All the various WiFi scan types that can be interacted with inside the 56/// nanoapp. The values used here map directly to values from the CHRE API. 57enum WifiScanType : ubyte { 58 ACTIVE = 0, 59 ACTIVE_PLUS_PASSIVE_DFS = 1, 60 PASSIVE = 2, 61 NO_PREFERENCE = 3, 62} 63 64/// All the various WiFi radio chain preferences that can be interacted with 65/// inside the nanoapp. The values used here map directly to values from the 66/// CHRE API. 67enum WifiRadioChain : ubyte { 68 DEFAULT = 0, 69 LOW_LATENCY = 1, 70 LOW_POWER = 2, 71 HIGH_ACCURACY = 3, 72} 73 74/// All the various WiFi channel sets that can be interacted with inside the 75/// nanoapp. The values used here map directly to values from the CHRE API. 76enum WifiChannelSet : ubyte { 77 NON_DFS = 0, 78 ALL = 1, 79} 80 81/// Represents a message to ask the nanoapp to start or stop WiFi scanning and 82/// the scan interval to use if scanning is being started 83table WifiScanMessage { 84 enable:bool; 85 scan_interval_ns:ulong; 86 scan_type:WifiScanType; 87 radio_chain:WifiRadioChain; 88 channel_set:WifiChannelSet; 89} 90 91/// Represents a message to ask the nanoapp to start or stop Gnss location 92/// sampling at the requested interval 93table GnssLocationMessage { 94 enable:bool; 95 scan_interval_millis:uint; 96 min_time_to_next_fix_millis:uint; 97} 98 99/// Represents a message to ask the nanoapp to start or stop querying the cell 100/// modem for the latest cell scan results on the given interval 101table CellQueryMessage { 102 enable:bool; 103 query_interval_ns:ulong; 104} 105 106/// Represents a message to ask the nanoapp to start / stop requesting Audio 107/// data buffered at given interval. Note: If there is more than one audio 108/// source, the nanoapp will only request audio from the first source. 109table AudioRequestMessage { 110 enable:bool; 111 /// The buffer duration is also used as the interval for how often 112 /// the buffer should be delivered to the nanoapp. 113 buffer_duration_ns:ulong; 114} 115 116/// All the various sensors that can be interacted with inside the nanoapp. 117/// The values used here map directly to values from the CHRE API 118enum SensorType : ubyte { 119 UNKNOWN = 0, 120 ACCELEROMETER = 1, 121 INSTANT_MOTION_DETECT = 2, 122 STATIONARY_DETECT = 3, 123 GYROSCOPE = 6, 124 UNCALIBRATED_GYROSCOPE = 7, 125 GEOMAGNETIC_FIELD = 8, 126 UNCALIBRATED_GEOMAGNETIC_FIELD = 9, 127 PRESSURE = 10, 128 LIGHT = 12, 129 PROXIMITY = 13, 130 STEP_DETECT = 23, 131 STEP_COUNTER = 24, 132 UNCALIBRATED_ACCELEROMETER = 55, 133 ACCELEROMETER_TEMPERATURE = 56, 134 GYROSCOPE_TEMPERATURE = 57, 135 GEOMAGNETIC_FIELD_TEMPERATURE = 58, 136} 137 138/// Represents a message to ask the nanoapp to start / stop sampling / batching 139/// a given sensor 140table SensorRequestMessage { 141 enable:bool; 142 sensor:SensorType; 143 sampling_interval_ns:ulong; 144 latency_ns:ulong; 145} 146 147/// Represents a message to enable / disable break-it mode inside the nanoapp. 148/// Break-it mode enables WiFi / GNSS / Cell to be queried every second and 149/// enables all sensors at their fastest sampling rate. 150table BreakItMessage { 151 enable:bool; 152} 153 154/// Indicates whether the nanoapp successfully performed the requested action. 155/// Any failures will be printed to the logs. 156table NanoappResponseMessage { 157 success:bool; 158} 159 160/// Represents a message to ask the nanoapp to start or stop Gnss measurement 161/// sampling at the requested interval 162table GnssMeasurementMessage { 163 enable:bool; 164 min_interval_millis:uint; 165} 166 167/// Represents a message to ask the nanoapp to start a NAN subscription session. 168/// See chreWifiNanSubscribeConfig for how to fill in this message. 169table WifiNanSubMessage { 170 sub_type:ubyte; 171 service_name:[ubyte]; 172 service_specific_info:[ubyte]; 173 match_filter:[ubyte]; 174} 175 176/// Represents a messages to ask the nanoapp to cancel an ongoing subscription 177table WifiNanSubCancelMessage { 178 subscription_id:uint; 179} 180 181/// Represents a message from the nanoapp indicating whether a subscription 182/// request succeeded 183table WifiNanSubResponseMessage { 184 success:bool; 185 subscription_id:uint; 186}