apply push/cb function
authorChangseok Oh <seok.oh@samsung.com>
Tue, 9 Oct 2012 08:37:37 +0000 (17:37 +0900)
committerChangseok Oh <seok.oh@samsung.com>
Tue, 9 Oct 2012 09:57:15 +0000 (18:57 +0900)
38 files changed:
framework/plugin-manager/MsgPluginManager.cpp
include/common/MsgCmdTypes.h
include/common/MsgInternalTypes.h
include/common/MsgPluginInterface.h
include/common/MsgStorageTypes.h
include/common/MsgTypes.h
include/framework/MsgCmdHandler.h
include/framework/MsgStorageHandler.h
include/framework/MsgTransManager.h
include/mapi/msg_private.h
include/mapi/msg_storage.h
include/mapi/msg_transport.h
include/mapi/msg_transport_types.h
include/mapi/msg_types.h
include/proxy/MsgHandle.h
include/proxy/MsgProxyListener.h
include/utils/MsgSqliteWrapper.h
mapi/msg_message.cpp
mapi/msg_storage.cpp
mapi/msg_svc.cpp
mapi/msg_transport.cpp
msg_helper/CMakeLists.txt
msg_helper/MsgSoundPlayer.cpp
packaging/msg-service.spec
plugin/sms_plugin/SmsPluginCallback.cpp
plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
plugin/sms_plugin/SmsPluginEventHandler.cpp
plugin/sms_plugin/SmsPluginStorage.cpp
plugin/sms_plugin/SmsPluginWapPushHandler.cpp
plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
plugin/sms_plugin/include/SmsPluginEventHandler.h
plugin/sms_plugin/include/SmsPluginStorage.h
plugin/sms_plugin/include/SmsPluginTypes.h
proxy/MsgHandleControl.cpp
proxy/MsgHandleStorage.cpp
proxy/MsgHandleTransport.cpp
proxy/MsgProxyListener.cpp
utils/MsgDebug.cpp

index 7c5bf38..f872f65 100755 (executable)
@@ -223,6 +223,112 @@ msg_error_t MsgIncomingSyncMLMessageListener(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLD
        return (pEvent->result);
 }
 
+msg_error_t MsgIncomingPushMessageListener(MSG_PUSH_MESSAGE_DATA_S *pPushData)
+{
+       MSG_BEGIN();
+
+       // establish connection to msgfw daemon
+       MsgIpcClientSocket client;
+       client.connect(MSG_SOCKET_PATH);
+
+       // composing command
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_MESSAGE_DATA_S); // cmd type, MSG_SYNCML_MESSAGE_DATA_S
+
+       MSG_DEBUG("cmdSize: %d", cmdSize);
+
+       char cmdBuf[cmdSize];
+       bzero(cmdBuf, cmdSize);
+       MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
+
+       // Set Command Parameters
+       pCmd->cmdType = MSG_CMD_PLG_INCOMING_PUSH_IND;
+
+       memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN);
+
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pPushData, sizeof(MSG_PUSH_MESSAGE_DATA_S));
+
+       // Send Command to Messaging FW
+       client.write(cmdBuf, cmdSize);
+
+       // Receive result from Transaction Manager
+       char* retBuf = NULL;
+       AutoPtr<char> wrap(&retBuf);
+       int retSize;
+       client.read(&retBuf, &retSize);
+
+       // close connection to msgfw daemon
+       client.close();
+
+       // Decoding the result from FW and Returning it to plugin
+       // the result is used for making delivery report
+       MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf;
+
+       if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND)
+               THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType));
+
+       MSG_END();
+
+       return (pEvent->result);
+}
+
+
+msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg)
+{
+       MSG_BEGIN();
+
+       // establish connection to msgfw daemon
+       MsgIpcClientSocket client;
+       client.connect(MSG_SOCKET_PATH);
+
+       // Check Invalid Message Structure
+       if (pCbMsg == NULL)
+       {
+               MSG_DEBUG("pMsg is NULL !!");
+
+               return MSG_ERR_NULL_MESSAGE;
+       }
+
+       // composing command
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CB_MSG_S); // cmd type, MSG_CB_MSG_S
+
+       MSG_DEBUG("cmdSize: %d", cmdSize);
+
+       char cmdBuf[cmdSize];
+       bzero(cmdBuf, cmdSize);
+
+       MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
+
+       // Set Command Parameters
+       pCmd->cmdType = MSG_CMD_PLG_INCOMING_CB_IND;
+
+       memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN);
+
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pCbMsg, sizeof(MSG_CB_MSG_S));
+
+       // Send Command to Messaging FW
+       client.write(cmdBuf, cmdSize);
+
+       char* retBuf = NULL;
+       AutoPtr<char> wrap(&retBuf);
+       int retSize;
+
+       client.read(&retBuf, &retSize);
+
+       // close connection to msgfw daemon
+       client.close();
+
+       // Decoding the result from FW and Returning it to plugin
+       // the result is used for making delivery report
+       MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf;
+
+       if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_CB_MSG_IND)
+               THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType));
+
+       MSG_END();
+
+       return (pEvent->result);
+}
+
 
 msg_error_t MsgIncomingLBSMessageListener(MSG_LBS_MESSAGE_DATA_S *pLBSData)
 {
@@ -414,6 +520,8 @@ MsgPlugin::MsgPlugin(MSG_MAIN_TYPE_T mainType, const char *libPath): mSupportedM
        fwListener.pfSyncMLMsgIncomingCb        = &MsgIncomingSyncMLMessageListener;
        fwListener.pfLBSMsgIncomingCb           = &MsgIncomingLBSMessageListener;
        fwListener.pfMmsConfIncomingCb = &MsgMmsConfIncomingListener;
+       fwListener.pfPushMsgIncomingCb          = &MsgIncomingPushMessageListener;
+       fwListener.pfCBMsgIncomingCb            = &MsgIncomingCBMessageListener;
 
        if (registerListener(&fwListener) != MSG_SUCCESS)
                THROW(MsgException::PLUGIN_ERROR, "ERROR to register listener");
index 4439c7b..c20ca3d 100755 (executable)
@@ -159,6 +159,14 @@ enum _MSG_CMD_TYPE_E
        MSG_CMD_SET_GENERAL_MSG_OPT,
        MSG_CMD_SET_MSG_SIZE_OPT,
 
+       MSG_CMD_REG_INCOMING_PUSH_MSG_CB,
+       MSG_CMD_PLG_INCOMING_PUSH_IND,
+       MSG_CMD_REG_INCOMING_CB_MSG_CB,
+       MSG_CMD_PLG_INCOMING_CB_IND,
+       MSG_CMD_ADD_PUSH_EVENT,
+       MSG_CMD_DELETE_PUSH_EVENT,
+       MSG_CMD_UPDATE_PUSH_EVENT,
+
 // end of MSG_CMD; new CMD should be defined before MSG_CMD_NUM
        MSG_CMD_NUM
 };
@@ -262,6 +270,14 @@ enum _MSG_EVENT_TYPE_E
        MSG_EVENT_SET_VOICE_MSG_OPT,
        MSG_EVENT_SET_GENERAL_MSG_OPT,
        MSG_EVENT_SET_MSG_SIZE_OPT,
+       MSG_EVENT_REG_INCOMING_PUSH_MSG_CB,
+       MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND,
+       MSG_EVENT_REG_INCOMING_CB_MSG_CB,
+       MSG_EVENT_PLG_INCOMING_CB_MSG_IND,
+       MSG_EVENT_ADD_PUSH_EVENT,
+
+       MSG_EVENT_DELETE_PUSH_EVENT,
+       MSG_EVENT_UPDATE_PUSH_EVENT,
 
 // end of MSG_EVENT; new EVENT should be defined before MSG_EVENT_NUM
        MSG_EVENT_NUM
index cb208ea..edeadf8 100755 (executable)
@@ -43,6 +43,8 @@
 #define MAX_THREAD_ADDR_LEN    40
 #define MAX_THREAD_NAME_LEN    195
 #define MAX_THREAD_DATA_LEN    128
+#define MAX_CB_MSG_TEXT_LEN    4200    // 1page max char(93)*max page(15)*max bytes of UTF8 1 char(3)
+#define MAX_ETWS_WARNING_SECURITY_INFO_LEN     50
 
 #define SMS_MINIMUM_SPACE      (3 * 1024)
 #define MMS_MINIMUM_SPACE      (600 * 1024)
 #define PUSH_SERVICE_TYPE                              DEFAULT_PUSH_MSG_OPT_PATH"/service_load"
 
 #define CB_RECEIVE                                             DEFAULT_CB_MSG_OPT_PATH"/receive"
-#define CB_ALL_CHANNEL                         DEFAULT_CB_MSG_OPT_PATH"/all_channel"
+#define CB_SAVE                                                DEFAULT_CB_MSG_OPT_PATH"/save"
 #define CB_MAX_SIM_COUNT                       DEFAULT_CB_MSG_OPT_PATH"/max_sim_count"
 #define CB_CHANNEL_COUNT                       DEFAULT_CB_MSG_OPT_PATH"/channel_count"
 #define CB_CHANNEL_ACTIVATE            DEFAULT_CB_MSG_OPT_PATH"/channel_activate"
@@ -323,6 +325,13 @@ typedef struct
        unsigned short          port;
 } MSG_CMD_REG_INCOMING_MSG_CB_S;
 
+typedef struct
+{
+       int                             listenerFd;
+       MSG_MAIN_TYPE_T         msgType;
+       bool                            bsave;
+} MSG_CMD_REG_CB_INCOMING_MSG_CB_S;
+
 
 /**
  *     @brief  Aux data structure for MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB. \n
@@ -380,6 +389,20 @@ typedef struct
        MSG_MAIN_TYPE_T         msgType;
 } MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S;
 
+typedef struct
+{
+       int                             listenerFd;
+       MSG_MAIN_TYPE_T         msgType;
+       char appId[MAX_WAPPUSH_ID_LEN+1];
+} MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S;
+
+typedef struct
+{
+       int                             listenerFd;
+       MSG_MAIN_TYPE_T         msgType;
+       bool                            bsave;
+} MSG_CMD_REG_INCOMING_CB_MSG_CB_S;
+
 
 typedef struct
 {
@@ -387,6 +410,24 @@ typedef struct
        MSG_REQUEST_INFO_S              reqInfo;
 }MSG_SCHEDULED_MSG_S;
 
+/**
+ *     @brief  Represents a CB message in the framework.
+ */
+typedef struct
+{
+       MSG_SUB_TYPE_T                  type;
+       time_t                                  receivedTime;
+
+       unsigned short                  serialNum;
+       unsigned short                  messageId;      // Message Identifier
+       unsigned char                   dcs;            // data coding scheme
+       int                                             cbTextLen;      // length of cbText
+       unsigned char                   cbText[MAX_CB_MSG_TEXT_LEN];// cb message text (UTF8)
+
+       unsigned short                  etwsWarningType;
+       unsigned char                   etwsWarningSecurityInfo[MAX_ETWS_WARNING_SECURITY_INFO_LEN];
+} MSG_CB_MSG_S;
+
 
 /*==================================================================================================
                                          ENUMS
@@ -455,6 +496,8 @@ enum _MSG_SUB_TYPE_E
        MSG_FORWARDCONF_MMS,                    /**< MMS Forward Confirm message */
        MSG_READREPLY_MMS,                              /**< MMS Read Reply message */
        MSG_SENDREQ_JAVA_MMS,                   /**< MMS Send Request message for JAVA MMS */
+
+       MSG_ETWS_SMS,
 };
 
 /**
index efdf960..02cef24 100755 (executable)
@@ -1043,6 +1043,8 @@ typedef msg_error_t (*MsgPlgOnMsgIncoming)(MSG_MESSAGE_INFO_S *pMsgInfo);
 typedef msg_error_t (*MsgPlgOnInitSimBySat)(void);
 typedef msg_error_t (*MsgPlgOnSyncMLMsgIncoming)(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLData);
 typedef msg_error_t (*MsgPlgOnLBSMsgIncoming)(MSG_LBS_MESSAGE_DATA_S *pLBSData);
+typedef msg_error_t (*MsgPlgOnPushMsgIncoming)(MSG_PUSH_MESSAGE_DATA_S *pPushData);
+typedef msg_error_t (*MsgPlgOnCBMsgIncoming)(MSG_CB_MSG_S *pCbMsg);
 typedef msg_error_t (*MsgPlgOnMmsConfIncoming)(MSG_MESSAGE_INFO_S *pMsgInfo, msg_request_id_t *pRequest);
 
 
@@ -1057,6 +1059,8 @@ struct _MSG_PLUGIN_LISTENER_S
        MsgPlgOnInitSimBySat                    pfInitSimBySatCb;                       /** The function pointer of init SIM callback. */
        MsgPlgOnSyncMLMsgIncoming       pfSyncMLMsgIncomingCb;  /** The function pointer of receive syncML message callback. */
        MsgPlgOnLBSMsgIncoming          pfLBSMsgIncomingCb;             /** The function pointer of receive LBS message callback. */
+       MsgPlgOnPushMsgIncoming         pfPushMsgIncomingCb;            /** The function pointer of receive Push message callback. */
+       MsgPlgOnCBMsgIncoming           pfCBMsgIncomingCb;                      /** The function pointer of receive cb message callback. */
        MsgPlgOnMmsConfIncoming         pfMmsConfIncomingCb;    /** The function pointer of receive MMS conf */
 };
 
index aef5f1e..5d3c88f 100755 (executable)
@@ -150,5 +150,11 @@ typedef struct
 } MSG_SEARCH_CONDITION_S;
 
 
+typedef struct
+{
+       int appcode;
+       char appid[MAX_WAPPUSH_ID_LEN];
+} PUSH_APPLICATION_INFO_S;
+
 #endif // MSG_STORAGE_TYPES_H
 
index fd33621..2037e62 100755 (executable)
@@ -300,6 +300,14 @@ typedef struct
 }MSG_LBS_MESSAGE_DATA_S;
 
 
+typedef struct
+{
+       char                                                    pushHeader[MAX_WAPPUSH_CONTENTS_LEN];
+       int                                                     pushBodyLen;
+       char                                                    pushBody[MAX_WAPPUSH_CONTENTS_LEN];
+       char                                                    pushAppId[MAX_WAPPUSH_ID_LEN];
+}MSG_PUSH_MESSAGE_DATA_S;
+
 /**
  *     @brief  Represents the Report Status Data.
  */
@@ -311,6 +319,13 @@ typedef struct
        time_t                                                  readStatusTime;         /**< Indicates the display time related to the specific operation. */   //MAX_DISPLAY_TIME_LEN
 }MSG_REPORT_STATUS_INFO_S;
 
+typedef struct
+{
+       char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN];
+       char appId[MAX_WAPPUSH_ID_LEN];
+       char pkgName[MSG_FILEPATH_LEN_MAX];
+       bool bLaunch;
+}MSG_PUSH_EVENT_INFO_S;
 
 /**
  *     @}
index 1906581..e76ebb4 100755 (executable)
@@ -74,6 +74,8 @@ int MsgCancelReqHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgRegSentStatusCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgRegIncomingMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgRegIncomingMMSConfMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgRegIncomingPushMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgRegIncomingCBMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgRegIncomingSyncMLMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgRegIncomingLBSMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgRegSyncMLMsgOperationCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent);
@@ -82,6 +84,8 @@ int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 
 int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgIncomingPushMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgIncomingCBMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgIncomingSyncMLMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgIncomingLBSMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgSyncMLMsgOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent);
@@ -93,6 +97,9 @@ int MsgDeleteFilterHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgGetFilterListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgSetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgGetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgAddPushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgDeletePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 
 int MsgGetSMSCListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgGetCBInfoHandler(const MSG_CMD_S *pCmd, char **ppEvent);
index 68d97fd..fe541b2 100755 (executable)
@@ -129,5 +129,9 @@ msg_error_t MsgStoResetNetworkStatus();
 msg_error_t MsgStoCleanAbnormalMmsData();
 msg_error_t MsgStoCheckReadReportStatus(msg_message_id_t msgId);
 
+msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent);
+msg_error_t MsgStoDeletePushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent);
+msg_error_t MsgStoUpdatePushEvent(MSG_PUSH_EVENT_INFO_S* pSrc, MSG_PUSH_EVENT_INFO_S* pDst);
+
 #endif // MSG_STORAGE_HANDLER_H
 
index 554b7d6..53f7ba4 100755 (executable)
@@ -40,6 +40,8 @@ typedef std::map<int, MSG_PROXY_INFO_S> sentmsg_map;
 typedef std::map<int, bool> fd_map;
 typedef std::list<MSG_CMD_REG_INCOMING_MSG_CB_S> newmsg_list;
 typedef std::list<MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S>      mmsconf_list;
+typedef std::list<MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S> pushmsg_list;
+typedef std::list<MSG_CMD_REG_INCOMING_CB_MSG_CB_S> cbmsg_list;
 typedef std::list<MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S> syncmlmsg_list;
 typedef std::list<MSG_CMD_REG_INCOMING_LBS_MSG_CB_S> lbsmsg_list;
 typedef std::list<MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S> javamms_list;
@@ -70,6 +72,8 @@ public:
        void setSentStatusCB(int listenerFd);
        void setIncomingMsgCB(MSG_CMD_REG_INCOMING_MSG_CB_S *pCbInfo);
        void setMMSConfMsgCB(MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S *pCbinfo);
+       void setPushMsgCB(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCbinfo);
+       void setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo);
        void setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCbinfo);
        void setLBSMsgCB(MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCbinfo);
        void setJavaMMSList(MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S *pTrId);
@@ -80,6 +84,8 @@ public:
 
        void broadcastIncomingMsgCB(const msg_error_t err, const MSG_MESSAGE_INFO_S *msgInfo);
        void broadcastMMSConfCB(const msg_error_t err, const MSG_MESSAGE_INFO_S *msgInfo, const MMS_RECV_DATA_S *mmsRecvData);
+       void broadcastPushMsgCB(const msg_error_t err, const MSG_PUSH_MESSAGE_DATA_S *pushData);
+       void broadcastCBMsgCB(const msg_error_t err, const MSG_CB_MSG_S *cbMsg);
        void broadcastSyncMLMsgCB(const msg_error_t err, const MSG_SYNCML_MESSAGE_DATA_S *syncMLData);
        void broadcastLBSMsgCB(const msg_error_t err, const MSG_LBS_MESSAGE_DATA_S *lbsData);
        void broadcastSyncMLMsgOperationCB(const msg_error_t err, const int msgId, const int extId);
@@ -108,6 +114,8 @@ private:
 
        newmsg_list newMsgCBList;       // src_fd, msgType, port if registered
        mmsconf_list newMMSConfMsgCBList;       // src_fd, msgType, port if registered
+       pushmsg_list newPushMsgCBList;  // src_fd, msgType, port if registered
+       cbmsg_list newCBMsgCBList;      // src_fd, msgType, port if registered
        syncmlmsg_list newSyncMLMsgCBList;      // src_fd, msgType, port if registered
        lbsmsg_list newLBSMsgCBList;    // src_fd, msgType, port if registered
        javamms_list javaMMSList; // trId list to distinguish sent Java MMS msg when sendconf received
index 13e0312..b6771e4 100755 (executable)
@@ -50,6 +50,11 @@ int msg_message_set_struct_hnd(void *data, int field, void *value);
 
 void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S *pDst);
 
+int msg_cb_message_get_int_value(void *data, int field, int *value);
+int msg_cb_message_get_str_value(void *data, int field, char *value, int size);
+
+
+
 
 // filter
 int msg_get_filter_info_int(void *filter, int field);
@@ -142,6 +147,11 @@ int msg_set_general_opt_bool(void *general_opt, int field, bool value);
 int msg_get_msgsize_opt_int(void *size_opt, int field);
 int msg_set_msgsize_opt_int(void *size_opt, int field, int value);
 
+/* Wap Push */
+char* msg_push_config_get_str(void *event_info, int field, int size);
+bool msg_push_config_get_bool(void *event_info, int field);
+int msg_push_config_set_str(void *event_info, int field, char *value, int size);
+int msg_push_config_set_bool(void *event, int field, bool value);
 /* added internal apis for new managed api (storage) */
 int msg_syncml_info_get_int(void *syncml_info, int field);
 int msg_count_info_get_int(void *count_info, int field);
index 796f70f..0c2300d 100755 (executable)
@@ -2094,6 +2094,11 @@ int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_t
 
 int msg_get_message_list(msg_handle_t handle, msg_folder_id_t folder_id, msg_thread_id_t thread_id, msg_message_type_t msg_type, msg_storage_id_t storage_id, msg_struct_list_s *msg_list);
 
+int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_event);
+
+int msg_delete_push_event(msg_handle_t handle, const msg_struct_t push_event);
+
+int msg_update_push_event(msg_handle_t handle, const msg_struct_t src_event, const msg_struct_t dst_event);
 /**
  *     @}
  */
index f5b9e0d..522fe1a 100755 (executable)
@@ -503,6 +503,10 @@ int msg_reg_lbs_message_callback(msg_handle_t handle, msg_lbs_msg_incoming_cb cb
 int msg_reg_syncml_message_operation_callback(msg_handle_t handle,  msg_syncml_msg_operation_cb cb, void *user_param);
 
 
+int msg_reg_push_message_callback(msg_handle_t handle,  msg_push_msg_incoming_cb cb, const char *app_id, void *user_param);
+
+int msg_reg_cb_message_callback(msg_handle_t handle, msg_cb_incoming_cb  cb, bool bsave, void *user_param);
+
 /**
 
  * \par Description:
index 58229a5..db2b2b5 100755 (executable)
@@ -128,5 +128,9 @@ typedef void (*msg_lbs_msg_incoming_cb)(msg_handle_t handle, const char *push_he
 typedef void (*msg_syncml_msg_operation_cb)(msg_handle_t handle, int msgId, int extId, void *user_param);
 
 
+typedef void (*msg_push_msg_incoming_cb)(msg_handle_t handle, const char *push_header, const char *push_body, int push_body_len, void *user_param);
+
+
+typedef void (*msg_cb_incoming_cb)(msg_handle_t handle, msg_struct_t msg, void *user_param);
 
 #endif /* MSG_TRANSPORT_TYPES_H_ */
index 491c2f6..c2b067f 100755 (executable)
 #define MAX_COMMAND_LEN                1024
 #define MAX_FOLDER_NAME_SIZE           20
 
-#define MAX_WAPPUSH_ID_LEN                     40
-#define MAX_WAPPUSH_HREF_LEN           300
-#define MAX_WAPPUSH_CONTENTS_LEN       2048
+#define MAX_WAPPUSH_ID_LEN                             100
+#define MAX_WAPPUSH_CONTENT_TYPE_LEN   40
+#define MAX_WAPPUSH_HREF_LEN                   300
+#define MAX_WAPPUSH_CONTENTS_LEN               2048
 
 #define MAX_PUSH_CACHEOP_INVALID_OBJECT_MAX    5
 #define MAX_PUSH_CACHEOP_INVALID_SERVICE_MAX   5
@@ -358,6 +359,8 @@ enum _MSG_STRUCT_E {
        MSG_STRUCT_REJECT_MSG_INFO = 0x4400,                    /**< Indicates the MSG_STRUCT_REJECT_MSG_INFO */
        MSG_STRUCT_REQUEST_INFO = 0x4500,                               /**< Indicates the MSG_STRUCT_REQUEST_INFO */
        MSG_STRUCT_SENT_STATUS_INFO = 0x4600,                           /**< Indicates the MSG_STRUCT_SENT_STATUS_INFO */
+       MSG_STRUCT_PUSH_CONFIG_INFO = 0x4700,                           /**< Indicates the MSG_STRUCT_PUSH_CONFIG_INFO */
+       MSG_STRUCT_CB_MSG = 0x4800,                                             /**< Indicates the MSG_STRUCT_PUSH_CONFIG_INFO */
 };
 
 enum _MSG_MESSAGE_INFO_E_ {
@@ -422,7 +425,6 @@ enum _MSG_STRUCT_SETTING_SMSC_INFO_E {
 
 enum _MSG_STRUCT_CB_OPT_E {
        MSG_CB_RECEIVE_BOOL = MSG_STRUCT_SETTING_CB_OPT+1,              /**< Indicates whether the CB message is received or not. */
-       MSG_CB_RECEIVE_ALL_CHANNEL_BOOL,                        /**< Indicates whether All Channel's CB message is received or not. */
        MSG_CB_MAX_SIM_COUNT_INT,                               /**< Indicates the number of channels which can be stored in SIM. */
        MSG_CB_CHANNEL_LIST_STRUCT,                             /**< Indicates the cell broadcasting channel information. */
        MSG_CB_LANGUAGE_TYPE_ALL_BOOL,
@@ -696,6 +698,24 @@ enum MSG_SENT_STATUS_INFO_E {
        MSG_SENT_STATUS_NETWORK_STATUS_INT,                             /**< Indicates the status of the corresponding request. Refer to enum _MSG_NETWORK_STATUS_E*/
 };
 
+enum MSG_PUSH_CONFIG_INFO_E {
+       MSG_PUSH_CONFIG_CONTENT_TYPE_STR = MSG_STRUCT_PUSH_CONFIG_INFO+1,
+       MSG_PUSH_CONFIG_APPLICATON_ID_STR,
+       MSG_PUSH_CONFIG_PACKAGE_NAME_STR,
+       MSG_PUSH_CONFIG_LAUNCH_BOOL,
+};
+
+enum MSG_CB_MSG_E {
+       MSG_CB_MSG_TYPE_INT     = MSG_STRUCT_CB_MSG+1,          /**<  MSG_TYPE_SMS_CB/ETWS_PRIMARY/ETWS_SECONDARY (see _MSG_MESSAGE_TYPE_E) */
+       MSG_CB_MSG_RECV_TIME_INT,
+       MSG_CB_MSG_SERIAL_NUM_INT,                                              /**< serial number of CB/ETWS Primary Noti. : 2 bytes binary data */
+       MSG_CB_MSG_MSG_ID_INT,                                                  /**< message identifier of CB/ETWS Primary Noti. */
+       MSG_CB_MSG_DCS_INT,                                                             /**< Data coding scheme of CB MSG. */
+       MSG_CB_MSG_CB_TEXT_LEN_INT,                                             /**< length of CB text (except NULL) */
+       MSG_CB_MSG_CB_TEXT_STR,                                                 /**< CB text */
+       MSG_CB_MSG_ETWS_WARNING_TYPE_INT,                               /**< warning type of ETWS Primary Noti. : 2 bytes binary data */
+       MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR,                  /**< warning security information of ETWS Primary Noti. : 50 bytes binary data */
+};
 
 /**
  *     @brief  Represents the values of a message class type. \n
@@ -728,6 +748,9 @@ enum _MSG_CLASS_TYPE_E
        MSG_TYPE_MMS,                                   /** < Normal MMS Message */
        MSG_TYPE_MMS_JAVA,                      /** < JAVA MMS Message */
        MSG_TYPE_MMS_NOTI,                      /** < MMS Notification Message */
+
+       MSG_TYPE_SMS_ETWS_PRIMARY,              /** < CB - ETWS Primary Notification */
+       MSG_TYPE_SMS_ETWS_SECONDARY,    /** < CB - ETWS Secondary Notification */
 };
 
 
index ff1d0fb..a8c0c26 100755 (executable)
@@ -55,7 +55,8 @@ class MsgHandle
                msg_error_t regMmsConfMessageCallback(msg_mms_conf_msg_incoming_cb onMMSConfMsgIncoming, const char *pAppId, void *pUserParam);
                msg_error_t regSyncMLMessageCallback(msg_syncml_msg_incoming_cb onSyncMLMsgIncoming, void *pUserParam);
                msg_error_t regLBSMessageCallback(msg_lbs_msg_incoming_cb onLBSMsgIncoming, void *pUserParam);
-
+               msg_error_t regPushMessageCallback(msg_push_msg_incoming_cb onPushMsgIncoming, const char *pAppId, void *pUserParam);
+               msg_error_t regCBMessageCallback(msg_cb_incoming_cb onCBIncoming, bool bSave, void *pUserParam);
                msg_error_t regSyncMLMessageOperationCallback(msg_syncml_msg_operation_cb onSyncMLMsgOperation, void *pUserParam);
 
                msg_error_t operateSyncMLMessage(msg_message_id_t msgId);
@@ -130,6 +131,10 @@ class MsgHandle
                msg_error_t getThreadIdByAddress(msg_struct_list_s *pAddrList, msg_thread_id_t *pThreadId);
                msg_error_t getThread(msg_thread_id_t threadId, MSG_THREAD_VIEW_S* pThreadInfo);
                msg_error_t getMessageList(msg_folder_id_t folderId, msg_thread_id_t threadId, msg_message_type_t msgType, msg_storage_id_t storageId, msg_struct_list_s *pMsgList);
+               // Push Event
+               msg_error_t addPushEvent(MSG_PUSH_EVENT_INFO_S *push_event);
+               msg_error_t deletePushEvent(MSG_PUSH_EVENT_INFO_S *push_event);
+               msg_error_t updatePushEvent(MSG_PUSH_EVENT_INFO_S *pSrc, MSG_PUSH_EVENT_INFO_S *pDst);
 
                void convertMsgStruct(const MSG_MESSAGE_INFO_S *pSource, MSG_MESSAGE_HIDDEN_S *pDest);
                void convertSendOptStruct(const MSG_SENDINGOPT_INFO_S* pSrc, MSG_SENDINGOPT_S* pDest, MSG_MESSAGE_TYPE_S msgType);
index 53002cf..47385dd 100755 (executable)
@@ -60,6 +60,22 @@ typedef struct
 typedef struct
 {
        MsgHandle* hAddr;
+       msg_push_msg_incoming_cb pfPushIncomingCB;
+       char appId[MAX_WAPPUSH_ID_LEN+1];
+       void* userParam;
+} MSG_PUSH_INCOMING_CB_ITEM_S;
+
+typedef struct
+{
+       MsgHandle* hAddr;
+       msg_cb_incoming_cb pfCBIncomingCB;
+       bool bsave;
+       void* userParam;
+} MSG_CB_INCOMING_CB_ITEM_S;
+
+typedef struct
+{
+       MsgHandle* hAddr;
        msg_syncml_msg_incoming_cb pfSyncMLIncomingCB;
        void* userParam;
 } MSG_SYNCML_INCOMING_CB_ITEM_S;
@@ -89,6 +105,8 @@ typedef struct
 typedef std::list<MSG_SENT_STATUS_CB_ITEM_S> MsgSentStatusCBList;
 typedef std::list<MSG_INCOMING_CB_ITEM_S> MsgNewMessageCBList;
 typedef std::list<MSG_MMS_CONF_INCOMING_CB_ITEM_S> MsgNewMMSConfMessageCBList;
+typedef std::list<MSG_PUSH_INCOMING_CB_ITEM_S> MsgNewPushMessageCBList;
+typedef std::list<MSG_CB_INCOMING_CB_ITEM_S> MsgNewCBMessageCBList;
 typedef std::list<MSG_SYNCML_INCOMING_CB_ITEM_S> MsgNewSyncMLMessageCBList;
 typedef std::list<MSG_LBS_INCOMING_CB_ITEM_S> MsgNewLBSMessageCBList;
 typedef std::list<MSG_SYNCML_OPERATION_CB_ITEM_S> MsgOperationSyncMLMessageCBList;
@@ -109,6 +127,8 @@ public:
        bool regSentStatusEventCB(MsgHandle* pMsgHandle, msg_sent_status_cb pfSentStatus, void *pUserParam);
        bool regMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_sms_incoming_cb pfNewMessage, int port, void *pUserParam);
        bool regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_mms_conf_msg_incoming_cb pfNewMMSConfMessage, const char *pAppId, void *pUserParam);
+       bool regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_push_msg_incoming_cb pfNewPushMessage, const char *pAppId, void *pUserParam);
+       bool regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_cb_incoming_cb pfNewCBMessage, bool bSave, void *pUserParam);
        bool regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_incoming_cb pfNewSyncMLMessage, void *pUserParam);
        bool regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_lbs_msg_incoming_cb pfNewLBSMsgIncoming, void *pUserParam);
        bool regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_operation_cb pfSyncMLMessageOperation, void *pUserParam);
@@ -137,6 +157,8 @@ private:
        MsgSentStatusCBList sentStatusCBList;
        MsgNewMessageCBList newMessageCBList;
        MsgNewMMSConfMessageCBList newMMSConfMessageCBList;
+       MsgNewPushMessageCBList newPushMessageCBList;
+       MsgNewCBMessageCBList newCBMessageCBList;
        MsgNewSyncMLMessageCBList newSyncMLMessageCBList;
        MsgNewLBSMessageCBList newLBSMessageCBList;
        MsgOperationSyncMLMessageCBList operationSyncMLMessageCBList;
index e219b7a..55defbc 100755 (executable)
@@ -40,6 +40,7 @@
 #define MSGFW_SYNCML_MSG_TABLE_NAME            "MSG_SYNCML_TABLE"
 #define MSGFW_SMS_SENDOPT_TABLE_NAME           "MSG_SMS_SENDOPT_TABLE"
 
+#define MSGFW_PUSH_CONFIG_TABLE_NAME                   "MSG_PUSHCFG_TABLE"
 #define MAX_QUERY_LEN                                  3072
 #define MAX_FOLDER_NAME_LEN            20
 #define MAX_ACCOUNT_NAME_LEN   51
index 23fabc4..d69bdbd 100755 (executable)
@@ -151,6 +151,8 @@ int msg_message_get_int_value(void *data, int field, int *value)
                                *value = MSG_TYPE_SMS_SYNCML;
                        else if (msg_data->subType == MSG_REJECT_SMS)
                                *value = MSG_TYPE_SMS_REJECT;
+                       else if (msg_data->subType == MSG_ETWS_SMS)
+                               *value = MSG_TYPE_SMS_ETWS_PRIMARY;
                        else
                                *value = MSG_TYPE_SMS;
         }
@@ -260,8 +262,13 @@ int msg_message_get_str_value(void *data, int field, char *value, int size)
                break;
        case MSG_MESSAGE_SMS_DATA_STR :
        case MSG_MESSAGE_MMS_TEXT_STR :
-               if (msg_data->pData != NULL)
-                       strncpy(value, (char *)msg_data->pData, size);
+               if (msg_data->pData)
+               {
+                       int data_len = 0;
+                       (size >= msg_data->dataSize)? (data_len = msg_data->dataSize) : data_len = size;
+                       memset(value, 0, size);
+                       memcpy(value, msg_data->pData, data_len);
+               }
                break;
        default :
                ret = MSG_ERR_INVALID_PARAMETER;
@@ -442,16 +449,13 @@ int msg_message_set_str_value(void *data, int field, char *value, int size)
                break;
        case MSG_MESSAGE_SMS_DATA_STR :
        {
-                if (msg_data->pData)
-                        delete [] static_cast<char*>(msg_data->pData);
-
-                msg_data->dataSize = size;
-
-                msg_data->pData = (void*)new char[msg_data->dataSize+1];
-
-                memcpy((char *)msg_data->pData, value, msg_data->dataSize);
+               if (msg_data->pData)
+                       delete [] static_cast<char*>(msg_data->pData);
 
-                ((char*) msg_data->pData)[msg_data->dataSize] = '\0';
+               msg_data->dataSize = size;
+               msg_data->pData = (void*)new char[msg_data->dataSize+1];
+               memcpy((char *)msg_data->pData, value, msg_data->dataSize);
+               ((char*) msg_data->pData)[msg_data->dataSize] = '\0';
        }
                break;
        default :
@@ -512,6 +516,7 @@ void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S *
                {
                        int data_len = strlen((const char *)pSrc->pData);
                        pDst->pData = new char[data_len + 1];
+                       memset(pDst->pData, 0x00, data_len + 1);
                        strncpy((char *)pDst->pData, (const char *)pSrc->pData, data_len);
                }
        }
@@ -527,6 +532,91 @@ void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S *
        }
 }
 
+int msg_cb_message_get_int_value(void *data, int field, int *value)
+{
+       if (!data)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
+       MSG_CB_MSG_S *cb_msg = (MSG_CB_MSG_S *)data;
+
+       *value = 0;
+
+       switch (field)
+       {
+               case MSG_CB_MSG_TYPE_INT :
+                       {
+                               if ( cb_msg->type == MSG_ETWS_SMS )
+                                       *value = MSG_TYPE_SMS_ETWS_PRIMARY;
+                               else if ( cb_msg->type == MSG_CB_SMS )
+                                       *value = ((cb_msg->messageId & 0xFFF8) == 0x1100 ) ? MSG_TYPE_SMS_ETWS_SECONDARY : MSG_TYPE_SMS_CB;
+                               else
+                                       ret = MSG_ERR_UNKNOWN;
+                       }
+                       break;
+               case MSG_CB_MSG_RECV_TIME_INT :
+                       *value = cb_msg->receivedTime;
+                       break;
+               case MSG_CB_MSG_SERIAL_NUM_INT :
+                       *value = cb_msg->serialNum;
+                       break;
+               case MSG_CB_MSG_MSG_ID_INT :
+                       *value = cb_msg->messageId;
+                       break;
+               case MSG_CB_MSG_DCS_INT :
+                       *value = (int)cb_msg->dcs;
+                       break;
+               case MSG_CB_MSG_CB_TEXT_LEN_INT :
+                       *value = cb_msg->cbTextLen;
+                       break;
+               case MSG_CB_MSG_ETWS_WARNING_TYPE_INT :
+                       *value = cb_msg->etwsWarningType;
+               default :
+                       ret = MSG_ERR_INVALID_PARAMETER;
+                       break;
+       }
+
+       return ret;
+}
+
+int msg_cb_message_get_str_value(void *data, int field, char *value, int size)
+{
+       if (!data || !value)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
+       MSG_CB_MSG_S *cb_msg = (MSG_CB_MSG_S *)data;
+
+       switch (field) {
+               case MSG_CB_MSG_CB_TEXT_STR:
+                       {
+                               int     copylen = 0;
+                               copylen = (size > cb_msg->cbTextLen) ? cb_msg->cbTextLen : size - 1;
+                               memcpy (value, cb_msg->cbText, copylen);
+                               value[copylen] = '\0';
+                       }
+                       break;
+               case MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR:
+                       {
+                               if (size < sizeof(cb_msg->etwsWarningSecurityInfo))
+                                       ret = MSG_ERR_INVALID_PARAMETER;
+                               else
+                                       memcpy (value, cb_msg->etwsWarningSecurityInfo, sizeof(cb_msg->etwsWarningSecurityInfo));
+                       }
+                       break;
+
+               default :
+                       ret = MSG_ERR_INVALID_PARAMETER;
+                       break;
+       }
+
+       return ret;
+}
+
+
+
 EXPORT_API int msg_get_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t mms_struct_handle)
 {
        //TODO :: check message type is MMS
index c729773..76bf5f4 100755 (executable)
@@ -2278,7 +2278,173 @@ int msg_sms_sendopt_set_bool(void *option, int field, bool value)
                pOpt->bReplyPath = value;
                break;
     default:
-               err = MSG_ERR_UNKNOWN;
+       err = MSG_ERR_UNKNOWN;
+               break;
+    }
+       return err;
+}
+
+EXPORT_API int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_event)
+{
+       msg_error_t err =  MSG_SUCCESS;
+
+       if (handle == NULL || push_event == NULL)
+       {
+               return -EINVAL;
+       }
+
+       MsgHandle* pHandle = (MsgHandle*)handle;
+
+       msg_struct_s *pPush = (msg_struct_s *)push_event;
+
+       try
+       {
+               err = pHandle->addPushEvent((MSG_PUSH_EVENT_INFO_S *)pPush->data);
+       }
+       catch (MsgException& e)
+       {
+               MSG_FATAL("%s", e.what());
+               return MSG_ERR_STORAGE_ERROR;
+       }
+
+       return err;
+}
+
+EXPORT_API int msg_delete_push_event(msg_handle_t handle, const msg_struct_t push_event)
+{
+       msg_error_t err =  MSG_SUCCESS;
+
+       if (handle == NULL || push_event == NULL)
+       {
+               return -EINVAL;
+       }
+
+       MsgHandle* pHandle = (MsgHandle*)handle;
+
+       msg_struct_s *pPush = (msg_struct_s *)push_event;
+
+       try
+       {
+               err = pHandle->deletePushEvent((MSG_PUSH_EVENT_INFO_S *)pPush->data);
+       }
+       catch (MsgException& e)
+       {
+               MSG_FATAL("%s", e.what());
+               return MSG_ERR_STORAGE_ERROR;
+       }
+
+       return err;
+}
+
+EXPORT_API int msg_update_push_event(msg_handle_t handle, const msg_struct_t src_event, const msg_struct_t dst_event)
+{
+       msg_error_t err =  MSG_SUCCESS;
+
+       if (handle == NULL || src_event == NULL || dst_event == NULL)
+       {
+               return -EINVAL;
+       }
+
+       MsgHandle* pHandle = (MsgHandle*)handle;
+
+       msg_struct_s *pSrc = (msg_struct_s *)src_event;
+       msg_struct_s *pDst = (msg_struct_s *)dst_event;
+
+       try
+       {
+               err = pHandle->updatePushEvent((MSG_PUSH_EVENT_INFO_S *)pSrc->data, (MSG_PUSH_EVENT_INFO_S *)pDst->data);
+       }
+       catch (MsgException& e)
+       {
+               MSG_FATAL("%s", e.what());
+               return MSG_ERR_STORAGE_ERROR;
+       }
+
+       return err;
+}
+
+char* msg_push_config_get_str(void *event_info, int field, int size)
+{
+       char *result = NULL;
+       MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
+       switch(field)
+       {
+    case MSG_PUSH_CONFIG_CONTENT_TYPE_STR:
+               result = pEvent->contentType;
+               break;
+    case MSG_PUSH_CONFIG_APPLICATON_ID_STR:
+               result = pEvent->appId;
+               break;
+    case MSG_PUSH_CONFIG_PACKAGE_NAME_STR:
+               result = pEvent->pkgName;
+               break;
+
+       default:
+               result = NULL;
+               break;
+       }
+       return result;
+}
+
+bool msg_push_config_get_bool(void *event_info, int field)
+{
+       bool result = false;
+       MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
+       switch(field)
+       {
+    case MSG_PUSH_CONFIG_LAUNCH_BOOL:
+       result = pEvent->bLaunch;
+               break;
+       default:
+               break;
+       }
+       return result;
+}
+
+int msg_push_config_set_str(void *event_info, int field, char *value, int size)
+{
+       msg_error_t err =  MSG_SUCCESS;
+       if(!event_info || !value)
+               return MSG_ERR_NULL_POINTER;
+    MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
+    int _len = 0;
+
+    switch(field)
+    {
+    case MSG_PUSH_CONFIG_CONTENT_TYPE_STR:
+        (size > MAX_WAPPUSH_CONTENT_TYPE_LEN)? _len = MAX_WAPPUSH_CONTENT_TYPE_LEN : _len = size;
+               strncpy(pEvent->contentType, value, _len);
+               break;
+    case MSG_PUSH_CONFIG_APPLICATON_ID_STR:
+        (size > MAX_WAPPUSH_ID_LEN)? _len = MAX_WAPPUSH_ID_LEN : _len = size;
+               strncpy(pEvent->appId, value, _len);
+               break;
+    case MSG_PUSH_CONFIG_PACKAGE_NAME_STR:
+        (size > MSG_FILEPATH_LEN_MAX)? _len = MSG_FILEPATH_LEN_MAX : _len = size;
+               strncpy(pEvent->pkgName, value, _len);
+               break;
+    default:
+       err = MSG_ERR_UNKNOWN;
+               break;
+    }
+
+       return err;
+}
+
+int msg_push_config_set_bool(void *event, int field, bool value)
+{
+       msg_error_t err =  MSG_SUCCESS;
+       if(!event)
+               return MSG_ERR_NULL_POINTER;
+
+       MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event;
+    switch(field)
+    {
+    case MSG_PUSH_CONFIG_LAUNCH_BOOL:
+       pEvent->bLaunch = value;
+               break;
+    default:
+       err = MSG_ERR_UNKNOWN;
                break;
     }
        return err;
index 7a269e0..f05138c 100755 (executable)
@@ -302,6 +302,10 @@ EXPORT_API msg_struct_t msg_create_struct(int field)
        case MSG_STRUCT_MMS_SMIL_AVI:
                msg_struct->data = msg_mms_create_struct_data(field);
                break;
+       case MSG_STRUCT_PUSH_CONFIG_INFO:
+               msg_struct->data = new MSG_PUSH_EVENT_INFO_S;
+               memset(msg_struct->data, 0x00, sizeof(MSG_PUSH_EVENT_INFO_S));
+               break;
        }
 
        return (msg_struct_t) msg_struct;
@@ -639,6 +643,15 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle)
                *msg_struct_handle = NULL;
                break;
        }
+       case MSG_STRUCT_PUSH_CONFIG_INFO:
+       {
+               delete (MSG_PUSH_EVENT_INFO_S*)(msg_struct->data);
+               msg_struct->data = NULL;
+
+               delete msg_struct;
+               *msg_struct_handle = NULL;
+               break;
+       }
        default :
                err = MSG_ERR_INVALID_PARAMETER;
                break;
@@ -737,6 +750,9 @@ EXPORT_API int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int
        case MSG_STRUCT_SENT_STATUS_INFO :
                *value = msg_sent_status_get_int((MSG_SENT_STATUS_S *)msg_struct->data, field);
                break;
+       case MSG_STRUCT_CB_MSG :
+               err = msg_cb_message_get_int_value (msg_struct->data, field, value);
+               break;
        case MSG_STRUCT_MMS:
        case MSG_STRUCT_MMS_PAGE:
        case MSG_STRUCT_MMS_MEDIA:
@@ -847,6 +863,15 @@ EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char
        case MSG_STRUCT_SETTING_VOICE_MSG_OPT :
                err = msg_setting_get_str_value(msg_struct, field, src, size);
                break;
+       case MSG_STRUCT_PUSH_CONFIG_INFO :
+               ret_str = msg_push_config_get_str(msg_struct->data, field, size);
+               if (ret_str == NULL)
+                       err = MSG_ERR_UNKNOWN;
+               else
+                       strncpy(src, ret_str, size);
+               break;
+       case MSG_STRUCT_CB_MSG :
+               err = msg_cb_message_get_str_value(msg_struct->data, field, src, size);
        default :
                err = MSG_ERR_INVALID_PARAMETER;
                break;
@@ -1120,6 +1145,9 @@ EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char
        case MSG_STRUCT_SETTING_VOICE_MSG_OPT :
                err = msg_setting_set_str_value(msg_struct, field, value, size);
                break;
+       case MSG_STRUCT_PUSH_CONFIG_INFO:
+               err = msg_push_config_set_str(msg_struct->data, field, value, size);
+               break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
                break;
@@ -1177,6 +1205,9 @@ EXPORT_API int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, boo
        case MSG_STRUCT_SETTING_GENERAL_OPT :
                err = msg_setting_set_bool_value(msg_struct, field, value);
                break;
+       case MSG_STRUCT_PUSH_CONFIG_INFO:
+               err = msg_push_config_set_bool(msg_struct->data, field, value);
+               break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
                break;
index ec6dfd6..30ece6d 100755 (executable)
@@ -211,6 +211,59 @@ EXPORT_API int msg_reg_syncml_message_operation_callback(msg_handle_t handle,  m
 }
 
 
+EXPORT_API int msg_reg_push_message_callback(msg_handle_t handle,  msg_push_msg_incoming_cb cb, const char *app_id, void *user_param)
+{
+       msg_error_t err =  MSG_SUCCESS;
+
+       if (handle == NULL || cb == NULL)
+       {
+               return -EINVAL;
+       }
+
+       if (app_id && strlen(app_id) > MAX_WAPPUSH_ID_LEN)
+       {
+               return -EINVAL;
+       }
+
+       MsgHandle* pHandle = (MsgHandle*)handle;
+
+       try
+       {
+               err = pHandle->regPushMessageCallback(cb, app_id, user_param);
+       }
+       catch (MsgException& e)
+       {
+               MSG_FATAL("%s", e.what());
+               return MSG_ERR_CALLBACK_ERROR;
+       }
+
+       return err;
+}
+
+EXPORT_API int msg_reg_cb_message_callback(msg_handle_t handle, msg_cb_incoming_cb  cb, bool bsave, void *user_param)
+{
+       msg_error_t err =  MSG_SUCCESS;
+
+       if (handle == NULL || cb == NULL)
+       {
+               return -EINVAL;
+       }
+
+       MsgHandle* pHandle = (MsgHandle*)handle;
+
+       try
+       {
+               err = pHandle->regCBMessageCallback(cb, bsave, user_param);
+       }
+       catch (MsgException& e)
+       {
+               MSG_FATAL("%s", e.what());
+               return MSG_ERR_CALLBACK_ERROR;
+       }
+
+       return err;
+}
+
 EXPORT_API int msg_syncml_message_operation(msg_handle_t handle,  msg_message_id_t msgId)
 {
        msg_error_t err =  MSG_SUCCESS;
index 893f0ce..049b3a8 100755 (executable)
@@ -29,7 +29,7 @@ INCLUDE_DIRECTORIES(
 )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(msg_helper_pkgs REQUIRED glib-2.0 dlog vconf devman_haptic mm-player mm-fileinfo mm-player svi sensor)
+pkg_check_modules(msg_helper_pkgs REQUIRED glib-2.0 dlog vconf devman_haptic mm-player mm-fileinfo mm-player sensor)
 
 FOREACH(flag ${msg_helper_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 10da84f..88dd1f0 100755 (executable)
@@ -24,7 +24,7 @@
 #include "MsgHelper.h"
 
 #include <devman_managed.h>
-#include <svi.h>
+//#include <svi.h>
 
 #include <mm_error.h>
 #include <mm_player.h>
@@ -386,7 +386,7 @@ int MsgSoundPlayMelody(char *pMsgToneFilePath, bool bIncreasing)
 void MsgSoundPlayVibration()
 {
        MSG_BEGIN();
-
+/*
        int ret = 0;
        int vibLevel = 0;
        char ivtFilePath[MAX_SOUND_FILE_LEN] = {0,};
@@ -400,7 +400,7 @@ void MsgSoundPlayVibration()
 
                g_timeout_add(MSG_VIBRATION_INTERVAL , MsgSoundVibTimeout, NULL);
 
-               /* set timer to stop vibration, then play melody */
+               // set timer to stop vibration, then play melody
                svi_get_path(SVI_TYPE_VIB, SVI_VIB_NOTIFICATION_MESSAGE, ivtFilePath, sizeof(ivtFilePath));
                ret = device_haptic_play_file(dev_handle, ivtFilePath, HAPTIC_TEST_ITERATION, vibLevel);
 
@@ -408,7 +408,7 @@ void MsgSoundPlayVibration()
                        MSG_DEBUG("Fail to play haptic : [%d]", ret);
                }
        }
-
+*/
        MSG_END();
 }
 
index b626d5a..d35a666 100755 (executable)
@@ -133,6 +133,7 @@ then
     CREATE TABLE MSG_SMS_SENDOPT_TABLE ( MSG_ID INTEGER , DELREP_REQ INTEGER NOT NULL , KEEP_COPY INTEGER NOT NULL , REPLY_PATH INTEGER NOT NULL , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
     CREATE TABLE MSG_FILTER_TABLE ( FILTER_ID INTEGER PRIMARY KEY , FILTER_TYPE INTEGER NOT NULL , FILTER_VALUE TEXT NOT NULL );
     CREATE TABLE MSG_MMS_MESSAGE_TABLE ( MSG_ID INTEGER , TRANSACTION_ID TEXT , MESSAGE_ID TEXT , FWD_MESSAGE_ID TEXT , CONTENTS_LOCATION TEXT , FILE_PATH TEXT , VERSION INTEGER NOT NULL , DATA_TYPE INTEGER DEFAULT -1 , DATE DATETIME , HIDE_ADDRESS INTEGER DEFAULT 0 , ASK_DELIVERY_REPORT INTEGER DEFAULT 0 , REPORT_ALLOWED INTEGER DEFAULT 0 , READ_REPORT_ALLOWED_TYPE INTEGER DEFAULT 0 , ASK_READ_REPLY INTEGER DEFAULT 0 , READ INTEGER DEFAULT 0 , READ_REPORT_SEND_STATUS INTEGER DEFAULT 0 , READ_REPORT_SENT INTEGER DEFAULT 0 , PRIORITY INTEGER DEFAULT 0 , KEEP_COPY INTEGER DEFAULT 0 , MSG_SIZE INTEGER NOT NULL , MSG_CLASS INTEGER DEFAULT -1 , EXPIRY_TIME DATETIME , CUSTOM_DELIVERY_TIME INTEGER DEFAULT 0 , DELIVERY_TIME DATETIME , MSG_STATUS INTEGER DEFAULT -1 , FOREIGN KEY (MSG_ID) REFERENCES MSG_MESSAGE_TABLE (MSG_ID) );
+    CREATE TABLE MSG_PUSHCFG_TABLE ( PUSH_ID INTEGER , CONTENT_TYPE TEXT, APP_ID TEXT, PKG_NAME TEXT, LAUNCH INTEGER, APPCODE INTEGER, SECURE INTEGER);
 
     CREATE INDEX MSG_CONVERSATION_INDEX ON MSG_CONVERSATION_TABLE(CONV_ID);
     CREATE INDEX MSG_FOLDER_INDEX ON MSG_FOLDER_TABLE(FOLDER_ID);
@@ -145,7 +146,49 @@ then
     INSERT INTO MSG_FOLDER_TABLE VALUES (5, 'CBMSGBOX', 1);
     INSERT INTO MSG_FOLDER_TABLE VALUES (6, 'SPAMBOX', 4);
     INSERT INTO MSG_FOLDER_TABLE VALUES (7, 'SMS TEMPLATE', 5);
-    INSERT INTO MSG_FOLDER_TABLE VALUES (8, 'MMS TEMPLATE', 5);"
+    INSERT INTO MSG_FOLDER_TABLE VALUES (8, 'MMS TEMPLATE', 5);
+
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (1, 'text/vnd.wap.si', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 1, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (2, 'application/vnd.wap.sic', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 2, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (3, 'text/vnd.wap.sl', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 3, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (4, 'application/vnd.wap.slc', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 4, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (5, 'text/vnd.wap.co', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 5, 0);
+
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (6, 'application/vnd.wap.coc', 'X-Wap-Application-Id: x-wap-application:wml.ua', '', 0, 6, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (7, 'application/vnd.wap.mms-message', 'X-Wap-Application-Id: x-wap-application:mms.ua', '', 0, 7, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (8, 'application/vnd.wap.sia', 'X-Wap-Application-Id: x-wap-application:push.sia', '', 0, 8, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (9, 'application/vnd.syncml.dm+wbxml', 'X-Wap-Application-Id: x-wap-application:push.syncml.dm', '', 0, 9, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (10, 'application/vnd.syncml.dm+xml', 'X-Wap-Application-Id: x-wap-application:push.syncml.dm', '', 0, 10, 0);
+
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (11, 'application/vnd.syncml.notification', 'X-Wap-Application-Id: x-wap-application:push.syncml.dm', '', 0, 11, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (12, 'application/vnd.syncml.ds.notification', 'X-Wap-Application-Id: x-wap-application:push.syncml.ds', '', 0, 12, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (13, 'application/vnd.syncml+wbxml', 'X-Wap-Application-Id:x-wap-application:push.syncml', '', 0, 13, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (14, 'application/vnd.wap.locc+wbxml', 'X-Wap-Application-Id: x-wap-application:loc.ua', '', 0, 14, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (15, 'application/vnd.wap.loc+xml', 'X-Wap-Application-Id: x-wap-application:loc.ua', '', 0, 15, 0);
+
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (16, 'application/vnd.oma.dd+xml', 'X-Wap-Application-Id: x-wap-application:loc.ua', '', 0, 16, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (17, 'application/vnd.oma.drm.message', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 17, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (18, 'application/vnd.oma.drm.content', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 18, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (19, 'application/vnd.oma.drm.rights+xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 19, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (20, 'application/vnd.oma.drm.rights+wbxml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 20, 0);
+
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (21, 'application/vnd.oma.drm.ro+xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 21, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (22, 'application/vnd.oma.drm.roap-pdu+xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 22, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (23, 'application/vnd.oma.drm.roap-trigger+xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 23, 0);
+    INSERT INTO MSG_PUSHCFG_TABLE VALUES (24, 'application/vnd.oma.drm.roap-trigger+wbxml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 24, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (25, 'text/vnd.wap.connectivity-xml', 'X-Wap-Application-Id: x-wap-application:drm.ua', '', 0, 26, 0);
+
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (26, 'application/vnd.wap.connectivity-wbxml', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 27, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (27, 'application/x-wap-prov.browser-settings', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 28, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (28, 'application/x-wap-prov.browser-bookmarks', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 29, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (29, 'application/x-wap-prov.syncset+xml', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 30, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (30, 'application/x-wap-prov.syncset+wbxml', 'X-Wap-Application-Id: x-wap-samsung:provisioning.ua', '', 0, 31, 0);
+
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (31, 'text/vnd.wap.emn+xml', 'X-Wap-Application-Id: x-wap-application:emn.ua', '', 0, 32, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (32, 'application/vnd.wap.emn+wbxml', 'X-Wap-Application-Id: x-wap-application:emn.ua', '', 0, 33, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (33, 'application/vnd.wv.csp.cir', 'X-Wap-Application-Id: x-wap-application:wv.ua', '', 0, 34, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (34, 'application/vnd.omaloc-supl-init', 'X-Wap-Application-Id: x-oma-application:ulp.ua', '', 0, 44, 0);
+       INSERT INTO MSG_PUSHCFG_TABLE VALUES (35, 'application/vnd.wap.emn+wbxml', 'X-oma-docomo:xmd.mail.ua', '', 0, 45, 1);"
 fi
 
 chown :6011 /opt/dbspace/.msg_service.db
@@ -254,6 +297,7 @@ vconftool set -t int db/private/msg-service/push_msg/service_load 1
 
 # CB Msg Options
 vconftool set -t bool db/private/msg-service/cb_msg/receive 1 -f
+vconftool set -t bool db/private/msg-service/cb_msg/save 1 -f
 vconftool set -t int db/private/msg-service/cb_msg/max_sim_count 0
 vconftool set -t int db/private/msg-service/cb_msg/channel_count 0
 vconftool set -t bool db/private/msg-service/cb_msg/language/0 1 -f
index 337a4e7..a11a027 100755 (executable)
@@ -196,6 +196,29 @@ void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data,
 }
 
 
+void TapiEventEtwsMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
+{
+       MSG_DEBUG("TapiEventEtwsMsgIncoming is called. noti_id [%s]", noti_id);
+
+       if (data == NULL) {
+               MSG_DEBUG("Error. evt->pData is NULL.");
+               return;
+       }
+
+       TelSmsEtwsMsg_t *pEtwsMsg = (TelSmsEtwsMsg_t*)data;
+
+       try
+       {
+               SmsPluginCbMsgHandler::instance()->handleEtwsMsg(pEtwsMsg);
+       }
+       catch (MsgException& e)
+       {
+               MSG_FATAL("%s", e.what());
+               return;
+       }
+}
+
+
 void TapiEventDeliveryReportCNF(TapiHandle *handle, int result, void *data, void *user_data)
 {
        MSG_DEBUG("TapiEventDeliveryReportCNF is called. : result = [%d]", result);
@@ -755,6 +778,7 @@ void SmsPluginCallback::registerEvent()
 
        tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_INCOM_MSG, TapiEventMsgIncoming, NULL);
        tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_CB_INCOM_MSG, TapiEventCbMsgIncoming, NULL);
+       tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_ETWS_INCOM_MSG, TapiEventEtwsMsgIncoming, NULL);
 //     tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_REFRESH, TapiEventSatSmsRefresh, NULL);
        tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_SEND_SMS, TapiEventSatSendSms, NULL);
 //     tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_MO_SMS_CTRL, TapiEventSatMoSmsCtrl, NULL);
index 82d22f5..16ea14e 100755 (executable)
@@ -112,9 +112,27 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
 
                if (err == MSG_SUCCESS)
                {
-                       // Callback
-                       err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
+                       MSG_CB_MSG_S cbOutMsg = {0, };
 
+                       cbOutMsg.type = MSG_CB_SMS;
+                       cbOutMsg.receivedTime = cbMsg.recvTime;
+                       cbOutMsg.serialNum = encodeCbSerialNum (CbMsgPage.pageHeader.serialNum);
+                       cbOutMsg.messageId = cbMsg.msgId;
+                       cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData;
+                       memset (cbOutMsg.cbText, 0x00, sizeof(cbOutMsg.cbText));
+
+                       SMS_LANG_INFO_S langInfo = {0};
+
+                       langInfo.bSingleShift = false;
+                       langInfo.bLockingShift = false;
+
+                       if (cbMsg.codingScheme == SMS_CHARSET_7BIT)
+                               cbOutMsg.cbTextLen = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), (unsigned char*)cbMsg.msgData, cbMsg.msgLength, &langInfo);
+                       else if (cbMsg.codingScheme == SMS_CHARSET_UCS2)
+                               cbOutMsg.cbTextLen = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), (unsigned char*)cbMsg.msgData, cbMsg.msgLength);
+
+
+                       err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg);
                        if (err != MSG_SUCCESS)
                        {
                                MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
@@ -132,6 +150,40 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
 }
 
 
+void SmsPluginCbMsgHandler::handleEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg)
+{
+       MSG_BEGIN();
+       msg_error_t err = MSG_SUCCESS;
+       SMS_ETWS_NETWORK_TYPE_T type = pEtwsMsg->EtwsMsgType;
+       //MSG_MESSAGE_INFO_S msgInfo = {};
+       SMS_ETWS_PRIMARY_S              etwsPn = {0, };
+       MSG_CB_MSG_S                    cbOutMsg = {0, };
+
+       if(type != TAPI_NETTEXT_ETWS_PRIMARY)
+       {
+               MSG_DEBUG("The Etws Msg is not supported");
+               return;
+       }
+       DecodeEtwsMsg(pEtwsMsg, &etwsPn);
+       //convertEtwsMsgToMsginfo(CbMsgPage, &msgInfo);
+
+       cbOutMsg.type = MSG_ETWS_SMS;
+       cbOutMsg.receivedTime = etwsPn.recvTime;
+       cbOutMsg.serialNum = encodeCbSerialNum (etwsPn.serialNum);
+       cbOutMsg.messageId = etwsPn.msgId;
+       cbOutMsg.etwsWarningType = etwsPn.warningType;
+       memcpy (cbOutMsg.etwsWarningSecurityInfo, etwsPn.warningSecurityInfo, sizeof(cbOutMsg.etwsWarningSecurityInfo));
+
+       err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg);
+       if (err != MSG_SUCCESS)
+       {
+               MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
+       }
+
+       MSG_END();
+}
+
+
 void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
 {
        if (pCbMsg->Length > MAX_CBMSG_PAGE_SIZE)
@@ -222,6 +274,47 @@ MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->
 }
 
 
+void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PRIMARY_S *pEtwsPn)
+{
+       if ( !pEtwsMsg || !pEtwsPn )
+               return;
+
+       if (pEtwsMsg->Length > MAX_ETWS_SIZE)
+               THROW(MsgException::SMS_PLG_ERROR, "ETWS Msg Size is over MAX [%d]", pEtwsMsg->Length);
+
+       unsigned char EtwsData[pEtwsMsg->Length+1];
+
+       memset(EtwsData, 0x00, sizeof(EtwsData));
+       memcpy(EtwsData, pEtwsMsg->szMsgData, pEtwsMsg->Length);
+       EtwsData[pEtwsMsg->Length] = '\0';
+
+       // received time
+       pEtwsPn->recvTime = getRecvTime();
+
+       // Serial Number
+       pEtwsPn->serialNum.geoScope = (EtwsData[0] & 0xC0) >> 6;
+       pEtwsPn->serialNum.msgCode = (EtwsData[0] & 0x3F) << 4;
+       pEtwsPn->serialNum.msgCode |= (EtwsData[1] & 0xF0) >> 4;
+       pEtwsPn->serialNum.updateNum = EtwsData[1] & 0x0F;
+
+       MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pEtwsPn->serialNum.geoScope, pEtwsPn->serialNum.msgCode, pEtwsPn->serialNum.updateNum);
+
+       // Message Identifier
+       pEtwsPn->msgId = (EtwsData[2] << 8) | EtwsData[3];
+       MSG_DEBUG("MSG ID : [%d]", pEtwsPn->msgId);
+
+       // warning type
+       pEtwsPn->warningType = (EtwsData[4] << 8) | EtwsData[5];
+       MSG_DEBUG("warningType : [0x%04x]", pEtwsPn->msgId);
+
+       // warning security information
+       memcpy(pEtwsPn->warningSecurityInfo, &EtwsData[6], sizeof(pEtwsPn->warningSecurityInfo));       // 50bytes
+       for (unsigned int i = 0; i < sizeof(pEtwsPn->warningSecurityInfo); i++)
+       {
+               MSG_DEBUG("warning secu info [%02x]", pEtwsPn->warningSecurityInfo[i] );
+       }
+}
+
 void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
 {
        if (pCbMsg->Length > (MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM))
@@ -259,8 +352,52 @@ MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHead
 
        // Get Receive Time
        pCbPage->pageHeader.recvTime = getRecvTime();
+
+#if 0
+       // Decode CB Data
+       int dataLen = pCbMsg->Length - 6;
+
+       switch (pCbPage->pageHeader.dcs.codingScheme)
+       {
+               case SMS_CHARSET_7BIT :
+               {
+                       dataLen = (dataLen*8) / 7;
+
+                       if (pCbPage->pageLength > MAX_CBMSG_PAGE_SIZE)
+                               THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", pCbPage->pageLength);
+
+                       SmsPluginUDCodec udCodec;
+                       int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pCbPage->pageData);
+                       pCbPage->pageData[unpackLen] = '\0';
+
+                       pCbPage->pageLength = unpackLen;
+               }
+               break;
+
+               case SMS_CHARSET_8BIT :
+               case SMS_CHARSET_UCS2 :
+               {
+                       pCbPage->pageLength = dataLen;
+
+                       memcpy(pCbPage->pageData, &cbData[6], pCbPage->pageLength);
+                       pCbPage->pageData[pCbPage->pageLength] = '\0';
+               }
+               break;
+       }
+
+MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
+#endif
 }
 
+unsigned short SmsPluginCbMsgHandler::encodeCbSerialNum ( SMS_CBMSG_SERIAL_NUM_S snFields )
+{
+       unsigned short serialNum = 0;
+
+       serialNum = ((snFields.geoScope & 0x03) << 14) | ((snFields.msgCode&0x03FF) << 4) | (snFields.updateNum&0x0F);
+       MSG_DEBUG ("serialNum (%x), geo(%x), mc(%x), un(%x)\n", serialNum, snFields.geoScope, snFields.msgCode, snFields.updateNum);
+
+       return serialNum;
+}
 
 bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg)
 {
@@ -534,6 +671,47 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S cbMsg, MSG_MESSAGE
 }
 
 
+void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MSG_MESSAGE_INFO_S *pMsgInfo)
+{
+       pMsgInfo->msgId = (msg_message_id_t)EtwsMsg.pageHeader.msgId;
+
+       pMsgInfo->folderId = MSG_CBMSGBOX_ID;
+
+       // Convert Type values
+       pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
+
+       if (EtwsMsg.cbMsgType == SMS_CBMSG_TYPE_ETWS)
+               pMsgInfo->msgType.subType = MSG_ETWS_SMS;
+
+       pMsgInfo->storageId = MSG_STORAGE_PHONE;
+       pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
+       pMsgInfo->bRead = false;
+       pMsgInfo->bProtected = false;
+       pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
+       pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
+
+       // Temporary
+       pMsgInfo->nAddressCnt = 1;
+
+       pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
+       pMsgInfo->addressList[0].recipientType = MSG_RECIPIENTS_TYPE_UNKNOWN;
+
+       getDisplayName(EtwsMsg.pageHeader.msgId, pMsgInfo->addressList[0].addressVal);
+       MSG_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
+
+       pMsgInfo->msgPort.valid = false;
+       pMsgInfo->msgPort.dstPort = 0;
+       pMsgInfo->msgPort.srcPort = 0;
+
+       pMsgInfo->displayTime = EtwsMsg.pageHeader.recvTime;
+       MSG_DEBUG("recvTime is %s", ctime(&pMsgInfo->displayTime));
+       MSG_DEBUG("LENGTH %d", EtwsMsg.pageLength);
+       pMsgInfo->bTextSms = true;
+       pMsgInfo->dataSize = EtwsMsg.pageLength;
+       memset(pMsgInfo->msgData, 0x00, sizeof(pMsgInfo->msgData));
+       memcpy(pMsgInfo->msgData, EtwsMsg.pageData, pMsgInfo->dataSize);
+}
+
 void SmsPluginCbMsgHandler::addToPageLiat(SMS_CBMSG_PAGE_S CbPage)
 {
        CB_PAGE_INFO_S tmpInfo;
@@ -727,10 +905,8 @@ void SmsPluginCbMsgHandler::getDisplayName(unsigned short  MsgId, char *pDisplayN
 {
        int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
 
-       char keyName[128];
        char from[128];
        char to[128];
-       char strTmp[CB_CHANNEL_NAME_MAX+1];
 
        for (int i = 0; i < MsgIdCnt; i++)
        {
@@ -742,7 +918,6 @@ void SmsPluginCbMsgHandler::getDisplayName(unsigned short   MsgId, char *pDisplayN
 
                if (MsgId >= MsgSettingGetInt(from) && MsgId <= MsgSettingGetInt(to))
                {
-                       char *channelName = NULL;
                        MSG_DEBUG("FIND MSG ID = [%d]", MsgId);
 #if 0
                        memset(keyName, 0x00, sizeof(keyName));
index 20761af..f5b5f24 100755 (executable)
@@ -184,6 +184,24 @@ void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
        }
 }
 
+void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen, char *application_id)
+{
+       MSG_PUSH_MESSAGE_DATA_S pushData;
+
+       memset(&pushData, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S));
+
+       /** set PUSH data */
+       memcpy(&pushData.pushHeader, pPushHeader, strlen(pPushHeader));
+
+       pushData.pushBodyLen = pushBodyLen;
+       memcpy(pushData.pushBody, pPushBody, pushBodyLen);
+
+       memcpy(pushData.pushAppId, application_id, MAX_WAPPUSH_ID_LEN);
+
+       /** Callback to MSG FW */
+       listener.pfPushMsgIncomingCb(&pushData);
+}
+
 
 void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen)
 {
@@ -236,6 +254,20 @@ msg_error_t SmsPluginEventHandler::callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgI
        return err;
 }
 
+msg_error_t SmsPluginEventHandler::callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg)
+{
+       MSG_BEGIN();
+
+       msg_error_t err = MSG_SUCCESS;
+
+       /** Callback to MSG FW */
+       err = listener.pfCBMsgIncomingCb(pCbMsg);
+
+       MSG_END();
+
+       return err;
+}
+
 
 msg_error_t SmsPluginEventHandler::callbackInitSimBySat()
 {
index 26fc681..cdbe024 100755 (executable)
@@ -256,8 +256,13 @@ msg_error_t SmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                }
 
        } else if ((pMsgInfo->msgType.subType == MSG_CB_SMS) || (pMsgInfo->msgType.subType == MSG_JAVACB_SMS)) {
-               MSG_DEBUG("Add CB Message");
-               err = addCbMessage(pMsgInfo);
+               /** check add message option */
+               bool bSave = false;
+               MsgSettingGetBool(CB_SAVE, &bSave);
+               if(bSave) {
+                       MSG_DEBUG("Add CB Message");
+                       err = addCbMessage(pMsgInfo);
+               }
        } else if ((pMsgInfo->msgType.subType >= MSG_REPLACE_TYPE1_SMS) && (pMsgInfo->msgType.subType <= MSG_REPLACE_TYPE7_SMS)) {
                MSG_DEBUG("Add Replace SM Type [%d]", pMsgInfo->msgType.subType-3);
                err = addReplaceTypeMsg(pMsgInfo);
@@ -1041,3 +1046,110 @@ msg_error_t SmsPluginStorage::updateAllAddress()
 
        return err;
 }
+
+
+msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *count, char *application_id)
+{
+       msg_error_t err = MSG_SUCCESS;
+
+       int rowCnt = 0, index = 3;
+
+       char sqlQuery[MAX_QUERY_LEN+1] = {0, };
+
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONTENT_TYPE, APP_ID, APPCODE FROM %s", MSGFW_PUSH_CONFIG_TABLE_NAME);
+
+       err = dbHandle.getTable(sqlQuery, &rowCnt);
+       MSG_DEBUG("rowCnt: %d", rowCnt);
+
+       if (err == MSG_ERR_DB_NORECORD) {
+               dbHandle.freeTable();
+               return MSG_SUCCESS;
+       }
+       else if ( err != MSG_SUCCESS) {
+               dbHandle.freeTable();
+               return err;
+       }
+
+       char content_type[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1];
+       char app_id[MAX_WAPPUSH_ID_LEN + 1];
+       int appcode = 0, default_appcode = 0;
+       bool found = false;
+       char *_content_type = NULL, *_app_id = NULL;
+       *count = 0;
+
+
+       for (int i = 0; i < rowCnt; i++) {
+               memset(content_type, 0, MAX_WAPPUSH_CONTENT_TYPE_LEN);
+               memset(app_id, 0, MAX_WAPPUSH_ID_LEN);
+
+               dbHandle.getColumnToString(index++, MAX_WAPPUSH_CONTENT_TYPE_LEN + 1, content_type);
+               dbHandle.getColumnToString(index++, MAX_WAPPUSH_ID_LEN + 1, app_id);
+               appcode = dbHandle.getColumnToInt(index++);
+
+               //MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id);
+               _content_type = strcasestr(pPushHeader, content_type);
+               if(_content_type) {
+                       _app_id = strcasestr(pPushHeader, app_id);
+                       if(appcode)
+                               default_appcode = appcode;
+
+                       if(_app_id) {
+                               PUSH_APPLICATION_INFO_S pInfo = {0, };
+                               pInfo.appcode = appcode;
+                               MSG_DEBUG("appcode: %d, app_id: %s", pInfo.appcode, app_id);
+                               strcpy(application_id, app_id);
+                               pushAppInfoList.push_back(pInfo);
+                               (*count)++;
+                               found = true;
+                       }
+               }
+       }
+
+       if(!found)
+       {
+               // perform default action.
+               PUSH_APPLICATION_INFO_S pInfo = {0, };
+               pInfo.appcode = default_appcode;
+               strcpy(application_id, app_id);
+               pushAppInfoList.push_back(pInfo);
+               *count = 1;
+       }
+       dbHandle.freeTable();
+
+       return err;
+}
+
+
+msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode)
+{
+       msg_error_t err = MSG_SUCCESS;
+       if(index > pushAppInfoList.size() - 1)
+               return MSG_ERR_INVALID_PARAMETER;
+
+       std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
+       int count = 0;
+       for (; it != pushAppInfoList.end(); it++)
+       {
+               if(index == count){
+                       *appcode = it->appcode;
+                       break;
+               }
+               count++;
+       }
+
+       return err;
+}
+
+
+msg_error_t SmsPluginStorage::releasePushEvent()
+{
+       msg_error_t err = MSG_SUCCESS;
+       std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
+
+       for (; it != pushAppInfoList.end(); it++)
+               it = pushAppInfoList.erase(it);
+
+       return err;
+}
index 015a750..134e4f1 100755 (executable)
@@ -28,6 +28,7 @@
 
 static unsigned short wapPushPortList [] = {0x0b84, 0x0b85, 0x23F0, 0x23F1, 0x23F2, 0x23F3, 0xC34F};
 
+#if 0
 const SMS_PUSH_APP_INFO_S pushDefaultApplication [] =
 {
        {(char*)"text/vnd.wap.si", (char*)"X-Wap-Application-Id: x-wap-application:wml.ua\r\n", SMS_WAP_APPLICATION_PUSH_SI},
@@ -60,13 +61,20 @@ const SMS_PUSH_APP_INFO_S pushDefaultApplication [] =
        {(char*)"application/vnd.oma.drm.roap-trigger+xml", (char*)"X-Wap-Application-Id: x-wap-application:drm.ua\r\n", SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML},
        {(char*)"application/vnd.oma.drm.roap-trigger+wbxml", (char*)"X-Wap-Application-Id: x-wap-application:drm.ua\r\n", SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML},
 
+       {(char*)"text/vnd.wap.connectivity-xml", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML},
+       {(char*)"application/vnd.wap.connectivity-wbxml", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML},
+
+       {(char*)"application/x-wap-prov.browser-settings", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS},
+       {(char*)"application/x-wap-prov.browser-bookmarks", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS},
+       {(char*)"application/x-wap-prov.syncset+xml", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_SYNCSET_WBXML},
+       {(char*)"application/x-wap-prov.syncset+wbxml", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_SYNCSET_XML},
        {(char*)"text/vnd.wap.emn+xml", (char*)"X-Wap-Application-Id: x-wap-application:emn.ua\r\n", SMS_WAP_APPLICATION_PUSH_EMAIL_XML},
        {(char*)"application/vnd.wap.emn+wbxml", (char*)"X-Wap-Application-Id: x-wap-application:emn.ua\r\n", SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML},
        {(char*)"application/vnd.wv.csp.cir", (char*)"X-Wap-Application-Id: x-wap-application:wv.ua\r\n", SMS_WAP_APPLICATION_PUSH_IMPS_CIR},
        {(char*)"application/vnd.omaloc-supl-init", (char*)"X-Wap-Application-Id: x-oma-application:ulp.ua\r\n", SMS_WAP_APPLICATION_LBS},
        {NULL, NULL}
 };
-
+#endif
 
 char gWapCodeBufferLeft[WSP_CODE_BUFFER_LEFT_LEN_MAX];
 char gWapCodeBufferRight[WSP_CODE_BUFFER_RIGHT_LEN_MAX];
@@ -602,7 +610,8 @@ const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
        { (char*)"x-wap-application:loc.ua",  0x06 },
        { (char*)"x-wap-application:syncml.dm", 0x07 },
        { (char*)"x-wap-application:drm.ua", 0x08 },
-       { (char*)"x-wap-application:emn.ua", 0x09 }
+       { (char*)"x-wap-application:emn.ua", 0x09 },
+       { (char*)"x-oma-docomo:xmd.mail.ua", 0x905C },
 };
 
 
@@ -743,7 +752,7 @@ bool SmsPluginWapPushHandler::IsWapPushMsg(SMS_USERDATA_S *pUserData)
        return false;
 }
 
-
+#if 0
 SMS_WAP_APP_CODE_T SmsPluginWapPushHandler::getAppCode(const char *pPushHeader)
 {
        int appCount = sizeof(pushDefaultApplication)/sizeof(pushDefaultApplication[0]) - 1;
@@ -771,6 +780,7 @@ SMS_WAP_APP_CODE_T SmsPluginWapPushHandler::getAppCode(const char *pPushHeader)
 
        return appCode;
 }
+#endif
 
 
 void SmsPluginWapPushHandler::copyDeliverData(SMS_DELIVER_S *pDeliver)
@@ -894,7 +904,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
        MSG_END();
 }
 
-
+#if 0
 void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen)
 {
        MSG_BEGIN();
@@ -1040,7 +1050,169 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
 
        MSG_END();
 }
+#else
+void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen)
+{
+       MSG_BEGIN();
+
+       if (pPushBody == NULL) {
+               MSG_DEBUG("pPushBody is NULL");
+               return;
+       }
+
+       msg_error_t err = MSG_SUCCESS;
+       int pushEvt_cnt = 0;
+       char app_id[MAX_WAPPUSH_ID_LEN] = {0,};
+       SmsPluginStorage *storageHandler = SmsPluginStorage::instance();
+
+       err = storageHandler->getRegisteredPushEvent(pPushHeader, &pushEvt_cnt, app_id);
+       MSG_DEBUG("pushEvt_cnt: %d", pushEvt_cnt);
+       if(err != MSG_SUCCESS) {
+               MSG_DEBUG("Fail to get registered push event");
+               return;
+       }
+
+       for(int i = 0; i < pushEvt_cnt; ++i)    {
+
+               /**  check Push message receive setting */
+               bool bPushRecv = false;
+               int appcode = 0;
+               MsgSettingGetBool(PUSH_RECV_OPTION, &bPushRecv);
+
+               storageHandler->getnthPushEvent(i, &appcode);
+               MSG_DEBUG("pushEvt_cnt: %d, appcode: %d", pushEvt_cnt, appcode);
+               if ((bPushRecv == false) && (appcode != SMS_WAP_APPLICATION_MMS_UA)) {
+                       MSG_DEBUG("Push Message Receive option is OFF. Drop Push Message.");
+                       return;
+               }
+
+               switch (appcode) {
+               case SMS_WAP_APPLICATION_MMS_UA:
+                       MSG_DEBUG("Received MMS Notification");
+                       handleMMSNotification(pPushBody, PushBodyLen);
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_SI:
+                       MSG_DEBUG("Received WAP Push (Service Indication Textual form)");
+                       handleSIMessage(pPushBody, PushBodyLen, true);
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_SIC:
+                       MSG_DEBUG("Received WAP Push (Service Indication Tokenised form)");
+                       handleSIMessage(pPushBody, PushBodyLen, false);
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_SL:
+                       MSG_DEBUG("Received WAP Push (Service Loading Textual form)");
+                       handleSLMessage(pPushBody, PushBodyLen, true);
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_SLC:
+                       MSG_DEBUG("Received WAP Push (Service Loading Tokenised form)");
+                       handleSLMessage(pPushBody, PushBodyLen, false);
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_CO:
+                       MSG_DEBUG("Received WAP Push (Cache Operation Textual form)");
+                       handleCOMessage(pPushBody, PushBodyLen, true);
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_COC:
+                       MSG_DEBUG("Received WAP Push (Cache Operation Tokenised form)");
+                       handleCOMessage(pPushBody, PushBodyLen, false);
+                       break;
+
+               case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
+                       MSG_DEBUG("Received DM BOOTSTRAP");
+                       SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+                       break;
 
+               case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
+                       MSG_DEBUG("Received DM BOOTSTRAP");
+                       SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
+                       MSG_DEBUG("Received Provisioning");
+                       SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
+                       MSG_DEBUG("Received Provisioning");
+                       SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
+               case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
+                       MSG_DEBUG("Received Provisioning");
+                       SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(OTHERS, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+                       break;
+
+               case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
+                       MSG_DEBUG("Received DM Notification");
+                       SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+                       break;
+
+               case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
+                       MSG_DEBUG("Received DS Notification");
+                       SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+                       break;
+
+               case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
+                       MSG_DEBUG("Received DS Notification");
+                       SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+                       break;
+
+               case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_XML:
+               case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_WBXML:
+                       MSG_DEBUG("Received DRM UA");
+
+                       if (pPushBody != NULL)
+                               handleDrmVer1(pPushBody, PushBodyLen);
+
+                       break;
+
+               case SMS_WAP_APPLICATION_DRM_V2_RO_XML:
+               case SMS_WAP_APPLICATION_DRM_V2_ROAP_PDU_XML:
+               case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML:
+               case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML:
+                       MSG_DEBUG("Received DRM V2");
+                       // TODO: DRM V2
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_EMAIL:
+               case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
+               case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
+                       MSG_DEBUG("Received Email");
+                       // TODO: Email
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
+                       MSG_DEBUG("Received IMPS CIR");
+                       // TODO: IMPS CIR
+                       break;
+
+               case SMS_WAP_APPLICATION_LBS :
+                       MSG_DEBUG("Received LBS related message");
+                       SmsPluginEventHandler::instance()->handleLBSMsgIncoming(pPushHeader, pPushBody, PushBodyLen);
+                       // TODO: LBS
+                       break;
+
+               case SMS_WAP_APPLICATION_PUSH_SIA :
+                       MSG_DEBUG("Received SIA");
+                       // TODO: SIA
+                       break;
+
+               default:
+                       SmsPluginEventHandler::instance()->handlePushMsgIncoming(pPushHeader, pPushBody, PushBodyLen, app_id);
+                       break;
+               }
+       }
+       storageHandler->releasePushEvent();
+
+       MSG_END();
+}
+#endif
 
 void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int PushBodyLen)
 {
@@ -2182,13 +2354,16 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
 
                                                                integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
 
-                                                               if (integerValue > 0x0A) {
-                                                                       MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x0A).\n");
-                                                                       break;
+                                                               int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
+                                                               for(int i = 0; i < count ; ++i)
+                                                               {
+                                                                       if(integerValue == wspHeaderApplId[i].parameterCode)
+                                                                       {
+                                                                               snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
+                                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1);
+                                                                               break;
+                                                                       }
                                                                }
-
-                                                               snprintf((char*)temp, 64, "%s", wspHeaderApplId[integerValue].parameterToken);
-                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1);
                                                        }
                                                        break;
                                                /* Accept-Application */
index 9e46c77..febd64d 100755 (executable)
@@ -65,6 +65,7 @@ public:
        static SmsPluginCbMsgHandler* instance();
 
        void handleCbMsg(TelSmsCbMsg_t *pCbMsg);
+       void handleEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg);
 
 private:
        SmsPluginCbMsgHandler();
@@ -74,11 +75,15 @@ private:
 
        void Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage);
        void Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage);
+       void DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PRIMARY_S *pEtwsPn);
+       unsigned short encodeCbSerialNum ( SMS_CBMSG_SERIAL_NUM_S snFields );
 
        bool checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg);
        unsigned char checkCbPage(SMS_CBMSG_PAGE_S CbPage);
        void MakeCbMsg(SMS_CBMSG_PAGE_S CbPage, SMS_CBMSG_S *pCbMsg);
        void convertCbMsgToMsginfo(SMS_CBMSG_S cbMsg, MSG_MESSAGE_INFO_S *pMsgInfo);
+       void convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MSG_MESSAGE_INFO_S *pMsgInfo);
+       int convertTextToUtf8 (unsigned char* outBuf, int outBufSize, SMS_CBMSG_S* pCbMsg);
        void addToPageLiat(SMS_CBMSG_PAGE_S CbPage);
        void removeFromPageList(SMS_CBMSG_PAGE_S CbPage);
 
index 0165eb2..e8ba8fa 100755 (executable)
@@ -39,8 +39,10 @@ public:
        void handleMsgIncoming(SMS_TPDU_S *pTpdu);
        void handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen);
        void handleLBSMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen);
+       void handlePushMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen, char *app_id);
 
        msg_error_t callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgInfo);
+       msg_error_t callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg);
        msg_error_t callbackInitSimBySat();
        msg_error_t callbackStorageChange(msg_storage_change_type_t storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo);
 
index fae7306..df8029a 100755 (executable)
@@ -27,6 +27,7 @@
 #include "SmsPluginTypes.h"
 #include "MsgInternalTypes.h"
 #include "MsgSqliteWrapper.h"
+#include <list>
 
 extern "C"
 {
@@ -53,6 +54,9 @@ public:
 
        msg_error_t deleteSmsMessage(msg_message_id_t MsgId);
 
+       msg_error_t getRegisteredPushEvent(char* pPushHeader, int *count, char *app_id);
+       msg_error_t getnthPushEvent(int index, int *appcode);
+       msg_error_t releasePushEvent();
 private:
        SmsPluginStorage();
        ~SmsPluginStorage();
@@ -71,7 +75,8 @@ private:
        static SmsPluginStorage* pInstance;
 
        MsgDbHandler dbHandle;
-
+       std::list<PUSH_APPLICATION_INFO_S> pushAppInfoList;
+//     unsigned char tmpMsgRef;
 };
 
 #endif //SMS_PLUGIN_STORAGE_H
index eb07acc..57d60f4 100755 (executable)
@@ -41,6 +41,7 @@
 #define MAX_UD_HEADER_NUM                      7
 #define MAX_SAT_TPDU_LEN                       175
 #define MAX_CBMSG_PAGE_SIZE            93
+#define MAX_ETWS_SIZE                  56
 #define MAX_CBMSG_PAGE_NUM             15
 #define MAX_SIM_SMS_NUM                        90
 
@@ -168,9 +169,10 @@ typedef unsigned char SMS_SAT_CMD_TYPE_T;
 
 typedef unsigned short SMS_SIM_EFILE_NAME_T;
 
-
 typedef unsigned char SMS_LANGUAGE_ID_T;
 
+typedef unsigned char SMS_ETWS_NETWORK_TYPE_T;
+
 
 /*==================================================================================================
                                     ENUMS
@@ -462,6 +464,7 @@ enum _SMS_CBMSG_TYPE_E
        SMS_CBMSG_TYPE_SCHEDULE,                /**< Schedule */
        SMS_CBMSG_TYPE_CBS41,                   /**< CBS41 */
        SMS_CBMSG_TYPE_JAVACBS,         /**< JAVA-CB Message*/
+       SMS_CBMSG_TYPE_ETWS,
 };
 
 
@@ -852,6 +855,14 @@ typedef struct _SMS_CBMSG_S
        char                                                    msgData[MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM+1];              /**< user data */
 } SMS_CBMSG_S;
 
+typedef struct _SMS_ETWS_PRIMARY_S
+{
+       time_t                                          recvTime;
+       SMS_CBMSG_SERIAL_NUM_S          serialNum;
+       unsigned short                          msgId;
+       unsigned short                          warningType;
+       unsigned char                           warningSecurityInfo[MAX_ETWS_SIZE-6];
+}SMS_ETWS_PRIMARY_S;
 
 typedef struct _SMS_LANG_INFO_S
 {
index 31af9c9..073e189 100755 (executable)
@@ -359,7 +359,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_INFO_S *pSrc, MSG_MESSAGE_HID
                pDest->dataSize = pSrc->dataSize;
 
                if (pSrc->msgType.mainType == MSG_SMS_TYPE) {
-                       if (pDest->encodeType == MSG_ENCODE_8BIT) {
+                       if (pDest->encodeType == MSG_ENCODE_8BIT || pSrc->msgType.subType == MSG_ETWS_SMS) {
                                pDest->pData = (void*)new char[pDest->dataSize];
                                memset(pDest->pData, 0x00, pDest->dataSize);
                                memcpy(pDest->pData, pSrc->msgText, pDest->dataSize);
index 5f72126..37efe95 100755 (executable)
@@ -1395,3 +1395,111 @@ msg_error_t MsgHandle::getMessageList(msg_folder_id_t folderId, msg_thread_id_t
 
        return err;
 }
+
+
+int MsgHandle::addPushEvent(MSG_PUSH_EVENT_INFO_S *pPushEvent)
+{
+       // Allocate Memory to Command Data
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_EVENT_INFO_S);
+
+       char cmdBuf[cmdSize];
+       bzero(cmdBuf, cmdSize);
+       MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+       // Set Command Parameters
+       pCmd->cmdType = MSG_CMD_ADD_PUSH_EVENT;
+
+       // Copy Cookie
+       memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+       // Copy Command Data
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pPushEvent, sizeof(MSG_PUSH_EVENT_INFO_S));
+
+       // Send Command to Messaging FW
+       char* pEventData = NULL;
+       AutoPtr<char> eventBuf(&pEventData);
+
+       write((char*)pCmd, cmdSize, &pEventData);
+
+       // Get Return Data
+       MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+       if (pEvent->eventType != MSG_EVENT_ADD_PUSH_EVENT)
+       {
+               THROW(MsgException::INVALID_RESULT, "Event Data Error");
+       }
+
+       return pEvent->result;
+}
+
+
+int MsgHandle::deletePushEvent(MSG_PUSH_EVENT_INFO_S *pPushEvent)
+{
+       // Allocate Memory to Command Data
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_EVENT_INFO_S);
+
+       char cmdBuf[cmdSize];
+       bzero(cmdBuf, cmdSize);
+       MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+       // Set Command Parameters
+       pCmd->cmdType = MSG_CMD_DELETE_PUSH_EVENT;
+
+       // Copy Cookie
+       memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+       // Copy Command Data
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pPushEvent, sizeof(MSG_PUSH_EVENT_INFO_S));
+
+       // Send Command to Messaging FW
+       char* pEventData = NULL;
+       AutoPtr<char> eventBuf(&pEventData);
+
+       write((char*)pCmd, cmdSize, &pEventData);
+
+       // Get Return Data
+       MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+       if (pEvent->eventType != MSG_EVENT_DELETE_PUSH_EVENT)
+       {
+               THROW(MsgException::INVALID_RESULT, "Event Data Error");
+       }
+
+       return pEvent->result;
+}
+
+int MsgHandle::updatePushEvent(MSG_PUSH_EVENT_INFO_S *pSrc, MSG_PUSH_EVENT_INFO_S *pDst)
+{
+       // Allocate Memory to Command Data
+       int cmdSize = sizeof(MSG_CMD_S) +  2 * sizeof(MSG_PUSH_EVENT_INFO_S);
+
+       char cmdBuf[cmdSize];
+       bzero(cmdBuf, cmdSize);
+       MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+       // Set Command Parameters
+       pCmd->cmdType = MSG_CMD_UPDATE_PUSH_EVENT;
+
+       // Copy Cookie
+       memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+       // Copy Command Data
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pSrc, sizeof(MSG_PUSH_EVENT_INFO_S));
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_PUSH_EVENT_INFO_S)), pDst, sizeof(MSG_PUSH_EVENT_INFO_S));
+
+       // Send Command to Messaging FW
+       char* pEventData = NULL;
+       AutoPtr<char> eventBuf(&pEventData);
+
+       write((char*)pCmd, cmdSize, &pEventData);
+
+       // Get Return Data
+       MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+       if (pEvent->eventType != MSG_EVENT_UPDATE_PUSH_EVENT)
+       {
+               THROW(MsgException::INVALID_RESULT, "Event Data Error");
+       }
+
+       return pEvent->result;
+}
index e3ade18..2888381 100755 (executable)
@@ -507,6 +507,116 @@ msg_error_t MsgHandle::regSyncMLMessageOperationCallback(msg_syncml_msg_operatio
        return pEvent->result;
 }
 
+msg_error_t MsgHandle::regPushMessageCallback(msg_push_msg_incoming_cb onPushMsgIncoming, const char *pAppId, void *pUserParam)
+{
+       if( (!onPushMsgIncoming) )
+               THROW(MsgException::INVALID_PARAM, "Param %p", onPushMsgIncoming);
+
+       MsgProxyListener* eventListener = MsgProxyListener::instance();
+
+       eventListener->start();
+
+       if (eventListener->regPushMessageIncomingEventCB(this, onPushMsgIncoming, pAppId, pUserParam) == false) // callback was already registered, just return SUCCESS
+               return MSG_SUCCESS;
+
+       // Allocate Memory to Command Data
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S);
+
+       char cmdBuf[cmdSize];
+       bzero(cmdBuf, cmdSize);
+
+       MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
+
+       // Set Command Parameters
+       pCmd->cmdType = MSG_CMD_REG_INCOMING_PUSH_MSG_CB;
+
+       // Copy Cookie
+       memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+       MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S cmdParam = {0};
+
+       cmdParam.listenerFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       cmdParam.msgType = MSG_SMS_TYPE;
+
+       if (pAppId)
+               strncpy(cmdParam.appId, pAppId, MAX_WAPPUSH_ID_LEN);
+
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &cmdParam, sizeof(cmdParam));
+
+       MSG_DEBUG("reg new msg [%s], fd:%d, appId:%s", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd,  (pAppId)? cmdParam.appId:"NULL" );
+
+       // Send Command to Messaging FW
+       char* pEventData = NULL;
+       AutoPtr<char> eventBuf(&pEventData);
+
+
+       write((char*)pCmd, cmdSize, &pEventData);
+
+       // Get Return Data
+       MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_PUSH_MSG_CB)
+       {
+               THROW(MsgException::INVALID_RESULT, "Event Data Error");
+       }
+
+       return pEvent->result;
+}
+
+msg_error_t MsgHandle::regCBMessageCallback(msg_cb_incoming_cb onCBIncoming, bool bSave, void *pUserParam)
+{
+       if( (!onCBIncoming) )
+               THROW(MsgException::INVALID_PARAM, "Param %p", onCBIncoming);
+
+       MsgProxyListener* eventListener = MsgProxyListener::instance();
+
+       eventListener->start();
+
+       if (eventListener->regCBMessageIncomingEventCB(this, onCBIncoming, bSave, pUserParam) == false) // callback was already registered, just return SUCCESS
+               return MSG_SUCCESS;
+
+       // Allocate Memory to Command Data
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_CB_MSG_CB_S); //sizeof(int) + sizeof; // cmd type, listener fd
+
+       char cmdBuf[cmdSize];
+       bzero(cmdBuf, cmdSize);
+
+       MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
+
+       // Set Command Parameters
+       pCmd->cmdType = MSG_CMD_REG_INCOMING_CB_MSG_CB;
+
+       // Copy Cookie
+       memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+       MSG_CMD_REG_CB_INCOMING_MSG_CB_S cmdParam = {0};
+
+       cmdParam.listenerFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       cmdParam.msgType = MSG_SMS_TYPE;
+       cmdParam.bsave = bSave;
+
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &cmdParam, sizeof(cmdParam));
+
+       MSG_DEBUG("reg new msg [%s], fd %d", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd);
+
+       // Send Command to Messaging FW
+       char* pEventData = NULL;
+       AutoPtr<char> eventBuf(&pEventData);
+
+
+       write((char*)pCmd, cmdSize, &pEventData);
+
+       // Get Return Data
+       MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_CB_MSG_CB)
+       {
+               THROW(MsgException::INVALID_RESULT, "Event Data Error");
+       }
+
+       return pEvent->result;
+}
+
 
 msg_error_t MsgHandle::operateSyncMLMessage(msg_message_id_t msgId)
 {
index 1bf4a38..ec3e8bc 100755 (executable)
@@ -21,6 +21,7 @@
 #include "MsgException.h"
 #include "MsgUtilFile.h"
 #include "MsgProxyListener.h"
+#include "MsgGconfWrapper.h"
 
 
 gboolean readSocket(GIOChannel *source, GIOCondition condition, gpointer data)
@@ -266,6 +267,70 @@ bool MsgProxyListener::regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, m
 }
 
 
+bool MsgProxyListener::regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_push_msg_incoming_cb pfNewPushMessage, const char *pAppId, void *pUserParam)
+{
+       MutexLocker lock(mx);
+
+       std::list<MSG_PUSH_INCOMING_CB_ITEM_S>::iterator it = newPushMessageCBList.begin();
+
+       for (; it != newPushMessageCBList.end(); it++)
+       {
+               if (it->pfPushIncomingCB == pfNewPushMessage)
+               {
+
+                       if(pAppId == NULL)
+                       {
+                               MSG_DEBUG("msg_push_msg_incoming_cb() callback is already registered!!!");
+
+                               return false;
+                       }
+                       else if(!strncmp(it->appId, pAppId, MAX_WAPPUSH_ID_LEN))
+                       {
+                               MSG_DEBUG("msg_push_msg_incoming_cb() callback : AppId [%s] is already registered!!!", pAppId);
+
+                               it->userParam = pUserParam;
+
+                               return false;
+                       }
+               }
+       }
+
+       MSG_PUSH_INCOMING_CB_ITEM_S incomingPushCB = {pMsgHandle, pfNewPushMessage, {0}, pUserParam};
+
+       if (pAppId != NULL)
+               strncpy(incomingPushCB.appId, pAppId, MAX_WAPPUSH_ID_LEN);
+
+       newPushMessageCBList.push_back(incomingPushCB);
+
+       return true;
+}
+
+bool MsgProxyListener::regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_cb_incoming_cb pfNewCBMessage, bool bSave, void *pUserParam)
+{
+       MutexLocker lock(mx);
+
+       std::list<MSG_CB_INCOMING_CB_ITEM_S>::iterator it = newCBMessageCBList.begin();
+
+       for (; it != newCBMessageCBList.end(); it++)
+       {
+               if (it->pfCBIncomingCB == pfNewCBMessage)
+               {
+                       MSG_DEBUG("msg_CB_incoming_cb() callback : [%p] is already registered!!!", pfNewCBMessage);
+
+                       it->bsave = bSave;
+                       it->userParam = pUserParam;
+
+                       return false;
+               }
+       }
+
+       MSG_CB_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, pfNewCBMessage, bSave, pUserParam};
+
+       newCBMessageCBList.push_back(incomingCB);
+
+       return true;
+}
+
 bool MsgProxyListener::regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_incoming_cb pfNewSyncMLMessage, void *pUserParam)
 {
        MutexLocker lock(mx);
@@ -449,15 +514,57 @@ void MsgProxyListener::clearListOfClosedHandle(MsgHandle* pMsgHandle)
                }
        }
 
-       // Storage change Message CB list
-       std::list<MSG_STORAGE_CHANGE_CB_ITEM_S>::iterator it6 = storageChangeCBList.begin();
+       // Push Message CB list
+       std::list<MSG_PUSH_INCOMING_CB_ITEM_S>::iterator it6 = newPushMessageCBList.begin();
 
-       for (; it6 != storageChangeCBList.end(); it6++)
+       for (; it6 != newPushMessageCBList.end(); it6++)
        {
                if (it6->hAddr == pMsgHandle)
                {
-                       storageChangeCBList.erase(it6);
-                       it6 = storageChangeCBList.begin();
+                       newPushMessageCBList.erase(it6);
+                       it6 = newPushMessageCBList.begin();
+
+                       //Stop client Listener
+                       stop();
+               }
+
+       }
+
+       // CB Message CB list
+       std::list<MSG_CB_INCOMING_CB_ITEM_S>::iterator it7 = newCBMessageCBList.begin();
+
+       bool bSave = false;
+       for (; it7 != newCBMessageCBList.end(); it7++)
+       {
+
+               if (it7->hAddr == pMsgHandle)
+               {
+
+                       newCBMessageCBList.erase(it7);
+                       it7 = newCBMessageCBList.begin();
+
+                       //Stop client Listener
+                       stop();
+               }
+               else
+               {
+                       if(it7->bsave == true)
+                               bSave = true;
+               }
+       }
+
+       if(!bSave)
+               MsgSettingSetBool(CB_SAVE, bSave);
+
+       // Storage change Message CB list
+       std::list<MSG_STORAGE_CHANGE_CB_ITEM_S>::iterator it8 = storageChangeCBList.begin();
+
+       for (; it8 != storageChangeCBList.end(); it8++)
+       {
+               if (it8->hAddr == pMsgHandle)
+               {
+                       storageChangeCBList.erase(it8);
+                       it8 = storageChangeCBList.begin();
 
                        //Stop client Listener
                        stop();
@@ -808,6 +915,54 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                mx.unlock();
        }
 
+       else if (pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_CB_MSG_IND)
+       {
+               MSG_CB_MSG_S *pCbMsg = (MSG_CB_MSG_S *)pMsgEvent->data;
+
+               mx.lock();
+
+               MsgNewCBMessageCBList::iterator it = newCBMessageCBList.begin();
+
+               for( ; it != newCBMessageCBList.end() ; it++)
+               {
+                       MsgHandle* pHandle = it->hAddr;
+                       msg_struct_s msg = {0,};
+
+                       msg.type = MSG_STRUCT_CB_MSG;
+                       msg.data = pCbMsg;
+
+                       msg_cb_incoming_cb pfunc = it->pfCBIncomingCB;
+
+                       void* param = it->userParam;
+
+                       pfunc((msg_handle_t)pHandle, (msg_struct_t) &msg, param);
+               }
+
+               mx.unlock();
+       }
+
+       else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND )
+       {
+               MSG_PUSH_MESSAGE_DATA_S* pPushData = (MSG_PUSH_MESSAGE_DATA_S *)pMsgEvent->data;
+
+               mx.lock();
+
+               MsgNewPushMessageCBList::iterator it = newPushMessageCBList.begin();
+
+               for( ; it != newPushMessageCBList.end() ; it++)
+               {
+                       MsgHandle* pHandle = it->hAddr;
+
+                       msg_push_msg_incoming_cb pfunc = it->pfPushIncomingCB;
+
+                       void* param = it->userParam;
+
+                       pfunc((msg_handle_t)pHandle, pPushData->pushHeader, pPushData->pushBody, pPushData->pushBodyLen, param);
+               }
+
+               mx.unlock();
+       }
+
        MSG_END();
 }
 
index f4a157b..70e11b7 100755 (executable)
@@ -200,6 +200,21 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType)
                        return "MSG_CMD_SET_VOICE_MSG_OPT";
                case MSG_CMD_SET_GENERAL_MSG_OPT:
                        return "MSG_CMD_SET_GENERAL_MSG_OPT";
+               case MSG_CMD_REG_INCOMING_PUSH_MSG_CB:
+                       return "MSG_CMD_REG_INCOMING_PUSH_MSG_CB";
+               case MSG_CMD_PLG_INCOMING_PUSH_IND:
+                       return "MSG_CMD_PLG_INCOMING_PUSH_IND";
+               case MSG_CMD_REG_INCOMING_CB_MSG_CB:
+                       return "MSG_CMD_REG_INCOMING_CB_MSG_CB";
+               case MSG_CMD_PLG_INCOMING_CB_IND:
+                       return "MSG_CMD_PLG_INCOMING_CB_IND";
+               case MSG_CMD_ADD_PUSH_EVENT:
+                       return "MSG_CMD_ADD_PUSH_EVENT";
+//85
+               case MSG_CMD_DELETE_PUSH_EVENT:
+                       return "MSG_CMD_DELETE_PUSH_EVENT";
+               case MSG_CMD_UPDATE_PUSH_EVENT:
+                       return "MSG_CMD_UPDATE_PUSH_EVENT";
                default:
                        return "Unknown Command Type!!!";
        }
@@ -381,6 +396,21 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType)
                        return "MSG_EVENT_SET_VOICE_MSG_OPT";
                case MSG_EVENT_SET_GENERAL_MSG_OPT:
                        return "MSG_EVENT_SET_GENERAL_MSG_OPT";
+               case MSG_EVENT_REG_INCOMING_PUSH_MSG_CB:
+                       return "MSG_EVENT_REG_INCOMING_PUSH_MSG_CB";
+               case MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND:
+                       return "MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND";
+               case MSG_EVENT_REG_INCOMING_CB_MSG_CB:
+                       return "MSG_EVENT_REG_INCOMING_CB_MSG_CB";
+               case MSG_EVENT_PLG_INCOMING_CB_MSG_IND:
+                       return "MSG_EVENT_PLG_INCOMING_CB_MSG_IND";
+               case MSG_EVENT_ADD_PUSH_EVENT:
+                       return "MSG_EVENT_ADD_PUSH_EVENT";
+
+               case MSG_EVENT_DELETE_PUSH_EVENT:
+                       return "MSG_EVENT_DELETE_PUSH_EVENT";
+               case MSG_EVENT_UPDATE_PUSH_EVENT:
+                       return "MSG_EVENT_UPDATE_PUSH_EVENT";
 
                default:
                        return "Unknown Event Type!!!";