uifw/AvKon/src/aknsignal.cpp
branchRCL_3
changeset 15 c52421ed5f07
parent 6 9f56a4e1b8ab
child 18 fcdfafb36fe7
equal deleted inserted replaced
13:a8834a2e9a96 15:c52421ed5f07
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   301     iSignalStrengthControl = CAknSignalStrength::NewL();
   301     iSignalStrengthControl = CAknSignalStrength::NewL();
   302 
   302 
   303     iSignalIconControl->SetContainerWindowL( *this );
   303     iSignalIconControl->SetContainerWindowL( *this );
   304     iSignalStrengthControl->SetContainerWindowL( *this );
   304     iSignalStrengthControl->SetContainerWindowL( *this );
   305 
   305 
   306     iTicker = CPeriodic::NewL( CActive::EPriorityLow );
       
   307 
       
   308     // Set flags to default values
   306     // Set flags to default values
   309     iPrivateFlags = 0;
   307     iPrivateFlags = 0;
   310 
   308 
   311     iDataObserver = new (ELeave) CAknSignalDataObserver( this );
   309     iDataObserver = new (ELeave) CAknSignalDataObserver( this );
   312     }
   310     }
   379 // Stops ongoing signal state animation.
   377 // Stops ongoing signal state animation.
   380 // ---------------------------------------------------------------------------
   378 // ---------------------------------------------------------------------------
   381 //
   379 //
   382 void CAknSignalPane::DisableAnimation()
   380 void CAknSignalPane::DisableAnimation()
   383     {
   381     {
   384     if ( iTicker && iTicker->IsActive() )
   382     StopTicker();
   385         {
       
   386         iTicker->Cancel();
       
   387         }
       
   388     }
   383     }
   389 
   384 
   390 
   385 
   391 // ---------------------------------------------------------------------------
   386 // ---------------------------------------------------------------------------
   392 // CAknSignalPane::ShowGprsIcon
   387 // CAknSignalPane::ShowGprsIcon
   402         TRAP_IGNORE( LoadSignalIconL( aGprsIconState,
   397         TRAP_IGNORE( LoadSignalIconL( aGprsIconState,
   403                                       iSignalIconControl->ColorIndex() ) );
   398                                       iSignalIconControl->ColorIndex() ) );
   404 
   399 
   405         iSignalIconControl->SetDrawBlank( EFalse );
   400         iSignalIconControl->SetDrawBlank( EFalse );
   406 
   401 
   407         if ( aGprsIconState != EAknSignalGprsIndicatorEstablishingContext &&
   402         if ( aGprsIconState != EAknSignalGprsIndicatorEstablishingContext )
   408              iTicker )
   403             {
   409             {
   404             StopTicker();
   410             iTicker->Cancel();
       
   411             }
   405             }
   412         else if ( aGprsIconState == EAknSignalGprsIndicatorEstablishingContext )
   406         else if ( aGprsIconState == EAknSignalGprsIndicatorEstablishingContext )
   413             {
   407             {
   414             if ( iTicker && !iTicker->IsActive() )
   408             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   415                 {
   409                                        KAknIndicatorAnimationInterval ) );
   416                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   417                                 KAknIndicatorAnimationInterval,
       
   418                                 TCallBack( TickerCallback, this ) );
       
   419                 }
       
   420             }
   410             }
   421         }
   411         }
   422     }
   412     }
   423 
   413 
   424 
   414 
   767         TRAP_IGNORE( LoadSignalIconL( aCommonPacketDataIconState,
   757         TRAP_IGNORE( LoadSignalIconL( aCommonPacketDataIconState,
   768                                       iSignalIconControl->ColorIndex() ) );
   758                                       iSignalIconControl->ColorIndex() ) );
   769 
   759 
   770         iSignalIconControl->SetDrawBlank( EFalse );
   760         iSignalIconControl->SetDrawBlank( EFalse );
   771 
   761 
   772         if ( aCommonPacketDataIconState != EAknSignalCommonPacketDataIndicatorEstablishingContext &&
   762         if ( aCommonPacketDataIconState != EAknSignalCommonPacketDataIndicatorEstablishingContext )
   773              iTicker )
   763             {
   774             {
   764             StopTicker();
   775             iTicker->Cancel();
       
   776             }
   765             }
   777         else if ( aCommonPacketDataIconState == EAknSignalCommonPacketDataIndicatorEstablishingContext )
   766         else if ( aCommonPacketDataIconState == EAknSignalCommonPacketDataIndicatorEstablishingContext )
   778             {
   767             {
   779             if ( iTicker && !iTicker->IsActive() )
   768             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   780                 {
   769                                        KAknIndicatorAnimationInterval ) );
   781                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   782                                 KAknIndicatorAnimationInterval,
       
   783                                 TCallBack( TickerCallback, this ) );
       
   784                 }
       
   785             }
   770             }
   786         }
   771         }
   787     }
   772     }
   788 
   773 
   789 
   774 
   801         TRAP_IGNORE( LoadSignalIconL( aEdgeIconState,
   786         TRAP_IGNORE( LoadSignalIconL( aEdgeIconState,
   802                                       iSignalIconControl->ColorIndex() ) );
   787                                       iSignalIconControl->ColorIndex() ) );
   803 
   788 
   804         iSignalIconControl->SetDrawBlank( EFalse );
   789         iSignalIconControl->SetDrawBlank( EFalse );
   805 
   790 
   806         if ( aEdgeIconState != EAknSignalEdgeIndicatorEstablishingContext &&
   791         if ( aEdgeIconState != EAknSignalEdgeIndicatorEstablishingContext )
   807              iTicker )
   792             {
   808             {
   793             StopTicker();
   809             iTicker->Cancel();
       
   810             }
   794             }
   811         else if ( aEdgeIconState == EAknSignalEdgeIndicatorEstablishingContext )
   795         else if ( aEdgeIconState == EAknSignalEdgeIndicatorEstablishingContext )
   812             {
   796             {
   813             if ( iTicker && !iTicker->IsActive() )
   797             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   814                 {
   798                                        KAknIndicatorAnimationInterval ) );
   815                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   816                                 KAknIndicatorAnimationInterval,
       
   817                                 TCallBack( TickerCallback, this ) );
       
   818                 }
       
   819             }
   799             }
   820         }
   800         }
   821     }
   801     }
   822 
   802 
   823 
   803 
   835         TRAP_IGNORE( LoadSignalIconL( aWcdmaIconState,
   815         TRAP_IGNORE( LoadSignalIconL( aWcdmaIconState,
   836                                       iSignalIconControl->ColorIndex() ) );
   816                                       iSignalIconControl->ColorIndex() ) );
   837 
   817 
   838         iSignalIconControl->SetDrawBlank( EFalse );
   818         iSignalIconControl->SetDrawBlank( EFalse );
   839 
   819 
   840         if ( aWcdmaIconState != EAknSignalWcdmaIndicatorEstablishingContext &&
   820         if ( aWcdmaIconState != EAknSignalWcdmaIndicatorEstablishingContext )
   841              iTicker )
   821             {
   842             {
   822             StopTicker();
   843             iTicker->Cancel();
       
   844             }
   823             }
   845         else if ( aWcdmaIconState == EAknSignalWcdmaIndicatorEstablishingContext )
   824         else if ( aWcdmaIconState == EAknSignalWcdmaIndicatorEstablishingContext )
   846             {
   825             {
   847             if ( iTicker && !iTicker->IsActive() )
   826             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   848                 {
   827                                        KAknIndicatorAnimationInterval ) );
   849                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   850                                 KAknIndicatorAnimationInterval,
       
   851                                 TCallBack( TickerCallback, this ) );
       
   852                 }
       
   853             }
   828             }
   854         }
   829         }
   855     }
   830     }
   856 
   831 
   857 
   832 
   869         TRAP_IGNORE( LoadSignalIconL( aHsdpaIconState,
   844         TRAP_IGNORE( LoadSignalIconL( aHsdpaIconState,
   870                                       iSignalIconControl->ColorIndex() ) );
   845                                       iSignalIconControl->ColorIndex() ) );
   871 
   846 
   872         iSignalIconControl->SetDrawBlank( EFalse );
   847         iSignalIconControl->SetDrawBlank( EFalse );
   873 
   848 
   874         if ( aHsdpaIconState != EAknSignalHsdpaIndicatorEstablishingContext &&
   849         if ( aHsdpaIconState != EAknSignalHsdpaIndicatorEstablishingContext )
   875              iTicker )
   850             {
   876             {
   851             StopTicker();
   877             iTicker->Cancel();
       
   878             }
   852             }
   879         else if ( aHsdpaIconState == EAknSignalHsdpaIndicatorEstablishingContext )
   853         else if ( aHsdpaIconState == EAknSignalHsdpaIndicatorEstablishingContext )
   880             {
   854             {
   881             if ( iTicker && !iTicker->IsActive() )
   855             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   882                 {
   856                                        KAknIndicatorAnimationInterval ) );
   883                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   884                                 KAknIndicatorAnimationInterval,
       
   885                                 TCallBack( TickerCallback, this ) );
       
   886                 }
       
   887             }
   857             }
   888         }
   858         }
   889     }
   859     }
   890 
   860 
   891 
   861 
   907 
   877 
   908         iExtension->iCdmaSignalState = aCdmaIconState;
   878         iExtension->iCdmaSignalState = aCdmaIconState;
   909 
   879 
   910         // Tick timer is only used when animating.
   880         // Tick timer is only used when animating.
   911         if ( aCdmaIconState != EAknSignalCdmaIndicatorSending &&
   881         if ( aCdmaIconState != EAknSignalCdmaIndicatorSending &&
   912              aCdmaIconState != EAknSignalCdmaIndicatorReceiving &&
   882              aCdmaIconState != EAknSignalCdmaIndicatorReceiving )
   913              iTicker )
   883             {
   914             {
   884             StopTicker();
   915             iTicker->Cancel();
       
   916             }
   885             }
   917 
   886 
   918         switch ( aCdmaIconState )
   887         switch ( aCdmaIconState )
   919             {
   888             {
   920             case EAknSignalCdmaIndicatorSending:
   889             case EAknSignalCdmaIndicatorSending:
   921             case EAknSignalCdmaIndicatorReceiving:
   890             case EAknSignalCdmaIndicatorReceiving:
       
   891                 {
   922                 if ( iTicker && !iTicker->IsActive() )
   892                 if ( iTicker && !iTicker->IsActive() )
   923                     {
   893                     {
   924                     // restart animation
   894                     // restart animation
   925                     iExtension->iCdmaAnimationIndex = 0;
   895                     iExtension->iCdmaAnimationIndex = 0;
   926                     iTicker->Start( KAknIndicatorShortAnimationInterval,
   896                     TRAP_IGNORE(
   927                                     KAknIndicatorShortAnimationInterval,
   897                         StartTickerL( KAknIndicatorShortAnimationInterval,
   928                                     TCallBack( TickerCallback, this ) );
   898                                       KAknIndicatorShortAnimationInterval ) );
   929                     }
   899                     }
   930                 break;
   900                 break;
       
   901                 }
   931             default:
   902             default:
   932                 break;
   903                 break;
   933             }
   904             }
   934         }
   905         }
   935     }
   906     }
  1082         }
  1053         }
  1083 
  1054 
  1084     iSignalState = aIconState;
  1055     iSignalState = aIconState;
  1085     }
  1056     }
  1086 
  1057 
       
  1058 
       
  1059 // ---------------------------------------------------------------------------
       
  1060 // CAknSignalPane::StartTickerL
       
  1061 // Starts the animation timer.
       
  1062 // ---------------------------------------------------------------------------
       
  1063 //
       
  1064 void CAknSignalPane::StartTickerL( TTimeIntervalMicroSeconds32 aDelay,
       
  1065                                    TTimeIntervalMicroSeconds32 aInterval )
       
  1066     {
       
  1067     if ( !iTicker )
       
  1068         {
       
  1069         iTicker = CPeriodic::NewL( CActive::EPriorityLow );
       
  1070         }
       
  1071 
       
  1072     if ( iTicker && !iTicker->IsActive() )
       
  1073         {
       
  1074         iTicker->Start( aDelay,
       
  1075                         aInterval,
       
  1076                         TCallBack( TickerCallback, this ) );
       
  1077         }
       
  1078     }
       
  1079 
       
  1080 
       
  1081 // ---------------------------------------------------------------------------
       
  1082 // CAknSignalPane::StopTicker
       
  1083 // Stops the animation timer.
       
  1084 // ---------------------------------------------------------------------------
       
  1085 //
       
  1086 void CAknSignalPane::StopTicker()
       
  1087     {
       
  1088     if ( iTicker )
       
  1089         {
       
  1090         iTicker->Cancel();
       
  1091         delete iTicker;
       
  1092         iTicker = NULL;
       
  1093         }
       
  1094     }
       
  1095 
  1087 //  End of File
  1096 //  End of File