From a1859dbdcfdfaf242e67fd1687169ead2607323e Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 7 Oct 2015 11:12:36 +0200 Subject: [PATCH] [Bluetooth] Resolved TODOs [Verification] TCT passrate 100%. Change-Id: I83a24ddb2d5b018f8c5b26cd0413b0e28256530a Signed-off-by: Piotr Kosko --- src/bluetooth/bluetooth_adapter.cc | 1 - src/bluetooth/bluetooth_api.js | 32 +++++++++++++-------------- src/bluetooth/bluetooth_le_adapter.cc | 2 +- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/bluetooth/bluetooth_adapter.cc b/src/bluetooth/bluetooth_adapter.cc index de2679fb..e9a3b662 100755 --- a/src/bluetooth/bluetooth_adapter.cc +++ b/src/bluetooth/bluetooth_adapter.cc @@ -300,7 +300,6 @@ void BluetoothAdapter::DiscoveryStateChangedCB( data_obj->insert(std::make_pair(kData, picojson::value(adapter->discovered_devices_))); - //TODO Consider if all events during scanning shouldn't be called asynchronously adapter->user_request_list_[DISCOVER_DEVICES] = false; adapter->instance_.FireEvent(kAdapterDiscoverSuccessEvent, value); } diff --git a/src/bluetooth/bluetooth_api.js b/src/bluetooth/bluetooth_api.js index 4ed275c4..36e8fbec 100755 --- a/src/bluetooth/bluetooth_api.js +++ b/src/bluetooth/bluetooth_api.js @@ -633,7 +633,7 @@ BluetoothLEDevice.prototype.connect = function() { native.callIfPossible(args.successCallback); } }; - + // Errors are handled by error callback native.call('BluetoothLEDevice_connect', {address : this.address}, callback); }; @@ -930,7 +930,7 @@ BluetoothServiceHandler.prototype.unregister = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothServiceHandler_unregister', callArgs, callback); _bluetoothServiceListeners.removeListener(this.uuid); @@ -1025,7 +1025,7 @@ BluetoothHealthApplication.prototype.unregister = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothHealthApplication_unregister', callArgs, callback); _bluetoothHealthApplicationListeners.removeListener(this._id); @@ -1092,7 +1092,7 @@ BluetoothHealthProfileHandler.prototype.registerSinkApplication = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothHealthProfileHandler_registerSinkApp', callArgs, callback); }; @@ -1140,7 +1140,7 @@ BluetoothHealthProfileHandler.prototype.connectToSource = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothHealthProfileHandler_connectToSource', callArgs, callback); }; @@ -1477,12 +1477,10 @@ BluetoothLEAdapter.prototype.stopAdvertise = function() { xwalk.utils.checkPrivilegeAccess4Ver("2.4", Privilege.BLUETOOTH, Privilege.BLUETOOTH_ADMIN); - // TODO: when should we call _bleAdvertiseListener.removeListener()? - + _bleAdvertiseListener.removeListener(); var result = native.callSync('BluetoothLEAdapter_stopAdvertise', {}); if (native.isFailure(result)) { - _bleAdvertiseListener.removeListener(); throw native.getErrorObject(result); } }; @@ -2031,7 +2029,7 @@ BluetoothAdapter.prototype.setName = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothAdapter_setName', callArgs, callback); }; @@ -2071,7 +2069,7 @@ BluetoothAdapter.prototype.setPowered = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothAdapter_setPowered', callArgs, callback); }; @@ -2127,7 +2125,7 @@ BluetoothAdapter.prototype.setVisible = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothAdapter_setVisible', callArgs, callback); }; @@ -2300,7 +2298,7 @@ BluetoothAdapter.prototype.stopDiscovery = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothAdapter_stopDiscovery', {}, callback); }; @@ -2335,7 +2333,7 @@ BluetoothAdapter.prototype.getKnownDevices = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothAdapter_getKnownDevices', {}, callback); }; @@ -2369,7 +2367,7 @@ BluetoothAdapter.prototype.getDevice = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothAdapter_getDevice', {address : args.address}, callback); }; @@ -2409,7 +2407,7 @@ BluetoothAdapter.prototype.createBonding = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothAdapter_createBonding', callArgs, callback); }; @@ -2449,7 +2447,7 @@ BluetoothAdapter.prototype.destroyBonding = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothAdapter_destroyBonding', callArgs, callback); }; @@ -2494,7 +2492,7 @@ BluetoothAdapter.prototype.registerRFCOMMServiceByUUID = function() { }; // native.call does not inform if call results in failure - // TODO: what to do in this case? + // Errors are handled by error callback native.call('BluetoothAdapter_registerRFCOMMServiceByUUID', callArgs, callback); }; diff --git a/src/bluetooth/bluetooth_le_adapter.cc b/src/bluetooth/bluetooth_le_adapter.cc index 2ee99ac5..f2c232d1 100755 --- a/src/bluetooth/bluetooth_le_adapter.cc +++ b/src/bluetooth/bluetooth_le_adapter.cc @@ -704,7 +704,7 @@ void BluetoothLEAdapter::OnScanResult( ReportError(util::GetBluetoothError(result, "Error during scanning"), data_obj); data_obj->insert(std::make_pair(kAction, picojson::value(kOnScanError))); } else { - // TODO: this is probably capi-network-bluetooth error: when scan is stopped info has 0x1 value + // this is probably capi-network-bluetooth error: when scan is stopped info has 0x1 value if (nullptr != info && reinterpret_cast(0x1) != info) { // device found LoggerD("Device found"); -- 2.34.1