update header for Doxygen
[platform/framework/native/telephony.git] / inc / FTelSimInfo.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        FTelSimInfo.h
19  * @brief       This is the header file for the %SimInfo class.
20  *
21  * This header file contains the declarations of the %SimInfo class.
22  */
23 #ifndef _FTEL_SIM_INFO_H_
24 #define _FTEL_SIM_INFO_H_
25
26
27 #include <FBase.h>
28 #include <FTelTypes.h>
29
30
31 namespace Tizen { namespace Telephony
32 {
33 class _SimInfoImpl;
34
35
36 /**
37  * @class       SimInfo
38  * @brief       This class provides information of the currently inserted SIM card.
39  * @since       2.0
40  *
41  * The %SimInfo class provides methods to get information from the SIM card such as MCC, MNC, SPN, ICC ID, the name of operator,
42  * and whether the SIM card is available or not.
43  *
44  * The following example demonstrates how to use the %SimInfo class to get the SIM information.
45  *
46  * @code
47  *
48  *  #include <FBase.h>
49  *  #include <FTelephony.h>
50  *
51  *   using namespace Tizen::Base;
52  *   using namespace Tizen::Telephony;
53  *
54  *   class MyClass
55  *       : public Object
56  *   {
57  *   public:
58  *       void GetSimInfo(void);
59  *   };
60  *
61  *   void
62  *   MyClass::GetSimInfo(void)
63  *   {
64  *       int mnc;
65  *       int mcc;
66  *       bool isAvailable;
67  *       String spn;
68  *       String iccId;
69  *       String operatorName;
70  *       SimType simType;
71  *
72  *       SimStateManager* pSimStateManager = new (std::nothrow) SimStateManager();
73  *       SimInfo simInfo;
74  *
75  *       result r = pSimStateManager->Construct();
76  *       if (IsFailed(r))
77  *       {
78  *               delete pSimStateManager;
79  *               return;
80  *       }
81  *
82  *       r = pSimStateManager->GetSimInfo(simInfo);
83  *       if (IsFailed(r))
84  *       {
85  *               delete pSimStateManager;
86  *               return;
87  *       }
88  *
89  *       mnc = simInfo.GetMnc();
90  *       mcc = simInfo.GetMcc();
91  *       spn = simInfo.GetSpn();
92  *       iccId = simInfo.GetIccId();
93  *       operatorName = simInfo.GetOperatorName();
94  *       isAvailable = simInfo.IsAvailable();
95  *       simType = simInfo.GetSimType();
96  *
97  *       delete pSimStateManager;
98  *   }
99  *
100  *
101  * @endcode
102  */
103 class _OSP_EXPORT_ SimInfo
104         : public Tizen::Base::Object
105 {
106 public:
107         /**
108          * This is the default constructor for this class.
109          *
110          * @since               2.0
111          */
112         SimInfo(void);
113
114         /**
115          * Copying of objects using this copy constructor is allowed.
116          *
117          * @since       2.1
118          *
119          * @param[in]   rhs   An instance of %SimInfo
120          */
121         SimInfo(const SimInfo& rhs);
122
123         /**
124          * This destructor overrides Tizen::Base::Object::~Object().
125          *
126          * @since       2.0
127          */
128         virtual ~SimInfo(void);
129
130         /**
131          * Initializes this instance of %SimInfo.
132          *
133          * @brief   <i> [Deprecated] </i>
134          * @deprecated  This method is deprecated. Instead of using this method, it is recommended to use the SimStateManager::GetSimInfo() method to get the initialized %SimInfo instance.
135          *
136          * @since               2.0
137          * @feature %http://tizen.org/feature/network.telephony
138          * @return              An error code
139          * @exception   E_SUCCESS       The method is successful.
140          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
141          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
142          * @exception   E_UNSUPPORTED_OPERATION  The Emulator or target device does not support the required feature. @b Since: @b 2.1
143          *                                                                               For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
144          * @remarks     Before calling this method, check whether the feature is supported by 
145          *                      Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&).
146          */
147         result Construct(void);
148
149         /**
150          * Gets the Mobile Network Code (MNC) of the SIM International Mobile Subscriber Identity (IMSI) information.
151          *
152          * @since       2.0
153          *
154          * @privlevel   public
155      * @privilege   %http://tizen.org/privilege/telephony @n
156      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
157          *
158          * @return      The MNC of the SIM card, @n
159          *              else @c -1 if the method fails
160          * @exception   E_SUCCESS       The method is successful.
161          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
162          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
163          * @remarks             The specific error code can be accessed using the GetLastResult() method.
164          */
165         int GetMnc(void) const;
166
167         /**
168          * Gets the Mobile Country Code (MCC) of the SIM IMSI information.
169          *
170          * @since       2.0
171          *
172          * @privlevel   public
173      * @privilege   %http://tizen.org/privilege/telephony @n
174      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
175          *
176          * @return      The MCC of the SIM card, @n
177          *              else @c -1 if the method fails
178          * @exception   E_SUCCESS       The method is successful.
179          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
180          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
181          * @remarks             The specific error code can be accessed using the GetLastResult() method.
182          */
183         int GetMcc(void) const;
184
185         /**
186          * Gets the Service Provider Name (SPN) string of the SIM card.
187          *
188          * @since       2.0
189          *
190          * @privlevel   public
191      * @privilege   %http://tizen.org/privilege/telephony @n
192      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
193          *
194          * @return      The SPN of the SIM card, @n
195          *              else an empty string if there is no SIM card in the device, or if an SPN is not assigned to the SIM card
196          * @exception   E_SUCCESS       The method is successful.
197          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
198          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
199          * @remarks             The specific error code can be accessed using the GetLastResult() method.
200          */
201         Tizen::Base::String GetSpn(void) const;
202
203         /**
204          * Gets the Integrated Circuit Card Identifier (ICCID) of the SIM card. @n
205          * One useful case to detect the change of SIM cards is to store this value and compare it with the most recent value.
206          * The %GetIccId() method provides a unique identification number for the SIM card.
207          *
208          * @since       2.0
209          *
210          * @privlevel   public
211      * @privilege   %http://tizen.org/privilege/telephony @n
212      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
213          *
214          * @return  The ICCID of the SIM card, @n
215          *          else an empty string if the method fails
216          * @exception   E_SUCCESS       The method is successful.
217          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
218          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
219          * @remarks             The specific error code can be accessed using the GetLastResult() method.
220          */
221         Tizen::Base::String GetIccId(void) const;
222
223     /**
224          * Gets the operator name of Common PCN Handset Specification (CPHS) of the SIM card.
225          *
226          * @since       2.0
227          *
228          * @privlevel   public
229      * @privilege   %http://tizen.org/privilege/telephony @n
230      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
231          *
232          * @return      The operator name of the SIM card, @n
233          *              else an empty string if there is no SIM card in the device, or if an operator name is not assigned to the SIM card
234          * @exception   E_SUCCESS       The method is successful.
235          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
236          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
237          * @remarks If this method has failed, then this method returns an empty string.
238          * @remarks             The specific error code can be accessed using the GetLastResult() method.
239          */
240         Tizen::Base::String GetOperatorName(void) const;
241
242         /**
243          * Gets the phone number of the SIM card.
244          *
245          * @since       2.0
246          *
247          * @privlevel   public
248      * @privilege   %http://tizen.org/privilege/telephony @n
249      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
250          *
251          * @return      The phone number of the SIM card, @n
252          *              else an empty string if there is no SIM card in the device, or if a Mobile Station International Subscriber Directory Number
253          *              (MSISDN) is not assigned to the SIM card
254          * @exception   E_SUCCESS    The method is successful.
255          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
256          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
257          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
258          * @remarks             The specific error code can be accessed using the GetLastResult() method.
259          */
260         Tizen::Base::String GetPhoneNumber(void) const;
261
262         /**
263          * Gets the International Mobile Subscriber Identity (IMSI) of the SIM card.
264          *
265          * @since       2.0
266          *
267          * @privlevel  partner
268          * @privilege   %http://tizen.org/privilege/useridentity
269          *
270          * @return      The IMSI of the SIM card, @n
271          *              else an empty string if the method fails
272          * @exception   E_SUCCESS       The method is successful.
273          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
274          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
275          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
276          * @remarks             The specific error code can be accessed using the GetLastResult() method.
277          */
278         Tizen::Base::String GetImsi(void) const;
279
280         /**
281          * Gets the type of SIM card.
282          *
283          * @since       2.1
284          *
285          * @privlevel   public
286          * @privilege   %http://tizen.org/privilege/telephony
287          *
288          * @return              The type of SIM card
289          *
290          * @exception   E_SUCCESS       The method is successful.
291          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
292          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
293          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
294          * @remarks             The specified error code can be accessed using the GetLastResult() method.
295          */
296         SimType GetSimType(void) const;
297
298         /**
299          * Checks whether a SIM card is present in the device or not.
300          *
301          * @since       2.0
302          *
303          * @privlevel   public
304      * @privilege   %http://tizen.org/privilege/telephony @n
305      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
306          *
307          * @return  @c true if the SIM card is present in the device, @n
308          *          else @c false
309          * @exception   E_SUCCESS       The method is successful.
310          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
311          * @remarks             The specific error code can be accessed using the GetLastResult() method.
312          */
313         bool IsAvailable(void) const;
314
315         /**
316          * Copying of objects using this copy assignment operator is allowed.
317          *
318          * @since               2.1
319          *
320          * @param[in]   rhs An instance of %SimInfo
321          */
322         SimInfo& operator =(const SimInfo& rhs);
323
324         /**
325          * Compares the specified instance of %SimInfo with the calling instance.
326          *
327          * @since               2.0
328          *
329          * @return              @c true if the values match, @n
330          *                              else @c false
331          * @param[in]   rhs     The other Tizen::Base::Object to compare
332          * @see                 Tizen::Base::Object::Equals()
333          */
334         virtual bool Equals(const Tizen::Base::Object& rhs) const;
335
336         /**
337          * Gets the hash value of the current instance.
338          *
339          * @since               2.0
340          *
341          * @return      The hash value of the current instance
342          */
343         virtual int GetHashCode(void) const;
344
345 private:
346         _SimInfoImpl* __pSimInfoImpl;
347
348         friend class _SimInfoImpl;
349 }; // SimInfo
350
351 }} // Tizen::Telephony
352
353 #endif // _FTEL_SIM_INFO_H_