| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "modules/bluetooth/BluetoothError.h" | 5 #include "modules/bluetooth/BluetoothError.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
| 8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, | 53 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, |
| 54 "GATT Service no longer exists."); | 54 "GATT Service no longer exists."); |
| 55 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, | 55 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, |
| 56 "GATT Characteristic no longer exists."); | 56 "GATT Characteristic no longer exists."); |
| 57 MAP_ERROR(DESCRIPTOR_NO_LONGER_EXISTS, InvalidStateError, | 57 MAP_ERROR(DESCRIPTOR_NO_LONGER_EXISTS, InvalidStateError, |
| 58 "GATT Descriptor no longer exists."); | 58 "GATT Descriptor no longer exists."); |
| 59 | 59 |
| 60 // NetworkErrors: | 60 // NetworkErrors: |
| 61 MAP_ERROR(CONNECT_ALREADY_IN_PROGRESS, NetworkError, | 61 MAP_ERROR(CONNECT_ALREADY_IN_PROGRESS, NetworkError, |
| 62 "Connection already in progress."); | 62 "Connection already in progress."); |
| 63 MAP_ERROR(CONNECT_ATTRIBUTE_LENGTH_INVALID, NetworkError, | |
| 64 "Write operation exceeds the maximum length of the attribute."); | |
| 65 MAP_ERROR(CONNECT_AUTH_CANCELED, NetworkError, | 63 MAP_ERROR(CONNECT_AUTH_CANCELED, NetworkError, |
| 66 "Authentication canceled."); | 64 "Authentication canceled."); |
| 67 MAP_ERROR(CONNECT_AUTH_FAILED, NetworkError, "Authentication failed."); | 65 MAP_ERROR(CONNECT_AUTH_FAILED, NetworkError, "Authentication failed."); |
| 68 MAP_ERROR(CONNECT_AUTH_REJECTED, NetworkError, | 66 MAP_ERROR(CONNECT_AUTH_REJECTED, NetworkError, |
| 69 "Authentication rejected."); | 67 "Authentication rejected."); |
| 70 MAP_ERROR(CONNECT_AUTH_TIMEOUT, NetworkError, "Authentication timeout."); | 68 MAP_ERROR(CONNECT_AUTH_TIMEOUT, NetworkError, "Authentication timeout."); |
| 71 MAP_ERROR(CONNECT_CONNECTION_CONGESTED, NetworkError, | |
| 72 "Remote device connection is congested."); | |
| 73 MAP_ERROR(CONNECT_INSUFFICIENT_ENCRYPTION, NetworkError, | |
| 74 "Insufficient encryption for a given operation"); | |
| 75 MAP_ERROR( | |
| 76 CONNECT_OFFSET_INVALID, NetworkError, | |
| 77 "Read or write operation was requested with an invalid offset."); | |
| 78 MAP_ERROR(CONNECT_READ_NOT_PERMITTED, NetworkError, | |
| 79 "GATT read operation is not permitted."); | |
| 80 MAP_ERROR(CONNECT_REQUEST_NOT_SUPPORTED, NetworkError, | |
| 81 "The given request is not supported."); | |
| 82 MAP_ERROR(CONNECT_UNKNOWN_ERROR, NetworkError, | 69 MAP_ERROR(CONNECT_UNKNOWN_ERROR, NetworkError, |
| 83 "Unknown error when connecting to the device."); | 70 "Unknown error when connecting to the device."); |
| 84 MAP_ERROR(CONNECT_UNKNOWN_FAILURE, NetworkError, | 71 MAP_ERROR(CONNECT_UNKNOWN_FAILURE, NetworkError, |
| 85 "Connection failed for unknown reason."); | 72 "Connection failed for unknown reason."); |
| 86 MAP_ERROR(CONNECT_UNSUPPORTED_DEVICE, NetworkError, | 73 MAP_ERROR(CONNECT_UNSUPPORTED_DEVICE, NetworkError, |
| 87 "Unsupported device."); | 74 "Unsupported device."); |
| 88 MAP_ERROR(CONNECT_WRITE_NOT_PERMITTED, NetworkError, | |
| 89 "GATT write operation is not permitted."); | |
| 90 MAP_ERROR(DEVICE_NO_LONGER_IN_RANGE, NetworkError, | 75 MAP_ERROR(DEVICE_NO_LONGER_IN_RANGE, NetworkError, |
| 91 "Bluetooth Device is no longer in range."); | 76 "Bluetooth Device is no longer in range."); |
| 92 MAP_ERROR(GATT_NOT_PAIRED, NetworkError, "GATT Error: Not paired."); | 77 MAP_ERROR(GATT_NOT_PAIRED, NetworkError, "GATT Error: Not paired."); |
| 93 MAP_ERROR(GATT_OPERATION_IN_PROGRESS, NetworkError, | 78 MAP_ERROR(GATT_OPERATION_IN_PROGRESS, NetworkError, |
| 94 "GATT operation already in progress."); | 79 "GATT operation already in progress."); |
| 95 MAP_ERROR(UNTRANSLATED_CONNECT_ERROR_CODE, NetworkError, | |
| 96 "Unknown ConnectErrorCode."); | |
| 97 MAP_ERROR(GATT_SERVER_NOT_CONNECTED, NetworkError, | 80 MAP_ERROR(GATT_SERVER_NOT_CONNECTED, NetworkError, |
| 98 "GATT Server is disconnected. Cannot perform GATT operations."); | 81 "GATT Server is disconnected. Cannot perform GATT operations."); |
| 99 MAP_ERROR(GATT_SERVER_DISCONNECTED, NetworkError, | 82 MAP_ERROR(GATT_SERVER_DISCONNECTED, NetworkError, |
| 100 "GATT Server disconnected while performing a GATT operation."); | 83 "GATT Server disconnected while performing a GATT operation."); |
| 101 MAP_ERROR(GATT_SERVER_DISCONNECTED_WHILE_RETRIEVING_CHARACTERISTICS, | 84 MAP_ERROR(GATT_SERVER_DISCONNECTED_WHILE_RETRIEVING_CHARACTERISTICS, |
| 102 NetworkError, | 85 NetworkError, |
| 103 "GATT Server disconnected while retrieving characteristics."); | 86 "GATT Server disconnected while retrieving characteristics."); |
| 104 MAP_ERROR( | 87 MAP_ERROR( |
| 105 GATT_SERVER_NOT_CONNECTED_CANNOT_RETRIEVE_CHARACTERISTICS, | 88 GATT_SERVER_NOT_CONNECTED_CANNOT_RETRIEVE_CHARACTERISTICS, |
| 106 NetworkError, | 89 NetworkError, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 "requestDevice() called from cross-origin iframe."); | 156 "requestDevice() called from cross-origin iframe."); |
| 174 | 157 |
| 175 #undef MAP_ERROR | 158 #undef MAP_ERROR |
| 176 } | 159 } |
| 177 | 160 |
| 178 NOTREACHED(); | 161 NOTREACHED(); |
| 179 return DOMException::create(UnknownError); | 162 return DOMException::create(UnknownError); |
| 180 } | 163 } |
| 181 | 164 |
| 182 } // namespace blink | 165 } // namespace blink |
| OLD | NEW |