From: Tomasz Marciniak Date: Mon, 8 Feb 2016 14:30:28 +0000 (+0100) Subject: [Bluetooth] Added getServiceAllUuids() call from JS. X-Git-Tag: submit/tizen/20160308.045434^2~10^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27f045d5ddaa369c009ef9eec3424e126e3d4b86;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Bluetooth] Added getServiceAllUuids() call from JS. [Verification] Code compiles. Unable to test. Change-Id: I5eae738d4446047e749a60836594b4b90dc6444e Signed-off-by: Tomasz Marciniak --- diff --git a/src/bluetooth/bluetooth_api.js b/src/bluetooth/bluetooth_api.js index 5628a8bb..d1eaee4a 100755 --- a/src/bluetooth/bluetooth_api.js +++ b/src/bluetooth/bluetooth_api.js @@ -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, [ diff --git a/src/bluetooth/bluetooth_gatt_service.cc b/src/bluetooth/bluetooth_gatt_service.cc index 421d5aa0..fce5b566 100755 --- a/src/bluetooth/bluetooth_gatt_service.cc +++ b/src/bluetooth/bluetooth_gatt_service.cc @@ -535,7 +535,7 @@ void BluetoothGATTService::RemoveValueChangeListener( } } -common::PlatformResult BluetoothGATTService::GetServiceUuids( +common::PlatformResult BluetoothGATTService::GetServiceAllUuids( const std::string& address, picojson::array* array) { LoggerD("Entered"); diff --git a/src/bluetooth/bluetooth_gatt_service.h b/src/bluetooth/bluetooth_gatt_service.h index 7fc8f2d2..e6936a61 100755 --- a/src/bluetooth/bluetooth_gatt_service.h +++ b/src/bluetooth/bluetooth_gatt_service.h @@ -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); diff --git a/src/bluetooth/bluetooth_instance.cc b/src/bluetooth/bluetooth_instance.cc index a0c5de92..16a2f5aa 100755 --- a/src/bluetooth/bluetooth_instance.cc +++ b/src/bluetooth/bluetooth_instance.cc @@ -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 diff --git a/src/bluetooth/bluetooth_le_device.cc b/src/bluetooth/bluetooth_le_device.cc index 24037505..78047a08 100755 --- a/src/bluetooth/bluetooth_le_device.cc +++ b/src/bluetooth/bluetooth_le_device.cc @@ -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(); - PlatformResult result = service_.GetServiceUuids(address, data_obj); + PlatformResult result = service_.GetServiceAllUuids(address, data_obj); if (result) { ReportSuccess(response, out); diff --git a/src/bluetooth/bluetooth_le_device.h b/src/bluetooth/bluetooth_le_device.h index f95cab04..ed122f14 100755 --- a/src/bluetooth/bluetooth_le_device.h +++ b/src/bluetooth/bluetooth_le_device.h @@ -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,