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