//
#include "Sms.h"
-#include <dpl/log/log.h>
#include <Commons/Exception.h>
#include "ReqReceiverMessage.h"
#include "Messaging.h"
#include "CallbackMgr.h"
#include "MsgServiceHandleMgr.h"
+#include <Logger.h>
extern "C" {
#include <msg_storage.h>
IMessage(SMS, id),
m_messageData(NULL)
{
- LogDebug("enter");
- LogDebug("m_id=" << getIdRef());
- LogDebug("m_msgType=" << getMessageType());
+ LoggerD("enter");
+ LoggerD("m_id=" << getIdRef());
+ LoggerD("m_msgType=" << getMessageType());
if (getIdRef().empty()) {
createNewMessage();
IMessage(SMS, id),
m_messageData(NULL)
{
- LogDebug("enter");
- LogDebug("m_id=" << getIdRef());
- LogDebug("m_msgType=" << getMessageType());
+ LoggerD("enter");
+ LoggerD("m_id=" << getIdRef());
+ LoggerD("m_msgType=" << getMessageType());
- LogDebug("created msg_data : " << msg_data);
+ LoggerD("created msg_data : " << msg_data);
m_messageData = createNewCopyOfPLatformMsgWithAddressList(msg_data);
- LogDebug("created m_messageData : " << m_messageData);
+ LoggerD("created m_messageData : " << m_messageData);
readConversationId(m_messageData);
readRecipientList(m_messageData);
Sms::~Sms()
{
- LogDebug("enter");
+ LoggerD("enter");
if (m_messageData) {
// release platform message structure
- LogDebug("release m_messageData : " << m_messageData);
+ LoggerD("release m_messageData : " << m_messageData);
msg_release_struct(&m_messageData);
}
}
void Sms::update(bool draftsOnly)
{
- LogDebug("updating m_id=" << getIdRef());
+ LoggerD("updating m_id=" << getIdRef());
if (!m_messageData) {
//error if platform message not exists
- LogError("message can not be updated");
+ LoggerE("message can not be updated");
Throw(WrtDeviceApis::Commons::PlatformException);
}
}
Catch(WrtDeviceApis::Commons::PlatformException) {
- LogError("remove message error");
+ LoggerE("remove message error");
throw;
}
*/
// trying to add message
int error = msg_add_message(MsgGetCommonHandle(), msg, &option);
if (error != MSG_SUCCESS) {
- LogError("msg_add_message failed, error code=" << error);
+ LoggerE("msg_add_message failed, error code=" << error);
Throw(WrtDeviceApis::Commons::PlatformException);
}
}
Catch(WrtDeviceApis::Commons::PlatformException) {
- LogError("remove message error");
+ LoggerE("remove message error");
if (msg) {
//releasing platform message structure
msg_release_message(&msg);
int Sms::send()
{
- LogDebug("sending message, id=" << getIdRef());
+ LoggerD("sending message, id=" << getIdRef());
Try{
if(m_messageData == NULL)
{
}
Catch(WrtDeviceApis::Commons::PlatformException)
{
- LogDebug("getHandle failed");
+ LoggerD("getHandle failed");
Throw(WrtDeviceApis::Commons::PlatformException);
}
// split the message
SendRequest req;
- msg_struct_list_s *addr_list = NULL;
- msg_struct_list_s *new_addr_list = NULL;
+ msg_list_handle_t addr_list = NULL;
+ msg_struct_t addr_info = NULL;
+
char strNumber[MAX_ADDRESS_VAL_LEN] = {0,};
int nToCnt;
int tempInt;
int tempIdInt;
- msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
+ msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
msg_get_int_value(m_messageData, MSG_MESSAGE_ID_INT, &tempIdInt);
- nToCnt = addr_list->nCount;
- LogDebug("nToCnt : " << nToCnt);
+ nToCnt = msg_list_length(addr_list);
+ LoggerD("nToCnt : " << nToCnt);
for (int i = 0; i < nToCnt; ++i)
{
+ msg_struct_t tmpAddr;
msg_struct_t new_msg = createNewCopyOfPLatformMsg(m_messageData);
msg_set_int_value(new_msg, MSG_MESSAGE_ID_INT, tempIdInt);
- msg_get_list_handle(new_msg, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&new_addr_list);
-
- msg_get_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, &tempInt);
- LogDebug("RECIPIENT_TYPE : " << tempInt);
+ addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i);
+ msg_get_int_value(addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, &tempInt);
+ LoggerD("RECIPIENT_TYPE : " << tempInt);
if(MSG_RECIPIENTS_TYPE_TO != tempInt)
{
- LogDebug("skip");
+ LoggerD("skip");
continue;
}
+ msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN);
+
+ msg_list_add_item(new_msg, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr);
- msg_get_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN);
- msg_set_str_value(new_addr_list->msg_struct_info[0], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN);
- msg_set_int_value(new_addr_list->msg_struct_info[0], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO);
- new_addr_list->nCount = 1;
+ msg_set_str_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN);
+ msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO);
setMessageStatus(MESSAGE_STATUS_SENDING);
// schedule sending
PostEvent(0);
- LogDebug("sending method finished");
+ LoggerD("sending method finished");
return 0; //sms handle is -1;
}
void Sms::sendingCallback(msg_struct_t sent_status)
{
-// LogInfo(
+// LoggerI(
// "sendingCallback callback received. Req id = " <<
// sent_status->reqId << " Status = " << (int)sent_status->status <<
// ", Recipient=" << getRecipient());
void Sms::OnEventReceived(const int&)
{
- LogDebug("enter");
+ LoggerD("enter");
// send another one
sendSubMessage();
}
void Sms::sendSubMessage()
{
- LogDebug("enter");
+ LoggerD("enter");
DPL::Mutex::ScopedLock lock(&m_mutex);
msg_sms_send_message,
currentQueue().front(),
this);
- LogInfo("Sending Message (submit request) result:" << err);
+ LoggerI("Sending Message (submit request) result:" << err);
if (err != MSG_SUCCESS) {
- LogError("Sending Message (submit request) failed!!! err=" << err);
+ LoggerE("Sending Message (submit request) failed!!! err=" << err);
msg_release_struct(¤tQueue().front());
currentQueue().pop();
m_sendRequests.front().failed = true;
void Sms::setSendingStatusOk(const string &recipient)
{
- LogDebug("enter, success number is : " << recipient);
+ LoggerD("enter, success number is : " << recipient);
//success callback should be executed here
ReqReceiverMessage *requestReceiver = getRequestReceiver();
if (requestReceiver) {
event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::None);
event->m_successRecipients.push_back(recipient);
- msg_struct_list_s *addr_list = NULL;
- msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
+ msg_list_handle_t addr_list = NULL;
- if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)addr_list->nCount)
+ msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
+
+ if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)msg_list_length(addr_list))
{
requestReceiver->WrtDeviceApis::Commons::EventRequestReceiver< EventMessagingService >::ManualAnswer(event);
}
EventSendMessagePtr event = getSendMessageEvent();
event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::None);
event->m_successRecipients.push_back(recipient);
- //LogDebug("total address size : " << msg_get_address_count(m_messageData) << " Status size : " << event->m_successRecipients.size() + event->m_failRecipients.size());
+ //LoggerD("total address size : " << msg_get_address_count(m_messageData) << " Status size : " << event->m_successRecipients.size() + event->m_failRecipients.size());
if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)msg_get_address_count(m_messageData))
{
requestReceiver->WrtDeviceApis::Commons::EventRequestReceiver< EventSendMessage >::ManualAnswer(event);
void Sms::setSendingStatusFailed(const string &recipient)
{
- LogDebug("enter, fail number is : " << recipient);
+ LoggerD("enter, fail number is : " << recipient);
//error callback should be executed here
EventOnSendingFailedEmitterPtr emitter = getEmitter();
if (emitter) {
} else {
ReqReceiverMessage *requestReceiver = getRequestReceiver();
if (requestReceiver) {
- LogError("calling JS error callback");
+ LoggerE("calling JS error callback");
EventMessagingServicePtr event = getMessagingServiceEvent();
event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
event->m_successRecipients.push_back(recipient);
- msg_struct_list_s *addr_list = NULL;
- msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
- if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)addr_list->nCount)
+ msg_list_handle_t addr_list = NULL;
+
+ msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
+
+ if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)msg_list_length(addr_list))
{
requestReceiver->WrtDeviceApis::Commons::EventRequestReceiver< EventMessagingService >::ManualAnswer(event);
}
// delete message from platform
if (msg_delete_message(MsgGetCommonHandle(),
convertId(getId())) != MSG_SUCCESS) {
- LogError("delete message failed");
+ LoggerE("delete message failed");
Throw(WrtDeviceApis::Commons::PlatformException);
} else {
- LogDebug("message deleted succesfully");
+ LoggerD("message deleted succesfully");
}
}
Catch(WrtDeviceApis::Commons::PlatformException) {
- LogError("remove message error");
+ LoggerE("remove message error");
throw;
}
}
void Sms::createNewMessage()
{
- LogDebug("enter");
+ LoggerD("enter");
if (m_messageData) {
// release platform message if it was created previously
msg_release_struct(&m_messageData);
m_messageData = NULL;
}
// create new platform message
- LogDebug("create messeage instance");
+ LoggerD("create messeage instance");
m_messageData = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
- LogDebug("created message : " << m_messageData);
+ LoggerD("created message : " << m_messageData);
Try
{
msg_set_int_value(m_messageData, MSG_MESSAGE_DISPLAY_TIME_INT, (int)mktime(&dateT));
setMessageStatus(MESSAGE_STATUS_CREATED);
- LogDebug("Message created successfully, msgId=" << getId());
+ LoggerD("Message created successfully, msgId=" << getId());
}
Catch(WrtDeviceApis::Commons::PlatformException) {
msg_release_struct(&m_messageData);
m_messageData = NULL;
- LogError("Problem with message creation, cleaning");
+ LoggerE("Problem with message creation, cleaning");
}
}
sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT);
msg_message_id_t l_id = convertId(getIdRef());
- LogDebug("reading message id=" << l_id);
+ LoggerD("reading message id=" << l_id);
// trying to get message from platform
if (MSG_SUCCESS == msg_get_message(MsgGetCommonHandle(), l_id, m_messageData, sendOpt))
{
- LogDebug("message found with msgId=" << getIdRef());
+ LoggerD("message found with msgId=" << getIdRef());
// read all mms dat to abstraction layer
readConversationId(m_messageData);
readMessageStatus(m_messageData);
} else {
- LogError("message not found with msgId=" << getIdRef());
+ LoggerE("message not found with msgId=" << getIdRef());
setId("");
Throw(WrtDeviceApis::Commons::PlatformException);
}
msg_release_struct(&sendOpt);
}
Catch(WrtDeviceApis::Commons::PlatformException) {
- LogError("exception");
+ LoggerE("exception");
// nothing to do
msg_release_struct(&sendOpt);
}
if (isBodyValid()) {
return;
}
- LogInfo("updating platfoprm body");
+ LoggerI("updating platfoprm body");
// change body value in platform structure
if ( getBodyRef().length() > 0)
if (msg_set_str_value(m_messageData, MSG_MESSAGE_SMS_DATA_STR,
const_cast<char*>(getBodyRef().c_str()), getBodyRef().length()) != MSG_SUCCESS)
{
- LogError("problem with update Body");
+ LoggerE("problem with update Body");
Throw(WrtDeviceApis::Commons::PlatformException);
}
// set flag as true - platform synchronized with abstraction
return;
}
- LogInfo("SMS updating platform recipients");
-
- msg_struct_list_s *addr_list = NULL;
- msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
- int nToCnt = addr_list->nCount;
+ LoggerI("SMS updating platform recipients");
- LogInfo("nToCnt size " << nToCnt);
-
- if (nToCnt > 0)
- {
- for (int i = 0; i < nToCnt; i++) {
- msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, (char *)"", 0);
- msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_DISPLAYNAME_STR, (char *)"", 0);
- msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN);
- msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_UNKNOWN);
- msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_CONTACT_ID_INT, 0);
- }
- nToCnt = 0;
- addr_list->nCount = nToCnt;
- }
+ msg_list_clear(m_messageData, MSG_MESSAGE_ADDR_LIST_HND);
vector<string> to = getToRecipients().getRecipients();
// update addresses in platform structure
if (to.size())
{
- LogInfo("updating to");
+ LoggerI("updating to");
for (size_t i = 0; i < to.size(); i++)
{
string tmpAddr = to[i];
{
if (i >= MAX_TO_ADDRESS_CNT)
{
- LogError("max number of recipient exceeded");
+ LoggerE("max number of recipient exceeded");
break;
}
- LogDebug("adding to[" << i << "]=" << to[i]);
+ LoggerD("adding to[" << i << "]=" << to[i]);
- msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN);
+ msg_struct_t newAddr = NULL;
+ msg_list_add_item(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, &newAddr);
- if (msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT,
+ msg_set_int_value(newAddr, MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN);
+
+ if (msg_set_int_value(newAddr, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT,
MSG_RECIPIENTS_TYPE_TO) != MSG_SUCCESS)
{
- LogError("problem with adding to address");
+ LoggerE("problem with adding to address");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding to address");
}
- if(msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR,
+ if(msg_set_str_value(newAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR,
const_cast<char*>(to[i].c_str()), to[i].size()) != MSG_SUCCESS)
{
- LogError("problem with adding to address");
+ LoggerE("problem with adding to address");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding to address");
}
- addr_list->nCount ++;
- LogDebug("addr_list->nCount =" << addr_list->nCount);
+// addr_list->nCount ++;
+// LoggerD("addr_list->nCount =" << addr_list->nCount);
}
else
{
- LogError("wrong phone number format");
+ LoggerE("wrong phone number format");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "wrong phone number format");
}
}
// do not update if not changed
return;
}
- LogInfo("updating platform from");
+ LoggerI("updating platform from");
//TODO
// do not update if not changed
return;
}
- LogInfo("updating platform source address");
+ LoggerI("updating platform source address");
//TODO
void Sms::updateReadStatus()
{
- LogInfo("updating platform read status: " << isRead());
+ LoggerI("updating platform read status: " << isRead());
if (isReadStatusValid()) {
// do not update if not changed
return;
}
if (MSG_SUCCESS != msg_set_bool_value(m_messageData, MSG_MESSAGE_READ_BOOL, isRead())) {
- LogError("problem with setting subject");
+ LoggerE("problem with setting subject");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with setting subject");
}
setReadStatusValidity(true);
void Sms::updateIsRead()
{
- LogDebug("updating m_id=" << getIdRef());
+ LoggerD("updating m_id=" << getIdRef());
if (!m_messageData) {
//error if platform message not exists
- LogError("message can not be updated");
+ LoggerE("message can not be updated");
Throw(WrtDeviceApis::Commons::PlatformException);
}
Try
{
if (this->getIdRef().empty()) {
- LogError("existing msgId is zero, remove msg not done");
+ LoggerE("existing msgId is zero, remove msg not done");
ThrowMsg(WrtDeviceApis::Commons::PlatformException,
"existing msgId is zero, remove msg not done");
}
if (MSG_SUCCESS !=
msg_update_read_status(MsgGetCommonHandle(), convertId(getIdRef()), isReadChangeStatus()))
{
- LogError("Failed to update isRead");
+ LoggerE("Failed to update isRead");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update isRead");
}
}
Catch(WrtDeviceApis::Commons::PlatformException) {
- LogError("platform error occurs");
+ LoggerE("platform error occurs");
}
setisReadChangeStatusValidity(true);
void Sms::updateMessage()
{
- LogDebug("updating m_id=" << getIdRef());
+ LoggerD("updating m_id=" << getIdRef());
msg_error_t err = MSG_SUCCESS;
msg_struct_t msg = NULL;
if (!m_messageData) {
//error if platform message not exists
- LogError("message can not be updated");
+ LoggerE("message can not be updated");
Throw(WrtDeviceApis::Commons::PlatformException);
}
if (err != MSG_SUCCESS)
{
- LogError("Get Message Failed!");
+ LoggerE("Get Message Failed!");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message");
}
if (this->getIdRef().empty()) {
- LogError("existing msgId is zero, update msg not done");
+ LoggerE("existing msgId is zero, update msg not done");
ThrowMsg(WrtDeviceApis::Commons::PlatformException,
"existing msgId is zero, update msg not done");
}
if (MSG_SUCCESS != msg_update_message(MsgGetCommonHandle(), m_messageData, sendOpt))
{
- LogError("Failed to update message");
+ LoggerE("Failed to update message");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message");
}
msg_release_struct(&msg);
Catch(WrtDeviceApis::Commons::PlatformException) {
msg_release_struct(&msg);
msg_release_struct(&sendOpt);
- LogError("platform error occurs");
+ LoggerE("platform error occurs");
}
}
void Sms::createSendMessage()
{
- LogDebug("convert m_id= " << convertId(getIdRef()));
+ LoggerD("convert m_id= " << convertId(getIdRef()));
//prepare for add sms to draft folder
if (!m_messageData) {
//error if platform message not exists
- LogError("message can not be updated");
+ LoggerE("message can not be updated");
Throw(WrtDeviceApis::Commons::PlatformException);
}
//update all sms data
if (getCurrentFolder() == DRAFTBOX) {
- LogDebug("update all sms data");
+ LoggerD("update all sms data");
updateBody();
updateFrom();
updateTo();
setMessageStatus(MESSAGE_STATUS_DRAFT);
}
Catch(WrtDeviceApis::Commons::PlatformException) {
- LogError("remove message error");
+ LoggerE("remove message error");
if (m_messageData) {
//releasing platform message structure
msg_release_struct(&m_messageData);
void Sms::addMessageToDraft()
{
- LogDebug("convert m_id= " << convertId(getIdRef()));
+ LoggerD("convert m_id= " << convertId(getIdRef()));
msg_struct_t sendOpt = NULL;
//prepare for add sms to draft folder
if (!m_messageData) {
//error if platform message not exists
- LogError("message can not be updated");
+ LoggerE("message can not be updated");
Throw(WrtDeviceApis::Commons::PlatformException);
}
//update all sms data
if (getCurrentFolder() == DRAFTBOX) {
- LogDebug("update all sms data");
+ LoggerD("update all sms data");
updateBody();
updateFrom();
updateTo();
// trying to add message
int ret = msg_add_message(MsgGetCommonHandle(), m_messageData, sendOpt);
if (ret < MSG_SUCCESS) {
- LogError("msg_add_message failed, error code=" << ret);
+ LoggerE("msg_add_message failed, error code=" << ret);
Throw(WrtDeviceApis::Commons::PlatformException);
}
else
msgId = ret;
}
- LogDebug("Message ID : " << msgId);
+ LoggerD("Message ID : " << msgId);
if (msgId < 0)
{
- LogDebug("Message ID is invailded ");
+ LoggerD("Message ID is invailded ");
Throw(WrtDeviceApis::Commons::PlatformException);
}
setId(convertId(msgId));
setFolderType(DRAFTBOX);
setMessageStatus(MESSAGE_STATUS_DRAFT);
- LogDebug("Message Status " << getMessageStatus());
+ LoggerD("Message Status " << getMessageStatus());
#if 0
if ( folder_list_view.nCount )
}
Catch(WrtDeviceApis::Commons::PlatformException) {
- LogError("remove message error");
+ LoggerE("remove message error");
if (m_messageData) {
//releasing platform message structure
msg_release_struct(&m_messageData);
{
int tempInt = 0;
msg_get_int_value(messageData, MSG_MESSAGE_THREAD_ID_INT, &tempInt);
- LogDebug("conversationID : " <<tempInt);
+ LoggerD("conversationID : " <<tempInt);
setConvId(tempInt);
}
{
std::string phoneNumber;
// int recipientCount = msg_get_address_count(messageData);
-// LogDebug("Recipient count " << recipientCount);
+// LoggerD("Recipient count " << recipientCount);
+
+ msg_list_handle_t addr_list = NULL;
+ msg_struct_t addr_info = NULL;
- msg_struct_list_s *addr_list;
- msg_get_list_handle(messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
+ msg_get_list_handle(messageData, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
int tempInt = 0;
char strNumber[MAX_ADDRESS_VAL_LEN] = {0,};
- int recipientCount = addr_list->nCount;
- LogDebug("Recipient count " << recipientCount);
+ int recipientCount = msg_list_length(addr_list);
+ LoggerD("Recipient count " << recipientCount);
for (int i = 0; i < recipientCount; ++i)
if (MSG_DIRECTION_TYPE_MT == type)
{
- msg_struct_t addr_info = addr_list->msg_struct_info[i];
+ addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i);
msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN);
phoneNumber = strNumber;
setSourceAddress(phoneNumber);
setFrom(phoneNumber);
}
- LogDebug("MT number: " << phoneNumber);
+ LoggerD("MT number: " << phoneNumber);
}
else if (MSG_DIRECTION_TYPE_MO == type)
{
- msg_struct_t addr_info = addr_list->msg_struct_info[i];
+ addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i);
msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN);
- LogDebug("MO number: " << strNumber);
+ LoggerD("MO number: " << strNumber);
appendToRecipients(strNumber);
}
else
{
- LogError("Wrong type of recipient");
+ LoggerE("Wrong type of recipient");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Wrong type of recipient");
}
}
//set abstraction body value
int tempInt;
msg_get_int_value(messageData, MSG_MESSAGE_DATA_SIZE_INT, &tempInt);
- LogError("body Size : " <<tempInt);
+ LoggerE("body Size : " <<tempInt);
char msgText[tempInt+1];
memset(msgText, 0, tempInt+1);
msg_get_str_value(messageData, MSG_MESSAGE_SMS_DATA_STR, msgText, tempInt);
// setBody(msg_sms_get_message_body(messageData));
- LogError("body : " <<msgText);
+ LoggerE("body : " <<msgText);
setBody(msgText);
}
{
int tempInt = 0;
msg_get_int_value(messageData, MSG_MESSAGE_FOLDER_ID_INT, &tempInt);
- LogError("Folder : " <<tempInt);
+ LoggerE("Folder : " <<tempInt);
switch (tempInt) {
case MSG_INBOX_ID:
setFolderType(DRAFTBOX);
break;
default:
- LogError("Wrong folder id");
+ LoggerE("Wrong folder id");
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Unsupported folder id.");
}
}
{
int tempValue = 0;
msg_get_int_value(messageData, MSG_MESSAGE_FOLDER_ID_INT, &tempValue);
- LogDebug("readMessageStatus folder : " << tempValue);
+ LoggerD("readMessageStatus folder : " << tempValue);
switch (tempValue) {
case MSG_INBOX_ID:
int tempInt = 0;
msg_get_int_value(messageData, MSG_MESSAGE_DISPLAY_TIME_INT, &tempInt);
- LogError("readDateTime : " <<tempInt);
+ LoggerE("readDateTime : " <<tempInt);
tm* time = localtime((time_t*)&tempInt);
if (!time) {
- LogError("localtime failed");
+ LoggerE("localtime failed");
Throw(WrtDeviceApis::Commons::PlatformException);
}
setDateTime(*time);
// get read status
bool tempBool = 0;
msg_get_bool_value(messageData, MSG_MESSAGE_READ_BOOL, &tempBool);
- LogError("readReadStatus : " <<tempBool);
+ LoggerE("readReadStatus : " <<tempBool);
setReadStatus(tempBool);
}
int tempInt;
msg_get_int_value(messageData, MSG_MESSAGE_DATA_SIZE_INT, &tempInt);
// setSize(msg_get_message_body_size(messageData));
- LogError("readSize : " <<tempInt);
+ LoggerE("readSize : " <<tempInt);
setSize(tempInt);
}
msg_struct_t Sms::createNewCopyOfPLatformMsgWithAddressList(const msg_struct_t src) const
{
- int tempInt;
+ int tempInt, nCount;
bool tempBool;
- msg_struct_list_s *addr_list;
- msg_struct_list_s *new_addr_list;
+ msg_list_handle_t addr_list;
+ msg_list_handle_t new_addr_list;
msg_struct_t msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
msg_set_int_value(msg, MSG_MESSAGE_SRC_PORT_INT, tempInt);
// copy addr list
- msg_get_list_handle(src, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
- msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&new_addr_list);
+ msg_get_list_handle(src, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
+ msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&new_addr_list);
- new_addr_list->nCount = addr_list->nCount;
+ nCount = msg_list_length(addr_list);
- for(int i=0; i<addr_list->nCount; i++)
+ for(int i=0; i<nCount; i++)
{
msg_struct_t addr_info = NULL;
msg_struct_t new_addr_info = NULL;
char addr_value[MAX_ADDRESS_VAL_LEN] = {0,};
//get original address
- addr_info = addr_list->msg_struct_info[i];
+ addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i);
msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, addr_value, MAX_ADDRESS_VAL_LEN);
msg_get_int_value(addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, &tempInt);
//copy original address
- new_addr_info = new_addr_list->msg_struct_info[i];
+ msg_list_add_item(msg, MSG_MESSAGE_ADDR_LIST_HND, &new_addr_info);
msg_set_str_value(new_addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, addr_value, MAX_ADDRESS_VAL_LEN);
msg_set_int_value(new_addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, tempInt);
}