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

Unified Diff: chrome/browser/resources/bluetooth_internals/bluetooth_internals.js

Issue 2388533003: bluetooth: Add AdapterInfo in Bluetooth adapter service. (Closed)
Patch Set: More descriptive comments in mojom Created 4 years, 3 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 | « no previous file | device/bluetooth/adapter.h » ('j') | device/bluetooth/adapter.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(); });
});
})();
« no previous file with comments | « no previous file | device/bluetooth/adapter.h » ('j') | device/bluetooth/adapter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698