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
41 PUSHLOG_ERROR_NONE = 1000,
43 // Server reply error code. This should be synchronized with local_msg.h
44 PUSHLOG_ERROR_SUCCESS=1000,
45 PUSHLOG_ERROR_SUCCESS_AND_NO_UPDATE=1010, //this is not neccessary in client side. this rc will be replaced to 1000
46 PUSHLOG_ERROR_WRONG_REQUEST_FORMAT=2001,
47 PUSHLOG_ERROR_BLOCKED_DEVICE_TOKEN=2002,
48 PUSHLOG_ERROR_TOO_LONG_REQUEST_MSG=2003,
49 PUSHLOG_ERROR_EXCEEDED_DAILY_QUOTA=2004,
50 PUSHLOG_ERROR_FAIL_TO_AUTHENTICATE = 3001,
52 PUSHLOG_ERROR_WRONG_APP_ID = 4010,
53 PUSHLOG_ERROR_EMPTY_SERVICE = 4013,
54 PUSHLOG_ERROR_EMPTY_MESSAGES = 4014,
56 PUSHLOG_ERROR_NETWORK_NOT_AVAILABLE = -2,
57 PUSHLOG_ERROR_INVALID_REQUEST = -200,
58 PUSHLOG_ERROR_LOG_SIZE_OVER = -202,
59 PUSHLOG_ERROR_INVALID_LOG_STATUS = -204,
60 PUSHLOG_ERROR_ALREADY_REQUESTED = -205,
61 PUSHLOG_ERROR_LOGGING_FAIL = -206,
62 PUSHLOG_ERROR_REQUEST_TURN_OVER = -207,
63 PUSHLOG_ERROR_LOG_NOT_ACTIVATION = -208,
65 PUSHLOG_ERROR_INVALID_PARAMETER = -1000,
66 PUSHLOG_ERROR_OUT_OF_MEMORY,
67 PUSHLOG_ERROR_OPERATION_FAILED,
68 PUSHLOG_ERROR_CONNECT_FAIL,
69 PUSHLOG_ERROR_INTERNAL_SERVER_ERROR=8002,
70 PUSHLOG_ERROR_PANIC=9999
75 * @brief Enumerations of registration state
78 PUSHLOG_STATE_CONNECTED, /**< Connected to SPPCD */
79 PUSHLOG_STATE_DISCONNECTED, /**< Disconnected from SPPCD */
81 PUSHLOG_STATE_ERROR, /**< Error */
86 * @brief Push log service handle
88 typedef struct pushlog_connection_s *pushlog_connection_h;
92 * @brief Push log data handle
94 typedef void *pushlog_data;
97 * @brief Notification callback for logging service status
98 * @param[in] log_req_type status of logging service
99 * @param[in] result error code if any.
100 * PUSHLOG_ERROR_NONE indicates success.
101 * @param[in] user_data User data set with pushlog_connect()
102 * @see pushlog_connect()
104 typedef void (*pushlog_state_cb)(
105 pushlog_state_e state, pushlog_error_e err,
109 * @brief Notification callback invoked for pushlog_send_data() api response
110 * @param[in] log_id log id set while sending the data
111 * @param[in] result error code if any.
112 * PUSHLOG_ERROR_NONE indicates success.
113 * @param[in] user_data User data set with pushlog_connect()
114 * @see pushlog_connect()
116 typedef void (*pushlog_send_cb)(
117 const char *log_id, pushlog_error_e err,
121 * @brief Connects to the push log service and sets callback functions
122 * @remarks The status of connection between an application and the push log service,
123 * is indicated with the callback push_log_status_cb.
124 * Connection should be freed with @ref pushlog_disconnect() by you.
125 * @param[in] status_cb connection status callback
126 * @param[in] send_cb callback to receive pushlog_send_data() response
127 * @param[in] user_data User data to pass to <I>state_cb</I> and <I>notify_cb</I>
128 * @param[in] service A @ref Service handle to launch an application by
129 * an posted UI notification
130 * @param[out] log_h Handle of a connection to the push log service
131 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
132 * @see push_disconnect()
134 pushlog_error_e pushlog_connect(const char *service_name,
135 pushlog_state_cb status_cb,
136 pushlog_send_cb send_cb,
137 void *cb_data, app_control_h service,
138 pushlog_connection_h *log_h);
141 * @brief Disconnect push log service
142 * @remarks If there is a connection between an application and the push service,
143 * the notify callback passes the notification upon its arrival.
144 * Otherwise, the push service posts a UI notification to alert users.
145 * Connection should be freed with @ref push_disconnect() by you.
146 * @param[in] log_h Handle of a connection to the push log service
147 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
148 * @see pushlog_connect()
150 pushlog_error_e pushlog_disconnect(pushlog_connection_h log_h);
153 * @brief Send log data to server
155 * @param[in] log_h Handle of a connection to the push log service
156 * @param[in] log_prefix Data setting for prefix of log.
157 * @param[in] log_id log id
158 * @param[in] data_h Data to be sent
159 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
161 pushlog_error_e pushlog_send(pushlog_connection_h log_h,
162 const char *log_prefix,
163 const char *log_id, pushlog_data data_h);
167 * @brief Get push log service's configurations
169 * @param[in] log_h Handle of a connection to the push log service
170 * @param[in] item_size
171 * @param[out] unlimited_sending
172 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
174 pushlog_error_e pushlog_get_config(pushlog_connection_h log_h,
175 int *item_size, bool *unlimited_sending);
180 * @param[in] log_h Handle of a connection to the push log service
182 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
184 pushlog_error_e pushlog_get_state(pushlog_connection_h log_h,
185 pushlog_state_e *state);
191 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
193 pushlog_error_e pushlog_create_data(pushlog_data *data);
201 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
203 pushlog_error_e pushlog_add_data(pushlog_data data, char *value, int len);
209 * @return PUSHLOG_ERROR_NONE on success, otherwise a indicated by push_log_error_e.
211 pushlog_error_e pushlog_free_data(pushlog_data data);
218 #endif /* PUSHLOG_H_ */