*/
// OAF headers
-#include <messages.h>
+#include <msg.h>
+#include <msg_transport.h>
+#include <msg_storage.h>
+#include <app.h>
#include <FMsgWapPushManager.h>
#include <FBaseSysLog.h>
#include <FBase_StringConverter.h>
_WapPushManagerImpl::AddWapPushEventListener(const Tizen::Base::String& wapApplicationId, const IWapPushEventListener& listener)
{
result r = E_SUCCESS;
- int err = MESSAGES_ERROR_NONE;
+ int err = MSG_SUCCESS;
char* pWapAppId = null;
ClearLastResult();
// check value of msg handle
SysTryCatch(NID_MSG, __msgHandle > 0, r = E_SYSTEM, r, "failed to get msg handle.");
- err = messages_push_add_incoming_cb(__msgHandle, pWapAppId, &_SmsMmsCallbackHandler::IncomingWapPushMessageCallback, (void*) __pWapPushReceiveEvent);
+ err = msg_reg_push_message_callback(__msgHandle, &_SmsMmsCallbackHandler::IncomingWapPushMessageCallback, pWapAppId, (void*) __pWapPushReceiveEvent);
r = ConvertException(err);
SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to Add WapPush EventListener.", GetErrorMessage(r));
_WapPushManagerImpl::RemoveWapPushEventListener(const Tizen::Base::String& wapApplicationId, const IWapPushEventListener& listener)
{
result r = E_SUCCESS;
- int err = MESSAGES_ERROR_NONE;
ClearLastResult();
- char* pWapAppId = null;
SysTryCatch(NID_MSG, __pWapPushReceiveEvent != null, r = E_OBJ_NOT_FOUND, r, "listner not found");
r = __pWapPushReceiveEvent->RemoveListener(listener);
SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "listner remove failed");
- pWapAppId = _StringConverter::CopyToCharArrayN(wapApplicationId);
- SysTryCatch(NID_MSG, pWapAppId != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");
-
- err = messages_push_remove_incoming_cb(__msgHandle, pWapAppId);
-
- r = ConvertException(err);
- SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to Remove WapPush EventListener.", GetErrorMessage(r));
-
- if (pWapAppId)
- {
- delete[] pWapAppId;
- pWapAppId = null;
- }
-
if (__pWapPushReceiveEvent)
{
delete __pWapPushReceiveEvent;
return r;
CATCH:
- if (pWapAppId)
- {
- delete[] pWapAppId;
- pWapAppId = null;
- }
return r;
}
_WapPushManagerImpl::RegisterCondition(const Tizen::Base::String& wapApplicationId, const Tizen::Base::String& contentType)
{
result r = E_SUCCESS;
- int err = MESSAGES_ERROR_NONE;
+ int err = MSG_SUCCESS;
char* pWapAppId = null;
char* pContentType = null;
+ msg_struct_t pushInfo;
+ char* pPkgName = null;
ClearLastResult();
pContentType = _StringConverter::CopyToCharArrayN(contentType);
SysTryCatch(NID_MSG, pContentType != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");
- err = messages_push_register(__msgHandle, pContentType, pWapAppId);
+ err = app_get_package(&pPkgName);
+ SysTryCatch(NID_MSG, err == APP_ERROR_NONE, r = E_SYSTEM, r, "[%s] Failed to Open Message Handle", GetErrorMessage(r));
+
+ pushInfo = msg_create_struct(MSG_STRUCT_PUSH_CONFIG_INFO);
+ msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, (char *)pContentType, MAX_WAPPUSH_CONTENT_TYPE_LEN);
+ msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_APPLICATON_ID_STR, (char *)pWapAppId, MAX_WAPPUSH_ID_LEN);
+ msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, pPkgName, MSG_FILEPATH_LEN_MAX);
+ free(pPkgName);
+
+ err = msg_add_push_event(__msgHandle, pushInfo);
+ msg_release_struct(&pushInfo);
r = ConvertException(err);
SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to register Condition for wap push.", GetErrorMessage(r));
return r;
CATCH:
+ free(pPkgName);
+ msg_release_struct(&pushInfo);
+
if (pWapAppId)
{
delete[] pWapAppId;
_WapPushManagerImpl::UnregisterCondition(const Tizen::Base::String& wapApplicationId, const Tizen::Base::String& contentType)
{
result r = E_SUCCESS;
- int err = MESSAGES_ERROR_NONE;
+ int err = MSG_SUCCESS;
char* pWapAppId = null;
char* pContentType = null;
+ msg_struct_t pushInfo;
+ char* pPkgName = null;
ClearLastResult();
pContentType = _StringConverter::CopyToCharArrayN(contentType);
SysTryCatch(NID_MSG, pContentType != null, r = E_OUT_OF_MEMORY, r, "memory allocation failed");
- err = messages_push_deregister(__msgHandle, pContentType, pWapAppId);
+ err = app_get_package(&pPkgName);
+ SysTryCatch(NID_MSG, err == APP_ERROR_NONE, r = E_SYSTEM, r, "[%s] Failed to Open Message Handle", GetErrorMessage(r));
+
+ pushInfo = msg_create_struct(MSG_STRUCT_PUSH_CONFIG_INFO);
+ msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, pContentType, MAX_WAPPUSH_CONTENT_TYPE_LEN);
+ msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_APPLICATON_ID_STR, pWapAppId, MAX_WAPPUSH_ID_LEN);
+ msg_set_str_value(pushInfo, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, pPkgName, MSG_FILEPATH_LEN_MAX);
+ free(pPkgName);
+
+ err = msg_delete_push_event(__msgHandle, pushInfo);
+ msg_release_struct(&pushInfo);
r = ConvertException(err);
SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to Unregister Condition for wap push", GetErrorMessage(r));
return r;
CATCH:
+ free(pPkgName);
+ msg_release_struct(&pushInfo);
+
if (pWapAppId)
{
delete[] pWapAppId;
switch (err)
{
- case MESSAGES_ERROR_NONE:
+ case MSG_SUCCESS:
r = E_SUCCESS;
break;
- case MESSAGES_ERROR_INVALID_PARAMETER:
+ case MSG_ERR_INVALID_PARAMETER:
+ case MSG_ERR_INVALID_MESSAGE:
+ case MSG_ERR_NULL_POINTER:
+ case MSG_ERR_NULL_MESSAGE:
r = E_INVALID_ARG;
break;
- case MESSAGES_ERROR_OUT_OF_MEMORY:
+ case MSG_ERR_MEMORY_ERROR:
r = E_OUT_OF_MEMORY;
break;
- case MESSAGES_ERROR_SERVER_NOT_READY: // Communication error between client and server
- case MESSAGES_ERROR_COMMUNICATION_WITH_SERVER_FAILED:
+ case MSG_ERR_SERVER_NOT_READY:
+ case MSG_ERR_TRANSPORT_ERROR:
+ case MSG_ERR_COMMUNICATION_ERROR:
r = E_NETWORK_UNAVAILABLE;
break;
- case MESSAGES_ERROR_NO_SIM_CARD:
+ case MSG_ERR_NO_SIM:
r = E_DEVICE_UNAVAILABLE;
break;
- case MESSAGES_ERROR_OUT_OF_RANGE:
- r = E_OBJ_ALREADY_EXIST;
- break;
-
- case MESSAGES_ERROR_SENDING_FAILED:
- case MESSAGES_ERROR_OPERATION_FAILED:
+ case MSG_ERR_PLUGIN_TAPI_FAILED:
r = E_FAILURE;
break;