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 #include "nsWifiMonitor.h"
6 #include "nsIWifiAccessPoint.h"
9 #include "nsCOMArray.h"
10 #include "mozilla/Attributes.h"
12 #ifndef __nsWifiAccessPoint__
13 #define __nsWifiAccessPoint__
15 class nsWifiAccessPoint MOZ_FINAL
: public nsIWifiAccessPoint
19 NS_DECL_NSIWIFIACCESSPOINT
29 void setSignal(int signal
)
34 void setMacRaw(const char* aString
)
36 memcpy(mMac
, aString
, mozilla::ArrayLength(mMac
));
39 void setMac(const unsigned char mac_as_int
[6])
41 // mac_as_int is big-endian. Write in byte chunks.
42 // Format is XX-XX-XX-XX-XX-XX.
44 const unsigned char holder
[6] = {0};
49 static const char *kMacFormatString
= ("%02x-%02x-%02x-%02x-%02x-%02x");
51 sprintf(mMac
, kMacFormatString
,
52 mac_as_int
[0], mac_as_int
[1], mac_as_int
[2],
53 mac_as_int
[3], mac_as_int
[4], mac_as_int
[5]);
58 void setSSIDRaw(const char* aSSID
, unsigned long len
) {
59 memcpy(mSsid
, aSSID
, mozilla::ArrayLength(mSsid
));
60 mSsidLen
= PR_MIN(len
, mozilla::ArrayLength(mSsid
));
63 void setSSID(const char* aSSID
, unsigned long len
) {
64 if (aSSID
&& (len
< sizeof(mSsid
))) {
65 strncpy(mSsid
, aSSID
, len
);
81 bool AccessPointsEqual(nsCOMArray
<nsWifiAccessPoint
>& a
, nsCOMArray
<nsWifiAccessPoint
>& b
);
82 void ReplaceArray(nsCOMArray
<nsWifiAccessPoint
>& a
, nsCOMArray
<nsWifiAccessPoint
>& b
);