OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 // tools/metrisc/histogram/histograms.xml accordingly. | 123 // tools/metrisc/histogram/histograms.xml accordingly. |
124 COUNT | 124 COUNT |
125 }; | 125 }; |
126 // There should be a call to this function for every call to | 126 // There should be a call to this function for every call to |
127 // Send(BluetoothMsg_GetCharacteristicSuccess) and | 127 // Send(BluetoothMsg_GetCharacteristicSuccess) and |
128 // Send(BluetoothMsg_GetCharacteristicError). | 128 // Send(BluetoothMsg_GetCharacteristicError). |
129 void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome); | 129 void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome); |
130 // Records the UUID of the characteristic used when calling getCharacteristic. | 130 // Records the UUID of the characteristic used when calling getCharacteristic. |
131 void RecordGetCharacteristicCharacteristic(const std::string& characteristic); | 131 void RecordGetCharacteristicCharacteristic(const std::string& characteristic); |
132 | 132 |
133 // read/write characteristics Metrics | 133 // GATT Operations Metrics |
134 // TODO(ortuno): For now we are just copying over the code to record these | |
135 // errors but a follow up CL will add a function for each operation. | |
136 | 134 |
137 // These types of errors aren't as common. We log them to understand | 135 // These are the possible outcomes when performing GATT operations i.e. |
138 // how common they are and if we need to investigate more. | 136 // characteristic.readValue/writeValue descriptor.readValue/writeValue. |
139 enum class UMAGATTError { | 137 // Some of the |
Ilya Sherman
2015/08/14 22:27:50
nit: Sentence fragment. Consider revising ;)
ortuno
2015/08/14 22:35:03
Done.
| |
140 UNKNOWN = 0, | 138 enum UMAGATTOperationOutcome { |
141 FAILED = 1, | 139 SUCCESS = 0, |
142 IN_PROGRESS = 2, | 140 NO_DEVICE = 1, |
143 NOT_PAIRED = 3, | 141 NO_SERVICE = 2, |
144 // Note: Add new GATT Errors immediately above this line. | 142 NO_CHARACTERISTIC = 3, |
143 NO_DESCRIPTOR = 4, | |
144 UNKNOWN = 5, | |
145 FAILED = 6, | |
146 IN_PROGRESS = 7, | |
147 INVALID_LENGTH = 8, | |
148 NOT_PERMITTED = 9, | |
149 NOT_AUTHORIZED = 10, | |
150 NOT_PAIRED = 11, | |
151 NOT_SUPPORTED = 12, | |
152 // Note: Add new GATT Outcomes immediately above this line. | |
145 // Make sure to update the enum list in | 153 // Make sure to update the enum list in |
146 // tools/metrics/histograms/histograms.xml accordingly. | 154 // tools/metrics/histograms/histograms.xml accordingly. |
147 MAX_ERROR, | 155 COUNT |
148 }; | 156 }; |
149 // Records the GATT Error the function returned. | 157 |
150 void RecordGATTError(UMAGATTError error); | 158 enum class UMAGATTOperation { |
159 CHARACTERISTIC_READ, | |
160 CHARACTERISTIC_WRITE, | |
161 // Note: Add new GATT Operations immediately above this line. | |
162 COUNT | |
163 }; | |
164 | |
165 // Records the outcome of a GATT operation. | |
166 // There should be a call to this function whenever the corresponding operation | |
167 // doesn't have a call to Record[Operation]Outcome. | |
168 void RecordGATTOperationOutcome(UMAGATTOperation operation, | |
169 UMAGATTOperationOutcome outcome); | |
170 | |
171 // Characteristic.readValue() Metrics | |
172 // There should be a call to this function for every call to | |
173 // Send(BluetoothMsg_ReadCharacteristicValueSuccess) and | |
174 // Send(BluetoothMsg_ReadCharacteristicValueError). | |
175 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome error); | |
176 | |
177 // Characteristic.writeValue() Metrics | |
178 // There should be a call to this function for every call to | |
179 // Send(BluetoothMsg_WriteCharacteristicValueSuccess) and | |
180 // Send(BluetoothMsg_WriteCharacteristicValueError). | |
181 void RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome error); | |
151 | 182 |
152 } // namespace content | 183 } // namespace content |
153 | 184 |
154 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 185 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
OLD | NEW |