From 1e42358cb65a982891a0148269e904dabe4ca3ea Mon Sep 17 00:00:00 2001 From: Arkadiusz Pietraszek Date: Mon, 14 Jan 2019 12:56:41 +0100 Subject: [PATCH] [Bluetooth] Marking classes as deprecated. BluetoothHealthProfileHandler and BluetoothHealthChannel will be deprecated since tizen 5.5 [Verification] TCT Pass rate: 100% ACR: TWDAPI-196 Change-Id: I965e910a8d5fb71a5c98bdb62a3a757eb98777e0 Signed-off-by: Arkadiusz Pietraszek --- src/bluetooth/bluetooth_api.js | 28 +++++++++++++++------ src/bluetooth/bluetooth_health_application.cc | 3 +++ src/bluetooth/bluetooth_health_application.h | 5 ++++ src/bluetooth/bluetooth_health_channel.cc | 4 +++ src/bluetooth/bluetooth_health_channel.h | 11 +++++++++ src/bluetooth/bluetooth_health_profile_handler.cc | 8 ++++++ src/bluetooth/bluetooth_health_profile_handler.h | 30 +++++++++++++++++++++-- 7 files changed, 80 insertions(+), 9 deletions(-) diff --git a/src/bluetooth/bluetooth_api.js b/src/bluetooth/bluetooth_api.js index 9fb4266..4f2b978 100755 --- a/src/bluetooth/bluetooth_api.js +++ b/src/bluetooth/bluetooth_api.js @@ -1011,6 +1011,7 @@ var BluetoothHealthApplication = function(data) { BluetoothHealthApplication.prototype.unregister = function() { privUtils_.log('Entered BluetoothHealthApplication.unregister()'); + privUtils_.printDeprecationWarningFor('BluetoothHealthApplication'); var args = AV.validateMethod(arguments, [ { name : 'successCallback', @@ -1050,9 +1051,14 @@ var _BluetoothProfileType = { }; var BluetoothProfileHandler = function(data) { + var profileType = data.profileType; + function profileTypeGetter() { + privUtils_.printDeprecationWarningFor('profileType'); + return profileType; + } if (data) { Object.defineProperties(this, { - profileType : {value: data.profileType, writable: false, enumerable: true} + profileType : {enumerable: true, set : function() {}, get : profileTypeGetter } }); } }; @@ -1068,6 +1074,7 @@ BluetoothHealthProfileHandler.prototype.constructor = BluetoothProfileHandler; BluetoothHealthProfileHandler.prototype.registerSinkApplication = function() { privUtils_.log('Entered BluetoothHealthProfileHandler.registerSinkApplication()'); + privUtils_.printDeprecationWarningFor('BluetoothHealthProfileHandler'); var args = AV.validateMethod(arguments, [ { @@ -1111,6 +1118,7 @@ BluetoothHealthProfileHandler.prototype.registerSinkApplication = function() { BluetoothHealthProfileHandler.prototype.connectToSource = function() { privUtils_.log('Entered BluetoothHealthProfileHandler.connectToSource()'); + privUtils_.printDeprecationWarningFor('BluetoothHealthProfileHandler'); var args = AV.validateMethod(arguments, [ { @@ -1178,6 +1186,7 @@ var BluetoothHealthChannel = function(data) { BluetoothHealthChannel.prototype.close = function() { privUtils_.log('Entered BluetoothHealthChannel.close()'); + privUtils_.printDeprecationWarningFor('BluetoothHealthChannel'); if (this.isConnected) { var callArgs = { @@ -1197,6 +1206,8 @@ BluetoothHealthChannel.prototype.close = function() { BluetoothHealthChannel.prototype.sendData = function() { privUtils_.log('Entered BluetoothHealthChannel.sendData()'); + privUtils_.printDeprecationWarningFor('BluetoothHealthChannel'); + var args = AV.validateMethod(arguments, [ { name : 'data', @@ -1246,6 +1257,7 @@ function _BluetoothHealthChannelChangeCallback(event) { var BluetoothHealthChannel_setListener = function() { privUtils_.log('Entered BluetoothHealthChannel.setListener()'); + privUtils_.printDeprecationWarningFor('BluetoothHealthChannel'); privUtils_.checkPrivilegeAccess4Ver("2.4", Privilege.BLUETOOTH, Privilege.BLUETOOTH_HEALTH); var args = AV.validateMethod(arguments, [ { @@ -1269,6 +1281,7 @@ BluetoothHealthChannel.prototype.setListener = function() { var BluetoothHealthChannel_unsetListener = function() { privUtils_.log('Entered BluetoothHealthChannel.unsetListener ()'); + privUtils_.printDeprecationWarningFor('BluetoothHealthChannel'); if (T.isEmptyObject(_healthListeners)) { privUtils_.checkPrivilegeAccess4Ver("2.4", Privilege.BLUETOOTH, Privilege.BLUETOOTH_HEALTH); } @@ -1282,6 +1295,7 @@ var BluetoothHealthChannel_unsetListener = function() { }; BluetoothHealthChannel.prototype.unsetListener = function() { + privUtils_.printDeprecationWarningFor('BluetoothHealthChannel'); BluetoothHealthChannel_unsetListener.apply(this, arguments); }; @@ -2034,8 +2048,8 @@ BluetoothAdapter.prototype.setName = function() { BluetoothAdapter.prototype.setPowered = function() { privUtils_.log('Entered BluetoothAdapter.setPowered()'); - privUtils_.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. ' - + 'Let the user turn on/off Bluetooth through the Settings application instead.'); + privUtils_.printDeprecationWarningFor('setPowered()'); + privUtils_.warn('Let the user turn on/off Bluetooth through the Settings application instead.'); var args = AV.validateMethod(arguments, [ { @@ -2075,11 +2089,11 @@ BluetoothAdapter.prototype.setPowered = function() { }; -// This method is deprecated since Tizen 2.3 and will be removed in Tizen 3.0. +// This method is deprecated since Tizen 2.3. BluetoothAdapter.prototype.setVisible = function() { privUtils_.log('Entered BluetoothAdapter.setVisible()'); - privUtils_.warn('DEPRECATION WARNING: setVisible() is deprecated and will be removed from next release. ' - + 'Let the user change the Bluetooth visibility through the Settings application instead.'); + privUtils_.printDeprecationWarningFor('setVisible()'); + privUtils_.warn('Let the user change the Bluetooth visibility through the Settings application instead.'); var args = AV.validateMethod(arguments, [ { @@ -2493,7 +2507,7 @@ BluetoothAdapter.prototype.registerRFCOMMServiceByUUID = function() { BluetoothAdapter.prototype.getBluetoothProfileHandler = function() { privUtils_.log('Entered BluetoothAdapter.getBluetoothProfileHandler()'); - + privUtils_.printDeprecationWarningFor('getBluetoothProfileHandler'); var args = AV.validateMethod(arguments, [ { name : 'profileType', diff --git a/src/bluetooth/bluetooth_health_application.cc b/src/bluetooth/bluetooth_health_application.cc index 7b58724..1226ab7 100644 --- a/src/bluetooth/bluetooth_health_application.cc +++ b/src/bluetooth/bluetooth_health_application.cc @@ -39,10 +39,12 @@ using namespace common; BluetoothHealthApplication::BluetoothHealthApplication(BluetoothHealthProfileHandler& handler) : handler_(handler) { ScopeLogger(); + tools::PrintDeprecationWarningFor("BluetoothHealthApplication"); } void BluetoothHealthApplication::Unregister(const picojson::value& data, picojson::object& out) { ScopeLogger(); + tools::PrintDeprecationWarningFor("BluetoothHealthApplication"); CHECK_BACKWARD_COMPABILITY_PRIVILEGE_ACCESS(Privilege::kBluetooth, Privilege::kBluetoothHealth, &out); @@ -58,6 +60,7 @@ void BluetoothHealthApplication::Unregister(const picojson::value& data, picojso void BluetoothHealthApplication::ToJson(short data_type, const std::string& name, const char* id, picojson::object* out) { ScopeLogger(); + tools::PrintDeprecationWarningFor("BluetoothHealthApplication"); out->insert(std::make_pair(kDataType, picojson::value(static_cast(data_type)))); out->insert(std::make_pair(kName, picojson::value(name))); out->insert(std::make_pair(kId, picojson::value(id))); diff --git a/src/bluetooth/bluetooth_health_application.h b/src/bluetooth/bluetooth_health_application.h index a0027f8..1305cff 100644 --- a/src/bluetooth/bluetooth_health_application.h +++ b/src/bluetooth/bluetooth_health_application.h @@ -30,6 +30,7 @@ class BluetoothHealthApplication { /** * Signature: @code void unregister(successCallback, errorCallback); @endcode + * Deprecated since tizen version 5.5 * JSON: @code data: {method: 'BluetoothHealthApplication_unregister', args: {}} @endcode * Invocation: @code native.call(request, result_callback); @endcode * Return: @@ -45,6 +46,10 @@ class BluetoothHealthApplication { */ void Unregister(const picojson::value& data, picojson::object& out); + /** + * Signature: @code static void ToJson(short, const std::string&, const char*, picojson::object*); @endcode + * Deprecated since tizen version 5.5 + */ static void ToJson(short data_type, const std::string& name, const char* id, picojson::object* out); diff --git a/src/bluetooth/bluetooth_health_channel.cc b/src/bluetooth/bluetooth_health_channel.cc index 90d805d..9a7cbdd 100644 --- a/src/bluetooth/bluetooth_health_channel.cc +++ b/src/bluetooth/bluetooth_health_channel.cc @@ -43,6 +43,7 @@ const std::string kId = "_id"; void BluetoothHealthChannel::Close(const picojson::value& data, picojson::object& out) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthChannel"); CHECK_BACKWARD_COMPABILITY_PRIVILEGE_ACCESS(Privilege::kBluetooth, Privilege::kBluetoothHealth, &out); @@ -64,6 +65,7 @@ void BluetoothHealthChannel::Close(const picojson::value& data, picojson::object void BluetoothHealthChannel::SendData(const picojson::value& data, picojson::object& out) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthChannel"); CHECK_BACKWARD_COMPABILITY_PRIVILEGE_ACCESS(Privilege::kBluetooth, Privilege::kBluetoothHealth, &out); @@ -93,6 +95,7 @@ void BluetoothHealthChannel::SendData(const picojson::value& data, picojson::obj void BluetoothHealthChannel::ToJson(unsigned int channel, bt_hdp_channel_type_e type, picojson::object* out) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthChannel"); const char* type_str = "UNKNOWN"; switch (type) { @@ -118,6 +121,7 @@ void BluetoothHealthChannel::ToJson(unsigned int channel, bt_hdp_channel_type_e bt_device_info_s* device_info, const char* app_id, picojson::object* out) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthChannel"); ToJson(channel, type, out); auto& device = out->insert(std::make_pair(kPeer, picojson::value(picojson::object()))) .first->second.get(); diff --git a/src/bluetooth/bluetooth_health_channel.h b/src/bluetooth/bluetooth_health_channel.h index 80c13c3..3a4611f 100644 --- a/src/bluetooth/bluetooth_health_channel.h +++ b/src/bluetooth/bluetooth_health_channel.h @@ -28,6 +28,7 @@ class BluetoothHealthChannel { public: /** * Signature: @code void close(); @endcode + * Deprecated since tizen version 5.5 * JSON: @code data: {method: 'BluetoothHealthChannel_close', args: {}} @endcode * Invocation: @code native.callSync(request); @endcode * Return: @@ -40,6 +41,7 @@ class BluetoothHealthChannel { /** * Signature: @code unsigned long sendData(data[]); @endcode + * Deprecated since tizen version 5.5 * JSON: @code data: {method: 'BluetoothHealthChannel_sendData', args: {data: data}} @endcode * Invocation: @code native.callSync(request); @endcode * Return: @@ -49,8 +51,17 @@ class BluetoothHealthChannel { */ void SendData(const picojson::value& data, picojson::object& out); + /** + * Signature: @code void ToJson(unsigned int, bt_hdp_channel_type_e, picojson::object*); @endcode + * Deprecated since tizen version 5.5 + */ static void ToJson(unsigned int channel, bt_hdp_channel_type_e type, picojson::object* out); + /** + * Signature: @code void ToJson(unsigned int, bt_hdp_channel_type_e, bt_device_info_s*, + * const char*, picojson::object*); @endcode + * Deprecated since tizen version 5.5 + */ static void ToJson(unsigned int channel, bt_hdp_channel_type_e type, bt_device_info_s* device_info, const char* app_id, picojson::object* out); }; diff --git a/src/bluetooth/bluetooth_health_profile_handler.cc b/src/bluetooth/bluetooth_health_profile_handler.cc index 287015e..1b4b9c3 100644 --- a/src/bluetooth/bluetooth_health_profile_handler.cc +++ b/src/bluetooth/bluetooth_health_profile_handler.cc @@ -49,6 +49,7 @@ BluetoothHealthProfileHandler::BluetoothHealthProfileHandler(BluetoothInstance& : instance_(instance) { // initialize listeners ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthProfileHandler"); if (BT_ERROR_NONE != bt_hdp_set_connection_state_changed_cb(OnConnected, OnDisconnected, this)) { LoggerE("bt_hdp_set_connection_state_changed_cb() failed"); } @@ -60,6 +61,7 @@ BluetoothHealthProfileHandler::BluetoothHealthProfileHandler(BluetoothInstance& BluetoothHealthProfileHandler::~BluetoothHealthProfileHandler() { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthProfileHandler"); bt_hdp_unset_connection_state_changed_cb(); bt_hdp_unset_data_received_cb(); @@ -72,6 +74,7 @@ void BluetoothHealthProfileHandler::OnConnected(int result, const char* remote_a const char* app_id, bt_hdp_channel_type_e type, unsigned int channel, void* user_data) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthProfileHandler"); BluetoothHealthProfileHandler* object = static_cast(user_data); @@ -163,6 +166,7 @@ void BluetoothHealthProfileHandler::OnConnected(int result, const char* remote_a void BluetoothHealthProfileHandler::OnDisconnected(int result, const char* /* remote_address */, unsigned int channel, void* user_data) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthProfileHandler"); BluetoothHealthProfileHandler* object = static_cast(user_data); @@ -186,6 +190,7 @@ void BluetoothHealthProfileHandler::OnDisconnected(int result, const char* /* re void BluetoothHealthProfileHandler::OnDataReceived(unsigned int channel, const char* data, unsigned int size, void* user_data) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthProfileHandler"); BluetoothHealthProfileHandler* object = static_cast(user_data); @@ -217,6 +222,7 @@ void BluetoothHealthProfileHandler::OnDataReceived(unsigned int channel, const c void BluetoothHealthProfileHandler::RegisterSinkApp(const picojson::value& data, picojson::object& out) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthProfileHandler"); CHECK_BACKWARD_COMPABILITY_PRIVILEGE_ACCESS(Privilege::kBluetooth, Privilege::kBluetoothHealth, &out); @@ -281,6 +287,7 @@ void BluetoothHealthProfileHandler::RegisterSinkApp(const picojson::value& data, void BluetoothHealthProfileHandler::ConnectToSource(const picojson::value& data, picojson::object& out) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthProfileHandler"); CHECK_BACKWARD_COMPABILITY_PRIVILEGE_ACCESS(Privilege::kBluetooth, Privilege::kBluetoothHealth, &out); @@ -335,6 +342,7 @@ void BluetoothHealthProfileHandler::ConnectToSource(const picojson::value& data, void BluetoothHealthProfileHandler::UnregisterSinkAppAsync(const std::string& app_id, int callback_handle) { ScopeLogger(); + PrintDeprecationWarningFor("BluetoothHealthProfileHandler"); auto unregister_app = [app_id, this](const std::shared_ptr& response) -> void { ScopeLogger("Entered into asynchronous function, uregister_app"); diff --git a/src/bluetooth/bluetooth_health_profile_handler.h b/src/bluetooth/bluetooth_health_profile_handler.h index 39f55eb..e1a04f9 100644 --- a/src/bluetooth/bluetooth_health_profile_handler.h +++ b/src/bluetooth/bluetooth_health_profile_handler.h @@ -32,6 +32,7 @@ class BluetoothHealthProfileHandler { public: /** * Signature: @code void registerSinkApp(dataType, name, successCallback, errorCallback); @endcode + * Deprecated since tizen version 5.5 * JSON: @code data: {method: 'BluetoothHealthProfileHandler_registerSinkApp', * args: {dataType: dataType, name: name}} @endcode * Invocation: @code native.call(request, result_callback); @endcode @@ -49,8 +50,8 @@ class BluetoothHealthProfileHandler { void RegisterSinkApp(const picojson::value& data, picojson::object& out); /** - * Signature: @code void connectToSource(peer, application, successCallback, errorCallback); - * @endcode + * Signature: @code void connectToSource(peer, application, successCallback, errorCallback); @endcode + * Deprecated since tizen version 5.5 * JSON: @code data: {method: 'BluetoothHealthProfileHandler_connectToSource', * args: {peer: peer, application: application}} @endcode * Invocation: @code native.call(request, result_callback); @endcode @@ -67,21 +68,46 @@ class BluetoothHealthProfileHandler { */ void ConnectToSource(const picojson::value& data, picojson::object& out); + /** + * Signature: @code explicit BluetoothHealthProfileHandler(BluetoothInstance&); @endcode + * Deprecated since tizen version 5.5 + */ explicit BluetoothHealthProfileHandler(BluetoothInstance& instance); + + /** + * Signature: @code ~BluetoothHealthProfileHandler(); @endcode + * Deprecated since tizen version 5.5 + */ ~BluetoothHealthProfileHandler(); + /** + * Signature: @code void UnregisterSinkAppAsync(const std::string&, int); @endcode + * Deprecated since tizen version 5.5 + */ void UnregisterSinkAppAsync(const std::string& app_id, int callback_handle); private: BluetoothHealthProfileHandler(const BluetoothHealthProfileHandler&) = delete; BluetoothHealthProfileHandler& operator=(const BluetoothHealthProfileHandler&) = delete; + /** + * Signature: @code static void OnConnected(int, const char*, const char*, bt_hdp_channel_type_e, unsigned int, void*); @endcode + * Deprecated since tizen version 5.5 + */ static void OnConnected(int result, const char* remote_address, const char* app_id, bt_hdp_channel_type_e type, unsigned int channel, void* user_data); + /** + * Signature: @code static void OnDisconnected(int, const char*, unsigned int, void*); @endcode + * Deprecated since tizen version 5.5 + */ static void OnDisconnected(int result, const char* remote_address, unsigned int channel, void* user_data); + /** + * Signature: @code static void OnDataReceived(unsigned int, const char*, unsigned int, void*); @endcode + * Deprecated since tizen version 5.5 + */ static void OnDataReceived(unsigned int channel, const char* data, unsigned int size, void* user_data); -- 2.7.4