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 "nsProxyRelease.h"
12 #include "nsIThread.h"
13 #include "nsIRunnable.h"
14 #include "nsCOMArray.h"
15 #include "nsIWifiListener.h"
16 #include "mozilla/ReentrantMonitor.h"
18 #include "nsIObserver.h"
21 #include "mozilla/Attributes.h"
22 #include "nsIInterfaceRequestor.h"
24 #if defined(PR_LOGGING)
25 extern PRLogModuleInfo
*gWifiMonitorLog
;
27 #define LOG(args) PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args)
29 class nsWifiAccessPoint
;
35 nsWifiListener(nsMainThreadPtrHolder
<nsIWifiListener
>* aListener
)
37 mListener
= aListener
;
42 nsMainThreadPtrHandle
<nsIWifiListener
> mListener
;
46 #ifndef MOZ_WIDGET_GONK
47 class nsWifiMonitor MOZ_FINAL
: nsIRunnable
, nsIWifiMonitor
, nsIObserver
50 NS_DECL_THREADSAFE_ISUPPORTS
51 NS_DECL_NSIWIFIMONITOR
62 nsresult
CallWifiListeners(const nsCOMArray
<nsWifiAccessPoint
> &aAccessPoints
,
63 bool aAccessPointsChanged
);
66 nsCOMPtr
<nsIThread
> mThread
;
68 nsTArray
<nsWifiListener
> mListeners
;
70 mozilla::ReentrantMonitor mReentrantMonitor
;
75 class nsWifiMonitor MOZ_FINAL
: nsIWifiMonitor
, nsIWifiScanResultsReady
, nsIObserver
79 NS_DECL_NSIWIFIMONITOR
81 NS_DECL_NSIWIFISCANRESULTSREADY
94 nsCOMArray
<nsWifiAccessPoint
> mLastAccessPoints
;
95 nsTArray
<nsWifiListener
> mListeners
;
96 nsCOMPtr
<nsITimer
> mTimer
;