2 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 * Created on: Dec 17, 2012
36 * @brief Enumerations of error codes for push log service
40 PUSHLOG_ERROR_NONE = 1000,
42 // Server reply error code. This should be synchronized with local_msg.h
43 PUSHLOG_ERROR_SUCCESS = 1000,
44 PUSHLOG_ERROR_SUCCESS_AND_NO_UPDATE = 1010, //this is not neccessary in client side. this rc will be replaced to 1000
45 PUSHLOG_ERROR_WRONG_REQUEST_FORMAT = 2001,
46 PUSHLOG_ERROR_BLOCKED_DEVICE_TOKEN = 2002,
47 PUSHLOG_ERROR_TOO_LONG_REQUEST_MSG = 2003,
48 PUSHLOG_ERROR_EXCEEDED_DAILY_QUOTA = 2004,
49 PUSHLOG_ERROR_FAIL_TO_AUTHENTICATE = 3001,
51 PUSHLOG_ERROR_WRONG_APP_ID = 4010,
52 PUSHLOG_ERROR_EMPTY_SERVICE = 4013,
53 PUSHLOG_ERROR_EMPTY_MESSAGES = 4014,
55 PUSHLOG_ERROR_NETWORK_NOT_AVAILABLE = -2,
56 PUSHLOG_ERROR_INVALID_REQUEST = -200,
57 PUSHLOG_ERROR_LOG_SIZE_OVER = -202,
58 PUSHLOG_ERROR_INVALID_LOG_STATUS = -204,
59 PUSHLOG_ERROR_ALREADY_REQUESTED = -205,
60 PUSHLOG_ERROR_LOGGING_FAIL = -206,
61 PUSHLOG_ERROR_REQUEST_TURN_OVER = -207,
62 PUSHLOG_ERROR_LOG_NOT_ACTIVATION = -208,
64 PUSHLOG_ERROR_INVALID_PARAMETER = -1000,
65 PUSHLOG_ERROR_OUT_OF_MEMORY,
66 PUSHLOG_ERROR_OPERATION_FAILED,
67 PUSHLOG_ERROR_CONNECT_FAIL,
68 PUSHLOG_ERROR_INTERNAL_SERVER_ERROR = 8002,
69 PUSHLOG_ERROR_PANIC = 9999
74 * @brief Enumerations of registration state
77 PUSHLOG_STATE_CONNECTED, /**< Connected to SPPCD */
78 PUSHLOG_STATE_DISCONNECTED, /**< Disconnected from SPPCD */
80 PUSHLOG_STATE_ERROR, /**< Error */
85 * @brief Push log service handle
87 typedef struct pushlog_connection_s *pushlog_connection_h;
91 * @brief Push log data handle
93 typedef void *pushlog_data;
96 * @brief Notification callback for logging service status
97 * @param[in] log_req_type status of logging service
98 * @param[in] result error code if any.
99 * PUSHLOG_ERROR_NONE indicates success.
100 * @param[in] user_data User data set with pushlog_connect()
101 * @see pushlog_connect()
103 typedef void (*pushlog_state_cb)(
104 pushlog_state_e state, pushlog_error_e err,
108 * @brief Notification callback invoked for pushlog_send_data() api response
109 * @param[in] log_id log id set while sending the data
110 * @param[in] result error code if any.
111 * PUSHLOG_ERROR_NONE indicates success.
112 * @param[in] user_data User data set with pushlog_connect()
113 * @see pushlog_connect()
115 typedef void (*pushlog_send_cb)(
116 const char *log_id, pushlog_error_e err,
120 * @brief Connects to the push log service and sets callback functions
121 * @remarks The status of connection between an application and the push log service,
122 * is indicated with the callback push_log_status_cb.
123 * Connection should be freed with @ref pushlog_disconnect() by you.
124 * @param[in] status_cb connection status callback
125 * @param[in] send_cb callback to receive pushlog_send_data() response
126 * @param[in] user_data User data to pass to <I>state_cb</I> and <I>notify_cb</I>
127 * @param[in] service A @ref Service handle to launch an application by
128 * an posted UI notification
129 * @param[out] log_h Handle of a connection to the push log service
130 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
131 * @see push_disconnect()
133 pushlog_error_e pushlog_connect(const char *service_name,
134 pushlog_state_cb status_cb,
135 pushlog_send_cb send_cb,
136 void *cb_data, app_control_h service,
137 pushlog_connection_h *log_h);
140 * @brief Disconnect push log service
141 * @remarks If there is a connection between an application and the push service,
142 * the notify callback passes the notification upon its arrival.
143 * Otherwise, the push service posts a UI notification to alert users.
144 * Connection should be freed with @ref push_disconnect() by you.
145 * @param[in] log_h Handle of a connection to the push log service
146 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
147 * @see pushlog_connect()
149 pushlog_error_e pushlog_disconnect(pushlog_connection_h log_h);
152 * @brief Send log data to server
154 * @param[in] log_h Handle of a connection to the push log service
155 * @param[in] log_prefix Data setting for prefix of log.
156 * @param[in] log_id log id
157 * @param[in] data_h Data to be sent
158 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
160 pushlog_error_e pushlog_send(pushlog_connection_h log_h,
161 const char *log_prefix,
162 const char *log_id, pushlog_data data_h);
166 * @brief Get push log service's configurations
168 * @param[in] log_h Handle of a connection to the push log service
169 * @param[in] item_size
170 * @param[out] unlimited_sending
171 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
173 pushlog_error_e pushlog_get_config(pushlog_connection_h log_h,
174 int *item_size, bool *unlimited_sending);
179 * @param[in] log_h Handle of a connection to the push log service
181 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
183 pushlog_error_e pushlog_get_state(pushlog_connection_h log_h,
184 pushlog_state_e *state);
190 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
192 pushlog_error_e pushlog_create_data(pushlog_data *data);
200 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
202 pushlog_error_e pushlog_add_data(pushlog_data data, char *value, int len);
208 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
210 pushlog_error_e pushlog_free_data(pushlog_data data);
217 #endif /* PUSHLOG_H_ */