tizen 2.3.1 release
[framework/api/messages.git] / include / messages_types.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __TIZEN_MESSAGING_TYPES_H__
18 #define __TIZEN_MESSAGING_TYPES_H__
19
20 #include <stdbool.h>
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26
27 /**
28  * @addtogroup CAPI_MESSAGING_MESSAGES_MODULE
29  * @{
30  */
31
32 /**
33  * @brief The messaging service handle.
34  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
35  */
36 typedef struct messages_service_s *messages_service_h;
37
38
39 /**
40  * @brief The message handle.
41  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
42  */
43 typedef struct messages_message_s *messages_message_h;
44
45 /**
46  * @brief Enumeration for the message box type.
47  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
48  */
49 typedef enum {
50         MESSAGES_MBOX_ALL = 0,      /**< All message box type */
51         MESSAGES_MBOX_INBOX = 1,    /**< Inbox type */
52         MESSAGES_MBOX_OUTBOX = 2,   /**< Outbox type*/
53         MESSAGES_MBOX_SENTBOX = 3,  /**< Sentbox type */
54         MESSAGES_MBOX_DRAFT = 4,    /**< Draft type */
55 } messages_message_box_e;
56
57
58 /**
59  * @brief Enumeration for the message type.
60  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
61  */
62 typedef enum {
63         MESSAGES_TYPE_UNKNOWN = 0,                                        /**< Unknown type */
64         MESSAGES_TYPE_SMS = 1,                                            /**< SMS type */
65         MESSAGES_TYPE_MMS = 2,                                            /**< MMS type */
66         MESSAGES_TYPE_SMS_CB   = MESSAGES_TYPE_SMS | 1 << 4,              /**< CB(Cell Broadcast) Type */
67         MESSAGES_TYPE_SMS_PUSH = MESSAGES_TYPE_SMS | 10 << 4,             /**< WAP Push Type */
68         MESSAGES_TYPE_SMS_ETWS_PRIMARY = MESSAGES_TYPE_SMS | 21 << 4,     /**< ETWS(Earthquake and Tsunami Warning System) Primary Type */
69         MESSAGES_TYPE_SMS_ETWS_SECONDARY = MESSAGES_TYPE_SMS | 22 << 4,   /**< ETWS(Earthquake and Tsunami Warning System) Secondary Type */
70 } messages_message_type_e;
71
72
73 /**
74  * @brief Enumeration for the attachment type for MMS messaging.
75  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
76  */
77 typedef enum {
78         MESSAGES_MEDIA_UNKNOWN = 0,  /**< Unknown */
79         MESSAGES_MEDIA_IMAGE = 1,    /**< The image */
80         MESSAGES_MEDIA_AUDIO = 2,    /**< The audio */
81         MESSAGES_MEDIA_VIDEO = 3,    /**< The video */
82 } messages_media_type_e;
83
84 /**
85  * @brief Enumeration for the recipient type of a message.
86  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
87  */
88 typedef enum {
89         MESSAGES_RECIPIENT_UNKNOWN = 0, /**< Unknown */
90         MESSAGES_RECIPIENT_TO = 1,      /**< The 'To' recipient  */
91         MESSAGES_RECIPIENT_CC = 2,      /**< The 'Cc' (carbon copy) recipient */
92         MESSAGES_RECIPIENT_BCC = 3,     /**< The 'Bcc' (blind carbon copy) recipient */
93 } messages_recipient_type_e;
94
95 /**
96  * @brief Enumeration for the result of sending a message.
97  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
98  */
99 typedef enum {
100         MESSAGES_SENDING_FAILED = -1,   /**< Message sending failed */
101         MESSAGES_SENDING_SUCCEEDED = 0, /**< Message sending succeeded */
102 } messages_sending_result_e;
103
104 /**
105  * @brief Enumeration for the SIM index of a message.
106  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
107  */
108 typedef enum {
109         MESSAGES_SIM_INDEX_UNKNOWN = 0, /**< Unknown SIM Index*/
110         MESSAGES_SIM_INDEX_1 = 1,               /**< SIM Index 1 */
111         MESSAGES_SIM_INDEX_2 = 2,               /**< SIM Index 2 */
112 } messages_sim_index_e;
113
114 /**
115  * @brief Called when the process of sending a message to all recipients finishes.
116  *
117  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
118  *
119  * @param[in] result     The result of message sending
120  * @param[in] user_data  The user data passed from the callback registration function
121  *
122  * @pre messages_send_message() will invoke this callback function.
123  *
124  * @see messages_send_message()
125  */
126 typedef void (* messages_sent_cb)(messages_sending_result_e result, void *user_data);
127
128
129 /**
130  * @brief Called when an incoming message is received.
131  *
132  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
133  *
134  * @param[in] incoming_msg  The incoming message
135  * @param[in] user_data     The user data passed from the callback registration function
136  *
137  * @pre You register this callback using messages_set_message_incoming_cb() for getting an incoming message.
138  *
139  * @see messages_set_message_incoming_cb()
140  * @see messages_unset_message_incoming_cb()
141  */
142 typedef void (* messages_incoming_cb)(messages_message_h incoming_msg, void *user_data);
143
144
145 /**
146  * @brief Called when a message is retrieved from a search request.
147  *
148  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
149  *
150  * @remarks You should not call messages_destroy_message() with @a msg.
151  *
152  * @param[in] msg          The message handle \n
153  *                         It can be @c NULL if nothing is found.
154  * @param[in] user_data    The user data passed from the foreach function
155  * @param[in] index        The index of a message from the messages that have been retrieved as a search result
156  * @param[in] result_count The count of the messages that have been retrieved as a result applying @a limit and @a offset \n
157  *                         If the search has a @a limit, then this value is always equal or less than the limit.
158  * @param[in] total_count  The count of the messages that have been retrieved as a result without applying @a limit and @a offset \n
159  *                         The value can be used to calculate the total number of page views for the searched messages. \n
160  *                          For example, if the count of message search is @c 50 and the limit is @c 20, then using this value, you can notice the total page is @c 3.
161  *
162  * @return @c true to continue with the next iteration of the loop,
163  *         otherwise return @c false to break out of the loop
164  *
165  * @pre messages_foreach_message() will invoke this callback function.
166  *
167  * @see messages_foreach_message()
168  */
169 typedef bool (* messages_search_cb)(messages_message_h msg, int index, int result_count, int total_count, void *user_data);
170
171
172  /**
173  * @addtogroup CAPI_MESSAGING_MESSAGES_PUSH_MODULE
174  * @{
175  */
176
177 /**
178  * @brief Called when an incoming push message is received.
179  *
180  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
181  *
182  * @param[in] header      The header of the push message
183  * @param[in] body        The body of the push message \n
184  *                        It is not a null-terminated string.
185  * @param[in] body_length The length of @a body
186  * @param[in] user_data   The user data to be passed to the callback function
187  *
188  * @pre You register this callback using messages_push_set_incoming_cb() for getting an incoming message.
189  *
190  * @see messages_push_set_incoming_cb()
191  * @see messages_push_unset_incoming_cb()
192  */
193 typedef void (* messages_push_incoming_cb)(const char *header, const char *body, int body_length, void *user_data);
194
195 /**
196  * @}
197  */
198
199
200 /**
201  * @}
202  */
203
204 #ifdef __cplusplus
205 }
206 #endif
207
208 #endif /* __TIZEN_MESSAGING_TYPES_H__ */