wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp
branchRCL_3
changeset 10 dff6ebfd236f
parent 8 c2bc3f8c7777
child 11 8b0eae1b1d71
equal deleted inserted replaced
8:c2bc3f8c7777 10:dff6ebfd236f
    44 #include "wsfmodel.h"
    44 #include "wsfmodel.h"
    45 #include "wsfaiview.h"
    45 #include "wsfaiview.h"
    46 #include "wsficonarraycreator.h"
    46 #include "wsficonarraycreator.h"
    47 #include "wsfdbobserver.h"
    47 #include "wsfdbobserver.h"
    48 #include "wsflogger.h"
    48 #include "wsflogger.h"
       
    49 #include "wsfactivewrappers.h"
    49 
    50 
    50 
    51 
    51 // define icon id for Navigation Bar icon
    52 // define icon id for Navigation Bar icon
    52 LOCAL_D const TInt KNaviBarIcon = EWlanOffIcon;
    53 LOCAL_D const TInt KNaviBarIcon = EWlanOffIcon;
    53 LOCAL_D const TInt KTransparentIcon = ETransparentIcon;
    54 LOCAL_D const TInt KTransparentIcon = ETransparentIcon;
    78 // CWsfAiPlugin::~CWsfAiPlugin
    79 // CWsfAiPlugin::~CWsfAiPlugin
    79 // --------------------------------------------------------------------------
    80 // --------------------------------------------------------------------------
    80 //
    81 //
    81 CWsfAiPlugin::~CWsfAiPlugin()
    82 CWsfAiPlugin::~CWsfAiPlugin()
    82     {
    83     {
       
    84     LOG_ENTERFN( "CWsfAiPlugin::~CWsfAiPlugin" );
    83     // Cancel periodic animation update
    85     // Cancel periodic animation update
    84     if ( iAnimationPeriodic )
    86     if ( iAnimationPeriodic )
    85         {
    87         {
    86         LOG_WRITE( "Cancel animation update" );
    88         LOG_WRITE( "Cancel animation update" );
    87         iAnimationPeriodic->Cancel();
    89         iAnimationPeriodic->Cancel();
    89         iAnimationPeriodic = NULL;
    91         iAnimationPeriodic = NULL;
    90         }
    92         }
    91     
    93     
    92     delete iDbObserver;
    94     delete iDbObserver;
    93     
    95     
    94     // Cancel start up refresh
    96     delete iActiveWrappers;
    95     if ( iStartupRefresh )
       
    96         {
       
    97         LOG_WRITE( "Cancel start up refresh" );
       
    98         iStartupRefresh->Cancel();
       
    99         delete iStartupRefresh;
       
   100         iStartupRefresh = NULL;
       
   101         }
       
   102     
    97     
   103     delete iModel;
    98     delete iModel;
   104     delete iAiModel;
    99     delete iAiModel;
   105     delete iUi;
   100     delete iUi;
   106 
   101 
   162     iModel = CWsfModel::NewL( iController, EFalse );
   157     iModel = CWsfModel::NewL( iController, EFalse );
   163 
   158 
   164     // then model
   159     // then model
   165     iAiModel = CWsfAiModel::NewL();
   160     iAiModel = CWsfAiModel::NewL();
   166     iUi = CWsfAiView::NewL( *this );
   161     iUi = CWsfAiView::NewL( *this );
   167     iStartupRefresh = new (ELeave) CAsyncCallBack( 
   162     
   168                                           TCallBack( StartupRefresh, this ), 
       
   169                                           CActive::EPriorityIdle );
       
   170     iDbObserver = CWsfDbObserver::NewL();
   163     iDbObserver = CWsfDbObserver::NewL();
       
   164     
       
   165     iActiveWrappers = CWsfActiveWrappers::NewL( iModel, iController );
       
   166     
   171     iController.SetUi( *static_cast<CWsfAiView*>( iUi ) );
   167     iController.SetUi( *static_cast<CWsfAiView*>( iUi ) );
   172     iController.InitializeL( iModel, iAiModel, iDbObserver );
   168     
       
   169     iController.InitializeL( iModel, iAiModel, iDbObserver, 
       
   170 							 iActiveWrappers );
   173     }
   171     }
   174 
   172 
   175 
   173 
   176 // --------------------------------------------------------------------------
   174 // --------------------------------------------------------------------------
   177 // CWsfAiPlugin::PublishContentL
   175 // CWsfAiPlugin::PublishContentL
   417 // --------------------------------------------------------------------------
   415 // --------------------------------------------------------------------------
   418 //
   416 //
   419 void CWsfAiPlugin::Start( TStartReason /*aReason*/ )
   417 void CWsfAiPlugin::Start( TStartReason /*aReason*/ )
   420     {
   418     {
   421     LOG_ENTERFN( "CWsfAiPlugin::Start");
   419     LOG_ENTERFN( "CWsfAiPlugin::Start");
   422     iStartupRefresh->CallBack();
   420     iController.StartupRefresh();
   423     }
   421     }
   424 
   422 
   425 // --------------------------------------------------------------------------
   423 // --------------------------------------------------------------------------
   426 // CWsfAiPlugin::Stop
   424 // CWsfAiPlugin::Stop
   427 // --------------------------------------------------------------------------
   425 // --------------------------------------------------------------------------
   450         {
   448         {
   451         // HS came to foreground -> make refresh scan
   449         // HS came to foreground -> make refresh scan
   452         if ( !iAiModel->Connected() && !iModel->IsConnecting() )
   450         if ( !iAiModel->Connected() && !iModel->IsConnecting() )
   453             {
   451             {
   454             LOG_WRITE( "Call Refresh scan" );
   452             LOG_WRITE( "Call Refresh scan" );
   455             TRAP_IGNORE( iModel->RefreshScanL() );
   453         	iActiveWrappers->RefreshScan();
   456             }
   454             }
   457         else
   455         else
   458             {
   456             {
   459             LOG_WRITE( "Connected no need to refresh scan results" );
   457             LOG_WRITE( "Connected no need to refresh scan results" );
   460             }
   458             }
   862                      ->CancelTransaction( reinterpret_cast<TInt32>( self ) );
   860                      ->CancelTransaction( reinterpret_cast<TInt32>( self ) );
   863     }
   861     }
   864 
   862 
   865 
   863 
   866 // ---------------------------------------------------------------------------
   864 // ---------------------------------------------------------------------------
   867 // CWsfAiPlugin::StartupRefresh
       
   868 // ---------------------------------------------------------------------------
       
   869 //
       
   870 TInt CWsfAiPlugin::StartupRefresh( TAny* aPtr )
       
   871     {
       
   872     LOG_ENTERFN( "CWsfAiPlugin::StartupRefresh" );
       
   873     CWsfAiPlugin* self = static_cast<CWsfAiPlugin*>( aPtr );
       
   874     TRAP_IGNORE( self->StartupRefreshL(); );
       
   875     
       
   876     return 0;
       
   877     }
       
   878 
       
   879 
       
   880 // ---------------------------------------------------------------------------
       
   881 // CWsfAiPlugin::StartupRefreshL
       
   882 // ---------------------------------------------------------------------------
       
   883 //
       
   884 TInt CWsfAiPlugin::StartupRefreshL()
       
   885     {
       
   886     LOG_ENTERFN( "CWsfAiPlugin::StartupRefresh" );
       
   887     iController.StartupRefreshL();
       
   888     
       
   889     return 0;
       
   890     }
       
   891 
       
   892 // ---------------------------------------------------------------------------
       
   893 // CWsfAiPlugin::DoRefreshingStepL
   865 // CWsfAiPlugin::DoRefreshingStepL
   894 // ---------------------------------------------------------------------------
   866 // ---------------------------------------------------------------------------
   895 //
   867 //
   896 TInt CWsfAiPlugin::DoRefreshingStepL( TAny* ptr )
   868 TInt CWsfAiPlugin::DoRefreshingStepL( TAny* ptr )
   897 	{
   869 	{