summaryrefslogtreecommitdiff
path: root/include/mapi/msg_transport.h
blob: 9badbe7b8805e7fa35369078e14d16b58c14dee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
/*
 * Copyright (c) 2014 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 MAPI_TRANSPORT_H
#define MAPI_TRANSPORT_H

/*==================================================================================================
                                         INCLUDE FILES
==================================================================================================*/

#include "msg_transport_types.h"

#ifdef __cplusplus
extern "C"
{
#endif

/**
 * @ingroup MSG_SERVICE_FRAMEWORK
 * @defgroup MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE Transport API
 * @brief The Transport API provides functions to send SMS/MMS and register incoming/sending/syncML/report callback.
 *
 * @addtogroup MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE
 * @{
 *
 * @section MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE_HEADER Required Header
 *   \#include <msg_transport.h>
 *
 * @section MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE_OVERVIEW Overview
 *
 * The Transport API provides the following functionalities:
 *
 * - Sending SMS/MMS messages
 * - Register incoming message callback
 * - Register sent status callback
 * - Register push message application
 * - Register syncML message callback
 * - Managing the registration
 *
 * @section MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE_FEATURE Related Features
 * This API is related with the following features:\n
 *  - http://tizen.org/feature/network.telephony\n
 *  - http://tizen.org/feature/network.telephony.sms\n
 *  - http://tizen.org/feature/network.telephony.mms\n
 *
 * It is recommended to design feature related codes in your application for reliability.\n
 *
 * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
 *
 * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
 *
 * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
 *
 */

/*==================================================================================================
                                     FUNCTION PROTOTYPES
==================================================================================================*/

/**
 * @brief Submits a request to the Messaging Framework.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.write
 *
 * @remarks The result information will be sent back by using the callback function, msg_sent_status_cb().
 * @remarks Applications MUST fill in the valid message type.
 * @remarks reqId will be filled in the framework.
 *
 * @param[in] handle  The message handle
 * @param[in] req     The pointer to an #MSG_REQUEST_S structure
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_TRANSPORT_ERROR   Transport error
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_submit_req(msg_handle_t handle, msg_struct_t req);


/**
 * @brief Registers sent status callback function to Message handle.
 * @details This API is used to register sent status callback function msg_sent_status_cb() to Message handle.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle      The message handle
 * @param[in] cb          The function to be called
 * @param[in] user_param  A pointer to user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_CALLBACK_ERROR    Callback registration error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_reg_sent_status_callback(msg_handle_t handle, msg_sent_status_cb cb, void *user_param);


/**
 * @brief Registers incoming SMS callback to Message handle.
 * @details This API is used to Registers incoming SMS callback function msg_sms_incoming_cb() to Message handle.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle      The message handle
 * @param[in] cb          The function to be called
 * @param[in] port        The port used for listening \n
 *                        If port is not used, set to @c 0.
 * @param[in] user_param  A pointer to user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_CALLBACK_ERROR    Callback registration error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_reg_sms_message_callback(msg_handle_t handle, msg_sms_incoming_cb cb, unsigned short port, void *user_param);


/**
 * @brief Registers incoming MMS conf callback to Message handle.
 * @details This API is used to Registers incoming MMS conf callback function msg_mms_conf_msg_incoming_cb() to Message handle.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle      The message handle
 * @param[in] cb          The function to be called
 * @param[in] app_id      The app ID used for listening \n
 *                        If appId is not used, set to @c NULL.
 * @param[in] user_param  A pointer to user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_CALLBACK_ERROR    Callback registration error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_reg_mms_conf_message_callback(msg_handle_t handle, msg_mms_conf_msg_incoming_cb cb, const char *app_id, void *user_param);


/**
 * @brief Registers incoming SyncML Message callback to Message handle.
 * @details This API is used to register incoming SyncML Message callback function msg_syncml_msg_incoming_cb() to Message handle.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle      The message handle
 * @param[in] cb          The function to be called
 * @param[in] user_param  A pointer to user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_CALLBACK_ERROR    Callback registration error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_reg_syncml_message_callback(msg_handle_t handle,  msg_syncml_msg_incoming_cb cb, void *user_param);


/**
 * @brief Registers incoming LBS Message callback to Message handle.
 * @details This API is used to register incoming LBS Message callback function msg_lbs_msg_incoming_cb() to Message handle.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle      The message handle
 * @param[in] cb          The function to be called
 * @param[in] user_param  A pointer to user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_CALLBACK_ERROR    Callback registration error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_reg_lbs_message_callback(msg_handle_t handle, msg_lbs_msg_incoming_cb cb, void *user_param);


/**
 * @brief Registers SyncML operation callback to Message handle.
 * @details This API is used to register SyncML operation callback function msg_syncml_msg_operation_cb() to Message handle.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle      The message handle
 * @param[in] cb          The function to be called
 * @param[in] user_param  A pointer to user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_CALLBACK_ERROR    Callback registration error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_reg_syncml_message_operation_callback(msg_handle_t handle,  msg_syncml_msg_operation_cb cb, void *user_param);


/**
 * @brief Registers incoming push Message callback to Message handle.
 * @details This API is used to register incoming push Message callback function msg_push_msg_incoming_cb() to Message handle.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle      The message handle
 * @param[in] cb          The function to be called
 * @param[in] app_id      The app ID for listening \n
 *                        If appId is not used, set to @c NULL.
 * @param[in] user_param  A pointer to user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_CALLBACK_ERROR    Callback registration error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_reg_push_message_callback(msg_handle_t handle,  msg_push_msg_incoming_cb cb, const char *app_id, void *user_param);


/**
 * @brief Registers incoming CB Message callback to Message handle.
 * @details This API is used to register incoming CB Message callback function msg_cb_incoming_cb() to Message handle.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle      The message handle
 * @param[in] cb          The function to be called
 * @param[in] bsave       A bool flag to indicate whether CB message is to be saved or not \n
 *                        CB message will be saved if this flag is true
 * @param[in] user_param  A pointer to user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_CALLBACK_ERROR    Callback registration error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_reg_cb_message_callback(msg_handle_t handle, msg_cb_incoming_cb  cb, bool bsave, void *user_param);



/**
 * @brief Registers incoming Report Message callback to Message handle.
 * @details This API is used to register incoming Report Message callback function msg_report_msg_incoming_cb() to Message handle.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle      The message handle
 * @param[in] cb          The function to be called
 * @param[in] user_param  A pointer to user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_CALLBACK_ERROR    Callback registration error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_reg_report_message_callback(msg_handle_t handle, msg_report_msg_incoming_cb cb, void *user_param);


/**
 * @brief Operates SyncML message.
 * @details This API is used to run SyncML operation.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.read
 *
 * @remarks This function MUST be called after Message handle is opened.
 *
 * @param[in] handle  The message handle
 * @param[in] msgId   The message ID to run SycnML operation
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_TRANSPORT_ERROR   Transport error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_syncml_message_operation(msg_handle_t handle, msg_message_id_t msgId);


/**
 * @brief Sends SMS.
 * @details This API is used to send SMS. It is a synchronous API which has been blocked until sent status arrives.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.write
 *
 * @param[in] phone_num   The list of phone numbers \n
 *                        It is separated by ",".
 * @param[in] sms_text    The SMS text
 * @param[in] cb          The function to be called
 * @param[in] user_param  The user data
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_MEMORY_ERROR      Memory error
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 *
 * \par Prospective clients:
 * External/Native Apps using Messaging Services.
 *
 */

int msg_sms_send(const char *phone_num, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param);


/**
 * @brief Submits request to send SMS message.
 * @details This API is used to submit request to send SMS message.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.write
 *
 * @param[in] handle The message handle
 * @param[in] req    A pointer to #msg_struct_t structure for SMS request information
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_NULL_POINTER      Null parameter
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_sms_send_message(msg_handle_t handle, msg_struct_t req);


/**
 * @brief Submits request to send MMS message.
 * @details This API is used to submit request to send MMS message.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.write
 *
 * @param[in] handle The message handle
 * @param[in] req    A pointer to #msg_struct_t structure for MMS request information
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_mms_send_message(msg_handle_t handle, msg_struct_t req);


/**
 * @brief Submits request to send MMS read report request.
 * @details This API is used to submit request to send MMS read report request.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.write
 *
 * @param[in] handle          The message handle
 * @param[in] msg_id          The message ID \n
 *                            This is a positive integer.
 * @param[in] mms_read_status This is status whether message was read or not
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_mms_send_read_report(msg_handle_t handle, msg_message_id_t msgId, msg_read_report_status_t mms_read_status);


/**
 * @brief Submits request to send forward MMS request.
 * @details This API is used to submit request to send forward MMS request.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.write
 *
 * @param[in] handle The message handle
 * @param[in] req    A pointer to #msg_struct_t structure for MMS
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_mms_forward_message(msg_handle_t handle, msg_struct_t req);


/**
 * @brief Submits request to retrieve MMS request.
 * @details This API is used to submit request to retrieve MMS request.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.write
 *
 * @param[in] handle  The message handle
 * @param[in] req     A pointer to #msg_struct_t structure for MMS
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_mms_retrieve_message(msg_handle_t handle, msg_struct_t req);


/**
 * @brief Submits request to reject MMS message.
 * @details This API is used to submit request to reject MMS message.
 *
 * @since_tizen 2.3
 * @privlevel public
 * @privilege %http://tizen.org/privilege/message.write
 *
 * @param[in] handle  The message handle
 * @param[in] req     A pointer to #msg_struct_t structure for MMS
 *
 * @return  @c 0 on success,
 *          otherwise a negative error value
 *
 * @retval MSG_SUCCESS               Success in operation
 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
 * @retval MSG_ERR_NOT_SUPPORTED     Not supported
 */

int msg_mms_reject_message(msg_handle_t handle, msg_struct_t req);

/**
 *	@}
 */

#ifdef __cplusplus
}
#endif

#endif /* MAPI_TRANSPORT_H */