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 #include "MmsPluginEventHandler.h"
33 #include "MmsPluginTransport.h"
34 #include "MsgUtilFile.h"
35 #include "MmsPluginCodec.h"
36 #include "MmsPluginMessage.h"
37 #include "MmsPluginUserAgent.h"
40 /*==================================================================================================
41 IMPLEMENTATION OF MmsPluginTransport - Member Functions
42 ==================================================================================================*/
43 MmsPluginTransport *MmsPluginTransport::pInstance = NULL;
46 MmsPluginTransport::MmsPluginTransport()
52 MmsPluginTransport::~MmsPluginTransport()
58 MmsPluginTransport *MmsPluginTransport::instance()
61 pInstance = new MmsPluginTransport();
67 void MmsPluginTransport::submitRequest(const MSG_REQUEST_INFO_S *pReqInfo)
69 mmsTranQEntity reqItem = {0};
71 reqItem.isCompleted = false;
72 reqItem.reqID = pReqInfo->reqId;
74 MSG_DEBUG("pReqInfo->msgInfo.msgType.subType [%d]", pReqInfo->msgInfo.msgType.subType);
76 switch (pReqInfo->msgInfo.msgType.subType) {
78 case MSG_SENDREQ_JAVA_MMS:
79 MSG_DEBUG("######### SEND REQUEST : POST TRANSACTION");
80 reqItem.msgId = pReqInfo->msgInfo.msgId;
81 reqItem.eMmsPduType = eMMS_SEND_REQ;
82 reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
83 reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
87 MSG_DEBUG("######### AUTO RETRIEVE : GET TRANSACTION");
88 reqItem.msgId = pReqInfo->msgInfo.msgId;
89 reqItem.eMmsPduType = eMMS_RETRIEVE_AUTO;
90 reqItem.eHttpCmdType = eHTTP_CMD_GET_TRANSACTION;
91 reqItem.getDataLen = pReqInfo->msgInfo.dataSize;
92 reqItem.pGetData = (char *)malloc(reqItem.getDataLen);
93 memcpy(reqItem.pGetData, pReqInfo->msgInfo.msgData, reqItem.getDataLen);
96 case MSG_NOTIFYRESPIND_MMS:
97 MSG_DEBUG("######### MANUAL RETRIEVE : SEND NOTIFY RESPONSE IND");
98 reqItem.msgId = pReqInfo->msgInfo.msgId;
99 reqItem.eMmsPduType = eMMS_NOTIFYRESP_IND;
100 reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
101 reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
102 remove(pReqInfo->msgInfo.msgData);
105 case MSG_RETRIEVE_MMS:
106 MSG_DEBUG("######### MANUAL RETRIEVE : GET TRANSACTION");
107 reqItem.msgId = pReqInfo->msgInfo.msgId;
108 reqItem.eMmsPduType = eMMS_RETRIEVE_MANUAL;
109 reqItem.eHttpCmdType = eHTTP_CMD_GET_TRANSACTION;
110 reqItem.getDataLen = pReqInfo->msgInfo.dataSize;
111 reqItem.pGetData = (char *)malloc(reqItem.getDataLen);
112 memcpy(reqItem.pGetData, pReqInfo->msgInfo.msgData, reqItem.getDataLen);
115 case MSG_READREPLY_MMS:
116 MSG_DEBUG("######### SEND READ REPORT : POST TRANSACTION");
117 reqItem.msgId = pReqInfo->msgInfo.msgId;
118 reqItem.eMmsPduType = eMMS_READREPORT_REQ;
119 reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
120 reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
122 remove(pReqInfo->msgInfo.msgData);
125 case MSG_READRECIND_MMS:
126 MSG_DEBUG("######### SEND READREC IND : POST TRANSACTION");
127 reqItem.msgId = pReqInfo->msgInfo.msgId;
128 reqItem.eMmsPduType = eMMS_READREC_IND;
129 reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
130 reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
133 case MSG_FORWARD_MMS:
134 MSG_DEBUG("######### SEND FORWARD MSG : POST TRANSACTION");
135 reqItem.msgId = pReqInfo->msgInfo.msgId;
136 reqItem.eMmsPduType = eMMS_SEND_REQ;
137 reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
138 reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
142 MmsPluginUaManager::instance()->addMmsReqEntity(reqItem);
143 MmsPluginUaManager::instance()->start();
147 void MmsPluginTransport::cancelRequest(MSG_REQUEST_ID_T reqId)