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.
35 #include "MsgUtilFile.h"
36 #include "MsgMmsTypes.h"
37 #include "MsgSoundPlayer.h"
38 #include "MsgStorageHandler.h"
39 #include "MmsPluginTransport.h"
40 #include "MmsPluginEventHandler.h"
41 #include "MmsPluginCodec.h"
42 #include "MmsPluginInternal.h"
43 #include "MmsPluginSmil.h"
44 #include "MsgMmsMessage.h"
47 /*==================================================================================================
48 IMPLEMENTATION OF SmsPluginEventHandler - Member Functions
49 ==================================================================================================*/
50 MmsPluginEventHandler *MmsPluginEventHandler::pInstance = NULL;
53 MmsPluginEventHandler::MmsPluginEventHandler()
55 memset(&listener, 0x00, sizeof(MSG_PLUGIN_LISTENER_S));
59 MmsPluginEventHandler::~MmsPluginEventHandler()
65 MmsPluginEventHandler *MmsPluginEventHandler::instance()
68 pInstance = new MmsPluginEventHandler();
74 void MmsPluginEventHandler::registerListener(MSG_PLUGIN_LISTENER_S *pListener)
76 listener = *pListener;
80 void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char *pRetrievedFilePath)
82 MSG_MESSAGE_INFO_S msgInfo = {0,};
84 switch (pRequest->eMmsPduType) {
85 // received data is send-conf
87 MmsPluginInternal::instance()->processSendConf(&msgInfo, pRequest);
90 listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
92 //MsgDeleteFile(pRetrievedFilePath + strlen(MSG_DATA_PATH)); // not ipc
93 remove(pRetrievedFilePath); // not ipc
96 // received data is retrieve-conf
97 case eMMS_RETRIEVE_AUTO_CONF:
98 case eMMS_RETRIEVE_MANUAL_CONF:
99 MmsPluginInternal::instance()->processRetrieveConf(&msgInfo, pRequest, pRetrievedFilePath);
101 // callback to MSG FW
102 listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
105 case eMMS_FORWARD_CONF:
106 MmsPluginInternal::instance()->processForwardConf(&msgInfo, pRequest);
115 void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest)
119 MSG_ERROR_T err = MSG_SUCCESS;
121 MSG_MESSAGE_INFO_S msgInfo = {};
122 MMS_RECV_DATA_S recvData = {{0}, };
124 MSG_DEBUG("pRequest->msgId [%d]", pRequest->msgId);
126 switch (pRequest->eMmsPduType) {
129 msgInfo.msgId = pRequest->msgId;
130 //Set only changed members
131 msgInfo.msgType.mainType = MSG_MMS_TYPE;
133 if (pRequest->eMmsPduType == eMMS_SEND_REQ)
134 msgInfo.msgType.subType = MSG_SENDREQ_MMS;
136 msgInfo.msgType.subType = MSG_SENDCONF_MMS;
138 msgInfo.networkStatus = MSG_NETWORK_SEND_FAIL;
140 msgInfo.folderId = MSG_OUTBOX_ID;
142 listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
145 case eMMS_RETRIEVE_AUTO:
146 case eMMS_RETRIEVE_AUTO_CONF:
147 msgInfo.msgId = pRequest->msgId;
148 //Set only changed members
149 msgInfo.msgType.mainType = MSG_MMS_TYPE;
150 msgInfo.msgType.subType = MSG_RETRIEVE_AUTOCONF_MMS;
152 msgInfo.networkStatus = MSG_NETWORK_RETRIEVE_FAIL;
153 msgInfo.folderId = MSG_INBOX_ID;
155 err = listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
159 case eMMS_RETRIEVE_MANUAL:
160 case eMMS_RETRIEVE_MANUAL_CONF:
161 msgInfo.msgId = pRequest->msgId;
162 //Set only changed members
163 msgInfo.msgType.mainType = MSG_MMS_TYPE;
164 msgInfo.msgType.subType = MSG_RETRIEVE_MANUALCONF_MMS;
166 msgInfo.networkStatus = MSG_NETWORK_RETRIEVE_FAIL;
167 msgInfo.folderId = MSG_INBOX_ID;
169 err = listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);