connectionmonitoring/connmon/connectionmonitor/src/connmonwlannetwork_v2.cpp
changeset 20 9c97ad6591ae
parent 0 5a93021fdf25
child 58 83ca720e2b9a
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
    73 
    73 
    74 // ---------------------------------------------------------------------------
    74 // ---------------------------------------------------------------------------
    75 //  Constructor
    75 //  Constructor
    76 // ---------------------------------------------------------------------------
    76 // ---------------------------------------------------------------------------
    77 //
    77 //
       
    78 CConnMonWlanNetwork::CConnMonWlanNetwork(
       
    79         const TBuf<KMaxNameLength>& aName,
       
    80         TUint aConnectionMode,
       
    81         TUint aSignalStrength,
       
    82         TUint aSecurityMode,
       
    83         TUint aSecurityModeV2,
       
    84         TUint aProtectedSetupSupport,
       
    85         const TBuf8<KWlanBssId>& aBssId,
       
    86         const TDesC& aVendorData )
       
    87         :
       
    88         iName( aName ),
       
    89         iConnectionMode( aConnectionMode ),
       
    90         iSignalStrength( aSignalStrength ),
       
    91         iSecurityMode( aSecurityMode ),
       
    92         iWlanBssId( aBssId ),
       
    93         iVendorData( NULL ),
       
    94         iSecurityModeV2( aSecurityModeV2 ),
       
    95         iProtectedSetupSupport( aProtectedSetupSupport )
       
    96     {
       
    97     if ( aVendorData != KNullDesC() && aVendorData.Length() > 0 )
       
    98         {
       
    99         // Can't leave here, copy contents only if enough memory
       
   100         iVendorData = HBufC::New( aVendorData.Length() );
       
   101         if ( iVendorData )
       
   102             {
       
   103             iVendorData->Des().Copy( aVendorData );
       
   104             }
       
   105         }
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 //  Constructor
       
   110 // ---------------------------------------------------------------------------
       
   111 //
    78 EXPORT_C CConnMonWlanNetwork* CConnMonWlanNetwork::NewL(
   112 EXPORT_C CConnMonWlanNetwork* CConnMonWlanNetwork::NewL(
    79         const TBuf<KMaxNameLength>& aName,
   113         const TBuf<KMaxNameLength>& aName,
    80         TUint aConnectionMode,
   114         TUint aConnectionMode,
    81         TUint aSignalStrength,
   115         TUint aSignalStrength,
    82         TUint aSecurityMode,
   116         TUint aSecurityMode,
    93 
   127 
    94     return wlanNet;
   128     return wlanNet;
    95     }
   129     }
    96 
   130 
    97 // ---------------------------------------------------------------------------
   131 // ---------------------------------------------------------------------------
       
   132 //  Constructor
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 EXPORT_C CConnMonWlanNetwork* CConnMonWlanNetwork::NewL(
       
   136         const TBuf<KMaxNameLength>& aName,
       
   137         TUint aConnectionMode,
       
   138         TUint aSignalStrength,
       
   139         TUint aSecurityMode,
       
   140         TUint aSecurityModeV2,
       
   141         TUint aProtectedSetupSupport,
       
   142         const TBuf8<KWlanBssId>& aBssId,
       
   143         const TDesC& aVendorData )
       
   144     {
       
   145     CConnMonWlanNetwork* wlanNet = new( ELeave ) CConnMonWlanNetwork(
       
   146             aName,
       
   147             aConnectionMode,
       
   148             aSignalStrength,
       
   149             aSecurityMode,
       
   150             aSecurityModeV2,
       
   151             aProtectedSetupSupport,
       
   152             aBssId,
       
   153             aVendorData );
       
   154 
       
   155     return wlanNet;
       
   156     }
       
   157 
       
   158 // ---------------------------------------------------------------------------
    98 //  Second-phase constructor
   159 //  Second-phase constructor
    99 // ---------------------------------------------------------------------------
   160 // ---------------------------------------------------------------------------
   100 //
   161 //
   101 void CConnMonWlanNetwork::ConstructL()
   162 void CConnMonWlanNetwork::ConstructL()
   102     {
   163     {
   115         wlanNet = new( ELeave ) CConnMonWlanNetwork(
   176         wlanNet = new( ELeave ) CConnMonWlanNetwork(
   116                 aConnMonWlanNetwork.iName,
   177                 aConnMonWlanNetwork.iName,
   117                 aConnMonWlanNetwork.iConnectionMode,
   178                 aConnMonWlanNetwork.iConnectionMode,
   118                 aConnMonWlanNetwork.iSignalStrength,
   179                 aConnMonWlanNetwork.iSignalStrength,
   119                 aConnMonWlanNetwork.iSecurityMode,
   180                 aConnMonWlanNetwork.iSecurityMode,
       
   181                 aConnMonWlanNetwork.iSecurityModeV2,
       
   182                 aConnMonWlanNetwork.iProtectedSetupSupport,
   120                 aConnMonWlanNetwork.iWlanBssId,
   183                 aConnMonWlanNetwork.iWlanBssId,
   121                 aConnMonWlanNetwork.iVendorData->Des() );
   184                 aConnMonWlanNetwork.iVendorData->Des() );
   122         }
   185         }
   123     else
   186     else
   124         {
   187         {
   125         wlanNet = new( ELeave ) CConnMonWlanNetwork(
   188         wlanNet = new( ELeave ) CConnMonWlanNetwork(
   126                 aConnMonWlanNetwork.iName,
   189                 aConnMonWlanNetwork.iName,
   127                 aConnMonWlanNetwork.iConnectionMode,
   190                 aConnMonWlanNetwork.iConnectionMode,
   128                 aConnMonWlanNetwork.iSignalStrength,
   191                 aConnMonWlanNetwork.iSignalStrength,
   129                 aConnMonWlanNetwork.iSecurityMode,
   192                 aConnMonWlanNetwork.iSecurityMode,
       
   193                 aConnMonWlanNetwork.iSecurityModeV2,
       
   194                 aConnMonWlanNetwork.iProtectedSetupSupport,
   130                 aConnMonWlanNetwork.iWlanBssId,
   195                 aConnMonWlanNetwork.iWlanBssId,
   131                 KNullDesC() );
   196                 KNullDesC() );
   132         }
   197         }
   133     return wlanNet;
   198     return wlanNet;
   134     }
   199     }
   153 
   218 
   154     iName.Copy( aConnMonWlanNetwork.Name() );
   219     iName.Copy( aConnMonWlanNetwork.Name() );
   155     iConnectionMode = aConnMonWlanNetwork.ConnectionMode();
   220     iConnectionMode = aConnMonWlanNetwork.ConnectionMode();
   156     iSignalStrength = aConnMonWlanNetwork.SignalStrength();
   221     iSignalStrength = aConnMonWlanNetwork.SignalStrength();
   157     iSecurityMode = aConnMonWlanNetwork.SecurityMode();
   222     iSecurityMode = aConnMonWlanNetwork.SecurityMode();
       
   223     iSecurityModeV2 = aConnMonWlanNetwork.SecurityModeV2();
       
   224     iProtectedSetupSupport = aConnMonWlanNetwork.IsProtectedSetupSupported();
   158     iWlanBssId = aConnMonWlanNetwork.WlanBssid();
   225     iWlanBssId = aConnMonWlanNetwork.WlanBssid();
   159 
   226 
   160     if ( aConnMonWlanNetwork.iVendorData )
   227     if ( aConnMonWlanNetwork.iVendorData )
   161         {
   228         {
   162         delete iVendorData;
   229         delete iVendorData;
   197     //LOGEXITFN1("CConnMonWlanNetwork::CompareBySignal()", rc)
   264     //LOGEXITFN1("CConnMonWlanNetwork::CompareBySignal()", rc)
   198     return rc;
   265     return rc;
   199     }
   266     }
   200 
   267 
   201 // ---------------------------------------------------------------------------
   268 // ---------------------------------------------------------------------------
       
   269 // Obtains the more detailed security mode of the network.
       
   270 // ---------------------------------------------------------------------------
       
   271 //
       
   272 EXPORT_C TUint CConnMonWlanNetwork::SecurityModeV2()
       
   273     {
       
   274     return iSecurityModeV2;
       
   275     }
       
   276 
       
   277 // ---------------------------------------------------------------------------
       
   278 // Finds whether Wi-Fi Protected Setup is supported.
       
   279 // ---------------------------------------------------------------------------
       
   280 //
       
   281 EXPORT_C TBool CConnMonWlanNetwork::IsProtectedSetupSupported()
       
   282     {
       
   283     TBool result( EFalse );
       
   284     if ( iProtectedSetupSupport )
       
   285         {
       
   286         result = ETrue;
       
   287         }
       
   288     return result;
       
   289     }
       
   290 
       
   291 // ---------------------------------------------------------------------------
   202 // Packages object to HBufC descriptor
   292 // Packages object to HBufC descriptor
   203 // ---------------------------------------------------------------------------
   293 // ---------------------------------------------------------------------------
   204 //
   294 //
   205 EXPORT_C const HBufC* CConnMonWlanNetwork::ToBuf() const
   295 EXPORT_C const HBufC* CConnMonWlanNetwork::ToBuf() const
   206     {
   296     {