Bug 853360 - Implement the coneGain part of the AudioPannerNode. r=roc
[gecko.git] / netwerk / wifi / nsWifiAccessPoint.h
blob07c10fc3ce67c7293be5cf4d98afbbfc271950da
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"
8 #include "nsString.h"
9 #include "nsCOMArray.h"
10 #include "mozilla/Attributes.h"
12 #ifndef __nsWifiAccessPoint__
13 #define __nsWifiAccessPoint__
15 class nsWifiAccessPoint MOZ_FINAL : public nsIWifiAccessPoint
17 public:
18 NS_DECL_ISUPPORTS
19 NS_DECL_NSIWIFIACCESSPOINT
21 nsWifiAccessPoint();
22 ~nsWifiAccessPoint();
24 char mMac[18];
25 int mSignal;
26 char mSsid[33];
27 int mSsidLen;
29 void setSignal(int signal)
31 mSignal = 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};
45 if (!mac_as_int) {
46 mac_as_int = holder;
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]);
55 mMac[17] = 0;
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);
66 mSsid[len] = 0;
67 mSsidLen = len;
69 else
71 mSsid[0] = 0;
72 mSsidLen = 0;
79 // Helper functions
81 bool AccessPointsEqual(nsCOMArray<nsWifiAccessPoint>& a, nsCOMArray<nsWifiAccessPoint>& b);
82 void ReplaceArray(nsCOMArray<nsWifiAccessPoint>& a, nsCOMArray<nsWifiAccessPoint>& b);
85 #endif