Implement E_UNSUPPORTED_OPERATION.
authorJaemin Ahn <j.m.ahn@samsung.com>
Wed, 27 Mar 2013 02:02:43 +0000 (11:02 +0900)
committerJaemin Ahn <j.m.ahn@samsung.com>
Wed, 27 Mar 2013 02:08:57 +0000 (11:08 +0900)
Change-Id: I8c80f3cd3627240732cdacff70d5464c1508d42a
Signed-off-by: Jaemin Ahn <j.m.ahn@samsung.com>
src/CMakeLists.txt
src/FNetNetAccountManager.cpp
src/FNetNetAccountManagerPartner.cpp
src/FNetNetConnectionManager.cpp
src/FNetNetStatistics.cpp

index ed85888..3b4956c 100644 (file)
@@ -14,6 +14,7 @@ INCLUDE_DIRECTORIES(
        /usr/include/osp/base
        /usr/include/osp/io
        /usr/include/osp/security
+       /usr/include/osp/system
        /usr/include/vconf
        /usr/include/wifi-direct        
        )
index 0d480f1..ed8413a 100644 (file)
 #include <FNetNetAccountManager.h>
 #include <FBaseSysLog.h>
 #include <FSec_AccessController.h>
+#include <FSys_SystemInfoImpl.h>
 #include "FNet_NetAccountManagerImpl.h"
 
 using namespace std;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Security;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Net
 {
@@ -75,6 +77,16 @@ NetAccountManager::CreateNetAccount(NetAccountInfo& netAccountInfo)
        SysTryReturn(NID_NET, r == E_SUCCESS, INVALID_HANDLE, r,
                        "[%s] The application does not have the privilege to call this method.", GetErrorMessage(r));
 
+#ifndef _OSP_EMUL_
+       static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+       bool isTelephonySupported = false;
+
+    r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+    SysTryReturn(NID_NET, r == E_SUCCESS && isTelephonySupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+               "[%s] Telephony is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+#endif // !_OSP_EMUL_
+
        SysAssertf(__pNetAccountManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        netAccountId = __pNetAccountManagerImpl->CreateNetAccount(netAccountInfo);
@@ -112,6 +124,15 @@ NetAccountManager::UpdateNetAccount(const NetAccountInfo& netAccountInfo)
        SysTryReturnResult(NID_NET, r == E_SUCCESS, r,
                        "[%s] The application does not have the privilege to call this method.", GetErrorMessage(r));
 
+#ifndef _OSP_EMUL_
+       static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+       bool isTelephonySupported = false;
+
+    r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+    SysTryReturnResult(NID_NET, r == E_SUCCESS && isTelephonySupported, E_UNSUPPORTED_OPERATION, "Telephony is not supported.");
+#endif // !_OSP_EMUL_
+
        SysAssertf(__pNetAccountManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        r = __pNetAccountManagerImpl->UpdateNetAccount(netAccountInfo);
@@ -188,6 +209,60 @@ NetAccountManager::GetNetAccountId(NetBearerType netBearerType) const
 
        SysAssertf(__pNetAccountManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
+#ifndef _OSP_EMUL_
+       if (netBearerType == NET_BEARER_PS)
+       {
+               static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+               bool isTelephonySupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+           SysTryReturn(NID_NET, r == E_SUCCESS && isTelephonySupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+                       "[%s] Telephony is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+       }
+       else if (netBearerType == NET_BEARER_WIFI)
+       {
+           static const wchar_t _WIFI[] = L"http://tizen.org/feature/network.wifi";
+
+               bool isWifiSupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_WIFI, isWifiSupported);
+           SysTryReturn(NID_NET, r == E_SUCCESS && isWifiSupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+                       "[%s] Wi-Fi is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+       }
+       else if (netBearerType == NET_BEARER_WIFI_DIRECT)
+       {
+           static const wchar_t _WIFI_DIRECT[] = L"http://tizen.org/feature/network.wifi.direct";
+
+               bool isWifiDirectSupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_WIFI_DIRECT, isWifiDirectSupported);
+           SysTryReturn(NID_NET, r == E_SUCCESS && isWifiDirectSupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+                       "[%s] Wi-Fi direct is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+       }
+       else if (netBearerType == NET_BEARER_USB)
+       {
+           static const wchar_t _USB[] = L"http://tizen.org/feature/usb.host";
+
+               bool isUsbSupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_USB, isUsbSupported);
+           SysTryReturn(NID_NET, r == E_SUCCESS && isUsbSupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+                       "[%s] USB is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+       }
+// ToDo - Check MMS after MMS feature key works well.
+//     else if (netBearerType == NET_BEARER_MMS)
+//     {
+//             static const wchar_t _MMS[] = L"http://tizen.org/feature/network.telephony.mms";
+//
+//             bool isMmsSupported = false;
+//
+//         r = _SystemInfoImpl::GetSysInfo(_MMS, isMmsSupported);
+//         SysTryReturn(NID_NET, r == E_SUCCESS && isMmsSupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+//                     "[%s] MMS is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+//     }
+#endif // !_OSP_EMUL_
+
        netAccountId = __pNetAccountManagerImpl->GetNetAccountId(netBearerType);
        r = GetLastResult();
        SysTryReturn(NID_NET, netAccountId != INVALID_HANDLE, INVALID_HANDLE, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -217,6 +292,26 @@ NetAccountManager::SetNetPreference(NetPreferenceType netPreference)
        SysTryReturnResult(NID_NET, r == E_SUCCESS, r,
                        "[%s] The application does not have the privilege to call this method.", GetErrorMessage(r));
 
+#ifndef _OSP_EMUL_
+       if (netPreference == NET_WIFI_ONLY)
+       {
+               static const wchar_t _WIFI[] = L"http://tizen.org/feature/network.wifi";
+
+               bool isWifiSupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_WIFI, isWifiSupported);
+           SysTryReturnResult(NID_NET, r == E_SUCCESS && isWifiSupported, E_UNSUPPORTED_OPERATION, "Wi-Fi is not supported.");
+       }
+       else if (netPreference == NET_PS_ONLY)
+       {
+               static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+               bool isTelephonySupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+           SysTryReturnResult(NID_NET, r == E_SUCCESS && isTelephonySupported, E_UNSUPPORTED_OPERATION, "Telephony is not supported.");
+       }
+#endif // !_OSP_EMUL_
 
        SysAssertf(__pNetAccountManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
index 7353429..0ba8822 100644 (file)
@@ -24,6 +24,7 @@
 #include <FNetNetAccountManager.h>
 #include <FBaseSysLog.h>
 #include <FSec_AccessController.h>
+#include <FSys_SystemInfoImpl.h>
 #include "FNet_NetTypes.h"
 #include "FNet_NetAccountDatabase.h"
 #include "FNet_NetAccountInfoImpl.h"
@@ -33,6 +34,7 @@
 
 using namespace Tizen::Base;
 using namespace Tizen::Security;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Net
 {
@@ -46,6 +48,28 @@ NetAccountManager::UpdateSystemNetAccount(const NetAccountInfo& netAccountInfo)
 
        SysAssertf(__pNetAccountManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
+#ifndef _OSP_EMUL_
+       if (netAccountInfo.GetAccountId() == _DEFAULT_PS_ACCOUNT_ID)
+       {
+               static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+               bool isTelephonySupported = false;
+
+               r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+               SysTryReturnResult(NID_NET, r == E_SUCCESS && isTelephonySupported, E_UNSUPPORTED_OPERATION, "Telephony is not supported.");
+       }
+// ToDo - Check MMS after MMS feature key works well.
+//     else if (netAccountInfo.GetAccountId() == _DEFAULT_MMS_ACCOUNT_ID)
+//     {
+//             static const wchar_t _MMS[] = L"http://tizen.org/feature/network.telephony.mms";
+//
+//             bool isMmsSupported = false;
+//
+//             r = _SystemInfoImpl::GetSysInfo(_MMS, isMmsSupported);
+//             SysTryReturnResult(NID_NET, r == E_SUCCESS && isMmsSupported, E_UNSUPPORTED_OPERATION, "MMS is not supported.");
+//     }
+#endif // !_OSP_EMUL_
+
        SysTryReturnResult(NID_NET, netAccountInfo.GetAccountId() > 0, E_INVALID_ARG,
                        "Invalid argument is used. accountId=%d", netAccountInfo.GetAccountId());
        SysTryReturnResult(NID_NET, !netAccountInfo.GetAccountName().IsEmpty(), E_INVALID_ARG,
@@ -79,6 +103,30 @@ NetAccountManager::GetAppNetAccountId(const String& netProfileName) const
 
        SysAssertf(__pNetAccountManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
+#ifndef _OSP_EMUL_
+       if (netProfileName.Equals(L"Internet", false))
+       {
+               static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+               bool isTelephonySupported = false;
+
+               r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+               SysTryReturn(NID_NET, r == E_SUCCESS && isTelephonySupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+                               "[%s] Telephony is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+       }
+// ToDo - Check MMS after MMS feature key works well.
+//     else if (netProfileName.Equals(L"Mms", false))
+//     {
+//             static const wchar_t _MMS[] = L"http://tizen.org/feature/network.telephony.mms";
+//
+//             bool isMmsSupported = false;
+//
+//             r = _SystemInfoImpl::GetSysInfo(_MMS, isMmsSupported);
+//             SysTryReturn(NID_NET, r == E_SUCCESS && isMmsSupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+//                             "[%s] MMS is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+//     }
+#endif // !_OSP_EMUL_
+
        _NetIpcProxy* pProxy = _NetIpcProxy::GetInstance();
        SysTryReturn(NID_NET, pProxy != null, INVALID_HANDLE, E_SYSTEM,
                        "[%s] A system error has been occurred. Failed to get an IPC proxy.", GetErrorMessage(E_SYSTEM));
index e7733d6..066436b 100644 (file)
 #include <FNetNetConnectionManager.h>
 #include <FBaseSysLog.h>
 #include <FSec_AccessController.h>
+#include <FSys_SystemInfoImpl.h>
 #include "FNet_NetConnectionManagerImpl.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Security;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Net
 {
@@ -105,6 +107,27 @@ NetConnectionManager::SetNetPreference(NetPreferenceType netPreference)
        SysTryReturnResult(NID_NET, r == E_SUCCESS, r,
                        "[%s] The application does not have the privilege to call this method.", GetErrorMessage(r));
 
+#ifndef _OSP_EMUL_
+       if (netPreference == NET_WIFI_ONLY)
+       {
+               static const wchar_t _WIFI[] = L"http://tizen.org/feature/network.wifi";
+
+               bool isWifiSupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_WIFI, isWifiSupported);
+           SysTryReturnResult(NID_NET, r == E_SUCCESS && isWifiSupported, E_UNSUPPORTED_OPERATION, "Wi-Fi is not supported.");
+       }
+       else if (netPreference == NET_PS_ONLY)
+       {
+               static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+               bool isTelephonySupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+           SysTryReturnResult(NID_NET, r == E_SUCCESS && isTelephonySupported, E_UNSUPPORTED_OPERATION, "Telephony is not supported.");
+       }
+#endif // !_OSP_EMUL_
+
        SysAssertf(__pNetConnectionManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        r = __pNetConnectionManagerImpl->SetNetPreference(netPreference);
index 170dde3..bec27bb 100644 (file)
 #include <FNet_NetTypes.h>
 #include <FBaseSysLog.h>
 #include <FSec_AccessController.h>
+#include <FSys_SystemInfoImpl.h>
 #include "FNet_NetStatisticsImpl.h"
 
 using namespace std;
 using namespace Tizen::Base;
 using namespace Tizen::Security;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Net
 {
@@ -77,6 +79,29 @@ NetStatistics::GetNetStatisticsInfo(NetBearerType operationMode, NetStatisticsIn
        SysTryReturn(NID_NET, r == E_SUCCESS, INVALID_HANDLE, r,
                        "[%s] The application does not have the privilege to call this method.", GetErrorMessage(r));
 
+#ifndef _OSP_EMUL_
+       if (operationMode == NET_BEARER_WIFI)
+       {
+               static const wchar_t _WIFI[] = L"http://tizen.org/feature/network.wifi";
+
+               bool isWifiSupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_WIFI, isWifiSupported);
+           SysTryReturn(NID_NET, r == E_SUCCESS && isWifiSupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+                       "[%s] Wi-Fi is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+       }
+       else if (operationMode == NET_BEARER_PS)
+       {
+               static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+               bool isTelephonySupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+           SysTryReturn(NID_NET, r == E_SUCCESS && isTelephonySupported, INVALID_HANDLE, E_UNSUPPORTED_OPERATION,
+                       "[%s] Telephony is not supported.", GetErrorMessage(E_UNSUPPORTED_OPERATION));
+       }
+#endif // !_OSP_EMUL_
+
        SysAssertf(__pNetStatisticsImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        ret = __pNetStatisticsImpl->GetNetStatisticsInfo(operationMode, netStatType);
@@ -93,6 +118,27 @@ NetStatistics::Reset(NetBearerType operationMode, NetStatisticsInfoType netStatT
 
        SysAssertf(__pNetStatisticsImpl != null, "Not yet constructed. Construct() should be called before use.");
 
+#ifndef _OSP_EMUL_
+       if (operationMode == NET_BEARER_WIFI)
+       {
+               static const wchar_t _WIFI[] = L"http://tizen.org/feature/network.wifi";
+
+               bool isWifiSupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_WIFI, isWifiSupported);
+           SysTryReturnResult(NID_NET, r == E_SUCCESS && isWifiSupported, E_UNSUPPORTED_OPERATION, "Wi-Fi is not supported.");
+       }
+       else if (operationMode == NET_BEARER_PS)
+       {
+               static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+               bool isTelephonySupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+           SysTryReturnResult(NID_NET, r == E_SUCCESS && isTelephonySupported, E_UNSUPPORTED_OPERATION, "Telephony is not supported.");
+       }
+#endif // !_OSP_EMUL_
+
        r = __pNetStatisticsImpl->Reset(operationMode, netStatType);
        SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
 
@@ -106,6 +152,27 @@ NetStatistics::ResetAll(NetBearerType operationMode)
 
        SysAssertf(__pNetStatisticsImpl != null, "Not yet constructed. Construct() should be called before use.");
 
+#ifndef _OSP_EMUL_
+       if (operationMode == NET_BEARER_WIFI)
+       {
+               static const wchar_t _WIFI[] = L"http://tizen.org/feature/network.wifi";
+
+               bool isWifiSupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_WIFI, isWifiSupported);
+           SysTryReturnResult(NID_NET, r == E_SUCCESS && isWifiSupported, E_UNSUPPORTED_OPERATION, "Wi-Fi is not supported.");
+       }
+       else if (operationMode == NET_BEARER_PS)
+       {
+               static const wchar_t _TELEPHONY[] = L"http://tizen.org/feature/network.telephony";
+
+               bool isTelephonySupported = false;
+
+           r = _SystemInfoImpl::GetSysInfo(_TELEPHONY, isTelephonySupported);
+           SysTryReturnResult(NID_NET, r == E_SUCCESS && isTelephonySupported, E_UNSUPPORTED_OPERATION, "Telephony is not supported.");
+       }
+#endif // !_OSP_EMUL_
+
        r = __pNetStatisticsImpl->ResetAll(operationMode);
        SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");