Only manual sync is possible after sync fails for 48hours 62/231962/1
authorInHong Han <inhong1.han@samsung.com>
Mon, 27 Apr 2020 04:41:35 +0000 (13:41 +0900)
committerInHong Han <inhong1.han@samsung.com>
Mon, 27 Apr 2020 04:47:50 +0000 (13:47 +0900)
Change-Id: I1e0683e4231cf9b99e32bcc5a8f3b5961015955a

receiver/inc/config.h
receiver/inc/ft.h
receiver/src/ft.cpp
receiver/src/main.cpp

index 10b742f..ecc3c10 100644 (file)
@@ -21,6 +21,7 @@
 #define ACCESSORY_SERVICE_CHANNEL_ID 107
 
 #define SYNC_INTERVAL 12*60*60
+#define MAX_WAIT_TIME 48*60*60
 
 #define REMOTE_APP_ID "com.samsung.w-input-selector"
 #define MESSAGE_PORT_REMOTE_NAME REMOTE_APP_ID"_msg_port_rcv"
index 90d506f..6c91c66 100644 (file)
@@ -35,6 +35,7 @@ void request_all_sticker_data(const char *mode, const char *type);
 bool request_sticker_data(const char *mode, const char *category, const char *type);
 void request_sticker_feature();
 void send_disconnect_message();
+void request_show_sync_notification();
 
 bool get_job_progress();
 
index 7fbbffb..ae52546 100644 (file)
@@ -48,6 +48,7 @@
 #define STICKER_SYNC_FEATURE_REQ "sticker-sync-feature-req"
 #define STICKER_SYNC_FEATURE_RSP "sticker-sync-feature-rsp"
 #define STICKER_REQUEST_SYNC_REQ "sticker-request-sync-req"
+#define STICKER_REQUEST_NOTI_REQ "sticker-request-noti-req"
 #define STICKER_SYNC_START_REQ "sticker-sync-start-req"
 #define STICKER_SYNC_START_RSP "sticker-sync-start-rsp"
 #define STICKER_SEND_START_REQ "sticker-send-start-req"
@@ -488,6 +489,25 @@ void send_disconnect_message()
     json_object_unref(j_object);
 }
 
+void request_show_sync_notification()
+{
+    JsonObject *j_object = NULL;
+    j_object = json_object_new();
+    if (j_object == NULL) {
+        LOGE("json object create error");
+        return;
+    }
+
+    json_object_set_string_member(j_object, "msgId", STICKER_REQUEST_NOTI_REQ);
+    json_object_set_int_member(j_object, "tID", ++t_id);
+
+    if (_send_json_data(j_object) == FALSE) {
+        LOGE("Failed to send STICKER_REQUEST_NOTI_REQ");
+    }
+
+    json_object_unref(j_object);
+}
+
 void reject_file()
 {
     int ret = sap_file_transfer_reject(priv_data.file_socket);
index 0de1ef9..c959151 100644 (file)
@@ -99,10 +99,16 @@ static bool check_sync_time_condition()
 
         // compare time
         LOGD("current time : %f, last_sync_time : %f", ecore_time_get(), last_sync_time);
-        if (ecore_time_get() - last_sync_time > SYNC_INTERVAL)
-            result = true;
-        else
+
+        if (ecore_time_get() - last_sync_time > MAX_WAIT_TIME) {
+            request_show_sync_notification();
             result = false;
+        } else {
+            if (ecore_time_get() - last_sync_time > SYNC_INTERVAL)
+                result = true;
+            else
+                result = false;
+        }
     }
     else
     {