voiceui/voiceuivoicerecognition/src/vuicnotificationobserver.cpp
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of CNBestListDialog
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "vuicnotificationobserver.h"
       
    20 
       
    21 #include <avkondomainpskeys.h>
       
    22 
       
    23 #include "rubydebug.h"
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CNotificationObserver::NewL
       
    27 // Two-phased constructor.
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 CNotificationObserver* CNotificationObserver::NewL()
       
    31     {
       
    32     CNotificationObserver* self = new (ELeave) CNotificationObserver();
       
    33     CleanupStack::PushL( self );
       
    34     self->ConstructL();
       
    35     CleanupStack::Pop( self );
       
    36     return self;
       
    37     } 
       
    38 
       
    39 // Destructor       
       
    40 CNotificationObserver::~CNotificationObserver()
       
    41     {
       
    42     RUBY_DEBUG0( "CNotificationObserver::~CNotificationObserver START" );
       
    43     
       
    44     Cancel();
       
    45     
       
    46     iNotificationState.Set( iNotificationStatus );
       
    47     
       
    48     iNotificationState.Close();
       
    49     
       
    50     RUBY_DEBUG0( "CNotificationObserver::~CNotificationObserver EXIT" );
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------
       
    54 // CNotificationObserver::DoCancel
       
    55 // ---------------------------------------------------------
       
    56 // 
       
    57 void CNotificationObserver::DoCancel()
       
    58     {
       
    59     RUBY_DEBUG0( "CNotificationObserver::DoCancel START" );
       
    60     
       
    61     iNotificationState.Cancel();
       
    62     
       
    63     RUBY_DEBUG0( "CNotificationObserver::DoCancel EXIT" );
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------
       
    67 // CNotificationObserver::RunL
       
    68 // ---------------------------------------------------------
       
    69 //     
       
    70 void CNotificationObserver::RunL()
       
    71     {
       
    72     RUBY_DEBUG_BLOCK( "CNotificationObserver::RunL" );
       
    73     
       
    74     TInt status = iStatus.Int();
       
    75     
       
    76     if ( status == KErrNone )
       
    77         {
       
    78         iNotificationState.Get( iNotificationStatus );
       
    79         
       
    80         if ( iNotificationStatus )
       
    81             {
       
    82             iNotificationState.Set( 0 );
       
    83             }
       
    84         }
       
    85         
       
    86     iNotificationState.Subscribe( iStatus );
       
    87     SetActive();
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // CNotificationObserver::CNotificationObserver
       
    92 // ---------------------------------------------------------
       
    93 //              
       
    94 CNotificationObserver::CNotificationObserver()
       
    95  : CActive( EPriorityStandard )
       
    96     {
       
    97     }
       
    98     
       
    99 // ---------------------------------------------------------
       
   100 // CNotificationObserver::ConstructL
       
   101 // ---------------------------------------------------------
       
   102 //           
       
   103 void CNotificationObserver::ConstructL()
       
   104     {
       
   105     RUBY_DEBUG_BLOCK( "CNotificationObserver::ConstructL" );
       
   106     
       
   107     User::LeaveIfError( iNotificationState.Attach( KPSUidAvkonDomain, KAknNotificationsInIdleAllowed ) );
       
   108     CActiveScheduler::Add( this );
       
   109     
       
   110     iNotificationState.Get( iNotificationStatus );
       
   111     
       
   112     if ( iNotificationStatus )
       
   113         {
       
   114         iNotificationState.Set( 0 );
       
   115         }
       
   116     
       
   117     iNotificationState.Subscribe( iStatus );
       
   118     SetActive();
       
   119     }    
       
   120 
       
   121     
       
   122 // End of File
       
   123