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_
28 #include <FTelTypes.h>
31 namespace Tizen { namespace Telephony
38 * @brief This class provides the information of a currently inserted SIM card.
41 * The %SimInfo class provides methods to obtain SIM card information, such as the MCC, the MNC, the SPN, the ICC ID, the name of the operator,
42 * and whether the SIM card is available or not.
44 * The following example demonstrates how to use the %SimInfo class to obtain the SIM information.
49 * #include <FTelephony.h>
51 * using namespace Tizen::Base;
52 * using namespace Tizen::Telephony;
58 * void GetSimInfo(void);
62 * MyClass::GetSimInfo(void)
69 * String operatorName;
72 * SimStateManager* pSimStateManager = new (std::nothrow) SimStateManager();
75 * result r = pSimStateManager->Construct();
78 * delete pSimStateManager;
82 * r = pSimStateManager->GetSimInfo(simInfo);
85 * delete pSimStateManager;
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();
97 * delete pSimStateManager;
103 class _OSP_EXPORT_ SimInfo
104 : public Tizen::Base::Object
108 * This is the default constructor for this class.
115 * Copying of objects using this copy constructor is allowed.
119 * @param[in] rhs An instance of %SimInfo to copy
121 SimInfo(const SimInfo& rhs);
124 * This destructor overrides Tizen::Base::Object::~Object().
128 virtual ~SimInfo(void);
131 * Initializes this instance of %SimInfo.
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.
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 because the SIM card is not ready.
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 Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&).
146 result Construct(void);
149 * Gets the Mobile Network Code (MNC) of the SIM International Mobile Subscriber Identity (IMSI) information.
154 * @privilege %http://tizen.org/privilege/telephony @n
155 * (%http://tizen.org/privilege/systeminfo is deprecated.)
157 * @return The MNC of the SIM card, @n
158 * else @c -1 if the method fails
159 * @exception E_SUCCESS The method is successful.
160 * @exception E_DEVICE_UNAVAILABLE The operation has failed because the SIM card is missing.
161 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
162 * @remarks The specific error code can be accessed using the GetLastResult() method.
164 int GetMnc(void) const;
167 * Gets the Mobile Country Code (MCC) of the SIM IMSI information.
172 * @privilege %http://tizen.org/privilege/telephony @n
173 * (%http://tizen.org/privilege/systeminfo is deprecated.)
175 * @return The MCC of the SIM card, @n
176 * else @c -1 if the method fails
177 * @exception E_SUCCESS The method is successful.
178 * @exception E_DEVICE_UNAVAILABLE The operation has failed because the SIM card is missing.
179 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
180 * @remarks The specific error code can be accessed using the GetLastResult() method.
182 int GetMcc(void) const;
185 * Gets the Service Provider Name (SPN) string of the SIM card.
190 * @privilege %http://tizen.org/privilege/telephony @n
191 * (%http://tizen.org/privilege/systeminfo is deprecated.)
193 * @return The SPN of the SIM card, @n
194 * else an empty string if there is no SIM card in the device, or the SPN is not assigned to the SIM card
195 * @exception E_SUCCESS The method is successful.
196 * @exception E_DEVICE_UNAVAILABLE The operation has failed because the SIM card is missing.
197 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
198 * @remarks The specific error code can be accessed using the GetLastResult() method.
200 Tizen::Base::String GetSpn(void) const;
203 * Gets the Integrated Circuit Card Identifier (ICCID) of the SIM card. @n
204 * One useful way to detect the change of SIM cards is to store this value and compare it with the most recent value.
205 * The %GetIccId() method provides a unique identification number for the SIM card.
210 * @privilege %http://tizen.org/privilege/telephony @n
211 * (%http://tizen.org/privilege/systeminfo is deprecated.)
213 * @return The ICCID of the SIM card, @n
214 * else an empty string if the method fails
215 * @exception E_SUCCESS The method is successful.
216 * @exception E_DEVICE_UNAVAILABLE The operation has failed because the SIM card is missing.
217 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
218 * @remarks The specific error code can be accessed using the GetLastResult() method.
220 Tizen::Base::String GetIccId(void) const;
223 * Gets the operator name of the Common PCN Handset Specification (CPHS) of the SIM card.
228 * @privilege %http://tizen.org/privilege/telephony @n
229 * (%http://tizen.org/privilege/systeminfo is deprecated.)
231 * @return The operator name of the SIM card, @n
232 * else an empty string if there is no SIM card in the device, or the operator name is not assigned to the SIM card
233 * @exception E_SUCCESS The method is successful.
234 * @exception E_DEVICE_UNAVAILABLE The operation has failed because the SIM card is missing.
235 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
237 * - If this method fails, then an empty string is returned.
238 * - The specific error code can be accessed using the GetLastResult() method.
240 Tizen::Base::String GetOperatorName(void) const;
243 * Gets the phone number of the SIM card.
248 * @privilege %http://tizen.org/privilege/telephony @n
249 * (%http://tizen.org/privilege/systeminfo is deprecated.)
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 the 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 because the SIM card is missing
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.
260 Tizen::Base::String GetPhoneNumber(void) const;
263 * Gets the International Mobile Subscriber Identity (IMSI) of the SIM card.
268 * @privilege %http://tizen.org/privilege/systemmanager @n
269 * (%http://tizen.org/privilege/useridentity is deprecated.)
271 * @return The IMSI of the SIM card, @n
272 * else an empty string if the method fails
273 * @exception E_SUCCESS The method is successful.
274 * @exception E_DEVICE_UNAVAILABLE The operation has failed because the SIM card is missing
275 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
276 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
277 * @remarks The specific error code can be accessed using the GetLastResult() method.
279 Tizen::Base::String GetImsi(void) const;
282 * Gets the SIM card type.
287 * @privilege %http://tizen.org/privilege/telephony
289 * @return The SIM card type
291 * @exception E_SUCCESS The method is successful.
292 * @exception E_DEVICE_UNAVAILABLE The operation has failed because the SIM card is missing
293 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
294 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
295 * @remarks The specified error code can be accessed using the GetLastResult() method.
297 SimType GetSimType(void) const;
300 * Checks whether the SIM card is present in the device or not.
305 * @privilege %http://tizen.org/privilege/telephony @n
306 * (%http://tizen.org/privilege/systeminfo is deprecated.)
308 * @return @c true if the SIM card is present in the device, @n
310 * @exception E_SUCCESS The method is successful.
311 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
312 * @remarks The specific error code can be accessed using the GetLastResult() method.
314 bool IsAvailable(void) const;
317 * Copying of objects using this copy assignment operator is allowed.
321 * @param[in] rhs An instance of %SimInfo to copy
323 SimInfo& operator =(const SimInfo& rhs);
326 * Compares the specified instance of %SimInfo with the current instance.
330 * @return @c true if the values match, @n
332 * @param[in] rhs The Tizen::Base::Object to compare
333 * @see Tizen::Base::Object::Equals()
335 virtual bool Equals(const Tizen::Base::Object& rhs) const;
338 * Gets the hash value of the current instance.
342 * @return The hash value of the current instance
344 virtual int GetHashCode(void) const;
347 _SimInfoImpl* __pSimInfoImpl;
349 friend class _SimInfoImpl;
352 }} // Tizen::Telephony
354 #endif // _FTEL_SIM_INFO_H_