wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp
branchRCL_3
changeset 8 c2bc3f8c7777
parent 0 56b72877c1cb
child 15 dff6ebfd236f
--- a/wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp	Wed Feb 03 12:16:50 2010 +0000
+++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaiplugin.cpp	Fri Feb 19 23:55:42 2010 +0200
@@ -54,7 +54,6 @@
 LOCAL_D const TUid KUidSnifferApp = {0x10281CAA};
 LOCAL_D const TInt KRefreshStepTime = 200 * 1000;
 LOCAL_D const TInt KConnectingStepTime = 200 * 1000;
-_LIT8( KWlanWizardName, "WLANWizard" );
 
 
 
@@ -154,9 +153,6 @@
     {
     LOG_ENTERFN( "CWsfAiPlugin::ConstructL" );
     AllocateResourcesL();
-        
-    iInfo.iUid = KUidWlanWizardPlugin;
-    iInfo.iName.Copy( KWlanWizardName );
     
     iContent = AiUtility::CreateContentItemArrayIteratorL( 
                                                     KAiWizardContent );
@@ -416,68 +412,21 @@
     iResourceFileOffset = env->AddResourceFileL( resourceFile );    
     }
 
-
 // --------------------------------------------------------------------------
-// CWsfAiPlugin::Resume
+// CWsfAiPlugin::Start
 // --------------------------------------------------------------------------
 //
-void CWsfAiPlugin::Resume( TAiTransitionReason aReason )
+void CWsfAiPlugin::Start( TStartReason /*aReason*/ )
     {
-    LOG_ENTERFN( "CWsfAiPlugin::Resume" );
-    switch ( aReason ) 
-        {
-        case EAiSystemStartup:
-            {
-            LOG_WRITE( "Resume - EAiSystemStartup");
-            iStartupRefresh->CallBack();
-            break;
-            }
-            
-        case EAiIdleForeground: 
-            { 
-            // AI came to foreground -> make refresh scan 
-            if ( !iAiModel->Connected() && !iModel->IsConnecting() )
-                {
-                LOG_WRITE( "Call Refresh scan" );
-                TRAP_IGNORE( iModel->RefreshScanL() );
-                }
-            else
-                {
-                LOG_WRITE( "Connected no need to refresh scan results" );
-                }
-            break; 
-            } 
-            
-        case EAiIdleBackground:
-            {
-            // AI went to background -> dismiss open dialogs/menus
-            TRAP_IGNORE( iController.DismissDialogsL() );
-            break;
-            }
-            
-        default: 
-            { 
-            break; 
-            } 
-        } 
+    LOG_ENTERFN( "CWsfAiPlugin::Start");
+    iStartupRefresh->CallBack();
     }
 
-
-// --------------------------------------------------------------------------
-// CWsfAiPlugin::Suspend
-// --------------------------------------------------------------------------
-//
-void CWsfAiPlugin::Suspend( TAiTransitionReason /*aReason*/ )
-    {
-    LOG_ENTERFN( "CWsfAiPlugin::Suspend" );
-    }
-
-
 // --------------------------------------------------------------------------
 // CWsfAiPlugin::Stop
 // --------------------------------------------------------------------------
 //
-void CWsfAiPlugin::Stop( TAiTransitionReason /*aReason*/ )
+void CWsfAiPlugin::Stop( TStopReason /*aReason*/ )
     {
     LOG_ENTERFN( "CWsfAiPlugin::Stop" );
     TRAP_IGNORE( iController.DeInitializeL() );
@@ -490,6 +439,50 @@
         }
     }
 
+// --------------------------------------------------------------------------
+// CWsfAiPlugin::Resume
+// --------------------------------------------------------------------------
+//
+void CWsfAiPlugin::Resume( TResumeReason aReason )
+    {
+    LOG_ENTERFN( "CWsfAiPlugin::Resume" );
+    if( aReason == EForeground ) 
+        {
+        // HS came to foreground -> make refresh scan
+        if ( !iAiModel->Connected() && !iModel->IsConnecting() )
+            {
+            LOG_WRITE( "Call Refresh scan" );
+            TRAP_IGNORE( iModel->RefreshScanL() );
+            }
+        else
+            {
+            LOG_WRITE( "Connected no need to refresh scan results" );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CWsfAiPlugin::Suspend
+// --------------------------------------------------------------------------
+//
+void CWsfAiPlugin::Suspend( TSuspendReason aReason )
+    {
+    LOG_ENTERFN( "CWsfAiPlugin::Suspend" );
+    
+    if( aReason == EBackground )
+        {
+        if ( iAnimationPeriodic )
+            {
+            LOG_WRITE( "Cancel animation update" );
+            iAnimationPeriodic->Cancel();
+            delete iAnimationPeriodic;
+            iAnimationPeriodic = NULL;
+            }
+                
+        // HS went to background -> dismiss open dialogs/menus
+        TRAP_IGNORE( iController.DismissDialogsL() );
+        }
+    }
 
 // --------------------------------------------------------------------------
 // CWsfAiPlugin::SubscribeL
@@ -498,7 +491,7 @@
 void CWsfAiPlugin::SubscribeL( MAiContentObserver& aObserver )
     {
     LOG_ENTERFN( "CWsfAiPlugin::Subscribe" );
-    return iObservers.AppendL( &aObserver );
+    iObservers.AppendL( &aObserver );
     }
 
 
@@ -511,76 +504,24 @@
     LOG_ENTERFN( "CWsfAiPlugin::ConfigureL" );
     }
 
-
-// --------------------------------------------------------------------------
-// CWsfAiPlugin::Extension
-// --------------------------------------------------------------------------
-//
-TAny* CWsfAiPlugin::Extension( TUid aUid )
-    {
-    LOG_ENTERFN( "CWsfAiPlugin::Extension" );
-    if ( aUid == KExtensionUidProperty )
-        {
-        return static_cast<MAiPropertyExtension*>( this );
-        }
-    else if ( aUid == KExtensionUidEventHandler )
-        {
-        return static_cast<MAiEventHandlerExtension*>( this );
-        }
-
-    return NULL;
-    }
-
-
 // --------------------------------------------------------------------------
 // CWsfAiPlugin::GetPropertyL
 // --------------------------------------------------------------------------
 //
-TAny* CWsfAiPlugin::GetPropertyL( TInt aProperty )
+TAny* CWsfAiPlugin::GetProperty( TProperty aProperty )
     {
-    switch ( aProperty )
+    if( aProperty == EPublisherContent )
         {
-        case EAiPublisherInfo:
-            {
-            return &iInfo;
-            }
+        return iContent;
+        }
+    else if( aProperty == EPublisherEvents )
+        {
+        return iEvents;
+        }
 
-        case EAiPublisherContent:
-            {
-            return static_cast<MAiContentItemIterator*>( iContent );
-            }
-
-        case EAiPublisherEvents:
-            {
-            return static_cast<MAiContentItemIterator*>( iEvents );
-            }
-            
-        default:
-            {
-            User::Leave( KErrNotSupported );
-            }
-        }
-    
     return NULL;
     }
 
-
-// --------------------------------------------------------------------------
-// CWsfAiPlugin::SetPropertyL
-// --------------------------------------------------------------------------
-//
-void CWsfAiPlugin::SetPropertyL( TInt aProperty, TAny* aValue )
-    {
-    LOG_ENTERFN( "CWsfAiPlugin::SetProperty" );
-    if ( aValue && ( aProperty == EAiPublisherInfo ) )
-        {
-        const TAiPublisherInfo* info =
-                            static_cast<const TAiPublisherInfo*>( aValue );
-        iInfo = *info;  
-        }
-    }
-
-
 // --------------------------------------------------------------------------
 // CWsfAiPlugin::HandleEvent
 // --------------------------------------------------------------------------
@@ -734,9 +675,12 @@
             }
         else
             {
-            iAnimationPeriodic->Cancel();
-            delete iAnimationPeriodic;
-            iAnimationPeriodic = NULL;
+            if ( iAnimationPeriodic )
+                {
+                iAnimationPeriodic->Cancel();
+                delete iAnimationPeriodic;
+                iAnimationPeriodic = NULL;                
+                }
             }
         }
     iRefreshing = aRefreshing;