3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
5 * This file is part of msg-service.
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 * Sangkoo Kim <sangkoo.kim@samsung.com>
9 * Seunghwan Lee <sh.cat.lee@samsung.com>
10 * SoonMin Jung <sm0415.jung@samsung.com>
11 * Jae-Young Lee <jy4710.lee@samsung.com>
12 * KeeBum Kim <keebum.kim@samsung.com>
14 * PROPRIETARY/CONFIDENTIAL
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
32 /*==================================================================================================
34 ==================================================================================================*/
36 #include "MsgSettingTypes.h"
37 #include "MapiTransport.h"
38 #include "MapiSetting.h"
39 #include "MsgTestTransport.h"
41 #include "MapiMessage.h"
43 /*==================================================================================================
44 FUNCTION IMPLEMENTATION
45 ==================================================================================================*/
47 MSG_ERROR_T MsgTestSubmitReq(MSG_HANDLE_T hMsgHandle, msg_message_t pMsg, MSG_SENDINGOPT_S* pSendOpt)
49 if ( !hMsgHandle || !pMsg )
51 MSG_DEBUG("Handle or pMsg is NULL");
52 return MSG_ERR_NULL_MSGHANDLE;
55 MSG_ERROR_T err = MSG_SUCCESS;
57 MSG_REQUEST_S req = {0};
62 memcpy(&req.sendOpt, pSendOpt, sizeof(req.sendOpt));
64 MSG_DEBUG("==== [MsgTestSubmitReq] MSG ID = [%d] ====", msg_get_message_id(req.msg));
65 MSG_DEBUG("==== [MsgTestSubmitReq] Folder ID = [%d] ====", msg_get_folder_id(req.msg));
66 MSG_DEBUG("==== [MsgTestSubmitReq] Message Type = [%d] ====", msg_get_message_type(req.msg));
67 MSG_DEBUG("==== [MsgTestSubmitReq] # number = [%d] ====", msg_get_address_count(req.msg));
68 MSG_DEBUG("==== [MsgTestSubmitReq] to = [%s] ====", msg_get_ith_address(req.msg, 0));
69 // MSG_DEBUG("==== [MsgTestSubmitReq] Message Data = [%s] ====", msg_sms_get_message_body(req.msg));
70 MSG_DEBUG("==== [MsgTestSubmitReq] Message Data size = [%d] ====", msg_get_message_body_size(req.msg));
72 MSG_DEBUG("==== [MsgTestSubmitReq] sendOpt : bSetting = [%d] ====", req.sendOpt.bSetting);
73 MSG_DEBUG("==== [MsgTestSubmitReq] sendOpt : bDelivery = [%d] ====", req.sendOpt.bDeliverReq);
74 MSG_DEBUG("==== [MsgTestSubmitReq] sendOpt : bKeepCopy = [%d] ====", req.sendOpt.bKeepCopy);
77 MSG_DEBUG("==== [MsgTestSubmitReq] sendOpt : bReplyPath = [%d] ====", req.sendOpt.option.smsSendOpt.bReplyPath);
78 else if(msg_is_mms(pMsg))
80 MSG_DEBUG("==== [MsgTestSubmitReq] sendOpt : bReadReq = [%d] ====", req.sendOpt.option.mmsSendOpt.bReadReq);
81 MSG_DEBUG("==== [MsgTestSubmitReq] sendOpt : priority = [%d] ====", req.sendOpt.option.mmsSendOpt.priority);
82 MSG_DEBUG("==== [MsgTestSubmitReq] sendOpt : expiryTime = [%lu] ====", req.sendOpt.option.mmsSendOpt.expiryTime);
83 MSG_DEBUG("==== [MsgTestSubmitReq] sendOpt : deliveryTime = [%lu] ====", req.sendOpt.option.mmsSendOpt.deliveryTime);
86 print("Start Sending Message...");
88 if (msg_is_mms(req.msg))
90 if (msg_get_message_type(req.msg) == MSG_TYPE_MMS)
91 err = msg_mms_send_message(hMsgHandle, &req);
93 err = msg_mms_retrieve_message(hMsgHandle, &req);
96 err = msg_sms_send_message(hMsgHandle, &req);
98 if (err == MSG_SUCCESS)
99 printf("Sending Message is successful!!!");
101 printf("Sending Message is failed!!! %d", err);
106 MSG_ERROR_T MsgTestScheduledSubmitReq(MSG_HANDLE_T hMsgHandle, msg_message_t pMsg, MSG_SENDINGOPT_S* pSendOpt)
108 if ( !hMsgHandle || !pMsg )
110 MSG_DEBUG("Handle is NULL");
111 return MSG_ERR_NULL_MSGHANDLE;
114 MSG_REQUEST_S req = {0};
118 req.sendOpt = *pSendOpt; // memcpy(&req.sendOpt, pSendOpt, sizeof(req.sendOpt));
120 time_t scheduledTime;
122 time(&scheduledTime);
123 scheduledTime = scheduledTime + 180;
124 msg_set_scheduled_time(req.msg, scheduledTime);
126 MSG_DEBUG("==== [MsgTestSubmitReq] MSG ID = [%d] ====", msg_get_message_id(req.msg));
127 MSG_DEBUG("==== [MsgTestSubmitReq] Folder ID = [%d] ====", msg_get_folder_id(req.msg));
128 MSG_DEBUG("==== [MsgTestSubmitReq] Msg Type = [%d] ====", msg_get_message_type(req.msg));
129 // MSG_DEBUG("==== [MsgTestSubmitReq] Message Data = [%s] ====", msg_sms_get_message_body(req.msg));
130 MSG_DEBUG("==== [MsgTestSubmitReq] Message Data size = [%d] ====", msg_get_message_body_size(req.msg));
132 print("Start Sending Message...");
134 MSG_ERROR_T err = MSG_SUCCESS;
136 if (msg_is_mms(req.msg))
138 if (msg_get_message_type(req.msg) == MSG_TYPE_MMS)
139 err = msg_mms_send_message(hMsgHandle, &req);
141 err = msg_mms_retrieve_message(hMsgHandle, &req);
144 err = msg_sms_send_message(hMsgHandle, &req);
146 if (err == MSG_SUCCESS)
147 print("Sending Message is OK!");
149 print("Sending Message is failed!");