1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef __nsWifiMonitor__
6 #define __nsWifiMonitor__
8 #include "nsIWifiMonitor.h"
10 #include "nsAutoPtr.h"
11 #include "nsIThread.h"
12 #include "nsIRunnable.h"
13 #include "nsCOMArray.h"
14 #include "nsIWifiMonitor.h"
15 #include "mozilla/ReentrantMonitor.h"
17 #include "nsIObserver.h"
20 #include "mozilla/Attributes.h"
21 #include "nsIInterfaceRequestor.h"
23 #if defined(PR_LOGGING)
24 extern PRLogModuleInfo
*gWifiMonitorLog
;
26 #define LOG(args) PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args)
28 class nsWifiAccessPoint
;
34 nsWifiListener(nsIWifiListener
* aListener
)
36 mListener
= aListener
;
41 nsCOMPtr
<nsIWifiListener
> mListener
;
45 #ifndef MOZ_WIDGET_GONK
46 class nsWifiMonitor MOZ_FINAL
: nsIRunnable
, nsIWifiMonitor
, nsIObserver
50 NS_DECL_NSIWIFIMONITOR
61 #if defined(XP_MACOSX)
62 nsresult
DoScanWithCoreWLAN();
66 nsresult
CallWifiListeners(const nsCOMArray
<nsWifiAccessPoint
> &aAccessPoints
,
67 bool aAccessPointsChanged
);
70 nsCOMPtr
<nsIThread
> mThread
;
72 nsTArray
<nsWifiListener
> mListeners
;
74 mozilla::ReentrantMonitor mReentrantMonitor
;
79 class nsWifiMonitor MOZ_FINAL
: nsIWifiMonitor
, nsIWifiScanResultsReady
, nsIObserver
83 NS_DECL_NSIWIFIMONITOR
85 NS_DECL_NSIWIFISCANRESULTSREADY
98 nsCOMArray
<nsWifiAccessPoint
> mLastAccessPoints
;
99 nsTArray
<nsWifiListener
> mListeners
;
100 nsCOMPtr
<nsITimer
> mTimer
;