radioapp/radioenginewrapper/tsrc/inc/t_radioenginewrapper.h
branchRCL_3
changeset 20 93c594350b9a
parent 19 cce62ebc198e
equal deleted inserted replaced
19:cce62ebc198e 20:93c594350b9a
     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 
       
    19 #ifndef T_RADIOENGINEWRAPPER_H_
       
    20 #define T_RADIOENGINEWRAPPER_H_
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <QtTest/QtTest>
       
    25 #include <e32property.h>
       
    26 #include <centralrepository.h>
       
    27 #include <RadioStubManager.h>
       
    28 
       
    29 #include "radioenginewrapperobserver.h"
       
    30 #include "radiostationhandlerif.h"
       
    31 //#include "radiostation.h"
       
    32 #include "t_schedulerstartandstoptimer.h"
       
    33 
       
    34 class RadioUiEngine;
       
    35 class RadioStationModel;
       
    36 class RadioPlayLogModel;
       
    37 class RadioPresetStorage;
       
    38 class RadioEngineWrapper;
       
    39 //class RadioStationHandlerIf;
       
    40 
       
    41 class TestRadioEngineWrapper : public QObject, RadioStationHandlerIf, RadioEngineWrapperObserver, MSchedulerStartAndStopTimerObserver
       
    42 {
       
    43     Q_OBJECT
       
    44 
       
    45     /**
       
    46      * Flags to indicate which slots have been entered since calling API method. 
       
    47      * Declared to use QFlags<> to ease flag usage and to enforce type safety.
       
    48      */
       
    49     enum SlotEnteredFlag
       
    50     {
       
    51     	NoSlotsEntered         = 0
       
    52         ,TunedToFrequency       = 1 << 0
       
    53         ,MuteChanged            = 1 << 1
       
    54         ,VolumeChanged          = 1 << 2
       
    55         ,AntennaChanged         = 1 << 3
       
    56         ,ItemAdded              = 1 << 4
       
    57     };
       
    58     Q_DECLARE_FLAGS( Slots, SlotEnteredFlag )    
       
    59     
       
    60 public:
       
    61 
       
    62     TestRadioEngineWrapper();
       
    63     ~TestRadioEngineWrapper();    
       
    64 
       
    65 public slots:
       
    66 //    void dataChanged(const QModelIndex topLeft, const QModelIndex bottomRight);
       
    67 //    void stationAdded( RadioStation addedStation );    
       
    68 //    void stationDataChanged( RadioStation station );        
       
    69 //    void favoriteChanged( RadioStation station );
       
    70 //    void itemAdded();
       
    71     
       
    72 private slots:
       
    73     // test framework called slots 
       
    74     void initTestCase();
       
    75     void init();
       
    76     void cleanup();
       
    77     
       
    78     void testRadioSettingsReference();
       
    79     
       
    80     void testRegion();
       
    81     
       
    82     void testRadioOnOff();
       
    83 
       
    84     void testTuning();
       
    85     
       
    86     void testCancelSeeking();
       
    87     
       
    88     // Mute's callback function CRadioEngine::MrpoMuteChange() is commented in radio engine, so no point to test here.
       
    89     // void testMute();
       
    90     
       
    91     void testVolumeSetting();
       
    92     
       
    93     void testLoudSpeakerUsage();
       
    94     
       
    95     void cleanupTestCase();
       
    96     
       
    97 private:
       
    98 
       
    99     // from base class RadioStationHandlerIf =>
       
   100     uint currentFrequency() const;
       
   101     int currentPresetIndex() const;
       
   102 
       
   103     void setCurrentStation( uint frequency );
       
   104 
       
   105     bool containsFrequency( uint frequency );
       
   106 
       
   107     bool containsPresetIndex( int presetIndex );
       
   108 
       
   109     void startDynamicPsCheck();
       
   110 
       
   111     void addScannedFrequency( uint frequency );
       
   112 
       
   113     void removeLocalStations();
       
   114 
       
   115     void setCurrentPsName( uint frequency, const QString& name );
       
   116     void setCurrentRadioText( uint frequency, const QString& radioText );
       
   117     void setCurrentRadioTextPlus( uint frequency, int rtClass, const QString& rtItem );
       
   118     void setCurrentPiCode( uint frequency, int piCode );
       
   119     void setCurrentGenre( uint frequency, int genre );
       
   120     // <= from base class RadioStationHandlerIf 
       
   121     
       
   122     // c =>
       
   123     void tunedToFrequency( uint frequency, int commandSender );
       
   124 
       
   125     void rdsAvailabilityChanged( bool available );
       
   126 
       
   127     void increaseVolume();
       
   128     void decreaseVolume();
       
   129     void volumeChanged( int volume );
       
   130     void muteChanged( bool muted );
       
   131 
       
   132     void antennaStatusChanged( bool connected ); // uusi
       
   133     
       
   134     void audioRouteChanged( bool loudspeaker );
       
   135 
       
   136     void skipPrevious();
       
   137     void skipNext();
       
   138     // <= from base class RadioStationHandlerIf 
       
   139       
       
   140     // from base class MSchedulerStartAndStopTimerObserver =>
       
   141     void Timeout( TUint aTimerId );    
       
   142     void CreateMUT();
       
   143     void DeleteMUT();
       
   144     // <=
       
   145     
       
   146     void tstSetTunerCababilities(uint category = 0);
       
   147     void tstSetFrequency( TUint aFrequency );
       
   148     TInt tstGetFrequency();
       
   149     void tstSetScanningData( TUint aCount, TInt aMinFreq, TInt aFrequencyStepSize );
       
   150     void tstDefineAndAttachRadioServerProperties();
       
   151     TInt tstCreateCRObjects();
       
   152     
       
   153 private:
       
   154     RadioEngineWrapper* mEngineWrapper;
       
   155 
       
   156     // RadioStubManager pointer points inside RadioStubManagerChunk
       
   157     SRadioStubManager* mRadioStubManager;
       
   158     
       
   159     // RadioStubManagerChunk handle
       
   160     RChunk mRadioStubManagerChunk;
       
   161 
       
   162     // Active scheduler
       
   163     // Workaround for the below panic, occured after porting to 10.1 
       
   164     // Main Panic E32USER-CBase 44
       
   165     // Create and install the active scheduler
       
   166     CActiveScheduler* mScheduler;
       
   167     
       
   168     //QScopedPointer<RadioEngineWrapper>  mEngineWrapper;
       
   169 
       
   170     //int mExpectedStationCount;
       
   171     
       
   172 	Slots mEnteredSlots;
       
   173 	//QString mStationToBeAdded;
       
   174 	
       
   175 	CSchedulerStopAndStartTimer* mSchedulerTimer;
       
   176 
       
   177     RProperty mPropertyPlayerState;
       
   178     RProperty mPropertyAntennaStatus;
       
   179     RProperty mPropertyOfflineMode;
       
   180     RProperty mPropertyTransmitterStatus;
       
   181     RProperty mPropertyFrequency;
       
   182     RProperty mPropertyFrequencyRange;
       
   183     RProperty mPropertyForceMonoReception;
       
   184     RProperty mPropertySquelch;
       
   185     RProperty mPropertyVolume;
       
   186     RProperty mPropertyMuteStatus;
       
   187     RProperty mPropertyBalance;
       
   188 
       
   189     CRepository* mRadioCR;
       
   190     
       
   191     TInt mLastRecordedVolume; 
       
   192 };
       
   193 
       
   194 #endif /* T_RADIOENGINEWRAPPER_H_ */