From b6584d5eab189dae7b1fc248001020c58f277aa0 Mon Sep 17 00:00:00 2001 From: Jaemin Ahn Date: Wed, 27 Mar 2013 11:02:43 +0900 Subject: [PATCH] Implement E_UNSUPPORTED_OPERATION. Change-Id: I8c80f3cd3627240732cdacff70d5464c1508d42a Signed-off-by: Jaemin Ahn --- src/CMakeLists.txt | 1 + src/FNetNetAccountManager.cpp | 95 ++++++++++++++++++++++++++++++++++++ src/FNetNetAccountManagerPartner.cpp | 48 ++++++++++++++++++ src/FNetNetConnectionManager.cpp | 23 +++++++++ src/FNetNetStatistics.cpp | 67 +++++++++++++++++++++++++ 5 files changed, 234 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ed85888..3b4956c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 ) diff --git a/src/FNetNetAccountManager.cpp b/src/FNetNetAccountManager.cpp index 0d480f1..ed8413a 100644 --- a/src/FNetNetAccountManager.cpp +++ b/src/FNetNetAccountManager.cpp @@ -23,12 +23,14 @@ #include #include #include +#include #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."); diff --git a/src/FNetNetAccountManagerPartner.cpp b/src/FNetNetAccountManagerPartner.cpp index 7353429..0ba8822 100644 --- a/src/FNetNetAccountManagerPartner.cpp +++ b/src/FNetNetAccountManagerPartner.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #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)); diff --git a/src/FNetNetConnectionManager.cpp b/src/FNetNetConnectionManager.cpp index e7733d6..066436b 100644 --- a/src/FNetNetConnectionManager.cpp +++ b/src/FNetNetConnectionManager.cpp @@ -24,11 +24,13 @@ #include #include #include +#include #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); diff --git a/src/FNetNetStatistics.cpp b/src/FNetNetStatistics.cpp index 170dde3..bec27bb 100644 --- a/src/FNetNetStatistics.cpp +++ b/src/FNetNetStatistics.cpp @@ -25,11 +25,13 @@ #include #include #include +#include #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."); -- 2.7.4