Synchronized tizen_2.1 branch with master
[platform/framework/native/telephony.git] / src / FTelSimInfo.cpp
index ca24fc1..3c96ed9 100644 (file)
 #include <FTelSimInfo.h>
 #include <FBaseSysLog.h>
 #include <FSec_AccessController.h>
+#include <FSys_SystemInfoImpl.h>
 #include "FTel_SimInfoImpl.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Security;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Telephony
 {
@@ -50,10 +52,16 @@ SimInfo::~SimInfo(void)
 result
 SimInfo::Construct(void)
 {
+       static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
        SysAssertf(__pSimInfoImpl == 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.");
 
        __pSimInfoImpl = new (std::nothrow)_SimInfoImpl();
        SysTryReturnResult(NID_TEL, __pSimInfoImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed");