radioapp/radioenginewrapper/inc/radioenginewrapper_p.h
branchRCL_3
changeset 45 cce62ebc198e
equal deleted inserted replaced
43:1a6714c53019 45:cce62ebc198e
       
     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 RADIOENGINEWRAPPER_P_H
       
    19 #define RADIOENGINEWRAPPER_P_H
       
    20 
       
    21 // System includes
       
    22 #include <e32std.h>
       
    23 #include <QScopedPointer>
       
    24 #include <QList>
       
    25 
       
    26 // User includes
       
    27 #include "radioenginewrapper.h"
       
    28 #include "mradioenginehandlerobserver.h"
       
    29 
       
    30 // Forward declarations
       
    31 class RadioEngineHandler;
       
    32 class RadioControlEventListener;
       
    33 class RadioRdsListener;
       
    34 class RadioSettingsIf;
       
    35 class RadioSettings;
       
    36 class RadioStationHandlerIf;
       
    37 class RadioEngineWrapperObserver;
       
    38 
       
    39 typedef QList<RadioEngineWrapperObserver*> ObserverList;
       
    40 
       
    41 // Constants
       
    42 
       
    43 #define RUN_NOTIFY_LOOP( list, func ) \
       
    44         foreach( RadioEngineWrapperObserver* observer, list ) { \
       
    45             observer->func; \
       
    46         }
       
    47 
       
    48 // Class declaration
       
    49 class RadioEngineWrapperPrivate : public MRadioEngineHandlerObserver
       
    50 {
       
    51     Q_DECLARE_PUBLIC( RadioEngineWrapper )
       
    52     Q_DISABLE_COPY( RadioEngineWrapperPrivate )
       
    53 
       
    54     friend class RadioFrequencyScanningHandler;
       
    55 
       
    56 public:
       
    57 
       
    58     RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
       
    59                                RadioStationHandlerIf& stationHandler );
       
    60 
       
    61     virtual ~RadioEngineWrapperPrivate();
       
    62 
       
    63     /**
       
    64      * Initialization and startup
       
    65      */
       
    66     bool init();
       
    67 
       
    68     /**
       
    69      * Returns the radio settings
       
    70      */
       
    71     RadioSettingsIf& settings();
       
    72 
       
    73     /**
       
    74     * Getter for CRadioEngineHandler instance.
       
    75     * Returns reference to the CRadioEngineHandler
       
    76     */
       
    77     RadioEngineHandler& radioEnginehandler();
       
    78 
       
    79     /**
       
    80      * Tunes to given frequency
       
    81      */
       
    82     void setFrequency( uint frequency, const int reason );
       
    83 
       
    84     ObserverList& observers();
       
    85 
       
    86     void startSeeking( Seek::Direction direction, const int reason = TuneReason::Unspecified );
       
    87 
       
    88 private:
       
    89 
       
    90 // from base class MRadioEngineObserver
       
    91 
       
    92     void PowerEventL( TBool aPowerState, TInt aError );
       
    93     void FrequencyEventL( TUint32 aFrequency, RadioEngine::TRadioFrequencyEventReason aReason, TInt aError );
       
    94     void VolumeEventL( TInt aVolume, TInt aError );
       
    95     void MuteEventL( TBool aMuteState, TInt aError );
       
    96     void AudioModeEventL( TInt aAudioMode, TInt aError );
       
    97     void AntennaEventL( TBool aAntennaAttached, TInt aError );
       
    98     void AudioRoutingEventL( TInt aAudioDestination, TInt aError );
       
    99     void SeekingEventL( TInt aSeekingState, TInt aError );
       
   100     void RegionEventL( TInt aRegion, TInt aError );
       
   101     void FmTransmitterEventL( TBool /*aActive*/ ) {}
       
   102 
       
   103 // from base class MRadioAudioRoutingObserver
       
   104 
       
   105     void AudioRouteChangedL( RadioEngine::TRadioAudioRoute aRoute );
       
   106 
       
   107 // from base class MRadioSystemEventObserver
       
   108 
       
   109     void HandleSystemEventL( TRadioSystemEventType aEventType );
       
   110 
       
   111 private: // data
       
   112 
       
   113     /**
       
   114      * Pointer to the public class
       
   115      * Not own.
       
   116      */
       
   117     RadioEngineWrapper*                             q_ptr;
       
   118 
       
   119     /**
       
   120      * Map of radio stations read from the radio engine
       
   121      * Own.
       
   122      */
       
   123     RadioStationHandlerIf&                          mStationHandler;
       
   124 
       
   125     /**
       
   126      * Reference to the wrapper observer
       
   127      */
       
   128     ObserverList                                    mObservers;
       
   129 
       
   130     /**
       
   131      * Radio settings handler
       
   132      * Own.
       
   133      */
       
   134     QScopedPointer<RadioSettings>                   mSettings;
       
   135 
       
   136     /**
       
   137      * Radio engine handler.
       
   138      * Own.
       
   139      */
       
   140     QScopedPointer<RadioEngineHandler>              mEngineHandler;
       
   141 
       
   142     /**
       
   143      * RemCon listener.
       
   144      * Own.
       
   145      */
       
   146     QScopedPointer<RadioControlEventListener>       mControlEventListener;
       
   147 
       
   148     /**
       
   149      * Rds listener
       
   150      * Own.
       
   151      */
       
   152     QScopedPointer<RadioRdsListener>                mRdsListener;
       
   153 
       
   154     /**
       
   155      * Reason for the tune event. Can be FrequencyStrip, Carousel or station scanner
       
   156      */
       
   157     int                                             mTuneReason;
       
   158 
       
   159     /**
       
   160      * Flag to indicate whether or not audio should be routed to loudspeaker
       
   161      */
       
   162     bool                                            mUseLoudspeaker;
       
   163 
       
   164 };
       
   165 
       
   166 #endif // RADIOENGINEWRAPPER_P_H