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.
19 * @brief This is the header file for the %SimInfo class.
21 * This header file contains the declarations of the %SimInfo class.
23 #ifndef _FTEL_SIM_INFO_H_
24 #define _FTEL_SIM_INFO_H_
30 namespace Tizen { namespace Telephony
36 * @brief This class provides information of the currently inserted SIM card.
39 * The %SimInfo class provides methods to get information from the SIM card such as MCC, MNC, SPN, ICC ID, the name of operator,
40 * and whether the SIM card is available or not.
42 * The following example demonstrates how to use the %SimInfo class to get the SIM information.
47 * MyClass::GetSimInfo(void)
54 * String operatorName;
56 * SimInfo* pSimInfo = new SimInfo();
58 * result r = pSimInfo->Construct();
65 * mnc = pSimInfo->GetMnc();
66 * mcc = pSimInfo->GetMcc();
67 * spn = pSimInfo->GetSpn();
68 * iccId = pSimInfo->GetIccId();
69 * operatorName = pSimInfo->GetOperatorName();
70 * isAvailable = pSimInfo->IsAvailable();
78 class _OSP_EXPORT_ SimInfo
79 : public Tizen::Base::Object
83 * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
90 * This destructor overrides Tizen::Base::Object::~Object().
94 virtual ~SimInfo(void);
97 * Initializes this instance of %SimInfo.
101 * @return An error code
102 * @exception E_SUCCESS The method is successful.
103 * @exception E_SYSTEM A system error has occurred.
104 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
106 result Construct(void);
109 * Gets the Mobile Network Code (MNC) of the SIM International Mobile Subscriber Identity (IMSI) information.
113 * @privilege %http://tizen.org/privilege/systeminfo
115 * @return The MNC of the SIM card, @n
116 * else @c -1 if the method fails
117 * @exception E_SUCCESS The method is successful.
118 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
119 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
120 * @remarks The specific error code can be accessed using the GetLastResult() method.
122 int GetMnc(void) const;
125 * Gets the Mobile Country Code (MCC) of the SIM IMSI information.
129 * @privilege %http://tizen.org/privilege/systeminfo
131 * @return The MCC of the SIM card, @n
132 * else @c -1 if the method fails
133 * @exception E_SUCCESS The method is successful.
134 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
135 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
136 * @remarks The specific error code can be accessed using the GetLastResult() method.
138 int GetMcc(void) const;
141 * Gets the Service Provider Name (SPN) string of the SIM card.
145 * @privilege %http://tizen.org/privilege/systeminfo
147 * @return The SPN of the SIM card, @n
148 * else an empty string if there is no SIM card in the device, or if an SPN is not assigned to the SIM card
149 * @exception E_SUCCESS The method is successful.
150 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
151 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
152 * @remarks The specific error code can be accessed using the GetLastResult() method.
154 Tizen::Base::String GetSpn(void) const;
157 * Gets the Integrated Circuit Card Identifier (ICCID) of the SIM card. @n
158 * One useful case to detect the change of SIM cards is to store this value and compare it with the most recent value.
159 * This method provides a unique identification number for the SIM card.
163 * @privilege %http://tizen.org/privilege/systeminfo
165 * @return The ICCID of the SIM card, @n
166 * else an empty string if the method fails
167 * @exception E_SUCCESS The method is successful.
168 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
169 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
170 * @remarks The specific error code can be accessed using the GetLastResult() method.
172 Tizen::Base::String GetIccId(void) const;
175 * Gets the operator name of Common PCN Handset Specification (CPHS) of the SIM card.
179 * @privilege %http://tizen.org/privilege/systeminfo
181 * @return The operator name of the SIM card, @n
182 * 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
183 * @exception E_SUCCESS The method is successful.
184 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
185 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
186 * @remarks If this method has failed, then this method returns an empty string.
187 * @remarks The specific error code can be accessed using the GetLastResult() method.
189 Tizen::Base::String GetOperatorName(void) const;
192 * Gets the phone number of the SIM card.
196 * @privilege %http://tizen.org/privilege/systeminfo
198 * @return The phone number of the SIM card, @n
199 * else an empty string if there is no SIM card in the device, or if a Mobile Station International Subscriber Directory Number
200 * (MSISDN) is not assigned to the SIM card
201 * @exception E_SUCCESS The method is successful.
202 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
203 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
204 * @exception E_SYSTEM A system error has occurred.
205 * @remarks The specific error code can be accessed using the GetLastResult() method.
207 Tizen::Base::String GetPhoneNumber(void) const;
211 * Gets the International Mobile Subscriber Identity (IMSI) of the SIM card.
215 * @visibility partner
216 * @privilege %http://tizen.org/privilege/useridentity
218 * @return The IMSI of the SIM card, @n
219 * else an empty string if the method fails
220 * @exception E_SUCCESS The method is successful.
221 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
222 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
223 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
224 * @remarks The specific error code can be accessed using the GetLastResult() method.
227 Tizen::Base::String GetImsi(void) const;
230 * Checks whether a SIM card is present in the device or not.
234 * @privilege %http://tizen.org/privilege/systeminfo
236 * @return @c true if the SIM card is present in the device, @n
238 * @exception E_SUCCESS The method is successful.
239 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
240 * @remarks The specific error code can be accessed using the GetLastResult() method.
242 bool IsAvailable(void) const;
246 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
248 * @param[in] rhs An instance of %SimInfo
250 SimInfo(const SimInfo& rhs);
253 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
255 * @param[in] rhs An instance of %SimInfo
257 SimInfo& operator =(const SimInfo& rhs);
260 _SimInfoImpl* __pSimInfoImpl;
262 friend class _SimInfoImpl;
265 }} // Tizen::Telephony
266 #endif // _FTEL_SIM_INFO_H_