Index: chrome/browser/resources/bluetooth_internals/bluetooth_internals.js |
diff --git a/chrome/browser/resources/bluetooth_internals/bluetooth_internals.js b/chrome/browser/resources/bluetooth_internals/bluetooth_internals.js |
index 68efb06a83edcdabab79e611aacd535d7ff84a85..855bbce3c5f437517f8ab2aa874d1ecc42d09da2 100644 |
--- a/chrome/browser/resources/bluetooth_internals/bluetooth_internals.js |
+++ b/chrome/browser/resources/bluetooth_internals/bluetooth_internals.js |
@@ -38,6 +38,33 @@ AdapterClient.prototype = { |
var adapterClientHandle = null; |
/** |
+ * Logs basic information retrieved from the adapter. |
+ */ |
+ function logAdapterInfo() { |
+ console.log('Getting adapter info'); |
+ |
+ adapter.getAddress().then(function(response) { |
scheib
2016/10/01 00:26:49
Perhaps we should have an AdapterInfo struct and f
mbrunson
2016/10/03 17:40:10
I agree.
|
+ console.log('Address: ' + response.address); |
+ }); |
+ |
+ adapter.getName().then(function(response) { |
+ console.log('Name: ' + response.name); |
+ }); |
+ |
+ adapter.isPowered().then(function(response) { |
+ console.log('Is Powered: ' + response.powered); |
+ }); |
+ |
+ adapter.isPresent().then(function(response) { |
+ console.log('Is Present: ' + response.present); |
+ }); |
+ |
+ adapter.getDevices().then(function(response) { |
+ console.log('Device Count: ' + response.devices.length); |
+ }); |
+ } |
+ |
+ /** |
* Helper to convert callback-based define() API to a promise-based API. |
* @param {!Array<string>} moduleNames |
* @return {!Promise} |
@@ -67,12 +94,12 @@ AdapterClient.prototype = { |
console.log('Loaded modules'); |
- // Hook up the instance properties |
+ // Hook up the instance properties. |
AdapterClient.prototype.__proto__ = |
bluetoothAdapter.AdapterClient.stubClass.prototype; |
// Create a message pipe and bind one end to client |
- // implementation |
+ // implementation. |
adapterClient = new AdapterClient(); |
adapterClientHandle = connection.bindStubDerivedImpl(adapterClient); |
@@ -85,8 +112,6 @@ AdapterClient.prototype = { |
} |
document.addEventListener('DOMContentLoaded', function() { |
- initializeProxies() |
- .then(function() { return adapter.getDevices();}) |
- .then(function(response) {console.log(response.devices);}); |
+ initializeProxies().then(function() { logAdapterInfo(); }); |
}); |
})(); |