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 %Tizen::System::SystemInfo::GetValue() methods.
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 due to a missing SIM card.
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 due to a missing SIM card.
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 if an 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 due to a missing SIM card.
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 case 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 due to a missing SIM card.
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 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 if an 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 due to a missing SIM card.
235 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
236 * @remarks If this method has failed, then this method returns an empty string.
237 * @remarks The specific error code can be accessed using the GetLastResult() method.
239 Tizen::Base::String GetOperatorName(void) const;
242 * Gets the phone number of the SIM card.
247 * @privilege %http://tizen.org/privilege/telephony @n
248 * (%http://tizen.org/privilege/systeminfo is deprecated.)
250 * @return The phone number of the SIM card, @n
251 * else an empty string if there is no SIM card in the device, or if a Mobile Station International Subscriber Directory Number
252 * (MSISDN) is not assigned to the SIM card
253 * @exception E_SUCCESS The method is successful.
254 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
255 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
256 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
257 * @remarks The specific error code can be accessed using the GetLastResult() method.
259 Tizen::Base::String GetPhoneNumber(void) const;
262 * Gets the International Mobile Subscriber Identity (IMSI) of the SIM card.
267 * @privilege %http://tizen.org/privilege/useridentity
269 * @return The IMSI of the SIM card, @n
270 * else an empty string if the method fails
271 * @exception E_SUCCESS The method is successful.
272 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
273 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
274 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
275 * @remarks The specific error code can be accessed using the GetLastResult() method.
277 Tizen::Base::String GetImsi(void) const;
280 * Gets the type of SIM card.
285 * @privilege %http://tizen.org/privilege/telephony
287 * @return The type of SIM card
289 * @exception E_SUCCESS The method is successful.
290 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
291 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
292 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
293 * @remarks The specified error code can be accessed using the GetLastResult() method.
295 SimType GetSimType(void) const;
298 * Checks whether a SIM card is present in the device or not.
303 * @privilege %http://tizen.org/privilege/telephony @n
304 * (%http://tizen.org/privilege/systeminfo is deprecated.)
306 * @return @c true if the SIM card is present in the device, @n
308 * @exception E_SUCCESS The method is successful.
309 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
310 * @remarks The specific error code can be accessed using the GetLastResult() method.
312 bool IsAvailable(void) const;
315 * Copying of objects using this copy assignment operator is allowed.
319 * @param[in] rhs An instance of %SimInfo
321 SimInfo& operator =(const SimInfo& rhs);
324 * Compares the specified instance of %SimInfo with the calling instance.
328 * @return @c true if the values match, @n
330 * @param[in] rhs The other Tizen::Base::Object to compare
331 * @see Tizen::Base::Object::Equals()
333 virtual bool Equals(const Tizen::Base::Object& rhs) const;
336 * Gets the hash value of the current instance.
340 * @return The hash value of the current instance
342 virtual int GetHashCode(void) const;
345 _SimInfoImpl* __pSimInfoImpl;
347 friend class _SimInfoImpl;
350 }} // Tizen::Telephony
352 #endif // _FTEL_SIM_INFO_H_