Synchronized tizen_2.1 branch with master
[platform/framework/native/telephony.git] / src / FTelCallManager.cpp
index c80835f..12467be 100644 (file)
 #include <FTelCallManager.h>
 #include <FBaseSysLog.h>
 #include <FSec_AccessController.h>
+#include <FSys_SystemInfoImpl.h>
 #include "FTel_CallManagerImpl.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Security;
+using namespace Tizen::System;
 
 
 namespace Tizen { namespace Telephony
@@ -43,10 +45,16 @@ CallManager::~CallManager(void)
 result
 CallManager::Construct(void)
 {
+       static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
        SysAssertf(__pCallManagerImpl  == null,
                        "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
        result r = E_SUCCESS;
+       bool isTelephonySupported = false;
+
+    r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+    SysTryReturnResult(NID_TEL, r == E_SUCCESS && isTelephonySupported, E_UNSUPPORTED_OPERATION, "Telephony is not supported.");
 
        __pCallManagerImpl = new (std::nothrow) _CallManagerImpl();
        SysTryReturnResult(NID_TEL, __pCallManagerImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
@@ -65,10 +73,16 @@ CallManager::Construct(void)
 result
 CallManager::Construct(ITelephonyCallEventListener& listener)
 {
+       static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
        SysAssertf(__pCallManagerImpl == null,
                "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
 
        result r = E_SUCCESS;
+       bool isTelephonySupported = false;
+
+    r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+    SysTryReturnResult(NID_TEL, r == E_SUCCESS && isTelephonySupported, E_UNSUPPORTED_OPERATION, "Telephony is not supported.");
 
        __pCallManagerImpl = new (std::nothrow) _CallManagerImpl();
        SysTryReturnResult(NID_TEL, __pCallManagerImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");