From 3ddf7de74234241ccca21cd7632a83fad4c4daa8 Mon Sep 17 00:00:00 2001 From: Przemyslaw Ciezkowski Date: Wed, 23 Sep 2015 16:07:34 +0200 Subject: [PATCH] [BLE] Incorrectly used closure closures can't be used with prototype. All instances of BluetoothGATTCharacteristic had the same _handle variable (last created). Change-Id: Ia89987637733596345a7bdbc3d2e99c092986fd1 Signed-off-by: Przemyslaw Ciezkowski --- src/bluetooth/bluetooth_api.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bluetooth/bluetooth_api.js b/src/bluetooth/bluetooth_api.js index 710c771..997ebb3 100755 --- a/src/bluetooth/bluetooth_api.js +++ b/src/bluetooth/bluetooth_api.js @@ -1637,7 +1637,7 @@ var BluetoothGATTCharacteristic = function(data, address) { } }); - BluetoothGATTCharacteristic.prototype.readValue = function() { + this.readValue = function() { console.log('Entered BluetoothGATTCharacteristic.readValue()'); xwalk.utils.checkPrivilegeAccess4Ver("2.4", Privilege.BLUETOOTH, Privilege.BLUETOOTH_ADMIN); @@ -1670,7 +1670,7 @@ var BluetoothGATTCharacteristic = function(data, address) { } }; - BluetoothGATTCharacteristic.prototype.writeValue = function() { + this.writeValue = function() { console.log('Entered BluetoothGATTCharacteristic.writeValue()'); xwalk.utils.checkPrivilegeAccess4Ver("2.4", Privilege.BLUETOOTH, Privilege.BLUETOOTH_ADMIN); @@ -1708,7 +1708,7 @@ var BluetoothGATTCharacteristic = function(data, address) { } }; - BluetoothGATTCharacteristic.prototype.addValueChangeListener = function() { + this.addValueChangeListener = function() { console.log('Entered BluetoothGATTCharacteristic.addValueChangeListener()'); xwalk.utils.checkPrivilegeAccess4Ver("2.4", Privilege.BLUETOOTH, Privilege.BLUETOOTH_ADMIN); @@ -1729,7 +1729,7 @@ var BluetoothGATTCharacteristic = function(data, address) { return _bluetoothGATTCharacteristicListener.addListener(callback, callArgs); }; - BluetoothGATTCharacteristic.prototype.removeValueChangeListener = function() { + this.removeValueChangeListener = function() { console.log('Entered BluetoothGATTCharacteristic.removeValueChangeListener()'); var args = AV.validateMethod(arguments, [{ @@ -1855,7 +1855,7 @@ var BluetoothGATTDescriptor = function(data, address) { //address_ is needed to control if device is still connected var address_ = address; - BluetoothGATTDescriptor.prototype.readValue = function() { + this.readValue = function() { console.log('Entered BluetoothGATTDescriptor.readValue()'); xwalk.utils.checkPrivilegeAccess4Ver("2.4", Privilege.BLUETOOTH, Privilege.BLUETOOTH_ADMIN); @@ -1888,7 +1888,7 @@ var BluetoothGATTDescriptor = function(data, address) { } }; - BluetoothGATTDescriptor.prototype.writeValue = function() { + this.writeValue = function() { console.log('Entered BluetoothGATTDescriptor.writeValue()'); xwalk.utils.checkPrivilegeAccess4Ver("2.4", Privilege.BLUETOOTH, Privilege.BLUETOOTH_ADMIN); -- 2.7.4