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 FTelNetworkInfo.cpp
19 * @brief This is the implementation file for NetworkInfo class.
22 #include <FTelNetworkInfo.h>
23 #include <FBaseSysLog.h>
24 #include <FSec_AccessController.h>
25 #include "FTel_NetworkInfoImpl.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Security;
32 namespace Tizen { namespace Telephony
35 NetworkInfo::NetworkInfo(void)
36 : __pNetworkInfoImpl(null)
38 __pNetworkInfoImpl = new (std::nothrow) _NetworkInfoImpl();
39 SysTryReturnVoidResult(NID_TEL, __pNetworkInfoImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
42 NetworkInfo::NetworkInfo(const NetworkInfo& value)
44 __pNetworkInfoImpl = new (std::nothrow) _NetworkInfoImpl(*(value.__pNetworkInfoImpl));
45 SysTryReturnVoidResult(NID_TEL, __pNetworkInfoImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
48 NetworkInfo::~NetworkInfo(void)
50 delete __pNetworkInfoImpl;
54 NetworkInfo::operator=(const NetworkInfo& rhs)
58 *__pNetworkInfoImpl = *(rhs.__pNetworkInfoImpl);
65 NetworkInfo::GetMnc(void) const
70 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
72 SysTryReturn(NID_TEL, r == E_SUCCESS, mnc, E_PRIVILEGE_DENIED,
73 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
75 mnc = __pNetworkInfoImpl->GetMnc();
81 NetworkInfo::GetMcc(void) const
86 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
88 SysTryReturn(NID_TEL, r == E_SUCCESS, mcc, E_PRIVILEGE_DENIED,
89 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
91 mcc = __pNetworkInfoImpl->GetMcc();
97 NetworkInfo::GetPlmn(void) const
102 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
104 SysTryReturn(NID_TEL, r == E_SUCCESS, plmn, E_PRIVILEGE_DENIED,
105 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
107 plmn = __pNetworkInfoImpl->GetPlmn();
113 NetworkInfo::GetCellId(void) const
118 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
120 SysTryReturn(NID_TEL, r == E_SUCCESS, cellId, E_PRIVILEGE_DENIED,
121 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
123 cellId = __pNetworkInfoImpl->GetCellId();
129 NetworkInfo::GetLac(void) const
134 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
136 SysTryReturn(NID_TEL, r == E_SUCCESS, lac, E_PRIVILEGE_DENIED,
137 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
139 lac = __pNetworkInfoImpl->GetLac();
145 NetworkInfo::GetOperatorName(void) const
150 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
152 SysTryReturn(NID_TEL, r == E_SUCCESS, operatorName, E_PRIVILEGE_DENIED,
153 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
155 operatorName = __pNetworkInfoImpl->GetOperatorName();
161 NetworkInfo::Equals(const Object& obj) const
163 const NetworkInfo* pOther = dynamic_cast<const NetworkInfo*>(&obj);
175 return __pNetworkInfoImpl->Equals(*pOther->__pNetworkInfoImpl);
179 NetworkInfo::GetHashCode(void) const
181 return __pNetworkInfoImpl->GetHashCode();
185 NetworkInfo::GetRssi(void)
190 result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO);
192 SysTryReturn(NID_TEL, r == E_SUCCESS, rssi, E_PRIVILEGE_DENIED,
193 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
195 rssi = _NetworkInfoImpl::GetRssi();
199 SysTryReturn(NID_TEL, r == E_SUCCESS, rssi, r, "[%s] Propagating.", GetErrorMessage(r));
204 }} // Tizen::Telephony