#include "Messaging.h"
#include "CallbackMgr.h"
#include "MsgServiceHandleMgr.h"
+#include "WidgetFilePathMgr.h"
#include <Logger.h>
-#include <net_connection.h>
+#include <vconf.h>
extern "C" {
#include <msg.h>
namespace {
const char* TEXT_AREA = "Text";
const char* TEXT_FILE_EXTENSION = ".txt";
-const char* TEXT_DIR_PREFIX = "/tmp/";
+const char* TEXT_DIR_SEPERATOR = "/";
const int WHITE_COLOR = 0xffffff;
const int BLACK_COLOR = 0x000000;
const int ROOT_LAYOUT_WIDTH = 100;
Mms::Mms(const string& id) :
IMessage(MMS, id),
-// m_bodyFilePath(string(tmpnam(NULL)) + TEXT_FILE_EXTENSION),
m_messageData(NULL)
{
LoggerD("m_id=" << getIdRef());
- LoggerD("m_msgType=" << getMessageType());
char buf[] = "XXXXXX";
mode_t mask = umask(S_IWGRP | S_IWOTH);
LoggerD("buf : " << buf << " i : " << i);
umask(mask);
m_bodyFilePath = buf;
- m_bodyFilePath = TEXT_DIR_PREFIX+m_bodyFilePath+TEXT_FILE_EXTENSION;
-
- LoggerD("m_bodyFilePath : " << m_bodyFilePath);
+ m_bodyFilePath = getWidgetPath()+TEXT_DIR_SEPERATOR+m_bodyFilePath+TEXT_FILE_EXTENSION;
if (getIdRef().empty()) {
- LoggerD("create new message");
createNewMessage();
} else {
- LoggerD("read existing message");
readExistingMessage();
}
}
m_messageData(NULL)
{
LoggerD("m_id=" << getIdRef());
- LoggerD("m_msgType=" << getMessageType());
- LoggerD("created msg_data : " << msg_data);
m_messageData = createNewCopyOfPLatformMsgWithAddressList(msg_data);
- LoggerD("created m_messageData : " << m_messageData);
char buf[] = "XXXXXX";
mode_t mask = umask(S_IWGRP | S_IWOTH);
LoggerD("buf : " << buf << " i : " << i);
umask(mask);
m_bodyFilePath = buf;
- m_bodyFilePath = TEXT_DIR_PREFIX+m_bodyFilePath+TEXT_FILE_EXTENSION;
-
- LoggerD("m_bodyFilePath : " << m_bodyFilePath);
-
+ m_bodyFilePath = getWidgetPath()+TEXT_DIR_SEPERATOR+m_bodyFilePath+TEXT_FILE_EXTENSION;
+
readConversationId(m_messageData);
readRecipientList(m_messageData);
readPriority(m_messageData);
readDateTime(m_messageData);
readReadStatus(m_messageData);
readMessageStatus(m_messageData);
-// setMessageStatus(MESSAGE_STATUS_LOADED);
}
{
LoggerD("updating m_id=" << getIdRef());
msg_error_t err = MSG_SUCCESS;
+ int tempInt = 0;
+
msg_struct_t msg = NULL;
msg_struct_t sendOpt = NULL;
if (err != MSG_SUCCESS)
{
- LoggerE("Get Message Failed!");
- ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message");
+ LoggerE("msg_get_message() Failed!");
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to get message for update");
}
if (this->getIdRef().empty()) {
ThrowMsg(WrtDeviceApis::Commons::PlatformException,
"existing msgId is zero, update msg not done");
}
-
+
+ err = msg_get_int_value(msg, MSG_MESSAGE_NETWORK_STATUS_INT, &tempInt);
+ if(err == MSG_SUCCESS)
+ {
+ msg_set_int_value(m_messageData, MSG_MESSAGE_NETWORK_STATUS_INT, tempInt);
+ }
+
+ err = msg_get_int_value(msg, MSG_MESSAGE_FOLDER_ID_INT, &tempInt);
+ if(err == MSG_SUCCESS)
+ {
+ msg_set_int_value(m_messageData, MSG_MESSAGE_FOLDER_ID_INT, tempInt);
+ }
+
update(TRUE);
if (MSG_SUCCESS != msg_update_message(MsgGetCommonHandle(), m_messageData, sendOpt))
{
- LoggerE("Failed to update message");
+ LoggerE("msg_update_message() Failed!");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message");
}
msg_release_struct(&msg);
bool Mms::getCellularOn()
{
auto cellularOn = true;
- void* connectionHandle;
- if (CONNECTION_ERROR_NONE == connection_create(&connectionHandle)) {
- connection_cellular_state_e cellularState;
- if (CONNECTION_ERROR_NONE == connection_get_cellular_state (connectionHandle,
- &cellularState)) {
- if (CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE == cellularState || CONNECTION_CELLULAR_STATE_FLIGHT_MODE == cellularState) {
- cellularOn = false;
- LoggerW("Cellular State Error" << cellularState);
- }
- } else {
- LoggerE("Can't obtain state of cellular connection");
- }
- connection_destroy(connectionHandle);
- } else {
- LoggerE("Can't obtain state of cellular connection");
+ int tempInt;
+ int tempbool;
+
+ vconf_get_int(VCONFKEY_TELEPHONY_SVCTYPE, &tempInt);
+ vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &tempbool);
+ if(tempInt <= VCONFKEY_TELEPHONY_SVCTYPE_SEARCH || tempbool == TRUE)
+ {
+ LoggerE("VCONFKEY_TELEPHONY_SVCTYPE error " << tempInt);
+ LoggerE("VCONFKEY_TELEPHONY_FLIGHT_MODE error " << tempbool);
+ cellularOn = false;
+ return cellularOn;
+ }
+
+ vconf_get_bool(VCONFKEY_3G_ENABLE, &tempbool);
+ vconf_get_int(VCONFKEY_TELEPHONY_SVC_PS, &tempInt);
+ if(tempbool == FALSE || tempInt != VCONFKEY_TELEPHONY_SVC_PS_ON)
+ {
+ LoggerE("VCONFKEY_3G_ENABLE error " << tempbool);
+ LoggerE("VCONFKEY_TELEPHONY_SVC_PS_ON error " << tempInt);
+ cellularOn = false;
}
return cellularOn;
}