wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtimpl.cpp
branchRCL_3
changeset 14 13838cf40350
parent 6 e0f767079796
child 17 a828660c511c
equal deleted inserted replaced
12:af3fb27c7511 14:13838cf40350
    14 * Description:  Implementation of wlan management API
    14 * Description:  Implementation of wlan management API
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 31 %
    19 * %version: 31.1.2 %
    20 */
    20 */
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include <e32std.h>
    23 #include <e32std.h>
    24 #include <ecom/implementationproxy.h>
    24 #include <ecom/implementationproxy.h>
   399     aAvailableIaps.Reset();
   399     aAvailableIaps.Reset();
   400 
   400 
   401     iCacheLifetime = KWlanMgmtDefaultCacheLifetime;
   401     iCacheLifetime = KWlanMgmtDefaultCacheLifetime;
   402     iMaxDelay = KWlanMgmtDefaultMaxDelay;
   402     iMaxDelay = KWlanMgmtDefaultMaxDelay;
   403 
   403 
   404 	TInt ret = iServer.GetAvailableIaps( iaps, iCacheLifetime, iMaxDelay );
   404 	TInt ret = iServer.GetAvailableIaps( iaps, iCacheLifetime, iMaxDelay, ETrue );
   405 	if ( ret != KErrNone )
   405 	if ( ret != KErrNone )
   406 		{
   406 		{
   407 		return ret;
   407 		return ret;
   408 		}   
   408 		}   
   409     for ( TUint idx( 0 ); idx < iaps.count; ++idx )
   409     for ( TUint idx( 0 ); idx < iaps.count; ++idx )
   410         {
   410         {
   411         aAvailableIaps.Append( iaps.iaps[idx] );
   411         aAvailableIaps.Append( iaps.iaps[idx].iapId );
   412         }
   412         }
   413 
   413 
   414     return KErrNone;
   414     return KErrNone;
   415     }
   415     }
   416 
   416 
   681 // CWlanMgmtImpl::ActivateExtendedNotificationsL
   681 // CWlanMgmtImpl::ActivateExtendedNotificationsL
   682 // ---------------------------------------------------------
   682 // ---------------------------------------------------------
   683 //
   683 //
   684 void CWlanMgmtImpl::ActivateExtendedNotificationsL(
   684 void CWlanMgmtImpl::ActivateExtendedNotificationsL(
   685     MWlanMgmtNotifications& aCallback,
   685     MWlanMgmtNotifications& aCallback,
   686     TUint aCallbackInterfaceVersion = KWlanCallbackInterfaceVersion )
   686     TUint aCallbackInterfaceVersion )
   687     {
   687     {
   688     TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ActivateExtendedNotificationsL()" ) ) );
   688     TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ActivateExtendedNotificationsL()" ) ) );
   689     iClientNotification = &aCallback;
   689     iClientNotification = &aCallback;
   690 
   690 
   691     if( !aCallbackInterfaceVersion ||
   691     if( !aCallbackInterfaceVersion ||
   793 TInt CWlanMgmtImpl::StartAggressiveBgScan(
   793 TInt CWlanMgmtImpl::StartAggressiveBgScan(
   794     TUint aInterval )
   794     TUint aInterval )
   795     {
   795     {
   796     TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::StartAggressiveBgScan()" ) ) );
   796     TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::StartAggressiveBgScan()" ) ) );
   797     return iServer.StartAggressiveBgScan( aInterval );
   797     return iServer.StartAggressiveBgScan( aInterval );
       
   798     }
       
   799 
       
   800 // ---------------------------------------------------------
       
   801 // CWlanMgmtImpl::GetAvailableIaps
       
   802 // ---------------------------------------------------------
       
   803 //
       
   804 void CWlanMgmtImpl::GetAvailableIaps(
       
   805     TInt& aCacheLifetime,
       
   806     TUint& aMaxDelay,
       
   807     TBool aFilteredResults,
       
   808     TRequestStatus& aStatus,
       
   809     RArray<TWlanIapAvailabilityData>& aAvailableIaps )
       
   810     {
       
   811     TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetAvailableIaps() (async)" ) ) );
       
   812     
       
   813     aAvailableIaps.Reset();
       
   814     
       
   815     aStatus = KRequestPending;
       
   816     iPendingAvailableIapsStatus = &aStatus;    
       
   817     iAvailableIapsRequest = new CWlanAvailableIapsRequest( *this, iServer, aAvailableIaps, aCacheLifetime, aMaxDelay, aFilteredResults );
       
   818     if ( !iAvailableIapsRequest )
       
   819         {
       
   820         User::RequestComplete( iPendingAvailableIapsStatus, KErrNoMemory );
       
   821         iPendingAvailableIapsStatus = NULL;
       
   822         return;
       
   823         }
       
   824     iAvailableIapsRequest->IssueRequest();
   798     }
   825     }
   799 
   826 
   800 // ---------------------------------------------------------
   827 // ---------------------------------------------------------
   801 // CWlanMgmtImpl::ScanComplete
   828 // CWlanMgmtImpl::ScanComplete
   802 // ---------------------------------------------------------
   829 // ---------------------------------------------------------
  1066     TInt& aCacheLifetime,
  1093     TInt& aCacheLifetime,
  1067     TUint& aMaxDelay ) :
  1094     TUint& aMaxDelay ) :
  1068     CActive( CActive::EPriorityStandard ),
  1095     CActive( CActive::EPriorityStandard ),
  1069     iCallback( aCallback ),
  1096     iCallback( aCallback ),
  1070     iServer( aServer ),
  1097     iServer( aServer ),
  1071     iPendingAvailableIaps( aAvailableIaps ),
  1098     iPendingAvailableIapIds( &aAvailableIaps ),
       
  1099     iPendingAvailableIaps( NULL ),
  1072     iAvailableIapsBuf( iAvailableIaps ),
  1100     iAvailableIapsBuf( iAvailableIaps ),
  1073     iCacheLifetimeBuf( aCacheLifetime ),
  1101     iCacheLifetimeBuf( aCacheLifetime ),
  1074     iMaxDelayBuf( aMaxDelay )
  1102     iMaxDelayBuf( aMaxDelay ),
       
  1103     iFilteredResults( ETrue )
  1075     {
  1104     {
  1076     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) );
  1105     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) );
  1077     CActiveScheduler::Add( this );
  1106     CActiveScheduler::Add( this );
  1078     }
  1107     }
  1079 
  1108 
       
  1109 // C++ default constructor can NOT contain any code, that
       
  1110 // might leave.
       
  1111 //
       
  1112 CWlanAvailableIapsRequest::CWlanAvailableIapsRequest(
       
  1113     CWlanMgmtImpl& aCallback, 
       
  1114     RWLMServer& aServer,
       
  1115     RArray<TWlanIapAvailabilityData>& aAvailableIaps,
       
  1116     TInt& aCacheLifetime,
       
  1117     TUint& aMaxDelay,
       
  1118     TBool aFilteredResults ) :
       
  1119     CActive( CActive::EPriorityStandard ),
       
  1120     iCallback( aCallback ),
       
  1121     iServer( aServer ),
       
  1122     iPendingAvailableIapIds( NULL ),
       
  1123     iPendingAvailableIaps( &aAvailableIaps ),
       
  1124     iAvailableIapsBuf( iAvailableIaps ),
       
  1125     iCacheLifetimeBuf( aCacheLifetime ),
       
  1126     iMaxDelayBuf( aMaxDelay ),
       
  1127     iFilteredResults( aFilteredResults )
       
  1128     {
       
  1129     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) );
       
  1130     CActiveScheduler::Add( this );
       
  1131     }
       
  1132 
  1080 // Destructor
  1133 // Destructor
  1081 CWlanAvailableIapsRequest::~CWlanAvailableIapsRequest()
  1134 CWlanAvailableIapsRequest::~CWlanAvailableIapsRequest()
  1082     {
  1135     {
  1083     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) );
  1136     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) );
  1084     Cancel();
  1137     Cancel();
       
  1138     iPendingAvailableIapIds = NULL;
       
  1139     iPendingAvailableIaps = NULL;
  1085     }
  1140     }
  1086 
  1141 
  1087 // ---------------------------------------------------------
  1142 // ---------------------------------------------------------
  1088 // CWlanAvailableIapsRequest::IssueRequest
  1143 // CWlanAvailableIapsRequest::IssueRequest
  1089 // ---------------------------------------------------------
  1144 // ---------------------------------------------------------
  1090 //
  1145 //
  1091 void CWlanAvailableIapsRequest::IssueRequest()
  1146 void CWlanAvailableIapsRequest::IssueRequest()
  1092     {
  1147     {
  1093     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::IssueRequest()" ) ) );
  1148     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::IssueRequest()" ) ) );
  1094     iServer.GetAvailableIaps( iAvailableIapsBuf, iCacheLifetimeBuf, iMaxDelayBuf, iStatus );
  1149     iServer.GetAvailableIaps( iAvailableIapsBuf, iCacheLifetimeBuf, iMaxDelayBuf, iFilteredResults, iStatus );
  1095     SetActive();
  1150     SetActive();
  1096     }
  1151     }
  1097 
  1152 
  1098 // ---------------------------------------------------------
  1153 // ---------------------------------------------------------
  1099 // CWlanAvailableIapsRequest::RunL
  1154 // CWlanAvailableIapsRequest::RunL
  1100 // ---------------------------------------------------------
  1155 // ---------------------------------------------------------
  1101 //
  1156 //
  1102 void CWlanAvailableIapsRequest::RunL()
  1157 void CWlanAvailableIapsRequest::RunL()
  1103     {
  1158     {
  1104     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::RunL()" ) ) );
  1159     TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::RunL()" ) ) );
  1105     for ( TUint idx( 0 ); idx < iAvailableIaps.count; ++idx )
  1160     if( iPendingAvailableIapIds )
  1106         {
  1161         {
  1107         iPendingAvailableIaps.Append( iAvailableIaps.iaps[idx] );
  1162         for ( TUint idx( 0 ); idx < iAvailableIaps.count; ++idx )
       
  1163             {
       
  1164             iPendingAvailableIapIds->Append( iAvailableIaps.iaps[idx].iapId );
       
  1165             }
       
  1166         }
       
  1167     else if( iPendingAvailableIaps )
       
  1168         {
       
  1169         for ( TUint idx( 0 ); idx < iAvailableIaps.count; ++idx )
       
  1170             {
       
  1171             TWlanIapAvailabilityData tmp;
       
  1172             tmp.iIapId = iAvailableIaps.iaps[idx].iapId;
       
  1173             // RCPI -> RSSI CONVERSION
       
  1174             // Note: conversion may round the result by 0.5 units
       
  1175             tmp.iRssi = ( 110 - ( iAvailableIaps.iaps[idx].rcpi / 2 ) ); 
       
  1176             iPendingAvailableIaps->Append( tmp );
       
  1177             }        
  1108         }
  1178         }
  1109     iCallback.AvailableIapsComplete( iStatus.Int() );
  1179     iCallback.AvailableIapsComplete( iStatus.Int() );
  1110     }
  1180     }
  1111 
  1181 
  1112 // ---------------------------------------------------------
  1182 // ---------------------------------------------------------