3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 * @Common_Define_Internal.h
21 * @brief This file is the header file of defined common structure for using between SE and SA
24 #ifndef COMMON_DEFINE_INTERNAL_H_
25 #define COMMON_DEFINE_INTERNAL_H_
32 /* #define COMMUNICATION_TYPE SYNC_AGENT_PB_ENCODING_XML */
33 #define COMMUNICATION_TYPE SYNC_AGENT_PB_ENCODING_WBXML_12
35 #define TRANSPORT_TYPE 1 /*http */
36 /*#define TRANSPORT_TYPE "FW_MOBEX" *//*mobex -> does not support in OMA */
38 #define NETWORK_TIMEOUT 60
40 #define MAXIMUM_ACCOUNT_COUNT 5
42 #define PKG_NAME "oma-ds-agent"
43 #define DEFINE_PLATFORM 1
44 #define LOW_BATTERY_LEVEL 10
46 #define OMA_DS_MSG_PATH "/opt/usr/data/oma-ds/debug_msg"
47 #define OMA_DS_CSC_CHECK_PATH "/opt/usr/data/oma-ds/csc_check"
49 #define ELEMENT_TEXT_VCARD "text/x-vcard"
50 #define ELEMENT_TEXT_VCARD_30 "text/vcard"
51 #define ELEMENT_TEXT_VCAL "text/x-vcalendar"
52 #define ELEMENT_TEXT_ICAL "text/calendar"
53 #define ELEMENT_TEXT_PLAIN "text/plain"
54 #define ELEMENT_TEXT_XCALLLOG "text/x-calllog"
55 #define ELEMENT_TEXT_MESSAGE "text/x-vMessage"
57 #define DEFINE_ALERT_UNKNOWN_STR "Unknown"
58 #define DEFINE_ALERT_SLOW_SYNC_STR "Full"
59 #define DEFINE_ALERT_TWO_WAY_STR "Update both"
60 #define DEFINE_ALERT_ONE_WAY_FROM_CLIENT_STR "Update to server"
61 #define DEFINE_ALERT_ONE_WAY_FROM_SERVER_STR "Update to phone"
62 #define DEFINE_ALERT_REFRESH_FROM_SERVER_STR "Refresh from server"
63 #define DEFINE_ALERT_REFRESH_FROM_CLIENT_STR "Refresh from phone"
65 #define DEFINE_ALERT_SLOW_SYNC_VALUE "201"
66 #define DEFINE_ALERT_TWO_WAY_VALUE "200"
67 #define DEFINE_ALERT_ONE_WAY_FROM_CLIENT_VALUE "202"
68 #define DEFINE_ALERT_ONE_WAY_FROM_SERVER_VALUE "204"
69 #define DEFINE_ALERT_REFRESH_FROM_SERVER_VALUE "205"
70 #define DEFINE_ALERT_REFRESH_FROM_CLIENT_VALUE "203"
72 #define DEFINE_CONFIG_KEY_PROFILE_SERVER_ID "Server_id"
73 #define DEFINE_CONFIG_KEY_PROFILE_SYNC_MODE "Sync_mode"
74 #define DEFINE_CONFIG_KEY_PROFILE_SERVER_IP "Server_ip"
75 #define DEFINE_CONFIG_KEY_PROFILE_NEXT_NONCE "Next_nonce"
76 #define DEFINE_CONFIG_KEY_PROFILE_DIR_NAME "Dir_name"
77 #define DEFINE_CONFIG_KEY_PROFILE_SYNCHRONISING "Synchronising"
78 #define DEFINE_CONFIG_KEY_PROFILE_RESUME "Resume"
79 #define DEFINE_CONFIG_KEY_PROFILE_NAME "Name"
80 #define DEFINE_CONFIG_KEY_PROFILE_CLIENT_SYNC_TYPE "Client_Sync_type"
81 #define DEFINE_CONFIG_KEY_PROFILE_SERVER_SYNC_TYPE "Server_Sync_type"
82 #define DEFINE_CONFIG_KEY_PROFILE_SYNC_INTERVAL "Sync_interval"
83 #define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_CONTACTS "Contacts"
84 #define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_CALENDAR "Organizer"
85 #define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_MEMO "Memo"
86 #define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_CALLLOG "CallLog"
87 #define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_SOURCE "source"
88 #define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_TARGET "target"
89 #define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_ID "id"
90 #define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_PASSWORD "password"
91 #define DEFINE_CONFIG_KEY_PROFILE_LAST_SESSION_STATUS "Last_session_status"
92 #define DEFINE_CONFIG_KEY_PROFILE_LAST_SESSION_TIME "Last_session_time"
93 #define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_DBSYNCED "dbSynced"
94 #define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_LAST_TIME "last_session_time"
95 #define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_TOTAL "numberOfChanges"
96 #define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_NROFADD "add_count"
97 #define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_NROFDELETE "delete_count"
98 #define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_NROFREPLACE "replace_count"
99 #define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_SERVER "server"
100 #define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_CLIENT "client"
101 #define DEFINE_CONFIG_KEY_PROFILE_ALARM_ID "Alarm_id"
103 #define DEFINE_SYNC_MODE_MANUAL "Manual"
104 #define DEFINE_SYNC_MODE_PUSH "Push"
105 #define DEFINE_SYNC_MODE_PERIODIC "Periodic"
107 #define DEFINE_SOURCE_CONTACT_URI "Contacts"
108 #define DEFINE_SOURCE_CALENDAR_URI "Organizer"
109 #define DEFINE_SOURCE_MEMO_URI "Memo"
110 #define DEFINE_SOURCE_CALLLOG_URI "CallLog"
112 #define DEFINE_DIVE_SERVER_URL_HTTPS "https://syn.samsungdive.com/sync"
113 #define DEFINE_DIVE_SERVER_URL_HTTP "http://syn.samsungdive.com/sync"
114 #define DEFINE_DIVE_SERVER_ID "syn.samsungdive.com"
115 #define DEFINE_DIVE_DEFAULT_NEXT_NONCE "pcwds"
118 SYNC_SESSION_NOT_SYNCED_YET = -1,
119 SYNC_SESSION_FAILED = 0,
120 SYNC_SESSION_SUCCEEDED = 1,
121 SYNC_SESSION_STOPPED = 2,
122 SYNC_SESSION_SYNCHRONIZING = 3
123 } sync_session_result_e;
129 ALERT_SLOW_SYNC = 201,
130 ALERT_ONE_WAY_FROM_CLIENT = 202,
131 ALERT_REFRESH_FROM_CLIENT = 203,
132 ALERT_ONE_WAY_FROM_SERVER = 204,
133 ALERT_REFRESH_FROM_SERVER = 205,
134 ALERT_TWO_WAY_BY_SERVER = 206,
135 ALERT_ONE_WAY_FROM_CLIENT_BY_SERVER = 207,
136 ALERT_REFRESH_FROM_CLIENT_BY_SERVER = 208,
137 ALERT_ONE_WAY_FROM_SERVER_BY_SERVER = 209,
138 ALERT_REFRESH_FROM_SERVER_BY_SERVER = 210,
140 ALERT_NEXT_MESSAGE = 222,
141 ALERT_NO_END_OF_DATA = 223,
165 COMMON_MISCONFIGURATION = 200,
166 COMMON_AUTHENTICATION_ERROR = 201,
167 COMMON_NOT_FOUND = 202,
168 COMMON_NO_MEMORY = 203,
169 COMMON_INTERNAL_ERROR = 204,
170 COMMON_SERVER_ERROR = 205,
171 COMMON_CONNECTION_ERROR = 206,
172 COMMON_AUTOCONFIG_NOT_SUPPORT_BY_SERVER = 207,
173 COMMON_BUSY_SIGNALING = 208,
174 COMMON_SUSPEND_FAIL = 209,
176 } common_error_type_e;
179 sync_session_result_e session_result;
180 unsigned int number_of_change;
181 unsigned int received_count;
182 unsigned int add_count;
183 unsigned int replace_count;
184 unsigned int delete_count;
188 * @brief Data Store information
189 * relevant information about Data Store\n
193 int datastore_id; /**< plugin_type : TYPE_CONTACT, TYPE_CALENDAR, TYPE_MEMO, TYPE_CALL_LOG */
194 int folder_type_id; /**< folder type id 0 */
195 char *target; /**< target(server) URI */
196 char *source; /**< source(client) URI */
197 char *id; /**< account id */
198 char *pw; /**< account pw */
199 alert_type_e client_sync_type; /**< Sync Type(two-way, one-way ...) */
200 alert_type_e server_sync_type; /**< Sync Type(two-way, one-way ...) */
201 char *last_anchor_client; /**< Last Anchor of datastore for client side */
202 char *next_anchor_client; /**< Next Anchor of datastore for client side */
203 char *last_anchor_server; /**< Next Anchor of datastore for server side */
204 char *next_anchor_server; /**< Next Anchor of datastore for server side */
205 sync_result_s *client_sync_result;
206 sync_result_s *server_sync_result;
210 char *target; /**< target(server) URI */
211 char *source; /**< source(client) URI */
212 alert_type_e sync_type; /**< Sync Type(two-way, one-way ...) */
213 char *last_anchor; /**< Last Anchor of datastore for client side */
214 char *next_anchor; /**< Next Anchor of datastore for client side */
215 unsigned int max_obj_size;
219 @brief Third parameter of pre_sync function
221 Output data from pre_sync function\n
222 Data that need to be passed to Service Engine from Service Adapter result of pkg2
226 GList *datastore_info; /**< containing datastore_info structure*/
228 } pre_sync_return_obj_s;
231 @brief a changed item(changelog)
235 change_type_e change_type; /**< type of changes (add, replace, delete, copy, move ..) */
236 char *luid; /**< luid of item */
237 char *content_type; /**< content type of data */
238 unsigned int index_of_datastore;
239 char *data; /**< data */
243 @brief item that are grouped by each Data Store
247 char *source; /**< source(client) URI */
248 char *target; /**< target(server) URI */
249 int need_sync_command;
250 unsigned int number_of_changes;
251 int has_number_of_changes;
253 GList *change_item; /**< containing changed_item all type */
254 GList *sent_item; /**< containing changed_item */
255 } changed_datastore_s;
258 @brief result of applied command that from service engine or server
262 change_type_e change_type; /**< change type (add, replace, delete...) */
263 char *luid; /**< luid of item */
264 int status; /**< status of applied item */
268 char *source; /**< source(client) URI */
269 char *target; /**< target(server) URI */
270 GList *items; /**< containing appllied_status struct */
274 @brief second and third parameter of sync function
278 GList *changed_datastore; /**< containing changed_datastore structure when it's in SyncObj it will be command that client send to server */
279 GList *sending_status; /**< containing sending_status structure when it's in SyncObj status of add, replace, delete command from server */
283 GList *changed_datastore; /**< containing changed_datastore structure when it's in SyncReturnObj command(add, relpace, delete) from server */
284 GList *status; /**< containing applied_status structure when it's in SyncReturnObj return to engine(status of add, replace, delete command that client sent to server)*/
288 service_type_e service_type;
305 extern datastore_s *datastoreinfo_per_content_type[4];
307 #endif /* COMMON_DEFINE_INTERNAL_H_ */