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