Modified to use wifi_direct_disconnect() instead of wifi_direct_disconnect_all()...
[platform/framework/native/net.git] / src / inc / FNetWifi_WifiManagerImpl.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        FNetWifi_WifiManagerImpl.h
19  * @brief       This is the header file for the _WifiManagerImpl Class.
20  * @version     3.0
21  *
22  * This header file contains declaration of the _WifiManagerImpl Class.
23  */
24
25 #ifndef _FNET_WIFI_INTERNAL_WIFI_MANAGER_IMPL_H_
26 #define _FNET_WIFI_INTERNAL_WIFI_MANAGER_IMPL_H_
27
28 #include <FOspConfig.h>
29 #include <FBaseObject.h>
30 #include <FNetWifiWifiTypes.h>
31 #include "FNetWifi_IWifiManagerEventListener.h"
32
33 namespace Tizen { namespace Net { namespace Wifi
34 {
35
36 class WifiBssInfo;
37 class WifiManager;
38 class IWifiManagerEventListener;
39 class IWifiSystemMonitoringEventListener;
40 class _WifiSystemAdapter;
41 class _WifiManagerEvent;
42 class _WifiSystemMonitoringEvent;
43
44 /**
45  * @class   _WifiManagerImpl
46  * @brief   This class provides methods for the local Wi-Fi device management.
47  * @since   1.0
48  *
49  * _WifiManagerImpl class provides the functionality for creating a _WifiManagerImpl instance, and
50  * managing local Wifi devices. It also allows the listener to get events from local Wifi devices.
51  */
52 class _OSP_EXPORT_ _WifiManagerImpl
53         : public Tizen::Base::Object
54         , public _IWifiManagerEventListener
55 {
56
57 public:
58     /**
59      * This is the default constructor for this class.
60      *
61      * @remarks     After creating an instance of this class, you must explicitly call
62      *              the construction method to initialize the instance.
63      * @see Construct()
64      */
65     _WifiManagerImpl(void);
66
67     /**
68      *  This is the copy constructor for this class. Do @b not use directly.
69      *
70      * @param[in]   value   An instance of %_WifiManagerImpl
71      */
72     _WifiManagerImpl(const _WifiManagerImpl& value);
73
74     /**
75      *This destructor overrides Tizen::Base::Object::~Object().
76      */
77     virtual ~_WifiManagerImpl(void);
78
79     /**
80      * @see WifiManager::Construct()
81      */
82      result Construct(IWifiManagerEventListener& listener);
83
84     /**
85      * @see WifiManager::Activate()
86      */
87     result Activate(void);
88
89     /**
90      * @see WifiManager::Deactivate()
91      */
92     result Deactivate(void);
93
94     /**
95      * @see WifiManager::GetPowerStatus()
96      */
97     WifiPowerStatus GetPowerStatus(void) const;
98
99     /**
100      * @see WifiManager::GetMacAddress()
101      */
102     Tizen::Base::String GetMacAddress(void) const;
103
104     /**
105      * @see WifiManager::IsActivated()
106      */
107     bool IsActivated(void) const;
108
109     /**
110      * @see WifiManager::IsConnected()
111      */
112     bool IsConnected(void) const;
113
114     /**
115      * @see WifiManager::Scan()
116      */
117     result Scan(void);
118
119     /**
120      * @see WifiManager::Connect()
121      */
122     result Connect(const WifiBssInfo& targetApInfo);
123
124     /**
125      * @see WifiManager::SetWifiSystemScanMode()
126      */
127     result SetWifiSystemScanMode(WifiSystemScanMode mode);
128
129     /**
130      * @see WifiManager::AddSystemMonitoringEventListener()
131      */
132     result AddSystemMonitoringEventListener(IWifiSystemMonitoringEventListener& listener);
133
134     /**
135      * @see WifiManager::RemoveSystemMonitoringEventListener()
136      */
137     result RemoveSystemMonitoringEventListener(IWifiSystemMonitoringEventListener& listener);
138
139     /**
140      * @see WifiManager::GetConnectionState()
141      */
142     WifiConnectionState GetConnectionState(void) const;
143
144     /**
145      * @see WifiManager::GetConnectionTargetInfoN()
146      */
147     WifiBssInfo* GetConnectionTargetInfoN(void) const;
148
149     /**
150      * @see WifiManager::UpdateBssInfo()
151      */
152     result UpdateBssInfo(const WifiBssInfo& bssInfo);
153
154     /**
155      * @see WifiManager::GetSystemScanResultN()
156      */
157     Tizen::Base::Collection::IList* GetSystemScanResultN(void) const;
158
159     /**
160      * @see IWifiManagerEventListener::OnWifiActivated()
161      */
162     virtual void OnWifiActivated(result r);
163
164     /**
165      * @see IWifiManagerEventListener::OnWifiDeactivated()
166      */
167     virtual void OnWifiDeactivated(result r);
168
169     /**
170      * @see IWifiManagerEventListener::OnWifiConnected()
171      */
172     virtual void OnWifiConnected(const Tizen::Base::String& ssid, result r);
173
174     /**
175      * @see IWifiManagerEventListener::OnWifiDisconnected()
176      */
177     virtual void OnWifiDisconnected(void);
178
179     /**
180      * @see IWifiManagerEventListener::OnWifiRssiChanged()
181      */
182     virtual void OnWifiRssiChanged(long rssi);
183
184     /**
185      * @see IWifiManagerEventListener::OnWifiScanCompletedN()
186      */
187     virtual void OnWifiScanCompleted(Tizen::Base::Collection::IList* pWifiBssInfoList, result r);
188
189     /**
190      * @see IWifiSystemMonitoringEventListener::OnWOnWifiConnectionStateChanged()
191      */
192     virtual void OnWifiConnectionStateChanged(WifiConnectionState state);
193
194     /**
195      * @see IWifiSystemMonitoringEventListener::OnWifiSystemScanResultUpdated()
196      */
197     virtual void OnWifiSystemScanResultUpdated(void);
198
199     /**
200      * Gets the Impl instance.
201      *
202      * @return  The pointer to %_WifiManagerImpl
203      * @param[in]   wifiManager   An instance of %WifiManager
204      */
205     static _WifiManagerImpl* GetInstance(WifiManager& wifiManager);
206
207     /**
208      * Gets the Impl instance.
209      *
210      * @return  The pointer to %_WifiManagerImpl
211      * @param[in]   wifiManager   An instance of %WifiManager
212      */
213     static const _WifiManagerImpl* GetInstance(const WifiManager& wifiManager);
214     
215     /**
216      * @see WifiManager::operator=()
217      */
218     _WifiManagerImpl& operator=(const _WifiManagerImpl& rhs);
219
220 private:
221     enum _WifiManagerState
222     {
223             WIFI_MANAGER_DEACTIVATED,
224             WIFI_MANAGER_ACTIVATING,
225             WIFI_MANAGER_DEACTIVATING,
226             WIFI_MANAGER_ACTIVATED,
227             WIFI_MANAGER_CONNECTING,
228             WIFI_MANAGER_CONNECTED,
229             WIFI_MANAGER_DISCONNECTING
230     };
231     enum _WifiScanState
232     {
233             WIFI_SCAN_IDLE,
234             WIFI_SCAN_SCANNING,
235             WIFI_SCAN_CANCELLING
236     };
237
238     /**
239      * Return character string of current wifi status
240      */
241     const char* GetStringOfCurrentState(void) const;
242
243     /**
244      * Return character string of current scan status
245      */
246     const char* GetStringOfCurrentScanState(void) const;
247
248     /**
249      * Return character string of current connection state
250      */
251     const char* GetStringOfConnectionState(WifiConnectionState state) const;
252
253 private:
254     _WifiSystemAdapter* __pWifiSystemAdapter;
255     std::unique_ptr<_WifiManagerEvent> __pMgrEvent;
256     std::unique_ptr<_WifiSystemMonitoringEvent> __pMonitoringEvent;
257     WifiBssInfo* __pTargetApInfo;
258     Tizen::Base::Runtime::Mutex __stateMutex;
259     _WifiManagerState __currentState;
260     _WifiScanState __currentScanState;
261
262 }; // _WifiManagerImpl
263
264 } } } // Tizen::Net::Wifi
265
266 #endif // _FNET_WIFI_INTERNAL_WIFI_MANAGER_IMPL_H_