2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FTelNetworkStatus.cpp
19 * @brief This is the implementation file for NetworkStatus class.
22 #include <FTelNetworkStatus.h>
23 #include <FBaseSysLog.h>
24 #include <FSec_AccessController.h>
25 #include "FTel_NetworkStatusImpl.h"
27 using namespace Tizen::Security;
29 namespace Tizen { namespace Telephony
31 NetworkStatus::NetworkStatus(void)
32 : __pNetworkStatusImpl(null)
34 __pNetworkStatusImpl = new (std::nothrow) _NetworkStatusImpl();
35 SysTryReturnVoidResult(NID_TEL, __pNetworkStatusImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
38 NetworkStatus::~NetworkStatus(void)
40 delete __pNetworkStatusImpl;
44 NetworkStatus::IsRoaming(void) const
48 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
49 SysTryReturn(NID_TEL, r == E_SUCCESS, false, E_PRIVILEGE_DENIED,
50 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
52 bool isRoaming = false;
54 isRoaming = __pNetworkStatusImpl->IsRoaming();
60 NetworkStatus::IsCallServiceAvailable(void) const
64 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
65 SysTryReturn(NID_TEL, r == E_SUCCESS, false, E_PRIVILEGE_DENIED,
66 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
68 bool isCallServiceAvailable = false;
70 isCallServiceAvailable = __pNetworkStatusImpl->IsCallServiceAvailable();
72 return isCallServiceAvailable;
76 NetworkStatus::IsDataServiceAvailable(void) const
80 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
81 SysTryReturn(NID_TEL, r == E_SUCCESS, false, E_PRIVILEGE_DENIED,
82 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
84 bool isDataServiceAvailable = false;
86 isDataServiceAvailable = __pNetworkStatusImpl->IsDataServiceAvailable();
88 return isDataServiceAvailable;
91 }} // Tizen::Telephony