Index: chrome/browser/resources/bluetooth_internals/characteristic_list.js |
diff --git a/chrome/browser/resources/bluetooth_internals/characteristic_list.js b/chrome/browser/resources/bluetooth_internals/characteristic_list.js |
index faa7f9d013b346557a03080c93f8d20791a70f47..da7818d5f619049afaba879ad3fa5944f34ebb85 100644 |
--- a/chrome/browser/resources/bluetooth_internals/characteristic_list.js |
+++ b/chrome/browser/resources/bluetooth_internals/characteristic_list.js |
@@ -45,12 +45,17 @@ cr.define('characteristic_list', function() { |
* CharacteristicInfo object. |
* @constructor |
* @param {!interfaces.BluetoothDevice.CharacteristicInfo} characteristicInfo |
+ * @param {string} deviceAddress |
+ * @param {string} serviceId |
*/ |
- function CharacteristicListItem(characteristicInfo) { |
+ function CharacteristicListItem( |
+ characteristicInfo, deviceAddress, serviceId) { |
var listItem = new ExpandableListItem(); |
listItem.__proto__ = CharacteristicListItem.prototype; |
listItem.info = characteristicInfo; |
+ listItem.deviceAddress_ = deviceAddress; |
+ listItem.serviceId_ = serviceId; |
listItem.decorate(); |
return listItem; |
@@ -103,6 +108,11 @@ cr.define('characteristic_list', function() { |
Property.WRITE_ENCRYPTED_AUTHENTICATED) > 0, |
}); |
+ /** @private {!value_control.ValueControl} */ |
+ this.valueControl_ = new value_control.ValueControl(); |
+ this.valueControl_.load(this.deviceAddress_, this.serviceId_, this.info); |
+ this.valueControl_.setValue(this.info.last_known_value); |
+ |
// Create content for display in brief content container. |
var characteristicHeaderText = document.createElement('div'); |
characteristicHeaderText.textContent = 'Characteristic:'; |
@@ -132,11 +142,16 @@ cr.define('characteristic_list', function() { |
var infoDiv = document.createElement('div'); |
infoDiv.classList.add('info-container'); |
+ |
+ var valueHeader = document.createElement('h4'); |
+ valueHeader.textContent = 'Value'; |
+ |
infoDiv.appendChild(characteristicInfoHeader); |
infoDiv.appendChild(characteristicDiv); |
infoDiv.appendChild(propertiesHeader); |
infoDiv.appendChild(propertiesDiv); |
- |
+ infoDiv.appendChild(valueHeader); |
+ infoDiv.appendChild(this.valueControl_); |
this.expandedContent_.appendChild(infoDiv); |
}, |
}; |
@@ -163,7 +178,8 @@ cr.define('characteristic_list', function() { |
/** @override */ |
createItem: function(data) { |
- return new CharacteristicListItem(data); |
+ return new CharacteristicListItem( |
+ data, this.deviceAddress_, this.serviceId_); |
}, |
/** |
@@ -177,6 +193,8 @@ cr.define('characteristic_list', function() { |
if (this.characteristicsRequested_ || !this.isLoading()) |
return; |
+ this.deviceAddress_ = deviceAddress; |
+ this.serviceId_ = serviceId; |
this.characteristicsRequested_ = true; |
device_broker.connectToDevice(deviceAddress).then(function(device) { |
@@ -189,9 +207,7 @@ cr.define('characteristic_list', function() { |
this.characteristicsRequested_ = false; |
Snackbar.show( |
deviceAddress + ': ' + error.message, SnackbarType.ERROR, 'Retry', |
- function() { |
- this.load(deviceAddress, serviceId); |
- }.bind(this)); |
+ function() { this.load(deviceAddress, serviceId); }.bind(this)); |
}.bind(this)); |
}, |
}; |
@@ -200,4 +216,4 @@ cr.define('characteristic_list', function() { |
CharacteristicList: CharacteristicList, |
CharacteristicListItem: CharacteristicListItem, |
}; |
-}); |
+}); |