From d7a4f06eec2bd30fd450df1e063cbce05b2c3ef4 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 19 Mar 2020 11:09:27 +0900 Subject: [PATCH 01/16] Add a new API to delete sticker using URI Change-Id: I16e910c6135199018da711c7684a699ea36d9b44 --- client/sticker_dbus.c | 15 +++++++++++++++ client/sticker_dbus.h | 1 + include/sticker_provider.h | 16 ++++++++++++++++ provider/sticker_provider.c | 30 ++++++++++++++++++++++++++++++ server/stickerd_data_manager.c | 28 ++++++++++++++++++++++++++++ server/stickerd_data_manager.h | 1 + server/stickerd_db_manager.c | 40 ++++++++++++++++++++++++++++++++++++++++ server/stickerd_db_manager.h | 1 + 8 files changed, 132 insertions(+) diff --git a/client/sticker_dbus.c b/client/sticker_dbus.c index 6af66b4..13eef77 100644 --- a/client/sticker_dbus.c +++ b/client/sticker_dbus.c @@ -643,6 +643,21 @@ int sticker_dbus_delete_sticker_info(GDBusConnection *gdbus_connection, int reco return ret; } +int sticker_dbus_delete_sticker_info_by_uri(GDBusConnection *gdbus_connection, const char *uri) +{ + int ret; + GDBusMessage *reply = NULL; + + ret = _send_sync_message(gdbus_connection, g_variant_new("(s)", uri), &reply, "delete_sticker_info_by_uri"); + if (ret != STICKER_CLIENT_ERROR_NONE) + LOGE("failed to delete sticker info"); + + if (reply) + g_object_unref(reply); + + return ret; +} + int sticker_dbus_update_sticker_info(GDBusConnection *gdbus_connection, sticker_data_h sticker_data) { int ret; diff --git a/client/sticker_dbus.h b/client/sticker_dbus.h index 1982d46..610cfe1 100644 --- a/client/sticker_dbus.h +++ b/client/sticker_dbus.h @@ -51,6 +51,7 @@ int sticker_dbus_shutdown(GDBusConnection *gdbus_connection, int *server_watcher int sticker_dbus_insert_sticker_info(GDBusConnection *gdbus_connection, sticker_data_h sticker_data); int sticker_dbus_insert_sticker_info_by_json(GDBusConnection *gdbus_connection, const char *app_id, const char *json_path); int sticker_dbus_delete_sticker_info(GDBusConnection *gdbus_connection, int record_id); +int sticker_dbus_delete_sticker_info_by_uri(GDBusConnection *gdbus_connection, const char *uri); int sticker_dbus_update_sticker_info(GDBusConnection *gdbus_connection, sticker_data_h sticker_data); int sticker_dbus_get_sticker_info_by_record_id(GDBusConnection *gdbus_connection, sticker_data_h sticker_data, int record_id); int sticker_dbus_get_group_list(GDBusConnection *gdbus_connection, const char *app_id, GList **group_list); diff --git a/include/sticker_provider.h b/include/sticker_provider.h index e7367b3..8271ad7 100644 --- a/include/sticker_provider.h +++ b/include/sticker_provider.h @@ -201,6 +201,22 @@ int sticker_provider_update_data(sticker_provider_h provider_handle, sticker_dat int sticker_provider_delete_data(sticker_provider_h provider_handle, sticker_data_h data_handle); /** + * @brief Deletes a sticker data in the sticker database using URI. + * @since_tizen 5.5 + * @param[in] provider_handle The sticker provider handle + * @param[in] uri The URI of the sticker data to be deleted + * @return 0 on success, otherwise a negative error value + * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed + * @retval #STICKER_ERROR_NO_SUCH_FILE No such file + * @see sticker_provider_insert_data() + * @see sticker_provider_delete_data() + */ +int sticker_provider_delete_data_by_uri(sticker_provider_h provider_handle, const char *uri); + +/** * @brief Gets the count of stickers stored by the provider application. * @since_tizen 5.5 * @param[in] provider_handle The sticker provider handle diff --git a/provider/sticker_provider.c b/provider/sticker_provider.c index 7dfca80..98f1005 100644 --- a/provider/sticker_provider.c +++ b/provider/sticker_provider.c @@ -364,4 +364,34 @@ cleanup: g_variant_iter_free(id_iter); return ret; +} + +EXPORT_API int sticker_provider_delete_data_by_uri(sticker_provider_h provider_handle, const char *uri) +{ + CHECK_STICKER_FEATURE(); + + int ret; + int is_exist = 0; + + if (!provider_handle || !uri) + return STICKER_ERROR_INVALID_PARAMETER; + + ret = sticker_dbus_check_file_exists(provider_handle->gdbus_connection, uri, &is_exist); + if (ret != STICKER_ERROR_NONE) { + LOGE("Failed to check file exists : %d", ret); + return STICKER_ERROR_OPERATION_FAILED; + } + + if (!is_exist) { + LOGE("Sticker does not exist"); + return STICKER_ERROR_NO_SUCH_FILE; + } + + ret = sticker_dbus_delete_sticker_info_by_uri(provider_handle->gdbus_connection, uri); + if (ret != STICKER_ERROR_NONE) { + LOGE("Failed to delete sticker information : %d", ret); + return STICKER_ERROR_OPERATION_FAILED; + } + + return STICKER_ERROR_NONE; } \ No newline at end of file diff --git a/server/stickerd_data_manager.c b/server/stickerd_data_manager.c index 8d0d604..4f0b5b2 100644 --- a/server/stickerd_data_manager.c +++ b/server/stickerd_data_manager.c @@ -109,6 +109,8 @@ static void _stickerd_client_dbus_method_call_handler(GDBusConnection *conn, con ret = stickerd_insert_sticker_info_by_json(parameters, &reply_body, sender); } else if (g_strcmp0(method_name, "delete_sticker_info") == 0) { ret = stickerd_del_sticker_info(parameters, &reply_body); + } else if (g_strcmp0(method_name, "delete_sticker_info_by_uri") == 0) { + ret = stickerd_del_sticker_info_by_uri(parameters, &reply_body); } else if (g_strcmp0(method_name, "update_sticker_type") == 0) { ret = stickerd_update_sticker_type(parameters, &reply_body); } else if (g_strcmp0(method_name, "update_sticker_uri") == 0) { @@ -194,6 +196,10 @@ int stickerd_register_dbus_interface(void) " " " " + " " + " " + " " + " " " " " " @@ -800,6 +806,28 @@ int stickerd_del_sticker_info(GVariant *parameters, GVariant **reply_body) return ret; } +int stickerd_del_sticker_info_by_uri(GVariant *parameters, GVariant **reply_body) +{ + int ret; + char *uri = NULL; + + *reply_body = g_variant_new("()"); + if (*reply_body == NULL) { + LOGE("Failed to create reply_body"); + return STICKERD_SERVER_ERROR_OPERATION_FAILED; + } + + g_variant_get(parameters, "(&s)", &uri); + + ret = stickerd_db_delete_sticker_info_by_uri(uri); + if (ret != STICKERD_SERVER_ERROR_NONE) { + LOGE("Failed to delete sticker info"); + return STICKERD_SERVER_ERROR_OPERATION_FAILED; + } + + return ret; +} + int stickerd_update_sticker_type(GVariant *parameters, GVariant **reply_body) { int ret; diff --git a/server/stickerd_data_manager.h b/server/stickerd_data_manager.h index d102573..e09e91d 100644 --- a/server/stickerd_data_manager.h +++ b/server/stickerd_data_manager.h @@ -28,6 +28,7 @@ int stickerd_register_dbus_interface(void); int stickerd_insert_sticker_info(GVariant *parameters, GVariant **reply_body); int stickerd_insert_sticker_info_by_json(GVariant *parameters, GVariant **reply_body, const char *sender); int stickerd_del_sticker_info(GVariant *parameters, GVariant **reply_body); +int stickerd_del_sticker_info_by_uri(GVariant *parameters, GVariant **reply_body); int stickerd_update_sticker_type(GVariant *parameters, GVariant **reply_body); int stickerd_update_sticker_uri(GVariant *parameters, GVariant **reply_body); int stickerd_update_sticker_thumbnail(GVariant *parameters, GVariant **reply_body); diff --git a/server/stickerd_db_manager.c b/server/stickerd_db_manager.c index 6680905..52a177c 100644 --- a/server/stickerd_db_manager.c +++ b/server/stickerd_db_manager.c @@ -63,6 +63,7 @@ #define STICKER_DB_DELETE_STICKER_INFO "DELETE FROM sticker_info WHERE sticker_info_id = ?" #define STICKER_DB_DELETE_STICKER_KEYWORD_INFO "DELETE FROM sticker_keyword_info WHERE sticker_info_id = ?" +#define STICKER_DB_DELETE_STICKER_INFO_BY_URI "DELETE FROM sticker_info WHERE uri = ?" #define STICKER_DB_UPDATE_STICKER_TYPE "UPDATE sticker_info SET type = ?, date = DateTime('now','localtime') WHERE sticker_info_id = ?" #define STICKER_DB_UPDATE_STICKER_URI "UPDATE sticker_info SET uri = ?, date = DateTime('now','localtime') WHERE sticker_info_id = ?" @@ -426,6 +427,45 @@ cleanup: return STICKERD_SERVER_ERROR_DB_FAILED; } +int stickerd_db_delete_sticker_info_by_uri(char *uri) +{ + int ret; + sqlite3 *db = NULL; + sqlite3_stmt *stmt = NULL; + + db = _db_open(); + if (!db) + return STICKERD_SERVER_ERROR_DB_FAILED; + + ret = sqlite3_prepare_v2(db, STICKER_DB_DELETE_STICKER_INFO_BY_URI, -1, &stmt, NULL); + if (ret != SQLITE_OK) { + LOGE("fail to delete sticker information : %s", sqlite3_errmsg(db)); + goto cleanup; + } + + sqlite3_bind_text(stmt, 1, uri, -1, SQLITE_TRANSIENT); + + ret = sqlite3_step(stmt); + if (ret != SQLITE_OK && ret != SQLITE_DONE) { + LOGE("sqlite3_step() failed : ret(%d)", ret); + goto cleanup; + } else if (sqlite3_changes(db) == 0) { + LOGE("No changes to DB"); + goto cleanup; + } + + sqlite3_finalize(stmt); + sqlite3_close(db); + + return STICKERD_SERVER_ERROR_NONE; + +cleanup: + sqlite3_finalize(stmt); + sqlite3_close(db); + + return STICKERD_SERVER_ERROR_DB_FAILED; +} + int stickerd_db_update_sticker_info(int record_id, sticker_info_db_type type, void *data) { int ret; diff --git a/server/stickerd_db_manager.h b/server/stickerd_db_manager.h index 2c260f4..4a14e50 100644 --- a/server/stickerd_db_manager.h +++ b/server/stickerd_db_manager.h @@ -51,6 +51,7 @@ typedef struct { int stickerd_db_init(void); int stickerd_db_insert_sticker_info(int *record_id, sticker_info_db *sticker_info); int stickerd_db_delete_sticker_info(int record_id); +int stickerd_db_delete_sticker_info_by_uri(char *uri); int stickerd_db_update_sticker_info(int record_id, sticker_info_db_type type, void *data); int stickerd_db_get_sticker_info_by_record_id(int record_id, sticker_info_db *sticker_info); int stickerd_db_get_group_list(GVariantBuilder *builder, char *app_id); -- 2.7.4 From e8bc0cb40e08a9a6a8b32949909c7bbf1cf8c75f Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 19 Mar 2020 19:12:40 +0900 Subject: [PATCH 02/16] Modified to use the new API to delete sticker Change-Id: I4867a69a865bc291b30ef6b867cbc88bd780f7a6 --- receiver/src/sticker_info.cpp | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/receiver/src/sticker_info.cpp b/receiver/src/sticker_info.cpp index 89aedfb..b71c149 100644 --- a/receiver/src/sticker_info.cpp +++ b/receiver/src/sticker_info.cpp @@ -126,46 +126,10 @@ void destroy_sticker_provider_handle(void) sticker_provider = NULL; } -static void _sticker_foreach_cb(sticker_data_h data_handle, void *user_data) -{ - int ret; - char *del_file = (char *)user_data; - sticker_data_uri_type_e type; - char *uri = NULL; - - if (!need_to_retrive) - return; - - ret = sticker_data_get_uri(data_handle, &type, &uri); - if (ret != STICKER_ERROR_NONE) - LOGE("Failed to get sticker uri"); - - int result = (string(uri)).find(del_file); - if (result >= 0) { - LOGI("Delete sticker (%s)", uri); - need_to_retrive = false; - - ret = sticker_provider_delete_data(sticker_provider, data_handle); - if (ret != STICKER_ERROR_NONE) - LOGE("Failed to delete sticker"); - } -} - void delete_sticker_data(const char *fileName) { int ret; - int offset = 0; - int count = 0; - int result = 0; - need_to_retrive = true; - - while (result == count && need_to_retrive) { - count = 20; - ret = sticker_provider_data_foreach_all(sticker_provider, offset, count, &result, _sticker_foreach_cb, (void *)fileName); - offset += result; - if (ret != STICKER_ERROR_NONE) { - LOGE("Failed to retrieve sticker"); - return; - } - } + ret = sticker_provider_delete_data_by_uri(sticker_provider, fileName); + if (ret != STICKER_ERROR_NONE) + LOGE("Failed to delete sticker. ret : %d", ret); } \ No newline at end of file -- 2.7.4 From 4d7cec539fecfe222d9c89bb9faae02b0396ec55 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 19 Mar 2020 19:14:19 +0900 Subject: [PATCH 03/16] Update package version to 0.1.23 Change-Id: I0c9b9a4745bdf1bcf01b645d3762a42060339973 --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index d36c513..cc07b17 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.22 +Version: 0.1.23 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 6726d6d..b01d8c2 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 58558b88fb7aebee2a03722378bbbf31ca9aead9 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 20 Mar 2020 14:56:40 +0900 Subject: [PATCH 04/16] Remove unused variable Change-Id: Iaa0a0b6744e091ab9c761363de5e1edcc21d27e0 --- receiver/src/sticker_info.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/receiver/src/sticker_info.cpp b/receiver/src/sticker_info.cpp index b71c149..57ace21 100644 --- a/receiver/src/sticker_info.cpp +++ b/receiver/src/sticker_info.cpp @@ -18,14 +18,10 @@ #include #include #include -#include #include "log.h" -using namespace std; - static sticker_provider_h sticker_provider = NULL; -static bool need_to_retrive = false; sticker_data_h set_sticker_data(sticker_data_uri_type_e type, const char* uri, const char* keyword, -- 2.7.4 From c55a6705b7f6f38b46ec00a749d23484b99538df Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 20 Mar 2020 15:36:15 +0900 Subject: [PATCH 05/16] Check battery charging status for sync condition Change-Id: I07450a60edef785e197bac03f85d3f13855465b8 Signed-off-by: Jihoon Kim --- receiver/src/main.cpp | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 9968b91..7a5e20d 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -48,6 +48,8 @@ static void app_control(app_control_h app_control, void *data) char* alarm_data = NULL; int res; + int battery_percentage = 0; + bool battery_charging = false; // operation int ret = app_control_get_operation(app_control, &operation); @@ -63,20 +65,30 @@ static void app_control(app_control_h app_control, void *data) LOGD("alarm data : %s", alarm_data); - int battery_percentage = 0; - int ret = device_battery_get_percent(&battery_percentage); - if (ret == DEVICE_ERROR_NONE) { - LOGD("battery percent : %d", battery_percentage); - if (battery_percentage >= MINIMUM_BATTERY) { - request_sticker_data("auto", "arsticker", "input"); - request_sticker_data("auto", "bitmoji", "input"); - } - else { - LOGD("No sync request due to insufficient battery"); - } + int ret = device_battery_is_charging(&battery_charging); + if (ret != DEVICE_ERROR_NONE) { + LOGW("No sync. Can't get battery charging status"); + goto cleanup; + } + + if (!battery_charging) { + LOGI("No sync due to no battery charging status"); + goto cleanup; + } + + ret = device_battery_get_percent(&battery_percentage); + if (ret != DEVICE_ERROR_NONE) { + LOGW("No sync. Failed to get battery percent. error : %d", ret); + goto cleanup; + } + + LOGI("battery percent : %d", battery_percentage); + if (battery_percentage >= MINIMUM_BATTERY) { + request_sticker_data("auto", "arsticker", "input"); + request_sticker_data("auto", "bitmoji", "input"); } else { - LOGW("Failed to get battery percent. error : %d", ret); + LOGI("No sync due to insufficient battery"); } goto cleanup; -- 2.7.4 From cccab67025622346c9643bd1fe8e0205593def7a Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 20 Mar 2020 13:11:25 +0900 Subject: [PATCH 06/16] Fix wrong error value Change-Id: If4d58982b791dc064cc3b05d7e35d84caf9c661f --- include/sticker_error.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sticker_error.h b/include/sticker_error.h index fea1302..2239809 100644 --- a/include/sticker_error.h +++ b/include/sticker_error.h @@ -47,7 +47,7 @@ typedef enum { STICKER_ERROR_OPERATION_FAILED = TIZEN_ERROR_STICKER | 0x0001, /**< Operation failed */ STICKER_ERROR_FILE_EXISTS = TIZEN_ERROR_FILE_EXISTS, /**< File exists */ STICKER_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data available */ - STICKER_ERROR_NO_SUCH_FILE = TIZEN_ERROR_FILE_EXISTS, /**< No such file */ + STICKER_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file */ } sticker_error_e; /** -- 2.7.4 From 80dc4d119819af92f77c49771f0dfe2e8e8c0ece Mon Sep 17 00:00:00 2001 From: InHong Han Date: Tue, 24 Mar 2020 13:45:10 +0900 Subject: [PATCH 07/16] Update package version to 0.1.24 Change-Id: Ia2d82f6d9e7397b97dd7155c6f72f143d42fbb2d --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index cc07b17..442c769 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.23 +Version: 0.1.24 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index b01d8c2..aeaa201 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 6c03a6605febb89590e3355138b6917429cc19ca Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 24 Mar 2020 20:28:57 +0900 Subject: [PATCH 08/16] Fix issue request sending fail log is displayed before connection is established Change-Id: I655ef74f51c62c82a4c476b9b2fabb2faee774f3 Signed-off-by: Jihoon Kim --- receiver/src/ft.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 4a2ec79..cc821a9 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -273,7 +273,18 @@ void accept_file() void request_sticker_data(const char *mode, const char *category, const char *type) { - JsonObject *j_object = json_object_new(); + JsonObject *j_object = NULL; + if (!priv_data.socket) { + pending_request.req_type = REQUEST_TYPE_SYNC; + pending_request.mode = string(mode ? mode : "manual"); + pending_request.category = string(category? category : "arsticker"); + pending_request.type = string(type ? type : "input"); + + LOGI("Push sync request"); + return; + } + + j_object = json_object_new(); if (j_object == NULL) { LOGE("json object create error"); return; @@ -286,12 +297,7 @@ void request_sticker_data(const char *mode, const char *category, const char *ty json_object_set_string_member(j_object, "type", type); if (_send_json_data(j_object) == FALSE) { - pending_request.req_type = REQUEST_TYPE_SYNC; - pending_request.mode = string(mode ? mode : "manual"); - pending_request.category = string(category? category : "arsticker"); - pending_request.type = string(type ? type : "input"); - - LOGI("Push sync request"); + LOGE("Failed to send STICKER_SYNC_START_REQ"); } else { current_request.req_type = REQUEST_TYPE_SYNC; @@ -305,7 +311,15 @@ void request_sticker_data(const char *mode, const char *category, const char *ty void request_sticker_feature() { - JsonObject *j_object = json_object_new(); + JsonObject *j_object = NULL; + + if (!priv_data.socket) { + pending_request.req_type = REQUEST_TYPE_FEATURE_REQ; + LOGI("Push sync feature request"); + return; + } + + j_object = json_object_new(); if (j_object == NULL) { LOGE("json object create error"); return; @@ -315,7 +329,6 @@ void request_sticker_feature() json_object_set_int_member(j_object, "tID", ++t_id); if (_send_json_data(j_object) == FALSE) { - pending_request.req_type = REQUEST_TYPE_FEATURE_REQ; LOGE("Failed to send STICKER_SYNC_FEATURE_REQ"); } -- 2.7.4 From 5a67afed3e35ce14a9f675b0a6d6faabe1ec22b2 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 24 Mar 2020 20:49:43 +0900 Subject: [PATCH 09/16] Fix coding style Change-Id: I277099b06973fe4306ad95e869a20ce12f2ff0e3 Signed-off-by: Jihoon Kim --- receiver/src/ft.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index cc821a9..9a8addd 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -277,7 +277,7 @@ void request_sticker_data(const char *mode, const char *category, const char *ty if (!priv_data.socket) { pending_request.req_type = REQUEST_TYPE_SYNC; pending_request.mode = string(mode ? mode : "manual"); - pending_request.category = string(category? category : "arsticker"); + pending_request.category = string(category ? category : "arsticker"); pending_request.type = string(type ? type : "input"); LOGI("Push sync request"); @@ -302,7 +302,7 @@ void request_sticker_data(const char *mode, const char *category, const char *ty else { current_request.req_type = REQUEST_TYPE_SYNC; current_request.mode = string(mode ? mode : "manual"); - current_request.category = string(category? category : "arsticker"); + current_request.category = string(category ? category : "arsticker"); current_request.type = string(type ? type : "input"); } -- 2.7.4 From 1f5ca3b282adbf20ced43e8c140767b1d69099c4 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 18 Mar 2020 20:11:41 +0900 Subject: [PATCH 10/16] Use request queue Change-Id: I707e5b8bc720659afefc04f1c4cc5adc54ed0f44 Signed-off-by: Jihoon Kim --- receiver/inc/ft.h | 2 +- receiver/inc/sticker_request.h | 34 +++++++++++++ receiver/src/ft.cpp | 113 ++++++++++++++++++++++++----------------- receiver/src/main.cpp | 4 +- 4 files changed, 104 insertions(+), 49 deletions(-) create mode 100644 receiver/inc/sticker_request.h diff --git a/receiver/inc/ft.h b/receiver/inc/ft.h index a95204c..10ccb0e 100644 --- a/receiver/inc/ft.h +++ b/receiver/inc/ft.h @@ -29,7 +29,7 @@ void accept_file(void); gboolean initialize_sap(void); void deinitialize_sap(void); -void request_sticker_data(const char *mode, const char *category, const char *type); +bool request_sticker_data(const char *mode, const char *category, const char *type); void request_sticker_feature(); #endif /* __FT_H__ */ diff --git a/receiver/inc/sticker_request.h b/receiver/inc/sticker_request.h new file mode 100644 index 0000000..9c8089f --- /dev/null +++ b/receiver/inc/sticker_request.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef __STICKER_REQUEST_H__ +#define __STICKER_REQUEST_H__ + +#include + +using namespace std; + +typedef enum { + REQUEST_TYPE_SYNC, + REQUEST_TYPE_FEATURE_REQ +} request_type; + +struct StickerRequest { + request_type req_type; + string mode; + string category; + string type; +}; +#endif /* __STICKER_REQUEST_H__ */ diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 9a8addd..e2b703d 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -31,11 +31,13 @@ #include #include #include +#include #include "ft.h" #include "log.h" #include "sticker_info.h" #include "../inc/sticker_data.h" +#include "sticker_request.h" #include "message.h" #include "sync_alarm.h" @@ -54,11 +56,6 @@ using namespace std; -typedef enum { - REQUEST_TYPE_SYNC, - REQUEST_TYPE_FEATURE_REQ -} request_type; - enum { SYNC_START_RSP_SUCCESS = 1000, SYNC_START_RSP_NO_STICKER = 1001 @@ -71,22 +68,17 @@ struct sap_info_s { sap_file_transaction_h file_socket; }; -struct request { - request_type req_type; - string mode; - string category; - string type; -}; - static struct sap_info_s priv_data = { 0 }; static struct sticker_info sticker_data; -static struct request pending_request, current_request; +static queue ReqQueue; +static StickerRequest current_request; gboolean file_on_progress = 0; static string incoming_file_name; static int t_id = 0; static int rec_file_cnt = 0; static int total_file_count = 0; +static int sync_success_cnt = 0; static gboolean _send_json_data(JsonObject *obj) { @@ -271,23 +263,28 @@ void accept_file() file_on_progress = 1; } -void request_sticker_data(const char *mode, const char *category, const char *type) +bool request_sticker_data(const char *mode, const char *category, const char *type) { + bool result = false; JsonObject *j_object = NULL; + if (!priv_data.socket) { + StickerRequest pending_request; pending_request.req_type = REQUEST_TYPE_SYNC; pending_request.mode = string(mode ? mode : "manual"); pending_request.category = string(category ? category : "arsticker"); pending_request.type = string(type ? type : "input"); + ReqQueue.push(pending_request); LOGI("Push sync request"); - return; + + return false; } j_object = json_object_new(); if (j_object == NULL) { LOGE("json object create error"); - return; + return false; } json_object_set_string_member(j_object, "msgId", STICKER_SYNC_START_REQ); @@ -298,15 +295,19 @@ void request_sticker_data(const char *mode, const char *category, const char *ty if (_send_json_data(j_object) == FALSE) { LOGE("Failed to send STICKER_SYNC_START_REQ"); + result = false; } else { current_request.req_type = REQUEST_TYPE_SYNC; current_request.mode = string(mode ? mode : "manual"); current_request.category = string(category ? category : "arsticker"); current_request.type = string(type ? type : "input"); + result = true; } json_object_unref(j_object); + + return result; } void request_sticker_feature() @@ -314,7 +315,9 @@ void request_sticker_feature() JsonObject *j_object = NULL; if (!priv_data.socket) { + StickerRequest pending_request; pending_request.req_type = REQUEST_TYPE_FEATURE_REQ; + ReqQueue.push(pending_request); LOGI("Push sync feature request"); return; } @@ -392,6 +395,29 @@ void conn_terminated(sap_peer_agent_h peer_agent, service_app_exit(); } +static bool process_request_queue() +{ + if (ReqQueue.empty()) + return false; + + StickerRequest request = ReqQueue.front(); + + if (request.req_type == REQUEST_TYPE_FEATURE_REQ) { + LOGD("[Request feature exchange]"); + request_sticker_feature(); + ReqQueue.pop(); + } + else if (request.req_type == REQUEST_TYPE_SYNC) { + LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(), + request.category.c_str(), + request.type.c_str()); + + if (request_sticker_data(request.mode.c_str(), request.category.c_str(), request.type.c_str())) + ReqQueue.pop(); + } + + return true; +} void on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned int payload_length, void *buffer, @@ -448,7 +474,9 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in LOGW("Fail to set supported feature"); #endif - service_app_exit(); + if (!process_request_queue()) { + service_app_exit(); + } } else if (msg_id == STICKER_SYNC_START_RSP) { LOGD("msg : %s", msg_id.c_str()); const char *json_result = json_object_get_string_member(root_obj, "result"); @@ -471,8 +499,11 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in send_message("sync_start_response", response_to_app.c_str()); - if (result_code != SYNC_START_RSP_SUCCESS) - service_app_exit(); + if (result_code != SYNC_START_RSP_SUCCESS) { + if (!process_request_queue()) { + service_app_exit(); + } + } } else if (msg_id == STICKER_SEND_START_REQ) { LOGD("msg : %s", msg_id.c_str()); total_file_count = 0; @@ -542,8 +573,9 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in json_object_set_string_member(j_object, "msgId", STICKER_SEND_STOP_RSP); json_object_set_int_member(j_object, "tID", t_id); - if (reason == "complete" && rec_file_cnt != file_len) + if (reason == "complete" && rec_file_cnt != file_len) { json_object_set_string_member(j_object, "result", "failure"); + } else { int complete_flags = 0; if (vconf_get_int(VCONFKEY_STICKER_SYNC_COMPLETE, &complete_flags) == 0) { @@ -564,25 +596,30 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in } json_object_set_string_member(j_object, "result", "success"); - - if (current_request.mode == string("manual")) { - if (!sync_alarm_exist()) - sync_alarm_register(APP_CONTROL_OPERATION_SYNC_ALARM, SYNC_ALARM_DELAY, SYNC_ALARM_INTERVAL); - } + sync_success_cnt++; } if (_send_json_data(j_object) == FALSE) LOGE("Failed to send message"); + json_object_unref(j_object); + send_message("sync_stop_result", reason.c_str()); - json_object_unref(j_object); + if (!process_request_queue()) { + if (sync_success_cnt > 0 && current_request.mode == string("manual")) { + if (!sync_alarm_exist()) + sync_alarm_register(APP_CONTROL_OPERATION_SYNC_ALARM, SYNC_ALARM_DELAY, SYNC_ALARM_INTERVAL); + } + + sync_success_cnt = 0; + + service_app_exit(); + } current_request.mode.clear(); current_request.category.clear(); current_request.type.clear(); - - service_app_exit(); } else LOGW("unknown msg id : %s", msg_id.c_str()); @@ -655,25 +692,7 @@ _on_service_connection_created(sap_peer_agent_h peer_agent, priv->socket = socket; LOGI("Connection Established"); - LOGD("pending_request : %d", pending_request.req_type); - - if (pending_request.req_type == REQUEST_TYPE_FEATURE_REQ) { - LOGD("[Request feature exchange]"); - request_sticker_feature(); - } - else if (pending_request.req_type == REQUEST_TYPE_SYNC) { - if (!pending_request.mode.empty()) { - LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", pending_request.mode.c_str(), - pending_request.category.c_str(), - pending_request.type.c_str()); - - request_sticker_data(pending_request.mode.c_str(), pending_request.category.c_str(), pending_request.type.c_str()); - - pending_request.mode.clear(); - pending_request.category.clear(); - pending_request.type.clear(); - } - } + process_request_queue(); break; diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 7a5e20d..3fd98e1 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -117,8 +117,10 @@ static void app_control(app_control_h app_control, void *data) if (param_error) goto cleanup; - if (mode && type) + if (mode && type) { request_sticker_data(mode, "arsticker", type); + request_sticker_data(mode, "bitmoji", type); + } } else if (strcmp(request, "oobe") == 0) { LOGI("[OOBE] register sync alarm"); -- 2.7.4 From 5201478930848f51eeff0a48217cb28a9acc0be8 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 13 Mar 2020 17:01:02 +0900 Subject: [PATCH 11/16] Change the sync progress method from total to each group Change-Id: I11bf1a405cd8e69cb9b62e416c7ac45fca9b3c6e Signed-off-by: Jihoon Kim --- receiver/src/ft.cpp | 24 ++++++++++-------------- receiver/src/message.cpp | 5 +++-- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index e2b703d..e6f085b 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -76,8 +76,8 @@ static StickerRequest current_request; gboolean file_on_progress = 0; static string incoming_file_name; static int t_id = 0; -static int rec_file_cnt = 0; -static int total_file_count = 0; +static int rec_file_cnt_in_group = 0; +static int total_file_count_in_group = 0; static int sync_success_cnt = 0; static gboolean _send_json_data(JsonObject *obj) @@ -129,15 +129,11 @@ cleanup: static void notify_sync_progress(unsigned int file_progress) { - if (total_file_count == 0) + if (total_file_count_in_group == 0) return; - double total_progress = (((double)rec_file_cnt / (double)total_file_count) + (1.0/(double)total_file_count*file_progress/100))*100; - - LOGI("(%2d / %2d), file progress : %3u%%, total progress : %3u%%", rec_file_cnt, total_file_count, file_progress, (unsigned int)total_progress); - char progress_str[32]; - snprintf(progress_str, sizeof(progress_str), "%u", (unsigned int)total_progress); - send_message("sync_progress", progress_str); + LOGI("(%2d / %2d), file progress : %3u%%", rec_file_cnt_in_group+1, total_file_count_in_group, file_progress); + send_message("sync_progress", NULL); } static void _on_send_completed(sap_file_transaction_h file_transaction, @@ -167,7 +163,7 @@ static void _on_send_completed(sap_file_transaction_h file_transaction, } } - rec_file_cnt++; + rec_file_cnt_in_group++; } else { switch (result) { case (SAP_FT_TRANSFER_FAIL_CHANNEL_IO): { @@ -506,8 +502,8 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in } } else if (msg_id == STICKER_SEND_START_REQ) { LOGD("msg : %s", msg_id.c_str()); - total_file_count = 0; - rec_file_cnt = 0; + total_file_count_in_group = 0; + rec_file_cnt_in_group = 0; t_id = json_object_get_int_member(root_obj, "tID"); JsonArray *file_list = json_object_get_array_member(root_obj, "list"); if (file_list) { @@ -520,7 +516,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in if (file_len > 0) { LOGD("Add file : %s, len : %d", file_name.c_str(), file_len); - total_file_count++; + total_file_count_in_group++; } else { LOGD("Delete file : %s, len : %d", file_name.c_str(), file_len); if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { @@ -573,7 +569,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in json_object_set_string_member(j_object, "msgId", STICKER_SEND_STOP_RSP); json_object_set_int_member(j_object, "tID", t_id); - if (reason == "complete" && rec_file_cnt != file_len) { + if (reason == "complete" && rec_file_cnt_in_group != file_len) { json_object_set_string_member(j_object, "result", "failure"); } else { diff --git a/receiver/src/message.cpp b/receiver/src/message.cpp index f67b29e..8dde6a6 100644 --- a/receiver/src/message.cpp +++ b/receiver/src/message.cpp @@ -72,7 +72,8 @@ bool send_message(const char *cmd, const char *data) bundle *b = bundle_create(); bundle_add_str(b, "command", cmd); - bundle_add_str(b, "data", data); + if (data) + bundle_add_str(b, "data", data); ret = message_port_send_message(REMOTE_APP_ID, MESSAGE_PORT_REMOTE_NAME, b); if (ret != MESSAGE_PORT_ERROR_NONE) { LOGW("message port send message error. err : %d", ret); @@ -87,4 +88,4 @@ bool send_message(const char *cmd, const char *data) bundle_free(b); return result; -} \ No newline at end of file +} -- 2.7.4 From b4f75db5f90c042630cc950a7d6d494e6ec92772 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 26 Mar 2020 12:12:09 +0900 Subject: [PATCH 12/16] Update package version to 0.1.25 Change-Id: I572cea0f5e4f90bc58fba9f4a08c148dbd6d7f96 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 442c769..ee59659 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.24 +Version: 0.1.25 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index aeaa201..71b376e 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 00fc02d1298495261ce9a3b4e22578827b570cd0 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 27 Mar 2020 11:09:46 +0900 Subject: [PATCH 13/16] Modified to not initialize the file_path to null before inserting sticker data Change-Id: I5473c0ea2d6dae2a9c68d3c641f8cc76108491de --- receiver/src/ft.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index e6f085b..1b03c03 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -213,6 +213,7 @@ static void _on_send_completed(sap_file_transaction_h file_transaction, } file_on_progress = 0; + sticker_data.reset(); } static void _on_sending_file_in_progress(sap_file_transaction_h file_transaction, @@ -543,8 +544,6 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in json_object_unref(j_object); } else if (msg_id == STICKER_SEND_FACE_DATA) { LOGD("msg : %s", msg_id.c_str()); - sticker_data.reset(); - const char *type_data = json_object_get_string_member(root_obj, "type"); if (type_data) sticker_data.disp_type = string(type_data); -- 2.7.4 From f5afe2482017b66ca67993cb4f7fb9be6b52b043 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 27 Mar 2020 13:34:15 +0900 Subject: [PATCH 14/16] Improve code for human readability Change-Id: I3ba1efb2012761a4d98928e2156bcaeba56b6cc7 Signed-off-by: Jihoon Kim --- receiver/src/ft.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 1b03c03..a6cba2f 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -73,7 +73,7 @@ static struct sticker_info sticker_data; static queue ReqQueue; static StickerRequest current_request; -gboolean file_on_progress = 0; +static gboolean file_on_progress = FALSE; static string incoming_file_name; static int t_id = 0; static int rec_file_cnt_in_group = 0; @@ -212,7 +212,7 @@ static void _on_send_completed(sap_file_transaction_h file_transaction, } } - file_on_progress = 0; + file_on_progress = FALSE; sticker_data.reset(); } @@ -257,7 +257,7 @@ void accept_file() break; } - file_on_progress = 1; + file_on_progress = TRUE; } bool request_sticker_data(const char *mode, const char *category, const char *type) @@ -340,7 +340,7 @@ void reject_file() int ret = sap_file_transfer_reject(priv_data.file_socket); LOGI("ret : %d", ret); - file_on_progress = 0; + file_on_progress = FALSE; } static void _on_receive_file_cb(sap_peer_agent_h peer_agent_h, @@ -348,7 +348,7 @@ static void _on_receive_file_cb(sap_peer_agent_h peer_agent_h, const char *file_path, void *user_data) { - file_on_progress = 1; + file_on_progress = TRUE; priv_data.file_socket = socket; LOGI("# incoming file request."); __set_file_transfer_cb(priv_data.file_socket); -- 2.7.4 From e3ae2adc6b24c98cd684049dfcb4a5ab16955bd2 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 27 Mar 2020 14:44:01 +0900 Subject: [PATCH 15/16] Create configuration header Change-Id: I8e909a05e42cfcc76b025f07baec87c879362f7c Signed-off-by: Jihoon Kim --- receiver/inc/config.h | 31 +++++++++++++++++++++++++++++++ receiver/inc/ft.h | 1 + receiver/inc/log.h | 1 + receiver/inc/main.h | 1 + receiver/inc/message.h | 1 + receiver/inc/sticker_info.h | 1 + receiver/inc/sticker_request.h | 1 + receiver/inc/sync_alarm.h | 3 +-- receiver/src/ft.cpp | 4 +--- receiver/src/main.cpp | 4 ++-- receiver/src/message.cpp | 4 +--- receiver/src/sticker_info.cpp | 1 + receiver/src/sync_alarm.cpp | 1 + 13 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 receiver/inc/config.h diff --git a/receiver/inc/config.h b/receiver/inc/config.h new file mode 100644 index 0000000..88eee4d --- /dev/null +++ b/receiver/inc/config.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#define ACCESSORY_SERVICE_PROFILE_ID "/sample/filetransfersender" +#define ACCESSORY_SERVICE_CHANNEL_ID 107 + +#define SYNC_ALARM_DELAY 0 +#define SYNC_ALARM_INTERVAL 12*60*60 + +#define REMOTE_APP_ID "com.samsung.w-input-selector" +#define MESSAGE_PORT_REMOTE_NAME REMOTE_APP_ID"_msg_port_rcv" + +#define MINIMUM_BATTERY 15 + +#endif /* __CONFIG_H__ */ diff --git a/receiver/inc/ft.h b/receiver/inc/ft.h index 10ccb0e..0a022a6 100644 --- a/receiver/inc/ft.h +++ b/receiver/inc/ft.h @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #ifndef __FT_H__ diff --git a/receiver/inc/log.h b/receiver/inc/log.h index 07ee738..763f6cb 100644 --- a/receiver/inc/log.h +++ b/receiver/inc/log.h @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef __debug_H__ #define __debug_H__ diff --git a/receiver/inc/main.h b/receiver/inc/main.h index e32a820..27883e4 100644 --- a/receiver/inc/main.h +++ b/receiver/inc/main.h @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include diff --git a/receiver/inc/message.h b/receiver/inc/message.h index 392f1cd..791a9aa 100644 --- a/receiver/inc/message.h +++ b/receiver/inc/message.h @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include diff --git a/receiver/inc/sticker_info.h b/receiver/inc/sticker_info.h index 8231585..2e20ad8 100644 --- a/receiver/inc/sticker_info.h +++ b/receiver/inc/sticker_info.h @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef __STICKER_INFO_H__ #define __STICKER_INFO_H__ diff --git a/receiver/inc/sticker_request.h b/receiver/inc/sticker_request.h index 9c8089f..583bd9a 100644 --- a/receiver/inc/sticker_request.h +++ b/receiver/inc/sticker_request.h @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef __STICKER_REQUEST_H__ #define __STICKER_REQUEST_H__ diff --git a/receiver/inc/sync_alarm.h b/receiver/inc/sync_alarm.h index e46515c..8f025ca 100644 --- a/receiver/inc/sync_alarm.h +++ b/receiver/inc/sync_alarm.h @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #ifndef __ALARM_H__ #define __ALARM_H__ #define APP_CONTROL_OPERATION_SYNC_ALARM "http://tizen.org/appcontrol/operation/sticker_sync_alarm" -#define SYNC_ALARM_DELAY 0 -#define SYNC_ALARM_INTERVAL 12*60*60 bool sync_alarm_register(const char *operation, int delay, int period); bool sync_alarm_exist(); diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index a6cba2f..1408aa7 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -40,9 +40,7 @@ #include "sticker_request.h" #include "message.h" #include "sync_alarm.h" - -#define ACCESSORY_SERVICE_PROFILE_ID "/sample/filetransfersender" -#define ACCESSORY_SERVICE_CHANNEL_ID 107 +#include "config.h" #define STICKER_SYNC_FEATURE_REQ "sticker-sync-feature-req" #define STICKER_SYNC_FEATURE_RSP "sticker-sync-feature-rsp" diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 3fd98e1..969f575 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include @@ -22,10 +23,9 @@ #include "main.h" #include "ft.h" #include "log.h" +#include "config.h" #include "sync_alarm.h" -#define MINIMUM_BATTERY 15 - static bool app_create(void *data) { /* Hook to take necessary actions before main event loop starts diff --git a/receiver/src/message.cpp b/receiver/src/message.cpp index 8dde6a6..0ca7d32 100644 --- a/receiver/src/message.cpp +++ b/receiver/src/message.cpp @@ -18,9 +18,7 @@ #include "message.h" #include "log.h" - -#define REMOTE_APP_ID "com.samsung.w-input-selector" -#define MESSAGE_PORT_REMOTE_NAME REMOTE_APP_ID"_msg_port_rcv" +#include "config.h" static int port_id = -1; diff --git a/receiver/src/sticker_info.cpp b/receiver/src/sticker_info.cpp index 57ace21..16ca72e 100644 --- a/receiver/src/sticker_info.cpp +++ b/receiver/src/sticker_info.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "sticker_info.h" #include #include diff --git a/receiver/src/sync_alarm.cpp b/receiver/src/sync_alarm.cpp index d4879d8..ec7079e 100644 --- a/receiver/src/sync_alarm.cpp +++ b/receiver/src/sync_alarm.cpp @@ -19,6 +19,7 @@ #include #include "log.h" +#include "config.h" static int recurring_alarm_id = -1; -- 2.7.4 From ff069d1debde7c14b3e64e614670e24f53357e26 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 27 Mar 2020 18:52:46 +0900 Subject: [PATCH 16/16] Fix indentation in manifest file Change-Id: I281de93c075efb6df8c7b96338ddb7113736cdd7 Signed-off-by: Jihoon Kim --- receiver/tizen-manifest.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 71b376e..1d23be5 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -2,12 +2,12 @@ - - - - - - + + + + + + http://developer.samsung.com/tizen/privilege/accessoryprotocol -- 2.7.4