Chromium Code Reviews| Index: device/bluetooth/bluetooth_adapter_mac_metrics.h |
| diff --git a/device/bluetooth/bluetooth_adapter_mac_metrics.h b/device/bluetooth/bluetooth_adapter_mac_metrics.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..947aa9d6080f02bb2685b67dbd5ad7e5cbcd351c |
| --- /dev/null |
| +++ b/device/bluetooth/bluetooth_adapter_mac_metrics.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_METRICS_H_ |
| +#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_METRICS_H_ |
| + |
| +@class NSError; |
| + |
| +enum class WebBluetoothMacOSAPIs : int { |
| + WEB_BLUETOOTH_MACOS_APIS_DID_FAIL_TO_CONNECT_TO_PERIPHERAL = 0, |
|
ortuno
2017/05/31 06:59:52
Because this is an enum class we need to spell out
jlebel
2017/06/13 22:31:37
Done.
|
| + WEB_BLUETOOTH_MACOS_APIS_DID_DISCONNECT_PERIPHERAL, |
| + WEB_BLUETOOTH_MACOS_APIS_DID_DISCOVER_PRIMARY_SERVICES, |
| + WEB_BLUETOOTH_MACOS_APIS_DID_DISCOVER_CHARACTERISTICS, |
| + WEB_BLUETOOTH_MACOS_APIS_DID_UPDATE_VALUE, |
| + WEB_BLUETOOTH_MACOS_APIS_DID_WRITE_VALUE, |
| + WEB_BLUETOOTH_MACOS_APIS_DID_UPDATE_NOTIFICATION_STATE, |
| + WEB_BLUETOOTH_MACOS_APIS_DID_DISCOVER_DESCRIPTORS, |
| + WEB_BLUETOOTH_MACOS_APIS_DID_UPDATE_VALUE_FOR_DESCRIPTOR, |
| + WEB_BLUETOOTH_MACOS_APIS_DID_WRITE_VALUE_FOR_DESCRIPTOR, |
| +}; |
| + |
| +enum class WebBluetoothMacOSErrors : int { |
| + WEB_BLUETOOTH_MACOS_ERRORS_UNKNOWN_ERROR_DOMAIN = -1, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_SUCCESS = 0, |
|
ortuno
2017/05/31 06:59:52
Does this mean that we could get error != nil but
jlebel
2017/06/13 22:31:37
We are not supposed to receive it. This is when us
|
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_INVALID_HANDLE = 1, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_READ_NOT_PERMITTED = 2, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_WRITE_NOT_PERMITTED = 3, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_INVALID_PDU = 4, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_INSUFFICIENT_AUTHENTICATION = 5, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_REQUEST_NOT_SUPPORTED = 6, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_INVALID_OFFSET = 7, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_INSUFFICIENT_AUTHORIZATION = 8, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_PREPARE_QUEUE_FULL = 9, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_ATTRIBUTE_NOT_FOUND = 10, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_ATTRIBUTE_NOT_LONG = 11, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE = 12, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_INVALID_ATTRIBUTE_VALUE_LENGTH = 13, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_UNLIKELY_ERROR = 14, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_INSUFFICIENT_ENCRYPTION = 15, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_UNSUPPORTED_GROUP_TYPE = 16, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_INSUFFICIENT_RESOURCES = 17, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBATT_ERROR_MAX = 999, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_UNKNOWN = 1000, |
|
ortuno
2017/05/31 06:59:52
Do CBErrors values overlap with CBATT errors? If s
jlebel
2017/06/13 22:31:37
What do you mean overlap? for the integer values?
ortuno
2017/06/14 03:46:28
Yes, do the integer values overlap?
jlebel
2017/06/19 07:07:49
Yes, they do. They both start at 0 and increment.
|
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_INVALID_PARAMETERS = 1001, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_INVALID_HANDLE = 1002, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_NOT_CONNECTED = 1003, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_OUT_OF_SPACE = 1004, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_OPERATION_CANCELLED = 1005, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_CONNECTION_TIMEOUT = 1005, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_PERIPHERAL_DISCONNECTED = 1007, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_UUID_NOT_ALLOWED = 1008, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_ALREADY_ADVERTISING = 1010, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_MAX_CONNECTION = 1011, |
| + WEB_BLUETOOTH_MACOS_ERRORS_CBERROR_MAX = 1999, |
| + WEB_BLUETOOTH_MACOS_ERRORS_MAX, |
| +}; |
| + |
| +void LogNSErrorToHistogram(NSError* error, |
| + WebBluetoothMacOSAPIs web_bluetooth_macos_apis); |
| + |
| +#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_METRICS_H_ |