From 1f90239d23730192de6c37843568a8a3b1e9fdcc Mon Sep 17 00:00:00 2001 From: Keebum Kim Date: Thu, 21 Mar 2013 15:05:37 +0900 Subject: Apply MMS emulator send success, fail mode. Change-Id: Ic84f047a1ad1d2c9e112a48c8bd2a5ab9f93ef9e --- plugin/mms_plugin/MmsPluginEventHandler.cpp | 12 ++++-- plugin/mms_plugin/MmsPluginUserAgent.cpp | 58 +++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/plugin/mms_plugin/MmsPluginEventHandler.cpp b/plugin/mms_plugin/MmsPluginEventHandler.cpp index d4e3265..922b1b9 100755 --- a/plugin/mms_plugin/MmsPluginEventHandler.cpp +++ b/plugin/mms_plugin/MmsPluginEventHandler.cpp @@ -68,8 +68,10 @@ void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID); //MsgDeleteFile(pRetrievedFilePath + strlen(MSG_DATA_PATH)); // not ipc - if (remove(pRetrievedFilePath) != 0) - MSG_DEBUG("remove fail"); + if (pRetrievedFilePath) { + if (remove(pRetrievedFilePath) != 0) + MSG_DEBUG("remove fail"); + } break; // received data is retrieve-conf @@ -86,8 +88,10 @@ void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char break; case eMMS_READREPORT_CONF: - if (remove(pRetrievedFilePath) != 0) - MSG_DEBUG("remove fail"); + if (pRetrievedFilePath) { + if (remove(pRetrievedFilePath) != 0) + MSG_DEBUG("remove fail"); + } break; default: break; diff --git a/plugin/mms_plugin/MmsPluginUserAgent.cpp b/plugin/mms_plugin/MmsPluginUserAgent.cpp index 32fa3c5..9b8e4e8 100755 --- a/plugin/mms_plugin/MmsPluginUserAgent.cpp +++ b/plugin/mms_plugin/MmsPluginUserAgent.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include "MsgException.h" #include "MsgUtilFile.h" #include "MsgGconfWrapper.h" @@ -295,6 +297,62 @@ void MmsPluginUaManager::run() unlock(); } + + { // Check is it emulator or not. + struct utsname buf; + int ret = uname(&buf); + + if (ret == 0) { + MSG_DEBUG("System runs on [%s].", buf.machine); + if (strncmp(buf.machine, "i686", 4) == 0) { + MSG_DEBUG("Running on Emulator mode."); + + int mmsResult = MsgSettingGetInt(VCONFKEY_TELEPHONY_MMS_SENT_STATUS); + + MSG_DEBUG("MMS result has to be [%d]", mmsResult); + + while (!mmsTranQ.empty()) { + MSG_DEBUG("###### mmsTranQ.size [%d]", mmsTranQ.size()); + + mmsTranQEntity reqEntity; + memset(&reqEntity, 0, sizeof(mmsTranQEntity)); + + mmsTranQ.front(&reqEntity); + + if (mmsResult > 0) { + // For MMS send fail. + MmsPluginEventHandler::instance()->handleMmsError(&reqEntity); + mmsTranQ.pop_front(); + } else { + // For MMS send success. + MSG_DEBUG("conf received successfully"); + + reqEntity.eMmsPduType = eMMS_SEND_CONF; + + try { + MmsPluginEventHandler::instance()->handleMmsReceivedData(&reqEntity, NULL); + } catch (MsgException& e) { + MSG_FATAL("%s", e.what()); + break; + } catch (exception& e) { + MSG_FATAL("%s", e.what()); + break; + } + + mmsTranQ.pop_front(); + } + } + + mmsTranQ.clear(); + MutexLocker locker(mx); + running = false; + + return; + } + } + } + + // Request CM Open if (!(cmAgent->open())) { MSG_DEBUG("Cm Open Failed"); -- cgit v1.2.3