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 "config.h" | 5 #include "config.h" |
6 #include "modules/bluetooth/BluetoothDevice.h" | 6 #include "modules/bluetooth/BluetoothDevice.h" |
7 | 7 |
8 #include "wtf/OwnPtr.h" | 8 #include "wtf/OwnPtr.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 12 matching lines...) Expand all Loading... |
23 { | 23 { |
24 OwnPtr<WebBluetoothDevice> webDevice = adoptPtr(webDeviceRawPointer); | 24 OwnPtr<WebBluetoothDevice> webDevice = adoptPtr(webDeviceRawPointer); |
25 return BluetoothDevice::create(*webDevice); | 25 return BluetoothDevice::create(*webDevice); |
26 } | 26 } |
27 | 27 |
28 void BluetoothDevice::dispose(WebBluetoothDevice* webDeviceRaw) | 28 void BluetoothDevice::dispose(WebBluetoothDevice* webDeviceRaw) |
29 { | 29 { |
30 delete webDeviceRaw; | 30 delete webDeviceRaw; |
31 } | 31 } |
32 | 32 |
| 33 unsigned BluetoothDevice::deviceClass(bool& isNull) |
| 34 { |
| 35 isNull = false; |
| 36 return m_webDevice.deviceClass; |
| 37 } |
| 38 |
| 39 String BluetoothDevice::vendorIDSource() |
| 40 { |
| 41 switch (m_webDevice.vendorIDSource) { |
| 42 // FIXME: Should return undefined when Unknown. http://crbug.com/451604 |
| 43 case WebBluetoothDevice::VendorIDSource::Unknown: return ""; |
| 44 case WebBluetoothDevice::VendorIDSource::Bluetooth: return "bluetooth"; |
| 45 case WebBluetoothDevice::VendorIDSource::USB: return "usb"; |
| 46 } |
| 47 ASSERT_NOT_REACHED(); |
| 48 return ""; |
| 49 } |
| 50 |
| 51 unsigned BluetoothDevice::vendorID(bool& isNull) |
| 52 { |
| 53 isNull = false; |
| 54 return m_webDevice.vendorID; |
| 55 } |
| 56 |
| 57 unsigned BluetoothDevice::productID(bool& isNull) |
| 58 { |
| 59 isNull = false; |
| 60 return m_webDevice.productID; |
| 61 } |
| 62 |
| 63 unsigned BluetoothDevice::productVersion(bool& isNull) |
| 64 { |
| 65 isNull = false; |
| 66 return m_webDevice.productVersion; |
| 67 } |
| 68 |
| 69 bool BluetoothDevice::paired(bool& isNull) |
| 70 { |
| 71 isNull = false; |
| 72 return m_webDevice.paired; |
| 73 } |
| 74 |
| 75 bool BluetoothDevice::connected(bool& isNull) |
| 76 { |
| 77 isNull = false; |
| 78 return m_webDevice.connected; |
| 79 } |
| 80 |
| 81 Vector<String> BluetoothDevice::uuids(bool& isNull) |
| 82 { |
| 83 isNull = false; |
| 84 Vector<String> uuids(m_webDevice.uuids.size()); |
| 85 for (size_t i = 0; i < m_webDevice.uuids.size(); ++i) |
| 86 uuids[i] = m_webDevice.uuids[i]; |
| 87 return uuids; |
| 88 } |
| 89 |
33 } // namespace blink | 90 } // namespace blink |
34 | 91 |
OLD | NEW |