internetradio2.0/uiinc/irsystemeventdetector.h
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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:  Header file for CIRSystemEventDetector.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IRSYSTEMEVENTDETECTOR_H
       
    20 #define IRSYSTEMEVENTDETECTOR_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "irpropertyobserver2.h"
       
    25 
       
    26 class MIRSystemEventDetectorObserver;
       
    27 
       
    28 /**
       
    29 * Catches notification of the call and network state changes.
       
    30 *
       
    31 * Class provides implementation to detect system events and notify UI components of the event,
       
    32 * Class keeps several instances of CVPropertyObserver, and those instances send event notifications 
       
    33 * about the particular system component state change. 
       
    34 */
       
    35 NONSHARABLE_CLASS( CIRSystemEventDetector ) : public CBase, public MIRPropertyChangeObserver2
       
    36     {
       
    37     public:
       
    38 
       
    39         /**
       
    40         * Two-phased constructor.
       
    41         * @param aObserver a reference to the observer interface implementer
       
    42         */
       
    43         static CIRSystemEventDetector* NewL(MIRSystemEventDetectorObserver&  aObserver);
       
    44         
       
    45         /**
       
    46         * Destructor.
       
    47         */
       
    48         virtual ~CIRSystemEventDetector();
       
    49 
       
    50 		/**
       
    51 		* Returns network coverage state (wlan or mobile).
       
    52 		*/
       
    53 		TBool IsNetworkCoverage() const;
       
    54 
       
    55 		/**
       
    56 		* Returns mobile network coverage state.
       
    57 		*/
       
    58 		TBool IsMobileNetworkCoverage() const;
       
    59 
       
    60 		/**
       
    61 		* Returns current call state.
       
    62 		*/
       
    63 		TBool IsCallActive() const;
       
    64 		
       
    65 		/**
       
    66 		* Returns current audio resources state.
       
    67 		* @return audio resources state 
       
    68 		*/
       
    69 		TBool IsAudioResourcesAvailable() const;
       
    70 		
       
    71 		/**
       
    72 		* Returns current Voice UI state.
       
    73 		* @return ETrue if Voice UI is active, EFalse otherwise
       
    74 		*/
       
    75 		TBool IsVoiceUiActive() const;
       
    76 
       
    77     protected:
       
    78     
       
    79 // from base class MIRPropertyChangeObserver2
       
    80 	    void HandlePropertyChangeL(const TUid& aCategory, const TUint aKey, const TInt aValue);
       
    81 	    void HandlePropertyChangeL(const TUid& aCategory, const TUint aKey, const TDesC8& aValue);
       
    82 	    void HandlePropertyChangeL(const TUid& aCategory, const TUint aKey, const TDesC& aValue);
       
    83 	    void HandlePropertyChangeErrorL(const TUid& aCategory, const TUint aKey, TInt aError);
       
    84    
       
    85     private:
       
    86 
       
    87         /**
       
    88         * By default EPOC constructor is private.
       
    89         */
       
    90         void ConstructL();
       
    91         
       
    92         /**
       
    93         * Used internally to change network coverage status and report it to observer.
       
    94         **/
       
    95         void CIRSystemEventDetector::SetNetworkCoverageL( const TBool aIsMobileNetworkCoverage,
       
    96         		 const TBool aIsWlanCoverage );
       
    97 
       
    98         /**
       
    99         * C++ default constructor.
       
   100         * @param aObserver a reference to the observer interface implementer     
       
   101         */
       
   102         CIRSystemEventDetector(MIRSystemEventDetectorObserver&  aObserver);
       
   103     
       
   104 	private:    // Data
       
   105     
       
   106         /**Observer which will be notified of the call and network state changes*/
       
   107 		MIRSystemEventDetectorObserver&  iObserver;
       
   108 	
       
   109         /** handler to Publish & Subscribe interface*/        		
       
   110         CIRPropertyObserver2*    iCallStatusObserver;
       
   111         /** handler to Publish & Subscribe interface*/        		
       
   112         CIRPropertyObserver2*    iNetworkStatusObserver;
       
   113         /** handler to Publish & Subscribe interface*/        		
       
   114         CIRPropertyObserver2*    iVoiceUiObserver;
       
   115         /** handler to Publish & Subscribe interface*/        		
       
   116         CIRPropertyObserver2*    iAudioPolicyObserver;
       
   117         /** handler to Publish & Subscribe interface*/        		
       
   118         CIRPropertyObserver2*    iWlanObserver;
       
   119 
       
   120 		/**Indicator for the mobile network status*/
       
   121 		TBool iIsMobileNetworkCoverage;
       
   122 
       
   123 		/**Indicator for the wlan network status*/
       
   124 		TBool iIsWlanCoverage;
       
   125 		
       
   126 		/**Indicator for the call status*/
       
   127 		TBool iIsCallActive;
       
   128         
       
   129         /** Array of audio policy categories that VR must not resume after. */
       
   130         RArray<TInt> iNoAutoResumeAudioCategories;
       
   131         
       
   132         /** Indicator for audio resource status. */
       
   133 		TBool iIsAudioResourcesAvailable;
       
   134 		
       
   135 		/** Indicator for Voice UI status. */
       
   136 		TBool iIsVoiceUiActive;
       
   137     };
       
   138 
       
   139 #endif   // IRSYSTEMEVENTDETECTOR_H   
       
   140