[Bluetooth] Changed uuids getter.
authorTomasz Marciniak <t.marciniak@samsung.com>
Mon, 9 Feb 2015 10:26:12 +0000 (11:26 +0100)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 9 Feb 2015 15:11:22 +0000 (00:11 +0900)
[Feature] To avoid changing uuids array values
getter returns array copy now.

[Verification] Code compiles without errors.

Change-Id: I6bf7747b8bf26c56698b2bb04d9f8ee7664deb58
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
src/bluetooth/bluetooth_api.js

index 5812834c4cf927eaf8a976c6344e2d49dd57e5cd..89574eafb357fcb090ec3fce6fc2eafb7ec06eaf 100644 (file)
@@ -317,6 +317,11 @@ var BluetoothDevice = function(data) {
         return _getter('isConnected');
     }
 
+    var uuids = [];
+    if (data) {
+        uuids = data.uuids;
+    }
+
     Object.defineProperties(this, {
         name : {value: data.name, writable: false, enumerable: true},
         address : {value: data.address, writable: false, enumerable: true},
@@ -338,7 +343,11 @@ var BluetoothDevice = function(data) {
             set : function(){},
             get : isConnectedGetter
         },
-        uuids : {value: data.uuids, writable: false, enumerable: true}
+        uuids : {
+            enumerable: true,
+            set : function(){},
+            get : function(){ return uuids.slice(); }
+        }
     });
 };