wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscaninfo.inl
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of ScanInfo inline methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "genscanoffsets.h"
       
    20 
       
    21 // ---------------------------------------------------------------------------
       
    22 //
       
    23 // ---------------------------------------------------------------------------
       
    24 //
       
    25 inline u8_t ScanInfo::SignalNoiseRatio() const
       
    26     {
       
    27     return *( current_m + CNTRL_RX_SNR_OFFSET );
       
    28     }
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 inline u8_t ScanInfo::RXLevel() const
       
    35     {
       
    36     if( !current_m )
       
    37         {
       
    38         return 0;
       
    39         }
       
    40     
       
    41     return *( current_m + CNTRL_RX_LEVEL_OFFSET );
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 inline void ScanInfo::BSSID(
       
    49     u8_t bssid[BSSID_LENGTH] ) const
       
    50     {
       
    51     u8_t* dst = bssid;
       
    52     if ( !dst || !current_m )
       
    53         {
       
    54         return;
       
    55         }
       
    56 
       
    57     const u8_t* src = current_m + MGMT_BSSID_OFFSET;
       
    58     const u8_t* end = src + BSSID_LENGTH;
       
    59 
       
    60     for ( ; src < end; ++dst, ++src )
       
    61         {
       
    62         *dst = *src;
       
    63         }
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 inline u16_t ScanInfo::BeaconInterval() const
       
    71     {
       
    72     if( !current_m )
       
    73         {
       
    74         return 0;
       
    75         }
       
    76     
       
    77     return *( reinterpret_cast<const u16_t*>( current_m + MGMT_BEACON_INTERVAL_OFFSET ) );
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 inline u16_t ScanInfo::Capability() const
       
    85     {
       
    86     if( !current_m )
       
    87         {
       
    88         return 0;
       
    89         }
       
    90     
       
    91     return *( reinterpret_cast<const u16_t*>( current_m + MGMT_CAPABILITY_OFFSET ) );
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 inline bool_t ScanInfo::Privacy() const
       
    99     {
       
   100     if ( Capability() & SCAN_CAPABILITY_BIT_MASK_PRIVACY )
       
   101         {
       
   102         return true_t;
       
   103         }
       
   104 
       
   105     return false_t;
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 inline WlanOperatingMode ScanInfo::OperatingMode() const
       
   113     {
       
   114     if ( Capability() & SCAN_CAPABILITY_BIT_MASK_ESS )
       
   115         {
       
   116         return WlanOperatingModeInfra;
       
   117         }
       
   118 
       
   119     return WlanOperatingModeAdhoc;
       
   120     }
       
   121 
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 inline void ScanInfo::Timestamp( u8_t timestamp[TIMESTAMP_LENGTH] ) const
       
   127     {
       
   128     u8_t* dst = timestamp;
       
   129     if ( !dst )
       
   130         {
       
   131         return;
       
   132         }
       
   133 
       
   134     const u8_t* src = current_m + MGMT_TIMESTAMP_OFFSET;
       
   135     const u8_t* end = src + TIMESTAMP_LENGTH;
       
   136 
       
   137     for ( ; src < end; ++dst, ++src )
       
   138         {
       
   139         *dst = *src;
       
   140         }
       
   141     }