Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: Source/modules/bluetooth/BluetoothDevice.cpp

Issue 876623003: bluetooth: New WebBluetoothDevice attributes plumbed to BluetoothDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@bt-1-
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/bluetooth/BluetoothDevice.h ('k') | Source/modules/bluetooth/BluetoothDevice.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/bluetooth/BluetoothDevice.cpp
diff --git a/Source/modules/bluetooth/BluetoothDevice.cpp b/Source/modules/bluetooth/BluetoothDevice.cpp
index e679e5ada2e848a22d3bd7b342a9395bfa1fb1be..5023c56990d6345ecb10648215f07ffd61911b10 100644
--- a/Source/modules/bluetooth/BluetoothDevice.cpp
+++ b/Source/modules/bluetooth/BluetoothDevice.cpp
@@ -30,5 +30,62 @@ void BluetoothDevice::dispose(WebBluetoothDevice* webDeviceRaw)
delete webDeviceRaw;
}
+unsigned BluetoothDevice::deviceClass(bool& isNull)
+{
+ isNull = false;
+ return m_webDevice.deviceClass;
+}
+
+String BluetoothDevice::vendorIDSource()
+{
+ switch (m_webDevice.vendorIDSource) {
+ // FIXME: Should return undefined when Unknown. http://crbug.com/451604
+ case WebBluetoothDevice::VendorIDSource::Unknown: return "";
+ case WebBluetoothDevice::VendorIDSource::Bluetooth: return "bluetooth";
+ case WebBluetoothDevice::VendorIDSource::USB: return "usb";
+ }
+ ASSERT_NOT_REACHED();
+ return "";
+}
+
+unsigned BluetoothDevice::vendorID(bool& isNull)
+{
+ isNull = false;
+ return m_webDevice.vendorID;
+}
+
+unsigned BluetoothDevice::productID(bool& isNull)
+{
+ isNull = false;
+ return m_webDevice.productID;
+}
+
+unsigned BluetoothDevice::productVersion(bool& isNull)
+{
+ isNull = false;
+ return m_webDevice.productVersion;
+}
+
+bool BluetoothDevice::paired(bool& isNull)
+{
+ isNull = false;
+ return m_webDevice.paired;
+}
+
+bool BluetoothDevice::connected(bool& isNull)
+{
+ isNull = false;
+ return m_webDevice.connected;
+}
+
+Vector<String> BluetoothDevice::uuids(bool& isNull)
+{
+ isNull = false;
+ Vector<String> uuids(m_webDevice.uuids.size());
+ for (size_t i = 0; i < m_webDevice.uuids.size(); ++i)
+ uuids[i] = m_webDevice.uuids[i];
+ return uuids;
+}
+
} // namespace blink
« no previous file with comments | « Source/modules/bluetooth/BluetoothDevice.h ('k') | Source/modules/bluetooth/BluetoothDevice.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698