Tizen 2.1 base
[platform/framework/native/telephony.git] / inc / FTelNetworkInfo.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file        FTelNetworkInfo.h
19  * @brief       This is the header file for the %NetworkInfo class.
20  *
21  * This header file contains the declarations of the %NetworkInfo class.
22  */
23 #ifndef _FTEL_NETWORK_INFO_H_
24 #define _FTEL_NETWORK_INFO_H_
25
26
27 #include <FBase.h>
28
29
30 namespace Tizen { namespace Telephony
31 {
32 class _NetworkInfoImpl;
33
34 /**
35  * @class       NetworkInfo
36  * @brief       This class provides information of the current network.
37  *
38  * @since       2.0
39  *
40  * The %NetworkInfo class provides methods to get information of the current network such as MNC, MCC, PLMN, cell ID, and operator name.
41  *
42  * The following example demonstrates how to use the %NetworkInfo class to get the network information.
43  *
44  * @code
45  *
46  *      result
47  *      MyClass::GetNetworkInfo(void)
48  *      {
49  *              result r = E_SUCCESS;
50  *              int mnc;
51  *              int mcc;
52  *              int cellId;
53  *              int lac;
54  *              String plmn;
55  *              String operatorName;
56  *
57  *              NetworkInfo networkInfo;
58  *
59  *              NetworkManager* pNetworkManager = new NetworkManager();
60  *
61  *              r = pNetworkManager->Construct(null);
62  *              if (IsFailed(r))
63  *              {
64  *                      delete pNetworkManager;
65  *                      return r;
66  *              }
67  *
68  *              r = pNetworkManager->GetNetworkInfo(networkInfo);
69  *              if (IsFailed(r))
70  *              {
71  *                      delete pNetworkManager;
72  *                      return r;
73  *              }
74  *
75  *              mnc = networkInfo.GetMnc();
76  *              mcc = networkInfo.GetMcc();
77  *              cellId = networkInfo.GetCellId();
78  *              lac = networkInfo.GetLac();
79  *              plmn = networkInfo.GetPlmn();
80  *              operatorName = networkInfo.GetOperatorName();
81  *
82  *              delete pNetworkManager;
83  *              return r;
84  *      }
85  *
86  * @endcode
87  */
88 class _OSP_EXPORT_ NetworkInfo
89         : public Tizen::Base::Object
90 {
91 public:
92         /**
93      * This is the default constructor for this class.
94      *
95      * @since   2.0
96      */
97         NetworkInfo(void);
98
99         /**
100      * Copying of objects using this copy constructor is allowed.
101      *
102      * @since 2.0
103      *
104      * @param[in]   rhs   An instance of %NetworkInfo
105      */
106         NetworkInfo(const NetworkInfo& rhs);
107
108         /**
109      * This destructor overrides Tizen::Base::Object::~Object().
110      *
111      * @since   2.0
112      */
113         virtual ~NetworkInfo(void);
114
115         /**
116      * Gets the Mobile Network Code (MNC) of the network.
117      *
118      * @since   2.0
119      * @privilege   %http://tizen.org/privilege/systeminfo
120      *
121      * @return          The MNC of the network
122      * @exception       E_SUCCESS       The method is successful.
123      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
124      * @remarks         The specific error code can be accessed using the GetLastResult() method.
125      */
126         int GetMnc(void) const;
127
128         /**
129      * Gets the Mobile Country Code (MCC) of the network.
130      *
131      * @since   2.0
132      * @privilege   %http://tizen.org/privilege/systeminfo
133      *
134      * @return          The MCC of the network
135      * @exception       E_SUCCESS       The method is successful.
136      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
137      * @remarks         The specific error code can be accessed using the GetLastResult() method.
138      */
139         int GetMcc(void) const;
140
141     /**
142      * Gets the Public Land Mobile Network (PLMN).
143      *
144      * @if OSPCOMPAT
145      * @brief <i> [Compatibility] </i>
146      * @endif
147      * @since   2.0
148      * @if OSPCOMPAT
149      * @compatibility   This method has compatibility issues with OSP compatible applications. @n
150      *                  For more information, see the issue description for @ref CompNetworkInfoGetPlmnPage "here".
151      * @endif
152      * @privilege   %http://tizen.org/privilege/systeminfo
153      *
154      * @return          The PLMN name
155      * @exception       E_SUCCESS               The method is successful.
156      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
157      * @remarks         The specific error code can be accessed using the GetLastResult() method.
158      */
159         Tizen::Base::String GetPlmn(void) const;
160
161
162     /**
163      * @page    CompNetworkInfoGetPlmnPage Compatibility for GetPlmn()
164      * @section CompNetworkInfoGetPlmnPageIssueSection Issues
165      *          Implementing this method in OSP compatible applications has the following issues:   @n 
166      *          -# The method returns an alphabetic name of PLMN.
167      *
168      * @section CompNetworkInfoGetPlmnPageSolutionSection Resolutions
169      *          -# The method returns a numeric name of PLMN-ID(MCC+MNC).
170      *           To get the alphabetic name of PLMN, it is recommended to use Tizen::Telephony::GetOperatorName().
171      */
172
173     /**
174      * Gets the current cell ID.
175      *
176      * @since   2.0
177      * @privilege   %http://tizen.org/privilege/systeminfo
178      *
179      * @return          The current cell ID
180      * @exception       E_SUCCESS       The method is successful.
181      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
182      * @remarks     This cell ID is provided using only NetworkManager::GetNetworkInfo() when connected to a network.
183      * @remarks         The specific error code can be accessed using the GetLastResult() method.
184      */
185         int GetCellId(void) const;
186
187         /**
188      * Gets the current Location Area Code (LAC).
189      *
190      * @since   2.0
191      * @privilege   %http://tizen.org/privilege/systeminfo
192      *
193      * @return          The current LAC
194      * @exception       E_SUCCESS       The method is successful.
195      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
196      * @remarks     This LAC is provided using only NetworkManager::GetNetworkInfo() when connected to a network.
197      * @remarks         The specific error code can be accessed using the GetLastResult() method.
198      */
199         int GetLac(void) const;
200
201     /**
202      * Gets the operator name.
203      *
204      * @since 2.0
205      * @privilege   %http://tizen.org/privilege/systeminfo
206      *
207      * @return      The operator name
208      * @exception   E_SUCCESS   The method is successful.
209      * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
210      * @remarks         The specific error code can be accessed using the GetLastResult() method.
211      */
212     Tizen::Base::String GetOperatorName(void) const;
213
214     /**
215      * Checks whether the specified instance of %NetworkInfo equals the current instance.
216      *
217      * @since   2.0
218          *
219      * @return  @c true if the specified instance equals the current instance, @n
220      *          else @c false
221      * @param[in]   rhs An instance of %NetworkInfo
222      * @remarks     The method returns @c false if the specified object is not %NetworkInfo.
223      */
224         virtual bool Equals(const Tizen::Base::Object& rhs) const;
225
226         /**
227      * Gets the hash value of the current instance.
228      *
229      * @since   2.0
230      *
231      * @return  The hash value of the current instance
232      */
233         virtual int GetHashCode(void) const;
234
235         /**
236      * Gets the received signal strength indication of a modem device.
237      *
238      * @since   2.0
239      * @privilege   %http://tizen.org/privilege/systeminfo
240      *
241      * @return  The current RSSI @n
242      *          The possible RSSI value ranges from @c 0 to @c 100.
243      * @exception   E_SUCCESS   The method is successful.
244      * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
245      * @exception   E_SYSTEM    A system error has occurred.
246      * @remarks         The specific error code can be accessed using the GetLastResult() method.
247      */
248         static int GetRssi(void);
249
250         /**
251       * Copying of objects using this copy assignment operator is allowed.
252       *
253       * @since 2.0
254       *
255       * @return     The reference of this instance
256       * @param[in]  rhs   An instance of %NetworkInfo
257       */
258         NetworkInfo& operator=(const NetworkInfo& rhs);
259
260 private:
261         _NetworkInfoImpl* __pNetworkInfoImpl;
262
263         friend class _NetworkInfoImpl;
264 }; // NetworkInfo
265
266 }} //Tizen::Telephony
267 #endif // _FTEL_NETWORK_INFO_H_