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 information of the currently inserted SIM card.
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.
44 * The following example demonstrates how to use the %SimInfo class to get 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
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 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&).
147 result Construct(void);
150 * Gets the Mobile Network Code (MNC) of the SIM International Mobile Subscriber Identity (IMSI) information.
155 * @privilege %http://tizen.org/privilege/telephony @n
156 * (%http://tizen.org/privilege/systeminfo is deprecated.)
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.
165 int GetMnc(void) const;
168 * Gets the Mobile Country Code (MCC) of the SIM IMSI information.
173 * @privilege %http://tizen.org/privilege/telephony @n
174 * (%http://tizen.org/privilege/systeminfo is deprecated.)
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.
183 int GetMcc(void) const;
186 * Gets the Service Provider Name (SPN) string of the SIM card.
191 * @privilege %http://tizen.org/privilege/telephony @n
192 * (%http://tizen.org/privilege/systeminfo is deprecated.)
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.
201 Tizen::Base::String GetSpn(void) const;
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.
211 * @privilege %http://tizen.org/privilege/telephony @n
212 * (%http://tizen.org/privilege/systeminfo is deprecated.)
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.
221 Tizen::Base::String GetIccId(void) const;
224 * Gets the operator name of Common PCN Handset Specification (CPHS) of the SIM card.
229 * @privilege %http://tizen.org/privilege/telephony @n
230 * (%http://tizen.org/privilege/systeminfo is deprecated.)
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.
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 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.
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/useridentity
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.
278 Tizen::Base::String GetImsi(void) const;
281 * Gets the type of SIM card.
286 * @privilege %http://tizen.org/privilege/telephony
288 * @return The type of SIM card
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.
296 SimType GetSimType(void) const;
299 * Checks whether a SIM card is present in the device or not.
304 * @privilege %http://tizen.org/privilege/telephony @n
305 * (%http://tizen.org/privilege/systeminfo is deprecated.)
307 * @return @c true if the SIM card is present in the device, @n
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.
313 bool IsAvailable(void) const;
316 * Copying of objects using this copy assignment operator is allowed.
320 * @param[in] rhs An instance of %SimInfo
322 SimInfo& operator =(const SimInfo& rhs);
325 * Compares the specified instance of %SimInfo with the calling instance.
329 * @return @c true if the values match, @n
331 * @param[in] rhs The other Tizen::Base::Object to compare
332 * @see Tizen::Base::Object::Equals()
334 virtual bool Equals(const Tizen::Base::Object& rhs) const;
337 * Gets the hash value of the current instance.
341 * @return The hash value of the current instance
343 virtual int GetHashCode(void) const;
346 _SimInfoImpl* __pSimInfoImpl;
348 friend class _SimInfoImpl;
351 }} // Tizen::Telephony
353 #endif // _FTEL_SIM_INFO_H_