[Bluetooth] Added getServiceAllUuids() call from JS.
authorTomasz Marciniak <t.marciniak@samsung.com>
Mon, 8 Feb 2016 14:30:28 +0000 (15:30 +0100)
committerTomasz Marciniak <t.marciniak@samsung.com>
Thu, 3 Mar 2016 07:52:31 +0000 (08:52 +0100)
[Verification] Code compiles. Unable to test.

Change-Id: I5eae738d4446047e749a60836594b4b90dc6444e
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
src/bluetooth/bluetooth_api.js
src/bluetooth/bluetooth_gatt_service.cc
src/bluetooth/bluetooth_gatt_service.h
src/bluetooth/bluetooth_instance.cc
src/bluetooth/bluetooth_le_device.cc
src/bluetooth/bluetooth_le_device.h

index 5628a8b..d1eaee4 100755 (executable)
@@ -691,6 +691,22 @@ BluetoothLEDevice.prototype.getService = function() {
     }
 };
 
+BluetoothLEDevice.prototype.getServiceAllUuids = function() {
+  console.log('Entered BluetoothLEDevice.getServiceAllUuids()');
+
+  var callArgs = {
+    address : this.address
+  };
+
+  var result = native.callSync('BluetoothLEDevice_getServiceAllUuids', callArgs);
+  if (native.isFailure(result)) {
+    throw native.getErrorObject(result);
+  } else {
+    var uuids = native.getResultObject(result);
+    return uuids;
+  }
+};
+
 BluetoothLEDevice.prototype.addConnectStateChangeListener = function() {
     console.log('Entered BluetoothLEDevice.addConnectStateChangeListener()');
     var args = AV.validateMethod(arguments, [
index 421d5aa..fce5b56 100755 (executable)
@@ -535,7 +535,7 @@ void BluetoothGATTService::RemoveValueChangeListener(
   }
 }
 
-common::PlatformResult BluetoothGATTService::GetServiceUuids(
+common::PlatformResult BluetoothGATTService::GetServiceAllUuids(
     const std::string& address, picojson::array* array) {
   LoggerD("Entered");
 
index 7fc8f2d..e6936a6 100755 (executable)
@@ -48,8 +48,8 @@ class BluetoothGATTService {
   void RemoveValueChangeListener(const picojson::value& args,
                                  picojson::object& out);
 
-  common::PlatformResult GetServiceUuids(const std::string& address,
-                                         picojson::array* array);
+  common::PlatformResult GetServiceAllUuids(const std::string& address,
+                                            picojson::array* array);
 
  private:
   bool IsStillConnected(const std::string& address);
index a0c5de9..16a2f5a 100755 (executable)
@@ -143,8 +143,8 @@ BluetoothInstance::BluetoothInstance() :
       std::bind(&BluetoothLEDevice::RemoveConnectStateChangeListener,
                 &bluetooth_le_device_, _1, _2));
   REGISTER_SYNC(
-        "BluetoothLEDevice_getServiceUuids",
-        std::bind(&BluetoothLEDevice::GetServiceUuids,
+        "BluetoothLEDevice_getServiceAllUuids",
+        std::bind(&BluetoothLEDevice::GetServiceAllUuids,
                   &bluetooth_le_device_, _1, _2));
 
   // BluetoothGATTService
index 2403750..78047a0 100755 (executable)
@@ -439,7 +439,7 @@ void BluetoothLEDevice::RemoveConnectStateChangeListener(
   ReportSuccess(out);
 }
 
-void BluetoothLEDevice::GetServiceUuids(const picojson::value& data,
+void BluetoothLEDevice::GetServiceAllUuids(const picojson::value& data,
                                         picojson::object& out) {
   LoggerD("Entered");
 
@@ -449,7 +449,7 @@ void BluetoothLEDevice::GetServiceUuids(const picojson::value& data,
   picojson::value response = picojson::value(picojson::array());
   picojson::array *data_obj = &response.get<picojson::array>();
 
-  PlatformResult result = service_.GetServiceUuids(address, data_obj);
+  PlatformResult result = service_.GetServiceAllUuids(address, data_obj);
 
   if (result) {
     ReportSuccess(response, out);
index f95cab0..ed122f1 100755 (executable)
@@ -47,7 +47,7 @@ class BluetoothLEDevice {
   void RemoveConnectStateChangeListener(const picojson::value& data,
                                         picojson::object& out);
 
-  void GetServiceUuids(const picojson::value& data, picojson::object& out);
+  void GetServiceAllUuids(const picojson::value& data, picojson::object& out);
 
   static common::PlatformResult ToJson(
       bt_adapter_le_device_scan_result_info_s* info,