1b6f9ca2ebc733d312fc93fe84919df483b56c4b
[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 SimManager::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          */
127         result Construct(void);
128
129         /**
130          * Gets the Mobile Network Code (MNC) of the SIM International Mobile Subscriber Identity (IMSI) information.
131          *
132          * @since       2.0
133          *
134          * @privlevel   public
135          * @privilege   http://tizen.org/privilege/telephony
136          *
137          * @return      The MNC of the SIM card, @n
138          *              else @c -1 if the method fails
139          * @exception   E_SUCCESS       The method is successful.
140          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
141          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
142          * @remarks             The specific error code can be accessed using the GetLastResult() method.
143          */
144         int GetMnc(void) const;
145
146         /**
147          * Gets the Mobile Country Code (MCC) of the SIM IMSI information.
148          *
149          * @since       2.0
150          *
151          * @privlevel   public
152          * @privilege   http://tizen.org/privilege/telephony
153          *
154          * @return      The MCC of the SIM card, @n
155          *              else @c -1 if the method fails
156          * @exception   E_SUCCESS       The method is successful.
157          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
158          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
159          * @remarks             The specific error code can be accessed using the GetLastResult() method.
160          */
161         int GetMcc(void) const;
162
163         /**
164          * Gets the Service Provider Name (SPN) string of the SIM card.
165          *
166          * @since       2.0
167          *
168          * @privlevel   public
169          * @privilege   http://tizen.org/privilege/telephony
170          *
171          * @return      The SPN of the SIM card, @n
172          *              else an empty string if there is no SIM card in the device, or if an SPN is not assigned to the SIM card
173          * @exception   E_SUCCESS       The method is successful.
174          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
175          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
176          * @remarks             The specific error code can be accessed using the GetLastResult() method.
177          */
178         Tizen::Base::String GetSpn(void) const;
179
180         /**
181          * Gets the Integrated Circuit Card Identifier (ICCID) of the SIM card. @n
182          * One useful case to detect the change of SIM cards is to store this value and compare it with the most recent value.
183          * This method provides a unique identification number for the SIM card.
184          *
185          * @since       2.0
186          *
187          * @privlevel   public
188          * @privilege   http://tizen.org/privilege/telephony
189          *
190          * @return  The ICCID of the SIM card, @n
191          *          else an empty string if the method fails
192          * @exception   E_SUCCESS       The method is successful.
193          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
194          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
195          * @remarks             The specific error code can be accessed using the GetLastResult() method.
196          */
197         Tizen::Base::String GetIccId(void) const;
198
199     /**
200          * Gets the operator name of Common PCN Handset Specification (CPHS) of the SIM card.
201          *
202          * @since       2.0
203          *
204          * @privlevel   public
205          * @privilege   http://tizen.org/privilege/telephony
206          *
207          * @return      The operator name of the SIM card, @n
208          *              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
209          * @exception   E_SUCCESS       The method is successful.
210          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
211          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
212          * @remarks If this method has failed, then this method returns an empty string.
213          * @remarks             The specific error code can be accessed using the GetLastResult() method.
214          */
215         Tizen::Base::String GetOperatorName(void) const;
216
217         /**
218          * Gets the phone number of the SIM card.
219          *
220          * @since       2.0
221          *
222          * @privlevel   public
223          * @privilege   http://tizen.org/privilege/telephony
224          *
225          * @return      The phone number of the SIM card, @n
226          *              else an empty string if there is no SIM card in the device, or if a Mobile Station International Subscriber Directory Number
227          *              (MSISDN) is not assigned to the SIM card
228          * @exception   E_SUCCESS    The method is successful.
229          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
230          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
231          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
232          * @remarks             The specific error code can be accessed using the GetLastResult() method.
233          */
234         Tizen::Base::String GetPhoneNumber(void) const;
235
236         /**
237          * Gets the International Mobile Subscriber Identity (IMSI) of the SIM card.
238          *
239          * @since       2.0
240          *
241          * @privlevel  partner
242          * @privilege   http://tizen.org/privilege/useridentity
243          *
244          * @return      The IMSI of the SIM card, @n
245          *              else an empty string if the method fails
246          * @exception   E_SUCCESS       The method is successful.
247          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
248          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
249          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
250          * @remarks             The specific error code can be accessed using the GetLastResult() method.
251          */
252         Tizen::Base::String GetImsi(void) const;
253
254         /**
255          * Gets the type of SIM card.
256          *
257          * @since       2.1
258          *
259          * @privlevel   public
260          * @privilege   http://tizen.org/privilege/telephony
261          *
262          * @return              The type of SIM card
263          *
264          * @exception   E_SUCCESS       The method is successful.
265          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
266          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
267          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
268          * @remarks             The specified error code can be accessed using the GetLastResult() method.
269          */
270         SimType GetSimType(void) const;
271
272         /**
273          * Checks whether a SIM card is present in the device or not.
274          *
275          * @since       2.0
276          *
277          * @privlevel   public
278          * @privilege   http://tizen.org/privilege/telephony
279          *
280          * @return  @c true if the SIM card is present in the device, @n
281          *          else @c false
282          * @exception   E_SUCCESS       The method is successful.
283          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
284          * @remarks             The specific error code can be accessed using the GetLastResult() method.
285          */
286         bool IsAvailable(void) const;
287
288         /**
289          * Copying of objects using this copy assignment operator is allowed.
290          *
291          * @since               2.1
292          *
293          * @param[in]   rhs An instance of %SimInfo
294          */
295         SimInfo& operator =(const SimInfo& rhs);
296
297         /**
298          * Compares the specified instance of %SimInfo with the calling instance.
299          *
300          * @since               2.0
301          *
302          * @return              @c true if the values match, @n
303          *                              else @c false
304          * @param[in]   rhs     The other Object to be compared
305          * @see                 Object::Equals()
306          */
307         virtual bool Equals(const Tizen::Base::Object& rhs) const;
308
309         /**
310          * Gets the hash value of the current instance.
311          *
312          * @since               2.0
313          *
314          * @return      The current instance's hash value
315          */
316         virtual int GetHashCode(void) const;
317
318 private:
319         _SimInfoImpl* __pSimInfoImpl;
320
321         friend class _SimInfoImpl;
322 }; // SimInfo
323
324 }} // Tizen::Telephony
325
326 #endif // _FTEL_SIM_INFO_H_