| 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 #include "modules/bluetooth/BluetoothUUID.h" | 5 #include "modules/bluetooth/BluetoothUUID.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptRegexp.h" | 8 #include "bindings/core/v8/ScriptRegexp.h" |
| 9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "platform/UUID.h" | 10 #include "platform/UUID.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 map = getAssignedNumberForCharacteristicNameMap(); | 297 map = getAssignedNumberForCharacteristicNameMap(); |
| 298 attributeType = "Characteristic"; | 298 attributeType = "Characteristic"; |
| 299 break; | 299 break; |
| 300 case GATTAttribute::Descriptor: | 300 case GATTAttribute::Descriptor: |
| 301 map = getAssignedNumberForDescriptorNameMap(); | 301 map = getAssignedNumberForDescriptorNameMap(); |
| 302 attributeType = "Descriptor"; | 302 attributeType = "Descriptor"; |
| 303 break; | 303 break; |
| 304 } | 304 } |
| 305 | 305 |
| 306 if (map->contains(nameStr)) | 306 if (map->contains(nameStr)) |
| 307 return BluetoothUUID::canonicalUUID(map->get(nameStr)); | 307 return BluetoothUUID::canonicalUUID(map->at(nameStr)); |
| 308 | 308 |
| 309 StringBuilder errorMessage; | 309 StringBuilder errorMessage; |
| 310 errorMessage.append("Invalid "); | 310 errorMessage.append("Invalid "); |
| 311 errorMessage.append(attributeType); | 311 errorMessage.append(attributeType); |
| 312 errorMessage.append(" name: '"); | 312 errorMessage.append(" name: '"); |
| 313 errorMessage.append(nameStr); | 313 errorMessage.append(nameStr); |
| 314 errorMessage.append( | 314 errorMessage.append( |
| 315 "'. It must be a valid UUID alias (e.g. 0x1234), " | 315 "'. It must be a valid UUID alias (e.g. 0x1234), " |
| 316 "UUID (lowercase hex characters e.g. " | 316 "UUID (lowercase hex characters e.g. " |
| 317 "'00001234-0000-1000-8000-00805f9b34fb'), " | 317 "'00001234-0000-1000-8000-00805f9b34fb'), " |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 builder.reserveCapacity(36 /* 36 chars or 128 bits, length of a UUID */); | 369 builder.reserveCapacity(36 /* 36 chars or 128 bits, length of a UUID */); |
| 370 HexNumber::appendUnsignedAsHexFixedSize( | 370 HexNumber::appendUnsignedAsHexFixedSize( |
| 371 alias, builder, 8 /* 8 chars or 32 bits, prefix length */, | 371 alias, builder, 8 /* 8 chars or 32 bits, prefix length */, |
| 372 HexNumber::Lowercase); | 372 HexNumber::Lowercase); |
| 373 | 373 |
| 374 builder.append("-0000-1000-8000-00805f9b34fb"); | 374 builder.append("-0000-1000-8000-00805f9b34fb"); |
| 375 return builder.toString(); | 375 return builder.toString(); |
| 376 } | 376 } |
| 377 | 377 |
| 378 } // namespace blink | 378 } // namespace blink |
| OLD | NEW |