mmserv/radioutility/radioserver/Server/Src/RadioServer.h
changeset 0 71ca22bcf22a
child 7 709f89d8c047
child 12 5a06f39ad45b
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  This is the main implementation of radio server.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef RADIOSERVER_H
       
    21 #define RADIOSERVER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <FMRadioTunerControl.h>	// Adaptation
       
    26 #include <RadioRdsControl.h>		// Adaptation
       
    27 #include <mmf/server/sounddevice.h>
       
    28 #include <cenrepnotifyhandler.h>
       
    29 
       
    30 #ifdef RD_TSP_CLIENT_MAPPER
       
    31 #include <tspclientmapper.h>
       
    32 #endif // RD_TSP_CLIENT_MAPPER
       
    33 #include "RadioServerData.h"
       
    34 #include "RadioClientServer.h"
       
    35 #include "RadioServerFmTuner.h"
       
    36 
       
    37 // DATA TYPES
       
    38 struct TRadioMessageRequestData
       
    39 	{
       
    40 	TSglQueLink iLink;
       
    41 	TRadioServerRequest iType;
       
    42 	RMessage2 iMessage;
       
    43 	};
       
    44 
       
    45 // FORWARD DECLARATIONS
       
    46 class CFMRadioTunerControl;
       
    47 class CRadioServerSettings;
       
    48 class CRadioServerShutdown;
       
    49 class CMMFBuffer;
       
    50 class CRepository;
       
    51 
       
    52 // CLASS DECLARATION
       
    53 
       
    54 /**
       
    55 *  This is the main implemetation of radio server.
       
    56 *
       
    57 *  @lib RadioServer.exe
       
    58 *  @since S60 3.0
       
    59 */
       
    60 class CRadioServer: public CServer2,
       
    61 					public MRadioServerFMTunerObserver,
       
    62 					public MDevSoundObserver,
       
    63 					public MCenRepNotifyHandlerCallback
       
    64     {
       
    65 public:  // Constructors and destructor
       
    66 
       
    67 	/**
       
    68 	 * Two-phased constructor.
       
    69 	 */
       
    70 	static CRadioServer* NewL();
       
    71 
       
    72 	/**
       
    73 	 * Destructor.
       
    74 	 */
       
    75 	virtual ~CRadioServer();
       
    76 
       
    77 public: // New functions
       
    78 
       
    79 	/**
       
    80 	 * Keep track of session count (and cancel shutdown timer)
       
    81 	 * @since S60 3.0
       
    82 	 */
       
    83 	void AddSession();
       
    84 
       
    85 	/**
       
    86 	 * Keep track of session count (and start shutdown timer if session count is zero)
       
    87 	 * @since S60 3.0
       
    88 	 */
       
    89 	void DropSession();
       
    90 
       
    91 	/**
       
    92 	 * Called by CRadioServerSession to handle messages for Radio Server.
       
    93 	 * @since S60 3.0
       
    94 	 * @param aMessage Message containing client request and data
       
    95 	 */
       
    96 	void ServiceRequestL( const RMessage2& aMessage );
       
    97 
       
    98 private:  // Functions from base classes
       
    99 
       
   100 	/**
       
   101 	 * From CServer2
       
   102 	 * Creates a server-side client session object.
       
   103 	 */
       
   104 	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
       
   105 
       
   106 	/**
       
   107 	 * From MRadioServerFMTunerObserver
       
   108 	 * See RadioServerFMTuner.h (or the actual adaptation APIs in FMRadioTunerControl.h
       
   109 	 * and RadioRdsControl) for detailed description.
       
   110 	 * @since S60 3.2
       
   111 	 */
       
   112 	void TunerOnComplete( TRadioServerError aError );
       
   113 	void TunerOffComplete( TRadioServerError aError );
       
   114 	void SetFrequencyRangeComplete( TRadioServerError aError );
       
   115 	void SetFrequencyComplete( TRadioServerError aError );
       
   116 	void StationSeekComplete( TRadioServerError aError, TInt aFrequency );
       
   117 	void AudioModeComplete( TRadioServerError aError, TBool aStereo );
       
   118 	void SetAudioModeComplete( TRadioServerError aError );
       
   119 	void SignalStrengthComplete( TRadioServerError aError, TInt aStrength );
       
   120 	void MaxSignalStrengthComplete( TRadioServerError aError, TInt aMaxStrength );
       
   121     void SquelchComplete( TRadioServerError aError, TBool aEnabled );
       
   122     void SetSquelchComplete( TRadioServerError aError );
       
   123 	void BufferFilled( TDes8& aBuffer );
       
   124 	void RadioEventAntennaStatusChange( TBool aAttached );
       
   125     void RadioEventTunerControlChange( TRadioServerError aError );
       
   126     // RDS
       
   127     void StationSeekByPTYComplete( TRadioServerError aError, TInt aFrequency );
       
   128     void StationSeekByTAComplete( TRadioServerError aError, TInt aFrequency );
       
   129     void StationSeekByTPComplete( TRadioServerError aError, TInt aFrequency );
       
   130 	void RdsDataPI( TInt aPi );
       
   131 	void RdsDataPTY( TRdsProgrammeType aPty );
       
   132 	void RdsDataPS( TRdsPSName& aPs );
       
   133 	void RdsDataRT( TRdsRadioText& aRt, RArray<TRdsRTplusTag>& aRTplusTags );
       
   134 	void RdsDataCT( TDateTime& aCt );
       
   135 	void RdsDataTA( TBool aTaOn );
       
   136 	void RdsSearchBeginAF();
       
   137 	void RdsSearchEndAF( TRadioServerError aError, TInt aFrequency );
       
   138 	void RdsEventSignalChange( TBool aSignal );
       
   139 
       
   140 	/**
       
   141 	 * From MDevSoundObserver
       
   142 	 * See SoundDevice.h for detailed description.
       
   143 	 * @since S60 3.0
       
   144 	 */
       
   145 	void InitializeComplete( TInt aError );
       
   146 	void ToneFinished( TInt aError );
       
   147 	void BufferToBeFilled( CMMFBuffer* aBuffer );
       
   148 	void PlayError( TInt aError );
       
   149 	void BufferToBeEmptied( CMMFBuffer* aBuffer );
       
   150 	void RecordError( TInt aError );
       
   151 	void ConvertError(  TInt aError );
       
   152 	void DeviceMessage( TUid aMessageType, const TDesC8& aMsg );
       
   153 	void SendEventToClient( const TMMFEvent& aEvent );
       
   154 
       
   155 	/**
       
   156 	 * From MCenRepNotifyHandlerCallback
       
   157 	 * See CenRepNotifyHandler.h for detailed description.
       
   158 	 * @since S60 3.0
       
   159 	 */
       
   160 	void HandleNotifyInt( TUint32 aId, TInt aNewValue );
       
   161 
       
   162 private:
       
   163 
       
   164 	/**
       
   165 	 * C++ default constructor.
       
   166 	 */
       
   167 	CRadioServer();
       
   168 
       
   169 	/**
       
   170 	 * By default Symbian 2nd phase constructor is private.
       
   171 	 */
       
   172 	void ConstructL();
       
   173 
       
   174 	/**
       
   175 	 * All asynchronous requests from the client are Q'ed and processed in order. This
       
   176 	 * function is called to process the next request in the Q.
       
   177 	 * @since S60 3.0
       
   178 	 * @param aRequest Request from the client
       
   179 	 */
       
   180 	void ProcessAsyncRequest( TRadioMessageRequestData* aRequest );
       
   181 
       
   182 	/**
       
   183 	 * Request for control of a tuner.
       
   184 	 * @since S60 3.2
       
   185 	 * @param Tuner type (e.g. FM, AM)
       
   186 	 */
       
   187 	void ProcessRequestTunerControl( TRsTuner aTuner );
       
   188 
       
   189 	/**
       
   190 	 * Request to set the frequency range.
       
   191 	 * @since S60 3.2
       
   192 	 * @param aRange Frequency range
       
   193 	 */
       
   194 	void ProcessSetFrequencyRange( TRsFrequencyRange aRange );
       
   195 
       
   196 	/**
       
   197 	 * Tunes the tuner to the specified frequency.
       
   198 	 * @since S60 3.0
       
   199 	 * @param aFrequency The frequency (Hz) to tune to
       
   200 	 */
       
   201 	void ProcessSetFrequency( TInt aFrequency );
       
   202 
       
   203 	/**
       
   204 	 * Finds a radio station, starting from current frequency and seaching in the
       
   205 	 * direction specified (i.e. up or down).
       
   206 	 * @since S60 3.0
       
   207 	 * @param aUpwards Search direction
       
   208 	 */
       
   209 	void ProcessStationSeek( TBool aUpwards );
       
   210 
       
   211 	/**
       
   212 	 * Starts playback of the tuner output.
       
   213 	 * @since S60 3.0
       
   214 	 */
       
   215 	void ProcessPlay();
       
   216 
       
   217 	/**
       
   218 	 * Stops playback, and release the output device for use by other clients.
       
   219 	 * @since S60 3.2
       
   220      * @param aIfOnlyPrimaryClient ETrue to stop playback only if there are no other primary clients
       
   221 	 */
       
   222 	void ProcessStop( TBool aIfOnlyPrimaryClient );
       
   223 
       
   224 	/**
       
   225      * Asynchronous request to find a radio station with the specified Programme Type(PTY).
       
   226      * @since S60 3.2
       
   227      * @param aPty The type of programme to search for.
       
   228      * @param aSeekUp The direction to search in. Searches upwards if set to ETrue.
       
   229      */
       
   230 	void ProcessStationSeekByPTY( TRsRdsProgrammeType aPty, TBool aSeekUp );
       
   231 
       
   232 	/**
       
   233      * Asynchronous request to find a radio station with Traffic Announcement(TA).
       
   234      * @since S60 3.2
       
   235      * @param aSeekUp The direction to search in. Searches upwards if set to ETrue.
       
   236      */
       
   237 	void ProcessStationSeekByTA( TBool aSeekUp );
       
   238 
       
   239 	/**
       
   240      * Asynchronous request to find a radio station with Traffic Programme(TP).
       
   241      * @since S60 3.2
       
   242      * @param aSeekUp The direction to search in. Searches upwards if set to ETrue.
       
   243      */
       
   244 	void ProcessStationSeekByTP( TBool aSeekUp );
       
   245 
       
   246 	/**
       
   247 	 * Indication that a session from primary client is being closed.
       
   248 	 * @since S60 3.2
       
   249 	 */
       
   250     TInt ProcessRemovePrimaryClientL( const RMessage2& aMessage );
       
   251 
       
   252 	/**
       
   253 	 * Get the capabilities of the radio on the device.
       
   254 	 * @since S60 3.2
       
   255 	 * @param aMessage Message containing client request and data
       
   256 	 * @return A standard system/RadioServer error code.
       
   257 	 */
       
   258 	TInt ProcessGetTunerCapabilities( const RMessage2& aMessage );
       
   259 
       
   260 	/**
       
   261 	 * Request to enabled tuner in offline mode (if supported by the adaptation).
       
   262 	 * @since S60 3.2
       
   263 	 * @param aEnable ETrue to enable tuner functions in offline mode, EFalse to disable.
       
   264 	 * @return A standard system error/RadioServer code.
       
   265 	 */
       
   266 	TInt ProcessEnableTunerInOfflineMode( TBool aEnable );
       
   267 
       
   268 	/**
       
   269 	 * Get the current frequency range. It also returns the minimum and maximum frequencies(Hz)
       
   270 	 * for the returned range.
       
   271 	 * @since S60 3.2
       
   272 	 * @param aMessage Message containing client request and data
       
   273 	 * @return A standard system error/RadioServer code.
       
   274 	 */
       
   275 	TInt ProcessGetFrequencyRange( const RMessage2& aMessage );
       
   276 
       
   277 	/**
       
   278 	 * Get the current frequency.
       
   279 	 * @since S60 3.2
       
   280 	 * @param aMessage Message containing client request and data
       
   281 	 * @return A standard system error/RadioServer code.
       
   282 	 */
       
   283 	TInt ProcessGetFrequency( const RMessage2& aMessage );
       
   284 
       
   285 	/**
       
   286 	 * Checks whether force mono reception is on or not.
       
   287 	 * @since S60 3.2
       
   288 	 * @param aMessage Message containing client request and data
       
   289 	 * @return A standard system error/RadioServer code.
       
   290 	 */
       
   291 	TInt ProcessGetForceMonoReception( const RMessage2& aMessage );
       
   292 
       
   293 	/**
       
   294 	 * Set the squelching flag.
       
   295 	 * @since S60 3.2
       
   296 	 * @param aEnabled ETrue to enable squelching, EFalse to disable it.
       
   297 	 * @return A standard system error/RadioServer code.
       
   298 	 */
       
   299 	TInt ProcessSetSquelch( TBool aEnabled );
       
   300 
       
   301 	/**
       
   302 	 * Get the squelch status.
       
   303 	 * @since S60 3.2
       
   304 	 * @param aMessage Message containing client request and data
       
   305 	 * @return A standard system error/RadioServer code.
       
   306 	 */
       
   307 	TInt ProcessGetSquelch( const RMessage2& aMessage );
       
   308 
       
   309 	/**
       
   310 	 * Some synchronous requests from the client are Q'ed and processed in order. This
       
   311 	 * function is called to process the next request in the Q.
       
   312 	 * @since S60 3.0
       
   313 	 * @param aRequest Request from the client
       
   314 	 */
       
   315 	void ProcessSyncRequest( TRadioMessageRequestData* aRequest );
       
   316 
       
   317 	/**
       
   318 	 * Retrieves the signal strength of the currently tuned signal.
       
   319 	 * @since S60 3.2
       
   320 	 */
       
   321 	void ProcessGetSignalStrength();
       
   322 
       
   323 	/**
       
   324 	 * Retrieves the maximum possible signal strength of a tuned signal.
       
   325 	 * @since S60 3.2
       
   326 	 */
       
   327 	void ProcessGetMaxSignalStrength();
       
   328 
       
   329 	/**
       
   330 	 * Finds out if the current signal is being received in stereo or not.
       
   331 	 * @since S60 3.0
       
   332 	 */
       
   333 	void ProcessGetStereoMode();
       
   334 
       
   335 	/**
       
   336 	 * Indicates whether the reception should be forced into monophonic mode.
       
   337 	 * @since S60 3.2
       
   338 	 * @param aForcedMono If ETrue, all reception will be in mono mode even if a stereo signal is
       
   339 	 *		 available. If EFalse, a stereo signal will be received when possible.
       
   340 	 */
       
   341 	void ProcessForceMonoReception( TBool aForcedMono );
       
   342 
       
   343 	/**
       
   344 	 * Get the player state.
       
   345 	 * @since S60 3.2
       
   346 	 * @param aMessage Message containing client request and data
       
   347 	 * @return A standard system error/RadioServer code.
       
   348 	 */
       
   349 	TInt ProcessGetPlayerState( const RMessage2& aMessage );
       
   350 
       
   351 	/**
       
   352 	 * Retrieves the maximum volume supported.
       
   353 	 * @since S60 3.0
       
   354 	 * @param aMessage Message containing client request and data
       
   355 	 * @return A standard system error/RadioServer code.
       
   356 	 */
       
   357 	TInt ProcessGetMaxVolume( const RMessage2& aMessage );
       
   358 
       
   359 	/**
       
   360 	 * Sets the volume to the specified level.
       
   361 	 * @since S60 3.0
       
   362 	 * @param aVolume The volume level to set
       
   363 	 * @return A standard system error/RadioServer code.
       
   364 	 */
       
   365 	TInt ProcessSetVolume( TInt aVolume );
       
   366 
       
   367 	/**
       
   368 	 * Retrieves the current volume.
       
   369 	 * @since S60 3.2
       
   370 	 * @param aMessage Message containing client request and data
       
   371 	 * @return A standard system error/RadioServer code.
       
   372 	 */
       
   373 	TInt ProcessGetVolume( const RMessage2& aMessage );
       
   374 
       
   375 	/**
       
   376 	 * Sets a volume ramp.
       
   377 	 * @since S60 3.0
       
   378 	 * @param aMessage Message containing client request and data
       
   379      * @return A standard system error/RadioServer code.
       
   380 	 */
       
   381 	TInt ProcessSetVolumeRamp( const RMessage2& aMessage );
       
   382 
       
   383 	/**
       
   384 	 * Mutes or unmutes playback.
       
   385 	 * @since S60 3.0
       
   386 	 * @param aMute ETrue to mute the audio, EFalse to unmute it.
       
   387 	 * @return A standard system error/RadioServer code.
       
   388 	 */
       
   389 	TInt ProcessSetMute( TBool aMute );
       
   390 
       
   391  	/**
       
   392 	 * Get mute status.
       
   393 	 * @since S60 3.2
       
   394 	 * @param aMessage Message containing client request and data
       
   395 	 * @return A standard system error/RadioServer code.
       
   396 	 */
       
   397 	TInt ProcessGetMuteStatus( const RMessage2& aMessage );
       
   398 
       
   399 	/**
       
   400 	 * Sets the stereo balance between left and right channels.
       
   401 	 * @since S60 3.2
       
   402      * @param aLeft Left speaker volume percentage. This value ranges from 0 to 100.
       
   403      * @param aRight Right speaker volume percentage. This value ranges from 0 to 100.
       
   404 
       
   405 	 * @return A standard system error/RadioServer code.
       
   406 	 */
       
   407 	TInt ProcessSetBalance( TInt aLeft, TInt aRight );
       
   408 
       
   409 	/**
       
   410 	 * Gets the stereo balance between left and right channels.
       
   411 	 * @since S60 3.0
       
   412 	 * @param aMessage Message containing client request and data
       
   413 	 * @return A standard system error/RadioServer code.
       
   414 	 */
       
   415 	TInt ProcessGetBalance( const RMessage2& aMessage );
       
   416 
       
   417 	/**
       
   418      * Gets the capabilities of the RDS control on the device.
       
   419      * @since S60 3.2
       
   420 	 * @param aMessage Message containing client request and data
       
   421 	 * @return A standard system error/RadioServer code.
       
   422      */
       
   423 	TInt ProcessGetRdsCapabilities( const RMessage2& aMessage );
       
   424 
       
   425 	/**
       
   426      * Gets the status of the RDS reception.
       
   427      * @since S60 3.2
       
   428 	 * @param aMessage Message containing client request and data
       
   429 	 * @return A standard system error/RadioServer code.
       
   430      */
       
   431 	TInt ProcessGetRdsSignalStatus( const RMessage2& aMessage );
       
   432 
       
   433 	/**
       
   434      * Subscribe for notification for the specified RDS data.
       
   435      * @since S60 3.2
       
   436 	 * @return A standard system error/RadioServer code.
       
   437      */
       
   438 	TInt ProcessNotifyRdsDataChange( const RMessage2& aMessage );
       
   439 
       
   440 	/**
       
   441 	 * Cancel NotifyRdsDataChange request.
       
   442      * @since S60 3.2
       
   443 	 * @param aMessage Message containing client request and data
       
   444 	 * @return A standard system error/RadioServer code.
       
   445      */
       
   446 	TInt ProcessCancelNotifyRdsDataChange( const RMessage2& aMessage );
       
   447 
       
   448 	/**
       
   449      * Turn on/off automatic switching of frequency based on Alternate Frequency.
       
   450      * @since S60 3.2
       
   451      * @param aAuto ETrue to turn automatic switching on, EFalse to turn it off.
       
   452 	 * @return A standard system error/RadioServer code.
       
   453      */
       
   454 	TInt ProcessSetAutomaticSwitching( TBool aAuto );
       
   455 
       
   456 	/**
       
   457      * Find out whether automatic switching is on or off.
       
   458      * @since S60 3.2
       
   459 	 * @param aMessage Message containing client request and data
       
   460 	 * @return A standard system error/RadioServer code.
       
   461      */
       
   462 	TInt ProcessGetAutomaticSwitching( const RMessage2& aMessage );
       
   463 
       
   464 	/**
       
   465      * Cancel ongoing search for an Alternate Frequency (AF) with stronger signal.
       
   466      * @since S60 3.2
       
   467 	 * @param aMessage Message containing client request and data
       
   468 	 * @return A standard system error/RadioServer code.
       
   469      */
       
   470 	TInt ProcessCancelAFSearch();
       
   471 
       
   472 	/**
       
   473      * Get the current Programme Identification code.
       
   474      * @since S60 3.2
       
   475 	 * @param aMessage Message containing client request and data
       
   476 	 * @return A standard system error/RadioServer code.
       
   477      */
       
   478 	TInt ProcessGetProgrammeIdentification( const RMessage2& aMessage );
       
   479 
       
   480 	/**
       
   481      * Get the current Programme Type.
       
   482      * @since S60 3.2
       
   483 	 * @param aMessage Message containing client request and data
       
   484 	 * @return A standard system error/RadioServer code.
       
   485      */
       
   486 	TInt ProcessGetProgrammeType( const RMessage2& aMessage );
       
   487 
       
   488 	/**
       
   489      * Get the current Programme Service name.
       
   490      * @since S60 3.2
       
   491 	 * @param aMessage Message containing client request and data
       
   492 	 * @return A standard system error/RadioServer code.
       
   493      */
       
   494 	TInt ProcessGetProgrammeService( const RMessage2& aMessage );
       
   495 
       
   496 	/**
       
   497      * Get the current Radio Text.
       
   498      * @since S60 3.2
       
   499 	 * @param aMessage Message containing client request and data
       
   500 	 * @return A standard system error/RadioServer code.
       
   501      */
       
   502 	TInt ProcessGetRadioText( const RMessage2& aMessage );
       
   503 
       
   504 	/**
       
   505      * Get the current Radio Text+.
       
   506      * @since S60 3.2
       
   507 	 * @param aMessage Message containing client request and data
       
   508 	 * @return A standard system error/RadioServer code.
       
   509      */
       
   510 	TInt ProcessGetRadioTextPlus( const RMessage2& aMessage );
       
   511 
       
   512 	/**
       
   513      * Get the current Clock Time and date.
       
   514      * @since S60 3.2
       
   515 	 * @param aMessage Message containing client request and data
       
   516 	 * @return A standard system error/RadioServer code.
       
   517      */
       
   518 	TInt ProcessGetClockTime( const RMessage2& aMessage );
       
   519 
       
   520 	/**
       
   521      * Get Traffic Announcement status at the current station.
       
   522      * @since S60 3.2
       
   523 	 * @param aMessage Message containing client request and data
       
   524 	 * @return A standard system error/RadioServer code.
       
   525      */
       
   526 	TInt ProcessGetTrafficAnnouncementStatus( const RMessage2& aMessage );
       
   527 
       
   528 	/**
       
   529      * Get Traffic Programme status at the current station.
       
   530      * @since S60 3.2
       
   531 	 * @param aMessage Message containing client request and data
       
   532 	 * @return A standard system error/RadioServer code.
       
   533      */
       
   534 	TInt ProcessGetTrafficProgrammeStatus( const RMessage2& aMessage );
       
   535 
       
   536 	/**
       
   537 	 * Completes the outstanding asynchronous message with aError and processes the next
       
   538 	 * message in the queue, if any.
       
   539 	 * @since S60 3.2
       
   540 	 * @param aError A standard system/RadioServer error code
       
   541 	 */
       
   542 	void CompleteAsyncRequest( TInt aError );
       
   543 
       
   544 	/**
       
   545 	 * Completes the outstanding synchronous message with aError and processes the next
       
   546 	 * message in the queue, if any.
       
   547 	 * @since S60 3.2
       
   548 	 * @param aError A standard system/RadioServer error code
       
   549 	 */
       
   550 	void CompleteSyncRequest( TInt aError );
       
   551 
       
   552 	/**
       
   553 	 * Request has been cancelled. Delete the request from the queue, if found.
       
   554 	 * @since S60 3.0
       
   555 	 * @param aQue Request queue
       
   556 	 * @param aMessageType Request to be deleted
       
   557 	 */
       
   558 	void RemoveFromQueue( TSglQue<TRadioMessageRequestData>& aQue, TRadioServerRequest aMessageType );
       
   559 
       
   560 	/**
       
   561 	 * Check if another request exists in the queue. If so, process the request.
       
   562 	 * @since S60 3.0
       
   563 	 * @param aQue Request queue
       
   564 	 */
       
   565 	void ProcessNextItemInQueue( TSglQue<TRadioMessageRequestData>& aQue );
       
   566 
       
   567     /**
       
   568      * Clears all outstanding requests in RadioServer owned Qs.
       
   569      * @since S60 3.2
       
   570      */
       
   571 	void ClearQueue();
       
   572 
       
   573     /**
       
   574      * Check to see if radio is allowed in offline mode.
       
   575      * @since S60 3.2
       
   576      */
       
   577 	TBool AllowRadioInOfflineMode();
       
   578 
       
   579     /**
       
   580      * Gets the current frequency range.
       
   581      *
       
   582      * @since S60 3.2
       
   583      * @param aRange On return contains the current frequency range.
       
   584      * @param aMinFreq On return contains the minimum frequency for the current frequency range.
       
   585      * @param aMaxFreq On return contains the maximum frequency for the current frequency range.
       
   586      * @return A standard system/RadioServer error code
       
   587      */
       
   588     TInt GetFrequencyRange( TRsFrequencyRange& aRange, TInt& aMinFreq, TInt& aMaxFreq ) const;
       
   589 
       
   590     /**
       
   591      * Converts RadioServer range to Tuner control range.
       
   592      * @since S60 3.2
       
   593      */
       
   594 	TFMRadioFrequencyRange TunerControlFreqRange( TRsFrequencyRange aRange );
       
   595 
       
   596     /**
       
   597      * Configures DevSound and initiates playback.
       
   598      * @since S60 3.2
       
   599      */
       
   600 	void DoPlayL();
       
   601 
       
   602     /**
       
   603      * AK - temporary until adaptation fix is available (CPHU-73YTQW)
       
   604      */
       
   605 	void RecreateFmTunerControl();
       
   606 
       
   607     /**
       
   608      * Add client ID to array.
       
   609      *
       
   610      * @since S60 3.2
       
   611      * @param aClientId client id.
       
   612      */
       
   613     void AddRdsNotifyClientId( TUint aClientId );
       
   614 
       
   615     /**
       
   616      * Remove client ID from array.
       
   617      *
       
   618      * @since S60 3.2
       
   619      * @param aClientId client id.
       
   620      */
       
   621     void RemoveRdsNotifyClientId( TUint aClientId );
       
   622 
       
   623     /**
       
   624      * Sets the TSP target client type based on the state of the player.
       
   625      *
       
   626      * @param aPlayerTargetState The target state of the player.
       
   627      * @since S60 3.2
       
   628      */
       
   629     void SetTspTargetClient( TRsPlayerState aPlayerTargetState );
       
   630 
       
   631     /**
       
   632      * Register client's PID
       
   633      *
       
   634      * @param aMessage Message containing client request and data
       
   635      * @since S60 3.2
       
   636      */
       
   637     void RegisterClientPidL( const RMessage2& aMessage );
       
   638 private:    // Data
       
   639 
       
   640 	enum TServerState
       
   641 		{
       
   642 		EStateStarted,
       
   643 		EStateTunerOn,
       
   644 		EStateTunerOff,
       
   645 		EStatePlaying,
       
   646 		EStateShutdown
       
   647 		};
       
   648 
       
   649 	enum TTunerOnTrigger
       
   650 		{
       
   651 		ETriggerTunerControl,
       
   652 		ETriggerSetFrequency,
       
   653 		ETriggerSetFrequencyRange,
       
   654 		ETriggerPlay,
       
   655 		ETriggerAntenna,
       
   656 		ETriggerTransmitter,
       
   657 		ETriggerOffline
       
   658 		};
       
   659 
       
   660 	enum TServerChannel
       
   661 		{
       
   662 		EChannelMono,
       
   663 		EChannelStereo,
       
   664 		EChannelBoth
       
   665 		};
       
   666 
       
   667 	// Server state
       
   668 	TServerState iState;
       
   669 	// Total number of active sessions
       
   670 	TInt iSessionCount;
       
   671 	// Number of active sessions from primary clients
       
   672 	TInt iSessionCountPrimary;
       
   673 	// Request which triggered TunerOn
       
   674 	TTunerOnTrigger iTunerOnTrigger;
       
   675 
       
   676 	// Delayed shutdown timer
       
   677 	CRadioServerShutdown* iShutdownTimer;
       
   678 	// Radio settings
       
   679 	CRadioServerSettings* iSettings;
       
   680 	// Tuner control observer handler
       
   681 	CRadioServerFMTuner* iTunerControlObserver;
       
   682 
       
   683 	// Tuner control adaptation
       
   684 	CFMRadioTunerControl* iTunerControl;
       
   685 	// Tuner control capabilities
       
   686 	TFMRadioCapabilities iTunerCaps;
       
   687 	// RDS control adaptation
       
   688 	MRdsControl* iRdsControl;
       
   689 	// RDS control capabilities
       
   690 	TRdsCapabilities iRdsCaps;
       
   691 
       
   692 	// DevSound
       
   693 	CMMFDevSound* iDevSound;
       
   694 	// Max volume supported by DevSound
       
   695 	TInt iMaxVolume;
       
   696 	// Central repository
       
   697 	CRepository* iRepository;
       
   698 	// Central repository notify handler
       
   699 	CCenRepNotifyHandler* iCenRepNotifyHandler;
       
   700 
       
   701 	// Queue for asynchronous requests
       
   702 	TSglQue<TRadioMessageRequestData> iAsyncRequestQue;
       
   703 	// Outstanding asynchronous request
       
   704 	TRadioMessageRequestData* iAsyncRequest;
       
   705 
       
   706 	// Queue for synchronous requests
       
   707 	TSglQue<TRadioMessageRequestData> iSyncRequestQue;
       
   708 	// Outstanding synchronous request
       
   709 	TRadioMessageRequestData* iSyncRequest;
       
   710 
       
   711 	// Max signal strength supported by the tuner
       
   712 	TInt iMaxSigStrength;
       
   713 	// Enable tuner functions when the device is in offline mode
       
   714 	TBool iEnableTunerInOffline;
       
   715 	// Temporary holder for frequency range
       
   716 	TRsFrequencyRange iFreqRange;
       
   717 	// Internal squelching indicator while seeking
       
   718 	TBool iSquelch;
       
   719 	// DevSound configuration
       
   720 	TMMFCapabilities iDevSoundConfig;
       
   721 	// Number of channels supported, i.e. Stereo/Mono
       
   722 
       
   723 	TServerChannel iChannels;
       
   724 	// Wait for Play - we've been pre-empted
       
   725 	TBool iPreEmpted;
       
   726 	// RDS notify request counter
       
   727 	TInt iRdsNotifyCount;
       
   728 	// Array to keep track of clients requesting to be notified of RDS Data
       
   729 	RArray<TUint> iRdsNotifyClientIdArray;
       
   730 
       
   731 #ifdef RD_TSP_CLIENT_MAPPER
       
   732     // Process Id of the client
       
   733     TProcessId iProcessId;
       
   734     CTspClientMapper* iMapper;
       
   735     CTspClientMapper::TTspClientMappingType iTspState;
       
   736     RMessage2 iMessageTsp;
       
   737     RArray<TProcessId> iClientPids;
       
   738 #endif // RD_TSP_CLIENT_MAPPER
       
   739 private:    // Friend classes
       
   740 	friend class CRadioServerSession;
       
   741     };
       
   742 
       
   743 #endif      // RADIOSERVER_H
       
   744 
       
   745 // End of File