, __pTempCbsChannelList(0)
, __callbackRegistered(false)
, __incomingSmsCallbackRegistered(true)
- , __pCbsUserEvent(null)
- , __pEtwsUserEvent(null)
{
}
{
if (pSmsEvent)
{
- if (port == 0) // normal incoming SMS message case
- {
- pSmsEventArg = new (std::nothrow) _SmsEventArg(message, senderAddress, receivedTime);
- SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
- }
- else // SMS trigger message case
- {
- pSmsEventArg = new (std::nothrow) _SmsEventArg(port, receivedTime, message, senderAddress);
- SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
- }
- pSmsEvent->Fire(*pSmsEventArg);
- }
- }
-}
-
-void
-_SmsMmsCallbackHandler::IncomingCbsMessageCallback(msg_handle_t hMsgHandle, msg_struct_t newMsg, void* pUserParam)
-{
- result r = E_SUCCESS;
- _SmsEventArg* pSmsEventArg = null;
- int tempReceivedTime = 0;
- DateTime receivedTime;
- bool etwsNotifiation = false;
- int messgeId = 0;
- int serialNumber = 0;
- int length = 0;
- int cbsType = -1;
- Tizen::Base::ByteBuffer msgSerialNumber;
-
- msg_get_int_value(newMsg, MSG_CB_MSG_RECV_TIME_INT, &tempReceivedTime);
- receivedTime = _MsgUtil::ConvertTime((time_t *) &tempReceivedTime);
-
- msg_get_int_value(newMsg, MSG_CB_MSG_MSG_ID_INT, &messgeId);
- msg_get_int_value(newMsg, MSG_CB_MSG_SERIAL_NUM_INT, &serialNumber);
- msg_get_int_value(newMsg, MSG_CB_MSG_TYPE_INT, &cbsType);
-
- Tizen::Base::Integer serialno(serialNumber);
- length = serialno.ToString().GetLength();
-
- msgSerialNumber.Construct(length);
- msgSerialNumber.SetInt(0, serialNumber);
- msgSerialNumber.SetPosition(0);
-
- if (cbsType == MSG_TYPE_SMS_ETWS_PRIMARY)
- {
- int etwsWarningType;
- char etwsWarningInfo[MESSAGES_ETWS_WARNING_INFO_LEN];
- Tizen::Base::ByteBuffer msgSecurityInfo;
- Tizen::Base::ByteBuffer etwsMsgWarningType;
- msg_get_int_value(newMsg, MSG_CB_MSG_ETWS_WARNING_TYPE_INT, &etwsWarningType);
- msg_get_str_value(newMsg, MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR, etwsWarningInfo, MESSAGES_ETWS_WARNING_INFO_LEN);
-
- String etwsSecurityInfo(etwsWarningInfo);
- length = etwsSecurityInfo.GetLength();
- msgSecurityInfo.Construct(length);
- r = msgSecurityInfo.SetArray((byte*) etwsWarningInfo, 0, length);
- msgSecurityInfo.SetPosition(0);
-
- Tizen::Base::Integer warningtype(etwsWarningType);
- length = warningtype.ToString().GetLength();
-
- etwsMsgWarningType.Construct(length);
- etwsMsgWarningType.SetInt(0, etwsWarningType);
- etwsMsgWarningType.SetPosition(0);
-
- etwsNotifiation = true;
- _SmsEvent* pSmsEvent = static_cast <_SmsEvent*>(_SmsMmsCallbackHandler::GetInstance()->__pEtwsUserEvent);
-
- SysLog(NID_MSG, "cbs etwsWarningType: [%d]", etwsWarningType);
-
- if (pSmsEvent)
- {
- pSmsEventArg = new (std::nothrow) _SmsEventArg(receivedTime, msgSerialNumber, msgSecurityInfo, messgeId,
- etwsMsgWarningType, _SMS_EVENT_TYPE_ETWS_RECEIVE_RESULT);
- SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
+ pSmsEventArg = new (std::nothrow) _SmsEventArg(message, senderAddress, receivedTime);
+ SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
pSmsEvent->Fire(*pSmsEventArg);
}
}
- else
- {
- _SmsEvent* pSmsEvent = static_cast <_SmsEvent*>(_SmsMmsCallbackHandler::GetInstance()->__pCbsUserEvent);
- int dataCodingScheme = 0;
- int msgSize = 0;
-
- msg_get_int_value(newMsg, MSG_CB_MSG_CB_TEXT_LEN_INT, &msgSize);
- char msgBody[msgSize + 1];
- memset(msgBody, 0, msgSize + 1);
- msg_get_str_value(newMsg, MSG_CB_MSG_CB_TEXT_STR, msgBody, msgSize + 1);
- String message(msgBody); // porting char* to String
-
- msg_get_int_value(newMsg, MSG_CB_MSG_DCS_INT, &dataCodingScheme);
- Tizen::Base::Integer dataCodingSchemeTemp(dataCodingScheme);
-
- //language type of cbs message
- String messageLanguage(L"");
- byte higherNibble = dataCodingScheme & 0xf0;
- byte lowerNibble = dataCodingScheme & 0x0f;
-
- //check higher nibble
- // if higher nibble 0000
- if (higherNibble == 0x00)
- {
- messageLanguage = GetCbsLanguageType(lowerNibble);
- }
- else if (higherNibble == 0x01)
- {
- // if higher nibble is 0001, get language type from framework
- int len = 15;
- char type[len + 1];
- memset(type, 0, len + 1);
- msg_get_str_value(newMsg, MSG_CB_MSG_LANGUAGE_TYPE_STR, type, len);
- messageLanguage = String(type);
- }
- else if (higherNibble == 0x20 && lowerNibble == 0x00)
- {
- // if 0010 0000
- messageLanguage = String(L"CS");
- }
- else
- {
- // use empty string
- }
-
- if (pSmsEvent)
- {
- pSmsEventArg = new (std::nothrow) _SmsEventArg(message, msgSerialNumber, receivedTime, messgeId, etwsNotifiation,
- ((byte) dataCodingSchemeTemp.ToChar()),messageLanguage, _SMS_EVENT_TYPE_CBS_RECEIVE_RESULT);
- SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
- pSmsEvent->Fire(*pSmsEventArg);
- }
-
- SysLog(NID_MSG, "cbs msg_body: [%s]", msgBody);
- SysLog(NID_MSG, "cbs dataCodingScheme: [%d]", dataCodingScheme);
- SysLog(NID_MSG, "cbs languageType: [%ls]", messageLanguage.GetPointer());
- }
-
- SysLog(NID_MSG, "cbs msg_id: [%d]", messgeId);
- SysLog(NID_MSG, "cbs serialNumber: [%d]", serialNumber);
- SysLog(NID_MSG, "cbs etwsNotifiation: [%d]", etwsNotifiation);
-}
-
-void
-_SmsMmsCallbackHandler::IncomingWapPushMessageCallback(msg_handle_t hMsgHandle, const char* pHeader, const char* pBody, int bodyLength, void* pUserParam)
-{
- result r = E_SUCCESS;
- _SmsEvent* pSmsEvent = static_cast <_SmsEvent*>(pUserParam);
- _SmsEventArg* pSmsEventArg = null;
- String msgHeader(pHeader);
- Tizen::Base::ByteBuffer msgBody;
- msgBody.Construct(bodyLength);
- r = msgBody.SetArray((byte*) pBody, 0, bodyLength);
- msgBody.SetPosition(0);
-
- SysLog(NID_MSG, "push msg body: [%s]", pBody);
- SysLog(NID_MSG, "push msg header: [%s]", pHeader);
- SysLog(NID_MSG, "push body length: [%d]", bodyLength);
-
- if (pSmsEvent)
- {
- pSmsEventArg = new (std::nothrow) _SmsEventArg(msgHeader, msgBody, _SMS_EVENT_TYPE_WAP_PUSH_RECEIVE_RESULT);
- SysTryReturnVoidResult(NID_MSG, pSmsEventArg != null, E_OUT_OF_MEMORY, "memory allocation failed.");
- pSmsEvent->Fire(*pSmsEventArg);
- }
}
Tizen::Base::String