Split sticker data into another file 29/228029/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 18 Mar 2020 07:50:30 +0000 (16:50 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 18 Mar 2020 08:09:21 +0000 (17:09 +0900)
Change-Id: I3c23542e657757e0250fea67effb196677ae08c7
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
receiver/CMakeLists.txt
receiver/inc/sticker_data.h [new file with mode: 0644]
receiver/inc/sticker_info.h
receiver/src/ft.cpp
receiver/src/sticker_data.cpp [new file with mode: 0644]

index 73d4503..4a875d9 100644 (file)
@@ -3,6 +3,7 @@ PROJECT(sticker-receiver CXX)
 
 SET(SRCS
        src/main.cpp
+       src/sticker_data.cpp
        src/ft.cpp
        src/sticker_info.cpp
        src/message.cpp
diff --git a/receiver/inc/sticker_data.h b/receiver/inc/sticker_data.h
new file mode 100644 (file)
index 0000000..97f82cc
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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_DATA_H__
+#define __STICKER_DATA_H__
+
+#include <string>
+
+using namespace std;
+
+struct sticker_info {
+    sticker_info();
+    ~sticker_info();
+
+    void reset();
+
+    string file_path;
+    string group;
+    string keyword;
+    string disp_type;
+    string description;
+};
+
+#endif /* __STICKER_DATA_H__ */
index 86b6c88..8231585 100644 (file)
@@ -21,4 +21,4 @@ int create_sticker_provider_handle(void);
 void destroy_sticker_provider_handle(void);
 void delete_sticker_data(const char *fileName);
 
-#endif /* __STICKER_INF_H__ */
+#endif /* __STICKER_INFO_H__ */
index 61afdc0..4a2ec79 100644 (file)
@@ -35,6 +35,7 @@
 #include "ft.h"
 #include "log.h"
 #include "sticker_info.h"
+#include "../inc/sticker_data.h"
 #include "message.h"
 #include "sync_alarm.h"
 
@@ -77,21 +78,6 @@ struct request {
     string type;
 };
 
-static void _reset_sticker_data();
-
-struct sticker_info {
-    string file_path;
-    string group;
-    string keyword;
-    string disp_type;
-    string description;
-
-    sticker_info()
-    {
-        _reset_sticker_data();
-    }
-};
-
 static struct sap_info_s priv_data = { 0 };
 static struct sticker_info sticker_data;
 static struct request pending_request, current_request;
@@ -393,14 +379,6 @@ void conn_terminated(sap_peer_agent_h peer_agent,
     service_app_exit();
 }
 
-static void _reset_sticker_data()
-{
-    sticker_data.file_path.clear();
-    sticker_data.group.clear();
-    sticker_data.keyword.clear();
-    sticker_data.disp_type.clear();
-    sticker_data.description.clear();
-}
 
 void
 on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned int payload_length, void *buffer,
@@ -525,7 +503,7 @@ 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());
-        _reset_sticker_data();
+        sticker_data.reset();
 
         const char *type_data = json_object_get_string_member(root_obj, "type");
         if (type_data)
diff --git a/receiver/src/sticker_data.cpp b/receiver/src/sticker_data.cpp
new file mode 100644 (file)
index 0000000..bd94ee5
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+#include "../inc/sticker_data.h"
+
+sticker_info::sticker_info()
+{
+    reset();
+}
+
+sticker_info::~sticker_info()
+{
+
+}
+
+void sticker_info::reset()
+{
+    file_path.clear();
+    group.clear();
+    keyword.clear();
+    disp_type.clear();
+    description.clear();
+}
\ No newline at end of file