1b41b919a13045b1019a0d655444811342d48708
[platform/framework/native/telephony.git] / inc / FTelSimStateManager.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        FTelSimStateManager.h
19  * @brief       This is the header file for the %SimStateManager class.
20  *
21  * This header file contains the declarations of the %SimStateManager class.
22  */
23 #ifndef _FTEL_SIM_STATE_MANAGER_H_
24 #define _FTEL_SIM_STATE_MANAGER_H_
25
26
27 #include <FBase.h>
28 #include <FTelTypes.h>
29 #include <FTelSimInfo.h>
30 #include <FTelITelephonySimEventListener.h>
31 #include <FTelISimStateManagerGetPinLockSettingResultListener.h>
32
33
34 namespace Tizen { namespace Telephony
35 {
36 class _SimStateManagerImpl;
37
38 /**
39  * @class       SimStateManager
40  * @brief       This class provides methods to obtain information and events about the SIM card.
41  * @since       2.1
42  *
43  * The %SimStateManager class provides methods to obtain information and events about the SIM card.
44  *
45  * @code
46  *
47  *  #include <FBase.h>
48  *  #include <FTelephony.h>
49  *
50  *  using namespace Tizen::Base;
51  *  using namespace Tizen::Telephony;
52  *
53  *  class MyClass
54  *      : public Object
55  *      , public ITelephonySimEventListener
56  *  {
57  *    public:
58  *      MyClass(void) {}
59  *      ~MyClass(void) {}
60  *
61  *   // ITelephonySimEventListener
62  *       void OnTelephonySimStateChanged(SimState state);
63  *
64  *   void GetSimState (void);
65  * };
66  *
67  *  void
68  *  MyClass::OnTelephonySimStateChanged(SimState state)
69  *  {
70  *              //Do Something.
71  *  }
72  *
73  *  void
74  *  MyClass::GetSimState(void)
75  *  {
76  *      SimStateManager* pSimStateManager = new (std::nothrow) SimStateManager();
77  *      SimInfo simInfo;
78  *      SimState simState = SIM_STATE_UNKNOWN;
79  *
80  *      result r = pSimStateManager->Construct();
81  *      if (IsFailed(r))
82  *      {
83  *              delete pSimStateManager;
84  *              return;
85  *      }
86  *
87  *      r = pSimStateManager->SetSimEventListener(this);
88  *      if (IsFailed(r))
89  *      {
90  *              delete pSimStateManager;
91  *              return;
92  *      }
93  *
94  *      r = pSimStateManager->GetSimInfo(simInfo);
95  *      if (IsFailed(r))
96  *      {
97  *              delete pSimStateManager;
98  *              return;
99  *      }
100  *
101  *      simState = pSimStateManager->GetSimState();
102  *              delete pSimStateManager;
103  *  }
104  *
105  *
106  * @endcode
107  */
108 class _OSP_EXPORT_ SimStateManager
109         : public Tizen::Base::Object
110 {
111 public:
112         /**
113          * 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.
114          *
115          * @since       2.1
116          */
117         SimStateManager(void);
118
119         /**
120          * This destructor overrides Tizen::Base::Object::~Object().
121          *
122          * @since       2.1
123          */
124         virtual ~SimStateManager(void);
125
126         /**
127          * Initializes this instance of %SimStateManager.
128          *
129          * @since       2.1
130          * @feature %http://tizen.org/feature/network.telephony
131          * @return      An error code
132          *
133          * @exception   E_SUCCESS                               The method is successful.
134          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
135          * @exception   E_UNSUPPORTED_OPERATION  The Emulator or target device does not support the required feature.
136          *                                                                               For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
137          * @remarks     Before calling this method, check whether the feature is supported by 
138          *                      Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&).
139          */
140         result Construct(void);
141
142         /**
143          * Sets the listener for receiving SIM-related events.
144          *
145          * @since   2.1
146          *
147          * @privlevel   public
148          * @privilege   %http://tizen.org/privilege/telephony
149          *
150          * @return  An error code
151          *
152          * @param[in]   pListener                               An ITelephonySimEventListener instance @n
153          *                                                                              The parameter can be set to @c null to remove listener.
154          *
155          * @exception   E_SUCCESS                               The method is successful.
156          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
157          * @exception   E_INVALID_OPERATION             The current state of the instance prohibits the execution of the specified operation, @n
158          *                                                                              because the caller thread is a worker thread.
159          */
160         result SetSimEventListener(ITelephonySimEventListener* pListener);
161
162         /**
163          * Requests for the PIN lock setting information. @n
164          * The %GetPinLockSetting() method is asynchronous.
165          *
166          * @since   2.1
167          *
168          * @privlevel   public
169          * @privilege   %http://tizen.org/privilege/telephony
170          *
171          * @return  An error code
172          *
173          * @param[in]   pListener                               An ISimStateManagerGetPinLockSettingResultListener instance
174          * @exception   E_SUCCESS                               The method is successful.
175          * @exception   E_INVALID_ARG                   The specified @c pListener must not be @c null.
176          * @exception   E_IN_PROGRESS                   The previous request is in progress.
177          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
178          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
179          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
180          * @see ISimStateManagerGetPinLockSettingResultListener::OnSimStateManagerGetPinLockSettingResultReceived()
181          */
182         result GetPinLockSetting(ISimStateManagerGetPinLockSettingResultListener* pListener);
183
184         /**
185          * Gets the current state of SIM card.
186          *
187          * @since   2.1
188          *
189          * @privlevel   public
190          * @privilege   %http://tizen.org/privilege/telephony
191          *
192          * @return      The state of SIM card, @n
193          *                              else @c SIM_STATE_UNKNOWN if the method fails
194          *
195          * @exception   E_SUCCESS                               The method is successful.
196          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
197          */
198         SimState GetSimState(void) const;
199
200         /**
201          * Gets the SIM card information.
202          *
203          * @since   2.1
204          *
205          * @privlevel   public
206          * @privilege   %http://tizen.org/privilege/telephony
207          *
208          * @return  An error code
209          *
210          * @param[out]  simInfo                                 The SIM card information
211          * @exception   E_SUCCESS                               The method is successful.
212          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
213          * @exception   E_DEVICE_UNAVAILABLE    The operation has failed due to a missing SIM card.
214          */
215         result GetSimInfo(SimInfo& simInfo) const;
216
217 private:
218         //
219         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
220         //
221         // @param[in]   rhs   An instance of %SimStateManager
222         //
223         SimStateManager(const SimStateManager& rhs);
224
225         //
226         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
227         //
228         // @param[in]   rhs An instance of %SimStateManager
229         //
230         SimStateManager& operator =(const SimStateManager& rhs);
231
232 private:
233         _SimStateManagerImpl* __pSimStateManagerImpl;
234
235         friend class _SimStateManagerImpl;
236 }; // SimStateManager
237
238 }} // Tizen::Telephony
239
240 #endif // _FTEL_SIM_STATE_MANAGER_H_