Add E_UNSUPPORTED_OPERATION on push feature.
authorJaemin Ahn <j.m.ahn@samsung.com>
Wed, 20 Mar 2013 07:18:30 +0000 (16:18 +0900)
committerJaemin Ahn <j.m.ahn@samsung.com>
Wed, 20 Mar 2013 07:18:30 +0000 (16:18 +0900)
Change-Id: I30c923332e2e3dbb3eee184ccb22b592a074bac4
Signed-off-by: Jaemin Ahn <j.m.ahn@samsung.com>
CMakeLists.txt
src/FMsgPushManager.cpp

index 748ae95..8ca1882 100644 (file)
@@ -15,6 +15,7 @@ INCLUDE_DIRECTORIES(
        /usr/include/osp/app
        /usr/include/osp/base
        /usr/include/osp/security
+       /usr/include/osp/system
        /usr/include/msg-service
        /usr/include/dbus-1.0
        /usr/lib/dbus-1.0/include
index 0f7c69d..8093e1f 100644 (file)
 #include <FMsgPushManager.h>
 #include <FBaseSysLog.h>
 #include <FSec_AccessController.h>
+#include <FSys_SystemInfoImpl.h>
 #include "FMsg_PushManagerImpl.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Security;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Messaging
 {
@@ -47,11 +49,18 @@ PushManager::~PushManager(void)
 result
 PushManager::Construct(IPushManagerListener& managerListener, IPushEventListener& eventListener)
 {
+       static const wchar_t _PUSH[] = L"http://tizen.org/feature/network.push";
+
        result r = E_SUCCESS;
 
        r = _AccessController::CheckUserPrivilege(_PRV_PUSH);
        SysTryReturnResult(NID_MSG, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
 
+       bool isPushSupported = false;
+
+    r = _SystemInfoImpl::GetSysInfo(_PUSH, isPushSupported);
+    SysTryReturnResult(NID_NET, r == E_SUCCESS && isPushSupported, E_UNSUPPORTED_OPERATION, "Push messaging is not supported.");
+
        SysAssertf(__pPushManagerImpl == null,
                        "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");