LCOV - app.info - netwerk/wifi/nsWifiAccessPoint.h

LCOV - code coverage report
| Current view: | directory - netwerk/wifi - nsWifiAccessPoint.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 19 | 0 | 0.0 %
| Date: | 2012-04-21 | Functions: | 3 | 0 | 0.0 %

           1                 : /* ***** BEGIN LICENSE BLOCK *****
           2                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           3                 :  *
           4                 :  * The contents of this file are subject to the Mozilla Public License Version
           5                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           6                 :  * the License. You may obtain a copy of the License at
           7                 :  * http://www.mozilla.org/MPL/
           8                 :  *
           9                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          10                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          11                 :  * for the specific language governing rights and limitations under the
          12                 :  * License.
          13                 :  *
          14                 :  * The Original Code is Geolocation.
          15                 :  *
          16                 :  * The Initial Developer of the Original Code is Mozilla Foundation
          17                 :  * Portions created by the Initial Developer are Copyright (C) 2008
          18                 :  * the Initial Developer. All Rights Reserved.
          19                 :  *
          20                 :  * This is a derivative of work done by Google under a BSD style License.
          21                 :  * See: http://gears.googlecode.com/svn/trunk/gears/geolocation/
          22                 :  *
          23                 :  * Contributor(s):
          24                 :  *  Doug Turner <dougt@meer.net>  (Original Author)
          25                 :  *
          26                 :  * Alternatively, the contents of this file may be used under the terms of
          27                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
          28                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          30                 :  * of those above. If you wish to allow use of your version of this file only
          31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          32                 :  * use your version of this file under the terms of the MPL, indicate your
          33                 :  * decision by deleting the provisions above and replace them with the notice
          34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          35                 :  * the provisions above, a recipient may use your version of this file under
          36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          37                 :  *
          38                 :  * ***** END LICENSE BLOCK ***** */
          39                 :
          40                 : #include "nsWifiMonitor.h"
          41                 : #include "nsIWifiAccessPoint.h"
          42                 :
          43                 : #include "nsString.h"
          44                 : #include "nsCOMArray.h"
          45                 :
          46                 : #ifndef __nsWifiAccessPoint__
          47                 : #define __nsWifiAccessPoint__
          48                 :
          49                 : class nsWifiAccessPoint : public nsIWifiAccessPoint
          50                 : {
          51                 : public:
          52                 :   NS_DECL_ISUPPORTS
          53                 :   NS_DECL_NSIWIFIACCESSPOINT
          54                 :
          55                 :   nsWifiAccessPoint();
          56                 :   ~nsWifiAccessPoint();
          57                 :
          58                 :   char mMac[18];
          59                 :   int  mSignal;
          60                 :   char mSsid[33];
          61                 :   int  mSsidLen;
          62                 :
          63               0 :   void setSignal(int signal)
          64                 :   {
          65               0 :     mSignal = signal;
          66               0 :   };
          67                 :
          68               0 :   void setMac(const unsigned char mac_as_int[6])
          69                 :   {
          70                 :     // mac_as_int is big-endian. Write in byte chunks.
          71                 :     // Format is XX-XX-XX-XX-XX-XX.
          72                 :
          73               0 :     const unsigned char holder[6] = {0};
          74               0 :     if (!mac_as_int) {
          75               0 :       mac_as_int = holder;
          76                 :     }
          77                 :
          78                 :     static const char *kMacFormatString = ("%02x-%02x-%02x-%02x-%02x-%02x");
          79                 :
          80                 :     sprintf(mMac, kMacFormatString,
          81               0 :             mac_as_int[0], mac_as_int[1], mac_as_int[2],
          82               0 :             mac_as_int[3], mac_as_int[4], mac_as_int[5]);
          83                 :
          84               0 :     mMac[17] = 0;
          85               0 :   };
          86                 :
          87               0 :   void setSSID(const char* aSSID, unsigned long len) {
          88               0 :     if (aSSID && (len < sizeof(mSsid))) {
          89               0 :         strncpy(mSsid, aSSID, len);
          90               0 :         mSsid[len] = 0;
          91               0 :         mSsidLen = len;
          92                 :     }
          93                 :     else
          94                 :     {
          95               0 :       mSsid[0] = 0;
          96               0 :       mSsidLen = 0;
          97                 :     }
          98               0 :   };
          99                 : };
         100                 :
         101                 :
         102                 :
         103                 : // Helper functions
         104                 :
         105                 : bool AccessPointsEqual(nsCOMArray<nsWifiAccessPoint>& a, nsCOMArray<nsWifiAccessPoint>& b);
         106                 : void ReplaceArray(nsCOMArray<nsWifiAccessPoint>& a, nsCOMArray<nsWifiAccessPoint>& b);
         107                 :
         108                 :
         109                 : #endif

Generated by: LCOV version 1.7