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 enum UMAGATTOperationOutcome { |
140 UNKNOWN = 0, | 138 SUCCESS = 0, |
141 FAILED = 1, | 139 NO_DEVICE = 1, |
142 IN_PROGRESS = 2, | 140 NO_SERVICE = 2, |
143 NOT_PAIRED = 3, | 141 NO_CHARACTERISTIC = 3, |
144 // Note: Add new GATT Errors immediately above this line. | 142 NO_DESCRIPTOR = 4, |
| 143 UNKNOWN = 5, |
| 144 FAILED = 6, |
| 145 IN_PROGRESS = 7, |
| 146 INVALID_LENGTH = 8, |
| 147 NOT_PERMITTED = 9, |
| 148 NOT_AUTHORIZED = 10, |
| 149 NOT_PAIRED = 11, |
| 150 NOT_SUPPORTED = 12, |
| 151 // Note: Add new GATT Outcomes immediately above this line. |
145 // Make sure to update the enum list in | 152 // Make sure to update the enum list in |
146 // tools/metrics/histograms/histograms.xml accordingly. | 153 // tools/metrics/histograms/histograms.xml accordingly. |
147 MAX_ERROR, | 154 COUNT |
148 }; | 155 }; |
149 // Records the GATT Error the function returned. | 156 |
150 void RecordGATTError(UMAGATTError error); | 157 enum class UMAGATTOperation { |
| 158 CHARACTERISTIC_READ, |
| 159 CHARACTERISTIC_WRITE, |
| 160 // Note: Add new GATT Operations immediately above this line. |
| 161 COUNT |
| 162 }; |
| 163 |
| 164 // Records the outcome of a GATT operation. |
| 165 // There should be a call to this function whenever the corresponding operation |
| 166 // doesn't have a call to Record[Operation]Outcome. |
| 167 void RecordGATTOperationOutcome(UMAGATTOperation operation, |
| 168 UMAGATTOperationOutcome outcome); |
| 169 |
| 170 // Characteristic.readValue() Metrics |
| 171 // There should be a call to this function for every call to |
| 172 // Send(BluetoothMsg_ReadCharacteristicValueSuccess) and |
| 173 // Send(BluetoothMsg_ReadCharacteristicValueError). |
| 174 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome error); |
| 175 |
| 176 // Characteristic.writeValue() Metrics |
| 177 // There should be a call to this function for every call to |
| 178 // Send(BluetoothMsg_WriteCharacteristicValueSuccess) and |
| 179 // Send(BluetoothMsg_WriteCharacteristicValueError). |
| 180 void RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome error); |
151 | 181 |
152 } // namespace content | 182 } // namespace content |
153 | 183 |
154 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 184 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
OLD | NEW |