From: Przemyslaw Ciezkowski Date: Wed, 23 Sep 2015 14:07:34 +0000 (+0200) Subject: [BLE] Incorrectly used closure X-Git-Tag: accepted/tizen/mobile/20151026.233336^2^2~78 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ddf7de74234241ccca21cd7632a83fad4c4daa8;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [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 --- 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);