radioengine/utils/inc/cradiosystemeventdetector.h
changeset 23 a2b50a479edf
parent 19 afea38384506
child 24 6df133bd92e1
equal deleted inserted replaced
19:afea38384506 23:a2b50a479edf
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CRADIOSYSTEMEVENTDETECTOR_H
       
    19 #define CRADIOSYSTEMEVENTDETECTOR_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 #include "cradiopropertyobserver.h"
       
    24 
       
    25 class MRadioSystemEventDetectorObserver;
       
    26 
       
    27 /**
       
    28 * Catches notification of the call and network state changes.
       
    29 *
       
    30 * Class provides implementation to detect system events and notify UI components of the event,
       
    31 * Class keeps several instances of CVPropertyObserver, and those instances send event notifications
       
    32 * about the particular system component state change.
       
    33 */
       
    34 NONSHARABLE_CLASS( CRadioSystemEventDetector ) : public CBase
       
    35                                                , public MRadioPropertyChangeObserver
       
    36     {
       
    37 public:
       
    38 
       
    39     static CRadioSystemEventDetector* NewL( MRadioSystemEventDetectorObserver&  aObserver );
       
    40 
       
    41     virtual ~CRadioSystemEventDetector();
       
    42 
       
    43     /**
       
    44      * Returns network coverage state ( wlan or mobile ).
       
    45      */
       
    46     TBool IsNetworkCoverage() const;
       
    47 
       
    48     /**
       
    49      * Returns mobile network coverage state.
       
    50      */
       
    51     TBool IsMobileNetworkCoverage() const;
       
    52 
       
    53     /**
       
    54      * Returns current call state.
       
    55      */
       
    56     TBool IsCallActive() const;
       
    57 
       
    58     /**
       
    59      * Returns current audio resources state.
       
    60      * @return audio resources state
       
    61      */
       
    62     TBool IsAudioResourcesAvailable() const;
       
    63 
       
    64     /**
       
    65      * Returns current Voice UI state.
       
    66      * @return ETrue if Voice UI is active, EFalse otherwise
       
    67      */
       
    68     TBool IsVoiceUiActive() const;
       
    69 
       
    70 protected:
       
    71 
       
    72 // from base class MRadioPropertyChangeObserver
       
    73 
       
    74     void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TInt aValue );
       
    75     void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TDesC8& aValue );
       
    76     void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TDesC& aValue );
       
    77     void HandlePropertyChangeErrorL( const TUid& aCategory, const TUint aKey, TInt aError );
       
    78 
       
    79 private:
       
    80 
       
    81     void ConstructL();
       
    82 
       
    83     /**
       
    84      * Used internally to change network coverage status and report it to observer.
       
    85      */
       
    86     void SetNetworkCoverageL( const TBool aIsMobileNetworkCoverage, const TBool aIsWlanCoverage );
       
    87 
       
    88     CRadioSystemEventDetector( MRadioSystemEventDetectorObserver&  aObserver );
       
    89 
       
    90 private: // data
       
    91 
       
    92     /** Observer which will be notified of the call and network state changes*/
       
    93     MRadioSystemEventDetectorObserver&  iObserver;
       
    94 
       
    95     /** handler to Publish & Subscribe interface*/
       
    96     CRadioPropertyObserver*    iCallStatusObserver;
       
    97     /** handler to Publish & Subscribe interface*/
       
    98     CRadioPropertyObserver*    iNetworkStatusObserver;
       
    99     /** handler to Publish & Subscribe interface*/
       
   100     CRadioPropertyObserver*    iVoiceUiObserver;
       
   101     /** handler to Publish & Subscribe interface*/
       
   102     CRadioPropertyObserver*    iAudioPolicyObserver;
       
   103 
       
   104     /**Indicator for the mobile network status*/
       
   105     TBool iIsMobileNetworkCoverage;
       
   106 
       
   107     /**Indicator for the wlan network status*/
       
   108     TBool iIsWlanCoverage;
       
   109 
       
   110     /**Indicator for the call status*/
       
   111     TBool iIsCallActive;
       
   112 
       
   113     /** Array of audio policy categories that VR must not resume after. */
       
   114     RArray<TInt> iNoAutoResumeAudioCategories;
       
   115 
       
   116     /** Indicator for audio resource status. */
       
   117     TBool iIsAudioResourcesAvailable;
       
   118 
       
   119     /** Indicator for Voice UI status. */
       
   120     TBool iIsVoiceUiActive;
       
   121     
       
   122     };
       
   123 
       
   124 #endif // CRADIOSYSTEMEVENTDETECTOR_H