--- a/fmradio/activeidleengine/bwins/fmradioactiveidleengine200u.def Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-EXPORTS
- ?FrequencyDecimalCount@CFMRadioActiveIdleEngine@@QBE?AW4TFMRadioPSFrequencyDecimalCount@@XZ @ 1 NONAME ; enum TFMRadioPSFrequencyDecimalCount CFMRadioActiveIdleEngine::FrequencyDecimalCount(void) const
- ?SetMuteState@CFMRadioActiveIdleEngine@@QBEXW4TFMRadioPSRadioMuteState@@@Z @ 2 NONAME ; void CFMRadioActiveIdleEngine::SetMuteState(enum TFMRadioPSRadioMuteState) const
- ?Channel@CFMRadioActiveIdleEngine@@QBEHXZ @ 3 NONAME ; int CFMRadioActiveIdleEngine::Channel(void) const
- ??1CFMRadioActiveIdleEngine@@UAE@XZ @ 4 NONAME ; CFMRadioActiveIdleEngine::~CFMRadioActiveIdleEngine(void)
- ?Cancel@CFMRadioActiveIdleEngine@@QAEXXZ @ 5 NONAME ; void CFMRadioActiveIdleEngine::Cancel(void)
- ?ApplicationRunningState@CFMRadioActiveIdleEngine@@QBE?AW4TFMRadioPSApplicationRunningState@@XZ @ 6 NONAME ; enum TFMRadioPSApplicationRunningState CFMRadioActiveIdleEngine::ApplicationRunningState(void) const
- ?AdjustRadioVolume@CFMRadioActiveIdleEngine@@QBEXW4TFMRadioPSAdjustVolume@@@Z @ 7 NONAME ; void CFMRadioActiveIdleEngine::AdjustRadioVolume(enum TFMRadioPSAdjustVolume) const
- ?MuteState@CFMRadioActiveIdleEngine@@QBE?AW4TFMRadioPSRadioMuteState@@XZ @ 8 NONAME ; enum TFMRadioPSRadioMuteState CFMRadioActiveIdleEngine::MuteState(void) const
- ?ChannelName@CFMRadioActiveIdleEngine@@QBEABVTDesC16@@XZ @ 9 NONAME ; class TDesC16 const & CFMRadioActiveIdleEngine::ChannelName(void) const
- ?TuningState@CFMRadioActiveIdleEngine@@QBE?AW4TFMRadioPSTuningState@@XZ @ 10 NONAME ; enum TFMRadioPSTuningState CFMRadioActiveIdleEngine::TuningState(void) const
- ?NewL@CFMRadioActiveIdleEngine@@SAPAV1@AAVMFMRadioActiveIdleEngineNotifyHandler@@@Z @ 11 NONAME ; class CFMRadioActiveIdleEngine * CFMRadioActiveIdleEngine::NewL(class MFMRadioActiveIdleEngineNotifyHandler &)
- ?PowerState@CFMRadioActiveIdleEngine@@QBE?AW4TFMRadioPSRadioPowerState@@XZ @ 12 NONAME ; enum TFMRadioPSRadioPowerState CFMRadioActiveIdleEngine::PowerState(void) const
- ?AntennaStatus@CFMRadioActiveIdleEngine@@QBE?AW4TFMRadioPSHeadsetStatus@@XZ @ 13 NONAME ; enum TFMRadioPSHeadsetStatus CFMRadioActiveIdleEngine::AntennaStatus(void) const
- ?Frequency@CFMRadioActiveIdleEngine@@QBEHXZ @ 14 NONAME ; int CFMRadioActiveIdleEngine::Frequency(void) const
- ?RDSProgramService@CFMRadioActiveIdleEngine@@QBEABVTDesC16@@XZ @ 15 NONAME ; class TDesC16 const & CFMRadioActiveIdleEngine::RDSProgramService(void) const
- ?RadioVolume@CFMRadioActiveIdleEngine@@QBEHXZ @ 16 NONAME ; int CFMRadioActiveIdleEngine::RadioVolume(void) const
- ?ActivateL@CFMRadioActiveIdleEngine@@QAEXXZ @ 17 NONAME ; void CFMRadioActiveIdleEngine::ActivateL(void)
-
--- a/fmradio/activeidleengine/eabi/fmradioactiveidleengine200u.def Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-EXPORTS
- _ZN24CFMRadioActiveIdleEngine4NewLER37MFMRadioActiveIdleEngineNotifyHandler @ 1 NONAME
- _ZN24CFMRadioActiveIdleEngine6CancelEv @ 2 NONAME
- _ZN24CFMRadioActiveIdleEngine9ActivateLEv @ 3 NONAME
- _ZN24CFMRadioActiveIdleEngineD0Ev @ 4 NONAME
- _ZN24CFMRadioActiveIdleEngineD1Ev @ 5 NONAME
- _ZN24CFMRadioActiveIdleEngineD2Ev @ 6 NONAME
- _ZNK24CFMRadioActiveIdleEngine10PowerStateEv @ 7 NONAME
- _ZNK24CFMRadioActiveIdleEngine11ChannelNameEv @ 8 NONAME
- _ZNK24CFMRadioActiveIdleEngine11RadioVolumeEv @ 9 NONAME
- _ZNK24CFMRadioActiveIdleEngine11TuningStateEv @ 10 NONAME
- _ZNK24CFMRadioActiveIdleEngine12SetMuteStateE24TFMRadioPSRadioMuteState @ 11 NONAME
- _ZNK24CFMRadioActiveIdleEngine13AntennaStatusEv @ 12 NONAME
- _ZNK24CFMRadioActiveIdleEngine17AdjustRadioVolumeE22TFMRadioPSAdjustVolume @ 13 NONAME
- _ZNK24CFMRadioActiveIdleEngine17RDSProgramServiceEv @ 14 NONAME
- _ZNK24CFMRadioActiveIdleEngine21FrequencyDecimalCountEv @ 15 NONAME
- _ZNK24CFMRadioActiveIdleEngine23ApplicationRunningStateEv @ 16 NONAME
- _ZNK24CFMRadioActiveIdleEngine7ChannelEv @ 17 NONAME
- _ZNK24CFMRadioActiveIdleEngine9FrequencyEv @ 18 NONAME
- _ZNK24CFMRadioActiveIdleEngine9MuteStateEv @ 19 NONAME
- _ZTI24CFMRadioPropertyObserver @ 20 NONAME ; #<TI>#
- _ZTV24CFMRadioPropertyObserver @ 21 NONAME ; #<VT>#
-
--- a/fmradio/activeidleengine/group/bld.inf Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Build configuration for FMRadio active idle engine
-*
-*/
-
-#include <platform_paths.hrh>
-
-// Platforms the component needs to be built on
-//
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-fmradioactiveidleengine.mmp
-
-
-
-// End of file
--- a/fmradio/activeidleengine/group/fmradioactiveidleengine.mmp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project FMRadio active idle engine
-*
-*/
-
-
-// To get the APP_LAYER_SYSTEMINCLUDE-definition
-#include <platform_paths.hrh>
-#include "../../inc/fmradioactiveidle.hrh"
-
-TARGET fmradioactiveidleengine200.dll
-TARGETTYPE DLL
-UID 0x1000006C AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_FMRADIOPLUGIN
-VERSION 20.0
-
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-PAGED
-
-SOURCEPATH ../src
-SOURCE fmradioactiveidleengine.cpp
-
-SOURCEPATH ../../fmradioengine/src
-SOURCE fmradiopropertyobserver.cpp
-
-USERINCLUDE ../inc
-USERINCLUDE ../../fmradioengine/inc
-
-// Default system include paths for application layer modules.
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY euser.lib
-DEBUGLIBRARY flogger.lib
\ No newline at end of file
--- a/fmradio/activeidleengine/inc/fmradioactiveidleengine.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Engine component for FMRadio Active Idle plugin.
-*
-*/
-
-
-#ifndef __FMRADIOACTIVEIDLEENGINE_H__
-#define __FMRADIOACTIVEIDLEENGINE_H__
-
-#include <e32base.h>
-#include <fmradiointernalpskeys.h>
-
-#include "fmradiopropertyobserver.h"
-
-class MFMRadioActiveIdleEngineNotifyHandler;
-
-
-/**
-* Engine component for FMRadio Active Idle plugin.
-*
-* This class is responsible for listening to relevant P&S keys and notifying the UI code whenever the listened keys change.
-* The actual listening is done by multiple CFMRadioPropertyObserver objects.
-*
-* @lib fmradioactiveidleengine200.lib
-*
-*/
-NONSHARABLE_CLASS(CFMRadioActiveIdleEngine) : public CBase, public MFMRadioPropertyChangeObserver
- {
- public:
-
- /**
- * Static constructor.
- * @param aObserver The observer to be notified of the changes in the keys.
- * @return The newly created CFMRadioActiveIdleEngine object.
- */
- IMPORT_C static CFMRadioActiveIdleEngine* NewL( MFMRadioActiveIdleEngineNotifyHandler& aObserver );
-
- /**
- * Destructor.
- */
- IMPORT_C ~CFMRadioActiveIdleEngine();
-
- /**
- * Activates subscription to P&S keys if not already active.
- * Must be called after CFMRadioActiveIdleEngine::NewL, or after Cancel.
- */
- IMPORT_C void ActivateL();
-
- /**
- * Stops subscribing to P&S keys.
- */
- IMPORT_C void Cancel();
-
- /**
- * Returns the current volume level of the radio.
- * @return The current volume level of the radio.
- */
- IMPORT_C TInt RadioVolume() const;
-
- /**
- * Sets the radio volume.
- * @param aVolume The radio volume to set.
- */
- IMPORT_C void AdjustRadioVolume( TFMRadioPSAdjustVolume aVolume ) const;
-
- /**
- * Returns the current tuning state.
- * @return The current tuning state.
- */
- IMPORT_C TFMRadioPSTuningState TuningState() const;
-
- /**
- * Returns the current frequency.
- * @return The current frequency.
- */
- IMPORT_C TInt Frequency() const;
-
- /**
- * Returns the current channel ID.
- * @return The current channel ID.
- */
- IMPORT_C TInt Channel() const;
-
- /**
- * Returns the current channel name.
- * @return The current channel name.
- */
- IMPORT_C const TDesC& ChannelName() const;
-
- /**
- * Returns the current mute state.
- * @return The current mute state.
- */
- IMPORT_C TFMRadioPSRadioMuteState MuteState() const;
-
- /**
- * Sets the mute state.
- * @param aMuteState The mute state to set.
- */
- IMPORT_C void SetMuteState( TFMRadioPSRadioMuteState aMuteState ) const;
-
- /**
- * Returns the antenna's current connectivity status.
- * @return The antenna's current connectivity status.
- */
- IMPORT_C TFMRadioPSHeadsetStatus AntennaStatus() const;
-
- /**
- * Returns the current frequency decimal count.
- * @return The current frequency decimal count.
- */
- IMPORT_C TFMRadioPSFrequencyDecimalCount FrequencyDecimalCount() const;
-
- /**
- * Returns FM Radio application's running state.
- * @return Application's running state.
- */
- IMPORT_C TFMRadioPSApplicationRunningState ApplicationRunningState() const;
-
- /**
- * Returns the radio's power state.
- * @return The power state.
- */
- IMPORT_C TFMRadioPSRadioPowerState PowerState() const;
-
- /**
- * Returns the RDS Program Service information.
- * @return RDS Program Service.
- */
- IMPORT_C const TDesC& RDSProgramService() const;
-
- protected:
-
- // from base class MFMRadioPropertyChangeObserver
- void HandlePropertyChangeL( const TUid& aCategory, TUint aKey, TInt aValue );
- void HandlePropertyChangeL( const TUid& aCategory, TUint aKey, const TDesC8& aValue );
- void HandlePropertyChangeL( const TUid& aCategory, TUint aKey, const TDesC& aValue );
- void HandlePropertyChangeErrorL( const TUid& aCategory, TUint aKey, TInt aError );
-
- private:
-
- /**
- * Constructor.
- * @param aObserver The observer to be notified of the changes in the keys.
- */
- CFMRadioActiveIdleEngine( MFMRadioActiveIdleEngineNotifyHandler& aObserver );
-
- /**
- * Second-phase constructor.
- */
- void ConstructL();
-
- protected:
-
- /** The observer to be notified of the changes in the listened keys. */
- MFMRadioActiveIdleEngineNotifyHandler& iObserver;
- /** Array of status observers. */
- RPointerArray<CFMRadioPropertyObserver> iPropertyObserverArray;
-
- private:
-
- };
-
-#endif //__FMRADIOACTIVEIDLEENGINE_H__
--- a/fmradio/activeidleengine/inc/fmradioactiveidleenginenotifyhandler.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Observer interface for active idle engine
-*
-*/
-
-
-#ifndef __FMRADIOACTIVEIDLEENGINENOTIFYHANDLER_H__
-#define __FMRADIOACTIVEIDLEENGINENOTIFYHANDLER_H__
-
-#include <fmradiointernalpskeys.h>
-
-/**
-* Observer interface for active idle engine.
-* The observer is notified about the changes in relevant keys through this interface.
-*/
-NONSHARABLE_CLASS(MFMRadioActiveIdleEngineNotifyHandler)
- {
- public:
-
- /**
- * Invoked when the radio volume has changed.
- * @param aVolume The new radio volume.
- */
- virtual void HandleRadioVolumeChangeL( TInt aVolume ) = 0;
-
- /**
- * Invoked when tuning has taken more than one second, or tuning was previously on, but now completed.
- * @param aTuningState The new tuning state.
- */
- virtual void HandleTuningStateChangeL( TFMRadioPSTuningState aTuningState ) = 0;
-
- /**
- * Invoked when a new channel has been tuned into.
- * @param aIndex The index of the channel.
- */
- virtual void HandleChannelChangeL( TInt aIndex ) = 0;
-
- /**
- * Invoked when a channel has been modifed.
- * @param aIndex The index of the channel that was modified.
- */
- virtual void HandleChannelModifyL( TInt aIndex ) = 0;
-
- /**
- * Invoked when the frequency has changed.
- * @param aFrequency The new frequency.
- */
- virtual void HandleFrequencyChangeL( TInt aFrequency ) = 0;
-
- /**
- * Invoked when the muting state has changed.
- * @param aMuteState The new mute state.
- */
- virtual void HandleMuteStateChangeL( TFMRadioPSRadioMuteState aMuteState ) = 0;
-
- /**
- * Invoked when the application's running state has changed.
- * @param aRunningState The new running state.
- */
- virtual void HandleApplicationRunningStateChangeL( TFMRadioPSApplicationRunningState aRunningState ) = 0;
-
- /**
- * Invoked when the used decimal count is changed.
- * @param aDecimalCount The new decimal count.
- */
- virtual void HandleFrequencyDecimalCountChangeL( TFMRadioPSFrequencyDecimalCount aDecimalCount ) = 0;
-
- /**
- * Invoked when the antenna's connectivity status is changed.
- * @param aAntennaStatus Antenna's new connectivity status.
- */
- virtual void HandleAntennaStatusChangeL( TFMRadioPSHeadsetStatus aAntennaStatus ) = 0;
-
- /**
- * Invoked when radio's power state changes.
- * @param aPowerState The new power state.
- */
- virtual void HandlePowerStateChangeL( TFMRadioPSRadioPowerState aPowerState ) = 0;
-
- /**
- * Invoked when RDS Program Service information changes.
- * @param aProgramService New Program Service info.
- */
- virtual void HandleRDSProgramServiceChangeL( const TDesC& aProgramService ) = 0;
-
- /**
- * Invoked when RDS Text information changes.
- * @param aRdsText New Program Service info.
- */
- virtual void HandleRDSRadioTextChangeL( const TDesC& aRdsText ) = 0;
-
- /**
- * Invoked when Channel name changes.
- * @param aName New channel name.
- */
- virtual void HandleChannelNameChangeL( const TDesC& aName ) = 0;
-
- virtual void HandlePresetListCountChangeL( TInt aPresetCount ) = 0;
- virtual void HandlePresetListFocusChangeL( TInt aPresetFocus ) = 0;
- };
-
-#endif // __FMRADIOACTIVEIDLEENGINENOTIFYHANDLER_H__
-
--- a/fmradio/activeidleengine/src/fmradioactiveidleengine.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,386 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: FMRadio active idle engine
-*
-*/
-
-
-#include <e32std.h>
-
-#include "fmradioactiveidleengine.h"
-#include "fmradioactiveidleenginenotifyhandler.h"
-
-
-/**
-* Listing of the subscribed P&S values.
-* Changing the order of this enumeration requires changes to CFMRadioActiveIdleEngine::ConstructL as well.
-*/
-
-enum TFMRadioActiveIdleStatusObserverArray
- {
- //EFMRadioActiveIdleRadioVolumeObserver, /**< Index of the radio volume observer. */
- EFMRadioActiveIdleTuningStateObserver, /**< Index of the tuning state observer. */
- EFMRadioActiveIdleFrequencyObserver, /**< Index of the current frequency observer. */
- EFMRadioActiveIdleChannelChangeObserver, /**< Index of the current channel observer. */
- EFMRadioActiveIdleChannelModifyObserver, /**< Index of the channel modified observer. */
- EFMRadioActiveIdleMuteStateObserver, /**< Index of the muting state observer. */
- EFMRadioActiveIdleApplicationObserver, /**< Index of the FM Radio application observer used to observer whether the application is running or not. */
- EFMRadioActiveIdleHeadsetStatusObserver, /**< Index of the antenna status observer. */
- EFMRadioActiveIdleDecimalCountObserver, /**< Index of the frequency decimal count observer. */
- EFMRadioActiveIdlePowerStateObserver, /**< Index of the power state observer. */
- EFMRadioActiveIdleRDSProgramServiceObserver, /**< Index of the RDS Program Service observer. */
- EFMRadioPSDataRDSRadioText,
- EFMRadioPSDataChannelName,
- EFMRadioActiveIdlePresetListCountObserver, /**< Index of the active preset list count observer */
- EFMRadioActiveIdlePresetListFocusObserver /**< Index of the active preset list focus observer */
- };
-
-// ==================== LOCAL FUNCTIONS ====================
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------------------------
-// Constructor.
-// ---------------------------------------------------------------------------
-//
-CFMRadioActiveIdleEngine::CFMRadioActiveIdleEngine( MFMRadioActiveIdleEngineNotifyHandler& aObserver )
- : iObserver( aObserver )
- {
- }
-
-// ---------------------------------------------------------------------------
-// Second-phase constructor.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioActiveIdleEngine::ConstructL()
- {
- //User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioEnginePSUid, KFMRadioPSDataVolume, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataTuningState, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataFrequency, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataChannel, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataChannelDataChanged, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataRadioMuteState, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataApplicationRunning, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataHeadsetStatus, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataFrequencyDecimalCount, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataRadioPowerState, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataRDSProgramService, CFMRadioPropertyObserver::EFMRadioPropertyText ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataRDSRadioText, CFMRadioPropertyObserver::EFMRadioPropertyText ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioPSDataChannelName, CFMRadioPropertyObserver::EFMRadioPropertyText ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioActiveIdlePresetListCount, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- User::LeaveIfError( iPropertyObserverArray.Append( CFMRadioPropertyObserver::NewL( *this, KFMRadioPSUid, KFMRadioActiveIdlePresetListFocus, CFMRadioPropertyObserver::EFMRadioPropertyInt ) ) );
- }
-
-// ---------------------------------------------------------------------------
-// Makes all pubsub objects to subscribe.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioActiveIdleEngine::ActivateL()
- {
- for ( TInt i = 0; i < iPropertyObserverArray.Count(); i++ )
- {
- iPropertyObserverArray[i]->ActivateL();
- }
- }
-
-// ---------------------------------------------------------------------------
-// Cancels all pubsub objects.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioActiveIdleEngine::Cancel()
- {
- for ( TInt i = 0; i < iPropertyObserverArray.Count(); i++ )
- {
- iPropertyObserverArray[i]->Cancel();
- }
- }
-
-// ---------------------------------------------------------------------------
-// Static constructor.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CFMRadioActiveIdleEngine* CFMRadioActiveIdleEngine::NewL( MFMRadioActiveIdleEngineNotifyHandler& aObserver )
- {
- CFMRadioActiveIdleEngine* self = new ( ELeave ) CFMRadioActiveIdleEngine( aObserver );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CFMRadioActiveIdleEngine::~CFMRadioActiveIdleEngine()
- {
- iPropertyObserverArray.ResetAndDestroy();
- iPropertyObserverArray.Close();
- /*
- if ( iServ )
- {
- iServ->Close();
- }
- delete iServ;
- */
- }
-
-// ---------------------------------------------------------------------------
-// Invoked when a listened integer P&S key is changed.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioActiveIdleEngine::HandlePropertyChangeL( const TUid& aCategory, TUint aKey, TInt aValue )
- {
- if ( aCategory == KFMRadioPSUid )
- {
- switch ( aKey )
- {/*
- case KFMRadioPSDataVolume:
- iObserver.HandleRadioVolumeChangeL( aValue );
- break;*/
-
- case KFMRadioPSDataTuningState:
- iObserver.HandleTuningStateChangeL( static_cast<TFMRadioPSTuningState>( aValue ) );
- break;
-
- case KFMRadioPSDataFrequency:
- iObserver.HandleFrequencyChangeL( aValue );
- break;
-
- case KFMRadioPSDataChannel:
- // Sync the cache values for channel name and index
- iPropertyObserverArray[EFMRadioPSDataChannelName]->ValueDes( ETrue );
- iObserver.HandleChannelChangeL( aValue );
- break;
-
- case KFMRadioPSDataChannelDataChanged:
- iPropertyObserverArray[EFMRadioPSDataChannelName]->ValueDes( ETrue );
- iObserver.HandleChannelModifyL( aValue );
- break;
-
- case KFMRadioPSDataRadioMuteState:
- iObserver.HandleMuteStateChangeL( static_cast<TFMRadioPSRadioMuteState>( aValue ) );
- break;
-
- case KFMRadioPSDataApplicationRunning:
- iObserver.HandleApplicationRunningStateChangeL( static_cast<TFMRadioPSApplicationRunningState>( aValue ) );
- break;
-
- case KFMRadioPSDataHeadsetStatus:
- iObserver.HandleAntennaStatusChangeL( static_cast<TFMRadioPSHeadsetStatus>( aValue ) );
- break;
-
- case KFMRadioPSDataFrequencyDecimalCount:
- iObserver.HandleFrequencyDecimalCountChangeL( static_cast<TFMRadioPSFrequencyDecimalCount>( aValue ) );
- break;
-
- case KFMRadioPSDataRadioPowerState:
- iObserver.HandlePowerStateChangeL( static_cast<TFMRadioPSRadioPowerState>( aValue ) );
- break;
-
- case KFMRadioActiveIdlePresetListCount:
- iObserver.HandlePresetListCountChangeL( aValue );
- break;
-
- case KFMRadioActiveIdlePresetListFocus:
- //iObserver.HandlePresetListFocusChangeL( aValue );
- break;
-
- default:
- break;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Invoked when a listened byte array P&S key is changed.
-// ---------------------------------------------------------------------------
-//
-//void CFMRadioActiveIdleEngine::HandlePropertyChangeL( const TUid& /*aCategory*/, TUint /*aKey*/, const TDesC8& /*aValue*/ )
-// {
-// }
-
-// ---------------------------------------------------------------------------
-// Invoked when a listened text P&S key is changed.
-// ---------------------------------------------------------------------------
-//
-
-void CFMRadioActiveIdleEngine::HandlePropertyChangeL( const TUid& aCategory, TUint aKey, const TDesC& aValue )
- {
- if ( aCategory == KFMRadioPSUid )
- {
- switch ( aKey )
- {
- case KFMRadioPSDataRDSProgramService:
- iObserver.HandleRDSProgramServiceChangeL( aValue );
- break;
- case KFMRadioPSDataRDSRadioText:
- iObserver.HandleRDSRadioTextChangeL( aValue );
- break;
- case KFMRadioPSDataChannelName:
- // Sync the cache valuse for channel name and index
- iPropertyObserverArray[EFMRadioActiveIdleChannelChangeObserver]->ValueInt( ETrue );
- iObserver.HandleChannelNameChangeL( aValue );
- break;
- default:
- break;
- }
- }
-
- }
-// ---------------------------------------------------------------------------
-// Invoked when a listened text P&S key is changed.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioActiveIdleEngine::HandlePropertyChangeL( const TUid&, TUint, const TDesC8&)
- {
- }
-
-// ---------------------------------------------------------------------------
-// Invoked when an error has occured while fetching the new value of any listened P&S key.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioActiveIdleEngine::HandlePropertyChangeErrorL( const TUid& /*aCategory*/, TUint /*aKey*/, TInt aError )
- {
- if (aError < 0)
- {
- // If any error should pass to this method, handle it like 'application shutdown'.
- // This situation will realize whenever the application is killed, by accident/by system/by an app crash
- // or due to change to offline mode.
- HandlePropertyChangeL(KFMRadioPSUid, KFMRadioPSDataApplicationRunning, EFMRadioPSApplicationClosing);
- }
- }
-
-// ---------------------------------------------------------------------------
-// Returns the current radio volume.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CFMRadioActiveIdleEngine::RadioVolume() const
- {
- //return iPropertyObserverArray[EFMRadioActiveIdleRadioVolumeObserver]->ValueInt();
- return 0;
- }
-
-// ---------------------------------------------------------------------------
-// Sets the radio volume.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioActiveIdleEngine::AdjustRadioVolume( TFMRadioPSAdjustVolume aVolume ) const
- {
- RProperty::Set( KFMRadioPSUid, KFMRadioPSControlAdjustVolume, aVolume );
- }
-
-
-// ---------------------------------------------------------------------------
-// Returns the current tuning state.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TFMRadioPSTuningState CFMRadioActiveIdleEngine::TuningState() const
- {
- return static_cast<TFMRadioPSTuningState>( iPropertyObserverArray[EFMRadioActiveIdleTuningStateObserver]->ValueInt() );
- }
-
-// ---------------------------------------------------------------------------
-// Returns the current frequency.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CFMRadioActiveIdleEngine::Frequency() const
- {
- return iPropertyObserverArray[EFMRadioActiveIdleFrequencyObserver]->ValueInt();
- }
-
-// ---------------------------------------------------------------------------
-// Returns the currently active channel ID.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CFMRadioActiveIdleEngine::Channel() const
- {
- return iPropertyObserverArray[EFMRadioActiveIdleChannelChangeObserver]->ValueInt();
- }
-
-// ---------------------------------------------------------------------------
-// Returns the currently active channel name.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CFMRadioActiveIdleEngine::ChannelName() const
- {
- return iPropertyObserverArray[EFMRadioPSDataChannelName]->ValueDes();
- }
-
-// ---------------------------------------------------------------------------
-// Returns the current mute state.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TFMRadioPSRadioMuteState CFMRadioActiveIdleEngine::MuteState() const
- {
- return static_cast<TFMRadioPSRadioMuteState>( iPropertyObserverArray[EFMRadioActiveIdleMuteStateObserver]->ValueInt() );
- }
-
-// ---------------------------------------------------------------------------
-// Sets the mute state.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioActiveIdleEngine::SetMuteState( TFMRadioPSRadioMuteState aMuteState ) const
- {
- RProperty::Set( KFMRadioPSUid, KFMRadioPSControlSetRadioMuteState, aMuteState );
- }
-
-// ---------------------------------------------------------------------------
-// Returns the current antenna connectivity status.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TFMRadioPSHeadsetStatus CFMRadioActiveIdleEngine::AntennaStatus() const
- {
- return static_cast<TFMRadioPSHeadsetStatus>( iPropertyObserverArray[EFMRadioActiveIdleHeadsetStatusObserver]->ValueInt() );
- }
-
-// ---------------------------------------------------------------------------
-// Returns the current frequency decimal count.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TFMRadioPSFrequencyDecimalCount CFMRadioActiveIdleEngine::FrequencyDecimalCount() const
- {
- return static_cast<TFMRadioPSFrequencyDecimalCount>( iPropertyObserverArray[EFMRadioActiveIdleDecimalCountObserver]->ValueInt() );
- }
-
-// ---------------------------------------------------------------------------
-// Returns FM Radio application's running state.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TFMRadioPSApplicationRunningState CFMRadioActiveIdleEngine::ApplicationRunningState() const
- {
- return static_cast<TFMRadioPSApplicationRunningState>( iPropertyObserverArray[EFMRadioActiveIdleApplicationObserver]->ValueInt() );
- }
-
-// ---------------------------------------------------------------------------
-// Returns the radio's power state.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TFMRadioPSRadioPowerState CFMRadioActiveIdleEngine::PowerState() const
- {
- return static_cast<TFMRadioPSRadioPowerState>( iPropertyObserverArray[EFMRadioActiveIdlePowerStateObserver]->ValueInt() );
- }
-
-// ---------------------------------------------------------------------------
-// Returns RDS Program Service information.
-// ---------------------------------------------------------------------------
-//
-
-EXPORT_C const TDesC& CFMRadioActiveIdleEngine::RDSProgramService() const
- {
- return iPropertyObserverArray[EFMRadioActiveIdleRDSProgramServiceObserver]->ValueDes();
- }
-
-// ================= OTHER EXPORTED FUNCTIONS ==============
-
Binary file fmradio/conf/fmradio.confml has changed
Binary file fmradio/conf/fmradio_2001b25e.crml has changed
--- a/fmradio/fmradio/aif/fmradioaif.rss Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Resource file for creating the aif file for FMRadio.
-*
-*/
-
-#include <aiftool.rh>
-#include <bldvariant.hrh>
-
-RESOURCE AIF_DATA
- {
- app_uid=0x10207A89;
- num_icons=2;
- embeddability=KAppNotEmbeddable;
- newfile=KAppDoesNotSupportNewFile;
- }
-
-// End of File
--- a/fmradio/fmradio/data/fmradio.rh Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Resource headers for project FMRadio
-*
-*/
-
-
-#ifndef FMRADIO_RH
-#define FMRADIO_RH
-
-#include <avkon.hrh>
-
-// ---------------------------------------------------------------------------
-// Frequency editor struct
-// ---------------------------------------------------------------------------
-//
-STRUCT FMRADIO_FREQUENCY_EDITOR
- {
- BYTE flags = 0;
- }
-
-// ---------------------------------------------------------------------------
-// Struct for defining a fadable icon
-// ---------------------------------------------------------------------------
-//
-STRUCT FMRADIO_FADABLE_ICON
- {
- LTEXT bmpfile;
- LONG bitmap;
- LONG mask;
- WORD fadetime = 1000; // fading time in milliseconds, defaults to one second
- BYTE invisible_percentage = 0; // Percentage how much the icon is shown when it is faded out
- }
-
-// ---------------------------------------------------------------------------
-// Struct for defining a bitmap animation composed of fadable icons.
-// ---------------------------------------------------------------------------
-//
-STRUCT FMRADIO_BITMAP_ANIMATION
- {
- LONG frameInterval; // Interval between frames.
- STRUCT frames[]; // Bitmap animation frames of type FMRADIO_FADABLE_ICON.
- }
-
-#endif // FMRADIO_RH
--- a/fmradio/fmradio/data/fmradio.rss Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1655 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: FM Radio resource definitions
-*
-*
-*/
-
-
-// RESOURCE IDENTIFIER
-//
-NAME FMRD // 4 letter ID
-
-// INCLUDES
-//
-#include <bldvariant.hrh>
-#include <data_caging_paths_strings.hrh>
-
-#include <e32keys.h>
-#include <eikon.rh>
-#include <eikon.rsg>
-#include <avkon.rsg>
-#include <avkon.mbg>
-#include <avkon.rh>
-#include <avkon.loc>
-#include <avkon.hrh>
-#include <uikon.rh>
-#include <appinfo.rh>
-#include <avkon.loc>
-
-#include <fmradio.mbg>
-#include "fmradio.rh"
-#include "fmradio.hrh"
-
-#include <fmradio.loc>
-
-#define KFMRadioBitmapFile APP_BITMAP_DIR "\\fmradio.mif"
-
-// RESOURCE DEFINITIONS
-//
-RESOURCE RSS_SIGNATURE { }
-
-RESOURCE TBUF { buf="FM Radio"; }
-
-
-RESOURCE EIK_APP_INFO
- {
- menubar = r_fmradio_main_menu; // Resource defining the menu.
- status_pane = r_fmradio_status_pane;
- }
-
-// For scalable AIF
-RESOURCE LOCALISABLE_APP_INFO r_fmradio_localisable_app_info
- {
- short_caption = qtn_fmradio_app_menu_list;
- caption_and_icon = CAPTION_AND_ICON_INFO
- {
- caption = qtn_fmradio_app_menu_grid;
-#ifdef __SCALABLE_ICONS
- number_of_icons = 1;
- icon_file = APP_BITMAP_DIR"\\FMRadio_aif.mif";
-#else
- number_of_icons = 2;
- icon_file = APP_BITMAP_DIR"\\FMRadio_aif.mbm";
-#endif
- };
- }
-
-// ---------------------------------------------------------------------------
-// r_fmradio_setting_frequency_editor
-// Editor for setting frequency of a channel.
-// ---------------------------------------------------------------------------
-//
-RESOURCE FMRADIO_FREQUENCY_EDITOR r_fmradio_setting_frequency_editor
- {
- }
-
-// ---------------------------------------------------------------------------
-// r_fmradio_manual_tuning_query
-// Manual tuning query resources
-// ---------------------------------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_manual_tuning_query
- {
- flags = EGeneralQueryFlags | EEikDialogFlagDontEatUpDownEvents;
- buttons = r_fmradio_softkeys_save_cancel__save;
- items =
- {
- DLG_LINE
- {
- type = EFMRadioCtFrequencyQuery;
- id = EGeneralQuery;
- control = AVKON_DATA_QUERY
- {
- layout = ETimeLayout;
- control = FMRADIO_FREQUENCY_EDITOR
- {
- };
- };
- }
- };
- }
-
-// ---------------------------------------------------------------------------
-// r_fmradio_channel_list_icon_array
-// ---------------------------------------------------------------------------
-//
-RESOURCE AKN_ICON_ARRAY r_fmradio_channel_list_icon_array
- {
- type = EAknIconArraySimple;
- bmpfile = KFMRadioBitmapFile;
- icons =
- {
- AKN_ICON
- {
- iconId = EMbmFmradioQgn_indi_radio_playing;
- maskId = EMbmFmradioQgn_indi_radio_playing_mask;
- },
- AKN_ICON
- {
- iconId = EMbmFmradioQgn_indi_marked_add;
- maskId = EMbmFmradioQgn_indi_marked_add_mask;
- }
- };
- }
-
-// ---------------------------------------------------------------------------
-// r_fmradio_main_view_toolbar
-// ---------------------------------------------------------------------------
-//
-RESOURCE AVKON_TOOLBAR r_fmradio_main_view_toolbar
- {
- flags = KAknToolbarTransparent|KAknToolbarWithoutCba|KAknToolbarFixed;
- items =
- {
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioToolbarButtonCmdTuneDown;
- control = AVKON_BUTTON
- {
- flags = KAknButtonReportOnLongPress;
- states =
- {
- AVKON_BUTTON_STATE
- {
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_radio_previous;
- bmpmask = EMbmFmradioQgn_indi_tb_radio_previous_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtToolbarExtension;
- id = EFMRadioToolbarButtonCmdExtensionList;
- control = AVKON_TOOLBAR_EXTENSION
- {
- helptxt = qtn_fmradio_tooltip_extension;
- items =
- {
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioCmdRename;
- control = AVKON_BUTTON
- {
- flags = KAknButtonRequestExitOnButtonUpEvent;
- states =
- {
- AVKON_BUTTON_STATE
- {
- txt = qtn_tbextension_rename;
- helptxt = qtn_fmradio_tooltip_rename;
- bmpfile = KFMRadioBitmapFile;
- bmpmask = EMbmFmradioQgn_indi_tb_rename;
- bmpid = EMbmFmradioQgn_indi_tb_rename_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioCmdSaveChannel;
- control = AVKON_BUTTON
- {
- flags = KAknButtonRequestExitOnButtonUpEvent;
- states =
- {
- AVKON_BUTTON_STATE
- {
- txt = qtn_tbextension_save;
- helptxt = qtn_fmradio_tooltip_save;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_radio_station_save;
- bmpmask = EMbmFmradioQgn_indi_tb_radio_station_save_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioCmdErase;
- control = AVKON_BUTTON
- {
- flags = KAknButtonRequestExitOnButtonUpEvent;
- states =
- {
- AVKON_BUTTON_STATE
- {
- txt = qtn_tbextension_delete;
- helptxt = qtn_fmradio_tooltip_delete;
- bmpfile = KFMRadioBitmapFile;
- bmpmask = EMbmFmradioQgn_indi_cam4_tb_delete_mask;
- bmpid = EMbmFmradioQgn_indi_cam4_tb_delete;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioToolbarButtonCmdOperatorMusicStore;
- control = AVKON_BUTTON
- {
- flags = KAknButtonRequestExitOnButtonUpEvent;
- states =
- {
- AVKON_BUTTON_STATE
- {
- bmpfile = KFMRadioBitmapFile;
- bmpmask = EMbmFmradioQgn_indi_radio_tb_mshop;
- bmpid = EMbmFmradioQgn_indi_radio_tb_mshop_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioToolbarButtonCmdToggleIhf;
- control = AVKON_BUTTON
- {
- flags = KAknButtonRequestExitOnButtonUpEvent;
- states =
- {
- AVKON_BUTTON_STATE
- {
- txt = qtn_tbextension_activate_loudspeaker;
- helptxt = qtn_fmradio_tooltip_activate_loudspeaker;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_ihf_on;
- bmpmask = EMbmFmradioQgn_indi_tb_ihf_on_mask;
- },
- AVKON_BUTTON_STATE
- {
- txt = qtn_tbextension_deactivate_loudspeaker;
- helptxt = qtn_fmradio_tooltip_deactivate_loudspeaker;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_ihf_off;
- bmpmask = EMbmFmradioQgn_indi_tb_ihf_off_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EMPXPbvCmdInternetGoToWeb;
- control = AVKON_BUTTON
- {
- flags = KAknButtonRequestExitOnButtonUpEvent;
- states =
- {
- AVKON_BUTTON_STATE
- {
- txt = qtn_tbextension_station_web;
- helptxt = qtn_fmradio_tooltip_web;
- bmpfile = KFMRadioBitmapFile;
- bmpmask = EMbmFmradioQgn_indi_radio_tb_gotoweb;
- bmpid = EMbmFmradioQgn_indi_radio_tb_gotoweb_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioCmdChannelList;
- control = AVKON_BUTTON
- {
- flags = KAknButtonRequestExitOnButtonUpEvent;
- states =
- {
- AVKON_BUTTON_STATE
- {
- txt = qtn_tbextension_list_view;
- helptxt = qtn_fmradio_tooltip_stations;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_radio_tb_list;
- bmpmask = EMbmFmradioQgn_indi_radio_tb_list_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioToolbarButtonCmdNokiaMusicStore;
- control = AVKON_BUTTON
- {
- flags = KAknButtonRequestExitOnButtonUpEvent;
- states =
- {
- AVKON_BUTTON_STATE
- {
- txt = qtn_tbextension_ovi_music;
- helptxt = qtn_fmradio_tooltip_nokia_music_store;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_menu_music;
- bmpmask = EMbmFmradioQgn_menu_music_mask;
- }
- };
- };
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioToolbarButtonCmdTuneUp;
- control = AVKON_BUTTON
- {
- flags = KAknButtonReportOnLongPress;
- states =
- {
- AVKON_BUTTON_STATE
- {
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_radio_next;
- bmpmask = EMbmFmradioQgn_indi_tb_radio_next_mask;
- }
- };
- };
- }
- };
- }
-
-//----------------------------------------------------
-//
-// r_fmradio_status_pane
-//
-//----------------------------------------------------
-//
-RESOURCE STATUS_PANE_APP_MODEL r_fmradio_status_pane
- {
- layout = R_AVKON_STATUS_PANE_LAYOUT_USUAL;
- panes =
- {
- SPANE_PANE
- {
- id = EEikStatusPaneUidTitle;
- type = EAknCtTitlePane;
- resource = r_qtn_fmradio_title;
- }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_title
-//----------------------------------------------------
-//
-RESOURCE TITLE_PANE r_qtn_fmradio_title
- {
- txt = qtn_fmradio_title;
- }
-
-// ============================ Application views ============================
-//
-RESOURCE CBA r_fmradio_softkeys_select_exit__select
- {
- buttons=
- {
- CBA_BUTTON { id = EAknSoftkeySelect; txt = text_softkey_select; },
- CBA_BUTTON { id = EAknSoftkeyExit; txt = text_softkey_exit; },
- CBA_BUTTON { id = EAknSoftkeySelect; txt = text_softkey_select; }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_softkeys_drop_done
-// Description : Reorder functionality softkeys
-//----------------------------------------------------
-//
-RESOURCE CBA r_fmradio_softkeys_drop_done
- {
- buttons=
- {
- CBA_BUTTON { id = EFMRadioCmdDrop; txt = qtn_fmradio_softkey_drop; },
- CBA_BUTTON { id = EFMRadioCmdDone; txt = text_softkey_done; }
- };
- }
-//----------------------------------------------------
-// Resource : r_fmradio_softkeys_drop_cancel
-// Description : Reorder functionality softkeys
-//----------------------------------------------------
-//
-RESOURCE CBA r_fmradio_softkeys_drop_cancel
- {
- buttons=
- {
- CBA_BUTTON { id = EFMRadioCmdDrop; txt = qtn_fmradio_softkey_drop; },
- CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_cancel; }
- };
- }
-//----------------------------------------------------
-// Resource : r_fmradio_softkeys_drop_done
-// Description : Reorder functionality softkeys
-//----------------------------------------------------
-//
-RESOURCE CBA r_fmradio_softkeys_grab_cancel
- {
- buttons=
- {
- CBA_BUTTON { id = EFMRadioCmdGrap; txt = qtn_fmradio_softkey_grab; },
- CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_cancel; }
- };
- }
-//----------------------------------------------------
-// Resource : r_fmradio_softkeys_grap_done
-// Description : Move functionality softkeys
-//----------------------------------------------------
-//
-RESOURCE CBA r_fmradio_softkeys_grap_done
- {
- buttons=
- {
- CBA_BUTTON { id = EFMRadioCmdGrap; txt = qtn_fmradio_softkey_grab; },
- CBA_BUTTON { id = EFMRadioCmdDone; txt = text_softkey_done; }
- };
- }
-//----------------------------------------------------
-// Resource : r_fmradio_softkeys_save_cancel__save
-// Description : softkeys for manual tuning dialog
-//----------------------------------------------------
-//
-RESOURCE CBA r_fmradio_softkeys_save_cancel__save
- {
- buttons=
- {
- CBA_BUTTON { id = EAknSoftkeySave; txt = text_softkey_save; },
- CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_cancel; },
- CBA_BUTTON { id = EAknSoftkeySave; txt = text_softkey_save; }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_main_view
-// Description : Application main view. (View ID=1)
-//----------------------------------------------------
-//
-RESOURCE AVKON_VIEW r_fmradio_main_view
- {
- menubar = r_fmradio_main_menu;
- cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
- toolbar = r_fmradio_main_view_toolbar;
- }
-
-// ---------------------------------------------------------
-// r_fmradio_main_view_tuning_state_softkeys
-// ---------------------------------------------------------
-//
-RESOURCE CBA r_fmradio_main_view_tuning_state_softkeys
- {
- buttons =
- {
- CBA_BUTTON { txt = text_softkey_empty; },
- CBA_BUTTON { id = EFMRadioCmdStopTuning; txt = text_softkey_stop; }
- };
- }
-
-// ---------------------------------------------------------
-// r_fmradio_softkeys_exit
-// ---------------------------------------------------------
-//
-RESOURCE CBA r_fmradio_softkeys_exit
- {
- buttons =
- {
- CBA_BUTTON { txt = text_softkey_empty; },
- CBA_BUTTON { id = EAknSoftkeyExit; txt = text_softkey_exit; }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_ch_list_view
-// Description : Stations view. (View ID=2)
-//----------------------------------------------------
-//
-RESOURCE AVKON_VIEW r_fmradio_ch_list_view
- {
- menubar = r_fmradio_channel_list_menu;
- cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
- toolbar = r_fmradio_channel_list_toolbar;
- }
-
-// ================================ View titles ==============================
-//
-
-// ---------------------------------------------------------------------------
-// r_fmradio_stations_view_title
-// Title of stations view.
-// ---------------------------------------------------------------------------
-//
-RESOURCE TBUF r_fmradio_stations_view_title { buf = qtn_fmradio_stations_title; }
-
-// ---------------------------------------------------------------------------
-// r_fmradio_search_stations_view_title
-// Title of scan local stations view.
-// ---------------------------------------------------------------------------
-//
-RESOURCE TBUF r_fmradio_search_stations_view_title { buf = qtn_fmradio_search_stations_title; }
-
-
-// ================================ Menu titles ==============================
-//
-
-//----------------------------------------------------
-// Resource : r_fmradio_main_menu
-// Description : Title for the Main menu.
-//----------------------------------------------------
-//
-RESOURCE MENU_BAR r_fmradio_main_menu
- {
- titles=
- {
- MENU_TITLE { menu_pane = r_fmradio_main_options_menu; txt = ""; }
- };
- }
-
-
-//----------------------------------------------------
-// Resource : r_fmradio_channel_list_menu
-// Description : Title for the channel list menu.
-//----------------------------------------------------
-//
-RESOURCE MENU_BAR r_fmradio_channel_list_menu
- {
- titles=
- {
- MENU_TITLE { menu_pane = r_fmradio_ch_list_options_menu; txt = ""; }
- };
- }
-
-
-// ================================ Menu items ===============================
-//
-
-//----------------------------------------------------
-// Resource : r_fmradio_main_options_menu
-// Description : Main options menu items v2.
-//----------------------------------------------------
-//
-RESOURCE MENU_PANE r_fmradio_main_options_menu
- {
- items=
- {
- MENU_ITEM { command = EMPXPbvCmdInternetGoToWeb; txt = qtn_fmradio_options_web_address; },
- MENU_ITEM { command = EFMRadioCmdChannelList; txt = qtn_fmradio_options_stations; },
- MENU_ITEM { command = EFMRadioCmdSaveChannel; txt = qtn_fmradio_options_save; },
- MENU_ITEM { command = EFMRadioCmdErase; txt = qtn_fmradio_options_delete; },
- MENU_ITEM { command = EFMRadioCmdRename; txt = qtn_fmradio_options_rename; },
- MENU_ITEM { command = EFMRadioCmdActivateIhf; txt = qtn_fmradio_options_activate; },
- MENU_ITEM { command = EFMRadioCmdDeactivateIhf; txt = qtn_fmradio_options_deactivate; },
- MENU_ITEM { command = EFMRadioCmdOpenAFSubmenu; txt = qtn_fmradio_options_alternative_freq; cascade = r_fmradio_options_af_sub_menu; },
- MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; },
- MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_options_af_sub_menu
-// Description : Sub options menu for alternative frequency.
-//----------------------------------------------------
-//
-RESOURCE MENU_PANE r_fmradio_options_af_sub_menu
- {
- items =
- {
- MENU_ITEM
- {
- command = EFMRadioCmdEnableRdsAfSearch;
- txt = qtn_fmradio_options_on;
- flags = EEikMenuItemRadioStart;
- },
- MENU_ITEM
- {
- command = EFMRadioCmdDisableRdsAfSearch;
- txt = qtn_fmradio_options_off;
- flags = EEikMenuItemRadioEnd;
- }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_ch_list_options_menu
-// Description : Channel list options menu items.
-//----------------------------------------------------
-//
-RESOURCE MENU_PANE r_fmradio_ch_list_options_menu
- {
- items=
- {
- MENU_ITEM { command = EFMRadioCmdRename; txt = qtn_fmradio_options_rename; flags = EEikMenuItemSpecific; },
- MENU_ITEM { command = EFMRadioCmdErase; txt = qtn_fmradio_options_delete; flags = EEikMenuItemSpecific; },
- MENU_ITEM { command = EFMRadioCmdMove; txt = qtn_fmradio_move; flags = EEikMenuItemSpecific; },
- MENU_ITEM { command = EFMRadioCmdScanLocalStations; txt = qtn_fmradio_options_search_stations; },
- MENU_ITEM { command = EFMRadioCmdTuneManually; txt = qtn_fmradio_options_tune_manually; },
- MENU_ITEM { command = EFMRadioCmdActivateIhf; txt = qtn_fmradio_options_activate; },
- MENU_ITEM { command = EFMRadioCmdDeactivateIhf; txt = qtn_fmradio_options_deactivate; },
- MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; },
- MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; }
- };
- }
-
-// ---------------------------------------------------------------------------
-// r_fmradio_channel_list_toolbar
-// ---------------------------------------------------------------------------
-//
-RESOURCE AVKON_TOOLBAR r_fmradio_channel_list_toolbar
- {
- flags = KAknToolbarTransparent|KAknToolbarWithoutCba|KAknToolbarFixed;
- items =
- {
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioCmdTuneManually;
- control = AVKON_BUTTON
- {
- states =
- {
- AVKON_BUTTON_STATE
- {
- helptxt = qtn_fmradio_tooltip_tune_manually;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_radio_tb_manualtune;
- bmpmask = EMbmFmradioQgn_indi_radio_tb_manualtune_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioCmdScanLocalStations;
- control = AVKON_BUTTON
- {
- states =
- {
- AVKON_BUTTON_STATE
- {
- helptxt = qtn_fmradio_tooltip_search_stations;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_radio_scan;
- bmpmask = EMbmFmradioQgn_indi_tb_radio_scan_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioToolbarButtonCmdToggleIhf;
- control = AVKON_BUTTON
- {
- states =
- {
- AVKON_BUTTON_STATE
- {
- helptxt = qtn_fmradio_tooltip_activate_loudspeaker;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_ihf_on;
- bmpmask = EMbmFmradioQgn_indi_tb_ihf_on_mask;
- },
- AVKON_BUTTON_STATE
- {
- helptxt = qtn_fmradio_tooltip_deactivate_loudspeaker;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_ihf_off;
- bmpmask = EMbmFmradioQgn_indi_tb_ihf_off_mask;
- }
- };
- };
- }
- };
- }
-
-// ============================= Data queries ==============================
-//
-
-RESOURCE AVKON_LIST_QUERY r_fmradio_listquery_save_all_replace_append
- {
- softkeys=R_AVKON_SOFTKEYS_SELECT_CANCEL;
- items =
- {
- AVKON_LIST_QUERY_DLG_LINE
- {
- control = AVKON_LIST_QUERY_CONTROL
- {
- listtype = EAknCtSinglePopupMenuListBox;
- heading = qtn_fmradio_list_query_save_all;
- listbox = AVKON_LIST_QUERY_LIST
- {
- array_id = r_fmradio_listquery_save_all_replace_append_items;
- };
- };
- }
- };
- }
-
-
-RESOURCE ARRAY r_fmradio_listquery_save_all_replace_append_items
- {
- items =
- {
- LBUF {txt = qtn_fmradio_list_query_replace_all; },
- LBUF {txt = qtn_fmradio_list_query_append; }
- };
- }
-
-RESOURCE AVKON_LIST_QUERY r_fmradio_listquery_save_all_replace_append_list_almost_full
- {
- softkeys=R_AVKON_SOFTKEYS_SELECT_CANCEL;
- items =
- {
- AVKON_LIST_QUERY_DLG_LINE
- {
- control = AVKON_LIST_QUERY_CONTROL
- {
- listtype = EAknCtSinglePopupMenuListBox;
- heading = qtn_fmradio_list_query_list_full;
- listbox = AVKON_LIST_QUERY_LIST
- {
- array_id = r_fmradio_listquery_save_all_replace_append_items_list_almost_full;
- };
- };
- }
- };
- }
-
-RESOURCE ARRAY r_fmradio_listquery_save_all_replace_append_items_list_almost_full
- {
- items =
- {
- LBUF {txt = qtn_fmradio_list_query_all_fits; },
- LBUF {txt = qtn_fmradio_list_query_replace_all; }
- };
- }
-
-RESOURCE DIALOG r_fmradio_rename_query
-{
- flags=EGeneralQueryFlags;
- buttons=R_AVKON_SOFTKEYS_OK_CANCEL;
- items=
- {
- DLG_LINE
- {
- type=EAknCtQuery;
- id=EGeneralQuery;
- control= AVKON_DATA_QUERY
- {
- layout = EDataLayout;
- label = qtn_fmradio_query_rename;
- control = EDWIN
- {
- flags= EEikEdwinNoHorizScrolling | EEikEdwinResizable;
- maxlength=20;
- width=16;
- lines=1;
- max_view_height_in_lines=1; // (5 or less lines are permitted)
- base_line_delta=21;
- };
- };
- }
- };
-}
-
-RESOURCE AVKON_LIST_QUERY r_fmradio_select_region_query
- {
- flags = EGeneralQueryFlags | EEikDialogFlagWait;
- softkeys = r_fmradio_softkeys_select_exit__select;
-
- items =
- {
- AVKON_LIST_QUERY_DLG_LINE
- {
- control = AVKON_LIST_QUERY_CONTROL
- {
- listtype = EAknCtSinglePopupMenuListBox;
- listbox = AVKON_LIST_QUERY_LIST
- {
- };
- heading = qtn_fmradio_popup_head_select_reg;
- };
- }
- };
- }
-
-// ========================= Confirmation queries ==========================
-//
-
-//----------------------------------------------------
-// Resource : r_fmradio_activate_in_offline_query
-// Description : A dialog shown when starting FM Radio
-// and off-line mode is active.
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_activate_in_offline_query
- {
- flags = EGeneralQueryFlags;
- buttons = R_AVKON_SOFTKEYS_YES_NO;
- items =
- {
- DLG_LINE
- {
- type = EAknCtQuery;
- id = EGeneralQuery;
- control = AVKON_CONFIRMATION_QUERY
- {
- layout = EConfirmationQueryLayout;
- label = qtn_fmradio_query_offline_activate;
- };
- }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_continue_in_offline_query
-// Description : A dialog shown when coming to
-// foreground and off-line mode has been
-// activated in background.
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_continue_in_offline_query
- {
- flags = EGeneralQueryFlags;
- buttons = R_AVKON_SOFTKEYS_YES_NO;
- items =
- {
- DLG_LINE
- {
- type = EAknCtQuery;
- id = EGeneralQuery;
- control = AVKON_CONFIRMATION_QUERY
- {
- layout = EConfirmationQueryLayout;
- label = qtn_fmradio_query_offline_use;
- };
- }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_save_ch_confirmation_query
-// Description : Confirmation query used when user
-// tries to save a channel to a reserved
-// channel slot. User is asked to
-// confirm is the intention to replace
-// the existing channel in that channel
-// slot.
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_save_ch_confirmation_query
-{
- flags = EGeneralQueryFlags;
- buttons = R_AVKON_SOFTKEYS_YES_NO;
- items =
- {
- DLG_LINE
- {
- type = EAknCtQuery;
- id = EGeneralQuery;
- control = AVKON_CONFIRMATION_QUERY
- {
- layout = EConfirmationLayout;
- };
- }
- };
-}
-
-//----------------------------------------------------
-// Resource : r_fmradio_erase_ch_confirmation_query
-// Description : Confirmation query used when user
-// tries to delete a channel from a
-// channel slot. User is asked to
-// confirm is the intention to really
-// delete the existing channel in that
-// channel slot or was it just an
-// accidental menu selection...
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_erase_ch_confirmation_query
-{
- flags = EGeneralQueryFlags;
- buttons = R_AVKON_SOFTKEYS_YES_NO;
- items =
- {
- DLG_LINE
- {
- type = EAknCtQuery;
- id = EGeneralQuery;
- control = AVKON_CONFIRMATION_QUERY
- {
- layout = EConfirmationLayout;
- };
- }
- };
-}
-
-RESOURCE DIALOG r_fmradio_connect_headset_note
- {
- flags = EAknDialogGenericQueryFlags;
- buttons = r_fmradio_softkeys_exit;
- items =
- {
- DLG_LINE
- {
- type = EAknCtQuery;
- id = EConfirmationLayout;
- control = AVKON_CONFIRMATION_QUERY
- {
- layout = EConfirmationQueryLayout;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_note_radio_jackmini;
- bmpmask = EMbmFmradioQgn_note_radio_jackmini_mask;
- };
- }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_query_save_current
-// Description : query for saving channel that has not been saved
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_query_save_current
- {
- flags = EGeneralQueryFlags;
- buttons = R_AVKON_SOFTKEYS_YES_NO;
- items =
- {
- DLG_LINE
- {
- type = EAknCtQuery;
- id = EGeneralQuery;
- control = AVKON_CONFIRMATION_QUERY
- {
- layout = EConfirmationQueryLayout;
- label = qtn_fmradio_query_save_current;
- };
- }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_replace_existing_channels_query
-// Description : Shown when starting channel list is full
-// and user presses save all in scan stations.
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_replace_existing_channels_query
- {
- flags = EGeneralQueryFlags;
- buttons = R_AVKON_SOFTKEYS_YES_NO;
- items =
- {
- DLG_LINE
- {
- type = EAknCtQuery;
- id = EGeneralQuery;
- control = AVKON_CONFIRMATION_QUERY
- {
- layout = EConfirmationQueryLayout;
- label = qtn_fmradio_query_replace_all;
- };
- }
- };
- }
-// ============================== Notes ===================================
-
-//----------------------------------------------------
-// Resource : r_fmradio_rtplus_firsttime_note
-// Description : A wait note used while seek is
-// in progress.
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_rtplus_firsttime_note
- {
- flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
- buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
- items =
- {
- DLG_LINE
- {
- type = EAknCtPopupHeadingPane;
- id = EAknMessageQueryHeaderId;
- control = AVKON_HEADING
- {
- headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
- };
- },
- DLG_LINE
- {
- type = EAknCtMessageQuery;
- id = EAknMessageQueryContentId;
- control = AVKON_MESSAGE_QUERY
- {
- };
- }
- };
- }
-
-// ======================== Dynamic menu strings ===========================
-//
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_options_activate
-// Description : String for a menu item when IHF-
-// speaker is inactive.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_options_activate { buf = qtn_fmradio_options_activate; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_options_deactivate
-// Description : String for a menu item when IHF-
-// speaker is active.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_options_deactivate { buf = qtn_fmradio_options_deactivate; }
-
-//----------------------------------------------------
-// Resource : r_fmradio_options_music_store
-// Description : Options menu item for music store.
-//----------------------------------------------------
-//
-RESOURCE MENU_PANE r_fmradio_options_music_store
- {
- items =
- {
- MENU_ITEM
- {
- command = EFMRadioMusicStore;
- txt = qtn_fmradio_options_music_store;
- }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_options_music_store_with_sub_menu
-// Description : Sub options menu for music store.
-//----------------------------------------------------
-//
-RESOURCE MENU_PANE r_fmradio_options_music_store_with_sub_menu
- {
- items =
- {
- MENU_ITEM
- {
- command = EFMRadioMusicStore;
- txt = qtn_fmradio_options_music_store_submenu;
- cascade = r_fmradio_options_music_store_sub_menu;
- }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_options_music_store_sub_menu
-// Description : Sub options menu for music store.
-//----------------------------------------------------
-//
-RESOURCE MENU_PANE r_fmradio_options_music_store_sub_menu
- {
- items =
- {
- MENU_ITEM
- {
- command = EFMRadioMusicStoreOperator;
- txt = ""; // Operator Music Store
- },
- MENU_ITEM
- {
- command = EFMRadioMusicStoreNokiaMusicShop;
- txt = qtn_fmradio_options_nokia_music_store;
- }
- };
- }
-
-
-// ====================== Strings from fmradio.loc =========================
-//
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_query_offline_use
-// Description : Prompt text for text query dialog.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_query_offline_use { buf = qtn_fmradio_query_offline_use; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_mem_location_freq
-// Description : Text including channel index and
-// frequency. Used in main view.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_mem_location_freq { buf = qtn_fmradio_mem_location_freq; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_mem_location_name
-// Description : Text including channel index and
-// channel name. Used in main view.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_mem_location_name { buf = qtn_fmradio_mem_location_name; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_freq
-// Description : Text to display frequency of current station
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_freq { buf= qtn_fmradio_freq; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_media_idle_freq
-// Description : Text to display frequency in media idle
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_media_idle_freq { buf= qtn_fmradio_media_idle_freq; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_rds
-// Description : Text to rds indicator
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_rds { buf = qtn_fmradio_rds; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_af
-// Description : Text to af indicator
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_af { buf = qtn_fmradio_af; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_rtplus_indicator_text
-// Description : Text to af indicator
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_rtplus_indicator_text { buf = qtn_fmradio_rtplus; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_rtplus_firsttime
-// Description : Text to a note which is shown when RT+
-// interactions become available for the first time.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_rtplus_firsttime { buf = qtn_fmradio_query_rtplus_enabled; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_query_delete
-// Description : Used in confirmation query when user
-// is asked to confirm deleting a
-// channel from the channel list.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_query_delete { buf = qtn_fmradio_query_delete; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_query_delete_mhz
-// Description : Used in confirmation query when user
-// is asked to confirm deleting a
-// channel from the channel list. Used
-// for frequency if the channel name
-// is not set
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_query_delete_mhz { buf = qtn_fmradio_query_delete_mhz; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_tuning
-// Description : A label used while
-// tuning is in progress.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_tuning { buf = qtn_fmradio_scanning; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_use_long_tap
-// Description : Text for the information note that
-// will be shown when the channels haven't been saved
-// and tryed to change channel.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_use_long_tap { buf = qtn_fmradio_use_long_tap; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_list_query_list_full
-// Description : If the amount of added stations is about to exceed
-// the limit, a List query is displayed with a prompt
-// text Station list full:
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_list_query_list_full { buf = qtn_fmradio_list_query_list_full; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_error_con_headset
-// Description : Text for the error note about
-// a missing headset.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_error_con_headset { buf = qtn_fmradio_error_con_headset; }
-
-//text for the frequence range note. User has selected range manually
-RESOURCE TBUF128 r_qtn_fmradio_conf_freq_band_set_manual { buf = qtn_fmradio_conf_freq_band_set_manual; }
-RESOURCE TBUF128 r_qtn_fmradio_conf_freq_band_set_autom { buf = qtn_fmradio_conf_freq_band_set_autom; }
-RESOURCE TBUF128 r_qtn_fmradio_manual_tune_freq { buf = qtn_fmradio_query_frequency; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_stations_saved
-// Description : Text "%N stations saved to the stations list." used in Scan Local Stations list.
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_stations_saved { buf = qtn_fmradio_saving_done; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_list_no_stations_found
-// Description : Text "No stations found. Please try again."
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_list_no_stations_found { buf = qtn_fmradio_list_no_stations_found; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_no_stations_found
-// Description : Text "No stations found."
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_no_stations_found { buf = qtn_fmradio_no_stations_found; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_msk_listen
-// Description : String for the listen text
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_msk_listen { buf = qtn_fmradio_msk_listen; }
-
-RESOURCE TBUF r_qtn_fmradio_none { buf = ""; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_list_no_stations
-// Description : String for empty stations list
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_list_no_stations { buf = qtn_fmradio_list_no_stations; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_note_fmtx_unable_to_start
-// Description : FM transmitter is active during radio launch
-// text : "FM Radio cannot be started when FM transmitter is on."
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_note_fmtx_unable_to_start { buf = qtn_fmradio_note_fmtx_unable_to_start; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_note_fmtx_close_application
-// Description :
-// text : "FM Radio cannot be used when the FM transmitter is on. FM Radio is closed."
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_note_fmtx_close_application { buf = qtn_fmradio_note_fmtx_close_application; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_saving_done_one
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_saving_done_one { buf = qtn_fmradio_saving_done_one; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_saving_done_one_no_name
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_saving_done_one_no_name { buf = qtn_fmradio_saving_done_one_no_name; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_double1_freq
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_double1_freq { buf = qtn_fmradio_double1_freq; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_double2_freq
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_double2_freq { buf = qtn_fmradio_double2_freq; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_single_freq
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_single_freq { buf = qtn_fmradio_single_freq; }
-
-//----------------------------------------------------
-// Resource : r_qtn_fmradio_single_freq_name
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_fmradio_single_freq_name { buf = qtn_fmradio_single_freq_name; }
-
-// ============================ Application views ============================
-
-// ---------------------------------------------------------------------------
-// r_fmradio_softkeys_empty_stop
-// ---------------------------------------------------------------------------
-//
-RESOURCE CBA r_fmradio_softkeys_empty_stop
- {
- buttons=
- {
- CBA_BUTTON { txt = text_softkey_empty; },
- CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_stop; }
- };
- }
-
-// ---------------------------------------------------------------------------
-// r_fmradio_softkeys_empty_cancel
-// ---------------------------------------------------------------------------
-//
-RESOURCE CBA r_fmradio_softkeys_empty_cancel
- {
- buttons=
- {
- CBA_BUTTON { txt = text_softkey_empty; },
- CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_cancel; }
- };
- }
-
-// Search Stations view
-
-//----------------------------------------------------
-// Resource : r_fmradio_search_stations__view
-// Description : Search Stations view. (View ID=4)
-//----------------------------------------------------
-//
-RESOURCE AVKON_VIEW r_fmradio_search_stations_view
- {
- menubar = r_fmradio_search_stations_menu;
- cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
- toolbar = r_fmradio_search_stations_toolbar;
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_search_stations_menu
-// Description : Search Stations menu.
-//----------------------------------------------------
-//
-RESOURCE MENU_BAR r_fmradio_search_stations_menu
- {
- titles=
- {
- MENU_TITLE { menu_pane = r_fmradio_search_stations_options_menu; txt = ""; }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_search_stations_options_menu
-// Description : Search Stations options menu items.
-//----------------------------------------------------
-//
-RESOURCE MENU_PANE r_fmradio_search_stations_options_menu
- {
- items=
- {
- MENU_ITEM { command = EFMRadioCmdSaveChannel; txt = qtn_fmradio_options_save; flags = EEikMenuItemSpecific; },
- MENU_ITEM { command = EFMRadioCmdSaveAllChannels; txt = qtn_fmradio_options_save_all; },
- MENU_ITEM { command = EFMRadioCmdScanLocalStationsScan; txt = qtn_fmradio_options_search_stations; },
- MENU_ITEM { command = EFMRadioCmdActivateIhf; txt = qtn_fmradio_options_activate; },
- MENU_ITEM { command = EFMRadioCmdDeactivateIhf; txt = qtn_fmradio_options_deactivate; },
- MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; },
- MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; }
- };
- }
-
-// ---------------------------------------------------------------------------
-// r_fmradio_search_stations_toolbar
-// ---------------------------------------------------------------------------
-//
-RESOURCE AVKON_TOOLBAR r_fmradio_search_stations_toolbar
- {
- flags = KAknToolbarTransparent|KAknToolbarWithoutCba|KAknToolbarFixed;
- items =
- {
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioToolbarButtonCmdSaveAll;
- control = AVKON_BUTTON
- {
- states =
- {
- AVKON_BUTTON_STATE
- {
- helptxt = qtn_fmradio_tooltip_save_all;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_radio_station_save_all;
- bmpmask = EMbmFmradioQgn_indi_tb_radio_station_save_all_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioToolbarButtonCmdScan;
- control = AVKON_BUTTON
- {
- states =
- {
- AVKON_BUTTON_STATE
- {
- helptxt = qtn_fmradio_tooltip_search_stations;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_radio_scan;
- bmpmask = EMbmFmradioQgn_indi_tb_radio_scan_mask;
- }
- };
- };
- },
- TBAR_CTRL
- {
- type = EAknCtButton;
- id = EFMRadioToolbarButtonCmdToggleIhf;
- control = AVKON_BUTTON
- {
- states =
- {
- AVKON_BUTTON_STATE
- {
- helptxt = qtn_fmradio_tooltip_activate_loudspeaker;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_ihf_on;
- bmpmask = EMbmFmradioQgn_indi_tb_ihf_on_mask;
- },
- AVKON_BUTTON_STATE
- {
- helptxt = qtn_fmradio_tooltip_deactivate_loudspeaker;
- bmpfile = KFMRadioBitmapFile;
- bmpid = EMbmFmradioQgn_indi_tb_ihf_off;
- bmpmask = EMbmFmradioQgn_indi_tb_ihf_off_mask;
- }
- };
- };
- }
- };
- }
-
-// ======================== Notes for the Scan Local Stations View ====================
-
-//----------------------------------------------------
-// Resource : r_fmradio_search_stations_wait_note
-// Description : A wait note used while station scanning is in progress.
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_search_stations_wait_note
- {
- flags = EAknWaitNoteFlags;
- buttons = r_fmradio_softkeys_empty_stop;
- items =
- {
- DLG_LINE
- {
- type = EAknCtNote;
- id = EGeneralNote;
- control = AVKON_NOTE
- {
- layout = EWaitLayout;
- singular_label = qtn_fmradio_wait_note_scanning;
- animation = R_QGN_GRAF_WAIT_BAR_ANIM;
- };
- }
- };
- }
-
-// -----------------------------------------------------------------------------
-//
-// r_radio_cui_fill_stations_ctx_menubar
-// Menu bar used by channel list view context sensitive menu.
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE MENU_BAR r_fmradio_scan_stations_ctx_menubar
- {
- titles =
- {
- MENU_TITLE
- {
- menu_pane = r_fmradio_scan_stations_ctx_menu;
- }
- };
- }
-
-RESOURCE MENU_PANE r_fmradio_scan_stations_ctx_menu
- {
- items =
- {
- MENU_ITEM { command = EFMRadioCmdSaveChannel; txt = qtn_fmradio_options_save; }
- };
- }
-
-// -----------------------------------------------------------------------------
-//
-// r_radio_cui_fill_stations_ctx_menubar
-// Menu bar used by channel list view context sensitive menu.
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE MENU_BAR r_fmradio_scan_stations_ctx_menubar_save
- {
- titles =
- {
- MENU_TITLE
- {
- menu_pane = r_fmradio_scan_stations_ctx_menu_save;
- }
- };
- }
-
-RESOURCE MENU_PANE r_fmradio_scan_stations_ctx_menu_save
- {
- items =
- {
- MENU_ITEM { command = EFMRadioCmdSaveChannel; txt = qtn_fmradio_options_save; }
- };
- }
-
-//----------------------------------------------------
-// Resource : r_fmradio_search_stations_wait_note
-// Description : A wait note used while station scanning is in progress.
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_fmradio_search_stations_wait_cancel_note
- {
- flags = EAknWaitNoteFlags;
- buttons = r_fmradio_softkeys_empty_cancel;
- items =
- {
- DLG_LINE
- {
- type = EAknCtNote;
- id = EGeneralNote;
- control = AVKON_NOTE
- {
- layout = EWaitLayout;
- singular_label = qtn_fmradio_wait_note_scanning;
- animation = R_QGN_GRAF_WAIT_BAR_ANIM;
- };
- }
- };
- }
-// ---------------------------------------------------------------------------
-// r_fmradio_wait_anim_tuning
-// Tuning animation.
-// ---------------------------------------------------------------------------
-//
-RESOURCE FMRADIO_BITMAP_ANIMATION r_fmradio_wait_anim_tuning
- {
- frameInterval = 20;
- frames =
- {
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_01;
- mask = EMbmFmradioQgn_graf_ring_wait_01_mask;
- },
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_02;
- mask = EMbmFmradioQgn_graf_ring_wait_02_mask;
- },
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_03;
- mask = EMbmFmradioQgn_graf_ring_wait_03_mask;
- },
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_04;
- mask = EMbmFmradioQgn_graf_ring_wait_04_mask;
- },
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_05;
- mask = EMbmFmradioQgn_graf_ring_wait_05_mask;
- },
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_06;
- mask = EMbmFmradioQgn_graf_ring_wait_06_mask;
- },
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_07;
- mask = EMbmFmradioQgn_graf_ring_wait_07_mask;
- },
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_08;
- mask = EMbmFmradioQgn_graf_ring_wait_08_mask;
- },
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_09;
- mask = EMbmFmradioQgn_graf_ring_wait_09_mask;
- },
- FMRADIO_FADABLE_ICON
- {
- bmpfile = KFMRadioBitmapFile;
- bitmap = EMbmFmradioQgn_graf_ring_wait_10;
- mask = EMbmFmradioQgn_graf_ring_wait_10_mask;
- }
- };
- }
-
-// End of File
--- a/fmradio/fmradio/data/fmradio_caption.rss Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: FM Radio UI
-*
-*/
-
-#include <fmradio.loc>
-#include <apcaptionfile.rh>
-
-RESOURCE CAPTION_DATA
- {
- caption = qtn_fmradio_app_menu_list;
- shortcaption = qtn_fmradio_app_menu_grid;
- }
--- a/fmradio/fmradio/data/fmradio_reg.rss Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: FMRadio
-*
-*/
-
-
-#include <appinfo.rh>
-#include <fmradio.rsg>
-#include <bldvariant.hrh>
-#include <data_caging_paths_strings.hrh>
-
-UID2 KUidAppRegistrationResourceFile
-UID3 0x10207A89 // MyApp UID
-
-RESOURCE APP_REGISTRATION_INFO
- {
- app_file = "fmradio";
- embeddability=KAppNotEmbeddable;
- newfile=KAppDoesNotSupportNewFile;
-
- localisable_resource_file = APP_RESOURCE_DIR"\\fmradio";
- localisable_resource_id = R_FMRADIO_LOCALISABLE_APP_INFO;
- }
--- a/fmradio/fmradio/group/bld.inf Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This file provides the information required for building the
-* FMRadio application.
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-// stub sis
-../../sis/fmradio_default/stub.sis /epoc32/data/z/system/install/fmradio_stub.sis
-../inc/fmradiocommandlineparams.h APP_LAYER_PLATFORM_EXPORT_PATH(fmradiocommandlineparams.h)
-../inc/fmradiouids.h APP_LAYER_PLATFORM_EXPORT_PATH(fmradiouids.h)
-
-// iby file
-../rom/fmradio.iby CORE_APP_LAYER_IBY_EXPORT_PATH(fmradio.iby)
-../rom/fmradioresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(fmradioresources.iby)
-
-PRJ_EXTENSIONS
-
-START EXTENSION s60/mifconv
-OPTION TARGETFILE fmradio.mif
-OPTION HEADERFILE fmradio.mbg
-OPTION SOURCEDIR ../aif
-OPTION SOURCEFILE iconlist.txt
-END
-
-START EXTENSION s60/mifconv
-OPTION TARGETFILE fmradio_aif.mif
-OPTION SOURCES -c8,8 qgn_menu_radio
-END
-
-PRJ_MMPFILES
-
-fmradio.mmp
--- a/fmradio/fmradio/group/fmradio.mmp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project FMRadio
-*
-*/
-
-
-
-#include <bldvariant.hrh>
-#include <data_caging_paths.hrh>
-
-#include <platform_paths.hrh>
-TARGET fmradio.exe
-TARGETTYPE exe
-epocstacksize 0x10000
-
-UID 0x100039CE 0x10207A89
-
-VENDORID VID_DEFAULT
-CAPABILITY CAP_APPLICATION MultimediaDD ReadUserData
-
-PAGED
-
-START RESOURCE ../data/fmradio.rss
-HEADER
-TARGETPATH APP_RESOURCE_DIR
-LANGUAGE_IDS
-END //RESOURCE
-
-START RESOURCE ../data/fmradio_reg.rss
-DEPENDS fmradio.rsg
-TARGETPATH /private/10003a3f/import/apps
-END
-
-SOURCEPATH ../src
-
-SOURCE fmradioalfbitmapanimation.cpp
-SOURCE fmradioalfindicator.cpp
-SOURCE fmradioalfmediaidle.cpp
-SOURCE fmradioalfvisualizer.cpp
-SOURCE fmradioapp.cpp
-SOURCE fmradioappui.cpp
-SOURCE fmradiobacksteppingservicewrapper.cpp
-SOURCE fmradiochannellistview.cpp
-SOURCE fmradiochannellistcontainer.cpp
-SOURCE fmradiocontroleventobserverimpl.cpp
-SOURCE fmradiodocument.cpp
-SOURCE fmradiomaincontainer.cpp
-SOURCE fmradiomainview.cpp
-SOURCE fmradiosvkevents.cpp
-SOURCE fmradioglobalconfirmationquery.cpp
-SOURCE fmradioscanlocalstationsview.cpp
-SOURCE fmradioscanlocalstationscontainer.cpp
-SOURCE fmradiofrequencyeditor.cpp
-SOURCE fmradiofrequencynumber.cpp
-SOURCE fmradiofrequencyquerycontrol.cpp
-SOURCE fmradiofrequencyquerydialog.cpp
-SOURCE fmradioalfrdsviewer.cpp
-SOURCE fmradiomusicstorehandler.cpp
-SOURCE fmradiopreset.cpp
-SOURCE fmradioidlecontroller.cpp
-SOURCE fmradiologo.cpp
-
-USERINCLUDE ../inc
-USERINCLUDE ../../inc
-USERINCLUDE ../../fmradioengine/inc
-USERINCLUDE ../../help/inc
-
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY aknnotify.lib
-LIBRARY alfclient.lib
-LIBRARY euser.lib
-LIBRARY apparc.lib
-LIBRARY cone.lib
-LIBRARY eikcore.lib
-LIBRARY eikdlg.lib
-LIBRARY ws32.lib
-LIBRARY eikcoctl.lib
-LIBRARY avkon.lib
-LIBRARY efsrv.lib
-LIBRARY featmgr.lib
-LIBRARY bafl.lib
-LIBRARY commonengine.lib
-LIBRARY aknskins.lib
-LIBRARY egul.lib
-LIBRARY eikctl.lib
-LIBRARY fmradioengine.lib
-LIBRARY hlplch.lib
-LIBRARY cdlengine.lib
-LIBRARY apgrfx.lib
-LIBRARY remconcoreapi.lib
-LIBRARY remconinterfacebase.lib
-LIBRARY remconextensionapi.lib
-LIBRARY gdi.lib
-LIBRARY numberconversion.lib
-LIBRARY aknlayout2.lib
-LIBRARY aknlayout2scalable.lib
-LIBRARY hwrmlightclient.lib
-LIBRARY iaupdateapi.lib
-LIBRARY liwservicehandler.lib
-LIBRARY centralrepository.lib
-LIBRARY ecom.lib
-LIBRARY gesturehelper.lib
-
-DEBUGLIBRARY flogger.lib
--- a/fmradio/fmradio/group/iconlist.txt Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
--c24,8 qgn_indi_radio_default.svg
--c8,8 qgn_indi_tb_radio_previous.svg
--c8,8 qgn_indi_tb_radio_next.svg
--c8,8 qgn_indi_tb_radio_scan.svg
--c8,8 qgn_indi_tb_radio_station_save.svg
--c8,8 qgn_indi_tb_radio_station_save_all.svg
--c8,8 qgn_indi_radio_playing.svg
--c24,8 qgn_menu_radio.svg
--c8,8 qgn_graf_ring_wait_01.svg
--c8,8 qgn_graf_ring_wait_02.svg
--c8,8 qgn_graf_ring_wait_03.svg
--c8,8 qgn_graf_ring_wait_04.svg
--c8,8 qgn_graf_ring_wait_05.svg
--c8,8 qgn_graf_ring_wait_06.svg
--c8,8 qgn_graf_ring_wait_07.svg
--c8,8 qgn_graf_ring_wait_08.svg
--c8,8 qgn_graf_ring_wait_09.svg
--c8,8 qgn_graf_ring_wait_10.svg
--c8,8 qgn_prop_msk_menu.svg
--c8,8 qgn_prop_image_tb_prev.svg
--c8,8 qgn_prop_image_tb_next.svg
--c8,8 qgn_prop_image_tb_prev_dimmed.svg
--c8,8 qgn_prop_image_tb_next_dimmed.svg
--c8,8 qgn_indi_music_widget_tb_radio_sound.svg
--c8,8 qgn_indi_music_widget_tb_radio_sound_dimmed.svg
--c8,8 qgn_indi_music_widget_tb_radio_sound_muted.svg
--c8,8 qgn_indi_music_widget_tb_radio_sound_muted_dimmed.svg
--c8,8 qgn_indi_radio_tb_list.svg
--c8,8 qgn_indi_tb_rename.svg
--c8,8 qgn_indi_cam4_tb_delete.svg
--c8,8 qgn_indi_marked_add.svg
--c8,8 qgn_indi_tb_ihf_on.svg
--c8,8 qgn_indi_tb_ihf_off.svg
--c8,8 qgn_indi_radio_tb_manualtune.svg
--c8,8 qgn_indi_radio_tb_mshop.svg
--c8,8 qgn_indi_radio_tb_gotoweb.svg
--c8,8 qgn_note_radio_jackmini.svg
--c8,8 qgn_menu_music.svg
--- a/fmradio/fmradio/inc/debug.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Central place for nice debug-type macros & functions
-*
-*
-*/
-
-
-#ifndef FMRADIO_DEBUG_H
-#define FMRADIO_DEBUG_H
-
-#ifdef _DEBUG
-
-#ifdef __WINS__
-#define __CLOGGING__
-// File logging for WIS
-//#define __FLOGGING__
-
-#else
-
-// Logging with RDebug for target HW
-#define __CLOGGING__
-//#define __FLOGGING__
-
-#endif //__WINS__
-
-#endif
-
-#if defined ( __FLOGGING__ )
-
-_LIT(KLogFile,"FMRadioLog.txt");
-_LIT(KLogDir,"FMRadio");
-
-#include <f32file.h>
-#include <flogger.h>
-
-#define FLOG(a) {FPrint(a);}
-
-#define FLOGHEX(value, len) {RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, "", " ",value, len);}
-
-#define FDEBUGVAR(a) a
-#define FTRACE(a) {a;}
-
-#define FDEBUGVAR(a) a
-
-// Declare the FPrint function
-
-inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
-{
- VA_LIST list;
- VA_START(list,aFmt);
- RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
-
-}
-
-inline void FHex(const TUint8* aPtr, TInt aLen)
-{
- RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen);
-}
-
-inline void FHex(const TDesC8& aDes)
-{
- FHex(aDes.Ptr(), aDes.Length());
-}
-
-// RDebug logging
-#elif defined(__CLOGGING__)
-
-#include <e32svr.h>
-
-#define FLOG(a) {RDebug::Print(a);}
-
-#define FLOGHEX(a)
-
-#define FDEBUGVAR(a) a
-#define FTRACE(a) {a;}
-
-#define FDEBUGVAR(a) a
-
-// Declare the FPrint function
-
-inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
-{
- VA_LIST list;
- VA_START(list,aFmt);
- TInt tmpInt = VA_ARG(list, TInt);
- TInt tmpInt2 = VA_ARG(list, TInt);
- TInt tmpInt3 = VA_ARG(list, TInt);
- VA_END(list);
- RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3);
-}
-
-
-#else // No loggings --> reduced code size
-#define FLOG(a)
-#define FLOGHEX(a)
-#define FDEBUGVAR(a)
-#define FTRACE(a)
-#define FDEBUGVAR(a)
-
-#endif //_DEBUG
-
-#endif // FMRADIO_DEBUG_H
--- a/fmradio/fmradio/inc/fmradio.hrh Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This file contains declarations for constants of FMRadio.
-* The file can be included in C++ or resource file.
-*
-*/
-
-
-#ifndef FMRADIO_HRH
-#define FMRADIO_HRH
-
-enum TFMRadioViewCBAButtons // CBA button ID's
- {
- EIdCBAStop = 550
- };
-
-enum TFMRadioCommandIds // Menu command ID's
- {
- // Main menu commands
- EFMRadioCmdChannelList = 600,
- EFMRadioCmdSeekUp,
- EFMRadioCmdSeekDown,
- EFMRadioCmdScanLocalStations,
- EFMRadioCmdSaveChannel,
- EFMRadioCmdSettings,
- EFMRadioCmdOpenAFSubmenu,
-
- //RT+
- EMPXPbvCmdInternet,
- EMPXPbvCmdInternetGoogle,
- EMPXPbvCmdInternetWikipedia,
- EMPXPbvCmdInternetAmg,
- EMPXPbvCmdInternetNokiaMusicStore,
- EMPXPbvCmdInternetMusicPortl,
- EMPXPbvCmdInternetGoToWeb,
-
- // Channel list menu commands
- EFMRadioCmdErase,
- EFMRadioCmdRename,
- EFMRadioCmdListenCh,
-
- // Manual tuning menu commands
- EFMRadioCmdTuneManually,
- EFMRadioCmdClose,
-
- // Scan local stations menu commands
- EFMRadioCmdSaveAllChannels,
- EFMRadioCmdScanLocalStationsScan,
-
- // Used in both menus
- EFMRadioCmdActivateIhf,
- EFMRadioCmdDeactivateIhf,
- EFMRadioCmdHelp,
- EFMRadioCmdExitApp,
-
- // Move commands
- EFMRadioCmdMove,
- EFMRadioCmdDone,
- EFMRadioCmdDrop,
- EFMRadioCmdGrap,
-
-
- // General commands
- EFMRadioCmdNextChannel,
- EFMRadioCmdPrevChannel,
- EFMRadioCmdRecord,
- EFMRadioCmdStop,//620
- EFMRadioCmdUpdateVolume,
- EFMRadioCmdStopTuning,
- EFMRadioCmdScanLocalStationsViewActive,
- EFMRadioCmdChannelListViewActive,
- EFMRadioCmdMainViewActive,
- EFMRadioCmdMuteOn,
- EFMRadioCmdMuteOff,
- EFMRadioCmdMute,
- EFMRadioCmdEnableRdsAfSearch,
- EFMRadioCmdDisableRdsAfSearch,
-
- //toolbar
- EFMRadioToolbarButtonCmdTuneDown,
- EFMRadioToolbarButtonCmdTuneUp,
- EFMRadioToolbarButtonCmdExtensionList,
- EFMRadioToolbarButtonCmdAutoSeekDown,
- EFMRadioToolbarButtonCmdAutoSeekUp,
- EFMRadioToolbarButtonCmdSaveAll,
- EFMRadioToolbarButtonCmdScan,
- EFMRadioToolbarButtonCmdToggleIhf,
- EFMRadioToolbarButtonCmdNokiaMusicStore,
- EFMRadioToolbarButtonCmdOperatorMusicStore,
- EFMRadioChannelListToolbarButtonCmdSearchStations,
-
- //rocker
- EFMRadioRockerButtonKeyLeft,
- EFMRadioRockerButtonKeyLeftLong,
- EFMRadioRockerButtonKeyRight,
- EFMRadioRockerButtonKeyRightLong,
- EFMRadioRockerButtonKeyUp,
- EFMRadioRockerButtonKeyDown
- };
-
-enum TFMRadioNoteDialog
- {
- EHeadsetErrorNote = 750,
- EChNotFoundInformationNote
- };
-
-enum TFMRadioStationChangeType
- {
- EFMRadioStationChangeNone = 950,
- EFMRadioStationChangeNext,
- EFMRadioStationChangePrevious,
- EFMRadioStationChangeScanUp,
- EFMRadioStationChangeScanDown
- };
-
-enum
- {
- EFMRadioFrequencyEditor = 0x2000,
- EFMRadioCtFrequencyQuery
- };
-
-enum TFMRadioCancelScanType
- {
- EFMRadioCancelScanDefault = 0,
- EFMRadioCancelScanBySoftkey,
- EFMRadioCancelScanByHeadsetDisconnect
- };
-
-enum TFMRadioMusicStoreCommandIds
- {
- EFMRadioMusicStore = 40567,
- EFMRadioMusicStoreGoogle,
- EFMRadioMusicStoreWikipedia,
- EFMRadioMusicStoreAmg,
- EFMRadioMusicStoreNokiaMusicShop,
- EFMRadioMusicStoreMusicPortl,
- EFMRadioMusicStoreOperator
- };
-
-#endif // FMRADIO_HRH
--- a/fmradio/fmradio/inc/fmradioalfbitmapanimation.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Tuning animation for RadioGaGa
-*
-*/
-
-
-#ifndef CMFRADIOALFBITMAPANIMATION_H
-#define CMFRADIOALFBITMAPANIMATION_H
-
-
-// INCLUDES
-
-#include <alf/alfcontrol.h>
-
-
-// FORWARD DECLARATIONS
-
-class CAlfImageVisual;
-class CAlfAnchorLayout;
-
-
-// CONSTANTS
-
-
-/**
- * Alf control to show tuning animation
- */
-class CFMRadioAlfBitmapAnimation : public CAlfControl
- {
-
- public:
- /**
- * Two-phased constructor.
- * @param aEnv Alf environment
- */
- static CFMRadioAlfBitmapAnimation* NewL( CAlfEnv& aEnv );
- /**
- * Destructor.
- */
- virtual ~CFMRadioAlfBitmapAnimation();
-
- public: // from base class
- /**
- * From CAlfControl, takes care of alfred event handling.
- */
- TBool OfferEventL( const TAlfEvent& aEvent );
-
- public: // New functions
- /**
- * Shows the indicator with the defined opacity value.
- * @param aShowWithFading ETrue if the indicator will be shown with fading; EFalse otherwise.
- * @see SetOpacityInVisibleState()
- */
- void Show( TBool aShowWithFading );
- /**
- * Hides the indicator with the defined opacity value.
- * @param aHideWithFading ETrue if the indicator will be hidden with fading; EFalse otherwise.
- * @see SetOpacityInHiddenState()
- */
- void Hide( TBool aHideWithFading );
- /**
- * Sets the indicator rectangle
- * @param aRect Rectangle to the indicator
- */
- void SetRect( const TRect& aRect );
- /**
- * Starts bitmap animation after delay and
- * fades it in while animation is running
- */
- void StartBmpAnimation();
- /**
- * Stops bitmap animation after delay and
- * fades it out while animation is running
- */
- void StopBmpAnimation();
-
- private:
- // Custom events for the bitmap animation.
- enum TBmpAnimationCustomEvent
- {
- EBmpAnimationStart,
- EBmpAnimationContinue,
- EBmpAnimationStop
- };
-
- enum TBmpAnimationRunningState
- {
- EBmpAnimationStopped,
- EBmpAnimationStartup,
- EBmpAnimationRunning
- };
-
- void StartAnimation();
-
- CFMRadioAlfBitmapAnimation();
-
- void ConstructL( CAlfEnv& aEnv );
-
- void CreateImageAnimationVisualL();
-
- void CreateBitmapAnimationArrayL();
-
- void ContinueBmpAnimation();
-
- /**
- * Sets absolute rect of the anchor by top left and bottom right points.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aBottomRightPosition Bottom right point of the rect
- */
- void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition );
-
- private: // data
-
- // Visual containing current frame
- CAlfImageVisual* iAnimationImageVisual;
- // Animation frame array
- RArray<TAlfImage> iFrames;
- // Interval to change frames
- TInt iFrameInterval;
- // mbm file for bitmaps
- HBufC* iBitmapFileName;
- /** Anchor layout for Bmpanimation */
- CAlfAnchorLayout* iBmpAnimationAnchor;
- TInt iCurrentFrameIndex;
- /** Bmpanimation opacity in visible state */
- TReal iOpacityInVisibleState;
- /** Bmpanimation opacity in hidden state */
- TReal iOpacityInHiddenState;
- /** Bmpanimation rectangle */
- TRect iRect;
- /** Animation state */
- TBmpAnimationRunningState iAnimationState;
-
-
- };
-
-
-#endif // CMFRADIOALFBITMAPANIMATION_H
--- a/fmradio/fmradio/inc/fmradioalfindicator.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definition of the class CFMRadioAlfIndicator.
-*
-*/
-
-
-#ifndef ALF_INDICATOR_H
-#define ALF_INDICATOR_H
-
-// INCLUDES
-
-#include <AknUtils.h>
-#include <alf/alfcontrol.h>
-#include <alf/alfanchorlayout.h>
-
-// FORWARD DECLARATIONS
-
-class CAlfTextVisual;
-
-// CLASS DEFINITION
-
-/**
-* Text indicator control class
-*
-* Provides means to show and fade in/out a specific text inside the supplied "layout".
-*
-*/
-class CFMRadioAlfIndicator : public CAlfControl
- {
-public: // Constructors and destructor
-
- /**
- * Epoc two-phased constructor.
- * @param aEnv Reference to the HitchCock environment instance.
- * @return Pointer to this Indicator component.
- */
- static CFMRadioAlfIndicator* NewL( CAlfEnv& aEnv );
- /**
- * Destructor
- */
- virtual ~CFMRadioAlfIndicator();
-public: // Functions from base classes
- /**
- * From CAlfControl, takes care of alfred event handling.
- * @param aEvent
- */
- TBool OfferEventL( const TAlfEvent& aEvent );
-public: // New functions
- /**
- * Shows the indicator with the defined opacity value.
- * @param aShowWithFading ETrue if the indicator will be shown with fading; EFalse otherwise.
- * @see SetOpacityInVisibleState()
- */
- void Show( TBool aShowWithFading );
- /**
- * Hides the indicator with the defined opacity value.
- * @param aHideWithFading ETrue if the indicator will be hidden with fading; EFalse otherwise.
- * @see SetOpacityInHiddenState()
- */
- void Hide( TBool aHideWithFading );
- /**
- * Sets the indicator opacity in visible state.
- * @param aOpacity The indicator opacity
- */
- void SetOpacityInVisibleState( const TReal aOpacity );
- /**
- * Sets the indicator opacity in hidden state.
- * @param aOpacity The indicator opacity
- */
- void SetOpacityInHiddenState( const TReal aOpacity );
- /**
- * Sets the indicator text.
- * @param aText The indicator text to be shown
- */
- void SetTextL( const TDesC& aText );
- /**
- * Changes indicator text color
- * @param aTextColor Color of the indicator text
- */
- void SetTextColor( const TRgb& aTextColor );
- /**
- * Sets the indicator rectangle
- * @param aRect Rectangle to the indicator
- */
- void SetRect( const TRect& aRect );
-private:
- /**
- * C++ default constructor
- */
- CFMRadioAlfIndicator( );
- /**
- * EPOC second phase constructor.
- * @param aEnv Reference to the Hitchcock environment instance.
- */
- void ConstructL( CAlfEnv& aEnv );
-private: // New functions
- /**
- * Sets the fading animation to the CAlfVisual object.
- * @param aVisual a pointer to the visual object
- * @param aFadingTime Time duration after the visual object has been faded. Fading duration in milliseconds.
- * @param aOpacity Target opacity value
- */
- void Fade( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity ) const;
- /**
- * Sets absolute rect of the anchor by top left and bottom right points.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aBottomRightPosition Bottom right point of the rect
- */
- void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition );
- /**
- * Sets absolute rect of the anchor by top left and size of the rect.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aSize Size of the rect
- */
- void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TSize& aSize );
- /**
- * Sets relative rect of the anchor by top left and bottom right points.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aBottomRightPosition Bottom right point of the rect
- */
- void SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealPoint& aBottomRightPosition );
- /**
- * Sets relative rect of the anchor by top left and size of the rect.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aSize Size of the rect
- */
- void SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealSize& aSize );
- /**
- * Creates the needed drawing layers and visual objects
- * for the indicator.
- */
- void AddIndicatorLayerL();
- /**
- * Creates the text style for the indicator
- */
- void SetTextStyleL();
-
-private: // Data
-
- /** Anchor layout for indicator */
- CAlfAnchorLayout* iIndicatorTextAnchor;
- /** Visual object of the indicator. Not owned. */
- CAlfTextVisual* iText;
- /** Text color of the indicator text */
- TRgb iTextColor;
- /** Text style id of the indicator text */
- TInt iTextStyleId;
- /** Indicator opacity in visible state */
- TReal iOpacityInVisibleState;
- /** Indicator opacity in hidden state */
- TReal iOpacityInHiddenState;
- /** Indicator rectangle */
- TRect iRect;
- };
-
-#endif //ALF_INDICATOR_H
--- a/fmradio/fmradio/inc/fmradioalfmediaidle.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,422 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definition of the class CFMRadioAlfMediaIdle.
-*
-*/
-
-
-#ifndef FMRADIOALFMEDIAIDLE_H_
-#define FMRADIOALFMEDIAIDLE_H_
-
-// INCLUDES
-
-#include <AknUtils.h>
-#include <alf/alfcontrol.h>
-#include <alf/alfanchorlayout.h>
-
-#include "fmradioidlecontrolinterface.h"
-
-// FORWARD DECLARATIONS
-
-class CAlfGradientBrush;
-class CAlfEnv;
-class CAlfVisual;
-
-// CONSTANTS
-
-// CLASS DEFINITIONS
-
-/**
-* CFMRadioAlfMediaIdle class
-*
-* Class launches animated information in the defined subregion of the display.
-*/
-NONSHARABLE_CLASS(CFMRadioAlfMediaIdle) : public CAlfControl,
- public MFMRadioIdleControlInterface
- {
-public: // Constructors and destructor
-
- /** Display orientations. */
- enum TOrientation
- {
- EPortrait = 0x4A,
- ELandscape,
- EOrientationNone
- };
-
- /**
- * Epoc two-phased constructor.
- * @param aEnv Reference to Alfred environment instance.
- * @return Pointer to this media idle component.
- */
- static CFMRadioAlfMediaIdle* NewL( CAlfEnv& aEnv );
- /**
- * Destructor
- */
- virtual ~CFMRadioAlfMediaIdle();
-public: // Functions from base classes
- /**
- * From CAlfControl, takes care of alfred event handling.
- */
- TBool OfferEventL( const TAlfEvent& aEvent );
-
-public: // New functions
-
- /** Media idle modes. */
- enum TMediaIdleMode
- {
- EOnlyBackgroundText = 0xB0,
- EBackgroundTextAndMediaIdleItems
- };
-
- /**
- * Adds media idle item text to be used in the media idle
- * @param aMediaIdleItemText Text of the media idle item
- */
- void AddMediaIdleContentL( const TDesC& aMediaIdleItemText );
- /**
- * Removes all media idle item texts
- */
- void ResetMediaIdleContent();
- /**
- * Returns number of media idle content items
- * @return content count
- */
- TInt MediaIdleContentCount() const;
- /**
- * Sets the mode request for mode change. The mode
- * will be changed as soon as possible.
- * @param aRequestedMode Requested mode
- */
- void SetModeChangeRequestL( TMediaIdleMode aRequestedMode );
- /**
- * Retrieves the media idle mode
- */
- CFMRadioAlfMediaIdle::TMediaIdleMode Mode();
- /**
- * Sets primary color for the media idle
- * @param aColor The color that is used as primary color of media idle
- */
- void SetPrimaryColor( const TRgb& aColor );
- /**
- * Sets secondary color for the media idle
- * @param aColor The color that is used as secondary color of media idle
- */
- void SetSecondaryColor( const TRgb& aColor );
-
- /**
- * Return orientation of the display
- */
- CFMRadioAlfMediaIdle::TOrientation Orientation();
- /**
- * Set orientation of the display
- * @param aOrientation The display orientation
- */
- void SetOrientation( TOrientation aOrientation );
- /**
- * Calculates display layout
- */
- void UpdateLayout();
- /**
- * Adds PS name to the media idle item array
- */
- void AddPsNameToMediaIdleL( const TDesC& aPsName );
-
-private:
- /**
- * C++ default constructor
- */
- CFMRadioAlfMediaIdle( );
- /**
- * EPOC second phase constructor.
- * @param aEnv Reference to the Hitchcock environment instance.
- */
- void ConstructL( CAlfEnv& aEnv );
-
-private: // New functions
-
- /** Scroll directions for the media idle item. */
- enum TMediaIdleItemScrollDirection
- {
- EScrollLeftToRight = 0xA0,
- EScrollRightToLeft,
- EScrollNone
- };
-
- /** States of media idle. */
- enum TMediaIdleState
- {
- ERunning = 0xA0,
- EStopped
- };
-
- /** Custom events for the media idle. */
- enum TMediaIdleCustomEvent
- {
- EMediaIdleItemTransformationEnd = 0x5B,
- EMediaIdleBackgroundTextScrollEnd,
- EMediaIdleFadeOutAnimationEnd,
- EMediaIdleChangeMode,
- EMediaIdleEventNone
- };
-
- /**
- * Launches media idle immediately.
- */
- void StartMediaIdleL();
- /**
- * Creates media idle with passed number of the media idle items
- * @param aNumberOfMediaIdleItems Number of the media idle items
- */
- void AddMediaIdleL( const TInt aNumberOfMediaIdleItems );
- /**
- * Creates the media idle item to the passed media idle view port.
- * @param aMediaIdle The view port of the media idle
- * @param aMediaIdleItemText Text of the media idle item
- * @param aMediaIdleItemHasBackground TBool to indicate background visibility
- * @param aBackgroundColor The background color of the media idle item
- * @param aBackgroundOpacity The background opacity of the media idle item
- */
- CAlfTextVisual* AddMediaIdleItemL( CAlfLayout* aMediaIdle,
- const TDesC& aMediaIdleItemText,
- TBool aMediaIdleItemHasBackground = EFalse,
- const TRgb& aBackgroundColor = KRgbWhite,
- const TReal aBackgroundOpacity = 0.5f );
- /**
- * Initializes the media idle items
- * @param aNumberOfMediaIdleItems Number of the media idle items
- */
- void InitializeMediaIdleItemsL( const TInt aNumberOfMediaIdleItems );
- /**
- * Sets defined animation to the created media idle items
- */
- void AnimateMediaIdleItems();
- /**
- * Retrieves text from randomly chousen media idle item
- */
- HBufC* GetRandomMediaIdleContentL();
- /**
- * Sets color, opacity and scaling settings to the media idle item
- * @param aMediaIdleItem The media idle item
- * @param aMediaIdleItemText Text of the media idle item
- * @param aTextStyleId Text style for text of the media idle item
- */
- void SetMediaIdleItemSettingsL( CAlfTextVisual* aMediaIdleItem, const TDesC& aMediaIdleItemText, const TInt aTextStyleId );
- /**
- * Sets translating animations to the media idle item
- * @param aMediaIdleItem The media idle item
- */
- void SetMediaIdleItemAnimation( CAlfTextVisual* aMediaIdleItem );
- /**
- * Sets the media idle mode
- */
- void SetMode( TMediaIdleMode aMode );
- /**
- * Sets image to display
- * @param aBitmapFileName Full path to image file
- * @param aAbsoluteRect Rect of the image
- * @param aBorders
- * @param aParentLayout
- */
- void SetImageByAbsoluteRectL( const TDesC& aBitmapFileName,
- const TRect& aAbsoluteRect,
- TBool aBorders,
- CAlfLayout* aParentLayout = 0 );
- /**
- * Fades in media idle
- * @param aNow If ETrue shows media idle immediately otherwise
- * fades with defined fading duration
- */
- void MediaIdleFadeIn( TBool aNow = EFalse );
- /**
- * Fades out media idle
- * @param aNow If ETrue hides media idle immediately otherwise
- * fades with defined fading duration
- */
- void MediaIdleFadeOut( TBool aNow = EFalse );
- /**
- * Sets and starts scrolling animation to CAlfTextVisual.
- * The visual object is scrolled from current position to
- * right side of the display
- * @param aVisual a pointer to the visual object
- */
- void ScrollToRight( CAlfTextVisual* aVisual ) const;
- /**
- * Sets and starts scrolling animation to CAlfTextVisual.
- * The visual object is scrolled from current position to
- * left side of the display
- * @param aVisual a pointer to the visual object
- */
- void ScrollToLeft( CAlfTextVisual* aVisual ) const;
- /**
- * @param aVisual a pointer to the visual object
- * @param aTransitionTime Duration for reaching the target.
- * @param aEventAfterScrollingEnd custom even that will be sent when transition time is end
- */
- void SetScrollingToBackgroundText( CAlfTextVisual* aVisual,
- TInt aTransitionTime,
- TMediaIdleCustomEvent aEventAfterScrollingEnd = EMediaIdleEventNone ) ;
- /**
- * Sets fade-in animation to the CAlfVisual.
- * @param aVisual a pointer to the visual object
- * @param aFadingTime Time duration after the visual object has been faded in.
- * Fading duration in milliseconds
- * @param aOpacity Target opacity value
- */
- void FadeIn( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity = 1.0f ) const;
- /**
- * Sets fade-out animation to the CAlfVisual.
- * @param aVisual a pointer to the visual object
- * @param aFadingTime Time duration after the visual object has been faded out.
- * Fading duration in milliseconds
- * @param aOpacity Target opacity value
- */
- void FadeOut( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity = 0.0f ) const;
- /**
- * Translates the visual object with passed arguments
- * @param aTextVisual a pointer to the visual object
- * @param aX Translation value in the horizontal direction
- * @param aY Translation value in the vertical direction
- */
- void Translate( CAlfTextVisual* aTextVisual, const TAlfTimedValue& aX, const TAlfTimedValue& aY );
- /**
- * Removes all transformations of the visual object such as the scaling and translating.
- * @param aTextVisual a pointer to the visual object
- */
- void LoadTextVisualIdentity( CAlfTextVisual* aTextVisual );
- /**
- * Sets absolute rect of the anchor by top left and bottom right points.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aBottomRightPosition Bottom right point of the rect
- */
- void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition );
- /**
- * Sets absolute rect of the anchor by top left and size of the rect.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aSize Size of the rect
- */
- void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TSize& aSize );
- /**
- * Sets relative rect of the anchor by top left and bottom right points.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aBottomRightPosition Bottom right point of the rect
- */
- void SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealPoint& aBottomRightPosition );
- /**
- * Sets relative rect of the anchor by top left and size of the rect.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aSize Size of the rect
- */
- void SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealSize& aSize );
-
-
-
- /*
- * Transformation end event received
- */
- void HandleMediaIdleItemTransformationEndEventL( const TAlfEvent& aEvent );
-
- /**
- * Background text scroll end event received
- */
- void HandleBackgroundTextScrollEndEventL( const TAlfEvent& aEvent );
-
- /**
- ** Create fonts for media idle; based on a list of relative font sizes
- */
- void CreateFontsL();
-
- /**
- * Create a background idle text visual
- */
- void CreateBackgroundTextL();
- /**
- * Stops media idle
- */
- void StopAndFadeOutMediaIdle();
-
- // from MFMRadioIdleControlInterface
- void Show();
-
- /**
- * from MFMRadioIdleControlInterface
- */
- void Hide();
-
- /**
- * from MFMRadioIdleControlInterface
- */
- void Deactivate();
-
-private: // Data
- /** Status flag for knowing should the fonts be recreated or not */
- TOrientation iFontsOrientation;
- /** Display orientation */
- TOrientation iOrientation;
-
- /** Layout for media idle */
- TAknLayoutRect iMediaIdleLayout;
- /** Text style id of the media idle background text */
- TInt iMediaIdleItemBackgroundTextStyleId;
- /** States of media idle */
- TMediaIdleState iMediaIdleState;
- /** Keeps track of the current media idle mode */
- TMediaIdleMode iMediaIdleMode;
- /** Keeps track of the requested mode */
- TMediaIdleMode iMediaIdleRequestedMode;
- /** Counts the items that have finished their transformations for mode change */
- TInt iItemsTransformationEndEventCounter;
-
- /** Color to be used for the media idle items */
- TRgb iMediaIdlePrimaryColor;
- /** Color to be used for the media idle items */
- TRgb iMediaIdleSecondaryColor;
- /** Scroll direction for the media idle item */
- TMediaIdleItemScrollDirection iScrollDirection;
-
- /** Array for the strings of the media idle items */
- CDesCArrayFlat* iMediaIdleItemArray;
- /** Array for the text styles of the media idle items */
- RArray<TInt> iTextStyleIdArray;
- /** Scroll direction for the media idle background text */
- TMediaIdleItemScrollDirection iBackgroundTextScrollDirection;
- /** Indicates whether the instance is fully constructed */
- TBool iIsConstructed;
- /** the latest PS name added to the media idle item array. Owned */
- HBufC* iPsName;
- /** The last size for font creation */
- TInt iFontReferenceHeight;
- };
-
-#endif /*FMRADIOALFMEDIAIDLE_H_*/
--- a/fmradio/fmradio/inc/fmradioalfrdsviewer.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definition of the class CFMRadioAlfRDSViewer.
-*
-*/
-
-
-#ifndef ALF_RDS_VIEWR_H
-#define ALF_RDS_VIEWR_H
-
-// INCLUDES
-
-#include <alf/alfcontrol.h>
-#include <alf/alfanchorlayout.h>
-
-#include "fmradioidlecontrolinterface.h"
-// FORWARD DECLARATIONS
-
-class CAlfTextVisual;
-class MFMRadioAlfRdsViewObserver;
-// CLASS DEFINITION
-
-/**
-* Text indicator control class
-*
-* Provides means to show and fade in/out a specific text inside the supplied "layout".
-*
-*/
-class CFMRadioAlfRDSViewer : public CAlfControl,
- public MFMRadioIdleControlInterface
- {
-public: // Constructors and destructor
-
- /**
- * Epoc two-phased constructor.
- * @param aEnv Reference to the HitchCock environment instance.
- * @return Pointer to this Indicator component.
- */
- static CFMRadioAlfRDSViewer* NewL( CAlfEnv& aEnv );
- /**
- * Destructor
- */
- virtual ~CFMRadioAlfRDSViewer();
-public: // Functions from base classes
- /**
- * From CAlfControl, takes care of alfred event handling.
- * @param aEvent
- */
- TBool OfferEventL( const TAlfEvent& aEvent );
-public: // New functions
- /**
- * Resets the RDS viewer and
- * cancels alf events.
- */
- void Reset();
- /**
- * Sets the indicator opacity in visible state.
- * @param aOpacity The indicator opacity
- */
- void SetOpacityInVisibleState( const TReal aOpacity );
- /**
- * Sets the indicator opacity in hidden state.
- * @param aOpacity The indicator opacity
- */
- void SetOpacityInHiddenState( const TReal aOpacity );
- /**
- * Sets the indicator text.
- * @param aText The indicator text to be shown
- */
- TBool SetTextL( const TDesC& aText );
- /**
- * Changes indicator text color
- * @param aTextColor Color of the indicator text
- */
- void SetTextColor( const TRgb& aTextColor );
- /**
- * Sets the indicator rectangle
- * @param aRect Rectangle to the indicator
- */
- void SetRect( const TRect& aRect );
- /**
- * Get RDS text area visibility
- * @return visibility status
- */
- TBool IsShowingRdsTextArea() const;
- /**
- * Sets the Observer
- * @param aObserver The object to observe the control
- */
-
- void SetObserver( MFMRadioAlfRdsViewObserver* aObserver );
- /**
- * Removes the observer
- */
- void RemoveObserver( MFMRadioAlfRdsViewObserver* aObserver );
-
- /**
- * Check if the same rds text has been displayed
- * for the predefined time period
- * @return timer status
- */
- TBool IsRdsTextVisibilityTimerCompleted();
-private:
- /**
- * C++ default constructor
- */
- CFMRadioAlfRDSViewer();
- /**
- * EPOC second phase constructor.
- * @param aEnv Reference to the Hitchcock environment instance.
- */
- void ConstructL( CAlfEnv& aEnv );
- /**
- * from MFMRadioIdleControlInterface
- */
- void Show();
- /**
- * from MFMRadioIdleControlInterface
- */
- void Hide();
-
- /**
- * from MFMRadioIdleControlInterface
- */
- void Deactivate();
-
-private: // New functions
- /**
- * Sets the fading animation to the CAlfVisual object.
- * @param aVisual a pointer to the visual object
- * @param aFadingTime Time duration after the visual object has been faded. Fading duration in milliseconds.
- * @param aOpacity Target opacity value
- */
- void Fade( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity ) const;
- /**
- * Sets absolute rect of the anchor by top left and bottom right points.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aBottomRightPosition Bottom right point of the rect
- */
- void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition );
- /**
- * Sets absolute rect of the anchor by top left and size of the rect.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aSize Size of the rect
- */
- void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TSize& aSize );
- /**
- * Sets relative rect of the anchor by top left and bottom right points.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aBottomRightPosition Bottom right point of the rect
- */
- void SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealPoint& aBottomRightPosition );
- /**
- * Sets relative rect of the anchor by top left and size of the rect.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aSize Size of the rect
- */
- void SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealSize& aSize );
- /**
- * Creates the needed drawing layers and visual objects
- * for the indicator.
- */
- void AddIndicatorLayerL();
- /**
- * Creates the text style for the indicator
- */
- void SetTextStyleL();
-
-private:
-
- enum TFadeCustomEvent
- {
- EFadeInCompleted,
- EOldTextFadeEffectCompleted,
- ERDSDisplayTimerCompleted
- };
-
-private:// Data
- /** Anchor layout for indicator */
- CAlfAnchorLayout* iIndicatorTextAnchor;
- /** Visual object of the indicator. Not owned. */
- CAlfTextVisual* iText;
- /** Text color of the indicator text */
- TRgb iTextColor;
- /** Text style id of the indicator text */
- TInt iTextStyleId;
- /** Indicator opacity in visible state */
- TReal iOpacityInVisibleState;
- /** Indicator opacity in hidden state */
- TReal iOpacityInHiddenState;
- /** Indicator rectangle */
- TRect iRect;
- /** flag for RDS text area visibility */
- TBool iIsRdsTextVisible;
- /** local copy of latest RT */
- RBuf iRadioText;
- /** Array of observers. */
- RPointerArray<MFMRadioAlfRdsViewObserver> iObservers;
- // flag for rds text timer
- TBool iRdsTextVisibilityTimerCompleted;
- };
-
-#endif //ALF_RDS_VIEWR_H
--- a/fmradio/fmradio/inc/fmradioalfrdsviewobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares an interface for observing rds text events
-*
-*/
-
-#ifndef FMRADIOALFRDSVIEWOBSERVER_H_
-#define FMRADIOALFRDSVIEWOBSERVER_H_
-
-/*
- * Interface for notifying rds text events.
- */
-class MFMRadioAlfRdsViewObserver
- {
- public:
- /*
- * Called when the same rds text has been
- * displayed for predifined time period
- */
- virtual void NotifyRdsTextTimerCompletion() = 0;
- };
-#endif /* FMRADIOALFRDSVIEWOBSERVER_H_ */
--- a/fmradio/fmradio/inc/fmradioalfvisualizer.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,429 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definition of the class CFMRadioAlfVisualizer.
-*
-*/
-
-
-#ifndef FMRADIOALFVISUALIZER_H
-#define FMRADIOALFVISUALIZER_H
-
-// INCLUDES
-
-#include <AknUtils.h>
-#include <alf/alfcontrol.h>
-#include <alf/alfanchorlayout.h>
-#include <gesturecontrol.h>
-#include <gestureobserver.h>
-
-#include "fmradiodefines.h"
-#include "fmradio.hrh"
-
-// CONSTANTS
-
-/** Scroll directions of the visual objects. */
-enum TScrollDirection
- {
- EScrollLeftToRight = 0xA0,
- EScrollRightToLeft,
- EScrollNone
- };
-
-/** Possible display styles. */
-enum TFMRadioDisplayStyle
- {
- EFMRadioDisplaySingleLine = 0, /**< Single line display. */
- EFMRadioDisplayDoubleLine, /**< Double line display. */
- EFMRadioDisplayTuning, /**< Tuning display. */
- EFMRadioDisplayNoDisplay /**< No display used. */
- };
-
-/** Display orientations. */
-enum TDisplayOrientation
- {
- EPortrait = 0x4A,
- ELandscape,
- EOrientationNone
- };
-
-// FORWARD DECLARATIONS
-
-class CAlfTextVisual;
-class CAlfViewportLayout;
-class CAlfGradientBrush;
-class CFMRadioAlfBitmapAnimation;
-class CFMRadioAppUi;
-
-using namespace GestureHelper;
-// CLASS DEFINITION
-
-/**
-* CFMRadioAlfVisualizer class
-*
-* Visualizes informations of the FMRadio to the display by Hitchcock UI Toolkit
-*/
-NONSHARABLE_CLASS(CFMRadioAlfVisualizer) : public CGestureControl, public MGestureObserver
- {
-public: // Constructors and destructor
-
- /**
- * Epoc two-phased constructor.
- * @param aEnv Reference to the HitchCock environment instance.
- * @return Pointer to this Visualizer component.
- */
- static CFMRadioAlfVisualizer* NewL( CAlfEnv& aEnv );
- /**
- * Destructor
- */
- virtual ~CFMRadioAlfVisualizer();
-public: // Functions from base classes
- /**
- * From CGestureControl/CAlfControl, takes care of alfred event handling.
- * @param aEvent
- */
- TBool OfferEventL( const TAlfEvent& aEvent );
-
- /**
- * From CGestureControl, takes care of gesture event handling.
- * @param aEvent
- */
- void HandleGestureL( const MGestureEvent& aEvent );
-public: // New functions
- /**
- * Changes station to next with scrolling and fading station's
- * information (name, frequency, etc.).
- * @param aChangeType The change type
- * @param aFirstLine The text shown in the first line
- * @param aSecondLine The text shown in the second line, or NULL
- */
- void ChangeStationL( TFMRadioStationChangeType aChangeType,
- const TDesC& aFirstLine,
- const TDesC* aSecondLine = NULL );
- /**
- * Scrolls out the current station information lines by
- * hiding actual visuals and scrolling out the created temporary information lines.
- * @param aChangeType Station change type
- */
- void ScrollOutCurrentStationInformationL( TFMRadioStationChangeType aChangeType );
- /**
- * Resets the station information and sets static text to the third line
- * @param aInfoText an information text to show
- * @param aChangeType The change type
- */
- void SetStaticInfoTextL( TFMRadioStationChangeType aChangeType, const TDesC& aInfoText );
- /**
- * Change text color of the text visuals
- * @param aTextColor Color of the visual texts
- */
- void SetStationInformationTextColor( const TRgb& aTextColor );
- /**
- * Sets the display style in use.
- * @param aDisplayStyle Display style to use.
- */
- void SetDisplayStyle( TFMRadioDisplayStyle aDisplayStyle );
- /**
- * Returns the display style.
- * @return Display style.
- */
- TFMRadioDisplayStyle DisplayStyle() const;
- /**
- * Calculates display layout
- */
- void UpdateLayout();
- /**
- * Return orientation of the display
- */
- TDisplayOrientation Orientation();
- /**
- * Set orientation of the display
- * @param aOrientation Orientation of the display
- */
- void SetOrientation( TDisplayOrientation aOrientation );
- /**
- * Set mirrored layout state
- * @param aIsMirrored state
- */
- void SetMirrored( const TBool aIsMirrored );
- /**
- * @return Mirrored layout state
- */
- TBool IsMirrored() const;
-
- /**
- * Starts tuning animation after delay
- */
- void StartTuningAnimation();
-
- /**
- * Stops tuning animation by fading it away
- */
- void StopTuningAnimation();
-private:
- /**
- * C++ default constructor
- */
- CFMRadioAlfVisualizer( );
- /**
- * EPOC second phase constructor.
- * @param aEnv Reference to the Hitchcock environment instance.
- */
- void ConstructL( CAlfEnv& aEnv );
-private: // New functions
-
- /** The visuals of the station information display. */
- enum TStationInformationVisual
- {
- EFirstLineTextVisual = 0x1, /**< Text visual of the first line. */
- ESecondLineTextVisual = 0x2, /**< Text visual of the second line. */
- ETuningTextVisual = 0x4, /* Tuning text visual. */
- EAllVisuals = EFirstLineTextVisual |
- ESecondLineTextVisual |
- ETuningTextVisual
- };
-
- /**
- * Specifies the axis that is currently used in the station info drag
- */
- enum TFMRadioDragAxis
- {
- EFMRadioDragAxisNone = 0,
- EFMRadioDragAxisX,
- EFMRadioDragAxisY
- };
-
- /**
- * Sets text to the defined station information visual.
- * @param aVisual The text visual object for showing
- * @param aText Text
- */
- void SetVisualTextL( TStationInformationVisual aVisual, const TDesC& aText );
- /**
- * Shows the defined station information visual.
- * @param aVisual The text visual object for showing
- * @param aFade <code>ETrue</code> if fade effect it to be used, <code>EFalse</code> otherwise.
- */
- void ShowVisual( TStationInformationVisual aVisual, TBool aFade );
- /**
- * Hides the defined station information visual.
- * @param aVisual The text visual object for hiding
- */
- void HideVisual( TStationInformationVisual aVisual );
- /**
- * Sets and starts scrolling and fading animations to CAlfTextVisual.
- * The visual object is scrolled from right side of the display to
- * original position of the visual object.
- * @param aVisual a pointer to the visual object
- */
- void ScrollRightToLeftWithFadeIn( CAlfVisual& aVisual ) const;
- /**
- * Sets and starts scrolling and fading animations to CAlfTextVisual.
- * The visual object is scrolled from left side of the display to
- * original position of the visual object.
- * @param aVisual a pointer to the visual object
- */
- void ScrollLeftToRightWithFadeIn( CAlfVisual& aVisual ) const;
- /**
- * Sets and starts scrolling and fading animations to CAlfTextVisual.
- * The visual object is scrolled from top of the display to
- * original position of the visual object.
- * @param aVisual a pointer to the visual object
- */
- void ScrollInFromTop( CAlfVisual& aVisual ) const;
- /**
- * Sets and starts scrolling and fading animations to CAlfTextVisual.
- * The visual object is scrolled from bottom of the display to
- * original position of the visual object.
- * @param aVisual a pointer to the visual object
- */
- void ScrollInFromBottom( CAlfVisual& aVisual ) const;
- /**
- * Moves the visual back to it's original position
- * @param aVisual The visual to be moved
- */
- void RevertVisual( CAlfVisual& aVisual );
- /**
- * Sets and starts scrolling animation to CAlfVisual.
- * The visual object is scrolled from current position to
- * right side of the display
- * @param aVisual a reference to the visual object
- * @param aTime Time duration after the visual object has been scrolled to the target.
- * Scrolling duration in milliseconds.
- */
- void ScrollToRight( CAlfVisual& aVisual, TInt aTime ) const;
- /**
- * Sets and starts scrolling animation to CAlfVisual.
- * The visual object is scrolled from current position to
- * left side of the display
- * @param aVisual a reference to the visual object
- * @param aTime Time duration after the visual object has been scrolled to the target.
- * Scrolling duration in milliseconds.
- */
- void ScrollToLeft( CAlfVisual& aVisual, TInt aTime ) const;
- /**
- * Sets and starts scrolling animation to CAlfVisual.
- * The visual object is scrolled from current position above the the display
- * @param aVisual a reference to the visual object
- * @param aTime Time duration after the visual object has been scrolled to the target.
- * Scrolling duration in milliseconds.
- */
- void ScrollUp( CAlfVisual& aVisual, TInt aTime ) const;
- /**
- * Sets and starts scrolling animation to CAlfVisual.
- * The visual object is scrolled from current position below the the display
- * @param aVisual a reference to the visual object
- * @param aTime Time duration after the visual object has been scrolled to the target.
- * Scrolling duration in milliseconds.
- */
- void ScrollDown( CAlfVisual& aVisual, TInt aTime ) const;
- /**
- * Sets fade-in animation to the CAlfVisual.
- * @param aVisual a reference to the visual object
- * @param aFadingTime Time duration after the visual object has been faded in.
- * Fading duration in milliseconds
- * @param aOpacity Target opacity value
- */
- void FadeIn( CAlfVisual& aVisual, TInt aFadingTime, TReal aOpacity = 1.0f ) const;
- /**
- * Sets fade-out animation to the CAlfVisual.
- * @param aVisual a reference to the visual object
- * @param aFadingTime Time duration after the visual object has been faded out.
- * Fading duration in milliseconds
- * @param aOpacity Target opacity value
- */
- void FadeOut( CAlfVisual& aVisual, TInt aFadingTime, TReal aOpacity = 0.0f ) const;
- /**
- * Translates the visual object with passed arguments
- * @param aTextVisual a pointer to the visual object
- * @param aX Translation value in the horizontal direction
- * @param aY Translation value in the vertical direction
- */
- void Translate( CAlfTextVisual* aTextVisual, const TAlfTimedValue& aX, const TAlfTimedValue& aY );
- /**
- * Removes all transformations of the visual object such as the scaling and translating.
- * @param aTextVisual a pointer to the visual object
- */
- void LoadTextVisualIdentity( CAlfTextVisual* aTextVisual );
- /**
- * Sets absolute rect of the anchor by top left and bottom right points.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aBottomRightPosition Bottom right point of the rect
- */
- void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition );
-
- /**
- * Creates the needed drawing layers and visual objects
- * for visualiazing the station information.
- */
- void AddInformationLayersL();
- /**
- * Creates the text styles to be used by station information visualiazing
- */
- void CreateTextStylesForStationInformationL();
- /**
- * Creates copy of current station information
- */
- void CreateTemporaryStationInformationVisualsL();
- /**
- * Animates temporary station infoout of the display
- * @param aChangeType Change type
- */
- void AnimateTemporaryStationInformationVisuals( TFMRadioStationChangeType aChangeType );
- /**
- * Triggers the command to view handling
- */
- void TriggerCommandL();
- /**
- * Static call back for the long key press timer.
- * @param aSelf Pointer to self.
- * @return KErrNone
- */
- static TInt StaticLongPressCallBack( TAny* aSelf );
-private: // Data
-
- /** Layout for the station information */
- TAknLayoutRect iStationInformationLayout;
- /** Layout for the transparent background layer of the station information */
- TAknLayoutRect iTransparentBackgroundLayout;
-
- /** Layout for the first line. */
- TAknLayoutText iFirstLineLayout;
- /** Layout for the second line */
- TAknLayoutText iSecondLineLayout;
- /** Layout for the tuning text. */
- TAknLayoutText iTuningTextLayout;
- /** Layout for the tuning animation. */
- TAknLayoutRect iTuningAnimationLayout;
-
- /** Visual object of the first line. Not owned. */
- CAlfTextVisual* iFirstLineVisualText;
- /** Visual object of the second line. Not owned. */
- CAlfTextVisual* iSecondLineVisualText;
- /** Visual text for tuning text. Not owned */
- CAlfTextVisual* iTuningVisualText;
-
- /** The layout for the station info visuals */
- CAlfAnchorLayout* iStationInformationAnchorLayout;
- /** The layout for temporary station info fade out effect */
- CAlfAnchorLayout* iStationInformationTempAnchorLayout;
-
- /** Text color of the station information visuals */
- TRgb iStationInformationTextColor;
-
- /** Text style id of the first line */
- TInt iFirstLineTextStyleId;
- /** Text style id of the second line */
- TInt iSecondLineTextStyleId;
- /** Text style id of the tuning text line */
- TInt iTuningTextStyleId;
-
- /** Display style */
- TFMRadioDisplayStyle iDisplayStyle;
- /** Display orientation */
- TDisplayOrientation iOrientation;
- /** Scroll direction */
- TScrollDirection iScrollDirection;
- // Bitmap Animation
- CFMRadioAlfBitmapAnimation* iBmpAnimation;
- // Flag to indicate mirrored layout usage
- TBool iMirrored;
- // visual size for bitmap animation positioning
- TSize iTuningTextVisualSize;
- // counts rt text (3rd line) scrollout -events for rt-timeout.
- TInt iScrollOutCounter;
- // Pointer to CFMRadioAppUi. Not owned
- CFMRadioAppUi* iAppUi;
- // key event
- TInt iKeyScanCode;
- /**
- * If the long key event was detected or not. If it was, the subsequent key up should be ignored
- */
- TBool iLongKeyTriggered;
- /**
- * Long key press timer. Owned.
- */
- CPeriodic* iLongPressTimer;
- // The position of the visual before the dragging started
- TAlfTimedPoint iDragStartPosition;
- // Status for determinging whether or not to revert the visual back to it's original position
- TBool iRevertGestureDrag;
- // The axis for the currently ongoing stroke
- TFMRadioDragAxis iDragAxis;
- };
-
-#endif //FMRADIOALFVISUALIZER_H
--- a/fmradio/fmradio/inc/fmradioapp.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Main application class definitions.
-*
-*/
-
-/*! \mainpage
-*
-* @section intro Introduction
-*
-* @subsection abstract Abstract
-*
-* Application provides FM radio functionality for
-* finding, saving and playing radio stations.
-*
-* @subsection architecture Basic architecture
-*
-* FMRadio constructs from the following program modules:
-* application UI, application engine, plugin extensions and interfaces to external components.
-**
-* @subsection containedcomponents Contained Components/Executables
-*
-* - fmradio.exe / UI application
-* - fmradioengine.dll / Application engine
-* - fmradioactiveidleengine200.dll / Active idle engine. Notify observers about P&S changes
-* - fmradioactionhandler.dll / Action handler plugin. Handles P&S commands
-* - fmradiomcpplugin100.dll / Content publisher plugin. Publishes radio data to other components
-*
-* @subsection providedapis Provided APIs
-*
-* - FM Radio command line parameters.
-* - Publish & Subscribe interface.
-*
-* @section usecases Use cases
-*
-* \image html fmradio_use_case.png "Use cases"
-*
-
-*
-*/
-
-#ifndef FMRADIOAPP_H
-#define FMRADIOAPP_H
-
-// INCLUDES
-#include <aknapp.h>
-
-// CONSTANTS
-
-// CLASS DECLARATION
-
-/**
-* CFMRadioApp application class.
-* This class is a part of the standard application framework. The application
-* gets instantiated by this class. Provides a factory method for
-* instantiating the document object.
-*
-* @since 2.6
-*/
-class CFMRadioApp : public CAknApplication
- {
-
- private:
- /**
- * From CApaApplication, creates CFMRadioDocument document object.
- * @return A pointer to the created document object.
- */
- CApaDocument* CreateDocumentL();
- /**
- * From CApaApplication, returns application's UID (KUidFMRadio).
- * @return The value of KUidFMRadio.
- */
- TUid AppDllUid() const;
- };
-
-#endif
-
-// End of File
-
--- a/fmradio/fmradio/inc/fmradioappui.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,805 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definition of class FMRadioAppUi. Provides command
-* and callback interfaces to control the engine and the
-* application views.
-*
-*/
-
-
-#ifndef FMRADIOAPPUI_H
-#define FMRADIOAPPUI_H
-
-// INCLUDES
-#include <eikapp.h>
-#include <eikdoc.h>
-#include <e32std.h>
-#include <coeccntx.h>
-#include <aknViewAppUi.h>
-#include <coecntrl.h>
-#include <aknnotedialog.h>
-#include <aknnotewrappers.h>
-#include <iaupdateobserver.h>
-
-#include "fmradioenginestatechangecallback.h"
-#include "fmradioengine.h"
-#include "fmradiodefines.h"
-#include "fmradiosvkevents.h"
-#include "fmradioglobalconfirmationquery.h"
-#include "mchannellisthandler.h"
-
-
-// FORWARD DECLARATIONS
-class CAknQueryDialog;
-class CFMRadioBackSteppingServiceWrapper;
-class CFMRadioDocument;
-class CFMRadioMainContainer;
-class CFMRadioScanLocalStationsView;
-class CFMRadioChannelListView;
-class CFMRadioMainView;
-class CEikMenuPane;
-class MFMRadioLayoutChangeObserver;
-class CAlfEnv;
-class CAknVolumePopup;
-class CAknInformationNote;
-class CAknGlobalNote;
-class CIAUpdate;
-class CIAUpdateParameters;
-class CFMRadioControlEventObserverImpl;
-class CRepository;
-// CLASS DECLARATION
-
-/**
-* Interface to tell when dialog was terminated
-*
-* @since 2.6
-*/
-class MInformationNoteInterface
- {
- public:
-
- /**
- * tells when dialog was terminated
- */
- virtual void DialogTerminated() = 0;
-
- };
-
-
-/**
-* Information note for headset key events. Enabling functionality to disable new dialog creation
-* when dialog is active
-*
-* @since 2.6
-*/
-class CFMInformationNote: public CAknInformationNote
- {
- public:
-
- /**
- * default constructor.
- */
- CFMInformationNote( MInformationNoteInterface& aObserver);
-
- /**
- * Destructor.
- */
- virtual ~CFMInformationNote();
-
- private:
-
- // Dialog event observer
- MInformationNoteInterface& iDialogObserver;
-
- };
-
-
-
-/**
-* Instantiates the application views. It also acts as the default command handler for the
-* application. Part of the standard application framework.
-*
-* @since 2.6
-*/
-
-class CFMRadioAppUi : public CAknViewAppUi,
- public MFMRadioSvkEventsObserver,
- public MCoeControlObserver,
- private MRadioEngineStateChangeCallback,
- private MFMRadioGlobalConfirmationQueryObserver,
- private MInformationNoteInterface,
- public MChannelListHandler,
- public MIAUpdateObserver
-
- {
- public:
- // Volume, seek, tune and channel changing directions
- enum TFMRadioDirections
- {
- EDirectionUp,
- EDirectionNone,
- EDirectionDown
- };
-
- public: // Constructors and destructor
- /**
- * EPOC default constructor.
- */
- void ConstructL();
- /**
- * Destructor.
- */
- virtual ~CFMRadioAppUi();
-
- /**
- * Utility method to select the right layout resource according to
- * mirroring and orientation
- *
- * @param aNormalPortraitRes Normal portrait resource id
- * @param aMirroredPortraitRes Mirrored portrait resource id
- * @param aNormalLandscapeRes Normal landscape resource id
- * @param aMirroredLandscapeRes Mirrored landscape resource id
- * @return one of the resource id's passed to this method
- */
- TInt ChooseLayoutResource( const TInt aNormalPortraitRes,
- const TInt aMirroredPortraitRes,
- const TInt aNormalLandscapeRes,
- const TInt aMirroredLandscapeRes ) const;
- public: // Functions from base classes
-
- /**
- * From CEikAppUi, takes care of command handling.
- * @since 2.6
- * @param aCommand command to be handled
- */
- void HandleCommandL( TInt aCommand );
-
- /**
- * Notification interface from RadioEngine. Used to inform
- * us when requests have completed.
- * @since 2.6
- * @param aEventCode code corresponding to the event being propogated
- * @param aErrorCode error code of the event being propogated
- */
- void HandleRadioEngineCallBack( MRadioEngineStateChangeCallback::TFMRadioNotifyEvent aEventCode, TInt aErrorCode );
- public: // new functions
- /**
- * Returns a pointer to the radio engine
- *
- * @return Radio engine
- */
- CRadioEngine* RadioEngine();
-
- /**
- * Returns a reference to Back Stepping wrapper
- *
- * @return Reference to Back Stepping wrapper
- */
- CFMRadioBackSteppingServiceWrapper& BackSteppingWrapper() const;
-
- /**
- * Returns a pointer to FMRadio's document, cannot be null.
- *
- * @return A pointer to a CFMRadioDocument object.
- */
- CFMRadioDocument* Document() const;
- /**
- * Checks if current screen orientation is landscape
- *
- * @return ETrue if orientation is landscape, otherwise EFalse
- */
- TBool IsLandscapeOrientation() const;
-
- /**
- * Handles offline mode at startup.
- */
- void HandleOfflineModeAtStartUpL();
-
- /**
- * Handles start up foreground event.
- */
- void HandleStartupForegroundEventL();
- /**
- * Nunber of channels stored in presets.
- * @return number of channels in presets
- */
- TInt NumberOfChannelsStored() const;
- /**
- * Returns the UID of the currently active local view. KNullUid if none
- * active (construction/destruction).
- * @return UID of the currently active local view, KNullUid if none
- * active.
- */
- TUid ActiveView() const;
- /**
- * Return startup scanning wizard status.
- * @return running status
- */
- TBool IsStartupWizardRunning() const;
- /**
- * Set startup scanning wizard status.
- * @param aRunningState running state
- */
- void SetStartupWizardRunning( const TBool aRunningState );
- /**
- * Tune to the specified frequency
- * @since 2.6
- * @param aFrequency the frequency to be tuned
- */
- void TuneL(TInt aFrequency);
- /**
- * @return mirrored layout state
- */
- TBool IsLayoutMirrored() const;
- /**
- * Show currently active volume popup control
- */
- void ShowVolumePopupL();
-
- /**
- * From MChannelListHandler
- * Updates channels array in appui
- * @param aOperation tells which operation is made to array
- * @param aIndex tells affecting index
- * @param aMovedToNewIndex optional during move operation
- */
- void UpdateChannelsL( TMoveoperations aOperation,
- TInt aIndex,
- TInt aMovedToNewIndex );
-
- /**
- * From MChannelListHandler
- * Add a new channel to list of channels
- * @param aChannelName Name of the channel to be saved
- * @param aChannelFreq Channel frequency
- */
- void AddChannelToListL( const TDesC& aChannelName, TInt aChannelFreq );
-
- /**
- * From MChannelListHandler
- * Accessory method to channels array
- */
- CArrayFixFlat<TChannelInformation>* Channels();
-
- void AutoTuneInMainView ( TBool aTune );
- /**
- * status of the startup wizard state
- * @return wizard status
- */
- TBool IsStartupWizardHandled() const;
- /**
- * Return the index of the first channel that matches the
- * frequency specified.
- * @since 2.6
- * @param aFrequency The frequency to match against
- * @return the index of the channel whose frequency matched.
- * -1 if no frequency matched.
- */
- TInt MatchingChannelL( TInt aFrequency );
-
- /**
- * Erase a channel
- * @param aIndex index to delete
- * @return ETrue if user accepted delete, otherwise EFalse
- */
- TBool EraseChannelL( TInt aIndex );
-
- /*
- * Returns a pointer to the currently active volume popup control
- * @return active volume popup
- */
- CAknVolumePopup* ActiveVolumePopup() const;
-
- protected:
- /**
- * From CEikAppUi HandleWsEventL
- */
- void HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination);
-
- /**
- * From base class CCoeAppUi
- */
- void HandleForegroundEventL( TBool aForeground );
-
- private: // Functions from base classes
-
- /**
- * Handles a change to the application's resources
- * @param aType The type of changed resource
- */
- void HandleResourceChangeL( TInt aType );
- /**
- * Updates the landscape data. This is done separately
- * and not in IsLandscapeOrientation method as
- * IsLandscapeOrientation MUST NOT do a window server flush
- */
- void UpdateLandscapeInformation();
- private: // new functions
-
- /**
- * All leaving function calls are made here, so that nothing is left on the stack if the ConstructL leaves
- * The reason for this behaviour is that the UI framework doesn't handle leaves from the AppUi correctly.
- */
- void SecondaryConstructL();
- /**
- * Perform object cleanup. This would normally be performed in the destructor, but since it can also be
- * called from SecondaryConstructL it was moved into a seperate function.
- */
- void Cleanup();
- /**
- * Handles callback from engine
- * @since 3.0
- */
- void HandleInitializedCallbackL();
- /**
- * Updates radio volume level by one step at time.
- * @since 2.6
- * @param aDirection Parameter is interpreted as
- * following: 1 = increase volume, 0 = no change,
- * -1 = decrease volume.
- */
- void UpdateVolume( CFMRadioAppUi::TFMRadioDirections aDirection );
- /**
- * Perform automatic tuning to the next available audible frequency
- * @since 2.6
- */
- void ScanUpL();
- /**
- * Perform automatic tuning to the last available audible frequency
- * @since 2.6
- */
- void ScanDownL();
- /**
- * Save currently tuned frequency to the currently selected channel
- * @since 2.6
- * @param aIndex the index of the slot to save the channel to.
- */
- void SaveChannelL( TInt aIndex );
- /**
- * Tune the radio hardware to the frequency saved at the specified channel
- * @since 2.6
- * @param aIndex index of channel to tune to
- */
- void PlayChannel( TInt aIndex );
- /**
- * Set the audio output of the radio, and update the UI
- * @since 2.6
- * @param aAudioOutput the audio output (headset or IHF)
- */
- void SetAudioOutput( CRadioEngine::TFMRadioAudioOutput aAudioOutput );
- /**
- * Cancel outstanding seek request
- * @since 2.6
- */
- void CancelSeek();
- /**
- * Shutdown the application.
- * @since 2.6
- */
- void ExitApplication();
- /**
- * Rename the currently selected channel
- * @since 2.6
- */
- void RenameCurrentChannelL();
- /**
- * Display confirmation dialog for channel deletion
- * @param aIndex the index of the channel to delete
- */
- TBool ConfirmChannelListDeleteL( TInt aIndex );
- /**
- * Saves channel to be last item in channels list
- * @since 2.6
- */
- void SaveChannelToLastIntoListL();
- /**
- * Displays an error note with the text contained in the passed in reference
- * @since 2.6
- * @param aErrorNote id of the text to display in the error note
- */
- void DisplayErrorNoteL( TInt aErrorNote );
-
- /**
- * Displays an information note with the text contained in the passed in reference
- * @since 2.6
- * @param aInfoNote id of the text to display in the error note
- */
- void DisplayInformationNoteL( TInt aInfoNote );
-
- /**
- * Return the numeric key value corresponding to the key code
- * @since 2.6
- * @param aCode the Symbian key code
- * @return the numeric key value
- */
- TInt NumericKeyValue( TUint aCode );
- /**
- * Turn the fm radio hardware on
- * @since 2.6
- */
- void TurnRadioOn();
- /**
- * Processes "seek operation completed" callback
- * @since 2.6
- */
- void HandleStopSeekCallback();
- /**
- * Processes "set mute state" callback
- * @since 2.6
- */
- void HandleSetMuteStateCallback();
- /**
- * Processes "volume changed" callback
- * @since 2.6
- */
- void HandleVolumeChangedCallback();
- /**
- * Processes "set audio output completed" callback
- * @since 2.6
- */
- void HandleAudioOutputSetCallback();
- /**
- * Processes "headset reconnected" callback
- * @since 2.6
- */
- void HandleHeadsetReconnectedCallback();
- /**
- * Processes "headset disconnected" callback
- * @since 2.6
- */
- void HandleHeadsetDisconnectedCallback();
- /**
- * Processes "flightmode disabled" callback
- * @since 2.6
- */
- void HandleFlightmodeDisabledCallback();
- /**
- * Processes "volume update failed" callback
- * @since 2.6
- */
- void HandleVolumeUpdateFailedCallback();
- /**
- * Handles mute keypress from main view
- *
- */
- void HandleMuteCommand();
- /**
- * Processes "manual tune failed" callback
- * @since 2.6
- */
- void HandleManualTuneFailedCallback();
- /**
- * Processes audio resource not available
- * @since 3.0
- */
- void HandleAudioResourceNotAvailableL(TInt aErrorCode);
-
- /**
- * Processes audio resource available
- * @since 3.0
- */
- void HandleAudioResourceAvailableL();
-
- /**
- * Processes FM Transmitter on.
- * @since 3.2
- */
- void HandleFMTransmitterOnCallbackL();
-
- /**
- * Processes Frequency range changed.
- * @since 3.2
- */
- void HandleFreqRangeChangedCallback();
-
- /**
- * Processes Frequency range changed.
- * @since 3.2
- */
- void HandleFlightModeEnabledCallbackL();
-
- /**
- * Handle flight mode disabled.
- * @since 3.2
- */
- void HandleFlightModeDisabledCallback();
-
- /**
- * Processes Frequency range changed.
- * @since 3.2
- */
- void HandleTunerReadyCallback();
-
- /**
- * Get region automatically from network or manually by user choice if network
- * is not available
- */
- TFMRadioRegionSetting HandleRegionsAtStartUpL();
-
- /**
- * Request tuner control from engine
- */
- void RequestTunerControl() const;
-
- /**
- * Is offline profile activated when radio audio was disabled.
- * @return ETrue, if offline profile activated when radio
- * audio was disabled. EFalse otherwise.
- */
- TBool IsOfflineProfileActivatedWhenRadioAudioDisabled() const;
-
- /**
- * Sets the toolbar visibility.
- * @param aVisible
- */
- void ShowToolbar( TBool aVisible );
-
- /**
- * Determine if scan all local stations view should be started
- * in wizard mode
- */
- void HandleStartupWizardL();
-
- /**
- * Start local stations scan
- */
- void StartLocalStationsSeekL();
-
- /**
- * Tries to start radio again if the situation allows it
- */
- void TryToResumeAudioL();
- /**
- * Fade and show exit on all views
- */
- void FadeViewsAndShowExit( TBool aState );
-
- /*
- * Show connect headset query with only exit softkey
- */
- void ShowConnectHeadsetDialogL();
-
- /*
- * Get help context based on active view
- * @return array containing help context for active view
- */
- CArrayFix<TCoeHelpContext>* GetCurrentHelpContextL() const;
-
- /**
- * A call back function for processing start up foreground event.
- *
- * @param aSelfPtr Pointer to self.
- * @return Always 0.
- */
- static TInt StaticStartupForegroundCallback( TAny* aSelfPtr );
-
- private:
-
- /**
- * Called when volume level should be changed.
- * Set volume control visible.
- * @param aVolumeChange: +1 change volume up
- * -1 change volume down
- */
- void FMRadioSvkChangeVolumeL( TInt aVolumeChange );
-
- /**
- * Called when volume was changed last time 2 seconds ago or
- * timer was started 2 seconds ago. The remove control timer
- * is started when ChangeVolumeL() is called
- * or when started through CMmsSvkEvents::StartRemoveTimerL()
- */
- void FMRadioSvkRemoveVolumeL( );
-
- void FMRadioHeadsetEvent(TAccessoryEvent aEvent);
-
- /**
- * From MFMRadioGlobalConfirmationQueryObserver
- *
- * @see MFMRadioGlobalConfirmationQueryObserver::GlobalConfirmationQueryDismissedL(TInt aSoftKey)
- */
- void GlobalConfirmationQueryDismissedL( TInt aSoftKey );
-
- /**
- *From MCoeControlObserver. To handle the volume events.
- */
- void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
-
- /**
- * From MInformationNoteInterface. To handle dialog terminated events.
- */
- void DialogTerminated();
-
- /**
- * Gets the Channels array
- */
- void GetChannelsArrayL();
- /**
- * Check available IAD updates
- */
- void HandleIADUpdateCheckL();
- // from base class MIAUpdateObserver
- void CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates );
- void UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResultDetails );
- void UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow );
-
- /**
- * Processes the tail of the command
- * @param aTail The tail to be processed
- */
- void ProcessCommandTailL( const TDesC8& aTail );
-
- // from base class CEikAppUi
- MCoeMessageObserver::TMessageResponse HandleMessageL(
- TUint32 aClientHandleOfTargetWindowGroup,
- TUid aMessageUid,
- const TDesC8& aMessageParameters );
-
- TBool ProcessCommandParametersL( TApaCommand aCommand,
- TFileName& aDocumentName,
- const TDesC8& aTail );
-
- /**
- * Check if Active Idle app is on foreground.
- *
- * @return ETrue if idle app is in the foreground, EFalse otherwise.
- */
- TBool IsIdleAppForeground();
-
- /**
- * Check if Active Idle is enabled.
- *
- * @return ETrue if active idle is in the enabled, EFalse otherwise.
- */
- TBool IsActiveIdleEnabled();
-
- /**
- * Handles the possibly pending view activation
- */
- void HandlePendingViewActivationL();
-
- private:
-
- enum TInterfaceState
- {
- EFMRadioStateOff = 0, // Radio off
- EFMRadioStateOffForPhoneCall, // Radio off because a phone call
- EFMRadioStateOffBeforePhoneCall,// Radio was off + phone call going on -> no resume
- EFMRadioStateOn,
- EFMRadioStateRecording,
- EFMRadioStateBusyRadioOn,
- EFMRadioStateBusyRadioOff,
- EFMRadioStateBusyScanUp,
- EFMRadioStateBusyScanDown,
- EFMRadioStateBusySeek,
- EFMRadioStateBusyMute,
- EFMRadioStateBusyVolume,
- EFMRadioStateBusyManualTune,
- EFMRadioStateBusyScanLocalStations,
- EFMRadioStateExiting
- };
-
- /**
- * State to indicate the mute status
- */
- enum TFMMuteStatus
- {
- EFMUninitialized = 0, // Uninitialized value
- EFMUnmuted, // Unmute state
- EFMMuted // Mute state
- };
-
- // System's volume indicator
- CAknVolumePopup* iIhfVolumePopupControl;
- CAknVolumePopup* iHeadsetVolumePopupControl;
- CAknVolumePopup* iActiveVolumePopupControl;
-
- CRadioEngine* iRadioEngine;
- TInt iCurrentRadioState;
- CFMRadioScanLocalStationsView* iScanLocalStationsView;
- CFMRadioChannelListView* iChannelListView;
- CFMRadioMainView* iMainView;
- //all the possible radio UI states
- TInt iFMRadioVariationFlags;
- CFMRadioSvkEvents* iSvkEvents;
- TBool iAlreadyClean;
- MFMRadioLayoutChangeObserver* iLayoutChangeObserver;
- CFMRadioControlEventObserverImpl* iControlEventObserver;
- /**
- * Is audio resources available
- */
- TBool iAudioResourceAvailable;
-
- /**
- * Was audio lost "permanently" due to another music playing application?
- */
- TBool iAudioLost;
-
- /**
- * Global offline query. Owned
- */
- CFMRadioGlobalConfirmationQuery* iGlobalOfflineQuery;
-
- /**
- * Local activate offline query. Owned
- */
- CAknQueryDialog* iLocalActivateOfflineQuery;
-
- /**
- * Local continue offline query. Owned
- */
- CAknQueryDialog* iLocalContinueOfflineQuery;
-
- /**
- * Is offline profile activated when radio audio was disabled.
- */
- TBool iOfflineProfileActivatedWhenRadioAudioDisabled;
-
- /**
- * Is the local "continue in offline" query visible.
- */
- TBool iShowingLocalOfflineContinueQuery;
-
- /**
- * Is the local or global offline query activated.
- */
- TBool iOfflineQueryDialogActivated;
-
- /**
- * Is the start up of application ongoing.
- */
- TBool iStartUp;
-
- /**
- * Is the screen orientation landscape
- */
- TBool iLandscape;
- CAlfEnv* iAlfEnv; // Owned
- // flag to indicate wizard handling
- TBool iStartupWizardHandled;
- // flag for startup wizard status
- TBool iStartupWizardRunning;
- // connect headset query
- CAknQueryDialog* iConnectHeadsetQuery;
- // flag to indicate if automatic tune is activated from startup wizard
- TBool iTuneFromWizardActivated;
- // akn information note ptr to check that dialog has dismissed from display
- TBool iInfoNoteOn;
- // global note for headset status when radio is background
- CAknGlobalNote* iConnectHeadsetGlobalNote;
- // flag for previous mute status
- TFMMuteStatus iMuteStatusBeforeRadioInit;
- // Channels list
- CArrayFixFlat<TChannelInformation>* iChannels;
- // IAD client object. Owned.
- CIAUpdate* iUpdate;
- // Parameters for IAD update. Owned.
- CIAUpdateParameters* iParameters;
- TBool iAutoTune;
- TBool iAutoTuneUnmute;
- // The backstepping wrapper. Owned.
- CFMRadioBackSteppingServiceWrapper* iBsWrapper;
- // Is feature manager initialized, used for uninitializing feature manager
- TBool iFeatureManagerInitialized;
- // own, for active idle setting
- CRepository* iSettingsRepository;
- // Callback for processing start up foreground event.
- CAsyncCallBack* iStartupForegroundCallback;
- // The view id of the view that is to be activated when possible
- TUid iPendingViewId;
- };
-
-#endif
-
-// End of File
--- a/fmradio/fmradio/inc/fmradiobacksteppingservicewrapper.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration of the class CFMRadioBackSteppingServiceWrapper
-*
-*/
-
-#ifndef CFMRADIOBACKSTEPPINGSERVICEWRAPPER_H
-#define CFMRADIOBACKSTEPPINGSERVICEWRAPPER_H
-
-#include <coeview.h>
-#include <e32base.h>
-#include <vwsdef.h>
-
-class MLiwInterface;
-class CLiwGenericParamList;
-class CLiwServiceHandler;
-
-/**
- * Back Stepping (BS) Service wrapper.
- */
-class CFMRadioBackSteppingServiceWrapper : public CBase, public MCoeViewActivationObserver
- {
-
-public:
-
- /**
- * Static constructor.
- * The object can be registered as view activation observer
- * or view activations can be notified explicitly by HandleViewActivationEventL.
- *
- * @param aUid Application UID.
- */
- static CFMRadioBackSteppingServiceWrapper* NewL( TUid aUid );
-
- /**
- * Destructor.
- */
- ~CFMRadioBackSteppingServiceWrapper();
-
- /**
- * Forwards view activation event to BS Service.
- *
- * @param aViewId View id of the view where back is called.
- * @param aEnter Indicates if it is entry or exit activation.
- */
- void HandleViewActivationEventL( const TVwsViewId aViewId, TBool aEnter );
-
- /**
- * Forwards back command to BS Service.
- *
- * @param aViewId View id of the view where back is called.
- * @return Returns Etrue if BS Service consumed the command, otherwise returns EFalse.
- */
- TBool HandleBackCommandL( const TVwsViewId aViewId );
-
-private:
-
- /**
- * C++ default constructor.
- */
- CFMRadioBackSteppingServiceWrapper();
-
- /**
- * 2nd phase constructor
- *
- * @param aUid Application UID.
- */
- void ConstructL( TUid aUid );
-
- /**
- * Initializes BS Service.
- *
- * @param aUid Application UID.
- */
- void InitializeL( TUid aUid );
-
- /**
- * Handles the result of a LIW command
- *
- * @return Returns ETrue if LIW command executed, otherwise returns EFalse.
- */
- TBool HandleResultL();
-
- // from base class MCoeViewActivationObserver
- void HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId,
- const TVwsViewId& aViewIdToBeDeactivated );
-
-private: // data
-
- /**
- * AIW Service Handler.
- * Owned.
- */
- CLiwServiceHandler* iServiceHandler;
-
- /**
- * BS Service interface returned by LIW.
- * Owned.
- */
- MLiwInterface* iBsInterface;
-
- /**
- * In param list.
- * Not owned.
- */
- CLiwGenericParamList* iInParamList;
-
- /**
- * Out param list.
- * Not owned.
- */
- CLiwGenericParamList* iOutParamList;
- };
-
-#endif // CFMRADIOBACKSTEPPINGSERVICEWRAPPER_H
--- a/fmradio/fmradio/inc/fmradiochannellistcontainer.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: definition of the class CFMRadioRecordingContainer
-*
-*/
-
-
-#ifndef FMRADIOCHANNELLISTCONTAINER_H
-#define FMRADIOCHANNELLISTCONTAINER_H
-
-// INCLUDES
-#include <coecntrl.h>
-#include <aknlists.h>
-
-#include "fmradiodefines.h"
-#include "fmradioengine.h"
-#include "mchannellisthandler.h"
-
-// FORWARD DECLARATIONS
-class CAknWaitDialog;
-class CFMRadioChannelListView;
-// CLASS DECLARATION
-
-/**
-* Creates and owns the UI components related to the Channel List view.
-* @since 2.6
-*/
-class CFMRadioChannelListContainer : public CCoeControl,
- public MEikListBoxObserver
- {
- public: // Constructors and destructor
- /**
- * Two-phase constructor of CFMRadioChannelListContainer
- * @since 2.6
- * @param aRect Frame rectangle for container
- * @param aRadioEngine Radio engine
- * @param aObserver Handler for channel list
- */
- static CFMRadioChannelListContainer* NewL( const TRect& aRect,
- CRadioEngine& aRadioEngine,
- MChannelListHandler& aObserver);
- /**
- * Destructor.
- */
- virtual ~CFMRadioChannelListContainer();
- public: // New functions
- /**
- * Returns the index of the selected channel item from the channel list.
- * @since 2.6
- * @return the index of the currently selected channel
- */
- TInt CurrentlySelectedChannel() const;
- /**
- * Update the content of the channel at aIndex with the values specified
- * @since 2.6
- * @param aIndex index of the channel to update
- * @param aChannelName the new name of the channel
- * @param aChannelFrequency the new frequency of the channel
- */
- void UpdateChannelListContentL( TInt aIndex, const TDesC& aChannelName, TInt aChannelFrequency );
- /**
- * RemoveChannel from channel list
- * @since 2.6
- * @param aIndex the index of the channel to update
- */
- void RemoveChannelL( TInt aIndex );
- /**
- * AddChannel from channel list
- * @since 2.6
- * @param aChannelName the new name of the channel
- * @param aChannelFrequency the new frequency of the channel
- * @param aNowPlaying ETrue if channel is tuned
- */
- void AddChannelL( const TDesC& aChannelName, TInt aChannelFrequency, TBool aNowPlaying );
- /**
- * Update the content of the channel at aIndex with the values specified
- * @since 2.6
- * @param aIndex index of the last selected channel
- */
- void UpdateLastListenedChannel( TInt aIndex );
- /**
- * Adds icon to a list item
- * @param aIndex new icon index
- * @param aIconIndex icon index in list icon array
- */
- void UpdateItemIconL( TInt aIndex, TInt aIconIndex );
- /**
- * Hide all icons from the list
- */
- void HideIconsL();
- /**
- * Fades the entire window and controls in the window owned by this container control.
- * @since 2.6
- * @param aFaded flag to indicate whether we should fade or unfade
- */
- void SetFaded( TBool aFaded );
- /**
- * From CCoeControl
- */
- void HandleResourceChange(TInt aType);
- /**
- * MoveMode handled -> All Done
- */
- void MoveDoneL();
- /**
- * ReIndexAll items in constainer list
- */
- void ReIndexAllL();
- /**
- * Handle movable item drop
- */
- void HandleDropL();
- /**
- * Move selected item in list up
- */
- void MoveUpL();
- /**
- * Move selected item in list down
- */
- void MoveDownL();
- /**
- * Activate move action -> when grab is selected
- */
- void ActivateMoveL();
- /**
- * Move action canceled, return list to previous state
- */
- TBool MoveCanceledL();
- /**
- * Current Move action state.
- */
- TBool MoveAction();
- /**
- * Touch pad move event handling
- */
- void TouchMoveEventL( TInt aIndex );
-
- private: // Functions from base classes
- /**
- * Called by framework when the view size is changed
- * @since 2.6
- */
- void SizeChanged();
- /**
- * Return the number of controls in the window owned by this container
- * @since 2.6
- * @return number of controls
- */
- TInt CountComponentControls() const;
- /**
- * Return the control corresponding to the specified index
- * @since 2.6
- * @param aIndex the index of the control to retrieve
- * @return the control corresponding to the specified index
- */
- CCoeControl* ComponentControl( TInt aIndex ) const;
- /**
- * Redraw the window owned by this container
- * @since 2.6
- * @param aRect the size of the window to redraw
- */
- void Draw( const TRect& aRect ) const;
- /**
- * From MEikListBoxObserver, for listbox event handling.
- * @since 2.6
- * @param aListBox The originating list box.
- * @param aEventType A code for the event.
- */
- void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
- /**
- * Allow the channel list to process key events
- * @since 2.6
- * @param aKeyEvent The key event.
- * @param aType The type of key event.
- */
- TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
- /**
- * Required for help.
- * @since 2.7
- * @param aContext the help context to be used.
- */
- void GetHelpContext(TCoeHelpContext& aContext) const;
-
- void FocusChanged(TDrawNow aDrawNow);
- /*
- * from CCoeControl
- */
- void HandlePointerEventL( const TPointerEvent& aPointerEvent );
-
- private: // new functions
- // Default constructor
- CFMRadioChannelListContainer( CRadioEngine& aRadioEngine, MChannelListHandler& aObserver );
- /**
- * EPOC default constructor.
- * @since 2.6
- * @param aRect Frame rectangle for container.
- */
- void ConstructL( const TRect& aRect);
- /**
- * Create the channel list (initially all spots are set as empty)
- * @since 2.6
- */
- void InitializeChannelListL();
- private: //data
- // The channel list listbox
- CAknDoubleNumberStyleListBox* iChannelList;
- // Array of channel list items
- CDesCArray* iChannelItemArray;
- // Index of the most recently listened channel to keep the listbox up-to-date.
- TInt iLastChIndex;
- RPointerArray<CCoeControl> iControls;
- TBool iFadeStatus;
- CRadioEngine& iRadioEngine;
- TBool iMoveAction;
- TInt iMoveIndex;
- TInt iTouchMoveIndex;
- MChannelListHandler& iObserver;
- // not owned
- CFMRadioChannelListView* iChannelView;
- };
-
-#endif
-
-// End of File
--- a/fmradio/fmradio/inc/fmradiochannellistview.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,305 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: definition of the class CFMRadioChannelListView
-*
-*/
-
-
-#ifndef FMRADIOCHANNELLISTVIEW_H
-#define FMRADIOCHANNELLISTVIEW_H
-
-// INCLUDES
-#include <aknview.h>
-#include <akntoolbarobserver.h>
-
-#include "fmradiochannellistcontainer.h"
-#include "mfmradiolayoutchangeobserver.h"
-#include "fmradiordsobserver.h"
-#include "mchannellisthandler.h"
-
-
-// FORWARD DECLARATIONS
-class CFMRadioChannelListViewContainer;
-class CRadioEngine;
-
-// CLASS DECLARATION
-
-/**
-* CFMRadioChannelListView view class.
-* @since 2.6
-*/
-class CFMRadioChannelListView : public CAknView,
- public MCoeControlObserver,
- public MFMRadioLayoutChangeObserver,
- public MFMRadioRdsObserver,
- public MAknToolbarObserver
- {
- public: // Constructors and destructor
- /**
- * Two-phase constructor of CFMRadioChannelListView
- * @since 2.6
- * @param aRadioEngine pointer to a radio engine object
- * @param aObserver Handler for channel list
- */
- static CFMRadioChannelListView* NewL( CRadioEngine* aRadioEngine,
- MChannelListHandler& aObserver );
-
- /**
- * CFMRadioChannelListView.
- * @since 2.6
- */
- CFMRadioChannelListView::CFMRadioChannelListView( MChannelListHandler& aObserver ) ;
-
- /**
- * Destructor.
- * @since 2.6
- */
- virtual ~CFMRadioChannelListView();
- public: // New functions
- /**
- * Return the unique identifier corresponding to this view
- * @since 2.6
- * @return the unique identifier corresponding to this view
- */
- TUid Id() const;
- /**
- * Keep track of the last selected channel
- * @since 2.6
- * @param aIndex the index of the last listened to channel
- */
- void SetLastListenedChannel( TInt aIndex );
- /**
- * Keep track of the current selected channel
- * @param aChannelIndex the index of the current channel
- */
- void SetNowPlayingChannel ( TInt aChannelIndex );
- /**
- * Returns the index of the playing channel item from the
- * channel list.
- * @return the currently playing channel
- */
- TInt CurrentlyPlayingChannel();
- /**
- * Returns the index of the selected channel item from the
- * channel list. If the container is active get the info from
- * it, because it may have more up-to-date info.
- * @since 2.6
- * @return the currently selected channel
- */
- TInt CurrentlySelectedChannel();
- /**
- * Make a request to the channel container to update the
- * content of the channel at aIndex with the values specified
- * @since 2.6
- * @param aIndex the index of the channel to update
- * @param aChannelName the new name of the channel
- * @param aChannelFrequency the new frequency
- */
- void UpdateChannelListContentL( TInt aIndex, const TDesC& aChannelName, TInt aChannelFrequency );
- /**
- * Return true/false to indicate whether the channel specified is in play
- * @param aChannelIndex the index of the channel to check
- * @return true/false to indicate whether the channel is currently being played
- */
- TBool ChannelInPlay( TInt aChannelIndex ) const;
- /**
- * Retrieve the index of the next channel that has been set.
- * @since 2.6
- * @return the index of the next "in use" channel
- */
- TInt NextChannel();
- /**
- * Retrieve the index of the previous channel that has been set.
- * @since 2.6
- * @return the index of the previous "in use" channel
- */
- TInt PreviousChannel();
- /**
- * Initialize the channels with the values currently saved in
- * the radio engine
- * @since 2.6
- */
- void InitializeChannelsL();
- /**
- * Fade the view and all controls associated with it. Change
- * the soft keys so that "Exit" is displayed
- * @since 2.6
- * @param aFaded indicates whether the view should fade/unfade.
- */
- void FadeAndShowExit( TBool aFaded );
- /**
- * Update display when focus regained
- * @since 3.0
- */
- void UpdateDisplayForFocusGained();
- /**
- * from MFMRadioLayoutChangeObserver
- * This method gets called by the AppUI when a dynamic layout change
- * event occurs.
- * @param aType layout change type
- */
- void LayoutChangedL( TInt aType );
- /**
- * Set empty channel list item
- * when preset is deleted from fmradiopresetutility
- * @param aIndex list index to delete
- */
- void SetEmptyChannelListItemL( const TInt aIndex ) const;
-
- /**
- * From MAknToolbarObserver
- * Handle commands from toolbar.
- * @param aCommandId The command id
- */
- void OfferToolbarEventL( TInt aCommandId );
-
- /**
- * Sets toolbar visibility
- * @param aVisible
- * @return none
- */
- void ShowToolbar( TBool aVisible );
-
- /**
- * From base class MFMRadioRdsObserver
- */
- void RdsDataProgrammeService( const TDesC& aProgramService );
- void RdsDataPsNameIsStatic( TBool aStatic );
- void RdsDataRadioText( const TDesC& aRadioText );
- void RdsDataRadioTextPlus( const TInt /*aRTPlusClass*/, const TDesC& /*aRadioText*/ ){};
- void RdsAfSearchBegin();
- void RdsAfSearchEnd( TUint32 aFrequency, TInt aError );
- void RdsAfSearchStateChange( TBool aEnabled );
- void RdsAvailable( TBool aAvailable );
- /**
- * Procedures for finishing a move of channel on the list
- * @param none
- * @return none
- */
- void MoveActionDoneL();
-
- /**
- * Cancel the moving
- */
- void CancelMoveL();
-
- /**
- * Dim relevant buttons when the list is empty
- */
- void UpdateToolbar() const;
-
- /*
- * Updates view when seek event is ended
- */
- void StopSeekL();
-
- private: // Functions from base classes
- /**
- * Activate the channel list view
- * @since 2.6
- */
- void DoActivateL( const TVwsViewId& aPrevViewId,TUid aCustomMessageId, const TDesC8& aCustomMessage );
- /**
- * Deactivate the channel list view
- * @since 2.6
- */
- void DoDeactivate();
- /**
- * Interprets view's menu,softkey and other commands and acts
- * accordingly by calling the appropriate command handler
- * function for further action.
- * @since 2.6
- * @param aCommand the command to process
- */
- void HandleCommandL( TInt aCommand );
- /**
- * From MCoeControlObserver, control event observing. In this case,
- * the user selection from the list is reported by container class
- * and observed here.
- * @since 2.6
- * @param aControl the control that caused the event
- * @param aEventType the type of event that was triggered
- */
- void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
- /**
- * Sets the state of menu items dynamically according to the
- * state of application data.
- * @since 2.6
- * @param aResourceId Resource ID identifying the menu pane to initialise.
- * @param aMenuPane The in-memory representation of the menu pane.
- */
- void DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane );
-
- /**
- * SetMiddleSoftKeyLabelL, sets the MSK label
- *
- */
- void SetMiddleSoftKeyLabelL (TInt aResourceId, TInt aCommandId);
-
- /**
- * UpdateMiddleSoftKeyL, updates the MSK
- *
- */
- void UpdateMiddleSoftKeyL();
- private: // new functions
- /**
- * EPOC default constructor.
- * @since 2.6
- * @param aRadioEngine pointer to a radio engine object
- */
- void ConstructL( CRadioEngine* aRadioEngine );
-
- /**
- * Prepare toolbar for FMRadio command buttons
- */
- void PrepareToolbar();
- /*
- * Set view title text
- * @param aResourceId resource Id containing the title text
- */
- void SetTitleL( TInt aResourceId );
- /**
- * Procedures for beginning a move of channel on the list
- * @param none
- * @return none
- */
- void MoveCurrentItemIndexL();
-
- private: // Data
- CFMRadioChannelListContainer* iContainer;
- CRadioEngine* iRadioEngine;
- TInt iChIndex;
- TInt iNowPlayingIndex;
- TInt iCurrentMSKCommandId; //owned
- TBool iFaded;
- MChannelListHandler& iObserver;
-
- CAknQueryDialog* iManualQueryDialog;
-
- TBool iMoveMode;
-
- /**
- * Boolean for knowing if any moves have been made
- */
- TBool iFirstMoveDone;
-
- /**
- * Toolbar for controlling the application.
- */
- CAknToolbar* iToolbar;
- };
-
-#endif
-
-// End of File
--- a/fmradio/fmradio/inc/fmradiocommandlineparams.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This file contains definitions for
-* FM Radio command line parameters
-*
-*/
-
-
-#ifndef FMRADIOCOMMANDLINEPARAMS_H
-#define FMRADIOCOMMANDLINEPARAMS_H
-
-#include <e32std.h>
-
-/**
- * The needed ID's are defined in fmradiouids.h
- * Only one of the following commands can be currently given at a time
- */
-
-/**
- * FM Radio application UID
- */
-const TUid KFMRadioCommandUid = {0x10207A89};
-
-/**
- * Starts FM Radio to specified view or activates it if some other view is already active
- * Supports only Main view and Channel List View
- * Example: "-v 1", use the ID's defined in fmradiouids.h
- */
-_LIT8( KFMRadioCommandActivateView, "-v" );
-
-/**
- * Starts FM Radio to specified frequency or just tunes if application is already running.
- * No effect if the frequency is outside current frequency range. Example: "-f 87500000"
- * @param frequency The frequency to be activated in hertz
- */
-_LIT8( KFMRadioCommandFrequency, "-f" );
-
-/**
- * Starts FM Radio to specified station index or just tunes if application is already running.
- * No effect if the index is out of boundaries. Example: "-i 0"
- * @param index The index to be activated
- */
-_LIT8( KFMRadioCommandStationIndex, "-i" );
-
-#endif // FMRADIOCOMMANDLINEPARAMS_H
-
-// End of file
--- a/fmradio/fmradio/inc/fmradiocontroleventobserverimpl.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration of class CFMRadioControlEventObserverImpl.
-* Provides the implementation for the control event observer.
-*
-*/
-
-#ifndef FMRADIOCONTROLEVENTOBSERVERIMPL_H_
-#define FMRADIOCONTROLEVENTOBSERVERIMPL_H_
-
-#include <fmradiointernalpskeys.h>
-
-#include "fmradiopropertyobserver.h"
-#include "fmradioaudioutils.hrh"
-#include "fmradiocontroleventobserver.h"
-
-class MFMRadioControlEventObserver;
-class CFMRadioAppUi;
-
-class CFMRadioControlEventObserverImpl : public CBase, public MFMRadioControlEventObserver
- {
- public:
- /**
- * Static constructor.
- */
- static CFMRadioControlEventObserverImpl* NewL( CFMRadioAppUi& aAppUi );
-
- /**
- * Destructor.
- */
- ~CFMRadioControlEventObserverImpl();
-
- void StepToChannelL( TFMRadioTuneDirection aDirection );
- void SetChannelL( TInt aChannelId );
- void SeekL( TFMRadioTuneDirection aDirection );
- void StepToFrequencyL( TFMRadioTuneDirection aDirection );
- void SetFrequencyL( TUint32 aFreq );
- void AdjustVolumeL( TFMRadioVolumeSetDirection aDirection );
- void MuteL( TBool aMute );
- void PlayL( TBool aDownPressed );
- void PauseL(TBool aDownPressed );
- void PausePlayL( TBool aDownPressed );
- void StopL( TBool aDownPressed );
- void ForwardL( TBool aDownPressed );
- void FastForwardL( TBool aDownPressed );
- void BackwardL( TBool aDownPressed );
- void RewindL( TBool aDownPressed );
- void ChannelUpL( TBool aDownPressed );
- void ChannelDownL( TBool aDownPressed );
- void VolumeUpL( TBool aDownPressed );
- void VolumeDownL( TBool aDownPressed );
- void ChangeViewL(TUid aViewId, TBool aForceChange);
- void SetAudioOutputDestinationL(TFMRadioOutputDestination aDestination);
- void AnswerEndCallL();
-
- private: //Methods
- CFMRadioControlEventObserverImpl(CFMRadioAppUi& aAppUi);
- void ConstructL();
-
- private:
- CFMRadioAppUi& iAppUi;
- };
-#endif /*FMRADIOCONTROLEVENTOBSERVERIMPL_H_*/
--- a/fmradio/fmradio/inc/fmradiodefines.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This file contains common constant defines used within the
-* scope of the application.
-*
-*/
-
-
-#ifndef FMRADIODEFINES_H
-#define FMRADIODEFINES_H
-
-#include <e32std.h>
-#include <e32base.h>
-#include <eikenv.h>
-#include <fmradio.rsg>
-
-#include "fmradioengine.h"
-
-const TInt KHzConversionFactor = 1000000;
-
-// Tuning step, frequency range high and low limits
-const TReal KFrequencyTuningStep = 0.05;
-
-const TInt KFrequencyMaxDecimalPlaces = 2;
-const TInt KFrequencyMaxLength = 6;
-
-// Minimum and maximum volume levels
-const TInt KMinimumVolume = 1;
-const TInt KMaximumVolume = 10;
-
-// Handy string buffer size declarations
-const TInt KBufLen16 = 0x10;
-
-const TInt KDefaultRegionArrayGranularity = 3;
-
-// Channel list item amount
-const TInt KMinNumberOfChannelListItems = 0;
-const TInt KMaxNumberOfChannelListItems = 99;
-
-// Channel list channel item string length
-const TInt KLengthOfChannelItemString = 100;
-
-// Channel list channel index string length
-const TInt KLengthOfChIndexStringChList = 5;
-
-// Channel list channel name string length
-const TInt KLengthOfChannelNameString = 80;
-
-// Channel list channel item icon index string length
-const TInt KLengthOfChannelItemIconIndexString = 3;
-
-// Time after pressing delayed key 1 or 2
-const TInt KKeyDelayTimeInMicroseconds = 2000000; // 2 seconds
-
-const TInt KFMRadioProgressUpdateDelayInMicroseconds = 5000; //every .05 seconds.
-const TInt KProgressBarMaxValue = 100;
-const TInt KProgressBarIntervalChange = 10;
-
-//Decimal notation
-const TInt KBaseTen = 10;
-
-// Asterisk key code
-const TInt EStdKeyNkpAsteriskInDevice = 0x2A;
-
-// Current mode of the channel list view
-enum TFMRadioChannelListViewMode
- {
- ENormalListMode,
- ESaveChannelMode
- };
-
-//const TInt KNumberOfButtonsToDisplay = 5;
-
-// Channel list channel index string formatter
-_LIT(KChIndexFormatChList, "%d");
-_LIT(KChIndexFormatChMenu, "%d ");
-// Channel list channel item icon index string formatter
-_LIT(KChIconIndexFormatChList, "%d");
-
-// bitmap file for the button panel
-_LIT( KFMRadioBmpFile, "fmradio.mif" );
-
-// Keyboard number key codes
-enum TKeyboardKeys
-{
- EKeyboardKey0 = 0x30,
- EKeyboardKey1 = 0x31,
- EKeyboardKey2 = 0x32,
- EKeyboardKey3 = 0x33,
- EKeyboardKey4 = 0x34,
- EKeyboardKey5 = 0x35,
- EKeyboardKey6 = 0x36,
- EKeyboardKey7 = 0x37,
- EKeyboardKey8 = 0x38,
- EKeyboardKey9 = 0x39
-};
-
-// CONSTANTS FOR ALFRED ENVIRONMENT
-
-// Main view visual controls group id
-const TInt KFMRadioVisualControlsGroupId = 1;
-const TInt KFMRadioVisualizerGestureControlGroupId = 2; //Do not use for any other purpose
-const TInt KFMRadioMediaIdleId = 312;
-const TInt KFMRadioVisualControlId = 211;
-const TInt KFMRadioRdsIndicatorId = 313;
-const TInt KFMRadioRdsAfIndicatorId = 314;
-const TInt KFMRadioRdsViewer = 316;
-const TInt KFMRadioRdsInteractionIndicatorId = 317;
-const TInt KFMRadioLogoId = 318;
-const TReal KFMRadioIndicatorOpacityInHiddenState = 0.2f;
-const TReal KFMRadioRdsViewerOpacityHidden = 0.0f;
-const TReal KFMRadioRdsViewerOpacityShow = 0.4f;
-
-
-// Main view transparent layer bottom margin
-const TReal KInfoBgLayerBottomMarginAsNormalizedValue = -0.12f;
-// Main view transparent layer top margin
-const TReal KInfoBgLayerTopMarginAsNormalizedValue = 0.5f;
-// Media Idle content item amount
-const TInt KFMRadioMaxNumberOfMediaIdleContentItem = 10;
-
-// Time delay in milliseconds when main view toolbar buttons report long key press event
-const TInt KLongPressDelayValueInMicroseconds = 500;
-// How many times user is asked to scan local frequencies at application startup
-const TInt KMaxStartupTimesToAskSaveWizard = 2;
-
-// Toolbar center (=mute) button state indexes
-const TInt KMuteStateIndex = 1;
-const TInt KUnMuteStateIndex = 0;
-
-/**
-* Local Variation Flags for FM Radio
-* For values, see FMRadioVariant.hrh.
-* Integer value.
-**/
-//_LIT( KFMRadioFeatures, "FMRadioFeatures" );
-
-/**
-* Upper frequency bound for FM Radio band
-* Possible Values are:
-* 0 ... 115000
-* 108000 default value
-* Integer value.
-**/
-_LIT( KFMRadioFrequencyRangeUpperLimit, "FMRadioFrequencyRangeUpperLimit" );
-
-/**
-* Lower frequency bound for FM Radio band
-* Possible Values are:
-* 0 ... 115000
-* 87500 default value
-* Integer value.
-**/
-_LIT( KFMRadioFrequencyRangeLowerLimit, "FMRadioFrequencyRangeLowerLimit" );
-
-/**
- * Direction change mark for strings with numerals in mirrored layout
- */
-_LIT( KRightToLeftMark, "\x200F" );
-_LIT( KLeftToRightMark, "\x200E" );
-
-/**
- * Volume settings for radio
- */
-const TInt KFMRadioMaxVolumeLevel = 20;
-const TInt KFMRadioMinVolumeLevel = 0;
-const TInt KFMRadioVolumeStepSize = 1;
-
-// Channel list icon index in the icon array
-const TInt KNowPlayingIconIndexChList = 0;
-const TInt KMoveIconIndexChList = 1;
-
-#endif
-
-
-
-// End of file
--- a/fmradio/fmradio/inc/fmradiodocument.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitaion of the CFMRadioDocument class, which
-* handles application data serialization. Owns the Ui
-* (controller) and the engine (model)
-*
-*/
-
-
-#ifndef FMRADIODOCUMENT_H
-#define FMRADIODOCUMENT_H
-
-// INCLUDES
-#include <AknDoc.h>
-
-// CONSTANTS
-
-// FORWARD DECLARATIONS
-class CEikAppUi;
-
-// CLASS DECLARATION
-
-/**
-* Part of the standard application framework. Declares the document class
-* for this application.
-* @since 2.6
-*/
-class CFMRadioDocument : public CAknDocument
- {
- public: // Constructors and destructor
- /**
- * Two-phased constructor.
- * @since 2.6
- */
- static CFMRadioDocument* NewL( CEikApplication& aApp );
- /**
- * Destructor.
- * @since 2.6
- */
- virtual ~CFMRadioDocument();
- private: // New functions
- /**
- * EPOC default constructor.
- * @since 2.6
- */
- CFMRadioDocument( CEikApplication& aApp );
- private: // Functions from base classes
- /**
- * From CEikDocument, create CFMRadioAppUi "App UI" object.
- * @since 2.6
- */
- CEikAppUi* CreateAppUiL();
- };
-
-#endif
-
-// End of File
-
--- a/fmradio/fmradio/inc/fmradiofrequencyeditor.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-/*
-* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Header file for CFMRadioFrequencyEditor
-*
-*/
-
-
-#ifndef CFMRADIOFREQUENCYEDITOR_H
-#define CFMRADIOFREQUENCYEDITOR_H
-
-#include <eikmfne.h>
-
-struct SEikControlInfo;
-
-/**
- * Custom editor for editing radio frequencies.
- */
-class CFMRadioFrequencyEditor : public CEikMfne
- {
-
-public: // Methods
-
- /**
- * C++ default constructor.
- */
- CFMRadioFrequencyEditor();
-
- /**
- * Symbian 2nd phase constructor.
- */
- void ConstructL(const TUint32 aFlags = 0);
-
- /**
- * Destructor.
- */
- ~CFMRadioFrequencyEditor();
-
- /**
- * This editor is constructed by the system using this static method.
- */
- static SEikControlInfo StaticCreateCustomEditor(TInt aIdentifier);
-
- /**
- * Sets the frequency of this editor.
- *
- * @param aFreq New frequency.
- */
- void SetFrequency(const TUint32 aFreq);
-
- /**
- * Returns the frequency of this editor.
- *
- * @return Frequency of this editor.
- */
- TUint32 Frequency() const;
-
- /**
- * Sets minimum and maximum frequencies of this editor.
- *
- * @param aMinimumFrequency Minimum frequency.
- * @param aMaximumFrequency Maximum frequency.
- */
- void SetMinimumAndMaximum(const TUint32 aMinimumFrequency,
- const TUint32 aMaximumFrequency);
-
- /**
- * Gets minimum and maximum frequencies of this editor.
- *
- * @param aMinimumFrequency Contains the minimum frequency when returned.
- * @param aMaximumFrequency Contains the maximum frequency when returned.
- */
- void GetMinimumAndMaximum(TUint32& aMinimumFrequency,
- TUint32& aMaximumFrequency) const;
-
- /**
- * Returns validity of this editor.
- * @return ETrue, if the values of the fields of this editor are valid.
- * EFalse otherwise.
- */
- TBool IsValid() const;
-
- /**
- * Returns the report state of this editor.
- * @return ETrue, if the editor is valid to report of a state change.
- * EFalse otherwise.
- */
- TBool IsValidToReport() const;
-
- /**
- * Fills decimal field with zero decimal, if field is left in middle of
- * typing.
- */
- void FillDecimalField();
-
- /**
- * Handle possible editor leave.
- *
- * @return ETrue, if editor can be left.
- */
- TBool CanLeaveEditorL();
-
- // from base class CCoeControl
- /**
- * From CCoeControl
- * @see CCoeControl::ConstructFromResourceL
- */
- void ConstructFromResourceL( TResourceReader& aResourceReader );
-
- // from base class CEikMfne
- /**
- * From CEikMfne OfferKeyEventL.
- * @see CEikMfne::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
- */
- TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
- /**
- * From CEikMfne HandlePointerEventL.
- * @see CEikMfne::HandlePointerEventL(const TPointerEvent& aPointerEvent)
- */
- void HandlePointerEventL(const TPointerEvent& aPointerEvent);
-
- /**
- * Updates minimum and maximum values of the fields.
- */
- void UpdateMinimumAndMaximum();
-
- /**
- * Increments the current field.
- */
- void IncrementCurrentField();
-
- /**
- * Decrements the current field.
- */
- void DecrementCurrentField();
-
- void SetEditorReportState( TBool aReport );
-
- /**
- * Redraws editor and reports of state change.
- *
- * @param aForceDrawNow forces immediate draw
- */
- void DrawAndReportL( TBool aForceDrawNow );
-
- /*
- * Set editor frame rect
- * @param aRect editor frame rect
- */
- void SetEditorFrameRect( const TRect& aRect );
-
-protected: // Methods
-
- // from base class CCoeControl
- /**
- * From CCoeControl
- *
- * @see CCoeControl::FocusChanged( TDrawNow aDrawNow )
- */
- void FocusChanged( TDrawNow aDrawNow );
-
-private: //Methods
-
- /**
- * Increments the integer field.
- */
- void IncrementIntField();
-
- /**
- * Decrements the integer field.
- */
- void DecrementIntField();
-
- /**
- * Increments the decimal field.
- */
- void IncrementDecField();
-
- /**
- * Decrements the decimal field.
- */
- void DecrementDecField();
-
- /**
- * Validates the values of the both fields.
- * Calls ValidateIntField and ValidateDecField,
- * but doesn't return anything.
- */
- void ValidateFields();
-
- /**
- * Validates the integer field. If field was changed, returns ETrue.
- */
- TBool ValidateIntField();
-
- /**
- * Validates the decimal field. If field was changed, returns ETrue.
- */
- TBool ValidateDecField();
-
-
-
-
-
-private: // Data
- /**
- * Minimum frequency got from RadioSettings.
- */
- TUint32 iMinFreq;
-
- /**
- * Maximum frequency got from RadioSettings.
- */
- TUint32 iMaxFreq;
-
- /**
- * Step frequency got from RadioSettings.
- */
- TUint32 iStepFreq;
-
- /**
- * Current minimum value of integer field.
- */
- TInt iMinIntValue;
-
- /**
- * Current maximum value of integer field.
- */
- TInt iMaxIntValue;
-
- /**
- * Current minimum value of decimal field.
- */
- TInt iMinDecValue;
-
- /**
- * Current maximum value of decimal field.
- */
- TInt iMaxDecValue;
-
- /**
- * The field at the beginning of keypress.
- */
- TInt iPreviousField;
-
- /**
- * ETrue, when user is in the middle of typing numbers in decimal
- * field.
- */
- TBool iTypedInDecField;
-
- /**
- * Editor is valid to report it's state (after internal validations).
- */
- TBool iValidToReport;
-
- /**
- * Decimal field divider that is based on decimal count.
- */
- TUint32 iDecDiv;
- /**
- * flag to set editor report state
- */
- TBool iReportEditorState;
-
- TInt iIncrements;
-
- /*
- * Editor frame rect
- */
- TRect iEditorFrameRect;
-
- };
-
-#endif // CFMRADIOFREQUENCYEDITOR_H
--- a/fmradio/fmradio/inc/fmradiofrequencynumber.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Header file for CFMRadioFrequencyNumber
-*
-*/
-
-
-#ifndef CFMRADIOFREQUENCYNUMBER_H
-#define CFMRADIOFREQUENCYNUMBER_H
-
-#include <eikmfne.h>
-
-/** Flags */
-enum
- {
- EFillWithLeadingZeros =0x1,
- EPreserveOldWidthBeforeEditing =0x2,
- ERepresentsYear =0x4,
- EPublicallySettableFlags =EFillWithLeadingZeros|EPreserveOldWidthBeforeEditing|ERepresentsYear,
- EIsBeingEditedWithCursor =0x8,
- EIsUninitialised =0x10
- };
-
-/**
- * Custom field for frequency number.
- */
-class CFMRadioFrequencyNumber : public CEikMfneField
- {
-
-public: // Methods
-
- /**
- * Static constructor.
- */
- static CFMRadioFrequencyNumber* NewL(
- const CFont& aFont,
- TInt aMinimumValue,
- TInt aMaximumValue,
- TInt aInitialValue,
- TUint32 aFlags );
-
- /**
- * Destructor.
- */
- ~CFMRadioFrequencyNumber();
-
- /**
- * Sets new value in this number field.
- *
- * @param aValue New value
- * @param aFont Current font
- */
- void SetValue( TInt aValue, const CFont& aFont );
-
- /**
- * Gets the value in this number field.
- *
- * @return Value
- */
- TInt Value() const;
-
- /**
- * Sets digit type of this number field.
- *
- * @param aDigitType New digit type
- * @param aFont Current font
- */
- void SetDigitType( TDigitType aDigitType, const CFont& aFont );
-
- /**
- * Gets digit type of this number field.
- *
- * @return aDigitType Digit type
- */
- TDigitType DigitType() const;
-
- // from base class CEikMfneField
- /**
- * From CEikMfneField
- *
- * @see CEikMfneField::IsValid()
- */
- TBool IsValid() const;
-
- /**
- * From CEikMfneField
- *
- * @see CEikMfneField::IsEditable.
- */
- TBool IsEditable() const;
-
- /**
- * From CEikMfneField
- *
- * @see CEikMfneField::HighlightType.
- */
- THighlightType HighlightType() const;
-
- /**
- * From CEikMfneField
- * CEikMfneField::HandleKey(
- * const CFont& aFont,
- * const TKeyEvent& aKeyEvent,
- * TBool aInterpretLeftAndRightAsEarEvents,
- * TBool& aDataAltered,
- * TInt& aHighlightIncrement
- */
- void HandleKey(
- const CFont& aFont,
- const TKeyEvent& aKeyEvent,
- TBool aInterpretLeftAndRightAsEarEvents,
- TBool& aDataAltered,
- TInt& aHighlightIncrement );
-
- /**
- * From CEikMfneField
- *
- * @see CEikMfneField::HandleDeHighlight(
- * const CFont& aFont,
- * CEikonEnv& aEikonEnv,
- * TBool& aDataAltered,
- * TBool& aError )
- */
- void HandleDeHighlight(
- const CFont& aFont,
- CEikonEnv& aEikonEnv,
- TBool& aDataAltered,
- TBool& aError);
-
-protected: // Methods
-
-private: //Methods
-
- /**
- * C++ default constructor.
- */
- CFMRadioFrequencyNumber(
- TInt aMinimumValue,
- TInt aMaximumValue,
- TUint32 aFlags );
-
- /**
- * By default Symbian 2nd phase constructor is private.
- */
- void ConstructL( const CFont& aFont, TInt aInitialValue );
-
- /**
- * Gets maximum width of this field in pixels.
- */
- TInt MaximumWidthInPixels(
- const CFont& aFont,
- TBool aShrinkToMinimumSize );
-
- /**
- * Gets input capabilities of this field.
- */
- TCoeInputCapabilities InputCapabilities() const;
-
- /**
- * Get textual representation of the value in this field.
- */
- const TDesC& Text() const;
-
- /**
- * Gets numerical representation of the value in this field.
- */
- TInt ValueFromText() const;
-
-private: // Data
- /**
- * Minimum value of this field.
- */
- TInt iMinimumValue;
-
- /**
- * Maximum value of this field.
- */
- TInt iMaximumValue;
-
- /**
- * Maximum number of digits value in this field.
- */
- TInt iMaxDigits;
-
- /**
- * Flags of this field.
- */
- TUint32 iFlags;
-
- /**
- * Holds the value of this field.
- */
- HBufC* iText;
-
- /**
- * Digit type of this field.
- */
- TDigitType iDigitType;
-
- };
-
-#endif // CFMRADIOFREQUENCYNUMBER_H
-
--- a/fmradio/fmradio/inc/fmradiofrequencyquerycontrol.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,400 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Header file for CFMRadioFrequencyQueryControl
-*
-*/
-
-
-#ifndef FMRADIOFREQUENCYQUERYCONTROL_H
-#define FMRADIOFREQUENCYQUERYCONTROL_H
-
-#include <aknEditStateIndicator.h>
-#include <AknIndicatorContainer.h>
-#include <aknQueryControl.h>
-
-// CONSTANTS
-
-const TInt KFMRadioFrequencyQueryDialogCustomAdditionHeight = 110;
-
-class CFMRadioFrequencyEditor;
-class CAknsFrameBackgroundControlContext;
-
-/**
- * Custom query control for frequency query dialog.
- */
-class CFMRadioFrequencyQueryControl : public CAknQueryControl
- {
-
-public: // Methods
-
- /**
- * C++ default constructor.
- */
- CFMRadioFrequencyQueryControl();
-
- /**
- * Destructor.
- */
- ~CFMRadioFrequencyQueryControl();
-
- /**
- * This control is constructed by the system using this static method.
- */
- static SEikControlInfo StaticCreateCustomControl( TInt aIdentifier );
-
- /**
- * Gets the frequency from the control
- *
- * @return Frequency
- */
- TUint32 Frequency() const;
-
- /**
- * Sets the frequency to the control
- *
- * @param aFreq Frequency
- */
- void SetFrequency(const TUint32 aFreq);
-
- /**
- * Handle possible editor leave.
- *
- * @return ETrue, if editor can be left.
- */
- TBool CanLeaveEditorL();
-
- // from base class CAknQueryControl
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::ControlByLayoutOrNull( TInt aLayout )
- */
- CCoeControl* ControlByLayoutOrNull( TInt aLayout );
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::EditorContentIsValidL() const
- */
- TBool EditorContentIsValidL() const;
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::SetAndUseFlags( TBitFlags16 aFlags )
- */
- void SetAndUseFlags( TBitFlags16 aFlags );
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::WindowLayout( TAknWindowLineLayout& aLayout )
- * const
- */
- void WindowLayout( TAknWindowLineLayout& aLayout ) const;
-
-
- // from base class CCoeControl
- /**
- * From CCoeControl
- *
- * @see CCoeControl::PrepareForFocusLossL()
- */
- void PrepareForFocusLossL();
-
- /**
- * From CCoeControl
- *
- * @see CCoeControl::FocusChanged( TDrawNow aDrawNow )
- */
- void FocusChanged( TDrawNow aDrawNow );
-
- /**
- * From CCoeControl
- *
- * @see CCoeControl::CountComponentControls() const
- */
- TInt CountComponentControls() const;
-
- /**
- * From CCoeControl
- *
- * @see CCoeControl::ComponentControl( TInt aIndex ) const
- */
- CCoeControl* ComponentControl( TInt aIndex ) const;
-
- /**
- * Is public so that callbacks may utilize this.
- * Sets repeat intervals.
- *
- * @param aAccelerated ETrue=accelerated speed, EFalse=default values
- */
- void SetAcceleratedLongPress(TBool aAccelerated);
-
- /**
- * From CCoeControl
- *
- * @see CCoeControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
- * */
- TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
-
- // from base class MCoeControlObserver
- /**
- * From MCoeControlObserver
- *
- * @see MCoeControlObserver::HandleControlEventL(
- * CCoeControl* aControl,
- * TCoeEvent aEventType )
- */
- void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
-
- class CFMRadioManualTuningEditorIndicator : public CAknIndicatorContainer, public MAknEditingStateIndicator
- {
- public:
-
- static CFMRadioManualTuningEditorIndicator* NewL(CCoeControl* aControl);
-
- ~CFMRadioManualTuningEditorIndicator();
-
- /**
- * From MAknEditingStateIndicator
- */
- void SetState(TAknEditingState aState);
-
- /**
- * From MAknEditingStateIndicator
- */
- CAknIndicatorContainer* IndicatorContainer();
-
- /**
- * Sets the information about the query flags.
- */
- void SetFlags(TBitFlags16 aFlags);
-
- private:
-
- CFMRadioManualTuningEditorIndicator();
-
- void ConstructL(CCoeControl* aControl);
-
- // from base class CAknIndicatorContainer
- /**
- * From CAknIndicatorContainer
- *
- * @see CAknIndicatorContainer::Reserved_1()
- */
- void Reserved_1();
-
- private:
- /**
- * Flags
- */
- TBitFlags16 iBitFlags;
-
- };
-
- public:
- /**
- * Manage indexes into LAF tables
- */
- class TIndex
- {
- public:
- TIndex(TInt aNumberOfPromptLines);
-
- public:
- TInt PromptLine() const;
-
- public:
- TInt DQPWindowTextsLine2(TInt aLineNum) const;
- TInt PNWindow() const;
- TInt PQDWindow(TInt aLineNum) const;
- TInt PQCWindow() const;
-
- private:
-
-
- private:
- TInt iNumberOfPromptLines;
- };
-
-protected: // Methods
-
- // from base class
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::ConstructQueryL( TResourceReader& aRes )
- */
- void ConstructQueryL( TResourceReader& aRes );
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::LayoutEditor( const TLayoutMethod& aLayoutM )
- */
- void LayoutEditor( const TLayoutMethod& aLayoutM );
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::LayoutPrompt( const TLayoutMethod& aLayoutM )
- */
- void LayoutPrompt( const TLayoutMethod& aLayoutM );
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::LayoutImageOrAnim(
- * const TLayoutMethod& aLayoutM )
- */
- void LayoutImageOrAnim( const TLayoutMethod& aLayoutM );
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::LayoutEditorFrame(
- * const TLayoutMethod& aLayoutM )
- */
- void LayoutEditorFrame( const TLayoutMethod& aLayoutM );
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::LayoutEditorIndicator(
- * const TLayoutMethod& aLayoutM )
- */
- void LayoutEditorIndicator( const TLayoutMethod& aLayoutM );
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::LayoutRect()
- */
- TRect LayoutRect();
-
- /**
- * From CAknQueryControl
- *
- * @see CAknQueryControl::SetLineWidthsL();
- */
- void SetLineWidthsL();
-
- /**
- * From CCoeControl
- *
- * @see CCoeControl::Draw( const TRect& aRect ) const
- */
- void Draw( const TRect& aRect ) const;
-
- /**
- * Draw editor frame and shadows
- */
- void DrawFrequencyEditorFrame(CWindowGc& aGc,TRect& aRect) const;
-
- /**
- * From CCoeControl
- *
- * @see CCoeControl::SizeChanged()
- */
- void SizeChanged();
-
- /**
- * From MObjectProvider
- *
- * @see MObjectProvider::MopSupplyObject( TTypeUid aId )
- */
- TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
-
- /**
- * From CCoeControl.
- * @see CCoeControl::HandlePointerEventL()
- */
- void HandlePointerEventL( const TPointerEvent& aPointerEvent );
-
-private: // Methods
-
- /**
- * Starts timer to accelerate long press repeat interval
- */
- void StartKeypress();
-
- /**
- * Instructs frequency editor component to update the appropriate field
- * if it is possible (user is not typing numbers). Update is either
- * incrementing or decrementing depending on state of iChangeDirectionIncrease.
- * If it is ETrue, the desired action is to increment the value.
- */
- void DoIncrementOrDecrement();
-
- /**
- * Callback for iLongPressAccelerationTimer
- * Speeds up repeated key event interval.
- * See CPeriodic::Start()
- *
- * @param aAny pointer to self
- *
- * @return ignored
- */
- static TInt LongPressAccelerateCallBack( TAny* aAny );
-
- /**
- * Callback for iLongPressTimer
- * Called repeatedly to act as long keypress repeat event.
- * See CPeriodic::Start()
- *
- * @return ignored
- */
- static TInt LongPressTimerCallBack( TAny* aAny );
-
-private: // Data
-
- /**
- * Prompt
- */
- CEikLabel* iMyPrompt;
-
- /**
- * Editor indicator
- */
- CFMRadioManualTuningEditorIndicator* iMyEditorIndicator;
-
- /**
- * Editor
- */
- CFMRadioFrequencyEditor* iFreqEditor;
-
- /**
- * A control context that provides a layout background generated from a frame item
- */
- CAknsFrameBackgroundControlContext* iEditorContext;
- /**
- * Accelerates manual tuning speed after two seconds
- */
- CPeriodic* iLongPressAccelerationTimer;
-
- CPeriodic* iLongPressTimer;
-
- /**
- * State of current keypress. Value is valid only between EEventKeyDown
- * and EEventKeyUp.
- * ETrue == increment, EFalse == decrement
- */
- TBool iChangeDirectionIncrease;
-
- TBool iKeyPressReported;
-
- };
-
-#endif // FMRADIOFREQUENCYQUERYCONTROL_H
--- a/fmradio/fmradio/inc/fmradiofrequencyquerydialog.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Header file for CFMRadioFrequencyQueryDialog
-*
-*/
-
-
-#ifndef FMRADIOFREQUENCYQUERYDIALOG_H
-#define FMRADIOFREQUENCYQUERYDIALOG_H
-
-#include <AknQueryDialog.h>
-
-/**
- * Custom query dialog for frequency.
- */
-class CFMRadioFrequencyQueryDialog : public CAknQueryDialog
- {
-
-public: // Methods
-
- /**
- * Static constructor.
- */
- static CFMRadioFrequencyQueryDialog* NewL( TUint32& aFreq,
- const TTone& aTone = ENoTone );
-
- /**
- * Destructor.
- */
- ~CFMRadioFrequencyQueryDialog();
-
- /**
- * Returns the frequency currently set in this dialog.
- *
- * @return ?description
- */
- TUint32 Frequency() const;
-
- // from base class MAknQueryControlObserver
- /**
- * From MAknQueryControlObserver
- *
- * @see MAknQueryControlObserver::HandleQueryEditorStateEventL
- */
- TBool HandleQueryEditorStateEventL(
- CAknQueryControl* aQueryControl,
- TQueryControlEvent aEventType,
- TQueryValidationStatus aStatus );
-
-protected: // Methods
-
- // from base class CAknQueryDialog
- /**
- * From CAknQueryDialog
- *
- * @see CAknQueryDialog::QueryControl() const
- */
- CAknQueryControl* QueryControl() const;
-
- /**
- * From CAknQueryDialog
- *
- * @see CAknQueryDialog::UpdateLeftSoftKeyL()
- */
- void UpdateLeftSoftKeyL();
-
- /**
- * From CAknQueryDialog OkToExitL
- */
- TBool OkToExitL(TInt aButtonId);
-
- // from base class CEikDialog
- /**
- * From CEikDialog
- *
- * @see CEikDialog::PreLayoutDynInitL()
- */
- void PreLayoutDynInitL();
-
-private: //Methods
-
- /**
- * C++ default constructor.
- */
- CFMRadioFrequencyQueryDialog( TUint32& aFreq, const TTone& aTone = ENoTone );
-
-
-private:
-
- /**
- * Current frequency
- */
- TUint32& iFreq;
-
- };
-
-#endif // FMRADIOFREQUENCYQUERYDIALOG_H
-
--- a/fmradio/fmradio/inc/fmradioglobalconfirmationquery.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
-* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Header file of CFMRadioGlobalConfirmationQuery
-*
-*/
-
-
-#ifndef C_CFMRADIOGLOBALCONFIRMATIONQUERY_H
-#define C_CFMRADIOGLOBALCONFIRMATIONQUERY_H
-
-#include <e32base.h>
-
-class CAknGlobalConfirmationQuery;
-
-/**
-* Observer for global confirmation query event.
-*/
-class MFMRadioGlobalConfirmationQueryObserver
- {
- public:
-
- /**
- * Callback function that is called when global confirmation
- * query is dismissed.
- *
- * @param aSoftKey The softkey used to dismiss the query.
- */
- virtual void GlobalConfirmationQueryDismissedL(TInt aSoftKey) = 0;
- };
-
-
-/**
- * FM Radio global confirmation query.
- *
- * Must be deleted after used once.
- */
-class CFMRadioGlobalConfirmationQuery : public CActive
- {
-
-public:
-
- /**
- * Static constructor.
- */
- static CFMRadioGlobalConfirmationQuery* NewL(MFMRadioGlobalConfirmationQueryObserver* aObserver = NULL);
-
- /**
- * Static constructor.
- */
- static CFMRadioGlobalConfirmationQuery* NewLC(MFMRadioGlobalConfirmationQueryObserver* aObserver = NULL);
-
- /**
- * Destructor.
- */
- virtual ~CFMRadioGlobalConfirmationQuery();
-
- /**
- * Shows the query.
- *
- * @param aText Query text.
- * @param aSoftkeys Query softkeys.
- * @param aAnimation Query animation.
- */
- void ShowQueryL(const TDesC& aText, TInt aSoftkeys, TInt aAnimation);
-
-// From base class CActive
-protected:
- void RunL();
- void DoCancel();
- TInt RunError(TInt aError);
-
-private:
- /**
- * C++ default constructor.
- */
- CFMRadioGlobalConfirmationQuery(MFMRadioGlobalConfirmationQueryObserver* aObserver = NULL);
-
- /**
- * 2nd phase constructor.
- */
- void ConstructL();
-
-private: // data
-
- /**
- * Pointer to avkon global confirmation query. Owned!
- */
- CAknGlobalConfirmationQuery* iAknGlobalConfirmationQuery;
-
- /**
- * Text of global confirmation query. Owned!
- */
- HBufC* iText;
-
- /**
- * Observer for global confirmation query. Not owned!
- */
- MFMRadioGlobalConfirmationQueryObserver* iObserver;
- };
-
-#endif // C_CFMRADIOGLOBALCONFIRMATIONQUERY_H
--- a/fmradio/fmradio/inc/fmradioidlecontrolinterface.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares an interface for handling the media idle components
-*
-*/
-
-#ifndef FMRADIOIDLECONTROLINTERFACE_H_
-#define FMRADIOIDLECONTROLINTERFACE_H_
-
-/*
- * Interface for handling the media idle components.
- * Media idle visuals are controlled solely through this interface.
- */
-class MFMRadioIdleControlInterface
- {
- public:
- /*
- * Show the component with fade in
- */
- virtual void Show() = 0;
-
- /*
- * Hide the component with fade out
- */
- virtual void Hide() = 0;
-
- /*
- * Deactivates control. Used for example
- * foreground and background events.
- */
- virtual void Deactivate() = 0;
- };
-
-
-#endif /* FMRADIOIDLECONTROLINTERFACE_H_ */
--- a/fmradio/fmradio/inc/fmradioidlecontroller.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: fmradio idle area controller
-*
-*/
-
-#ifndef CMRADIOIDLECONTROLLER_H
-#define CMRADIOIDLECONTROLLER_H
-
-// INCLUDES
-#include <e32base.h>
-
-// FORWARD DECLARATIONS
-class MFMRadioIdleControlInterface;
-// CONSTANTS
-
-/**
- * fmradio idle area controller
- */
-class CFMRadioIdleController : public CBase
- {
-
- public:
- /**
- * Two-phased constructor.
- */
- static CFMRadioIdleController* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CFMRadioIdleController();
-
- public: // New functions
- /**
- * Adds new item to control.
- * @aControl control to add
- */
- void AddControlItem( const MFMRadioIdleControlInterface& aControl );
-
- /**
- * Shows a control and hides all other controls
- * @param aControl control to show
- */
- void ShowControl( const MFMRadioIdleControlInterface& aControl );
-
- /**
- * Deactivates all controlled items
- */
- void DeactivateControls();
-
- /**
- * Hide all controlled items
- */
- void HideAllControls();
-
- private:
- /**
- * C++ default constructor.
- */
- CFMRadioIdleController();
-
- /**
- * EPOC default constructor.
- */
- void ConstructL();
-
-
- private: // data
- // array of controlled items
- RPointerArray<MFMRadioIdleControlInterface> iControlArray;
-
-
- };
-
-
-#endif // CMRADIOIDLECONTROLLER_H
--- a/fmradio/fmradio/inc/fmradiologo.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definition of the class CFMRadioLogo.
-*
-*/
-
-
-#ifndef FMRADIOALFLOGO_H
-#define FMRADIOALFLOGO_H
-
-// INCLUDES
-
-#include <alf/alfcontrol.h>
-
-#include "fmradioidlecontrolinterface.h"
-// FORWARD DECLARATIONS
-
-class CAlfImageVisual;
-class MFMRadioLogoObserver;
-class CAlfAnchorLayout;
-
-// CLASS DEFINITION
-
-/**
-* Class for handling the radio icon
-*
-*/
-class CFMRadioLogo : public CAlfControl,
- public MFMRadioIdleControlInterface
- {
- public: // Constructors and destructor
- /**
- * Epoc two-phased constructor.
- * @param aEnv Reference to the Alf environment instance.
- * @return Pointer to this Indicator component.
- */
- static CFMRadioLogo* NewL( CAlfEnv& aEnv );
-
- /**
- * Destructor
- */
- virtual ~CFMRadioLogo();
-
- public: // New functions
- /**
- * Sets the indicator opacity in visible state.
- * @param aOpacity The indicator opacity
- */
- void SetOpacityInVisibleState( const TReal aOpacity );
-
- /**
- * Sets the indicator opacity in hidden state.
- * @param aOpacity The indicator opacity
- */
- void SetOpacityInHiddenState( const TReal aOpacity );
-
- /**
- * Sets the indicator rectangle
- * @param aRect Rectangle to the indicator
- */
- void SetRect( const TRect& aRect );
-
- /**
- * Sets the Observer
- * @param aObserver The object to observe the control
- */
- void SetObserver( MFMRadioLogoObserver* aObserver );
-
- /**
- * Removes the observer
- */
- void RemoveObserver( MFMRadioLogoObserver* aObserver );
-
- /**
- * Switch to landscape image.
- * @param aShow. ETrue for landscape, EFalse for portrait
- */
- void SwitchToLandscapeImage( TBool aShow );
-
- private:
- /**
- * C++ default constructor
- */
- CFMRadioLogo ();
-
- /**
- * EPOC second phase constructor.
- * @param aEnv Reference to the Hitchcock environment instance.
- */
- void ConstructL( CAlfEnv& aEnv );
-
- private: // Functions from base classes
- /**
- * from MFMRadioIdleControlInterface
- */
- void Show();
-
- /**
- * from MFMRadioIdleControlInterface
- */
- void Hide();
-
- /**
- * from MFMRadioIdleControlInterface
- */
- void Deactivate();
-
- /**
- * from CAlfControl
- */
- TBool OfferEventL( const TAlfEvent& aEvent );
-
- private: // New functions
- /**
- * Sets the fading animation to the CAlfVisual object.
- * @param aVisual a pointer to the visual object
- * @param aFadingTime Time duration after the visual object has been faded. Fading duration in milliseconds.
- * @param aOpacity Target opacity value
- */
- void Fade( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity );
-
- /**
- * Sets absolute rect of the anchor by top left and bottom right points.
- * @param aAnchor Anchor layout for setting placement
- * @param aOrdinal Index of visual element
- * @param aTopLeftPosition Top left point of the rect
- * @param aBottomRightPosition Bottom right point of the rect
- */
- void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition );
- /**
- * Creates the needed drawing layers and visual objects
- * for the logo.
- */
- void CreateImageVisualsL();
-
- private:
- /**
- * Alf custom events for the logo fade effects.
- * Logo stays visible couple of seconds after the
- * fade in event.
- */
- enum TFadeCustomEvent
- {
- EFadeInCompleted, // Fade in completed.
- ELogoDisplayTimerCompleted // Visibility time ended.
- };
-
- private:// Data
- /** Anchor layout for the logo. Not owned */
- CAlfAnchorLayout* iLogoAnchor;
- /** logo opacity in visible state */
- TReal iOpacityInVisibleState;
- /** logo opacity in hidden state */
- TReal iOpacityInHiddenState;
- /** logo rectangle */
- TRect iRect;
- /** Array of observers. */
- RPointerArray<MFMRadioLogoObserver> iObservers;
- // visual containing the default radio icon. Not owned
- CAlfImageVisual* iImageVisual;
- // default radio icon in portrait mode
- TAlfImage iPortraitImage;
- // default radio icon in landscape mode
- TAlfImage iLandscapeImage;
- /** File name for the background bitmap. Owned. */
- HBufC* iBackgroundBitmapFileName;
- // flag for visibility status
- TBool iIsVisible;
- };
-
-#endif //FMRADIOALFLOGO_H
--- a/fmradio/fmradio/inc/fmradiologoobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares an interface for observing radio logo event
-*
-*/
-
-#ifndef FMRADIOALFLOGOOBSERVER_H_
-#define FMRADIOALFLOGOOBSERVER_H_
-
-/*
- * Interface for observing radio logo event
- */
-class MFMRadioLogoObserver
- {
- public:
- /*
- * Logo visibility time has ended
- */
- virtual void LogoDisplayTimeCompleted() = 0;
- };
-#endif /* FMRADIOALFLOGOOBSERVER_H_ */
--- a/fmradio/fmradio/inc/fmradiomaincontainer.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,290 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definition of the class CFMRadioMainContainer.
-*
-*/
-
-
-#ifndef FMRADIOMAINCONTAINER_H
-#define FMRADIOMAINCONTAINER_H
-
-// INCLUDES
-
-#include <AknUtils.h>
-#include <alf/alfenv.h>
-#include <hwrmlight.h>
-#include <hwrmlightdomaincrkeys.h>
-
-#include "fmradio.hrh"
-#include "fmradioappui.h"
-
-// FORWARD DECLARATIONS
-
-class CRadioEngine;
-class CFMRadioAlfVisualizer;
-class CFMRadioAlfMediaIdle;
-class CFMRadioAlfIndicator;
-class CFMRadioAlfRDSViewer;
-class CFMRadioIdleController;
-class CFMRadioLogo;
-// CLASS DECLARATION
-/**
-* Interface to tell when timeout event occured
-*
-* @since 2.6
-*/
-class MFMRadioTimer
- {
- public:
-
- virtual void TimerTimeOut( TInt aErrorStatus ) = 0;
-
- };
-
-/**
-* Active object to handle timer timeout events
-*
-* @since 2.6
-*/
-class CFMRadioTimer : public CActive
- {
- public:
- /**
- * Constructor
- * @param aTimerObserver observer for active object
- */
- CFMRadioTimer( MFMRadioTimer* aTimerObserver );
- /**
- * Destructor
- */
- ~CFMRadioTimer();
- /**
- * ActiveObject RunL, which calls observer interface when completes
- */
- void RunL();
- /**
- * ActiveObject DoCancel, which calls observer interface when completes
- */
- void DoCancel();
- /**
- * Activated active object
- */
- void Activate();
-
- private:
- // Active object observer
- MFMRadioTimer* iTimerObserver;
-
- };
-
-
-/**
-* Creates and owns the UI controls related to the main view.
-*
-*/
-class CFMRadioMainContainer : public CBase,
- public MHWRMLightObserver,
- public MFMRadioTimer
-
- {
- public: // Constructors and destructor
- /**
- * Two-phase constructor of CFMRadioMainContainer
- * @since 2.6
- * @param aRect Frame rectangle for container.
- * @param aAlfEnv A reference to the alfred environment
- * @param aRadioEngine A pointer to the radio engine
- */
- static CFMRadioMainContainer* NewL( const TRect& aRect,
- CAlfEnv& aAlfEnv,
- CRadioEngine& aRadioEngine );
- /**
- * Destructor.
- * @since 2.6
- */
- virtual ~CFMRadioMainContainer();
-
- public: // New functions
- /**
- * Display the channel information
- * @since 2.6
- * @param aChannelNumber the channel number to display
- * @param aStationName the station name to display
- * @param aChangeType Station change type for the animation
- * @param aFrequency of the channel
- */
- void DisplayChannelInfoL( TInt aChannelNumber,
- const TDesC& aStationName,
- TFMRadioStationChangeType aChangeType,
- TInt aFrequency );
-
- /**
- * Formats the frequency number and returns it as a descriptor.
- * Ownership of the returned string is transfered.
- * @param aFrequency The frequency to be formatted
- * @param aResourceId The resource to be used for formatting the string
- * @return The formatted frequency
- */
- HBufC* FormattedFrequencyStringL( TInt aFrequency, TInt aResourceId );
-
- /**
- * Dims or undims RDS information
- * @param aShow <code>ETrue</code> if RDS marquee is to be shown, <code>EFalse</code> otherwise.
- * @param aFade <code>ETrue</code> if fade effect it to be used, <code>EFalse</code> otherwise.
- * @param aShowAfMarquee <code>ETrue</code> if AF marquee is also to be shown, <code>EFalse</code> otherwise.
- * This only has effect if aShow is <code>ETrue</code>.
- */
- void ShowRdsInfo( TBool aShow, TBool aFade, TBool aShowAfMarquee = EFalse);
-
- /**
- * Sets RT+ interaction indicator visible or invisible.
- *
- * The indicator is "MusicStore" or "+" depending on KRadioRTPlusSupportLevel cenrep value.
- * When it is off, only music store interaction is supported and the indicator is set likewise.
- *
- * @param aVisible sets the visibility
- * @param aFadeEffect to use transition fade effect or not
- */
- void ShowRTPlusInteractionIndicator( TBool aVisible, TBool aFadeEffect);
-
- /**
- * Fades the entire window and controls in the window owned by this container control.
- * @since 2.6
- * @param aFaded true/false to indicate whether the view should fade/unfade
- */
- void SetFaded( TBool aFaded );
- /**
- * Handles resource changes
- * @param aType Resource change type
- */
- void HandleResourceChange(TInt aType);
- /**
- * Sets rectangle of the alfred display
- * @param aRect Display rectangle
- * @return none
- */
- void SetRect( const TRect& aRect );
- /**
- * Returns a pointer to the station information visualizer
- * @return VisualControl
- */
- CFMRadioAlfVisualizer* VisualControl();
- /**
- * Returns a reference to the Media Idle
- * @return Media Idle
- */
- CFMRadioAlfMediaIdle& MediaIdle();
-
- /**
- * Updates RDS text to display
- * @return Media Idle
- */
- void SetRdsRadioTextL( const TDesC& aRadioText );
- /**
- * From MHWRMLightObserver
- * Lights status has been changed
- */
- void LightStatusChanged(TInt aTarget,
- CHWRMLight::TLightStatus aStatus);
- /**
- * From MFMTimer To handle timer timeout events.
- */
- void TimerTimeOut( TInt aErrorStatus );
-
- /**
- * Returns a reference to the RDS Viewer
- * @return RDS Viewer
- */
- CFMRadioAlfRDSViewer& RdsViewer() const;
- /**
- * Returns a reference to the idle controller
- * @return idle controller
- */
- CFMRadioIdleController& IdleController() const;
- /**
- * Returns a reference to the logo visual
- * @return logo visual
- */
- CFMRadioLogo& Logo() const;
-
- private: // New functions
- /**
- * Called when the view size is changed
- */
- void SizeChanged();
- /**
- * Required for help.
- * @since 2.7
- * @param aContext the help context to be used.
- */
- void GetHelpContext(TCoeHelpContext& aContext) const;
- /**
- * C++ default constructor
- * @param aAlfEnv A reference to the alfred environment
- * @param aRadioEngine A pointer to the radio engine
- */
- CFMRadioMainContainer( CAlfEnv& aAlfEnv, CRadioEngine& aRadioEngine );
- /**
- * EPOC default constructor
- * @since 2.7
- * @param aRect Frame rectangle for container.
- */
- void ConstructL( const TRect& aRect );
- /**
- * Handles updating main area text colors using current skin
- * @since 3.0
- */
- void UpdateTextColorFromSkin();
-
- private: //data
-
- TBool iFadeStatus;
- TRect iMainPaneRect;
-
- /** Visualizer for the radio information. Not owned. */
- CFMRadioAlfVisualizer* iVisualControl;
- /** Media Idle. Not owned. */
- CFMRadioAlfMediaIdle* iMediaIdle;
- /** RDS indicator. Not owned. */
- CFMRadioAlfIndicator* iRdsIndicator;
- /** RDS AF indicator. Not owned. */
- CFMRadioAlfIndicator* iRdsAfIndicator;
- /** RDS viewer. Not owned. */
- CFMRadioAlfRDSViewer* iRdsViewer;
- /** RDS interaction (music store, web link etc.) indicator. Not owned. */
- CFMRadioAlfIndicator* iRdsInteractionIndicator;
- /** A reference to the alfred environment. */
- CAlfEnv& iAlfEnv;
- /** A reference to the radio engine */
- CRadioEngine& iRadioEngine;
- /** A pointer to the control environment */
- CCoeEnv* iCoeEnv;
- /**Light event informer*/
- CHWRMLight* iLight;
- /**timer for light dimmed handler*/
- RTimer timer;
- /**Active object to handle lights dimmed timer */
- CFMRadioTimer* iTimer;
- /**Frame counter */
- TInt iLightsOffCounter;
- // Media idle controller. Owned
- CFMRadioIdleController* iIdleController;
- // Alf image visual for the default radio icon. Not Owned
- CFMRadioLogo* iRadioLogo;
-
- };
-
-#endif
-
-// End of File
--- a/fmradio/fmradio/inc/fmradiomainview.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,320 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definition of the class CFMRadioMainView.
-*
-*/
-
-
-#ifndef FMRADIOMAINVIEW_H
-#define FMRADIOMAINVIEW_H
-
-// INCLUDES
-#include <aknview.h>
-#include <alf/alfenv.h>
-#include <akntoolbarobserver.h>
-
-#include "mfmradiolayoutchangeobserver.h"
-#include "fmradiordsobserver.h"
-#include "fmradio.hrh"
-#include "mchannellisthandler.h"
-#include "fmradioalfrdsviewobserver.h"
-#include "fmradiologoobserver.h"
-
-// FORWARD DECLARATIONS
-class CFMRadioMainContainer;
-class CRadioEngine;
-class CFMRadioMusicStoreHandler;
-
-// CLASS DECLARATION
-
-/**
-* CFMRadioMainView view class.
-*
-* @since 2.6
-*/
-class CFMRadioMainView : public CAknView,
- public MFMRadioLayoutChangeObserver,
- public MFMRadioRdsObserver,
- public MAknToolbarObserver,
- public MFMRadioAlfRdsViewObserver,
- public MFMRadioLogoObserver
- {
- public: // Constructors and destructor
- /**
- * Two-phase constructor of CFMRadioMainView
- * @since 2.6
- * @param aRadioEngine pointer to the radio engine object
- * @param aAlfEnv alfred environment reference
- * @param aObserver channel list handler
- */
- static CFMRadioMainView* NewL(
- CRadioEngine* aRadioEngine,
- CAlfEnv& aAlfEnv,
- MChannelListHandler& aObserver );
- /**
- * Destructor.
- * @since 2.6
- */
- virtual ~CFMRadioMainView();
- public: // New functions
- /**
- * Return the unique identifier corresponding to this view
- * @since 2.6
- * @return unique view identifier
- */
- TUid Id() const;
- /**
- * Fade the view and all controls associated with it. Change
- * the soft keys so that "Exit" is displayed
- * @since 2.6
- * @param aFaded flag whether to fade or unfade
- */
- void FadeAndShowExit( TBool aFaded );
- /**
- * Update display when focus is regained
- * @since 3.0
- */
- void UpdateDisplayForFocusGained();
- /**
- * Tells the window owning container to display seek note
- * and updates softkeys
- * @since 2.6
- */
- void SeekL();
- /**
- * Seek operation has completed. Update the view to reflect
- * this fact.
- * @since 2.6
- */
- void StopSeekL();
- /**
- * Inform the window owning container that it should display
- * the frequency and name of the channel specified
- * @since 2.6
- * @param aChannelIndex The index of the channel to display
- */
- void DisplayChannelL( TInt aChannelIndex );
- /**
- * from MFMRadioLayoutChangeObserver
- * This method gets called by the AppUI when a dynamic layout change
- * event occurs.
- */
- void LayoutChangedL( TInt aType );
-
- /**
- * Sets the type for forthcoming station change
- * @param aChangeType The change type
- */
- void SetStationChangeType( TFMRadioStationChangeType aChangeType );
-
- /*
- * called before channel is about to change
- * */
- void PrepareViewForChannelChange();
-
- /**
- * Sets toolbar visibility
- * @param aVisible
- * @return none
- */
- void ShowToolbar( TBool aVisible );
-
- /**
- * From base class MFMRadioRdsObserver
- */
- void RdsDataProgrammeService( const TDesC& aProgramService );
- void RdsDataPsNameIsStatic( TBool aStatic );
- void RdsDataRadioText( const TDesC& aRadioText );
- void RdsDataRadioTextPlus( const TInt aRadioTextPlusClass, const TDesC& aRadioText );
- void RdsAfSearchBegin();
- void RdsAfSearchEnd( TUint32 aFrequency, TInt aError );
- void RdsAfSearchStateChange( TBool aEnabled );
- void RdsAvailable( TBool aAvailable );
-
- /*
- * Requests the right idle component to be started
- */
- void DetermineActiveMediaIdleComponent();
-
- /*
- * Shows default radio logo
- */
- void ShowDefaultLogo();
-
- private: // New functions
- /**
- * EPOC default constructor.
- * @since 2.6
- */
- void ConstructL();
- /**
- * constructor.
- * @since 2.6
- * @param aRadioEngine pointer to the radio engine object
- * @param aAlfEnv alf environment
- * @param aObserver
- */
- CFMRadioMainView( CRadioEngine* aRadioEngine, CAlfEnv& aAlfEnv, MChannelListHandler& aObserver );
- /**
- * Shows a tutorial dialog when user sees RT+ interaction indicator
- * for the very first time.
- */
- void ShowRTPlusFirstTimeDialogL();
- /**
- * Determines if RT+ interaction indicator should be shown, based on if
- * data is available in iSongName, iArtistName and iWebUrl.
- *
- * @return ETrue if there is valid data for RT+ interactions
- */
- TBool IsRTPlusInterActionIndicatorNeeded();
- /**
- * StaticRdsSignalTimerCallback Callback for iRdsSignalTimer
- */
- static TInt StaticRdsSignalTimerCallback( TAny* aSelfPtr );
- /**
- * Prepare toolbar for FMRadio command buttons
- */
- void PrepareToolbar();
- /**
- * Set the current dimmed state of the toolbar
- * @param aState the new toolbar dimmed state
- */
- void SetToolbarDimmedState( TBool aState );
-
- /**
- * Checks if the rds feed has a web link
- */
- TBool IsWebLinkAvailable();
-
- /**
- * Updates speaker button state in the toolbar
- * extension list
- */
- void UpdateToolbarSpeakerButtonStatus();
-
- private: // Functions from base classes
- /**
- * All commands are handled by the AppUi
- * @since 2.6
- * @param aCommand key code of the command to handle
- */
- void HandleCommandL( TInt aCommand );
- /**
- * From base class CAknView
- */
- void HandleForegroundEventL( TBool aForeground );
- /**
- * Activate the main view
- * @since 2.6
- */
- void DoActivateL( const TVwsViewId& aPrevViewId,TUid aCustomMessageId, const TDesC8& aCustomMessage );
- /**
- * Deactivate the main view
- * @since 2.6
- */
- void DoDeactivate();
- /**
- * From MEikMenuObserver, for changing menu items dynamically.
- *
- * @param aResourceId Resource ID identifying the menu pane to initialise.
- * @param aMenuPane The in-memory representation of the menu pane.
- */
- void DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane );
- /**
- * from MAknToolbarObserver
- */
- void OfferToolbarEventL( TInt aCommandId );
-
- /**
- * from MAknToolbarObserver
- */
- void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
-
- /**
- * Launch WebBrowser or Music shop based on given command Id.
- * @param aCommandId The command id
- */
- void LaunchBrowserL(TInt aCommandId);
- /**
- * Handle RDS programme service change.
- * @param aProgramService New programme service
- */
- void RdsDataProgrammeServiceL( const TDesC& aProgramService );
- /**
- * Handles the notification about type of PS name
- * @param aStatic
- */
- void HandleStaticProgrammeServiceL( TBool aStatic );
- /**
- * PrepareViewForChannelChangeL.
- */
- void PrepareViewForChannelChangeL();
- /**
- * Show save query if the current channel is not saved
- */
- void HandleSaveChannelQueryL();
- /**
- * from MEikMenuObserver
- */
- void SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis );
-
- // from MFMRadioLogoObserver
- void LogoDisplayTimeCompleted();
-
- // from MFMRadioAlfRdsViewObserver
- void NotifyRdsTextTimerCompletion();
-
- private: // Data
- // pointer to the container of the main view
- CFMRadioMainContainer* iContainer;
- // A pointer to the radio engine object
- CRadioEngine* iRadioEngine;
- // flag to keep track of whether the radio is currently seeking
- TBool iSeeking;
-
- /**
- * Station change direction used for station information animation
- */
- TFMRadioStationChangeType iChangeDirection;
-
- /**
- * Is the start up of application ongoing.
- */
- TBool iStartUp;
- TBool iFaded;
- /**
- * Timer for hiding the RDS signal icon after a delay
- */
- CPeriodic* iRdsSignalTimer;
-
- /**
- * Toolbar for controlling the application.
- */
- CAknToolbar* iToolbar;
-
- /**
- * observer for list event from main list
- */
- MChannelListHandler& iObserver;
- /**
- * Takes care of Music store integration.
- */
- CFMRadioMusicStoreHandler* iMusicStoreHandler;
- // flag for options menu status
- TBool iOptionsMenuOpen;
- };
-
-#endif
-
-// End of File
--- a/fmradio/fmradio/inc/fmradiomusicstorehandler.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,277 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Handles music store integration.
-*
-*/
-
-
-#ifndef FMRADIOMUSICSTOREHANDLER_H
-#define FMRADIOMUSICSTOREHANDLER_H
-
-#include <e32base.h>
-
-class CEikMenuPane;
-class CRepository;
-
-/**
- * Handler for Music Store.
- *
- * Takes care of Nokia music store and operator specific music store.
- *
- * Provides also a interface to open a web page.
- */
-class CFMRadioMusicStoreHandler : public CBase
- {
-private:
- /**
- * Used for tracking the visibility state.
- */
- enum TFMRadioMusicStoreState
- {
- EFMRadioMusicStoreUninitialized,
- EFMRadioMusicStoreEnabled,
- EFMRadioMusicStoreDisabled,
- EFMRadioMusicStoreForceEnabled
- };
-
- /**
- * Distinguishes between different implementation types of music store.
- */
- enum TFMRadioOperatorAppType
- {
- EFMRadioAppNotAvailable,
- EFMRadioNativeApp,
- EFMRadioJavaApp,
- EFMRadioWebsite
- };
-
-public:
- /**
- * Two-phase constructor of CMusicStoreHandler.
- *
- * @param aResourceId Menu pane where the music store item/items
- * will be added.
- */
- static CFMRadioMusicStoreHandler* NewL( TInt aResourceId );
-
- /**
- * Destructor
- */
- ~CFMRadioMusicStoreHandler();
-
- /**
- * Checks wether given command id is for music store functionality.
- *
- * @param aCommandId command id to check
- * @returns ETrue for music store command ids
- */
- TBool IsMusicStoreCommandId( TInt aCommandId );
-
- /**
- * This is called when dynamically initializing menu (ie, from DynInitMenuPaneL).
- *
- * @param aResourceId Resource id for currently processed menu part
- * @param aMenuPane Menu pane which is being handled
- * @returns ETrue, if menu pane was handled by this method
- */
- TBool InitializeMenuL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
- /**
- * The value given will be used as a guideline to wether to show or hide the item.
- * If music shop feature is not supported and this is called with ETrue it will
- * not show the item unless forced state is used.
- *
- * @param aEnable Whether enable or disable the item
- * @param aForce Whether the state is forced, by default it is not
- */
- void EnableMusicStore( TBool aEnable, TBool aForce = EFalse );
-
- /**
- * Launches Music store based on command id.
- *
- * @param aCommandId Command id for menu item
- * @param aArtist Artist of the single
- * @param aAlbum Album of the single
- * @param aTitle Name of the single
- */
- void LaunchMusicStoreL( TInt aCommandId,
- const TDesC& aTitle,
- const TDesC& aArtist,
- const TDesC& aAlbum );
-
- /**
- * Launches web page based on given string.
- *
- * @param aWebpage Web site to be launched
- */
- void LaunchWebPageL( const TDesC& aWebpage );
-
- /**
- * Is Nokia Music shop available
- * @returns ETrue if available
- */
- TBool NokiaMusicStoreAvailable();
-
- /**
- * Is Operator music store available
- * @returns ETrue if available
- */
- TBool OperatorMusicStoreAvailable();
-
- /**
- * Check if the music store functionality has been enabled
- * @return state
- */
- TBool IsMusicStoreEnabled();
-
- /**
- * returns name of the operator music store
- * @return name
- */
- const TDesC& OperatorMusicStoreName() const;
-
-private:
- /**
- * Default C++ constuctor
- *
- * @param aResourceId Menu pane where the music store item/items
- * will be added.
- */
- CFMRadioMusicStoreHandler( TInt aResourceId );
-
- /**
- * Second-phase constructor
- */
- void ConstructL();
-
- /**
- * Finds out the type of operator specific music store.
- *
- * @param aRepository Cenrep from which information is sought.
- * @returns Application type if available, otherwise EFMRadioAppNotAvailable
- */
- TFMRadioOperatorAppType CheckOperatorMusicStoreTypeL( CRepository& aRepository );
-
- /**
- * Called for application type specific initialization.
- *
- * @param aRepository Cenrep from which information is sought.
- * @param aAppType Type of implementation to be initialized.
- */
- void InitializeParametersL( CRepository& aRepository, TFMRadioOperatorAppType aAppType );
-
- /**
- * Called when native music store needs initializing.
- *
- * @param aMusicstoreUid P&S UID for initializing music shop
- */
- void InitializeMusicStore( TUid aMusicstoreUid );
-
- /**
- * Returns the count of active music stores.
- *
- * @returns Active music store count
- */
- TInt MusicStoreCount();
-
- /**
- * Creates the search string for Nokia Music Shop application
- *
- * @param aArtistName Artist of the single
- * @param aAlbumName Album of the single
- * @param aSongName Name of the single
- * @returns search string and pushes it to cleanup stack.
- */
- HBufC* NokiaMusicShopSearchLC( const TDesC& aSongName,
- const TDesC& aArtistName,
- const TDesC& aAlbumName );
-
- /**
- * Handles calling appropriate operator music store implementation
- *
- * @param aSearchString string used for searching
- */
- void LaunchOperatorMusicStoreL( const TDesC& aSearchString );
-
- /**
- * Launches Nokia Music shop application
- *
- * @param aMusicshopUid UID of the music shop
- * @param aSearchString string used for searching
- */
- void LaunchMusicShopL( TUid aMusicshopUid, const TDesC& aSearchString );
-
- /**
- * Converts binary data from cenrep to Uint32 presentation
- * @param aBuf binary data from cenrep
- * @return resolved Uint32 number
- */
- TUint32 Uint32Presentation( const TDesC8& aBuf );
-
- /**
- * Checks if the application with the given uid is installed to the system
- * @param aAppUid Application uid
- * @return true if app is found
- */
- TBool IsAppInstalledL( const TUid& aAppUid );
-
-private: // members
- /**
- * Resource id to which music store option will be bound.
- */
- TInt iResourceId;
-
- /**
- * This is used for with isMenuInitialized so that it is not needed
- * to go through all items in case we don't find the music store item.
- */
- TInt iFirstKnownResourceId;
-
- /**
- * Saves the state of Music store item
- */
- TFMRadioMusicStoreState iState;
-
- /**
- * Nokia Music store UID
- */
- TUint32 iMusicStoreUID;
-
- /**
- * Display name for operator music store
- */
- RBuf iOperatorMusicStoreName;
-
- /**
- * UID for Operator music store (native app.)
- */
- TUint32 iOperatorStoreNativeUID;
-
- /**
- * Website where Operator music store can be found
- */
- RBuf iOperatorStoreWebsite;
-
- /**
- * Control environment.
- */
- CCoeEnv* iCoeEnv;
-
- /**
- * flag for music store application availability
- */
- TBool iMusicStoreAppInstalled;
- };
-
-#endif /*FMRADIOMUSICSTOREHANDLER_H*/
--- a/fmradio/fmradio/inc/fmradiopreset.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: fmradio preset station information
-*
-*/
-
-#ifndef CMFRADIOPRESET_H
-#define CMFRADIOPRESET_H
-
-// INCLUDES
-#include <e32base.h>
-
-// FORWARD DECLARATIONS
-
-// CONSTANTS
-
-/**
- * fmradio preset station information
- */
-class CFMRadioPreset : public CBase
- {
-
- public:
- /**
- * Two-phased constructor.
- */
- static CFMRadioPreset* NewL();
- /**
- * Destructor.
- */
- virtual ~CFMRadioPreset();
-
- public: // New functions
- /*
- * Set name for the preset
- * @param aName new name for the preset
- */
- void SetPresetNameL( const TDesC& aName );
- /*
- * Returns preset name
- * @return name
- */
- TDesC& PresetName();
- /*
- * Set of the preset valid
- * @param aValid ETrue is the name is set valid
- */
- void SetPresetNameValid( TBool aValid );
- /*
- * Returns the validity of the preset name
- * @return ETrue if the name is valid, otherwise EFalse
- */
- TBool PresetNameValid();
- /*
- * Set frequency for the preset
- * @param aFrequency frequency to set
- */
- void SetPresetFrequency( TInt aFrequency );
- /*
- * Returns preset frequency
- * @return frequency
- */
- TInt PresetFrequency();
-
- private:
- /**
- * C++ default constructor.
- */
- CFMRadioPreset();
- /**
- * EPOC default constructor.
- */
- void ConstructL();
-
- private: // data
- // station name
- RBuf iStationName;
- // station frequency
- TInt iStationFrequency;
- // Validity of the station name
- TBool iNameIsValid;
- };
-
-
-#endif // CMFRADIOPRESET_H
--- a/fmradio/fmradio/inc/fmradioscanlocalstationscontainer.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: definition of the class CFMRadioScanLocalStationsContainer
-*
-*/
-
-
-#ifndef FMRADIOSCANLOCALSTATIONSCONTAINER_H
-#define FMRADIOSCANLOCALSTATIONSCONTAINER_H
-
-// INCLUDES
-#include <coecntrl.h>
-#include <aknlists.h>
-
-#include "fmradiodefines.h"
-#include "fmradio.hrh"
-#include "fmradioengine.h"
-// FORWARD DECLARATIONS
-class CAknWaitDialog;
-
-// CLASS DECLARATION
-
-/**
-* Creates and owns the UI components related to the Scan Local Stations View.
-* @since 2.6
-*/
-class CFMRadioScanLocalStationsContainer : public CCoeControl,
- public MEikListBoxObserver
- {
- public: // Constructors and destructor
- /**
- * Two-phase constructor of CFMRadioScanLocalStationsContainer
- * @since 2.6
- * @param aRect Frame rectangle for container.
- * @param aRadioEngine Radio engine reference
- */
- static CFMRadioScanLocalStationsContainer* NewL( const TRect& aRect, CRadioEngine& aRadioEngine );
- /**
- * Destructor.
- */
- virtual ~CFMRadioScanLocalStationsContainer();
- public: // New functions
- /**
- * Returns the index of the selected channel item from the channel list.
- * @since 2.6
- * @return the index of the currently selected channel
- */
- TInt CurrentlySelectedChannel() const;
- /**
- * Update the content of the channel at aIndex with the values specified
- * @since 2.6
- * @param aIndex index of the channel to update
- * @param aInfoText Info text to be shown instead of the frequency value
- * @param aChannelFrequency the new frequency of the channel
- * @param aNowPlaying indicates if 'Now playing' icon needs to be shown
- * @param aInfoTextPlacement ETrue if info text is displayed after frequency string; EFalse otherwise.
- */
- void UpdateChannelListContentL( TInt aIndex, const TDesC& aInfoText, TInt aChannelFrequency, TBool aNowPlaying, TBool aInfoTextPlacement = EFalse );
- void RemoveChannelListContentL( TInt aIndex );
- /**
- * Update the content of the channel at aIndex with the values specified
- * @since 2.6
- * @param aIndex index of the last selected channel
- */
- void UpdateLastListenedChannel( TInt aIndex );
- /**
- * Displays 'Now Playing' icon for given index.
- * @param aNewIndex Index of channel to get the icon
- * @param aOldIndex Index of channel to loose the icon
- */
- void UpdateNowPlayingIconL( TInt aNewIndex, TInt aOldIndex = KErrNotFound );
- /**
- * Hide 'Now Playing' icon from given index
- * @param aIndex Index of channel to hide the icon
- * @param aDraw flag for updating list after icon removal
- */
- void HideNowPlayingIconL( TInt aIndex, TBool aDraw );
- /**
- * Fades the entire window and controls in the window owned by this container control.
- * @since 2.6
- * @param aFaded flag to indicate whether we should fade or unfade
- */
- void SetFaded( TBool aFaded );
- /**
- * From CCoeControl
- */
- void HandleResourceChange(TInt aType);
- /**
- * Resets channel list
- */
- void ResetChannelListL();
- /**
- * Create the channel list (initially all spots are set as empty)
- * @since 2.6
- */
- void InitializeChannelListL();
-
- void SetStationListEmptyTextL( const TDesC& aText );
-
- /*
- * Adds frequency to the scanned channels list. Used while
- * scanning is ongoing
- * @param aIndex channel index
- * @param aChannelFrequency frequency to add
- */
- void InsertScannedChannelToListL( TInt aIndex, TInt aChannelFrequency );
-
- private: // Functions from base classes
- /**
- * Called by framework when the view size is changed
- * @since 2.6
- */
- void SizeChanged();
- /**
- * Return the number of controls in the window owned by this container
- * @since 2.6
- * @return number of controls
- */
- TInt CountComponentControls() const;
- /**
- * Return the control corresponding to the specified index
- * @since 2.6
- * @param aIndex the index of the control to retrieve
- * @return the control corresponding to the specified index
- */
- CCoeControl* ComponentControl( TInt aIndex ) const;
- /**
- * Redraw the window owned by this container
- * @since 2.6
- * @param aRect the size of the window to redraw
- */
- void Draw( const TRect& aRect ) const;
- /**
- * From MEikListBoxObserver, for listbox event handling.
- * @since 2.6
- * @param aListBox The originating list box.
- * @param aEventType A code for the event.
- */
- void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
- /**
- * Allow the channel list to process key events
- * @since 2.6
- * @param aKeyEvent The key event.
- * @param aType The type of key event.
- */
- TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
- /**
- * Required for help.
- * @since 2.7
- * @param aContext the help context to be used.
- */
- void GetHelpContext(TCoeHelpContext& aContext) const;
-
- void FocusChanged(TDrawNow aDrawNow);
- /*
- * from CCoeControl
- */
- void HandlePointerEventL( const TPointerEvent& aPointerEvent );
-
- private: // new functions
- // Default constructor
- CFMRadioScanLocalStationsContainer( CRadioEngine& aRadioEngine );
- /**
- * EPOC two phased constructor
- * @since 2.6
- * @param aRect Frame rectangle for container.
- */
- void ConstructL( const TRect& aRect);
-
- private: //data
-
- // The channel list listbox
- CAknSingleNumberStyleListBox* iChannelList;
- // Array of channel list items
- CDesCArray* iChannelItemArray;
-
- // Index of the most recently listened channel to keep the listbox up-to-date.
- TInt iLastChIndex;
- RPointerArray<CCoeControl> iControls;
- TBool iFadeStatus;
- CAknsBasicBackgroundControlContext* iBackground;
- MAknsSkinInstance* iSkin;
- CRadioEngine& iRadioEngine; //not own
-
- };
-
-#endif
-
-// End of File
--- a/fmradio/fmradio/inc/fmradioscanlocalstationsview.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: definition of the class CFMRadioScanLocalStationsView
-*
-*/
-
-
-#ifndef FMRADIOSCANLOCALSTATIONSVIEW_H
-#define FMRADIOSCANLOCALSTATIONSVIEW_H
-
-// INCLUDES
-#include <aknview.h>
-#include <AknProgressDialog.h>
-#include <akntoolbarobserver.h>
-
-#include "fmradioscanlocalstationscontainer.h"
-#include "mfmradiolayoutchangeobserver.h"
-#include "fmradiordsobserver.h"
-#include "mchannellisthandler.h"
-#include "fmradiosvkevents.h"
-
-// FORWARD DECLARATIONS
-class CFMRadioScanLocalStationsContainer;
-class CRadioEngine;
-class CAknWaitDialog;
-class CFMRadioPreset;
-
-
-// CLASS DECLARATION
-
-/**
-* CFMRadioScanLocalStationsView view class.
-* @since 2.6
-*/
-class CFMRadioScanLocalStationsView : public CAknView,
- public MCoeControlObserver,
- public MFMRadioLayoutChangeObserver,
- public MProgressDialogCallback,
- public MFMRadioRdsObserver,
- public MAknToolbarObserver
- {
- public: // Constructors and destructor
- /**
- * Two-phase constructor of CFMRadioScanLocalStationsView
- * @since 2.6
- * @param aRadioEngine pointer to a radio engine object
- * @param aObserver channel list observer
- */
- static CFMRadioScanLocalStationsView* NewL( CRadioEngine& aRadioEngine,
- MChannelListHandler& aObserver );
- /**
- * Destructor.
- * @since 2.6
- */
- virtual ~CFMRadioScanLocalStationsView();
- public: // New functions
- /**
- * Return the unique identifier corresponding to this view
- * @since 2.6
- * @return the unique identifier corresponding to this view
- */
- TUid Id() const;
- /**
- * Keep track of the last selected channel
- * @since 2.6
- * @param aIndex the index of the last listened to channel
- */
- void SetLastListenedChannel( TInt aIndex );
- /**
- * Keep track of the current selected channel
- * @param aChannelIndex the index of the current channel
- */
- void SetNowPlayingChannelL ( TInt aChannelIndex );
- /**
- * Returns the index of the playing channel item from the
- * channel list.
- * @return the currently playing channel
- */
- TInt CurrentlyPlayingChannel();
- /**
- * Returns the index of the selected channel item from the
- * channel list. If the container is active get the info from
- * it, because it may have more up-to-date info.
- * @since 2.6
- * @return the currently selected channel
- */
- TInt CurrentlySelectedChannel();
- /**
- * Make a request to the channel container to update the
- * content of the channel at aIndex with the values specified
- * @since 2.6
- * @param aIndex the index of the channel to update
- * @param aChannelFrequency the new frequency
- */
- void UpdateChannelListContentL( TInt aIndex, TInt aChannelFrequency );
- /**
- * Return true/false to indicate whether the channel specified is in use
- * @since 2.6
- * @param aIndex the index of the channel to check
- * @return true/false to indicate whether the channel is currently being used
- */
- TBool ChannelInUse( const TInt aIndex ) const;
- /**
- * Return true/false to indicate whether the channel specified is in play
- * @param aChannelIndex the index of the channel to check
- * @return true/false to indicate whether the channel is currently being played
- */
- TBool ChannelInPlay( TInt aChannelIndex ) const;
- /**
- * Retrieve the index of the next channel that has been set.
- * @since 2.6
- * @return the index of the next "in use" channel
- */
- TInt NextChannel();
- /**
- * Retrieve the index of the previous channel that has been set.
- * @since 2.6
- * @return the index of the previous "in use" channel
- */
- TInt PreviousChannel();
- /**
- * Fade the view and all controls associated with it. Change
- * the soft keys so that "Exit" is displayed
- * @since 2.6
- * @param aFaded true/false to indicate whether the view should fade/unfade.
- */
- void FadeAndShowExit( TBool aFaded );
- /**
- * Update display when focus regained
- * @since 3.0
- */
- void UpdateDisplayForFocusGained();
- /**
- * Display a wait note while the channel fill is occuring.
- * @since 2.6 *
- */
- void DisplayScanningInProgressNoteL();
- /**
- * Remove and destroy the scanning note.
- * @since 2.6
- */
- void RemoveScanningInProgressNoteL();
- /**
- * from MFMRadioLayoutChangeObserver
- * This method gets called by the AppUI when a dynamic layout change
- * event occurs.
- */
- void LayoutChangedL( TInt aType );
-
- /**
- * Invoked by AppUi when a new radio station is found.
- */
- void StopSeekL();
- /**
- * Restores the radio after scanning
- */
- void RestoreRadio( TBool aTuneInitialFrequency = ETrue );
- /**
- * Called when a new scan is activated.
- */
- void ResetListAndStartScanL();
- /**
- * Saves all the scanned channels into Radio Engine's presets.
- */
- void SaveAllChannelsL();
- /**
- * Sets toolbar visibility
- * @param aVisible
- * @return none
- */
- void ShowToolbar( TBool aVisible );
-
- // from base class MFMRadioRdsObserver
- void RdsDataProgrammeService( const TDesC& aProgramService );
- void RdsDataPsNameIsStatic( TBool aStatic );
- void RdsDataRadioText( const TDesC& aRadioText );
- void RdsDataRadioTextPlus( const TInt /*aRTPlusClass*/, const TDesC& /*aRadioText*/ ){};
- void RdsAfSearchBegin();
- void RdsAfSearchEnd( TUint32 aFrequency, TInt aError );
- void RdsAfSearchStateChange( TBool aEnabled );
- void RdsAvailable( TBool aAvailable );
-
- //for canceling the wizard
- void SetScanCanceled( TFMRadioCancelScanType aType );
- TFMRadioCancelScanType CancelType();
- /**
- * Dim or undim save and saveall buttons.
- */
- void UpdateToolbar();
-
- /*
- * Handle view specific remote control events
- * @param aEvent accessory event
- */
- void HandleScanListRemConEventL( TAccessoryEvent aEvent );
-
- private: // Functions from base classes
- /**
- * Activate the channel list view
- * @since 2.6
- */
- void DoActivateL( const TVwsViewId& aPrevViewId,TUid aCustomMessageId, const TDesC8& aCustomMessage );
- /**
- * Deactivate the channel list view
- * @since 2.6
- */
- void DoDeactivate();
- /**
- * Interprets view's menu,softkey and other commands and acts
- * accordingly by calling the appropriate command handler
- * function for further action.
- * @since 2.6
- * @param aCommand the command to process
- */
- void HandleCommandL( TInt aCommand );
- /**
- * From MCoeControlObserver, control event observing. In this case,
- * the user selection from the list is reported by container class
- * and observed here.
- * @since 2.6
- * @param aControl the control that caused the event
- * @param aEventType the type of event that was triggered
- */
- void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
- /**
- * Sets the state of menu items dynamically according to the
- * state of application data.
- * @since 2.6
- * @param aResourceId Resource ID identifying the menu pane to initialise.
- * @param aMenuPane The in-memory representation of the menu pane.
- */
- void DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane );
-
- /**
- * SetMiddleSoftKeyLabelL, sets the MSK label
- * from resource
- */
- void SetMiddleSoftKeyLabelL( const TInt aResourceId, const TInt aCommandId );
- /**
- * SetMiddleSoftKeyIconL, sets the MSK icon
- *
- */
- void SetMiddleSoftKeyIconL();
- /**
- * Called when user cancels waiting note or process finishes
- */
- void DialogDismissedL( TInt aButtonId );
- /**
- * from MAknToolbarObserver
- * Handle commands from toolbar.
- * @param aCommandId The command id
- */
- void OfferToolbarEventL( TInt aCommandId );
- /**
- * SetContextMenu, to set MSK context
- */
- void SetContextMenu( TInt aMenuTitleResourceId );
- private: // new functions
-
- /** modes for channel saving */
- enum TSavingMode
- {
- EAppend = 0x1,
- EReplace
- };
- /**
- * C++ default constructor
- */
- CFMRadioScanLocalStationsView( CRadioEngine& aRadioEngine, MChannelListHandler& aObserver );
- /**
- * EPOC default constructor.
- * @since 2.6
- */
- void ConstructL();
- /**
- * Save scanned channels to presets
- */
- void SaveFoundChannelsToPresetsL( TSavingMode aSavingMode );
- /**
- * Add found channel to the frequency list
- */
- void AddTunedFrequencyToListL();
- /**
- * Tune to the selected channel
- */
- void PlayCurrentlySelectedChannelL();
-
- /**
- * Show aResQuery confimation query with aResText.
- * aResText and aResQuery must be real resource ids.
- * Returns users response, 0 if user denied.
- */
- TInt ShowConfirmationQueryL(TInt aResText, TInt aResQuery);
- /**
- * Prepare toolbar for FMRadio command buttons
- */
- void PrepareToolbar();
- /**
- * Set the current dimmed state of the toolbar
- *
- * @param aState the new toolbar dimmed state
- */
- void SetToolbarDimmedState( const TBool aState );
- /**
- * check if the frequency is already found
- * @param aFrequency frequency to check
- * @return list index or KErrNotFound if the frequency is not in the list
- */
- TInt FrequencyIndex( TInt aFrequency );
- /**
- * Handle single channel save
- */
- void HandleOneChannelSaveL();
- /*
- * Activates main view. Doesn't bring radio to
- * foreground if the app is in the background
- */
- void ActivateMainViewL();
-
- /*
- * Resolves index number for the given frequency.
- * Frequencies are sorted from smallest to largest.
- * @param aFrequency frequency to add
- */
- TInt SortedFrequencyListIndex( TInt aFrequency );
-
- private: // Data
- CFMRadioScanLocalStationsContainer* iContainer;
- TInt iChIndex;
- TInt iNowPlayingIndex;
- TBool iScanAndSaveActivated;
- TInt iCurrentMSKCommandId; //owned
- TBool iFaded;
- TBool iScanCancelled;
- CRadioEngine& iRadioEngine;
- TInt iLowerFrequencyBound;
- TInt iUpperFrequencyBound;
-
- TBool iScanningNoteIsVisible;
- // array for the scanned channels
- RPointerArray<CFMRadioPreset> iScannedChannels;
-
- TInt iInitialTunedFrequency;
- // A wait used when channel fill in progress
- CAknWaitDialog* iScanningNote;
- TBool iTuneRequested;
- /**
- * Toolbar for controlling the application.
- */
- CAknToolbar* iToolbar;
- /**
- * channel list handler observer
- */
- MChannelListHandler& iObserver;
- TFMRadioCancelScanType iCancelType;
- };
-
-#endif
-
-// End of File
--- a/fmradio/fmradio/inc/fmradiosvkevents.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Class which implements handling Side Volume Key events (SVK).
-* This class implements methods of MRemConCoreApiTargetObserver
-*
-*
-*/
-
-
-#ifndef FMRADIOSVKEVENTS_H
-#define FMRADIOSVKEVENTS_H
-
-// INCLUDES
-#include <remconcoreapitargetobserver.h>
-#include <RemConCallHandlingTargetObserver.h>
-#include <e32debug.h>
-
-#include "fmradio.hrh"
-
-// FORWARD DECLARATIONS
-
-// CONSTANTS
-
-enum TAccessoryEvent
- {
- EForward = 1,
- ERewind,
- EPausePlay,
- EStop
- };
-
-// CLASS DECLARATION
-class CRemConCallHandlingTarget;
-class CRemConCoreApiTarget;
-class CRemConInterfaceSelector;
-class CRemConCoreApiTarget;
-
-
-class MFMRadioSvkEventsObserver
- {
-
- public:
-
-
-
- public:
- /**
- * Called when volume level should be changed.
- * @param aVolumeChange: +1 change volume up
- * -1 change volume down
- */
- virtual void FMRadioSvkChangeVolumeL( TInt aVolumeChange ) = 0;
-
- /**
- * Called when volume was changed last time 2 seconds ago or
- * timer was started 2 seconds ago. The remove control timer
- * is started when ChangeVolumeL() is called
- * or when started through CFMRadioSvkEvents::StartRemoveTimerL()
- */
- virtual void FMRadioSvkRemoveVolumeL( ) = 0;
-
- /**
- * Called when accessory key is pressed.
- * @param aEvent The headset event generated.
- */
- virtual void FMRadioHeadsetEvent(TAccessoryEvent aEvent) = 0;
-
- };
-
-
-class CFMRadioSvkEvents : public CBase,
- public MRemConCoreApiTargetObserver,
- public MRemConCallHandlingTargetObserver
- {
- public: // Constructors and destructor
- /**
- * Symbian constructor
- * @param aObserver observer to implement callback functions
- */
-
- static CFMRadioSvkEvents* NewL( MFMRadioSvkEventsObserver& aObserver );
-
- /**
- * Starts remove timer. Cancels running remove timer.
- * If SVK event occurs, the timer is cancelled and restarted.
- */
- void StartRemoveTimerL( );
-
- /**
- * Cancels remove timer.
- * If SVK event occurs, the timer is restarted.
- */
- void CancelRemoveTimer( );
-
- /**
- * Destructor.
- */
- virtual ~CFMRadioSvkEvents();
-
-
- public: // From MRemConCallHandlingTargetObserver
-
- void AnswerCall();
-
- void AnswerEndCall();
-
- void DialCall( const TDesC8& aTelNumber );
-
- void EndCall();
-
- void GenerateDTMF( const TChar aChar );
-
- void LastNumberRedial();
-
- void MultipartyCalling( const TDesC8& aData );
-
- void SpeedDial( const TInt aIndex );
-
- void VoiceDial( const TBool aActivate );
-
- protected: // New functions
- /**
- * Default constructor.
- */
- CFMRadioSvkEvents( MFMRadioSvkEventsObserver& aObserver );
-
- /**
- * EPOC constructor.
- */
- void ConstructL();
-
- // From MRemConCoreApiTargetObserver
- void MrccatoCommand(TRemConCoreApiOperationId aOperationId,
- TRemConCoreApiButtonAction aButtonAct);
-
-
- private:
-
- /**
- * Calls respective observer function
- */
- void DoChangeVolume( );
-
- /**
- * Calls respective observer function
- */
- void RemoveControlL( );
-
-
- /**
- * ChangeVolume is the callback function called from change volume timer.
- */
- static TInt ChangeVolume(TAny* aThis);
-
- /**
- * RemoveControl is the callback function called from remove control timer.
- */
- static TInt RemoveControl(TAny* aThis);
-
- /**
- * TuneChannel can be used to tune up/down
- */
- void TuneChannel( TFMRadioCommandIds aDirection );
-
- /**
- * Takes care of remcon volume keys
- * @param aButtonAct the button event
- * @param aDirection volume up or down
- */
- void HandleVolumeButtons( TRemConCoreApiButtonAction aButtonAct, TInt aDirection );
-
-
- private:
- MFMRadioSvkEventsObserver& iObserver;
- CRemConInterfaceSelector* iInterfaceSelector;
- CRemConCoreApiTarget* iCoreTarget;
- CRemConCallHandlingTarget* iCallTarget;
- CPeriodic* iVolumeTimer;
- CPeriodic* iRemoveTimer;
-
- /// indicates size of volume level change
- TInt iChange;
- TBool iTargetOpen;
- };
-
-
-#endif
-
-// End of File
--- a/fmradio/fmradio/inc/fmradiouids.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: FMRadio identifiers
-*
-*/
-#ifndef FMRADIOUIDS_H
-#define FMRADIOUIDS_H
-
-#include <e32cmn.h>
-
-// FMRadio Application UID
-#define KUidFMRadioApplication 0x10207A89
-
-// FM Radio View id's
-const TUid KFMRadioMainViewId = {0x01};
-const TUid KFMRadioChannelListViewId = {0x02};
-const TUid KFMRadioScanLocalStationsViewId = {0x03};
-
-#endif // FMRADIOUIDS_H
--- a/fmradio/fmradio/inc/mchannellisthandler.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Callback definitions to channel main list update
-*
-*
-*/
-
-#ifndef MCHANNELLISTHANDLER_H
-
-#define MCHANNELLISTHANDLER_H
-
-/**
-* Operations to main list
-* @since 2.6
-*/
-enum TMoveoperations
- {
- EMoveChannels,
- EDeleteChannel,
- EAddChannelToList,
- EStoreAllToRepository,
- EStoreIndexToRepository,
- ERemoveAllFromRepository
- };
-
-/**
-* Holder for the channel information and channel frequency
-* @since 2.6
-*/
-struct TChannelInformation
- {
- TBuf<32> iChannelInformation;
- TInt iChannelFrequency;
- };
-
-/**
-* Interface to update channel list
-*
-* @since 2.6
-*/
-class MChannelListHandler
- {
- public:
-
-
- virtual void UpdateChannelsL( TMoveoperations aOperation,
- TInt aIndex,
- TInt aMovedToNewIndex ) = NULL;
-
- virtual void AddChannelToListL( const TDesC& aChannelName, TInt aChannelFreq ) = 0;
-
- virtual CArrayFixFlat<TChannelInformation>* Channels() = 0;
-
- };
-
-#endif // MCHANNELLISTHANDLER_H
--- a/fmradio/fmradio/inc/mfmradiolayoutchangeobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares an interface for observing
-*
-*/
-
-
-
-#ifndef MFMRADIOLAYOUTCHANGEOBSERVER_H
-#define MFMRADIOLAYOUTCHANGEOBSERVER_H
-
-// INCLUDES
-#include <e32def.h>
-
-// CLASS DECLARATION
-
-/**
-* Notifies layot change.
-*
-* @lib VoiceRecorderUtils.dll
-* @since 2.0
-*/
-class MFMRadioLayoutChangeObserver
- {
- public:
- virtual void LayoutChangedL( TInt aType ) = 0;
- };
-
-#endif // MFMRADIOLAYOUTCHANGEOBSERVER_H
-
-// End of File
--- a/fmradio/fmradio/rom/fmradio.iby Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project FM Radio
-*
-*/
-
-
-#ifndef __FMRADIO_IBY__
-#define __FMRADIO_IBY__
-
-#include <bldvariant.hrh>
-
-#ifdef __S60_FM_RADIO_APPLICATION
-
-S60_APP_EXE(fmradio)
-S60_APP_AIF_ICONS(fmradio)
-data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\fmradio_reg.rsc private\10003a3f\import\apps\fmradio_reg.rsc
-
-data=ZSYSTEM\install\fmradio_stub.sis system\install\fmradio_stub.sis
-
-SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,fmradio)
-
-// Active Idle Engine
-file=ABI_DIR\BUILD_DIR\fmradioactiveidleengine200.dll SHARED_LIB_DIR\fmradioactiveidleengine200.dll
-
-#ifdef FF_HOMESCREEN_COMMON_IDLEFW
-ECOM_PLUGIN(fmradiomcpplugin100.dll, 2001f497.rsc)
-ECOM_PLUGIN(fmradioactionhandler.dll, 2001f498.rsc)
-#endif // FF_HOMESCREEN_COMMON_IDLEFW
-
-#endif // __S60_FM_RADIO_APPLICATION
-
-#endif // __FMRADIO_IBY__
--- a/fmradio/fmradio/rom/fmradioresources.iby Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The iby file contains files that must be included in image
-*
-*/
-
-
-#ifndef __FMRADIORESOURCES_IBY__
-#define __FMRADIORESOURCES_IBY__
-
-#include <bldvariant.hrh>
-#ifdef __S60_FM_RADIO_APPLICATION
-
-data=DATAZ_\APP_RESOURCE_DIR\fmradio.rsc APP_RESOURCE_DIR\fmradio.rsc
-data=DATAZ_\RESOURCE_FILES_DIR\fmradioengine.rsc RESOURCE_FILES_DIR\fmradioengine.rsc
-
-#ifdef FF_HOMESCREEN_COMMON_IDLEFW
-data=DATAZ_\RESOURCE_FILES_DIR\fmradiomcpplugin.rsc RESOURCE_FILES_DIR\fmradiomcpplugin.rsc
-#endif // FF_HOMESCREEN_COMMON_IDLEFW
-
-#endif // __S60_FM_RADIO_APPLICATION
-
-#endif //__FMRADIORESOURCES_IBY__
-
--- a/fmradio/fmradio/src/fmradioalfbitmapanimation.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,369 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Tuning animation for fmradio
-*
-*/
-
-#include <aknlayoutscalable_apps.cdl.h>
-#include <AknUtils.h>
-#include <alf/alfimage.h>
-#include <alf/alfimagevisual.h>
-#include <alf/alfevent.h>
-#include <AknsItemID.h>
-#include <barsread.h>
-#include <data_caging_path_literals.hrh>
-#include <fmradio.rsg>
-#include <alf/alfanchorlayout.h>
-#include <alf/alfenv.h>
-
-#include "fmradioalfbitmapanimation.h"
-#include "fmradiodefines.h"
-
-// CONSTANTS
-//const TInt KBmpAnimationDelay = 90;
-const TInt KBmpAnimationStartupDelay = 500;
-const TInt KBmpAnimationFadeInDefaultDurationTime = 200;
-const TInt KBmpAnimationFadeOutDefaultDurationTime = 200;
-const TInt KbmpAnimationStopDelay = 210;
-
-const TReal KDefaultOpacityInVisibleState = 1.0f;
-const TReal KDefaultOpacityInHiddenState = 0.0f;
-
-_LIT8( KBmpAnimationAnchorTag, "BitmapAnimationAnchorTag" );
-// values from fmradio LAF document
-const TInt KLAFVarietyTuningAnimationPortrait = 7;
-
-// ======== MEMBER FUNCTIONS ========
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::CFMRadioAlfBitmapAnimation
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioAlfBitmapAnimation::CFMRadioAlfBitmapAnimation() :
- iOpacityInVisibleState( KDefaultOpacityInVisibleState ),
- iOpacityInHiddenState( KDefaultOpacityInHiddenState ),
- iAnimationState( EBmpAnimationStopped )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::ConstructL( CAlfEnv& aEnv )
- {
- CAlfControl::ConstructL( aEnv );
- CreateBitmapAnimationArrayL();
- CreateImageAnimationVisualL();
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::NewL
-// Two-phase constructor of CFMRadioAlfBitmapAnimation
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfBitmapAnimation* CFMRadioAlfBitmapAnimation::NewL( CAlfEnv& aEnv )
- {
- CFMRadioAlfBitmapAnimation* self = new ( ELeave ) CFMRadioAlfBitmapAnimation;
- CleanupStack::PushL( self );
- self->ConstructL( aEnv );
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::~CFMRadioAlfBitmapAnimation
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfBitmapAnimation::~CFMRadioAlfBitmapAnimation()
- {
- iFrames.Reset();
- iFrames.Close();
- delete iBitmapFileName;
- }
-
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::OfferEventL
-// From CAlfControl, takes care of alfred event handling.
-// ----------------------------------------------------------------------------
-//
-TBool CFMRadioAlfBitmapAnimation::OfferEventL( const TAlfEvent& aEvent )
- {
- TBool eventHandled = EFalse;
-
- if ( aEvent.IsCustomEvent() )
- {
- switch( aEvent.CustomParameter() )
- {
- case EBmpAnimationStart:
- {
- eventHandled = ETrue;
- iAnimationState = EBmpAnimationRunning;
- StartAnimation();
- break;
- }
- case EBmpAnimationContinue:
- {
- eventHandled = ETrue;
- ContinueBmpAnimation();
- break;
- }
- case EBmpAnimationStop:
- {
- eventHandled = ETrue;
- Env().CancelCustomCommands( this );
- iAnimationState = EBmpAnimationStopped;
- break;
- }
- default:
- {
- break;
- }
- }
- }
- return eventHandled;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::CreateImageAnimationVisualL
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::CreateImageAnimationVisualL()
- {
-
- //CAlfAnchorLayout* imageAnchorLayout = CAlfAnchorLayout::AddNewL( *this );
- //imageAnchorLayout->SetTagL( KBitmapAnimationAnchorTag );
- // Create an anchor for the indicator layout
- iBmpAnimationAnchor = CAlfAnchorLayout::AddNewL( *this );
- iBmpAnimationAnchor->SetTagL( KBmpAnimationAnchorTag );
-
- iAnimationImageVisual = CAlfImageVisual::AddNewL( *this, iBmpAnimationAnchor );
- iAnimationImageVisual->SetImage( iFrames[0] );
-
- TAlfTimedValue opacity;
- opacity.SetTarget( iOpacityInHiddenState, 0 );
-
- iAnimationImageVisual->SetOpacity( opacity );
- }
-
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::CreateBitmapAnimationArrayL
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::CreateBitmapAnimationArrayL()
- {
- CCoeEnv* coeEnv = CCoeEnv::Static();
-
- TResourceReader resourceReader;
- coeEnv->CreateResourceReaderLC( resourceReader, R_FMRADIO_WAIT_ANIM_TUNING );
-
- iFrameInterval = resourceReader.ReadInt32();
- TInt bitmapCount = resourceReader.ReadInt16();
-
- TFindFile finder( coeEnv->FsSession() );
- TInt err = finder.FindByDir( KFMRadioBmpFile, KDC_APP_BITMAP_DIR );
- if ( err == KErrNone )
- {
- iBitmapFileName = finder.File().AllocL();
- }
-
- // read bitmap size from layout data
- TRect tempRect;
- TAknLayoutRect bitmapLayout;
- bitmapLayout.LayoutRect(
- tempRect,
- AknLayoutScalable_Apps::area_fmrd2_info_pane_g1( KLAFVarietyTuningAnimationPortrait ) );
-
-
- for ( TInt i = 0; i < bitmapCount; i++ )
- {
- TFileName bmpFile = resourceReader.ReadTPtrC();
- TInt bitmapId = resourceReader.ReadInt32();
- TInt bitmapMaskId = resourceReader.ReadInt32();
- TInt xx = resourceReader.ReadInt16();
- TInt xxx = resourceReader.ReadInt8();
-
- TAlfImage alfImage( KAknsIIDNone,
- bitmapLayout.Rect().Size(),
- EAspectRatioPreserved,
- iBitmapFileName,
- bitmapId,
- bitmapMaskId );
-
- iFrames.Append( alfImage );
- }
- CleanupStack::PopAndDestroy(); //resourceReader
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::StartBmpAnimation
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::StartAnimation()
- {
- iCurrentFrameIndex = 0;
- iAnimationImageVisual->SetImage( iFrames[iCurrentFrameIndex] );
-
- Show( ETrue );
-
- Env().Send( TAlfCustomEventCommand( EBmpAnimationContinue, this ), iFrameInterval );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::ContinueBmpAnimation
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::ContinueBmpAnimation()
- {
- iCurrentFrameIndex++;
-
- if ( iCurrentFrameIndex == 9 )
- {
- iCurrentFrameIndex = 0;
- }
- iAnimationImageVisual->SetImage( iFrames[iCurrentFrameIndex] );
- Env().Send( TAlfCustomEventCommand( EBmpAnimationContinue, this ), iFrameInterval );
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfIndicator::Show
-// Shows the indicator with the defined opacity value.
-// ---------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::Show( TBool aShowWithFading )
- {
- TAlfTimedValue opacity;
-
- if ( aShowWithFading )
- {
- opacity.SetTarget( iOpacityInVisibleState, KBmpAnimationFadeInDefaultDurationTime );
-
- iAnimationImageVisual->SetOpacity( opacity );
- }
- else
- {
- opacity.SetValueNow( iOpacityInVisibleState );
- iAnimationImageVisual->SetOpacity( opacity );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfIndicator::Hide
-// Hides the indicator with the defined opacity value.
-// ---------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::Hide( TBool aHideWithFading )
- {
- TAlfTimedValue opacity;
-
- if ( aHideWithFading )
- {
- opacity.SetTarget( iOpacityInHiddenState, KBmpAnimationFadeOutDefaultDurationTime );
-
- iAnimationImageVisual->SetOpacity( opacity );
- }
- else
- {
- opacity.SetValueNow( iOpacityInHiddenState );
- iAnimationImageVisual->SetOpacity( opacity );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfIndicator::StopBmpAnimation
-// ---------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::StopBmpAnimation()
- {
- if ( iAnimationState == EBmpAnimationStartup )
- {
- Env().CancelCustomCommands( this, EBmpAnimationStart );
- iAnimationState = EBmpAnimationStopped;
- }
- else if ( iAnimationState == EBmpAnimationRunning )
- {
- Hide( ETrue );
-
- Env().Send( TAlfCustomEventCommand( EBmpAnimationStop, this ), KbmpAnimationStopDelay );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::SetRect
-// Sets the Bmpanimation rectangle.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::SetRect( const TRect& aRect )
- {
- iRect = aRect;
- if ( iBmpAnimationAnchor )
- {
- SetAbsoluteCornerAnchors( iBmpAnimationAnchor, 0, iRect.iTl, iRect.iBr );
- iBmpAnimationAnchor->UpdateChildrenLayout();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::SetAbsoluteCornerAnchors
-// Sets absolute rect of the anchor by top left and bottom right points.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition )
- {
- if ( aAnchor )
- {
- // Set top/left anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeTopLeft,
- TAlfXYMetric( TAlfMetric( aTopLeftPosition.iX ), TAlfMetric( aTopLeftPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
-
-
- // Set bottom/right anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeBottomRight,
- TAlfXYMetric( TAlfMetric( aBottomRightPosition.iX ), TAlfMetric( aBottomRightPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfBitmapAnimation::StartBmpAnimation
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfBitmapAnimation::StartBmpAnimation()
- {
- if ( iAnimationState == EBmpAnimationRunning )
- {
- Env().CancelCustomCommands( this );
- Hide( EFalse ); // hide without fade
- }
- else if ( iAnimationState == EBmpAnimationStartup )
- {
- Env().CancelCustomCommands( this, EBmpAnimationStart );
- }
- iAnimationState = EBmpAnimationStartup;
- Env().Send( TAlfCustomEventCommand( EBmpAnimationStart, this ), KBmpAnimationStartupDelay );
- }
-
-// End of file
--- a/fmradio/fmradio/src/fmradioalfindicator.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,333 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioAlfIndicator
-*
-*/
-
-
-// INCLUDE FILES
-
-#include <alf/alfenv.h>
-#include <alf/alftextvisual.h>
-#include <alf/alfevent.h>
-#include <alf/alftransformation.h>
-#include <alf/alftextstyle.h>
-
-#include "fmradioalfindicator.h"
-
-// CONSTANTS
-
-const TInt KIndicatorFadeInDefaultDurationTime = 500;
-const TInt KIndicatorFadeOutDefaultDurationTime = 500;
-const TReal KDefaultOpacityInVisibleState = 1.0f;
-const TReal KDefaultOpacityInHiddenState = 0.0f;
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::NewL
-// Two-phase constructor of CFMRadioAlfIndicator
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfIndicator* CFMRadioAlfIndicator::NewL( CAlfEnv& aEnv )
- {
- CFMRadioAlfIndicator* self = new (ELeave) CFMRadioAlfIndicator( );
- CleanupStack::PushL(self);
- self->ConstructL( aEnv );
- CleanupStack::Pop(self);
- return self;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfIndicator::CFMRadioAlfIndicator
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioAlfIndicator::CFMRadioAlfIndicator( )
-: iTextStyleId( KErrNotFound ),
- iOpacityInVisibleState( KDefaultOpacityInVisibleState ),
- iOpacityInHiddenState( KDefaultOpacityInHiddenState )
- {
- //No implementation needed
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfIndicator::ConstructL
-// Symbian 2nd phase constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::ConstructL( CAlfEnv& aEnv )
- {
- CAlfControl::ConstructL( aEnv );
- AddIndicatorLayerL();
- Hide( EFalse );
- }
-
-// ---------------------------------------------------------------------------
-// ~CFMRadioAlfIndicator::~CFMRadioAlfIndicator
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfIndicator::~CFMRadioAlfIndicator()
- {
- if( iTextStyleId != KErrNotFound )
- {
- CAlfTextStyleManager& manager = Env().TextStyleManager();
- manager.DeleteTextStyle( iTextStyleId );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::OfferEventL
-// From CAlfControl, takes care of alfred event handling.
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAlfIndicator::OfferEventL( const TAlfEvent& /*aEvent*/ )
- {
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::SetRect
-// Sets the indicator rectangle.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetRect( const TRect& aRect )
- {
- iRect = aRect;
- TRAP_IGNORE( SetTextStyleL() );
- if( iIndicatorTextAnchor )
- {
- SetAbsoluteCornerAnchors( iIndicatorTextAnchor, 0, iRect.iTl, iRect.iBr );
- iIndicatorTextAnchor->UpdateChildrenLayout();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::AddIndicatorLayerL
-// Creates the needed drawing layers and visual objects
-// for the indicator.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::AddIndicatorLayerL()
- {
- // Create an anchor for the indicator layout
- iIndicatorTextAnchor = CAlfAnchorLayout::AddNewL( *this );
-
- // Create visual object for the indicator
- iText = CAlfTextVisual::AddNewL( *this, iIndicatorTextAnchor );
- iText->SetColor( iTextColor );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::SetTextStyleL
-// Creates the text style for indicator
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetTextStyleL()
- {
- CAlfTextStyleManager& manager = Env().TextStyleManager();
- if ( iTextStyleId == KErrNotFound )
- {
- iTextStyleId = manager.CreatePlatformTextStyleL(
- EAknLogicalFontSecondaryFont,
- EAlfTextStyleNormal );
- }
- iText->SetTextStyle( iTextStyleId );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::SetTextColor
-// Changes indicator text color.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetTextColor( const TRgb& aTextColor )
- {
- iTextColor = aTextColor;
- if( iText )
- {
- iText->SetColor( aTextColor );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfIndicator::SetTextL
-// Sets the indicator text.
-// ---------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetTextL( const TDesC& aText )
- {
- iText->SetTextL( aText );
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfIndicator::Show
-// Shows the indicator with the defined opacity value.
-// ---------------------------------------------------------
-//
-void CFMRadioAlfIndicator::Show( TBool aShowWithFading )
- {
- if( aShowWithFading )
- {
- Fade( iText, KIndicatorFadeInDefaultDurationTime, iOpacityInVisibleState );
- }
- else
- {
- Fade( iText, 0, iOpacityInVisibleState );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfIndicator::Hide
-// Hides the indicator with the defined opacity value.
-// ---------------------------------------------------------
-//
-void CFMRadioAlfIndicator::Hide( TBool aHideWithFading )
- {
- if( aHideWithFading )
- {
- Fade( iText, KIndicatorFadeOutDefaultDurationTime, iOpacityInHiddenState );
- }
- else
- {
- Fade( iText, 0, iOpacityInHiddenState );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::SetOpacityInVisibleState
-// Sets the indicator opacity in visible state.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetOpacityInVisibleState( const TReal aOpacity )
- {
- iOpacityInVisibleState = aOpacity;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::SetOpacityInHiddenState
-// Sets the indicator opacity in hidden state.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetOpacityInHiddenState( const TReal aOpacity )
- {
- iOpacityInHiddenState = aOpacity;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::SetAbsoluteCornerAnchors
-// Sets absolute rect of the anchor by top left and bottom right points.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition )
- {
- if ( aAnchor )
- {
- // Set top/left anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeTopLeft,
- TAlfXYMetric( TAlfMetric( aTopLeftPosition.iX ), TAlfMetric( aTopLeftPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
-
-
- // Set bottom/right anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeBottomRight,
- TAlfXYMetric( TAlfMetric( aBottomRightPosition.iX ), TAlfMetric( aBottomRightPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::SetAbsoluteCornerAnchors
-// Sets absolute rect of the anchor by top left point and size of the rect
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TSize& aSize )
- {
- if( aAnchor )
- {
- // set top left corner position
- aAnchor->SetAnchor( EAlfAnchorTopLeft, aOrdinal,
- EAlfAnchorOriginLeft,
- EAlfAnchorOriginTop,
- EAlfAnchorMetricAbsolute,
- EAlfAnchorMetricAbsolute,
- TAlfTimedPoint( aTopLeftPosition.iX, aTopLeftPosition.iY ) );
- // .. and set the bottom right corner also to fix the size
- aAnchor->SetAnchor( EAlfAnchorBottomRight, aOrdinal,
- EAlfAnchorOriginLeft,
- EAlfAnchorOriginTop,
- EAlfAnchorMetricAbsolute,
- EAlfAnchorMetricAbsolute,
- TAlfTimedPoint( aTopLeftPosition.iX + aSize.iWidth, aTopLeftPosition.iY + aSize.iHeight ) );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::SetRelativeCornerAnchors
-// Sets relative rect of the anchor by top left and bottom right points.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealPoint& aBottomRightPosition )
- {
- if( aAnchor )
- {
- aAnchor->SetRelativeAnchorRect( aOrdinal,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aTopLeftPosition,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aBottomRightPosition );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::SetRelativeCornerAnchors
-// Sets relative rect of the anchor by top left point and size of the rect
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealSize& aSize )
- {
- if( aAnchor )
- {
- aAnchor->SetRelativeAnchorRect( aOrdinal,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aTopLeftPosition,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aTopLeftPosition + TAlfRealPoint( aSize.iWidth, aSize.iHeight ) );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::Fade
-// Sets the fading animation to the CAlfVisual object.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfIndicator::Fade( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity ) const
- {
- TAlfTimedValue opacity;
- opacity.SetTarget( aOpacity, aFadingTime ); // and smooth target
- aVisual->SetOpacity( opacity );
- }
-
-// End of File
-
--- a/fmradio/fmradio/src/fmradioalfmediaidle.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1274 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioAlfMediaIdle
-*
-*/
-
-
-// INCLUDE FILES
-
-#include <aknlayoutscalable_apps.cdl.h>
-#include <alf/alfenv.h>
-#include <alf/alftextvisual.h>
-#include <alf/alfevent.h>
-#include <alf/alftransformation.h>
-#include <alf/alfgradientbrush.h>
-#include <alf/alfbrusharray.h>
-#include <alf/alfborderbrush.h>
-#include <alf/alfimagebrush.h>
-#include <alf/alftexturemanager.h>
-#include <alf/alfviewportlayout.h>
-#include <alf/alfdecklayout.h>
-#include <alf/alfflowlayout.h>
-#include <alf/alfutil.h>
-#include <alf/alftextstyle.h>
-#include <AknsItemID.h>
-#include <data_caging_path_literals.hrh>
-#include <e32math.h>
-#include <eikenv.h>
-#include <StringLoader.h>
-
-#include "fmradioalfmediaidle.h"
-#include "fmradioappui.h"
-#include "debug.h"
-
-// CONSTANTS
-
-
-_LIT8( KMediaIdleAnchorTag, "mediaIdleAnchor" );
-_LIT8( KMediaIdleViewportTag, "mediaIdleViewport" );
-_LIT8( KMediaIdleFlowLayoutTag, "mediaIdleFlowLayout" );
-_LIT8( KMediaIdleBackgroundTextTag, "mediaIdleBackgroundText" );
-_LIT8( KMediaIdleItemTag, "mediaIdleItem" );
-
-const TInt KNumberOfTextStyles = 4;
-const TReal KRelativeFontSizeArray[KNumberOfTextStyles] = {0.12f, 0.17f, 0.25f, 0.33f};
-const TReal KRelativeSizeOfMediaIdleBackgroundFont = 0.7f;
-
-const TInt KMediaIdleFadeOutDurationTime = 500;
-const TInt KMediaIdleFadeInDurationTime = 500;
-
-const TInt KMediaIdleBackgroundTextScrollInterval = 12000;
-const TReal KMediaIdleBackgroundTextOpacity = 0.2f;
-const TInt KMediaIdleBackgroundTextSideToSideTransitionDurationTime = 25000;
-
-//const TInt KMediaIdleModeChangeInterval = 20000;
-
-const TInt KMaxNumberOfMediaIdleItems = 5;
-const TInt KMaxMediaIdleItemScrollDurationTime = 35000;
-const TInt KMinMediaIdleItemScrollDurationTime = 25000;
-const TInt KMinMediaIdleItemHideDurationTime = 5000;
-const TInt KModeChangingFactor = 3;
-
-const TReal KMaxOpacity = 0.3f;
-const TReal KMinOpacity = 0.1f;
-
-const TRgb KMediaIdleItemDefaultColor(0, 0, 0);
-const TRgb KMediaIdleItemBackgroundColor(255, 255, 255);
-const TReal KMediaIdleItemBackgroundOpacity = 0.4f;
-
-const TInt KMediaIdleItemArrayGranularity = 4;
-
-const TInt KLAFVarietyRadioIdlePortrait = 0;
-const TInt KLAFVarietyRadioIdleLandscape = 1;
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-
-// ============================ LOCAL FUNCTIONS ===============================
-
-namespace LocalFunctions {
-
-// ---------------------------------------------------------------------------
-// fullyVerticallyVisibleRect
-// Check does the given rect fit vertically into a CAlfLayout area
-// ---------------------------------------------------------------------------
-//
-static TBool fullyVerticallyVisibleRect( const CAlfLayout& aLayout, const TAlfRealRect & aRect )
- {
- TBool ret = ETrue;
- TInt layoutHeight = aLayout.Size().IntTarget().iY;
- TInt bottomY = aRect.BottomLeft().iY;
- TInt topY = aRect.TopRight().iY;
-
- if ( bottomY >= layoutHeight || topY < 0 ) ret = EFalse;
-
- return ret;
- }
-// ---------------------------------------------------------------------------
-// updateItemVisibility
-// Hide (or unhide) an visual depending is it going to be not fully visible or not
-// ---------------------------------------------------------------------------
-//
-static void updateItemVisibility( const CAlfLayout& aLayout, TInt index )
- {
- CAlfVisual& visual = aLayout.Visual( index );
- if ( !LocalFunctions::fullyVerticallyVisibleRect( aLayout, visual.DisplayRectTarget() ) )
- {
- visual.SetOpacity( TAlfTimedValue( 0.0f, KMinMediaIdleItemHideDurationTime ) );
- }
- }
-}
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::NewL
-// Two-phase constructor of CFMRadioAlfMediaIdle
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfMediaIdle* CFMRadioAlfMediaIdle::NewL( CAlfEnv& aEnv )
- {
- CFMRadioAlfMediaIdle* self = new (ELeave) CFMRadioAlfMediaIdle( );
- CleanupStack::PushL(self);
- self->ConstructL( aEnv );
- CleanupStack::Pop(self);
- return self;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::CFMRadioAlfMediaIdle
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioAlfMediaIdle::CFMRadioAlfMediaIdle()
-: iFontsOrientation( EOrientationNone ),
- iOrientation( EOrientationNone ),
- iMediaIdleItemBackgroundTextStyleId( KErrNotFound ),
- iMediaIdleState( EStopped ),
- iMediaIdleMode( EBackgroundTextAndMediaIdleItems ),
- iMediaIdleRequestedMode( EBackgroundTextAndMediaIdleItems ),
- iMediaIdlePrimaryColor( KRgbBlue ),
- iMediaIdleSecondaryColor( KRgbBlue ),
- iPsName( NULL )
- {
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::ConstructL
-// Symbian 2nd phase constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::ConstructL( CAlfEnv& aEnv )
- {
- CAlfControl::ConstructL( aEnv );
- UpdateLayout();
- iIsConstructed = ETrue;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::CreateFontsL
-// Create fonts that are based on a list of relative sizes
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::CreateFontsL()
- {
- TInt layoutHeight = 20;
-
- if ( iMediaIdleLayout.Rect().Height() != 0 )
- {
- layoutHeight = iMediaIdleLayout.Rect().Height();
- }
-
- if( iFontsOrientation != iOrientation ||
- iFontReferenceHeight != layoutHeight )
- {
- CAlfTextStyleManager& manager = Env().TextStyleManager();
- for( TInt i=0; i < iTextStyleIdArray.Count(); i++ )
- {
- manager.DeleteTextStyle( iTextStyleIdArray[i] );
- iTextStyleIdArray.Reset();
- }
- if( iMediaIdleItemBackgroundTextStyleId != KErrNotFound )
- {
- manager.DeleteTextStyle( iMediaIdleItemBackgroundTextStyleId );
- iMediaIdleItemBackgroundTextStyleId = KErrNotFound;
- }
-
- // Create largest font for the background text of media idle
- iMediaIdleItemBackgroundTextStyleId = manager.CreatePlatformTextStyleL();
- CAlfTextStyle* mediaIdleItemStyle = manager.TextStyle( iMediaIdleItemBackgroundTextStyleId );
- mediaIdleItemStyle->SetTextSizeInPixels( KRelativeSizeOfMediaIdleBackgroundFont * layoutHeight, ETrue );
- // Create text styles for other media idle items
- for( TInt i = 0; i < KNumberOfTextStyles; i++ )
- {
- TInt mediaIdleItemTextStyleId = manager.CreatePlatformTextStyleL();
- CAlfTextStyle* mediaIdleItemStyle = manager.TextStyle( mediaIdleItemTextStyleId );
- mediaIdleItemStyle->SetTextSizeInPixels( KRelativeFontSizeArray[i] * layoutHeight, ETrue );
- iTextStyleIdArray.Append( mediaIdleItemTextStyleId );
- }
- iFontsOrientation = iOrientation;
- iFontReferenceHeight = layoutHeight;
- }
- }
-
-// ---------------------------------------------------------------------------
-// ~CFMRadioAlfMediaIdle::~CFMRadioAlfMediaIdle
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfMediaIdle::~CFMRadioAlfMediaIdle()
- {
- Env().CancelCustomCommands( this );
- if( iMediaIdleItemArray )
- {
- if( iMediaIdleItemArray->Count() > 0 )
- {
- iMediaIdleItemArray->Reset();
- }
- delete iMediaIdleItemArray;
- }
- CAlfTextStyleManager& manager = Env().TextStyleManager();
- for( TInt i=0; i < iTextStyleIdArray.Count(); i++ )
- {
- manager.DeleteTextStyle( iTextStyleIdArray[i] );
- }
- iTextStyleIdArray.Close();
- if ( iMediaIdleItemBackgroundTextStyleId != KErrNotFound )
- {
- manager.DeleteTextStyle( iMediaIdleItemBackgroundTextStyleId );
- }
- delete iPsName;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::AddMediaIdleL
-// Creates the media idle with passed number of media idle items
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::AddMediaIdleL( const TInt aNumberOfMediaIdleItems )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::AddMediaIdleL(%d)"), aNumberOfMediaIdleItems ) );
-
- CAlfAnchorLayout* mediaIdleAnchor = static_cast<CAlfAnchorLayout*> ( FindTag( KMediaIdleAnchorTag ) );
- if ( !mediaIdleAnchor )
- {
- mediaIdleAnchor = CAlfAnchorLayout::AddNewL( *this );
- }
- mediaIdleAnchor->SetTagL( KMediaIdleAnchorTag );
-
- CAlfViewportLayout* mediaIdleViewport = static_cast<CAlfViewportLayout*> ( FindTag( KMediaIdleViewportTag ) );
- if( !mediaIdleViewport )
- {
- mediaIdleViewport = CAlfViewportLayout::AddNewL( *this, mediaIdleAnchor );
- mediaIdleViewport->SetTagL( KMediaIdleViewportTag );
- mediaIdleViewport->SetViewportPos( TAlfRealPoint( .0f, .0f ), 0 );
- mediaIdleViewport->SetViewportSize( TAlfRealSize( 1.0f, 1.0f ), 0 );
- }
- MediaIdleFadeOut( ETrue );
-
- // Create the flow layout for the other media idle items
- CAlfFlowLayout* mediaIdleFlowLayout = static_cast<CAlfFlowLayout*> ( FindTag( KMediaIdleFlowLayoutTag ) );
- if( !mediaIdleFlowLayout )
- {
- mediaIdleFlowLayout = CAlfFlowLayout::AddNewL( *this, mediaIdleViewport );
- mediaIdleFlowLayout->SetTagL( KMediaIdleFlowLayoutTag );
- mediaIdleFlowLayout->SetFlowDirection( CAlfFlowLayout::EFlowVertical );
- mediaIdleFlowLayout->SetMode( CAlfFlowLayout::EModeCenterPerpendicular );
- }
-
- InitializeMediaIdleItemsL( aNumberOfMediaIdleItems );
- UpdateLayout();
- AnimateMediaIdleItems();
- MediaIdleFadeIn();
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::CreateBackgroundTextL
-// Creates backgrounf text for media idle content
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::CreateBackgroundTextL()
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::CreateBackgroundTextL()") ) );
-
- CAlfViewportLayout* mediaIdleViewport = static_cast<CAlfViewportLayout*> ( FindTag( KMediaIdleViewportTag ) );
- // Create and animate the background text of the media idle
- HBufC* itemText = GetRandomMediaIdleContentL();
- CleanupStack::PushL( itemText );
- CAlfTextVisual* backgroundText = static_cast<CAlfTextVisual*> ( mediaIdleViewport->FindTag( KMediaIdleBackgroundTextTag ) );
- if( !backgroundText && itemText )
- {
- backgroundText = AddMediaIdleItemL( mediaIdleViewport, *itemText, EFalse, KMediaIdleItemBackgroundColor, KMediaIdleItemBackgroundOpacity );
- backgroundText->SetTagL( KMediaIdleBackgroundTextTag );
- SetMediaIdleItemSettingsL( backgroundText, *itemText, iMediaIdleItemBackgroundTextStyleId );
- backgroundText->SetOpacity( TAlfTimedValue( KMediaIdleBackgroundTextOpacity ) );
- backgroundText->EnableBrushesL();
- backgroundText->EnableShadow( EFalse );
- SetScrollingToBackgroundText( backgroundText,
- KMediaIdleBackgroundTextSideToSideTransitionDurationTime,
- EMediaIdleBackgroundTextScrollEnd );
- }
- else if( itemText )
- {
- SetMediaIdleItemSettingsL( backgroundText, *itemText, iMediaIdleItemBackgroundTextStyleId );
- backgroundText->SetOpacity( TAlfTimedValue( KMediaIdleBackgroundTextOpacity ) );
- SetScrollingToBackgroundText( backgroundText, KMediaIdleBackgroundTextSideToSideTransitionDurationTime, EMediaIdleBackgroundTextScrollEnd );
- }
- CleanupStack::PopAndDestroy( itemText );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::InitializeMediaIdleItemsL
-// Initializes the media idle items
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::InitializeMediaIdleItemsL( const TInt aNumberOfMediaIdleItems )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::InitializeMediaIdleItemsL(%d)"), aNumberOfMediaIdleItems ) );
-
- CAlfFlowLayout* mediaIdleFlowLayout = static_cast<CAlfFlowLayout*> ( FindTag( KMediaIdleFlowLayoutTag ) );
- if( mediaIdleFlowLayout )
- {
- CreateFontsL();
- CreateBackgroundTextL();
- // Create the media idle items
- for( TInt i = 0, fontStyleIdIx = 0; i < aNumberOfMediaIdleItems; i++, fontStyleIdIx++ )
- {
- HBufC* itemText = GetRandomMediaIdleContentL();
- const TPtrC& text = itemText ? itemText->Des() : KNullDesC();
-
- CleanupStack::PushL( itemText );
- TInt randFontStyleIx = AlfUtil::RandomInt( 0, iTextStyleIdArray.Count() - 1 );
- CAlfTextVisual* mediaIdleItem = NULL;
- if( mediaIdleFlowLayout->Count() < aNumberOfMediaIdleItems )
- {
- mediaIdleItem = AddMediaIdleItemL( mediaIdleFlowLayout, text, EFalse, KMediaIdleItemBackgroundColor, KMediaIdleItemBackgroundOpacity );
- }
- else
- {
- mediaIdleItem = static_cast<CAlfTextVisual*> ( &mediaIdleFlowLayout->Visual( i ) );
- mediaIdleItem->SetOpacity( TAlfTimedValue( .0f ) );
- mediaIdleItem->EnableTransformationL( ETrue );
- mediaIdleItem->Transformation().LoadIdentity();
- }
- SetMediaIdleItemSettingsL( mediaIdleItem, text, iTextStyleIdArray[ randFontStyleIx ] );
- CleanupStack::PopAndDestroy( itemText );
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::AnimateMediaIdleItems
-// Sets defined animation to the created media idle items
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::AnimateMediaIdleItems()
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::AnimateMediaIdleItems()") ) );
-
- CAlfFlowLayout* mediaIdleFlowLayout = static_cast<CAlfFlowLayout*> ( FindTag( KMediaIdleFlowLayoutTag ) );
- if( mediaIdleFlowLayout )
- {
- for( TInt i = 0; i < mediaIdleFlowLayout->Count(); i++ )
- {
- CAlfTextVisual* mediaIdleItem = static_cast<CAlfTextVisual*> ( &mediaIdleFlowLayout->Visual( i ) );
- if( mediaIdleItem )
- {
- SetMediaIdleItemAnimation( mediaIdleItem );
- }
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::AddMediaIdleItemL
-// Creates the media idle item to the passed media idle view port.
-// ----------------------------------------------------------------------------
-//
-CAlfTextVisual* CFMRadioAlfMediaIdle::AddMediaIdleItemL( CAlfLayout* aMediaIdle,
- const TDesC& aMediaIdleItemText,
- TBool aMediaIdleItemHasBackground,
- const TRgb& aBackgroundColor,
- const TReal aBackgroundOpacity )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::AddMediaIdleItemL('%S')"), &aMediaIdleItemText ) );
-
- CAlfTextVisual* mediaIdleItem = CAlfTextVisual::AddNewL( *this, aMediaIdle );
- mediaIdleItem->EnableBrushesL();
- mediaIdleItem->SetTextL( aMediaIdleItemText );
- mediaIdleItem->SetTagL( KMediaIdleItemTag );
- mediaIdleItem->EnableShadow( EFalse );
- mediaIdleItem->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
- // mediaIdleItem->SetFlag( EAlfVisualFlagManualLayout );
- mediaIdleItem->SetSize( mediaIdleItem->TextExtents() );
-
- if ( aMediaIdleItemHasBackground )
- {
- CAlfGradientBrush* gradientBrush = CAlfGradientBrush::NewLC( Env() );
- gradientBrush->SetColor( aBackgroundColor, aBackgroundOpacity );
- mediaIdleItem->Brushes()->AppendL( gradientBrush, EAlfHasOwnership );
- CleanupStack::Pop( gradientBrush );
- }
- return mediaIdleItem;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetMediaIdleItemSettings
-// Sets color, opacity and scaling settings to the media idle item
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetMediaIdleItemSettingsL( CAlfTextVisual* aMediaIdleItem, const TDesC& aMediaIdleItemText, const TInt aTextStyleId )
- {
- // Set text of the media idle item
- aMediaIdleItem->SetTextL( aMediaIdleItemText );
- aMediaIdleItem->SetOpacity( TAlfTimedValue( .0f ) );
- aMediaIdleItem->EnableTransformationL( ETrue );
- CAlfTransformation* mediaIdleItemTransformation = &( aMediaIdleItem->Transformation() );
- mediaIdleItemTransformation->LoadIdentity();
-
- // Select text color of the media idle item
- TInt randomColorSelector = AlfUtil::RandomInt( 0, 1 );
- if ( randomColorSelector )
- {
- // Set text color of the media idle item
- aMediaIdleItem->SetColor( iMediaIdlePrimaryColor );
- }
- else
- {
- // Set text color of the media idle item
- aMediaIdleItem->SetColor( iMediaIdleSecondaryColor );
- }
-
- // Set text style of the media idle item
- aMediaIdleItem->SetTextStyle( aTextStyleId );
-
- TSize itemSize( 0, 0 );
- if ( aMediaIdleItem->TextExtents() != itemSize )
- {
- aMediaIdleItem->SetSize( aMediaIdleItem->TextExtents() );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetMediaIdleItemAnimation
-// Sets translating animations to the media idle item
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetMediaIdleItemAnimation( CAlfTextVisual* aMediaIdleItem )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::SetMediaIdleItemAnimation()") ) );
-
- CAlfFlowLayout* mediaIdleFlowLayout = static_cast<CAlfFlowLayout*> ( aMediaIdleItem->Layout() );
- TInt mediaIdleItemCount = mediaIdleFlowLayout->Count();
- TInt mediaIdleItemIndex = mediaIdleFlowLayout->FindVisual( aMediaIdleItem );
-
- TInt mediaIdleItemWidth = aMediaIdleItem->DisplayRect().Width();
- TInt mediaIdleWidth = mediaIdleFlowLayout->Size().IntTarget().iX;
-
- TInt randomTranslateDuration = AlfUtil::RandomInt( KMinMediaIdleItemScrollDurationTime, KMaxMediaIdleItemScrollDurationTime );
- TInt scrollDirection = AlfUtil::RandomInt( 0, 1 );
- TAlfTimedValue targetPositionX;
- if( scrollDirection )
- {
- targetPositionX.SetValueNow( -mediaIdleWidth/2 - mediaIdleItemWidth/2 );
- targetPositionX.SetTarget( mediaIdleWidth/2 + mediaIdleItemWidth/2, randomTranslateDuration );
- }
- else
- {
- targetPositionX.SetValueNow( mediaIdleWidth/2 + mediaIdleItemWidth/2 );
- targetPositionX.SetTarget( -mediaIdleWidth/2 - mediaIdleItemWidth/2, randomTranslateDuration );
- }
-
- Translate( aMediaIdleItem, targetPositionX, TAlfTimedValue(0)); // targetPositionY );
-
- if( mediaIdleItemIndex >= 0 )
- {
- Env().Send( TAlfCustomEventCommand( EMediaIdleItemTransformationEnd,
- this,
- mediaIdleItemIndex ),
- randomTranslateDuration );
- }
- // Set text opacity of the media idle item
- if( !LocalFunctions::fullyVerticallyVisibleRect( *mediaIdleFlowLayout, aMediaIdleItem->DisplayRect() ) )
- {
- aMediaIdleItem->SetOpacity( TAlfTimedValue( 0.0f ) );
- }
- else
- {
- TReal randomOpacity = AlfUtil::RandomReal( KMinOpacity, KMaxOpacity );
- aMediaIdleItem->SetOpacity( TAlfTimedValue( randomOpacity ) );
- }
-
- mediaIdleFlowLayout->UpdateChildrenLayout( KMinMediaIdleItemScrollDurationTime );
-
- // Checking all items, should they fade or not; must be done after UpdateChildrenLayout
- for (TInt i=0; i<mediaIdleItemCount; i++ )
- {
- LocalFunctions::updateItemVisibility( *mediaIdleFlowLayout, i );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::MediaIdleFadeIn
-// Fades in media idle
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::MediaIdleFadeIn( TBool aNow )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::MediaIdleFadeIn(%d)"), aNow ) );
-
- CAlfViewportLayout* mediaIdle = static_cast<CAlfViewportLayout*> ( FindTag( KMediaIdleViewportTag ) );
- if ( mediaIdle )
- {
- if( aNow )
- {
- FadeIn( mediaIdle, 0 );
- }
- else
- {
- FadeIn( mediaIdle, KMediaIdleFadeInDurationTime );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::MediaIdleFadeOut
-// Fades out media idle
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::MediaIdleFadeOut( TBool aNow )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::MediaIdleFadeOut(%d)"), aNow ) );
-
- CAlfViewportLayout* mediaIdle = static_cast<CAlfViewportLayout*> ( FindTag( KMediaIdleViewportTag ) );
- if ( mediaIdle )
- {
- if( aNow )
- {
- FadeOut( mediaIdle, 0 );
- }
- else
- {
- FadeOut( mediaIdle, KMediaIdleFadeOutDurationTime );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::StartMediaIdleL
-// Launches media idle.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::StartMediaIdleL()
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::StartMediaIdleL()") ) );
-
- if ( iMediaIdleState == EStopped )
- {
- Env().CancelCustomCommands( this );
- iMediaIdleState = ERunning;
- AddMediaIdleL( KMaxNumberOfMediaIdleItems );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::AddMediaIdleContentL
-// Adds media idle item text to be used in the media idle
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::AddMediaIdleContentL( const TDesC& aMediaIdleItemText )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::AddMediaIdleContentL('%S')"), &aMediaIdleItemText ) );
-
- if( !iMediaIdleItemArray )
- {
- // Array for media idle items
- iMediaIdleItemArray = new( ELeave ) CDesCArrayFlat( KMediaIdleItemArrayGranularity );
- iMediaIdleItemArray->AppendL( aMediaIdleItemText );
- }
- else
- {
- TInt searchResultIndex = 0;
- if ( iMediaIdleItemArray->Find( aMediaIdleItemText, searchResultIndex ) )
- {
- // text wasn't added earlier
- iMediaIdleItemArray->AppendL( aMediaIdleItemText );
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::GetRandomMediaIdleContentL
-// Retrieves text from randomly chousen media idle item
-// ----------------------------------------------------------------------------
-//
-HBufC* CFMRadioAlfMediaIdle::GetRandomMediaIdleContentL()
- {
- if( !iMediaIdleItemArray )
- {
- return NULL;
- }
- TInt count = iMediaIdleItemArray->MdcaCount();
- if( count > 0 )
- {
- TInt mediaIdleItemIndex;
- mediaIdleItemIndex = AlfUtil::RandomInt( 0, count - 1 );
- TPtrC itemContent( iMediaIdleItemArray->MdcaPoint( mediaIdleItemIndex ) );
- return itemContent.AllocL();
- }
- else
- {
- return NULL;
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::ResetMediaIdleContent
-// Removes all media idle item texts
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::ResetMediaIdleContent()
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::ResetMediaIdleContent()") ) );
-
- delete iPsName;
- iPsName = NULL;
- if( iMediaIdleItemArray )
- {
- if( iMediaIdleItemArray->Count() > 0 )
- {
- iMediaIdleItemArray->Reset();
- iMediaIdleItemArray->Compress();
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::MediaIdleContentCount
-// Returns number of media idle content items
-// ----------------------------------------------------------------------------
-//
-TInt CFMRadioAlfMediaIdle::MediaIdleContentCount() const
- {
- if( iMediaIdleItemArray )
- {
- return iMediaIdleItemArray->Count();
- }
- else
- {
- return 0;
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetPrimaryColor
-// Sets primary color for the media idle
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetPrimaryColor( const TRgb& aColor )
- {
- iMediaIdlePrimaryColor = aColor;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetSecondaryColor
-// Sets secondary color for the media idle
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetSecondaryColor( const TRgb& aColor )
- {
- iMediaIdleSecondaryColor = aColor;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::Translate
-// Translates the visual object with passed arguments
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::Translate( CAlfTextVisual* aTextVisual, const TAlfTimedValue& aX, const TAlfTimedValue& aY )
- {
- if( aTextVisual )
- {
- TRAPD( err, aTextVisual->EnableTransformationL( ETrue ) );
- if( err == KErrNone )
- {
- CAlfTransformation* visualTransformation = &( aTextVisual->Transformation() );
- TAlfTimedValue x(aX);
- x.SetStyle( EAlfTimedValueStyleLinear );
-
- TAlfTimedValue y(aY);
- y.SetStyle( EAlfTimedValueStyleLinear );
-
- visualTransformation->Translate( x, y );
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::LoadTextVisualIdentity
-// Removes all transformations of the visual object such as the scaling and translating.
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::LoadTextVisualIdentity( CAlfTextVisual* aTextVisual )
- {
- if( aTextVisual )
- {
- TRAPD( err, aTextVisual->EnableTransformationL( ETrue ) );
- if( err == KErrNone )
- {
- CAlfTransformation* visualTransformation = &( aTextVisual->Transformation() );
- visualTransformation->LoadIdentity();
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::UpdateLayout
-// Calculates display layout
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::UpdateLayout()
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::UpdateLayout()") ) );
-
- TRect mainPaneRect;
- AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
- TRect displayRect( mainPaneRect.Size() );
-
- TInt lafVarietyMediaIdle = 0;
-
- // Adjust positions of the visual elements
- if ( iOrientation == EPortrait || iOrientation == EOrientationNone )
- {
- lafVarietyMediaIdle = KLAFVarietyRadioIdlePortrait;
- }
- else if ( iOrientation == ELandscape )
- {
- lafVarietyMediaIdle = KLAFVarietyRadioIdleLandscape;
- }
-
- iMediaIdleLayout.LayoutRect( displayRect,
- AknLayoutScalable_Apps::area_fmrd2_visual_pane( lafVarietyMediaIdle ).LayoutLine() );
-
- if ( iIsConstructed )
- {
- CAlfVisual* thirdVisual = FindTag( KMediaIdleAnchorTag );
- if ( thirdVisual )
- {
- CAlfAnchorLayout* mediaIdleAnchor = static_cast<CAlfAnchorLayout*>( thirdVisual );
- SetAbsoluteCornerAnchors( mediaIdleAnchor, 0, iMediaIdleLayout.Rect().iTl, iMediaIdleLayout.Rect().iBr );
- mediaIdleAnchor->UpdateChildrenLayout();
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetModeChangeRequest
-// Sets request for mode change
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetModeChangeRequestL( TMediaIdleMode aRequestedMode )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::SetModeChangeRequestL(%d)"), aRequestedMode ) );
-
- iMediaIdleRequestedMode = aRequestedMode;
- if( iMediaIdleRequestedMode == EBackgroundTextAndMediaIdleItems &&
- Mode() == EOnlyBackgroundText )
- {
- InitializeMediaIdleItemsL( KMaxNumberOfMediaIdleItems );
- AnimateMediaIdleItems();
- SetMode( EBackgroundTextAndMediaIdleItems );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetMode
-// Sets the media idle mode
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetMode( TMediaIdleMode aMode )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::SetMode(%d)"), aMode ) );
-
- iMediaIdleMode = aMode;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::Mode
-// Retrieves the media idle mode
-// ----------------------------------------------------------------------------
-//
-CFMRadioAlfMediaIdle::TMediaIdleMode CFMRadioAlfMediaIdle::Mode()
- {
- return iMediaIdleMode;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::Orientation
-// Return orientation of the display
-// ----------------------------------------------------------------------------
-//
-CFMRadioAlfMediaIdle::TOrientation CFMRadioAlfMediaIdle::Orientation()
- {
- return iOrientation;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::Orientation
-// Set orientation of the display
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetOrientation( TOrientation aOrientation )
- {
- iOrientation = aOrientation;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::OfferEventL
-// From CAlfControl, takes care of alfred event handling.
-// ----------------------------------------------------------------------------
-//
-TBool CFMRadioAlfMediaIdle::OfferEventL( const TAlfEvent& aEvent )
- {
- TBool isHandled = EFalse;
- if( aEvent.IsCustomEvent() )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::OfferEventL(aEvent.CustomParameter()=%d)"), aEvent.CustomParameter() ) );
-
- switch( aEvent.CustomParameter() )
- {
- case EMediaIdleItemTransformationEnd:
- {
- HandleMediaIdleItemTransformationEndEventL( aEvent );
- isHandled = ETrue;
- }
- break;
- case EMediaIdleBackgroundTextScrollEnd:
- {
- HandleBackgroundTextScrollEndEventL( aEvent );
- isHandled = ETrue;
- }
- break;
- case EMediaIdleChangeMode:
- {
- if( Mode() == EBackgroundTextAndMediaIdleItems )
- {
- SetModeChangeRequestL( EOnlyBackgroundText );
- }
- else
- {
- SetModeChangeRequestL( EBackgroundTextAndMediaIdleItems );
- }
- isHandled = ETrue;
- }
- break;
- default:
- break;
- }
- }
- return isHandled;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::HandleMediaIdleItemTransformationEndEventL
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::HandleMediaIdleItemTransformationEndEventL( const TAlfEvent& aEvent )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::HandleMediaIdleItemTransformationEndEventL()") ) );
-
- iItemsTransformationEndEventCounter++;
- if ( iMediaIdleRequestedMode == EOnlyBackgroundText || Mode() == EOnlyBackgroundText )
- {
- CAlfFlowLayout* mediaIdleFlowLayout = static_cast<CAlfFlowLayout*> ( FindTag( KMediaIdleFlowLayoutTag ) );
- if ( mediaIdleFlowLayout )
- {
- TInt mediaIdleItemIndex = aEvent.CustomEventData();
- CAlfTextVisual* mediaIdleItem = static_cast<CAlfTextVisual*> ( &mediaIdleFlowLayout->Visual( mediaIdleItemIndex ) );
- if ( mediaIdleItem )
- {
- mediaIdleItem->SetOpacity( TAlfTimedValue( .0f ) );
- }
-
- if( iItemsTransformationEndEventCounter == mediaIdleFlowLayout->Count() )
- {
- SetMode( EOnlyBackgroundText );
- iItemsTransformationEndEventCounter = 0;
- Env().Send( TAlfCustomEventCommand( EMediaIdleBackgroundTextScrollEnd, this ), 0 );
- }
- }
- }
- else
- {
- CAlfFlowLayout* mediaIdleFlowLayout = static_cast<CAlfFlowLayout*> ( FindTag( KMediaIdleFlowLayoutTag ) );
- if ( mediaIdleFlowLayout )
- {
- HBufC* itemText = GetRandomMediaIdleContentL();
- if( itemText )
- {
- CleanupStack::PushL( itemText );
- TInt mediaIdleItemIndex = aEvent.CustomEventData();
- CAlfTextVisual* mediaIdleItem = static_cast<CAlfTextVisual*> ( &mediaIdleFlowLayout->Visual( mediaIdleItemIndex ) );
- if ( mediaIdleItem && iTextStyleIdArray.Count() > 0 )
- {
- // First hide the media idle item
- mediaIdleItem->SetOpacity( TAlfTimedValue( .0f ) );
- mediaIdleItem->EnableTransformationL( ETrue );
- mediaIdleItem->Transformation().LoadIdentity();
-
- TInt randFontStyleIx = AlfUtil::RandomInt( 0, iTextStyleIdArray.Count() - 1 );
- SetMediaIdleItemSettingsL( mediaIdleItem, *itemText, iTextStyleIdArray[ randFontStyleIx ] );
- SetMediaIdleItemAnimation( mediaIdleItem );
-
- if ( iMediaIdleRequestedMode != EOnlyBackgroundText )
- {
- if( iItemsTransformationEndEventCounter == mediaIdleFlowLayout->Count() )
- {
- Env().Send( TAlfCustomEventCommand( EMediaIdleChangeMode, this ),
- KMaxMediaIdleItemScrollDurationTime * KModeChangingFactor );
- iItemsTransformationEndEventCounter = 0;
- }
- }
- }
- CleanupStack::PopAndDestroy( itemText );
- }
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::HandleBackgroundTextScrollEndEventL
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::HandleBackgroundTextScrollEndEventL( const TAlfEvent& /*aEvent*/ )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::HandleBackgroundTextScrollEndEventL()") ) );
-
- CAlfViewportLayout* mediaIdleViewport = static_cast<CAlfViewportLayout*> ( FindTag( KMediaIdleViewportTag ) );
- if( mediaIdleViewport )
- {
- CAlfTextVisual* backgroundText = static_cast<CAlfTextVisual*> ( mediaIdleViewport->FindTag( KMediaIdleBackgroundTextTag ) );
- if( backgroundText )
- {
- backgroundText->SetOpacity( TAlfTimedValue( .0f ) );
-
- if ( iMediaIdleRequestedMode == EOnlyBackgroundText && Mode() == EBackgroundTextAndMediaIdleItems )
- {
- }
- else
- {
- if( iMediaIdleRequestedMode == EOnlyBackgroundText &&
- Mode() == EOnlyBackgroundText )
- {
- Env().CancelCustomCommands( this );
- Env().Send( TAlfCustomEventCommand( EMediaIdleChangeMode, this ),
- KMediaIdleBackgroundTextSideToSideTransitionDurationTime );
- }
- backgroundText->EnableTransformationL( ETrue );
- backgroundText->Transformation().LoadIdentity();
- HBufC* itemText = GetRandomMediaIdleContentL();
- if( itemText )
- {
- CleanupStack::PushL( itemText );
- SetMediaIdleItemSettingsL( backgroundText, *itemText, iMediaIdleItemBackgroundTextStyleId );
- CleanupStack::PopAndDestroy( itemText );
- }
- backgroundText->SetOpacity( TAlfTimedValue( KMediaIdleBackgroundTextOpacity ) );
- SetScrollingToBackgroundText( backgroundText,
- KMediaIdleBackgroundTextSideToSideTransitionDurationTime,
- EMediaIdleBackgroundTextScrollEnd );
- }
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetAbsoluteCornerAnchors
-// Sets absolute rect of the anchor by top left and bottom right points.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition )
- {
- if ( aAnchor )
- {
- // Set top/left anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeTopLeft,
- TAlfXYMetric( TAlfMetric( aTopLeftPosition.iX ), TAlfMetric( aTopLeftPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
-
-
- // Set bottom/right anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeBottomRight,
- TAlfXYMetric( TAlfMetric( aBottomRightPosition.iX ), TAlfMetric( aBottomRightPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetAbsoluteCornerAnchors
-// Sets absolute rect of the anchor by top left point and size of the rect
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor, TInt aOrdinal, const TPoint& aTopLeftPosition, const TSize& aSize )
- {
- if( aAnchor )
- {
- // set top left corner position
- aAnchor->SetAnchor( EAlfAnchorTopLeft, aOrdinal,
- EAlfAnchorOriginLeft,
- EAlfAnchorOriginTop,
- EAlfAnchorMetricAbsolute,
- EAlfAnchorMetricAbsolute,
- TAlfTimedPoint( aTopLeftPosition.iX, aTopLeftPosition.iY ) );
- // .. and set the bottom right corner also to fix the size
- aAnchor->SetAnchor( EAlfAnchorBottomRight, aOrdinal,
- EAlfAnchorOriginLeft,
- EAlfAnchorOriginTop,
- EAlfAnchorMetricAbsolute,
- EAlfAnchorMetricAbsolute,
- TAlfTimedPoint( aTopLeftPosition.iX + aSize.iWidth, aTopLeftPosition.iY + aSize.iHeight ) );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetRelativeCornerAnchors
-// Sets relative rect of the anchor by top left and bottom right points.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor, TInt aOrdinal, const TAlfRealPoint& aTopLeftPosition, const TAlfRealPoint& aBottomRightPosition )
- {
- if( aAnchor )
- {
- aAnchor->SetRelativeAnchorRect( aOrdinal,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aTopLeftPosition,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aBottomRightPosition );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetRelativeCornerAnchors
-// Sets relative rect of the anchor by top left point and size of the rect
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor, TInt aOrdinal, const TAlfRealPoint& aTopLeftPosition, const TAlfRealSize& aSize )
- {
- if( aAnchor )
- {
- aAnchor->SetRelativeAnchorRect( aOrdinal,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aTopLeftPosition,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aTopLeftPosition + TAlfRealPoint( aSize.iWidth, aSize.iHeight ) );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::SetScrollingToBackgroundText
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::SetScrollingToBackgroundText( CAlfTextVisual* aVisual, TInt aTransitionTime, TMediaIdleCustomEvent aEventAfterScrollingEnd )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::SetScrollingToBackgroundText(aTransitionTime=%d)"), aTransitionTime ) );
-
- CAlfViewportLayout* mediaIdle = static_cast<CAlfViewportLayout*> ( aVisual->Layout() );
- TInt mediaIdleItemWidth = aVisual->DisplayRect().Width();
- TInt mediaIdleItemHeight = aVisual->DisplayRect().Height();
- TInt mediaIdleWidth = mediaIdle->Size().IntTarget().iX;
-
- TAlfTimedValue targetPositionX;
- if( iBackgroundTextScrollDirection == EScrollRightToLeft )
- {
- targetPositionX.SetValueNow( -mediaIdleItemWidth );
- targetPositionX.SetTarget( mediaIdleWidth, aTransitionTime );
- iBackgroundTextScrollDirection = EScrollLeftToRight;
- }
- else
- {
- targetPositionX.SetValueNow( mediaIdleWidth );
- targetPositionX.SetTarget( -mediaIdleItemWidth, aTransitionTime );
- iBackgroundTextScrollDirection = EScrollRightToLeft;
- }
- Translate( aVisual, targetPositionX, TAlfTimedValue( -30 ) );
- Env().Send( TAlfCustomEventCommand( aEventAfterScrollingEnd, this ),
- aTransitionTime + KMediaIdleBackgroundTextScrollInterval );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::ScrollToLeft
-// Sets and starts scrolling animation to CAlfTextVisual.
-// The visual object is scrolled from current position to
-// left side of the display
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::ScrollToLeft( CAlfTextVisual* aVisual ) const
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::ScrollToLeft(0x%x)"), aVisual ) );
-
- if( aVisual )
- {
- TInt visualWidth = aVisual->DisplayRect().Width();
- TInt textWidth = aVisual->TextExtents().iWidth;
- TInt scrollValue = visualWidth;
- if( textWidth > visualWidth )
- {
- scrollValue += textWidth - visualWidth;
- }
- TAlfTimedPoint timedPosition = aVisual->Pos();
- TAlfRealPoint positionZero( 0, timedPosition.iY.ValueNow() );
- TAlfRealPoint positionLeft( - ( scrollValue ), timedPosition.iY.ValueNow() );
- aVisual->SetPos( positionZero );
- aVisual->SetPos( positionLeft, 1000 );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::ScrollToRight
-// Sets and starts scrolling animation to CAlfTextVisual.
-// The visual object is scrolled from current position to
-// right side of the display
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::ScrollToRight( CAlfTextVisual* aVisual ) const
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::ScrollToRight(0x%x)"), aVisual ) );
-
- TInt visualWidth = aVisual->DisplayRect().Width();
- TInt textWidth = aVisual->TextExtents().iWidth;
- TInt scrollValue = visualWidth;
- if( textWidth > visualWidth )
- {
- scrollValue += textWidth - visualWidth;
- }
- TAlfTimedPoint timedPosition = aVisual->Pos();
- TAlfRealPoint positionZero( 0, timedPosition.iY.ValueNow() );
- TAlfRealPoint positionRight( scrollValue, timedPosition.iY.ValueNow() );
- aVisual->SetPos( positionZero );
- aVisual->SetPos( positionRight, 1000 );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::FadeIn
-// Sets fade-in animation to the CAlfVisual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::FadeIn( CAlfVisual* aVisual, TInt aTime, TReal aOpacity ) const
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::FadeIn(aVisual=0x%x, aTime=%d)"), aVisual, aTime ) );
-
- TAlfTimedValue opacity;
- opacity.SetValueNow( 0.0f ); // immediate change
- opacity.SetTarget( aOpacity, aTime ); // and smooth target
- aVisual->SetOpacity( opacity );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::FadeOut
-// Sets fade-out animation to the CAlfVisual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::FadeOut( CAlfVisual* aVisual, TInt aTime, TReal aOpacity ) const
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::FadeOut(aVisual=0x%x, aTime=%d)"), aVisual, aTime ) );
- TAlfTimedValue opacity;
- opacity.SetTarget( aOpacity, aTime );
- aVisual->SetOpacity( opacity );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::AddPsNameToMediaIdleL
-// Adds PS name to the media idle item array
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::AddPsNameToMediaIdleL( const TDesC& aPsName )
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::AddPsNameToMediaIdleL('%S')"), &aPsName ) );
-
- if ( !iMediaIdleItemArray )
- {
- // Array for media idle items
- iMediaIdleItemArray = new ( ELeave ) CDesCArrayFlat( KMediaIdleItemArrayGranularity );
- iPsName = aPsName.AllocL();
- iMediaIdleItemArray->AppendL( *iPsName );
- return;
- }
- else if ( !iPsName )
- {
- // PS name is added for the first time or media idle item array is reseted
- if ( iMediaIdleItemArray->Count() < KFMRadioMaxNumberOfMediaIdleContentItem )
- {
- iPsName = aPsName.AllocL();
- iMediaIdleItemArray->AppendL( *iPsName );
- }
- return;
- }
-
- TInt returnValue;
- TInt searchResultIndex;
-
- returnValue = iMediaIdleItemArray->Find( *iPsName, searchResultIndex );
-
- if ( returnValue == 0 )
- {
- // if old PS name is found, replace it with new name
- iMediaIdleItemArray->InsertL( searchResultIndex, aPsName );
- iMediaIdleItemArray->Delete( searchResultIndex + 1 );
- }
-
- delete iPsName;
- iPsName = NULL;
- iPsName = aPsName.AllocL();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::StopAndFadeOutMediaIdle
-// stops media idle and clears out animation and background image
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::StopAndFadeOutMediaIdle()
- {
- FTRACE( FPrint( _L("CFMRadioAlfMediaIdle::StopAndFadeOutMediaIdle() - iMediaIdleState was %d"), iMediaIdleState ) );
-
- if ( iMediaIdleState != EStopped )
- {
- Env().CancelCustomCommands( this );
- iMediaIdleState = EStopped;
- MediaIdleFadeOut();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::Show
-// from MFMRadioIdleControlInterface
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::Show()
- {
- TRAP_IGNORE( StartMediaIdleL() )
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::Hide
-// from MFMRadioIdleControlInterface
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::Hide()
- {
- StopAndFadeOutMediaIdle();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::Deactivate
-// from MFMRadioIdleControlInterface
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfMediaIdle::Deactivate()
- {
- StopAndFadeOutMediaIdle();
- }
-// End of File
--- a/fmradio/fmradio/src/fmradioalfrdsviewer.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,500 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioAlfIndicator
-*
-*/
-
-
-// INCLUDE FILES
-
-#include <e32cmn.h>
-#include <alf/alfenv.h>
-#include <alf/alftextvisual.h>
-#include <alf/alfevent.h>
-#include <alf/alftransformation.h>
-#include <alf/alftextstyle.h>
-
-// brushes
-#include <alf/alfgradientbrush.h>
-#include <alf/alfbrusharray.h>
-#include <alf/alfborderbrush.h>
-#include <alf/alfimagebrush.h>
-
-#include "debug.h"
-#include "fmradioalfrdsviewer.h"
-#include "fmradioalfrdsviewobserver.h"
-// CONSTANTS
-
-const TInt KIndicatorFadeInDefaultDurationTime = 500;
-const TInt KIndicatorFadeOutDefaultDurationTime = 500;
-const TInt KRDSDisplayPeriod = 60000; //milliseconds = 1 min.
-const TReal KDefaultOpacityInVisibleState = 1.0f;
-const TReal KDefaultOpacityInHiddenState = 0.0f;
-const TReal KRelativeFontSize = 0.10;
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfIndicator::NewL
-// Two-phase constructor of CFMRadioAlfIndicator
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfRDSViewer* CFMRadioAlfRDSViewer::NewL( CAlfEnv& aEnv )
- {
- CFMRadioAlfRDSViewer* self = new (ELeave) CFMRadioAlfRDSViewer( );
- CleanupStack::PushL(self);
- self->ConstructL( aEnv );
- CleanupStack::Pop(self);
- return self;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::CFMRadioAlfRDSViewer
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioAlfRDSViewer::CFMRadioAlfRDSViewer()
-: iTextStyleId( KErrNotFound ),
- iOpacityInVisibleState( KDefaultOpacityInVisibleState ),
- iOpacityInHiddenState( KDefaultOpacityInHiddenState ),
- iIsRdsTextVisible( EFalse ),
- iRdsTextVisibilityTimerCompleted( ETrue )
- {
- //No implementation needed
- }
-
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetObserver
-// Sets observer
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetObserver( MFMRadioAlfRdsViewObserver* aObserver )
- {
- FTRACE( FPrint( _L( "CFMRadioAlfRDSViewer::SetObserver" ) ) );
- TInt index = iObservers.FindInAddressOrder( aObserver );
- if ( index == KErrNotFound )
- {
- iObservers.InsertInAddressOrder( aObserver );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::RemoveObserver
-// Removes observer
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::RemoveObserver( MFMRadioAlfRdsViewObserver* aObserver )
- {
- FTRACE( FPrint( _L( "CFMRadioAlfRDSViewer::RemoveObserver" ) ) );
- TInt index = iObservers.FindInAddressOrder( aObserver );
-
- if ( index >= 0 )
- {
- iObservers.Remove( index );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::ConstructL
-// Symbian 2nd phase constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::ConstructL( CAlfEnv& aEnv )
- {
- FTRACE( FPrint( _L( "CFMRadioAlfRDSViewer::ConstructL" ) ) );
- CAlfControl::ConstructL( aEnv );
- AddIndicatorLayerL();
- Hide();
- }
-
-// ---------------------------------------------------------------------------
-// ~CFMRadioAlfRDSViewer::~CFMRadioAlfRDSViewer
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfRDSViewer::~CFMRadioAlfRDSViewer()
- {
- FTRACE( FPrint( _L( "CFMRadioAlfRDSViewer::Destructor" ) ) );
- Env().CancelCustomCommands( this );
- if( iTextStyleId != KErrNotFound )
- {
- CAlfTextStyleManager& manager = Env().TextStyleManager();
- manager.DeleteTextStyle( iTextStyleId );
- }
- iRadioText.Close();
- iObservers.Close();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::OfferEventL
-// From CAlfControl, takes care of alfred event handling.
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAlfRDSViewer::OfferEventL( const TAlfEvent& aEvent )
- {
- FTRACE( FPrint( _L( "CFMRadioAlfRDSViewer::OfferEventL" ) ) );
- TBool eventHandled = EFalse;
-
- if ( aEvent.IsCustomEvent() )
- {
- switch( aEvent.CustomParameter() )
- {
- case EFadeInCompleted:
- {
- eventHandled = ETrue;
- Env().Send( TAlfCustomEventCommand( ERDSDisplayTimerCompleted, this ), KRDSDisplayPeriod );
- break;
- }
- case EOldTextFadeEffectCompleted:
- {
- eventHandled = ETrue;
- iText->SetTextL( iRadioText );
- // fade in the new radio text
- Fade( iText, KIndicatorFadeInDefaultDurationTime, iOpacityInVisibleState );
- Env().Send( TAlfCustomEventCommand( EFadeInCompleted, this ), KIndicatorFadeOutDefaultDurationTime );
- break;
- }
- case ERDSDisplayTimerCompleted:
- {
- eventHandled = ETrue;
- iRdsTextVisibilityTimerCompleted = ETrue;
- iIsRdsTextVisible = EFalse;
- Fade( iText, KIndicatorFadeOutDefaultDurationTime, iOpacityInHiddenState );
- for ( TInt i = 0 ; i < iObservers.Count() ; i++ )
- {
- iObservers[i]->NotifyRdsTextTimerCompletion();
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- return eventHandled;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetRect
-// Sets the indicator rectangle.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetRect( const TRect& aRect )
- {
- iRect = aRect;
- TRAP_IGNORE( SetTextStyleL() );
- if( iIndicatorTextAnchor )
- {
- SetAbsoluteCornerAnchors( iIndicatorTextAnchor, 0, iRect.iTl, iRect.iBr );
- iIndicatorTextAnchor->UpdateChildrenLayout();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::AddIndicatorLayerL
-// Creates the needed drawing layers and visual objects
-// for the indicator.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::AddIndicatorLayerL()
- {
- // Create an anchor for the indicator layout
- iIndicatorTextAnchor = CAlfAnchorLayout::AddNewL( *this );
-
- // Create visual object for the indicator
- iText = CAlfTextVisual::AddNewL( *this, iIndicatorTextAnchor );
- iText->SetColor( iTextColor );
- iText->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
- iText->SetWrapping( CAlfTextVisual::ELineWrapBreak );
- iText->SetClipping( ETrue );
-
- // shadow enablers
- //iText->EnableDropShadowL( ETrue );
- //iText->EnableShadow( ETrue );
-
- iText->EnableBrushesL();
-
- /*CAlfGradientBrush* gradientBrush = CAlfGradientBrush::NewLC( Env() );
- gradientBrush->SetColor( KRgbBlack, 0.7f );
- iText->Brushes()->AppendL( gradientBrush, EAlfHasOwnership );
- CleanupStack::Pop( gradientBrush );
- */
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetTextStyleL
-// Creates the text style for indicator
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetTextStyleL()
- {
- CAlfTextStyleManager& manager = Env().TextStyleManager();
- CAlfTextStyle* textStyle = NULL;
- if( iTextStyleId == KErrNotFound )
- {
- iTextStyleId = manager.CreatePlatformTextStyleL( EAlfTextStyleNormal );
- }
-
- textStyle = manager.TextStyle( iTextStyleId );
- // 5 lines
- textStyle->SetTextSizeInPixels( ( iRect.Height()*KRelativeFontSize ), ETrue );
- //textStyle->SetTextPaneHeightInPixels(iRect.Height(), ETrue );
- iText->SetTextStyle( iTextStyleId );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetTextColor
-// Changes indicator text color.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetTextColor( const TRgb& aTextColor )
- {
- iTextColor = aTextColor;
- if( iText )
- {
- iText->SetColor( aTextColor );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetTextL
-// Sets the indicator text.
-// ---------------------------------------------------------
-//
-TBool CFMRadioAlfRDSViewer::SetTextL( const TDesC& aText )
- {
- TBool result = EFalse;
- if ( aText.Length() > 0 )
- {
- if ( iRadioText.Compare( aText ) != 0 )
- {
- iRdsTextVisibilityTimerCompleted = EFalse;
- Env().CancelCustomCommands( this, ERDSDisplayTimerCompleted );
-
- iRadioText.Close();
- iRadioText.Create( aText );
-
- if ( !iIsRdsTextVisible )
- {
- iText->SetTextL( aText );
- }
- else
- {
- // fade out the old radio text
- Fade( iText, KIndicatorFadeOutDefaultDurationTime, iOpacityInHiddenState );
- Env().Send( TAlfCustomEventCommand( EOldTextFadeEffectCompleted, this ), KIndicatorFadeOutDefaultDurationTime );
- }
- result = ETrue;
- }
- }
- return result;
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfRDSViewer::Show
-// Shows the indicator with the defined opacity value.
-// ---------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::Show()
- {
- if ( !iIsRdsTextVisible )
- {
- iIsRdsTextVisible = ETrue;
- Fade( iText, KIndicatorFadeInDefaultDurationTime, iOpacityInVisibleState );
- Env().Send( TAlfCustomEventCommand( EFadeInCompleted, this ), KIndicatorFadeOutDefaultDurationTime );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfRDSViewer::Hide
-// Hides the indicator with the defined opacity value.
-// ---------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::Hide()
- {
- if ( iIsRdsTextVisible )
- {
- // cancel timer event
- Env().CancelCustomCommands( this, ERDSDisplayTimerCompleted );
- iIsRdsTextVisible = EFalse;
- Fade( iText, KIndicatorFadeOutDefaultDurationTime, iOpacityInHiddenState );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioAlfRDSViewer::Reset
-// Cancel events and flush radio text cache
-// ---------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::Reset()
- {
- FTRACE( FPrint( _L( "CFMRadioAlfRDSViewer::Reset" ) ) );
- iRdsTextVisibilityTimerCompleted = ETrue;
- iRadioText.Close();
- Env().CancelCustomCommands( this );
- }
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetOpacityInVisibleState
-// Sets the indicator opacity in visible state.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetOpacityInVisibleState( const TReal aOpacity )
- {
- iOpacityInVisibleState = aOpacity;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetOpacityInHiddenState
-// Sets the indicator opacity in hidden state.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetOpacityInHiddenState( const TReal aOpacity )
- {
- iOpacityInHiddenState = aOpacity;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetAbsoluteCornerAnchors
-// Sets absolute rect of the anchor by top left and bottom right points.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition )
- {
- if ( aAnchor )
- {
- // Set top/left anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeTopLeft,
- TAlfXYMetric( TAlfMetric( aTopLeftPosition.iX ), TAlfMetric( aTopLeftPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
-
-
- // Set bottom/right anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeBottomRight,
- TAlfXYMetric( TAlfMetric( aBottomRightPosition.iX ), TAlfMetric( aBottomRightPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetAbsoluteCornerAnchors
-// Sets absolute rect of the anchor by top left point and size of the rect
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TSize& aSize )
- {
- if( aAnchor )
- {
- // set top left corner position
- aAnchor->SetAnchor( EAlfAnchorTopLeft, aOrdinal,
- EAlfAnchorOriginLeft,
- EAlfAnchorOriginTop,
- EAlfAnchorMetricAbsolute,
- EAlfAnchorMetricAbsolute,
- TAlfTimedPoint( aTopLeftPosition.iX, aTopLeftPosition.iY ) );
- // .. and set the bottom right corner also to fix the size
- aAnchor->SetAnchor( EAlfAnchorBottomRight, aOrdinal,
- EAlfAnchorOriginLeft,
- EAlfAnchorOriginTop,
- EAlfAnchorMetricAbsolute,
- EAlfAnchorMetricAbsolute,
- TAlfTimedPoint( aTopLeftPosition.iX + aSize.iWidth, aTopLeftPosition.iY + aSize.iHeight ) );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetRelativeCornerAnchors
-// Sets relative rect of the anchor by top left and bottom right points.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealPoint& aBottomRightPosition )
- {
- if( aAnchor )
- {
- aAnchor->SetRelativeAnchorRect( aOrdinal,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aTopLeftPosition,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aBottomRightPosition );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::SetRelativeCornerAnchors
-// Sets relative rect of the anchor by top left point and size of the rect
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TAlfRealPoint& aTopLeftPosition,
- const TAlfRealSize& aSize )
- {
- if( aAnchor )
- {
- aAnchor->SetRelativeAnchorRect( aOrdinal,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aTopLeftPosition,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop, aTopLeftPosition + TAlfRealPoint( aSize.iWidth, aSize.iHeight ) );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::Fade
-// Sets the fading animation to the CAlfVisual object.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::Fade( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity ) const
- {
- TAlfTimedValue opacity;
- opacity.SetTarget( aOpacity, aFadingTime ); // and smooth target
- aVisual->SetOpacity( opacity );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::IsShowingRdsTextArea
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAlfRDSViewer::IsShowingRdsTextArea() const
- {
- return iIsRdsTextVisible;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::Deactivate
-// from MFMRadioIdleControlInterface
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfRDSViewer::Deactivate()
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfRDSViewer::IsRdsTextVisibilityTimerCompleted
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAlfRDSViewer::IsRdsTextVisibilityTimerCompleted()
- {
- return iRdsTextVisibilityTimerCompleted;
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradioalfvisualizer.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1181 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioAlfVisualizer
-*
-*/
-
-
-// INCLUDE FILES
-
-#include <aknlayoutscalable_apps.cdl.h>
-#include <alf/alfbatchbuffer.h>
-#include <alf/alfcontrolgroup.h>
-#include <alf/alfenv.h>
-#include <alf/alftextvisual.h>
-#include <alf/alfevent.h>
-#include <alf/alftransformation.h>
-#include <alf/alfgradientbrush.h>
-#include <alf/alfbrusharray.h>
-#include <alf/alfborderbrush.h>
-#include <alf/alfimagevisual.h>
-#include <alf/alfimagebrush.h>
-#include <alf/alftexturemanager.h>
-#include <alf/alfdisplay.h>
-#include <alf/alfviewportlayout.h>
-#include <alf/alfdecklayout.h>
-#include <alf/alfutil.h>
-#include <alf/alftextstyle.h>
-#include <AknsItemID.h>
-#include <e32math.h>
-#include <eikenv.h>
-#include <fmradio.mbg>
-#include <aknview.h>
-#include <aknViewAppUi.h>
-#include <AknVolumePopup.h>
-
-#include "fmradioalfvisualizer.h"
-#include "fmradioappui.h"
-#include "fmradioalfbitmapanimation.h"
-#include "fmradio.hrh"
-#include "debug.h"
-
-using namespace GestureHelper;
-
-// CONSTANTS
-const TInt KFMRadioStationInformationFadeDurationTime = 200;
-const TInt KFMRadioStationInformationScrollDurationTime = 300;
-// The delay, in microseconds, after which long keypress is activated. Taken from S60 UI style guide
-const TInt KFMRadioRockerLongPressDelay = 600000;
-
-// values from fmradio LAF document
-const TInt KLAFVarietyTuningAnimationPortrait = 7;
-const TInt KLAFVarietyTuningAnimationLandscape = 7;
-const TInt KLAFVarietyTuningTextPortrait = 7;
-const TInt KLAFVarietyTuningTextLandscape = 7;
-const TInt KLAFVarietyInfoPaneFirstLinePortrait = 0;
-const TInt KLAFVarietyInfoPaneFirstLineLandscape = 1;
-const TInt KLAFVarietyInfoPaneSecondLinePortrait = 0;
-const TInt KLAFVarietyInfoPaneSecondLineLandscape = 1;
-const TInt KLAFVarietyStationInfoPanePortrait = 0;
-const TInt KLAFVarietyStationInfoPaneLandscape = 1;
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::NewL
-// Two-phase constructor of CFMRadioAlfVisualizer
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfVisualizer* CFMRadioAlfVisualizer::NewL( CAlfEnv& aEnv )
- {
- CFMRadioAlfVisualizer* self = new (ELeave) CFMRadioAlfVisualizer( );
- CleanupStack::PushL(self);
- self->ConstructL( aEnv );
- CleanupStack::Pop(self);
- return self;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::CFMRadioAlfVisualizer
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioAlfVisualizer::CFMRadioAlfVisualizer( )
-: iOrientation ( EOrientationNone )
- {
- //No implementation needed
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ConstructL
-// Symbian 2nd phase constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ConstructL( CAlfEnv& aEnv )
- {
- CGestureControl::ConstructL( *this, aEnv, aEnv.PrimaryDisplay(), KFMRadioVisualizerGestureControlGroupId );
-
- CCoeEnv* coeEnv = CCoeEnv::Static();
- iAppUi = static_cast<CFMRadioAppUi*>( coeEnv->AppUi() );
-
- SetDisplayStyle( EFMRadioDisplayNoDisplay );
- AddInformationLayersL();
-
- iBmpAnimation = CFMRadioAlfBitmapAnimation::NewL( aEnv );
- CAlfControlGroup& group = aEnv.ControlGroup( KFMRadioVisualControlsGroupId );
- group.AppendL( iBmpAnimation );
-
- UpdateLayout();
-
- if ( AknLayoutUtils::PenEnabled() )
- {
- iLongPressTimer = CPeriodic::NewL( CActive::EPriorityStandard );
- }
- }
-
-// ---------------------------------------------------------------------------
-// ~CFMRadioAlfVisualizer::~CFMRadioAlfVisualizer
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioAlfVisualizer::~CFMRadioAlfVisualizer()
- {
- CAlfTextStyleManager& manager = Env().TextStyleManager();
- manager.DeleteTextStyle( iFirstLineTextStyleId );
- manager.DeleteTextStyle( iSecondLineTextStyleId );
- manager.DeleteTextStyle( iTuningTextStyleId );
-
- delete iLongPressTimer;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::UpdateLayout
-// Calculates display layout
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::UpdateLayout()
- {
- TRect mainPaneRect;
- AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
- TRect displayRect( mainPaneRect.Size() );
-
- TInt lafVarietyAnimation = 0;
- TInt lafVarietyTuningText = 0;
- TInt lafVarietyStationInfoPane = 0;
- TInt lafVarietyFirstLineText = 0;
- TInt lafVarietySecondLineText = 0;
-
- TFMRadioDisplayStyle displayStyle = DisplayStyle();
-
- // Adjust positions of the visual elements
- if ( iOrientation == EPortrait || iOrientation == EOrientationNone )
- {
- lafVarietyAnimation = KLAFVarietyTuningAnimationPortrait;
- lafVarietyTuningText = KLAFVarietyTuningTextPortrait;
- lafVarietyStationInfoPane = KLAFVarietyStationInfoPanePortrait;
- lafVarietyFirstLineText = KLAFVarietyInfoPaneFirstLinePortrait;
- lafVarietySecondLineText = KLAFVarietyInfoPaneSecondLinePortrait;
- }
- else if ( iOrientation == ELandscape )
- {
- lafVarietyAnimation = KLAFVarietyTuningAnimationLandscape;
- lafVarietyTuningText = KLAFVarietyTuningTextLandscape;
- lafVarietyStationInfoPane = KLAFVarietyStationInfoPaneLandscape;
- lafVarietyFirstLineText = KLAFVarietyInfoPaneFirstLineLandscape;
- lafVarietySecondLineText = KLAFVarietyInfoPaneSecondLineLandscape;
- }
-
- iStationInformationLayout.LayoutRect( displayRect,
- AknLayoutScalable_Apps::area_fmrd2_info_pane( lafVarietyStationInfoPane ).LayoutLine() );
-
- if ( EFMRadioDisplayDoubleLine == displayStyle )
- {
- iFirstLineLayout.LayoutText( iStationInformationLayout.Rect(),
- AknLayoutScalable_Apps::area_fmrd2_info_pane_t1( lafVarietyFirstLineText ).LayoutLine() );
- }
- else // use bigger area for first line because it is the only visible line
- {
- iFirstLineLayout.LayoutText( iStationInformationLayout.Rect(),
- AknLayoutScalable_Apps::area_fmrd2_info_pane_t3( lafVarietyFirstLineText ).LayoutLine() );
- }
-
- iSecondLineLayout.LayoutText( iStationInformationLayout.Rect(),
- AknLayoutScalable_Apps::area_fmrd2_info_pane_t2( lafVarietySecondLineText ).LayoutLine() );
-
- iTuningTextLayout.LayoutText( iStationInformationLayout.Rect(),
- AknLayoutScalable_Apps::area_fmrd2_info_pane_t4( lafVarietyTuningText ).LayoutLine() );
-
- iTuningAnimationLayout.LayoutRect( iStationInformationLayout.Rect(),
- AknLayoutScalable_Apps::area_fmrd2_info_pane_g1( lafVarietyAnimation ) );
-
- CAlfTextStyleManager& manager = Env().TextStyleManager();
- CAlfTextStyle* style = NULL;
- style = manager.TextStyle( iFirstLineTextStyleId );
- if ( style->TextSizeInPixels() != iFirstLineLayout.TextRect().Height() )
- { // Update text size according to height of layout in LS & PT modes
- style->SetTextSizeInPixels( iFirstLineLayout.TextRect().Height(), ETrue );
- iFirstLineVisualText->SetTextStyle( iFirstLineTextStyleId );
- }
-
- style = manager.TextStyle( iSecondLineTextStyleId );
- if ( style->TextSizeInPixels() != iSecondLineLayout.TextRect().Height() )
- { // Update text size according to height of layout in LS & PT modes
- style->SetTextSizeInPixels( iSecondLineLayout.TextRect().Height(), ETrue );
- iSecondLineVisualText->SetTextStyle( iSecondLineTextStyleId );
- }
-
- style = manager.TextStyle( iTuningTextStyleId );
- if ( style->TextSizeInPixels() != iTuningTextLayout.TextRect().Height() )
- { // Update text size according to height of layout in LS & PT modes
- style->SetTextSizeInPixels( iTuningTextLayout.TextRect().Height(), ETrue );
- iTuningVisualText->SetTextStyle( iTuningTextStyleId );
- }
-
- SetAbsoluteCornerAnchors( iStationInformationAnchorLayout, 0, iFirstLineLayout.TextRect().iTl, iFirstLineLayout.TextRect().iBr );
- SetAbsoluteCornerAnchors( iStationInformationAnchorLayout, 1, iSecondLineLayout.TextRect().iTl, iSecondLineLayout.TextRect().iBr );
- SetAbsoluteCornerAnchors( iStationInformationAnchorLayout, 2, iTuningTextLayout.TextRect().iTl, iTuningTextLayout.TextRect().iBr );
- iStationInformationAnchorLayout->UpdateChildrenLayout();
- iBmpAnimation->SetRect( iTuningAnimationLayout.Rect() );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::Orientation
-// Return orientation of the display
-// ----------------------------------------------------------------------------
-//
-TDisplayOrientation CFMRadioAlfVisualizer::Orientation()
- {
- return iOrientation;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::Orientation
-// Set orientation of the display
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::SetOrientation( TDisplayOrientation aOrientation )
- {
- iOrientation = aOrientation;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::SetMirrored
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::SetMirrored( const TBool aIsMirrored )
- {
- iMirrored = aIsMirrored;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::IsMirroredL
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAlfVisualizer::IsMirrored() const
- {
- return iMirrored;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::AddInformationLayersL
-// Creates the needed drawing layers and visual objects
-// for visualiazing the station information.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::AddInformationLayersL()
- {
- CreateTextStylesForStationInformationL();
- // Create an anchor for layout of texts
- iStationInformationAnchorLayout = CAlfAnchorLayout::AddNewL( *this );
-
- // Create anchor to be used when preset channel is changed
- iStationInformationTempAnchorLayout = CAlfAnchorLayout::AddNewL( *this );
- iStationInformationTempAnchorLayout->SetOpacity( TAlfTimedValue( 0.0 ) );
-
- for ( TInt i = 0; i < 3; i++ )
- {
- CAlfTextVisual* tempTextVisual = CAlfTextVisual::AddNewL( *this, iStationInformationTempAnchorLayout );
- tempTextVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
- tempTextVisual->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
- }
-
- // Create visual object for the station name
- iFirstLineVisualText = CAlfTextVisual::AddNewL( *this, iStationInformationAnchorLayout );
- iFirstLineVisualText->SetTextStyle( iFirstLineTextStyleId );
- iFirstLineVisualText->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
- iFirstLineVisualText->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
- // Create visual object for frequency information
- iSecondLineVisualText = CAlfTextVisual::AddNewL( *this, iStationInformationAnchorLayout );
- iSecondLineVisualText->SetTextStyle( iSecondLineTextStyleId );
- iSecondLineVisualText->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
- iSecondLineVisualText->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
- // Visual for tuning text
- iTuningVisualText = CAlfTextVisual::AddNewL( *this, iStationInformationAnchorLayout );
- iTuningVisualText->SetTextStyle( iTuningTextStyleId );
- iTuningVisualText->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
- iTuningVisualText->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::CreateTextStylesForStationInformationL
-// Creates the text styles to be used by station information visualiazing
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::CreateTextStylesForStationInformationL()
- {
- CAlfTextStyleManager& manager = Env().TextStyleManager();
-
- iFirstLineTextStyleId = manager.CreatePlatformTextStyleL(
- EAknLogicalFontPrimaryFont,
- EAlfTextStyleNormal );
-
- iSecondLineTextStyleId = manager.CreatePlatformTextStyleL(
- EAknLogicalFontSecondaryFont,
- EAlfTextStyleNormal );
-
- iTuningTextStyleId = manager.CreatePlatformTextStyleL(
- EAknLogicalFontSecondaryFont,
- EAlfTextStyleNormal );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::SetVisualText
-// Sets text to the defined station information visual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::SetVisualTextL( TStationInformationVisual aVisual, const TDesC& aText )
- {
- if( aVisual & EFirstLineTextVisual )
- {
- iFirstLineVisualText->SetTextL( aText );
- iFirstLineVisualText->SetSize( iFirstLineVisualText->TextExtents() );
- }
- if( aVisual & ESecondLineTextVisual )
- {
- iSecondLineVisualText->SetTextL( aText );
- iSecondLineVisualText->SetSize( iSecondLineVisualText->TextExtents() );
- }
- if ( aVisual & ETuningTextVisual )
- {
- iTuningVisualText->SetTextL( aText );
- iTuningVisualText->SetSize( iTuningVisualText->TextExtents() );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ShowVisual
-// Shows the defined station information visual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ShowVisual( TStationInformationVisual aVisual, TBool aFade )
- {
- if ( aVisual & EFirstLineTextVisual )
- {
- if ( aFade )
- {
- FadeIn( *iFirstLineVisualText, KFMRadioStationInformationFadeDurationTime );
- }
- else
- {
- FadeIn( *iFirstLineVisualText, 0 );
- }
- }
- if ( aVisual & ESecondLineTextVisual )
- {
- if ( aFade )
- {
- FadeIn( *iSecondLineVisualText, KFMRadioStationInformationFadeDurationTime );
- }
- else
- {
- FadeIn( *iSecondLineVisualText, 0 );
- }
- }
- if ( aVisual & ETuningTextVisual )
- {
- if ( aFade )
- {
- FadeIn( *iTuningVisualText, KFMRadioStationInformationFadeDurationTime );
- }
- else
- {
- FadeIn( *iTuningVisualText, 0 );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::HideVisual
-// Hides the defined station information visual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::HideVisual( TStationInformationVisual aVisual )
- {
- if ( aVisual & EFirstLineTextVisual )
- {
- FadeOut( *iFirstLineVisualText, 0 );
- }
- if ( aVisual & ESecondLineTextVisual )
- {
- FadeOut( *iSecondLineVisualText, 0 );
- }
- if ( aVisual & ETuningTextVisual )
- {
- FadeOut( *iTuningVisualText, 0 );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::SetStationInformationTextColor
-// Change text color of the text visuals.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::SetStationInformationTextColor( const TRgb& aTextColor )
- {
- iStationInformationTextColor = aTextColor;
- iFirstLineVisualText->SetColor( aTextColor );
- iSecondLineVisualText->SetColor( aTextColor );
- iTuningVisualText->SetColor( aTextColor );
- };
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ScrollOutCurrentStationInformationL
-// Scrolls out the current station information lines by hiding actual visuals and scrolling out
-// the created temporary information lines
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ScrollOutCurrentStationInformationL( TFMRadioStationChangeType aChangeType )
- {
- // Don't start any effects if the current station info is already disappeared
- if ( iStationInformationAnchorLayout->Opacity().Target() != 0 )
- {
- // Hide the actual station information visuals
- CreateTemporaryStationInformationVisualsL();
- AnimateTemporaryStationInformationVisuals( aChangeType );
- // Hide the original and set it to origin by default
- HideVisual( EAllVisuals );
- FadeOut( *iStationInformationAnchorLayout, 0 );
- iStationInformationAnchorLayout->SetPos( TAlfRealPoint() );
- // Flush manually
- Env().BatchBufferHandler().FlushBatchBuffer();
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::CreateTemporaryStationInformationVisualsL
-// Creates copy of current station information
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::CreateTemporaryStationInformationVisualsL()
- {
- // update layout and attributes for child visuals
- for ( TInt i = 0, count = iStationInformationAnchorLayout->Count(); i < count; i++ )
- {
- TPoint childPosition;
- TSize childSize;
-
- iStationInformationAnchorLayout->ChildPos( i , childPosition );
- iStationInformationAnchorLayout->ChildSize( i , childSize );
- TAlfRealRect childRect( TRect( childPosition, childSize ) );
-
- CAlfTextVisual* textVisual = static_cast<CAlfTextVisual*>( &iStationInformationAnchorLayout->Visual( i ) );
- CAlfTextVisual* tempTextVisual = static_cast<CAlfTextVisual*>( &iStationInformationTempAnchorLayout->Visual( i ) );
-
- tempTextVisual->SetTextL( textVisual->Text() );
- tempTextVisual->SetTextStyle( textVisual->TextStyle() );
- tempTextVisual->SetColor( iStationInformationTextColor );
- tempTextVisual->SetOpacity( textVisual->Opacity() );
-
- SetAbsoluteCornerAnchors( iStationInformationTempAnchorLayout, i, childRect.iTl, childRect.iBr );
- }
- iStationInformationTempAnchorLayout->UpdateChildrenLayout();
-
- // Flush manually
- Env().BatchBufferHandler().FlushBatchBuffer();
-
- iStationInformationTempAnchorLayout->SetOpacity( iStationInformationAnchorLayout->Opacity() );
- iStationInformationTempAnchorLayout->SetPos( iStationInformationAnchorLayout->Pos() );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::AnimateTemporaryStationInformationVisuals
-// Animates temporary station infoout of the display
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::AnimateTemporaryStationInformationVisuals( TFMRadioStationChangeType aChangeType )
- {
- FadeOut( *iStationInformationTempAnchorLayout, KFMRadioStationInformationFadeDurationTime );
- switch ( aChangeType )
- {
- // Swipe visuals in the opposite direction to give the right impression
- case EFMRadioStationChangePrevious:
- {
- ScrollToRight( *iStationInformationTempAnchorLayout, KFMRadioStationInformationScrollDurationTime );
- break;
- }
- case EFMRadioStationChangeNext:
- {
- ScrollToLeft( *iStationInformationTempAnchorLayout, KFMRadioStationInformationScrollDurationTime );
- break;
- }
- case EFMRadioStationChangeScanUp:
- {
- ScrollUp( *iStationInformationTempAnchorLayout, KFMRadioStationInformationScrollDurationTime );
- break;
- }
- case EFMRadioStationChangeScanDown:
- {
- ScrollDown( *iStationInformationTempAnchorLayout, KFMRadioStationInformationScrollDurationTime );
- break;
- }
- default:
- break;
- };
- }
-
-// ---------------------------------------------------------------------------
-// From class MGestureObserver.
-// Called when user makes gestures.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::HandleGestureL( const MGestureEvent& aEvent )
- {
- TGestureCode eventCode( aEvent.Code( MGestureEvent::EAxisBoth ) );
- FTRACE( FPrint( _L("CFMRadioAlfVisualizer::HandleGestureL(eventCode=%d)"), eventCode ) );
-
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( CCoeEnv::Static()->AppUi() );
- // handle gestures only if there is no call ongoing
- if ( !appUi->RadioEngine()->IsInCall() )
- {
- switch ( eventCode )
- {
- case EGestureTap:
- {
- CAknVolumePopup* volPopup = appUi->ActiveVolumePopup();
- if ( volPopup )
- {
- if ( volPopup->IsVisible() )
- {
- volPopup->CloseVolumePopup();
- }
- else
- {
- volPopup->ShowVolumePopupL();
- }
- }
- break;
- }
- case EGestureSwipeLeft:
- {
- if ( iDragAxis == EFMRadioDragAxisX )
- {
- if ( appUi->NumberOfChannelsStored() )
- {
- iRevertGestureDrag = EFalse;
- }
- appUi->HandleCommandL( EFMRadioCmdNextChannel );
- }
- break;
- }
- case EGestureSwipeRight:
- {
- if ( iDragAxis == EFMRadioDragAxisX )
- {
- if ( appUi->NumberOfChannelsStored() )
- {
- iRevertGestureDrag = EFalse;
- }
- appUi->HandleCommandL( EFMRadioCmdPrevChannel );
- }
- break;
- }
- case EGestureSwipeUp:
- {
- if ( iDragAxis == EFMRadioDragAxisY )
- {
- iRevertGestureDrag = EFalse;
- appUi->HandleCommandL( EFMRadioCmdSeekUp );
- }
- break;
- }
- case EGestureSwipeDown:
- {
- if ( iDragAxis == EFMRadioDragAxisY )
- {
- iRevertGestureDrag = EFalse;
- appUi->HandleCommandL( EFMRadioCmdSeekDown );
- }
- break;
- }
- case EGestureStart:
- {
- iDragAxis = EFMRadioDragAxisNone;
- iRevertGestureDrag = ETrue;
- iDragStartPosition = iStationInformationAnchorLayout->Pos();
- break;
- }
- case EGestureDrag:
- {
- TPoint delta = aEvent.CurrentPos() - aEvent.StartPos();
-
- // Determine the dragging axis
- if ( iDragAxis == EFMRadioDragAxisNone )
- {
- TInt absX = Abs( delta.iX );
- TInt absY = Abs( delta.iY );
- if ( absX > absY )
- {
- iDragAxis = EFMRadioDragAxisX;
- }
- else if ( absY > absX )
- {
- iDragAxis = EFMRadioDragAxisY;
- }
- else
- {
- //X and Y are equal, can't determine the axis
- }
- }
-
-
- if ( iRevertGestureDrag && iDragAxis != EFMRadioDragAxisNone ) // gesture is ongoing, ok to move visual
- {
- TAlfRealPoint newPosition;
- newPosition.iX = iDragStartPosition.iX.ValueNow();
- newPosition.iY = iDragStartPosition.iY.ValueNow();
-
- if ( iDragAxis == EFMRadioDragAxisX )
- {
- newPosition.iX += delta.iX;
- }
- else
- {
- newPosition.iY += delta.iY;
- }
- iStationInformationAnchorLayout->SetPos( newPosition );
- }
- break;
- }
- case EGestureUnknown:
- case EGestureReleased:
- {
- if ( iRevertGestureDrag )
- {
- RevertVisual( *iStationInformationAnchorLayout );
- }
- break;
- }
- case EGestureHoldLeft:
- case EGestureHoldRight:
- case EGestureHoldUp:
- case EGestureHoldDown:
- {
- // gesture "timed out"
- if ( iRevertGestureDrag )
- {
- // change revert status so that the following
- // EGestureDrag event doesn't change visual position
- // anymore
- iRevertGestureDrag = EFalse;
- RevertVisual( *iStationInformationAnchorLayout );
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- else
- {
- FTRACE(FPrint(_L("CFMRadioAlfVisualizer::HandleGestureL() call ongoing -> gestures ignored")));
- }
- }
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::OfferEventL
-// From CAlfControl, takes care of alfred event handling.
-// ----------------------------------------------------------------------------
-//
-TBool CFMRadioAlfVisualizer::OfferEventL( const TAlfEvent& aEvent )
- {
- if ( aEvent.IsKeyEvent() && AknLayoutUtils::PenEnabled() )
- {
- const TKeyEvent& kEvent = aEvent.KeyEvent();
- if ( kEvent.iScanCode == EStdKeyRightArrow ||
- kEvent.iScanCode == EStdKeyLeftArrow ||
- kEvent.iScanCode == EStdKeyUpArrow ||
- kEvent.iScanCode == EStdKeyDownArrow )
- {
- iKeyScanCode = kEvent.iScanCode;
-
- if ( aEvent.Code() == EEventKeyUp )
- {
- iLongPressTimer->Cancel();
- if ( !iLongKeyTriggered )
- {
- TriggerCommandL();
- }
- }
- else if ( aEvent.Code() == EEventKeyDown )
- {
- iLongKeyTriggered = EFalse;
- // Start the long key press timer
- iLongPressTimer->Cancel();
- iLongPressTimer->Start( KFMRadioRockerLongPressDelay,
- 0,
- TCallBack( CFMRadioAlfVisualizer::StaticLongPressCallBack, this ) );
- }
- return ETrue;
- }
- }
- if ( aEvent.IsPointerEvent() )
- {
- CGestureControl::OfferEventL( aEvent );
- }
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Sets the display style in use.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::SetDisplayStyle( TFMRadioDisplayStyle aDisplayStyle )
- {
- iDisplayStyle = aDisplayStyle;
- }
-
-// ---------------------------------------------------------------------------
-// Returns the display style.
-// ---------------------------------------------------------------------------
-//
-TFMRadioDisplayStyle CFMRadioAlfVisualizer::DisplayStyle() const
- {
- return iDisplayStyle;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::SetAbsoluteCornerAnchors
-// Sets absolute rect of the anchor by top left and bottom right points.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition )
- {
- if ( aAnchor )
- {
- // Set top/left anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeTopLeft,
- TAlfXYMetric( TAlfMetric( aTopLeftPosition.iX ), TAlfMetric( aTopLeftPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
-
-
- // Set bottom/right anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeBottomRight,
- TAlfXYMetric( TAlfMetric( aBottomRightPosition.iX ), TAlfMetric( aBottomRightPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ScrollRightToLeftWithFadeIn
-// Sets and starts scrolling and fading animations to CAlfVisual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ScrollRightToLeftWithFadeIn( CAlfVisual& aVisual ) const
- {
- TInt visualWidthInDisplayCoord = aVisual.DisplayRect().Width();
-
- TAlfTimedPoint targetPoint;
- targetPoint.iX.SetValueNow( visualWidthInDisplayCoord );
- targetPoint.iX.SetTarget( 0, KFMRadioStationInformationScrollDurationTime );
- aVisual.SetPos( targetPoint );
-
- FadeIn( aVisual, KFMRadioStationInformationFadeDurationTime);
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ScrollLeftToRightWithFadeIn
-// Sets and starts scrolling and fading animations to CAlfVisual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ScrollLeftToRightWithFadeIn( CAlfVisual& aVisual ) const
- {
- TInt visualWidthInDisplayCoord = aVisual.DisplayRect().Width();
- TAlfTimedPoint targetPoint;
- targetPoint.iX.SetValueNow( - visualWidthInDisplayCoord );
- targetPoint.iX.SetTarget( 0, KFMRadioStationInformationScrollDurationTime );
- aVisual.SetPos( targetPoint );
-
- FadeIn( aVisual, KFMRadioStationInformationFadeDurationTime);
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ScrollInFromTop
-// Sets and starts scrolling and fading animations to CAlfVisual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ScrollInFromTop( CAlfVisual& aVisual ) const
- {
- TRect displayArea = Env().PrimaryDisplay().VisibleArea();
- TAlfTimedPoint targetPoint;
- targetPoint.iY.SetValueNow( -displayArea.Height() );
- targetPoint.iY.SetTarget( 0, KFMRadioStationInformationScrollDurationTime );
- aVisual.SetPos( targetPoint );
-
- FadeIn( aVisual, KFMRadioStationInformationFadeDurationTime);
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ScrollInFromBottom
-// Sets and starts scrolling and fading animations to CAlfVisual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ScrollInFromBottom( CAlfVisual& aVisual ) const
- {
- TRect displayArea = Env().PrimaryDisplay().VisibleArea();
- TAlfTimedPoint targetPoint;
- targetPoint.iY.SetValueNow( displayArea.Height() );
- targetPoint.iY.SetTarget( 0, KFMRadioStationInformationScrollDurationTime );
- aVisual.SetPos( targetPoint );
-
- FadeIn( aVisual, KFMRadioStationInformationFadeDurationTime);
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::RevertVisual
-// Reverts the visual to the origin
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::RevertVisual( CAlfVisual& aVisual )
- {
- TAlfTimedPoint targetPoint;
- targetPoint.iX.SetTarget( 0, KFMRadioStationInformationScrollDurationTime );
- targetPoint.iY.SetTarget( 0, KFMRadioStationInformationScrollDurationTime );
- aVisual.SetPos( targetPoint );
- TAlfTimedValue opacity;
- opacity.SetTarget( 1.0f, KFMRadioStationInformationFadeDurationTime );
- aVisual.SetOpacity( opacity );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ScrollToLeft
-// Sets and starts scrolling animation to CAlfVisual.
-// The visual object is scrolled from current position to
-// left side of the display
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ScrollToLeft( CAlfVisual& aVisual, TInt aTime ) const
- {
- TInt visualWidth = aVisual.DisplayRect().Width();
- TAlfTimedPoint timedPosition = aVisual.Pos();
- TAlfRealPoint positionLeft( - ( visualWidth ), timedPosition.iY.ValueNow() );
- aVisual.SetPos( positionLeft, aTime );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ScrollToRight
-// Sets and starts scrolling animation to CAlfVisual.
-// The visual object is scrolled from current position to
-// right side of the display
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ScrollToRight( CAlfVisual& aVisual, TInt aTime ) const
- {
- TRect displayArea = Env().PrimaryDisplay().VisibleArea();
- TAlfTimedPoint timedPosition = aVisual.Pos();
- TAlfRealPoint positionRight( displayArea.Width(), timedPosition.iY.ValueNow() );
-
- aVisual.SetPos( positionRight, aTime );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ScrollUp
-// Sets and starts scrolling animation to CAlfVisual.
-// The visual object is scrolled up
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ScrollUp( CAlfVisual& aVisual, TInt aTime ) const
- {
- TInt visualHeight = aVisual.DisplayRect().Height();
- TAlfTimedPoint timedPosition = aVisual.Pos();
- TAlfRealPoint positionUp( timedPosition.iX.ValueNow(), -visualHeight );
- aVisual.SetPos( positionUp, aTime );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ScrollDown
-// Sets and starts scrolling animation to CAlfVisual.
-// The visual object is scrolled down
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ScrollDown( CAlfVisual& aVisual, TInt aTime ) const
- {
- TRect displayArea = Env().PrimaryDisplay().VisibleArea();
- TAlfTimedPoint timedPosition = aVisual.Pos();
- TAlfRealPoint positionDown( timedPosition.iX.ValueNow(), displayArea.Height() );
- aVisual.SetPos( positionDown, aTime );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::FadeIn
-// Sets fading in animation to CAlfVisual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::FadeIn( CAlfVisual& aVisual, TInt aTime, TReal aOpacity ) const
- {
- TAlfTimedValue opacity;
- opacity.SetValueNow( 0.0f ); // immediate change
- opacity.SetTarget( aOpacity, aTime ); // and smooth target
- aVisual.SetOpacity( opacity );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::FadeOut
-// Sets fading out animation to CAlfVisual.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::FadeOut( CAlfVisual& aVisual, TInt aTime, TReal aOpacity ) const
- {
- TAlfTimedValue opacity;
- opacity.SetTarget( aOpacity, aTime );
- aVisual.SetOpacity( opacity );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::ChangeStationL
-// Changes station to next with scrolling and fading station's
-// information (name, frequency, etc.).
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::ChangeStationL( TFMRadioStationChangeType aChangeType,
- const TDesC& aFirstLine,
- const TDesC* aSecondLine )
- {
- const TDesC& secondLine = aSecondLine ? *aSecondLine : KNullDesC;
- TBool firstLineFade = iFirstLineVisualText->Text() != aFirstLine;
- TBool secondLineFade = iSecondLineVisualText->Text() != secondLine;
-
- if ( aChangeType != EFMRadioStationChangeNone || firstLineFade || secondLineFade )
- {
- Env().CancelCommands( iFirstLineVisualText );
- Env().CancelCommands( iSecondLineVisualText );
-
- if ( secondLine.Length() )
- {
- SetDisplayStyle( EFMRadioDisplayDoubleLine );
- }
- else
- {
- SetDisplayStyle( EFMRadioDisplaySingleLine );
- }
-
- FadeOut( *iTuningVisualText, 0 );
- LoadTextVisualIdentity( iFirstLineVisualText );
- LoadTextVisualIdentity( iSecondLineVisualText );
- iFirstLineVisualText->SetTextL( aFirstLine );
- iSecondLineVisualText->SetTextL( secondLine );
- UpdateLayout();
-
- // Set the horizontal animation
- switch ( aChangeType )
- {
- case EFMRadioStationChangePrevious:
- {
- // Direction of the animation is left to right
- ShowVisual( EFirstLineTextVisual, 0 );
- ShowVisual( ESecondLineTextVisual, 0 );
- ScrollLeftToRightWithFadeIn( *iStationInformationAnchorLayout );
- }
- break;
- case EFMRadioStationChangeNext:
- {
- // Direction of the animation is right to left
- ShowVisual( EFirstLineTextVisual, 0 );
- ShowVisual( ESecondLineTextVisual, 0 );
- ScrollRightToLeftWithFadeIn( *iStationInformationAnchorLayout );
- }
- break;
- case EFMRadioStationChangeScanUp:
- {
- ShowVisual( EFirstLineTextVisual, 0 );
- ShowVisual( ESecondLineTextVisual, 0 );
- ScrollInFromBottom( *iStationInformationAnchorLayout );
- }
- break;
- case EFMRadioStationChangeScanDown:
- {
- ShowVisual( EFirstLineTextVisual, 0 );
- ShowVisual( ESecondLineTextVisual, 0 );
- ScrollInFromTop( *iStationInformationAnchorLayout );
- }
- break;
- case EFMRadioStationChangeNone:
- {
- ShowVisual( EFirstLineTextVisual, firstLineFade );
- ShowVisual( ESecondLineTextVisual, secondLineFade );
- }
- break;
- default:
- break;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::SetStaticInfoTextL
-// Resets the station information and sets static text to the third line.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::SetStaticInfoTextL( TFMRadioStationChangeType aChangeType, const TDesC& aInfoText )
- {
- ScrollOutCurrentStationInformationL( aChangeType );
- SetVisualTextL( ETuningTextVisual, aInfoText );
- UpdateLayout();
- ShowVisual( ETuningTextVisual, ETrue );
- // Make the new station info visible
- FadeIn( *iStationInformationAnchorLayout, 0 );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::Translate
-// Translates the visual object with passed arguments
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::Translate( CAlfTextVisual* aTextVisual, const TAlfTimedValue& aX, const TAlfTimedValue& aY )
- {
- if( aTextVisual )
- {
- TRAPD( err, aTextVisual->EnableTransformationL( ETrue ) );
- if( err == KErrNone )
- {
- CAlfTransformation* visualTransformation = &( aTextVisual->Transformation() );
- TAlfTimedValue x(aX);
- x.SetStyle( EAlfTimedValueStyleLinear );
-
- TAlfTimedValue y(aY);
- y.SetStyle( EAlfTimedValueStyleLinear );
-
- visualTransformation->Translate( x, y );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Triggers the command to view handling
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::TriggerCommandL()
- {
- TVwsViewId viewId( KNullUid, KNullUid );
- CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() );
- TInt err = appUi->GetActiveViewId( viewId );
- RProcess process;
- TSecureId id = process.SecureId();
-
- if ( !err && viewId.iAppUid.iUid == id.iId )
- {
- CAknView* view = appUi->View( viewId.iViewUid );
- if ( view )
- {
- // command to be generated
- TInt commandId = 0;
-
- switch ( iKeyScanCode )
- {
- case EStdKeyLeftArrow:
- {
- if ( iLongKeyTriggered )
- {
- commandId = EFMRadioRockerButtonKeyLeftLong;
- break;
- }
- else
- {
- commandId = EFMRadioRockerButtonKeyLeft;
- }
- break;
- }
- case EStdKeyRightArrow:
- {
- if ( iLongKeyTriggered )
- {
- commandId = EFMRadioRockerButtonKeyRightLong;
- }
- else
- {
- commandId = EFMRadioRockerButtonKeyRight;
- }
- break;
- }
- case EStdKeyUpArrow:
- {
- commandId = EFMRadioRockerButtonKeyUp;
- break;
- }
- case EStdKeyDownArrow:
- {
- commandId = EFMRadioRockerButtonKeyDown;
- break;
- }
- }
- // send command to view
- view->ProcessCommandL( commandId );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Callback that is invoked when a long key press has occurred.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioAlfVisualizer::StaticLongPressCallBack( TAny* aSelf )
- {
- CFMRadioAlfVisualizer* self = static_cast<CFMRadioAlfVisualizer*>( aSelf );
- if ( self )
- {
- self->iLongPressTimer->Cancel();
- self->iLongKeyTriggered = ETrue;
-
- TRAP_IGNORE( self->TriggerCommandL() )
- }
- return KErrNone;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::LoadTextVisualIdentity
-// Removes all transformations of the visual object such as the scaling and translating.
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::LoadTextVisualIdentity( CAlfTextVisual* aTextVisual )
- {
- if( aTextVisual )
- {
- TRAPD( err, aTextVisual->EnableTransformationL( ETrue ) );
- if( err == KErrNone )
- {
- CAlfTransformation* visualTransformation = &( aTextVisual->Transformation() );
- visualTransformation->LoadIdentity();
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::StartTuningAnimation
-// Starts tuning animation after delay
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::StartTuningAnimation()
- {
- iBmpAnimation->StartBmpAnimation();
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioAlfVisualizer::StopTuningAnimation
-// Stops tuning animation by fading it away
-// ----------------------------------------------------------------------------
-//
-void CFMRadioAlfVisualizer::StopTuningAnimation()
- {
- iBmpAnimation->StopBmpAnimation();
- }
-
-// End of File
-
--- a/fmradio/fmradio/src/fmradioapp.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Main application class implementation.
-*
-*/
-
-
-// INCLUDE FILES
-#include <fmradiouids.h>
-
-#include "fmradioapp.h"
-#include "fmradiodocument.h"
-#include "debug.h"
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CFMRadioApp::AppDllUid()
-// Returns application UID
-// ---------------------------------------------------------
-//
-TUid CFMRadioApp::AppDllUid() const
- {
- return TUid::Uid( KUidFMRadioApplication );
- }
-
-
-// ---------------------------------------------------------
-// CFMRadioApp::CreateDocumentL()
-// Creates CFMRadioDocument object
-// ---------------------------------------------------------
-//
-CApaDocument* CFMRadioApp::CreateDocumentL()
- {
- return CFMRadioDocument::NewL( *this );
- }
-
-// ================= OTHER EXPORTED FUNCTIONS ==============
-
-
-#include <eikstart.h>
-
-LOCAL_C CApaApplication* NewApplication()
- {
- return new CFMRadioApp;
- }
-
-GLDEF_C TInt E32Main()
- {
- return EikStart::RunApplication(NewApplication);
- }
-
-
-// End of File
-
--- a/fmradio/fmradio/src/fmradioappui.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2802 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: FM Radio App UI implementation
-*
-*/
-
-// INCLUDE FILES
-
-#include <featmgr.h>
-#if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE
-#include <hlplch.h>
-#include "radio.hlp.hrh"
-#endif
-#include <akntoolbar.h>
-#include <StringLoader.h>
-#include <eikmenup.h>
-#include <avkon.hrh>
-#include <aknlistquerydialog.h>
-#include <AknQueryDialog.h>
-#include <AknGlobalNote.h>
-#include <fmradio.rsg>
-#include <fmradiocommandlineparams.h>
-#include <alf/alfenv.h>
-#include <AknVolumePopup.h>
-#include <fmradiointernalpskeys.h>
-#include <fmradiouids.h>
-#include <iaupdate.h>
-#include <iaupdateparameters.h>
-#include <iaupdateresult.h>
-#include <e32property.h>
-#include <apgwgnam.h>
-#include <centralrepository.h>
-#include <settingsinternalcrkeys.h>
-#include <activeidle2domainpskeys.h>
-#include <akntoolbarextension.h>
-
-#include "fmradiobacksteppingservicewrapper.h"
-#include "fmradiodocument.h"
-#include "fmradioengine.h"
-#include "fmradiovariant.hrh"
-#include "fmradiomainview.h"
-#include "fmradiochannellistview.h"
-#include "fmradiocontroleventobserverimpl.h"
-#include "fmradioscanlocalstationsview.h"
-#include "fmradio.hrh"
-#include "fmradioengine.hrh"
-#include "fmradioappui.h"
-#include "fmradiordsreceiver.h"
-#include "fmradioapp.h"
-#include "fmradiopubsub.h"
-#include "debug.h"
-
-// Application Uid for Active Idle app
-#ifdef __ACTIVE_IDLE
-const TUid KFMRadioUidIdleApp = { 0x101FD64C };
-#else
-const TUid KFMRadioUidIdleApp = KPSUidActiveIdle2; // use this one instead because the "aisystemuids.hrh" is not export
-#endif
-// CONSTANTS
-
-const TInt KMaxAlfredFrameRate = 25;
-
-// ---------------------------------------------------------------------------------
-// CFMInformationNote::CFMInformationNote
-// ---------------------------------------------------------------------------------
-CFMInformationNote::CFMInformationNote( MInformationNoteInterface& aObserver ) :
- CAknInformationNote ( EFalse ),
- iDialogObserver( aObserver )
- {
-
- }
-
-
-// ---------------------------------------------------------------------------------
-// CFMInformationNote::~CFMInformationNote
-// ---------------------------------------------------------------------------------
-//
-CFMInformationNote::~CFMInformationNote()
- {
- iDialogObserver.DialogTerminated();
- }
-
-
-
-// ================= MEMBER FUNCTIONS =======================
-//
-// ---------------------------------------------------------------------------------
-// CFMRadioAppUi::ConstructL
-// 2nd phase constructor. Instanciates all member objects
-// ---------------------------------------------------------------------------------
-//
-void CFMRadioAppUi::ConstructL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::ConstructL()") ) );
-
- iPendingViewId = TUid::Null();
- iStartUp = ETrue;
- iStartupWizardHandled = EFalse;
- iStartupWizardRunning = EFalse;
- iTuneFromWizardActivated = EFalse;
- iInfoNoteOn = EFalse;
- iAutoTune = EFalse;
- iAutoTuneUnmute = EFalse;
-
- BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible );
- FeatureManager::InitializeLibL();
- iFeatureManagerInitialized = ETrue;
-
- iChannels = new( ELeave ) CArrayFixFlat<TChannelInformation>( 1 );
-
- // initialise local variation key with all features disabled.
- iFMRadioVariationFlags = 0;
- iAudioResourceAvailable = ETrue;
- iAlreadyClean = EFalse;
-
- iRadioEngine = CRadioEngine::NewL( *this ); // Construct a radio engine object
-
- // Fill channels array from engine
- GetChannelsArrayL();
-
- if ( iRadioEngine->IsInCall() )
- {
- iCurrentRadioState = EFMRadioStateOffForPhoneCall;
- }
-
- iBsWrapper = CFMRadioBackSteppingServiceWrapper::NewL( TUid::Uid( KUidFMRadioApplication ) );
- AddViewActivationObserverL( iBsWrapper );
-
- iMainView = CFMRadioMainView::NewL( iRadioEngine, *iAlfEnv, *this );
- AddViewL( iMainView ); // transfer ownership to CAknViewAppUi
- iChannelListView = CFMRadioChannelListView::NewL( iRadioEngine, *this );
- AddViewL( iChannelListView ); // transfer ownership to CAknViewAppUi
- iScanLocalStationsView = CFMRadioScanLocalStationsView::NewL( *iRadioEngine, *this );
- AddViewL( iScanLocalStationsView ); // transfer ownership to CAknViewAppUi
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::SecondaryConstructL()
-// All leaving function calls are made here, so that nothing is left on the stack if the ConstructL leaves
-// The reason for this behaviour is that the UI framework doesn't handle leaves from the AppUi correctly.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::SecondaryConstructL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::SecondaryConstructL()") ) );
-
- iLayoutChangeObserver = iMainView;
-
- iRadioEngine->PubSubL().PublishPresetCountL( iChannels->Count() );
-
- // Create vertical volume popup for speaker and headset
- iIhfVolumePopupControl = CAknVolumePopup::NewL( NULL, ETrue );
- iIhfVolumePopupControl->SetRange( KFMRadioMinVolumeLevel, KFMRadioMaxVolumeLevel );
- iIhfVolumePopupControl->SetStepSize( KFMRadioVolumeStepSize );
- // Set observer for control events
- iIhfVolumePopupControl->SetObserver( this );
-
- iHeadsetVolumePopupControl = CAknVolumePopup::NewL( NULL, ETrue );
- iHeadsetVolumePopupControl->SetRange( KFMRadioMinVolumeLevel, KFMRadioMaxVolumeLevel );
- iHeadsetVolumePopupControl->SetStepSize( KFMRadioVolumeStepSize );
- iHeadsetVolumePopupControl->SetObserver( this );
-
- iActiveVolumePopupControl = iHeadsetVolumePopupControl; //initialize it to Headset
-
- // Create and set our observer for control events.
- iControlEventObserver = CFMRadioControlEventObserverImpl::NewL( *this );
- iRadioEngine->PubSubL().SetControlEventObserver( iControlEventObserver );
-
- // For monitoring side volume key events
- iSvkEvents = CFMRadioSvkEvents::NewL(*this);
-
- iRadioEngine->PubSubL().PublishApplicationRunningStateL( EFMRadioPSApplicationRunning );
-
- UpdateLandscapeInformation();
-
- // Create alfred environment
- iAlfEnv = CAlfEnv::NewL();
- iAlfEnv->SetMaxFrameRate( KMaxAlfredFrameRate );
-
- // Create alfred display
- TRect rect;
- AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
- if( !IsLandscapeOrientation() )
- {
- TRect toolBarRect = iMainView->Toolbar()->Rect();
- rect.SetHeight( rect.Height() - toolBarRect.Height() );
- }
- iAlfEnv->NewDisplayL( rect, CAlfEnv::ENewDisplayAsCoeControl );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleTunerReadyCallback
-// Tuner is initialized and ready.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleTunerReadyCallback()
- {
- iRadioEngine->InitializeRadio();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::~CFMRadioAppUi
-// Destructor
-// Frees reserved resources
-// ---------------------------------------------------------------------------
-//
-CFMRadioAppUi::~CFMRadioAppUi()
- {
- if ( iRadioEngine )
- {
- TRAP_IGNORE(
- iRadioEngine->PubSubL().PublishApplicationRunningStateL( EFMRadioPSApplicationClosing ) )
- }
-
- FTRACE( FPrint( _L("CFMRadioAppUi::~CFMRadioAppUi()") ) );
- if ( iAlreadyClean == EFalse )
- {
- Cleanup();
- }
-
- if ( iFeatureManagerInitialized )
- {
- FeatureManager::UnInitializeLib();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::Cleanup()
-// Perform object cleanup. This would normally be performed in the destructor,
-// but since it can also be called from SecondaryConstructL it was moved into
-// a seperate function.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::Cleanup()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::Cleanup()") ) );
-
- delete iIhfVolumePopupControl;
- iIhfVolumePopupControl = NULL;
- delete iHeadsetVolumePopupControl;
- iHeadsetVolumePopupControl = NULL;
-
- if (iRadioEngine)
- {
- delete iRadioEngine;
- iRadioEngine = NULL;
- }
- if (iSvkEvents)
- {
- delete iSvkEvents;
- }
-
- if (iGlobalOfflineQuery)
- {
- delete iGlobalOfflineQuery;
- }
-
- if (iLocalActivateOfflineQuery)
- {
- delete iLocalActivateOfflineQuery;
- }
-
- if (iLocalContinueOfflineQuery)
- {
- delete iLocalContinueOfflineQuery;
- }
-
- delete iControlEventObserver;
- delete iAlfEnv;
-
- iAlreadyClean = ETrue;
-
- if ( iConnectHeadsetGlobalNote )
- {
- delete iConnectHeadsetGlobalNote;
- iConnectHeadsetGlobalNote = NULL;
- }
-
- if ( iConnectHeadsetQuery )
- {
- delete iConnectHeadsetQuery;
- iConnectHeadsetQuery = NULL;
- }
- if ( iChannels )
- {
- iChannels->Reset();
- delete iChannels;
- iChannels = NULL;
- }
- if ( iUpdate )
- {
- delete iUpdate;
- iUpdate = NULL;
- }
- if ( iParameters )
- {
- delete iParameters;
- iParameters = NULL;
- }
- if ( iSettingsRepository )
- {
- delete iSettingsRepository;
- iSettingsRepository = NULL;
- }
- if ( iBsWrapper )
- {
- RemoveViewActivationObserver( iBsWrapper );
- }
- delete iBsWrapper;
- iBsWrapper = NULL;
-
- delete iStartupForegroundCallback;
- iStartupForegroundCallback = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleCommandL
-// Interprets view's menu-,softkey and other commands and acts
-// accordingly by calling the appropriate command handler
-// function for further action.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleCommandL( TInt aCommand )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleCommandL state=%d command=%d "), iCurrentRadioState, aCommand) );
- if ( iCurrentRadioState == EFMRadioStateOn )
- {
- switch ( aCommand )
- {
- case EFMRadioCmdChannelList:
- ActivateLocalViewL( iChannelListView->Id() );
- break;
- case EFMRadioCmdSeekUp:
- ScanUpL();
- break;
- case EFMRadioCmdSeekDown:
- ScanDownL();
- break;
- case EFMRadioCmdSaveChannel:
- SaveChannelToLastIntoListL();
- break;
- case EFMRadioCmdScanLocalStations:
- ActivateLocalViewL(iScanLocalStationsView->Id());
- break;
- case EFMRadioCmdScanLocalStationsScan:
- // continue scanning
- StartLocalStationsSeekL();
- break;
- case EFMRadioCmdListenCh:
-
- if ( iChannels->Count() > 0 )
- {
- PlayChannel( iChannelListView->CurrentlySelectedChannel() );
- }
- break;
- case EFMRadioCmdRename:
- RenameCurrentChannelL();
- break;
- case EFMRadioCmdActivateIhf:
- SetAudioOutput( CRadioEngine::EFMRadioOutputIHF );
- break;
- case EFMRadioCmdDeactivateIhf:
- SetAudioOutput( CRadioEngine::EFMRadioOutputHeadset );
- break;
- case EFMRadioCmdEnableRdsAfSearch:
- iRadioEngine->SetRdsAfSearchEnable( ETrue );
- break;
- case EFMRadioCmdDisableRdsAfSearch:
- iRadioEngine->SetRdsAfSearchEnable( EFalse );
- break;
- case EFMRadioCmdUpdateVolume:
- UpdateVolume( EDirectionNone );
- break;
- case EFMRadioCmdNextChannel:
- {
- TInt channelCount = iChannels->Count();
- if ( channelCount >= 1 )
- {
- iMainView->SetStationChangeType( EFMRadioStationChangeNext );
- PlayChannel( iChannelListView->NextChannel() );
- }
- else
- {
- if ( AknLayoutUtils::PenEnabled() )
- {
- DisplayInformationNoteL( R_QTN_FMRADIO_USE_LONG_TAP );
- }
- }
- break;
- }
- case EFMRadioCmdPrevChannel:
- {
- TInt channelCount = iChannels->Count();
- if ( channelCount >= 1 )
- {
- iMainView->SetStationChangeType( EFMRadioStationChangePrevious );
- PlayChannel( iChannelListView->PreviousChannel() );
- }
- else
- {
- if ( AknLayoutUtils::PenEnabled() )
- {
- DisplayInformationNoteL( R_QTN_FMRADIO_USE_LONG_TAP );
- }
- }
- break;
- }
- case EFMRadioCmdMuteOn:
- iRadioEngine->SetMuteOn( ETrue );
- break;
- case EFMRadioCmdMuteOff:
- iRadioEngine->SetMuteOn( EFalse );
- break;
- case EFMRadioCmdMute:
- HandleMuteCommand();
- break;
- case EAknCmdHelp:
- case EFMRadioCmdHelp:
- {
-#if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE
- if ( ActiveView() == KFMRadioMainViewId )
- {
- HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), GetCurrentHelpContextL() );
- }
- else
- {
- CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL();
- HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), buf );
- }
-#endif
- }
- break;
- case EFMRadioCmdScanLocalStationsViewActive:
- iLayoutChangeObserver = iScanLocalStationsView;
- break;
- case EFMRadioCmdChannelListViewActive:
- iLayoutChangeObserver = iChannelListView;
- break;
- case EFMRadioCmdMainViewActive:
- iLayoutChangeObserver = iMainView;
- if ( iAutoTune &&
- ( iScanLocalStationsView->CancelType() == EFMRadioCancelScanBySoftkey ||
- iScanLocalStationsView->CancelType() == EFMRadioCancelScanDefault))
- {
- ScanUpL();
- iAutoTune = EFalse;
- iAutoTuneUnmute = ETrue;
- }
- break;
-
- default:
- break;
- }
- }
- else if( iCurrentRadioState == EFMRadioStateBusyScanUp ||
- iCurrentRadioState == EFMRadioStateBusyScanDown ||
- iCurrentRadioState == EFMRadioStateBusySeek ||
- iCurrentRadioState == EFMRadioStateBusyScanLocalStations )
- {
- switch ( aCommand )
- {
- case EFMRadioCmdStopTuning:
- case EAknSoftkeyCancel:
- CancelSeek();
- break;
- default:
- break;
- }
- }
- switch ( aCommand )
- {
- case EAknSoftkeyExit:
- case EEikCmdExit:
- case EAknCmdExit:
- Exit();
- break;
- default:
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ActiveView
-// ---------------------------------------------------------------------------
-//
-TUid CFMRadioAppUi::ActiveView() const
- {
- return iView ? iView->Id() : KNullUid;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::RadioEngine
-// ---------------------------------------------------------------------------
-//
-CRadioEngine* CFMRadioAppUi::RadioEngine()
- {
- return iRadioEngine;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::Document
-// ---------------------------------------------------------------------------
-//
-CFMRadioDocument* CFMRadioAppUi::Document() const
- {
- return static_cast<CFMRadioDocument*>( CEikAppUi::Document() );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::BackSteppingWrapper
-// ---------------------------------------------------------------------------
-//
-CFMRadioBackSteppingServiceWrapper& CFMRadioAppUi::BackSteppingWrapper() const
- {
- return *iBsWrapper;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::TurnRadioOn
-// Turn the fm radio hardware on
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::TurnRadioOn()
- {
- FTRACE(FPrint(_L("CFMRadioAppUi::TurnRadioOn()")));
- if ( !iRadioEngine->IsRadioOn() )
- {
- // Force the mute state only if it wasn't already forced
- if ( iMuteStatusBeforeRadioInit == EFMUninitialized )
- {
- if ( iRadioEngine->IsMuteOn() )
- {
- FTRACE(FPrint(_L("CFMRadioAppUi::iMuteStatusBeforeRadioInit = ETrue;()")));
- iMuteStatusBeforeRadioInit = EFMMuted;
- }
- else
- {
- FTRACE(FPrint(_L("CFMRadioAppUi::iMuteStatusBeforeRadioInit = EFalse;()")));
- iMuteStatusBeforeRadioInit = EFMUnmuted;
- }
- }
- iCurrentRadioState = EFMRadioStateBusyRadioOn;
- // use mute here so we have no audio until tune event
- iRadioEngine->SetMuteOn( ETrue );
- iRadioEngine->RadioOn();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::PlayChannel
-// Tune the radio hardware to the frequency saved at the specified channel
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::PlayChannel( TInt aIndex )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::PlayChannel(%d)"), aIndex ) );
- if ( aIndex >= KMinNumberOfChannelListItems &&
- aIndex < KMaxNumberOfChannelListItems )
- {
- // Activate the channel by index
- TRAP_IGNORE( iRadioEngine->TunePresetL( aIndex ) )
- iMainView->PrepareViewForChannelChange();
-
- // Update channel list
- iChannelListView->SetNowPlayingChannel( aIndex );
- iChannelListView->SetLastListenedChannel( aIndex );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::EraseCurrentChannelL
-// Delete channel from the channel list
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::EraseChannelL( TInt aIndex )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::EraseCurrentChannelL()") ) );
-
- TBool accepted = ConfirmChannelListDeleteL( aIndex );
-
- if ( accepted )
- {
- UpdateChannelsL( EDeleteChannel, aIndex, 0 );
- UpdateChannelsL( EStoreAllToRepository, 0, 0 );
- }
- return accepted;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::RenameCurrentChannelL
-// Rename the currently selected channel
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::RenameCurrentChannelL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::RenameCurrentChannelL()") ) );
-
- TInt channelIndex = KErrNotFound;
- if ( ActiveView() == KFMRadioChannelListViewId )
- {
- channelIndex = iChannelListView->CurrentlySelectedChannel();
- }
- else
- {
- channelIndex = iRadioEngine->GetPresetIndex();
- }
- // Display the text query
- CRadioEngine::TStationName channelName = iChannels->At(channelIndex).iChannelInformation;
-
- CAknTextQueryDialog* dlg = new (ELeave) CAknTextQueryDialog( channelName, CAknQueryDialog::ENoTone );
-
- if ( dlg->ExecuteLD( R_FMRADIO_RENAME_QUERY ) )
- {
- FTRACE(FPrint(_L("CFMRadioAppUi::RenameCurrentChannelL()")));
-
- iChannels->At(channelIndex).iChannelInformation = channelName;
-
-
- iChannelListView->UpdateChannelListContentL( channelIndex,
- iChannels->At(channelIndex).iChannelInformation,
- iChannels->At(channelIndex).iChannelFrequency );
-
- UpdateChannelsL( EStoreIndexToRepository, channelIndex, 0 );
-
- iMainView->SetStationChangeType( EFMRadioStationChangeNone );
- // A channel can also be renamed from the main view
- iMainView->DisplayChannelL( channelIndex );
- // show default logo for a while
- // so that animation is stopped and it has the right channel name
- // after restart
- iMainView->ShowDefaultLogo();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::SaveChannelToLastIntoListL
-// Display listbox menu to allow user to specify a channel
-// to save currently tuned frequency to.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::SaveChannelToLastIntoListL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::SaveChannelToLastIntoListL()") ) );
- SaveChannelL( iChannels->Count() + 1 );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::SaveChannel
-// Save currently tuned frequency to the currently selected channel
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::SaveChannelL( TInt aIndex )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::SaveChannelL(%d)"), aIndex ) );
-
- TBool continueWithSave = ETrue;
- // check if channel list is full
- if ( aIndex == KMaxNumberOfChannelListItems + 1 )
- {
- CAknQueryDialog* query = CAknQueryDialog::NewL();
- if ( query->ExecuteLD( R_FMRADIO_REPLACE_EXISTING_CHANNELS_QUERY ) )
- {
- UpdateChannelsL( ERemoveAllFromRepository, 0, 0 );
- }
- else
- {
- continueWithSave = EFalse;
- }
- }
-
- if ( continueWithSave )
- {
- CFMRadioRdsReceiverBase::TFMRadioProgrammeSeviceType type =
- iRadioEngine->RdsReceiver().ProgrammeServiceNameType();
- const TDesC& channelName = type == CFMRadioRdsReceiverBase::EFMRadioPSNameStatic ?
- iRadioEngine->RdsReceiver().ProgrammeService() : KNullDesC;
-
- AddChannelToListL( channelName, iRadioEngine->GetTunedFrequency() );
- UpdateChannelsL( EStoreAllToRepository, 0, 0 );
-
- iMainView->SetStationChangeType( EFMRadioStationChangeNone );
- PlayChannel( iChannels->Count() - 1 );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ConfirmChannelListDeleteL
-// Display confirmation dialog for channel deletion
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::ConfirmChannelListDeleteL( TInt aIndex )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::ConfirmChannelListActionL( %d )"), aIndex ) );
- TInt accepted = EFalse; // Operation accepted or discarded
- TInt stringResourceId = 0; // Resource id of the prompt text
- TInt queryResourceId = R_FMRADIO_ERASE_CH_CONFIRMATION_QUERY; // Resource id of the used query dialog
-
- RBuf channelData;
- channelData.CleanupClosePushL();
-
- if ( iChannels->At( aIndex ).iChannelInformation.Length() )
- {
- stringResourceId = R_QTN_FMRADIO_QUERY_DELETE;
- channelData.CreateL( iChannels->At( aIndex ).iChannelInformation );
- }
- else
- {
- stringResourceId = R_QTN_FMRADIO_QUERY_DELETE_MHZ;
- TInt maxDecimalPlaces = iRadioEngine->DecimalCount();
- TInt channelfreq = iChannels->At( aIndex ).iChannelFrequency;
- TReal realFrequency = static_cast<TReal>( channelfreq / static_cast<TReal>( KHzConversionFactor ));
-
- channelData.CreateL( KFrequencyMaxLength );
-
- TRealFormat format( KFrequencyMaxLength, maxDecimalPlaces );
- channelData.Num( realFrequency, format );
- AknTextUtils::LanguageSpecificNumberConversion( channelData );
- }
-
- // Excecute a confirmation query with string and query resource id
- HBufC* prompt = StringLoader::LoadLC( stringResourceId, channelData, iCoeEnv );
- CAknQueryDialog* queryDlg = CAknQueryDialog::NewL();
- accepted = queryDlg->ExecuteLD( queryResourceId, *prompt );
- CleanupStack::PopAndDestroy( prompt );
- CleanupStack::PopAndDestroy( &channelData );
- return accepted;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ScanUpL
-//
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::ScanUpL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::ScanUpL()") ) );
- // Frequency is always 0 when asking engine for automatical tuning. Frequency
- // parameter is then ignored by engine when automatical tuning (seek) is requested.
- iCurrentRadioState = EFMRadioStateBusyScanUp;
-
- if ( iMainView->IsForeground() )
- {
- iMainView->SetStationChangeType( EFMRadioStationChangeScanUp );
- iMainView->SeekL(); // Show seek wait note
- }
- iRadioEngine->ScanUp();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ScanDownL
-//
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::ScanDownL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::ScanDownL()") ) );
- // Frequency is always 0 when asking engine for automatical tuning. Frequency
- // parameter is then ignored by engine when automatical tuning (seek) is requested.
- iCurrentRadioState = EFMRadioStateBusyScanDown;
-
- if ( iMainView->IsForeground() )
- {
- iMainView->SetStationChangeType( EFMRadioStationChangeScanDown );
- iMainView->SeekL(); // Show seek wait note
- }
- iRadioEngine->ScanDown();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::TuneL
-//
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::TuneL( TInt aFrequency )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::TuneL(%d)"), aFrequency ) );
- // Frequency is always 0 when asking engine for automatical tuning. Frequency
- // parameter is then ignored by engine when automatical tuning (seek) is requested.
- iCurrentRadioState = EFMRadioStateBusySeek;
-
- if (iMainView->IsForeground())
- {
- iMainView->SeekL(); // Show seek wait note
- }
-
- iRadioEngine->Tune(aFrequency);
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::UpdateVolume
-// Update the radio volume
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::UpdateVolume( CFMRadioAppUi::TFMRadioDirections aDirection )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::UpdateVolume(%d)"), UpdateVolume ) );
-
- if ( !iRadioEngine->IsInCall() )
- {
- TInt volumeControlLevel = iRadioEngine->GetVolume();
-
- TInt newVol = 0;
- if ( aDirection == EDirectionDown )
- {
- TRAP_IGNORE( ShowVolumePopupL(); )
- newVol = volumeControlLevel - 1;
-
- if ( newVol > KFMRadioMinVolumeLevel )
- {
- iRadioEngine->SetVolume( newVol );
- }
- else
- {
- iRadioEngine->SetMuteOn( ETrue );
- iRadioEngine->SetVolume( newVol );
- iActiveVolumePopupControl->SetValue( KFMRadioMinVolumeLevel );
- }
- }
- else if ( aDirection == EDirectionUp )
- {
- TRAP_IGNORE( ShowVolumePopupL(); )
- if ( iRadioEngine->IsMuteOn() )
- {
- iRadioEngine->SetMuteOn( EFalse );
- }
- newVol = volumeControlLevel + 1;
-
- if ( newVol <= KFMRadioMaxVolumeLevel )
- {
- iRadioEngine->SetVolume( newVol );
- }
- else
- {
- iActiveVolumePopupControl->SetValue( KFMRadioMaxVolumeLevel );
- }
- }
- else if ( aDirection == EDirectionNone )
- {
- //we just wish to update the UI's volume control
- HandleVolumeChangedCallback();
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::SetAudioOutput
-// Set the audio output of the radio.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::SetAudioOutput(
- CRadioEngine::TFMRadioAudioOutput aAudioOutput )
- {
- iRadioEngine->SetAudioOutput( aAudioOutput );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::CancelSeek
-// Cancel outstanding seek request.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::CancelSeek()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::CancelSeek()") ) );
- if( iCurrentRadioState == EFMRadioStateBusyScanUp ||
- iCurrentRadioState == EFMRadioStateBusyScanDown )
- {
- iRadioEngine->CancelScan(); // Seek request to engine
- }
- HandleStopSeekCallback();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::DisplayErrorNoteL
-// Displays an error note with the text contained in the passed in reference
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::DisplayErrorNoteL( TInt aErrorNote )
- {
- // Show headset missing note
- CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( ETrue );
- HBufC* noteText = StringLoader::LoadLC( aErrorNote, iCoeEnv );
- errorNote->ExecuteLD( *noteText );
- CleanupStack::PopAndDestroy( noteText );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::DisplayInformationNoteL
-// Displays an information note
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::DisplayInformationNoteL( TInt aInfoNote )
- {
- if ( !iInfoNoteOn )
- {
- CFMInformationNote* infonote = new ( ELeave ) CFMInformationNote( *this );
- HBufC* noteText = StringLoader::LoadLC( aInfoNote, iCoeEnv );
- iInfoNoteOn = ETrue;
- infonote->ExecuteLD( *noteText );
- CleanupStack::PopAndDestroy( noteText );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ExitApplication
-// Shutdown the application.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::ExitApplication()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::ExitApplication() - Start") ) );
- //this method is called twice. First will trigger the RadioOff command
- if ( iCurrentRadioState == EFMRadioStateOff ||
- iCurrentRadioState == EFMRadioStateOffForPhoneCall ||
- iCurrentRadioState == EFMRadioStateOffBeforePhoneCall )
- {
- //once we receive a radio off complete event we finish shutting down.
- FTRACE( FPrint( _L("CFMRadioAppUi::ExitApplication() - calling exit") ) );
- Exit();
- }
- else
- {
- if ( iCurrentRadioState != EFMRadioStateExiting )
- {
- iCurrentRadioState = EFMRadioStateExiting;
- FTRACE( FPrint( _L("CFMRadioAppUi::ExitApplication() - turning off, and starting timer") ) );
- iRadioEngine->RadioOff(); // Shutdown radio
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// From class CCoeAppUi
-// CFMRadioAppUi::HandleForegroundEventL
-// Application has gone to foreground/background.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleForegroundEventL( TBool aForeground )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleForegroundEventL(%d)"), aForeground ) );
- CAknViewAppUi::HandleForegroundEventL( aForeground );
-
- if ( aForeground )
- {
- if ( iStartUp )
- {
- iStartUp = EFalse;
- // Rest of startup processing may show a waiting dialog. It cannot be
- // done while processing a foreground event. So a call back is used.
- iStartupForegroundCallback = new( ELeave ) CAsyncCallBack(
- TCallBack( StaticStartupForegroundCallback, this ), CActive::EPriorityStandard );
- iStartupForegroundCallback->CallBack();
- }
- else
- {
- // Restores all resources that were released with a call to Release().
- // After this the Hitchcock user interface should be in the same state
- // in terms of resources as it was prior to the Release() call.
- //iAlfEnv->RestoreL();
-
- // Check if offline profile is activated after/when playing e.g. music player.
- // In that case we didn't show the offline query as global, so we need
- // to show it now.
- if ( IsOfflineProfileActivatedWhenRadioAudioDisabled() )
- {
- // Do not re-show the offline query if user hasn't yet answered to it.
- if ( !iShowingLocalOfflineContinueQuery )
- {
- iRadioEngine->RadioOff();
- TInt res(0);
- iShowingLocalOfflineContinueQuery = ETrue;
-
- iOfflineQueryDialogActivated = ETrue;
-
- if ( !iLocalContinueOfflineQuery )
- {
- iLocalContinueOfflineQuery = CAknQueryDialog::NewL();
- }
-
- res = iLocalContinueOfflineQuery->ExecuteLD( R_FMRADIO_CONTINUE_IN_OFFLINE_QUERY );
-
- iLocalContinueOfflineQuery = NULL;
- iOfflineQueryDialogActivated = EFalse;
- iShowingLocalOfflineContinueQuery = EFalse;
-
- if ( res )
- {
- iOfflineProfileActivatedWhenRadioAudioDisabled = EFalse;
- iRadioEngine->RadioOn();
- HandlePendingViewActivationL();
- }
- else
- {
- Exit();
- }
- }
- }
- TryToResumeAudioL();
- }
- }
- else
- {
- // Releases as many resources of the Hitchcock as possible.
- //iAlfEnv->Release( ETrue );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleRadioEngineCallBack
-// Notification from Radio Engine informing the UI when requests have
-// completed or certain events have occured that needs to be handled.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleRadioEngineCallBack(
- MRadioEngineStateChangeCallback::TFMRadioNotifyEvent aEventCode,
- TInt aErrorCode )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleRadioEngineCallBack - event %d error code: %d"), aEventCode, aErrorCode ) );
- TInt err = KErrNone;
- if ( aErrorCode == KErrNone )
- {
- switch ( aEventCode )
- {
- case EFMRadioEventTunerReady:
- HandleTunerReadyCallback();
- break;
- case EFMRadioEventRadioOn:
- iCurrentRadioState = EFMRadioStateOn;
- TRAPD( err, HandleStartupWizardL() );
- iStartupWizardHandled = ETrue;//FirstRadioInitCall = EFalse;
- if ( iAutoTune &&
- iScanLocalStationsView->CancelType() == EFMRadioCancelScanByHeadsetDisconnect)
- {
- TRAP_IGNORE( ScanUpL() );
- iAutoTune = EFalse;
- iAutoTuneUnmute = ETrue;
- }
- else if( !IsStartupWizardRunning() || err != KErrNone )
- {
- //we use method because the behaviour we require is the same.
- if ( !iTuneFromWizardActivated && iMuteStatusBeforeRadioInit != EFMUninitialized )
- {
- TBool mute = EFalse;
- if ( iMuteStatusBeforeRadioInit == EFMMuted )
- {
- mute = ETrue;
- }
- iRadioEngine->SetMuteOn( mute );
- iMuteStatusBeforeRadioInit = EFMUninitialized;
- }
- HandleStopSeekCallback();
- }
- break;
- case EFMRadioEventRadioOff:
- iCurrentRadioState = EFMRadioStateOff;
-
- if ( !iOfflineQueryDialogActivated )
- {
- ExitApplication();
- }
-
- break;
- case EFMRadioEventFMRadioInitialized:
- TRAP( err, HandleInitializedCallbackL() );
- break;
- case EFMRadioEventTune:
- if ( iTuneFromWizardActivated )
- {
- iTuneFromWizardActivated = EFalse;
- iRadioEngine->SetMuteOn( EFalse );
- iMuteStatusBeforeRadioInit = EFMUninitialized;
- }
- if( iAutoTuneUnmute )
- {
- iRadioEngine->SetMuteOn( EFalse );
- iAutoTuneUnmute = EFalse;
- }
- if ( IsStartupWizardHandled() )
- {
- HandleStopSeekCallback();
- }
- break;
- case EFMRadioEventSetMuteState:
- HandleSetMuteStateCallback();
- break;
- case EFMRadioEventVolumeUpdated:
- HandleVolumeChangedCallback();
- break;
- case EFMRadioEventSetAudioOutput:
- HandleAudioOutputSetCallback();
- break;
- case EFMRadioEventButtonPressed:
- iMainView->SetStationChangeType( EFMRadioStationChangeNext );
- PlayChannel( iChannelListView->NextChannel() );
- break;
- case EFMRadioEventHeadsetDisconnected:
- HandleHeadsetDisconnectedCallback();
- break;
- case EFMRadioEventHeadsetReconnected:
- HandleHeadsetReconnectedCallback();
- break;
- case EFMRadioEventAudioResourceLost:
- iAudioLost = ETrue;
- TRAP( err, HandleAudioResourceNotAvailableL(aErrorCode) );
- break;
- case EFMRadioEventAudioResourcePaused:
- TRAP( err, HandleAudioResourceNotAvailableL(aErrorCode) );
- break;
- case EFMRadioEventAudioResourceAvailable:
- TRAP( err, HandleAudioResourceAvailableL() );
- break;
- case EFMRadioEventCallStarted:
- if ( iCurrentRadioState != EFMRadioStateOff &&
- iCurrentRadioState != EFMRadioStateOffBeforePhoneCall )
- {
- iCurrentRadioState = EFMRadioStateOffForPhoneCall;
- }
- else
- {
- iCurrentRadioState = EFMRadioStateOffBeforePhoneCall;
- }
- FadeViewsAndShowExit( ETrue );
- break;
- case EFMRadioEventCallEnded:
- FadeViewsAndShowExit( EFalse );
- if ( iAudioLost )
- {
- TRAP_IGNORE( TryToResumeAudioL() );
- iCurrentRadioState = EFMRadioStateOff;
- }
- else if ( iCurrentRadioState == EFMRadioStateOffForPhoneCall )
- {
- TurnRadioOn();
- }
- else
- {
- // Do nothing.
- }
- break;
- case EFMRadioEventStandbyMode:
- ExitApplication();
- break;
- case EFMRadioEventFlightModeEnabled:
- TRAP( err, HandleFlightModeEnabledCallbackL() );
- break;
- case EFMRadioEventFlightModeDisabled:
- HandleFlightModeDisabledCallback();
- break;
- case EFMRadioEventFMTransmitterOn:
- TRAP_IGNORE( HandleFMTransmitterOnCallbackL() );
- break;
- case EFMRadioEventFreqRangeChanged:
- HandleFreqRangeChangedCallback();
- break;
- case EFMRadioEventScanLocalStationsCanceled:
- {
- HandleStopSeekCallback();
- SetStartupWizardRunning( EFalse );
- break;
- }
- default:
- break;
- }
- }
- else
- {
- switch ( aEventCode )
- {
- case EFMRadioEventAudioResourceLost:
- iAudioLost = ETrue;
- TRAP( err, HandleAudioResourceNotAvailableL( aErrorCode ) );
- break;
- case EFMRadioEventAudioResourcePaused:
- TRAP( err, HandleAudioResourceNotAvailableL( aErrorCode ) );
- break;
- case EFMRadioEventTune:
- if ( iTuneFromWizardActivated )
- {
- iTuneFromWizardActivated = EFalse;
- iRadioEngine->SetMuteOn( EFalse );
- iMuteStatusBeforeRadioInit = EFMUninitialized;
- }
-
- if ( aErrorCode == KFmRadioErrAntennaNotConnected )
- {
- iScanLocalStationsView->SetScanCanceled(EFMRadioCancelScanByHeadsetDisconnect);
- }
-
- HandleStopSeekCallback();
- break;
- case EFMRadioEventCallStarted:
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleRadioEngineCallBack() error -> EFMRadioEventCallStarted ") ) );
- if ( iCurrentRadioState != EFMRadioStateOff &&
- iCurrentRadioState != EFMRadioStateOffBeforePhoneCall )
- {
- iCurrentRadioState = EFMRadioStateOffForPhoneCall;
- }
- else
- {
- iCurrentRadioState = EFMRadioStateOffBeforePhoneCall;
- }
- FadeViewsAndShowExit( ETrue );
- break;
- }
- default:
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleRadioEngineCallBack() failed to process event.") ) );
- break;
- }
- }
-
- FTRACE( FPrint( _L("END CFMRadioAppUi::HandleRadioEngineCallBack()") ) );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleVolumeChangedCallback
-// Processes "volume changed" callback
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleVolumeChangedCallback()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleVolumeChangedCallback() Start") ) );
- if ( !iRadioEngine->IsMuteOn() )
- {
- TInt newVolume = iRadioEngine->GetVolume(); // current volume
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleVolumeChangedCallback() - volume now %d "), newVolume ) );
- iActiveVolumePopupControl->SetValue( newVolume );
- }
- else
- {
- iActiveVolumePopupControl->SetValue( KFMRadioMinVolumeLevel );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleInitializedCallbackL
-// The initialization of the radio is completed, the radio can be turned on if
-// not in call.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleInitializedCallbackL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleInitializedCallbackL() Start") ) );
- if( iCurrentRadioState != EFMRadioStateOffForPhoneCall &&
- iCurrentRadioState != EFMRadioStateOffBeforePhoneCall )
- {
- TurnRadioOn();
- if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
- {
- iActiveVolumePopupControl = iIhfVolumePopupControl;
- }
- else
- {
- iActiveVolumePopupControl = iHeadsetVolumePopupControl;
- }
- HandleVolumeChangedCallback();
- }
- }
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::FadeViewsAndShowExit
-// fade and show exit for all views
-// ---------------------------------------------------------------------------
-//
-
-void CFMRadioAppUi::FadeViewsAndShowExit( TBool aState )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::FadeViewsAndShowExit( Tbool %d )"), aState ) );
- iMainView->FadeAndShowExit( aState );
- iChannelListView->FadeAndShowExit( aState );
- iScanLocalStationsView->FadeAndShowExit( aState );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleAudioResourceAvailableL
-// When audio resource is available, we would resume the radio.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleAudioResourceAvailableL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleAudioResourceAvailableL") ) );
-
- iAudioResourceAvailable = ETrue;
-
- if ( !IsOfflineProfileActivatedWhenRadioAudioDisabled() &&
- !( iGlobalOfflineQuery && iGlobalOfflineQuery->IsActive() ) )
- {
- if ( ( ( iFMRadioVariationFlags & KFMRadioInternalAntennaSupported) ||
- iRadioEngine->IsHeadsetConnected() ) && !iAudioLost && !iRadioEngine->IsInCall() )
- {
- TurnRadioOn();
- }
- else if ( iAudioLost &&
- iRadioEngine->IsHeadsetConnected() )
- {
- TryToResumeAudioL();
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleAudioResourceNotAvailableL
-// Handles the cases when the radio is interrupted due to:
-// 1. Call setup/in progress
-// 2. Higher priority audio
-// ---------------------------------------------------------------------------
-
-void CFMRadioAppUi::HandleAudioResourceNotAvailableL( TInt FDEBUGVAR(aError) )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleAudioResourceNotAvailableL() error code: %d"),
- aError ) );
-
- SetStartupWizardRunning( EFalse );
- iAudioResourceAvailable = EFalse;
-
- if ( iCurrentRadioState != EFMRadioStateOffForPhoneCall &&
- iCurrentRadioState != EFMRadioStateOffBeforePhoneCall )
- {
- iCurrentRadioState = EFMRadioStateOff;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleHeadsetDisconnectedCallback
-// Take actions when the headset is disconnected.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleHeadsetDisconnectedCallback()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleHeadsetDisconnectedCallback" ) ) );
-
- if ( iFMRadioVariationFlags & KFMRadioInternalAntennaSupported )
- {
- SetAudioOutput( CRadioEngine::EFMRadioOutputIHF );
- }
- else
- {
- // radio is already turned off, and if it was tuning it was canceled
- iCurrentRadioState = EFMRadioStateOff;
- TRAP_IGNORE( ShowConnectHeadsetDialogL() );
- }
-
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleHeadsetReconnectedCallback
-// Take actions when the headset is reconnected.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleHeadsetReconnectedCallback()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleHeadsetReconnectedCallback()") ) );
- if ( iConnectHeadsetQuery )
- {
- delete iConnectHeadsetQuery;
- iConnectHeadsetQuery = NULL;
- }
-
- //compare bitmask to see if feature supported
- if ( !(iFMRadioVariationFlags & KFMRadioInternalAntennaSupported) &&
- iCurrentRadioState != EFMRadioStateOffForPhoneCall &&
- iCurrentRadioState != EFMRadioStateOffBeforePhoneCall )
- {
- // active offline query controls radio on/off
- if ( iAudioLost )
- {
- TRAP_IGNORE( TryToResumeAudioL() );
- }
- else if ( ( iGlobalOfflineQuery && !iGlobalOfflineQuery->IsActive() ) ||
- !iGlobalOfflineQuery )
- {
- iRadioEngine->InitializeRadio();
- }
- HandleVolumeChangedCallback();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleManualTuneFailedCallback
-// Processes "manual tune failed" callback
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleManualTuneFailedCallback()
- {
- HandleStopSeekCallback();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleVolumeUpdateFailedCallback
-// Processes "volume update failed" callback
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleVolumeUpdateFailedCallback()
- {
- HandleVolumeChangedCallback();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleMuteCallback
-// Processes "radio volume muted" callback
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleSetMuteStateCallback()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleSetMuteStateCallback()")) );
- HandleVolumeChangedCallback();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleStopSeekCallback
-// Processes "seek operation completed" callback
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleStopSeekCallback()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleStopSeekCallback() state %d "), iCurrentRadioState) );
-
- if ( iCurrentRadioState == EFMRadioStateBusyManualTune ||
- iCurrentRadioState == EFMRadioStateBusyScanUp ||
- iCurrentRadioState == EFMRadioStateBusyScanDown ||
- iCurrentRadioState == EFMRadioStateBusySeek ||
- iCurrentRadioState == EFMRadioStateBusyScanLocalStations )
- {
- iCurrentRadioState = EFMRadioStateOn; // Update state
- }
-
- const TUid activeViewTuid = ActiveView();
-
- if ( activeViewTuid == KFMRadioMainViewId )
- {
- TRAP_IGNORE( iMainView->StopSeekL() )
- }
- else if ( activeViewTuid == KFMRadioChannelListViewId )
- {
- TRAP_IGNORE( iChannelListView->StopSeekL() )
- }
- else if ( activeViewTuid == KFMRadioScanLocalStationsViewId )
- {
- TRAP_IGNORE( iScanLocalStationsView->StopSeekL() )
- }
- else
- {
- // nop
- }
-
- FTRACE( FPrint( _L("end CFMRadioAppUi::HandleStopSeekCallback") ) );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleAudioOutputSetCallback
-// Processes "set audio output completed" callback
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleAudioOutputSetCallback()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleAudioOutputSetCallback()")) );
- if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
- {
- iActiveVolumePopupControl = iIhfVolumePopupControl;
- }
- else
- {
- iActiveVolumePopupControl = iHeadsetVolumePopupControl;
- }
-
- // restore volume for current output
- TInt volumeLevel = iRadioEngine->GetVolume();
- iRadioEngine->SetVolume( volumeLevel );
-
- if ( iCurrentRadioState != EFMRadioStateBusyScanLocalStations )
- {
- iRadioEngine->SetMuteOn( EFalse );
- }
-
- TUid view = ActiveView();
-
- if ( view == KFMRadioScanLocalStationsViewId )
- {
- iScanLocalStationsView->UpdateToolbar();
- }
- else if ( view == KFMRadioChannelListViewId )
- {
- iChannelListView->UpdateToolbar();
- }
- else if ( view == KFMRadioMainViewId )
- {
- CAknView* mainView = View( KFMRadioMainViewId );
- if ( mainView )
- {
- // force update for toolbar extension view
- mainView->Toolbar()->ToolbarExtension()->SetShown( EFalse );
- }
- }
- else
- {
- // NOP
- }
-
- // So the views can dynamically change the option menu
- StopDisplayingMenuBar(); // force update for menu bar
- // Force UI update
- HandleVolumeChangedCallback();
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioAppUi::HandleWsEventL
-// --------------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleWsEventL - event %d "), aEvent.Type() ) );
- switch ( aEvent.Type() )
- {
- case EEventFocusLost:
- // being sent to background, so if tuning cancel first then handle event
- if( iCurrentRadioState == EFMRadioStateBusyScanUp ||
- iCurrentRadioState == EFMRadioStateBusyScanDown )
- {
- iRadioEngine->CancelScan();
- HandleStopSeekCallback();
- }
- CAknViewAppUi::HandleWsEventL(aEvent, aDestination);
- break;
- case EEventFocusGained:
- // override default behavior of unfading the ui
- // can be taken out when auto resume is implemented
- CAknViewAppUi::HandleWsEventL(aEvent, aDestination);
- if (iMainView)
- {
- iMainView->UpdateDisplayForFocusGained();
- }
- if (iChannelListView)
- {
- iChannelListView->UpdateDisplayForFocusGained();
- }
- if (iScanLocalStationsView)
- {
- iScanLocalStationsView->UpdateDisplayForFocusGained();
- }
- break;
- default:
- CAknViewAppUi::HandleWsEventL(aEvent, aDestination);
- break;
- }
- }
-
-// ----------------------------------------------------------------------------------------------------
-// CFMRadioAppUi::FMRadioSvkChangeVolumeL
-// Handles the change in the Volume that is needed as per the Side Volume Key
-// events.
-// ----------------------------------------------------------------------------------------------------
-//
-void CFMRadioAppUi::FMRadioSvkChangeVolumeL( TInt aVolumeChange )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::FMRadioSvkRemoveVolumeL() aVolumeChange : %d"), aVolumeChange ) );
-
- TBool headsetConnected = iRadioEngine->IsHeadsetConnected();
-
- if ( iCurrentRadioState != EFMRadioStateBusyScanLocalStations && IsStartupWizardHandled() &&
- headsetConnected )
- {
- if ( aVolumeChange > 0 ) // up direction
- {
- UpdateVolume( EDirectionUp );
- }
- else // down direction
- {
- UpdateVolume( EDirectionDown );
- }
- }
- }
-
-// ----------------------------------------------------------------------------------------------------
-// CFMRadioAppUi::FMRadioSvkRemoveVolumeL
-// Handles the remove Volume option that is needed depending on the duration of the
-// Side Volume Key press
-// ----------------------------------------------------------------------------------------------------
-//
-void CFMRadioAppUi::FMRadioSvkRemoveVolumeL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::FMRadioSvkRemoveVolumeL( )") ) );
- }
-
-
-// ----------------------------------------------------------------------------------------------------
-// CFMRadioAppUi::FMRadioHeadsetEvent
-// Handles the Headset button pressed
-// ----------------------------------------------------------------------------------------------------
-
-void CFMRadioAppUi::FMRadioHeadsetEvent( TAccessoryEvent aEvent )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::FMRadioHeadsetEvent event: %d "), aEvent ) );
- switch ( aEvent )
- {
- case EForward:
- {
- if ( ActiveView() == KFMRadioScanLocalStationsViewId &&
- iCurrentRadioState != EFMRadioStateBusyScanLocalStations )
- {
- // change channels in scan local stations view
- TRAP_IGNORE( iScanLocalStationsView->HandleScanListRemConEventL( aEvent ) )
- }
- else
- {
- TRAP_IGNORE( HandleCommandL( EFMRadioCmdNextChannel ) )
- }
- break;
- }
- case ERewind:
- {
- if ( ActiveView() == KFMRadioScanLocalStationsViewId &&
- iCurrentRadioState != EFMRadioStateBusyScanLocalStations )
- {
- TRAP_IGNORE( iScanLocalStationsView->HandleScanListRemConEventL( aEvent ) )
- }
- else
- {
- TRAP_IGNORE( HandleCommandL( EFMRadioCmdPrevChannel ) )
- }
- break;
- }
- case EStop:
- {
- if ( iCurrentRadioState != EFMRadioStateBusyScanLocalStations && IsStartupWizardHandled() )
- {
- iRadioEngine->SetMuteOn( ETrue );
- }
- break;
- }
- case EPausePlay:
- {
- if ( iCurrentRadioState != EFMRadioStateBusyScanLocalStations && IsStartupWizardHandled() )
- {
- HandleMuteCommand();
- }
- break;
- }
- default:
- break;
- }
- }
-
-// ----------------------------------------------------------------------------------------------------
-// CFMRadioAppUi::HandleResourceChangeL
-// ----------------------------------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleResourceChangeL( TInt aType )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleResourceChangeL type: %d "), aType ) );
- CAknViewAppUi::HandleResourceChangeL( aType );
-
- if ( aType == KEikDynamicLayoutVariantSwitch )
- {
- UpdateLandscapeInformation();
- iLayoutChangeObserver->LayoutChangedL( aType );
- }
- else if ( aType == KAknsMessageSkinChange )
- {
- iLayoutChangeObserver->LayoutChangedL( aType );
- }
- }
-
-// ----------------------------------------------------------------------------------------------------
-// Handles MCoeControl events
-// ----------------------------------------------------------------------------------------------------
-void CFMRadioAppUi::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleControlEventL - aEventID = %d"), aEventType) );
- if ( (aEventType == EEventStateChanged) &&
- ( aControl == iActiveVolumePopupControl ) )
- {
- TInt volumeControlLevel = iActiveVolumePopupControl->Value();
- // Set mute
- if ( volumeControlLevel == KFMRadioMinVolumeLevel )
- {
- // Mute status could change from toolbar, svk or pointer event
- if ( !iRadioEngine->IsMuteOn() )
- {
- iRadioEngine->SetMuteOn( ETrue );
- }
- }
- else
- {
- iRadioEngine->SetMuteOn( EFalse );
- }
-
- // Make sure volume level is in range
- if ( volumeControlLevel < KFMRadioMinVolumeLevel )
- {
- volumeControlLevel = KFMRadioMinVolumeLevel;
- }
- else if ( volumeControlLevel > KFMRadioMaxVolumeLevel )
- {
- volumeControlLevel = KFMRadioMaxVolumeLevel;
- }
-
- // Set volume. If volume is muted we dont want to set it to iRadioEngine
- if ( !iRadioEngine->IsMuteOn() )
- {
- iRadioEngine->SetVolume( volumeControlLevel );
- }
- }
- }
-
-// ----------------------------------------------------------------------------------------------------
-// DialogTerminated
-// ----------------------------------------------------------------------------------------------------
-void CFMRadioAppUi::DialogTerminated()
- {
- iInfoNoteOn = EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::UpdateLandscapeInformation
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::UpdateLandscapeInformation()
- {
- TSize screenSize;
-
- AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EScreen, screenSize );
-
- // Is it portrait or landscape, compare height and width, since we can't
- // be sure if EGraphicsOrientationNormal is portrait or landscape
- if ( screenSize.iHeight < screenSize.iWidth )
- {
- iLandscape = ETrue;
- }
- else
- {
- iLandscape = EFalse;
- }
- }
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::UpdateChannelsL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::UpdateChannelsL( TMoveoperations aOperation,
- TInt aIndex, TInt aMovedToNewIndex )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::UpdateChannelsL(%d, %d, %d)"), aOperation, aIndex, aMovedToNewIndex ) );
- TChannelInformation channelinfo;
-
- // Move channel operation moves channel from aIndex to aMovedToNewIndex value
- if ( EMoveChannels == aOperation )
- {
- channelinfo = iChannels->At( aIndex );
- iChannels->Delete( aIndex );
- iChannels->InsertL( aMovedToNewIndex, channelinfo );
- }
- // Delete channel deletes channel from list
- else if( EDeleteChannel == aOperation )
- {
- iChannels->Delete( aIndex );
-
- for ( TInt index = 0; index < iChannels->Count(); index++ )
- {
- iRadioEngine->SetPresetNameFrequencyL(
- index,
- iChannels->At( index ).iChannelInformation,
- iChannels->At( index ).iChannelFrequency );
- }
-
- CRadioEngine::TStationName emptyStationName;
- // Remove last
- iRadioEngine->SetPresetNameFrequencyL( iChannels->Count(), emptyStationName, KErrNotFound );
- }
- // Store all channels to repository
- else if ( EStoreAllToRepository == aOperation )
- {
- for ( TInt index = 0; index < iChannels->Count(); index++ )
- {
- iRadioEngine->SetPresetNameFrequencyL(
- index,
- iChannels->At( index ).iChannelInformation,
- iChannels->At( index ).iChannelFrequency );
- }
- }
- // Store specified index to repository and same index
- else if (EStoreIndexToRepository== aOperation )
- {
- iRadioEngine->SetPresetNameFrequencyL(
- aIndex,
- iChannels->At( aIndex ).iChannelInformation,
- iChannels->At( aIndex ).iChannelFrequency );
-
- }
- else if ( ERemoveAllFromRepository == aOperation )
- {
- CRadioEngine::TStationName emptyStationName;
-
- for ( TInt i = 0; i < iChannels->Count(); i++ )
- {
- iRadioEngine->SetPresetNameFrequencyL( i, emptyStationName, KErrNotFound );
- }
- iChannels->Reset();
- }
-
- iRadioEngine->PubSubL().PublishPresetCountL( iChannels->Count() );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::AddChannelToListL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::AddChannelToListL( const TDesC& aChannelName, TInt aChannelFreq )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::AddChannelToListL(%S, %d)"), &aChannelName, aChannelFreq ) );
- TChannelInformation channelinfo;
- channelinfo.iChannelInformation = aChannelName;
- channelinfo.iChannelFrequency = aChannelFreq;
- iChannels->AppendL( channelinfo );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::IsLandscapeOrientation
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::IsLandscapeOrientation() const
- {
- return iLandscape;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ChooseLayoutResource
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioAppUi::ChooseLayoutResource( TInt aNormalPortraitRes,
- TInt aMirroredPortraitRes, TInt aNormalLandscapeRes,
- TInt aMirroredLandscapeRes ) const
- {
- TInt resId = 0;
-
- if ( IsLandscapeOrientation() )
- {
- if ( AknLayoutUtils::LayoutMirrored() )
- {
- resId = aMirroredLandscapeRes;
- }
- else
- {
- resId = aNormalLandscapeRes;
- }
- }
- else
- {
- if ( AknLayoutUtils::LayoutMirrored() )
- {
- resId = aMirroredPortraitRes;
- }
- else
- {
- resId = aNormalPortraitRes;
- }
- }
- return resId;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::IsLayoutMirrored
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::IsLayoutMirrored() const
- {
- return AknLayoutUtils::LayoutMirrored();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleFlightModeEnabledCallbackL
-// Displays continue offline query.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleFlightModeEnabledCallbackL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleFlightModeEnabledCallbackL" ) ) );
-
- // If off-line profile is activated when no other app
- // (that would disable auto resume) is playing (or has played)
- // audio, a global confirmation query is displayed.
- if ( iAudioResourceAvailable )
- {
- iRadioEngine->RadioOff();
-
- if ( !iGlobalOfflineQuery )
- {
- iGlobalOfflineQuery = CFMRadioGlobalConfirmationQuery::NewL( this );
- }
-
- HBufC* text = StringLoader::LoadLC( R_QTN_FMRADIO_QUERY_OFFLINE_USE, iCoeEnv );
-
- iOfflineQueryDialogActivated = ETrue;
- iGlobalOfflineQuery->ShowQueryL( *text, R_AVKON_SOFTKEYS_YES_NO, R_QGN_NOTE_QUERY_ANIM );
-
- CleanupStack::PopAndDestroy( text );
- }
-
- // Do the next when offline query wasn't already on the screen.
- // That could happen when user changes profiles without
- // answering to the query.
- else if (!iGlobalOfflineQuery || !iGlobalOfflineQuery->IsActive())
- {
- iOfflineProfileActivatedWhenRadioAudioDisabled = ETrue;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleFlightModeDisabledCallback
-// Close query dialog.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleFlightModeDisabledCallback()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleFlightModeDisabledCallback" ) ) );
- iOfflineProfileActivatedWhenRadioAudioDisabled = EFalse;
-
- // Close continue offline query
- if ( iLocalContinueOfflineQuery && iLocalContinueOfflineQuery->IsVisible() )
- {
- TRAP_IGNORE( iLocalContinueOfflineQuery->DismissQueryL() );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::StaticStartupForegroundCallback
-// takes care of some delayed initialisation
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioAppUi::StaticStartupForegroundCallback( TAny* aSelfPtr )
- {
- CFMRadioAppUi* self = reinterpret_cast<CFMRadioAppUi*>( aSelfPtr );
- if ( self )
- {
- delete self->iStartupForegroundCallback;
- self->iStartupForegroundCallback = NULL;
-
- TRAPD( err, self->HandleStartupForegroundEventL() )
- if ( err )
- {
- // Shutdown the application
- CEikonEnv* eikonEnv = CEikonEnv::Static();
- TApaTask task( eikonEnv->WsSession() );
- task.SetWgId( eikonEnv->RootWin().Identifier() );
- task.EndTask();
- }
- }
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleStartupForegroundEventL
-// Note that leaving from this fuction will cause exit of
-// FM Radio (on purpose)!
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleStartupForegroundEventL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleStartupForegroundEventL" ) ) );
- HandleOfflineModeAtStartUpL();
- TFMRadioRegionSetting region = HandleRegionsAtStartUpL();
- iRadioEngine->SetRegionIdL( region );
- HandlePendingViewActivationL();
- RequestTunerControl();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleOfflineModeAtStartUpL
-// Handles offline mode at startup.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleOfflineModeAtStartUpL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleOfflineModeAtStartUpL" ) ) );
- if ( iRadioEngine->IsOfflineProfileL() )
- {
- iOfflineQueryDialogActivated = ETrue;
-
- if ( AknLayoutUtils::PenEnabled() )
- {
- // We must hide toolbar, otherwise query dialog softkeys doesn't work
- ShowToolbar( EFalse );
- }
-
- iLocalActivateOfflineQuery = CAknQueryDialog::NewL();
- TInt result = iLocalActivateOfflineQuery->ExecuteLD( R_FMRADIO_ACTIVATE_IN_OFFLINE_QUERY );
- iLocalActivateOfflineQuery = NULL;
-
- iOfflineQueryDialogActivated = EFalse;
-
- if ( result )
- {
- if ( AknLayoutUtils::PenEnabled() )
- {
- ShowToolbar( ETrue );
- }
- }
- else
- {
- Exit();
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ShowToolbar
-// Sets toolbar visibility. This function is used to hide toolbar component
-// while query dialog is shown.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::ShowToolbar( TBool aVisible )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::ShowToolbar(%d)"), aVisible ) );
- if ( iLayoutChangeObserver == iMainView )
- {
- iMainView->ShowToolbar( aVisible );
- }
- else if ( iLayoutChangeObserver == iScanLocalStationsView )
- {
- iScanLocalStationsView->ShowToolbar( aVisible );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::IsOfflineProfileActivatedWhenRadioAudioDisabled
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::IsOfflineProfileActivatedWhenRadioAudioDisabled() const
- {
- return iOfflineProfileActivatedWhenRadioAudioDisabled;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleFMTransmitterOnCallback
-// Displays note about transmitter being activated and
-// fade the UI.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleFMTransmitterOnCallbackL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleFMTransmitterOnCallbackL()") ) );
- iCurrentRadioState = EFMRadioStateOff;
- if ( IsStartupWizardHandled() )
- {
- // Wizard is allready handled so this callback is not coming
- // in startup phase
- HBufC* closeAppText = StringLoader::LoadLC( R_QTN_FMRADIO_NOTE_FMTX_CLOSE_APPLICATION, iCoeEnv );
-
- CAknGlobalNote* fmTransmitterGlobalNote = CAknGlobalNote::NewLC();
- fmTransmitterGlobalNote->ShowNoteL( EAknGlobalInformationNote, *closeAppText );
- CleanupStack::PopAndDestroy( fmTransmitterGlobalNote );
-
- CleanupStack::PopAndDestroy( closeAppText );
- }
- else
- {
- HBufC* unableToStartText = StringLoader::LoadLC( R_QTN_FMRADIO_NOTE_FMTX_UNABLE_TO_START, iCoeEnv );
-
- CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
- note->ExecuteLD( *unableToStartText );
-
- CleanupStack::PopAndDestroy( unableToStartText );
- }
- // check if we have any dialogs open and close them manually
- if ( IsDisplayingDialog() )
- {
- TKeyEvent key;
- key.iRepeats = 0;
- key.iCode = EKeyEscape;
- key.iModifiers = 0;
-
- iCoeEnv->SimulateKeyEventL( key, EEventKey );
- // in case there is still dialog on the screen
- if ( IsDisplayingDialog() )
- {
- iCoeEnv->SimulateKeyEventL( key, EEventKey );
- }
- }
- // Shutdown the application
- TApaTask task( iCoeEnv->WsSession() );
- task.SetWgId( iCoeEnv->RootWin().Identifier() );
- task.EndTask();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleFreqRangeChangedCallback
-// Frequency range changed.
-// Current handling is to exit the application since
-// the UI specification doesn't specify how this should
-// be handled.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleFreqRangeChangedCallback()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleFreqRangeChangedCallback()") ) );
- iCurrentRadioState = EFMRadioStateOff;
- Exit();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleMuteCommand
-// Handles mute keypress from main view
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleMuteCommand()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleMuteCommand" ) ) );
- if ( iRadioEngine->IsMuteOn() )
- {
- iRadioEngine->SetMuteOn( EFalse );
- }
- else
- {
- iRadioEngine->SetMuteOn( ETrue );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleRegionsAtStartUpL
-// get region automatically from network or manually by user choice if network
-// is not available
-// ---------------------------------------------------------------------------
-//
-TFMRadioRegionSetting CFMRadioAppUi::HandleRegionsAtStartUpL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleRegionsAtStartUpL()")) );
- TFMRadioRegionSetting region = iRadioEngine->GetRegionL();
-
- if ( region == EFMRadioRegionNone )
- {
- ShowToolbar( EFalse );
- TInt index = 0;
-
- CDesCArraySeg* regionList = new( ELeave ) CDesCArraySeg( KDefaultRegionArrayGranularity );
- CleanupStack::PushL( regionList );
-
- iRadioEngine->FillListWithRegionDataL( *regionList );
-
- CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( &index );
-
- dlg->PrepareLC( R_FMRADIO_SELECT_REGION_QUERY );
- CTextListBoxModel* model =
- static_cast<CAknListQueryControl*>( dlg->ListControl() )->listbox()->Model();
- model->SetItemTextArray( regionList );
- model->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Array won't be deleted here
-
- TInt ret = dlg->RunLD();
- CleanupStack::PopAndDestroy( regionList );
-
- if ( ret != EAknSoftkeyExit )
- {
- // We should have a proper region selected by user
- region = iRadioEngine->RegionIdAtIndex( index );
- }
-
- if ( region == EFMRadioRegionNone )
- {
- Exit(); // This will eventually exit FMRadio.
- }
- else
- {
- HBufC* bandSetText = StringLoader::LoadLC( R_QTN_FMRADIO_CONF_FREQ_BAND_SET_MANUAL, iCoeEnv );
- CAknInformationNote* note = new( ELeave ) CAknInformationNote( ETrue );
- note->ExecuteLD( *bandSetText );
- CleanupStack::PopAndDestroy( bandSetText );
- if ( AknLayoutUtils::PenEnabled() )
- {
- ShowToolbar( ETrue );
- }
- }
- }
- else
- {
- // Region is known
- if ( region != iRadioEngine->RegionId() )
- {
- TInt previousRegion = iRadioEngine->RegionId();
-
- if ( previousRegion != EFMRadioRegionNone )
- {
- // Show note only if the region has changed from a concrete
- // one to another concrete one. EFMRadioRegionNone is not
- // a concrete one (first startup case) -- don't show note.
- HBufC* bandSetText = StringLoader::LoadLC( R_QTN_FMRADIO_CONF_FREQ_BAND_SET_AUTOM, iCoeEnv );
- CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
- note->ExecuteLD( *bandSetText );
- CleanupStack::PopAndDestroy( bandSetText );
- }
- }
- }
-
- return region;
- }
-
-// ---------------------------------------------------------------------------
-// From class MFMRadioGlobalConfirmationQueryObserver. Callback function
-// that is called when global confirmation query is dismissed.
-// CFMRadioAppUi::GlobalConfirmationQueryDismissedL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::GlobalConfirmationQueryDismissedL(TInt aSoftKey)
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::GlobalConfirmationQueryDismissedL()")) );
- iOfflineQueryDialogActivated = EFalse;
-
- if ( aSoftKey == EAknSoftkeyYes )
- {
- iOfflineProfileActivatedWhenRadioAudioDisabled = EFalse;
- iRadioEngine->RadioOn();
- HandlePendingViewActivationL();
- }
- else
- {
- // Shutdown the application
- TApaTask task( iCoeEnv->WsSession() );
- task.SetWgId( iCoeEnv->RootWin().Identifier() );
- task.EndTask();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::RequestTunerControl
-// request tuner control from engine
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::RequestTunerControl() const
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::RequestTunerControl()")) );
- iRadioEngine->RequestTunerControl();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::NumberOfChannelsStored
-// return number of channels saved to the presets
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioAppUi::NumberOfChannelsStored() const
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::NumberOfChannelsStored()")) );
- return iChannels->Count();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleStartupWizard
-// Determine if "Scan all channels" in scan local stations view should be started.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleStartupWizardL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleStartupWizardL()")) );
- if ( !IsStartupWizardHandled() )
- {
- // Call to iRadioEngine->UpdatedStartupCount()
- // increases startup count by one and returns amount of app startups.
- TInt startupCount = iRadioEngine->UpdatedStartupCount();
- if ( startupCount <= KMaxStartupTimesToAskSaveWizard &&
- NumberOfChannelsStored() == 0 )
- {
- SetStartupWizardRunning( ETrue );
- ActivateLocalViewL( iScanLocalStationsView->Id() );
- }
- else // check IAD update here
- {
- HandleIADUpdateCheckL();
- }
- }
- }
-
-// --------------------------------------------------------------------------
-// CFMRadioAppUi::IsStartupWizardRunning
-// Return startup scanning wizard status.
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::IsStartupWizardRunning() const
- {
- return iStartupWizardRunning;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::SetStartupWizardRunning
-// Set startup scanning wizard status.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::SetStartupWizardRunning( const TBool aRunningState )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::SetStartupWizardRunning() - state = %d"), aRunningState) );
- iStartupWizardRunning = aRunningState;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::StartLocalStationsSeekL
-// Start local stations scan
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::StartLocalStationsSeekL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::StartLocalStationsSeekL()")) );
- iCurrentRadioState = EFMRadioStateBusyScanLocalStations;
- iRadioEngine->ScanUp();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::TryToResumeAudioL
-// Show Audio Preempted query
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::TryToResumeAudioL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::TryToResumeAudioL" ) ) );
- TFMRadioRegionSetting region = iRadioEngine->GetRegionL();
- if ( iAudioLost &&
- IsForeground() &&
- !iOfflineQueryDialogActivated &&
- region != EFMRadioRegionNone )
- {
- iAudioLost = EFalse;
- iRadioEngine->InitializeRadio();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ShowConnectHeadsetDialogL
-// Show connect headset query with only exit softkey
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::ShowConnectHeadsetDialogL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::ShowConnectHeadsetDialogL" ) ) );
- if ( !iConnectHeadsetQuery && !iConnectHeadsetGlobalNote )
- {
- HBufC* noteTxt = StringLoader::LoadLC( R_QTN_FMRADIO_ERROR_CON_HEADSET, iCoeEnv );
-
- // if radio is in background, show also global note
- if ( !IsForeground() )
- {
- iConnectHeadsetGlobalNote = CAknGlobalNote::NewL();
- iConnectHeadsetGlobalNote->ShowNoteL( EAknGlobalInformationNote, *noteTxt );
- delete iConnectHeadsetGlobalNote;
- iConnectHeadsetGlobalNote = NULL;
- }
-
- iConnectHeadsetQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
- TInt ret = iConnectHeadsetQuery->ExecuteLD( R_FMRADIO_CONNECT_HEADSET_NOTE, *noteTxt );
-
- CleanupStack::PopAndDestroy( noteTxt );
-
- if ( iConnectHeadsetQuery )
- {
- iConnectHeadsetQuery = NULL;
- if ( ret == EAknSoftkeyExit )
- {
- TApaTask task( iCoeEnv->WsSession() );
- task.SetWgId( iCoeEnv->RootWin().Identifier() );
- task.EndTask();
- }
- else
- {
- HandlePendingViewActivationL();
- }
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ShowVolumePopupL
-// Show currently active volume popup
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::ShowVolumePopupL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::ShowVolumePopupL" ) ) );
- if ( !iRadioEngine->IsInCall() )
- {
- if ( iActiveVolumePopupControl )
- {
- if ( IsForeground() || ( IsActiveIdleEnabled() && IsIdleAppForeground() ) )
- {
- iActiveVolumePopupControl->ShowVolumePopupL();
- }
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::GetCurrentHelpContext
-// get help context based on currently active view
-// ---------------------------------------------------------------------------
-//
-CArrayFix<TCoeHelpContext>* CFMRadioAppUi::GetCurrentHelpContextL() const
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::GetCurrentHelpContextL" ) ) );
-#if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE
- // currently main container and manual tuning container are derived from CBase
- // so lets create help array manually for them
- CArrayFixFlat<TCoeHelpContext>* helpArray = new( ELeave )
- CArrayFixFlat<TCoeHelpContext>( 1 );
- CleanupStack::PushL( helpArray );
- helpArray->AppendL( TCoeHelpContext( TUid::Uid( KUidFMRadioApplication ), KFMRADIO_HLP_MAIN ) );
- CleanupStack::Pop( helpArray );
- return helpArray;
-#else
- return AppHelpContextL();
-#endif
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::GetChannelsArrayL
-// Get channels array list from radio engine
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::GetChannelsArrayL()
- {
- FTRACE( FPrint( _L("CFMRadioChannelListView::GetChannelsArrayL Start") ) );
-
- // Note: KMaxNumberOfChannelListItems can be setted to any supported max value
- for ( TInt index = 0; index < KMaxNumberOfChannelListItems; index++ )
- {
- TChannelInformation channelinfo;
-
- iRadioEngine->GetPresetNameAndFrequencyL( index,
- channelinfo.iChannelInformation,
- channelinfo.iChannelFrequency );
-
- if ( channelinfo.iChannelFrequency != KErrNotFound )
- {
- FTRACE( FPrint( _L("CFMRadioChannelListView::ChannelInUse inside if") ) );
- iChannels->AppendL( channelinfo );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// From class CEikAppUi.
-// Handles window server messages.
-// ---------------------------------------------------------------------------
-//
-MCoeMessageObserver::TMessageResponse CFMRadioAppUi::HandleMessageL(
- TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid,
- const TDesC8& aMessageParameters )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio-- CFMRadioAppUi::HandleMessageL" )));
-
- TMessageResponse resp = CAknViewAppUi::HandleMessageL(
- aClientHandleOfTargetWindowGroup, aMessageUid, aMessageParameters );
-
- if ( resp == EMessageNotHandled && aMessageUid == TUid::Uid( KUidFMRadioApplication ) )
- {
- ProcessCommandTailL( aMessageParameters );
- resp = EMessageHandled;
- }
-
- return resp;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ProcessCommandParametersL
-// Processes the shell commands
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::ProcessCommandParametersL( TApaCommand aCommand,
- TFileName& aDocumentName,
- const TDesC8& aTail )
- {
- FTRACE(FPrint(_L("CFMRadioAppUi::ProcessCommandParametersL(%d, %S)" ), aCommand, &aTail ));
- SecondaryConstructL();
-
- TBool ret = CAknViewAppUi::ProcessCommandParametersL( aCommand, aDocumentName, aTail );
- ProcessCommandTailL( aTail );
-
- return ret;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::ProcessCommandParametersL
-// Processes the command tail in any situation
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::ProcessCommandTailL( const TDesC8& aTail )
- {
- TLex8 tailLex( aTail );
- if ( tailLex.Peek() != 0 )
- {
- TPtrC8 command = tailLex.NextToken();
- if ( command == KFMRadioCommandFrequency )
- {
- // tune to frequency
- TLex8 frequencyLex( tailLex.NextToken() );
- TInt32 frequency = 0;
- TInt min = 0;
- TInt max = 0;
- iRadioEngine->GetFrequencyBandRange( min, max );
- TInt ret = frequencyLex.BoundedVal( frequency, max );
- if ( ret == KErrNone && frequency >= min )
- {
- iRadioEngine->CancelScan();
- TuneL( frequency );
- }
- }
- else if ( command == KFMRadioCommandStationIndex )
- {
- // tune to station index
- TLex8 indexLex( tailLex.NextToken() );
- TInt32 index = 0;
- TInt ret = indexLex.BoundedVal( index, iChannels->Count() - 1 );
- if ( ret == KErrNone && index >= 0 )
- {
- iRadioEngine->CancelScan();
- PlayChannel( index );
- }
- }
- else if( command == KFMRadioCommandActivateView )
- {
- TLex8 viewIdLex( tailLex.NextToken() );
- TInt viewId = 0;
- TInt ret = viewIdLex.Val( viewId );
- if ( ret == KErrNone )
- {
- TUid uid = TUid::Uid( viewId );
- CAknView* view = View( uid );
- // Currently this API supports only activating main view or channel list view
- if ( view && ( uid == KFMRadioMainViewId || uid == KFMRadioChannelListViewId ) )
- {
- if ( iStartUp )
- {
- SetDefaultViewL( *view );
- }
- else
- {
- TFMRadioRegionSetting region = iRadioEngine->GetRegionL();
-
- if ( iOfflineQueryDialogActivated ||
- iConnectHeadsetQuery ||
- region == EFMRadioRegionNone )
- {
- iPendingViewId = view->Id();
- }
- else
- {
- iChannelListView->CancelMoveL();
- ActivateLocalViewL( view->Id() );
- }
- TApaTask task( iCoeEnv->WsSession() );
- task.SetWgId( iCoeEnv->RootWin().Identifier() );
- task.BringToForeground();
- }
- }
- }
- }
- else
- {
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::Channels
-// Returns channels array
-// ---------------------------------------------------------------------------
-//
-CArrayFixFlat<TChannelInformation>* CFMRadioAppUi::Channels()
- {
- return iChannels;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::HandleIADUpdateCheckL
-// Initialize software update check using IAD api
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::HandleIADUpdateCheckL()
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleIADUpdateCheckL") ) );
- if ( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::HandleIADUpdateCheckL - KFeatureIdIAUpdate supported") ) );
- TRAPD( err, iUpdate = CIAUpdate::NewL( *this ) )
- if ( err && err != KErrNotSupported )
- {
- User::Leave( err );
- }
- if ( !err )
- {
- iParameters = CIAUpdateParameters::NewL();
- // Use SIS package UID
- iParameters->SetUid( TUid::Uid( KUidFMRadioApplication ) );
- iUpdate->CheckUpdates( *iParameters );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::CheckUpdatesComplete
-// from base class MIAUpdateObserver
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::CheckUpdatesComplete(%d, %d)"), aErrorCode, aAvailableUpdates ) );
- if ( aErrorCode == KErrNone )
- {
- if ( aAvailableUpdates > 0 )
- {
- // There were some updates available. Let's ask if the user wants to update them.
- iUpdate->UpdateQuery();
- }
- else
- {
- // No updates available. CIAUpdate object could be deleted already now, since we are not
- // going to call anything else from the API. This will also close down the IAUpdate server.
- delete iUpdate;
- iUpdate = NULL;
- delete iParameters;
- iParameters = NULL;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::UpdateComplete
-// from base class MIAUpdateObserver
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::UpdateComplete( TInt FDEBUGVAR( aErrorCode ), CIAUpdateResult* aResultDetails )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::UpdateComplete(%d)"), aErrorCode ) );
- // The update process that the user started from IAUpdate UI is now completed.
- // If the client application itself was updated in the update process, this callback
- // is never called, since the client is not running anymore.
-
- delete aResultDetails; // Ownership was transferred, so this must be deleted by the client
-
- // We do not need the client-server session anymore, let's delete the object to close the session
- delete iUpdate;
- iUpdate = NULL;
- delete iParameters;
- iParameters = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::UpdateQueryComplete
-// from base class MIAUpdateObserver
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::UpdateQueryComplete(%d, %d)"), aErrorCode, aUpdateNow ) );
- if ( aErrorCode == KErrNone )
- {
- if ( aUpdateNow )
- {
- // User choosed to update now, so let's launch the IAUpdate UI.
- iUpdate->ShowUpdates( *iParameters );
- }
- else
- {
- // The answer was 'Later'. CIAUpdate object could be deleted already now, since we are not
- // going to call anything else from the API. This will also close down the IAUpdate server.
- delete iUpdate;
- iUpdate = NULL;
- delete iParameters;
- iParameters = NULL;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::AutoTuneInMainView
-// Set autotune true, if scan is interrupted
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAppUi::AutoTuneInMainView ( TBool aTune )
- {
- FTRACE( FPrint( _L("CFMRadioAppUi::AutoTuneInMainView()")));
- iAutoTune = aTune;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAppUi::IsStartupWizardHandled
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::IsStartupWizardHandled() const
- {
- return iStartupWizardHandled;
- }
-
-// -----------------------------------------------------------------------------
-// Check if Active Idle app is on foreground
-// -----------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::IsIdleAppForeground()
- {
- FTRACE( FPrint( _L( "CFMRadioAppUi::IsIdleAppForeground" ) ) );
- TBool isIdleActive( EFalse );
- // Gets the window group id of the app in foreground
- RWsSession& wsSession = iCoeEnv->Static()->WsSession();
- TInt windowGroupId = wsSession.GetFocusWindowGroup();
- if ( windowGroupId >= 0 )
- {
- TRAP_IGNORE(
- {
- CApaWindowGroupName* wgName = CApaWindowGroupName::NewL(
- wsSession, windowGroupId );
-
- isIdleActive = ( wgName->AppUid() == KFMRadioUidIdleApp );
- delete wgName;
- } );
- }
-
- return isIdleActive;
- }
-
-// -----------------------------------------------------------------------------
-// Check if Active Idle is enabled
-// -----------------------------------------------------------------------------
-//
-TBool CFMRadioAppUi::IsActiveIdleEnabled()
- {
- FTRACE( FPrint( _L( "CFMRadioAppUi::IsActiveIdleEnabled" ) ) );
- TBool res( EFalse );
-
-#ifdef __ACTIVE_IDLE
- if (! FeatureManager::FeatureSupported( KFeatureIdActiveIdle ) )
- return EFalse;
-#endif
- if ( !iSettingsRepository )
- {
- TRAP_IGNORE(
- {
- iSettingsRepository = CRepository::NewL(
- KCRUidPersonalizationSettings );
- } );
- }
-
- if ( iSettingsRepository )
- {
- TInt value( 0 );
- TInt err( iSettingsRepository->Get( KSettingsActiveIdleState, value ) );
- if ( !err && value )
- {
- res = ETrue;
- }
- }
- return res;
- }
-
-// ---------------------------------------------------------
-// CFMRadioAppUi::MatchingChannel
-// Return the index of the first channel that matches the
-// frequency specified.
-// ---------------------------------------------------------
-//
-TInt CFMRadioAppUi::MatchingChannelL( TInt aFrequency )
- {
- TInt channelIndex = KErrNotFound;
- TInt numberOfChannels = iChannels->Count();
-
- for ( TInt i = 0; i < numberOfChannels; i++ )
- {
- TInt presetFrequency = iChannels->At( i ).iChannelFrequency;
-
- if ( aFrequency == presetFrequency )
- {
- channelIndex = i;
- break;
- }
- }
- FTRACE(FPrint(_L("CFMRadioAppUi::MatchingChannel i[%d] aFrequency[%d]"), channelIndex, aFrequency));
- return channelIndex;
- }
-
-// ---------------------------------------------------------
-// CFMRadioAppUi::HandlePendingViewActivationL
-// Activates the view that is pending
-// ---------------------------------------------------------
-//
-void CFMRadioAppUi::HandlePendingViewActivationL()
- {
- if ( iPendingViewId != TUid::Null() )
- {
- ActivateLocalViewL( iPendingViewId );
- iPendingViewId == TUid::Null();
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioAppUi::ActiveVolumePopup
-// ---------------------------------------------------------
-//
-CAknVolumePopup* CFMRadioAppUi::ActiveVolumePopup() const
- {
- return iActiveVolumePopupControl;
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradiobacksteppingservicewrapper.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,275 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation for the Back Stepping Service wrapper
-*
-*/
-
-#include <liwcommon.h>
-#include <liwservicehandler.h>
-#include <mmf/common/mmfcontrollerpluginresolver.h>
-
-#include "fmradiobacksteppingservicewrapper.h"
-
-_LIT8( KFMRadioBackSteppingPrefix, "FMRADIOBS" );
-
-// BS Service implementation UID
-//const TInt KBSServiceImplUid( 0x2000F840 );
-
-// BS Service and Interface ID
-_LIT8( KFMRadioBSServiceID, "Service.BackStepping" );
-_LIT8( KFMRadioBSInterface, "IBackStepping" );
-
-// BS commands
-_LIT8( KFMRadioBSCmdInitialize, "Initialize" );
-_LIT8( KFMRadioBSCmdForwardActivationEvent, "ForwardActivationEvent" );
-_LIT8( KFMRadioBSCmdHandleBackCommand, "HandleBackCommand" );
-
-// BS in param names
-_LIT8( KFMRadioBSInParamAppUid, "AppUid" );
-_LIT8( KFMRadioBSInParamState, "State" );
-_LIT8( KFMRadioBSInParamEnter, "Enter" );
-
-// BS out param names
-_LIT8( KFMRadioBSOutParamStatusInfo, "StatusInfo" );
-
-// ======== MEMBER FUNCTIONS =================================================
-
-// ---------------------------------------------------------------------------
-// CFMRadioBackSteppingServiceWrapper::NewL
-// ---------------------------------------------------------------------------
-//
-CFMRadioBackSteppingServiceWrapper* CFMRadioBackSteppingServiceWrapper::NewL( TUid aUid )
- {
- CFMRadioBackSteppingServiceWrapper* self = new( ELeave ) CFMRadioBackSteppingServiceWrapper;
- CleanupStack::PushL( self );
- self->ConstructL( aUid );
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioBackSteppingServiceWrapper::CFMRadioBackSteppingServiceWrapper
-// ---------------------------------------------------------------------------
-//
-CFMRadioBackSteppingServiceWrapper::CFMRadioBackSteppingServiceWrapper()
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioBackSteppingServiceWrapper::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioBackSteppingServiceWrapper::ConstructL( TUid aUid )
- {
- // Create Service Handler and keep as long as access to BS Service needed.
- iServiceHandler = CLiwServiceHandler::NewL();
- // For convenience keep pointers to Service Handler param lists.
- iInParamList = &iServiceHandler->InParamListL();
- iOutParamList = &iServiceHandler->OutParamListL();
-
- // Create AIW criteria.
- RCriteriaArray criteriaArray;
- CleanupResetAndDestroyPushL( criteriaArray );
- CLiwCriteriaItem* criterion = CLiwCriteriaItem::NewLC(
- KLiwCmdAsStr,
- KFMRadioBSInterface,
- KFMRadioBSServiceID );
- criterion->SetServiceClass( TUid::Uid( KLiwClassBase ) );
- criteriaArray.AppendL( criterion );
- CleanupStack::Pop( criterion );
-
- // Attach AIW criteria.
- iServiceHandler->AttachL( criteriaArray );
- // Get BS Service interface.
- iServiceHandler->ExecuteServiceCmdL( *criterion, *iInParamList, *iOutParamList );
- CleanupStack::PopAndDestroy( &criteriaArray );
-
- // Check if BS interface can be found from output params.
- TInt pos( 0 );
- iOutParamList->FindFirst( pos, KFMRadioBSInterface );
- if( KErrNotFound != pos )
- {
- // Extract BS interface from output params.
- iBsInterface = ( *iOutParamList )[pos].Value().AsInterface();
- }
-
- // Initialize BS Service.
- InitializeL( aUid );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioBackSteppingServiceWrapper::~CFMRadioBackSteppingServiceWrapper
-// ---------------------------------------------------------------------------
-//
-CFMRadioBackSteppingServiceWrapper::~CFMRadioBackSteppingServiceWrapper()
- {
- if ( iBsInterface )
- {
- iBsInterface->Close();
- }
- if ( iServiceHandler )
- {
- delete iServiceHandler;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioBackSteppingServiceWrapper::HandleViewActivationEventL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioBackSteppingServiceWrapper::HandleViewActivationEventL( const TVwsViewId aViewId,
- TBool aEnter )
- {
- if ( iBsInterface )
- {
- // Make Service Handler param lists.
- iInParamList->Reset();
- iOutParamList->Reset();
-
- RBuf8 buffer;
- CleanupClosePushL( buffer );
- buffer.CreateL( KFMRadioBackSteppingPrefix().Length() + KDefaultRealWidth );
- buffer.Copy( KFMRadioBackSteppingPrefix );
- // Convert 32-bit signed integer (TInt32) view uid to TInt.
- TInt64 viewUid = static_cast< TInt64 >( aViewId.iViewUid.iUid );
- buffer.AppendNum( viewUid );
-
- TLiwGenericParam state( KFMRadioBSInParamState, TLiwVariant( buffer ) );
- iInParamList->AppendL( state );
- TLiwGenericParam enter( KFMRadioBSInParamEnter, TLiwVariant( aEnter ) );
- iInParamList->AppendL( enter );
-
- // Execute view activation event.
- iBsInterface->ExecuteCmdL( KFMRadioBSCmdForwardActivationEvent, *iInParamList, *iOutParamList );
- CleanupStack::PopAndDestroy();
-
- // Check if BS Service consumed the event.
- HandleResultL();
-
- iInParamList->Reset();
- iOutParamList->Reset();
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioBackSteppingServiceWrapper::HandleBackCommandL
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioBackSteppingServiceWrapper::HandleBackCommandL( const TVwsViewId aViewId )
- {
- TBool retVal = EFalse;
- if ( iBsInterface )
- {
- // Make Service Handler param lists.
- iInParamList->Reset();
- iOutParamList->Reset();
-
- // Create message for back stepping wrapper to handle back command event.
- RBuf8 buffer;
- CleanupClosePushL( buffer );
- buffer.CreateL( KFMRadioBackSteppingPrefix().Length() + KDefaultRealWidth );
- buffer.Copy( KFMRadioBackSteppingPrefix );
- // Convert 32-bit signed integer (TInt32) view uid to TInt64.
- TInt64 viewUid = static_cast< TInt64 >( aViewId.iViewUid.iUid );
- buffer.AppendNum( viewUid );
-
- TLiwGenericParam state( KFMRadioBSInParamState, TLiwVariant( buffer ) );
- iInParamList->AppendL( state );
-
- // Execute back event.
- iBsInterface->ExecuteCmdL( KFMRadioBSCmdHandleBackCommand, *iInParamList, *iOutParamList );
- CleanupStack::PopAndDestroy();
-
- // Check if BS Service consumes the event.
- retVal = HandleResultL();
-
- iInParamList->Reset();
- iOutParamList->Reset();
- }
-
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioBackSteppingServiceWrapper::InitializeL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioBackSteppingServiceWrapper::InitializeL( const TUid aUid )
- {
- if ( iBsInterface )
- {
- // Initialize BS Service.
- iInParamList->Reset();
- iOutParamList->Reset();
-
- TLiwGenericParam appUid( KFMRadioBSInParamAppUid, TLiwVariant( aUid.iUid ) );
- iInParamList->AppendL( appUid );
-
- iBsInterface->ExecuteCmdL( KFMRadioBSCmdInitialize, *iInParamList, *iOutParamList );
-
- if ( !HandleResultL() )
- {
- // Initialize command was not consumed.
- User::Leave( KErrArgument );
- }
-
- iInParamList->Reset();
- iOutParamList->Reset();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioBackSteppingServiceWrapper::HandleResultL
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioBackSteppingServiceWrapper::HandleResultL()
- {
- TBool retVal( EFalse );
- // Check if error can be found from outparams.
- TInt posErr( 0 );
- iOutParamList->FindFirst( posErr, LIW::EGenericParamError );
- if( KErrNotFound != posErr )
- {
- // Error code found - extract and handle
- TInt errorCode( KErrNone );
- ( *iOutParamList )[posErr].Value().Get( errorCode );
- User::LeaveIfError( errorCode );
- }
- // No errors found. Check if status info can be found from outparams.
- TInt posStat( 0 );
- iOutParamList->FindFirst( posStat, KFMRadioBSOutParamStatusInfo );
- if( KErrNotFound != posStat )
- {
- // Status info present - extract.
- ( *iOutParamList )[posStat].Value().Get( retVal );
- }
- else
- {
- // No status info found.
- User::Leave( KErrNotFound );
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioBackSteppingServiceWrapper::HandleViewActivation
-// ---------------------------------------------------------------------------
-//
-void CFMRadioBackSteppingServiceWrapper::HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId,
- const TVwsViewId& /*aViewIdToBeDeactivated*/ )
- {
- TRAP_IGNORE( HandleViewActivationEventL( aNewlyActivatedViewId, ETrue ) )
- }
--- a/fmradio/fmradio/src/fmradiochannellistcontainer.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,973 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioChannelListContainer
-*
-*/
-
-
-// INCLUDE FILES
-#include <e32math.h>
-#include <AknsSkinInstance.h>
-#include <AknsUtils.h>
-#include <AknsDrawUtils.h>
-#include <AknsBasicBackgroundControlContext.h>
-#include <gulutil.h>
-#include <w32std.h>
-#include <fmradio.rsg>
-#if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE
-#include "radio.hlp.hrh"
-#endif
-#include <StringLoader.h>
-#include <eiklabel.h>
-#include <AknIconArray.h>
-#include <gulicon.h>
-#include <fmradiouids.h>
-
-#include "fmradioappui.h"
-#include "fmradiochannellistcontainer.h"
-#include "fmradiochannellistview.h"
-
-// CONSTANTS
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// ----------------------------------------------------------------------------
-// CFMRadioChannelListContainer::CFMRadioChannelListContainer
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioChannelListContainer::CFMRadioChannelListContainer(
- CRadioEngine& aRadioEngine,
- MChannelListHandler& aObserver ) :
- iRadioEngine( aRadioEngine ),
- iObserver( aObserver )
-
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::NewL
-// Two-phase constructor of CFMRadioChannelListContainer
-// ---------------------------------------------------------
-//
-CFMRadioChannelListContainer* CFMRadioChannelListContainer::NewL( const TRect& aRect,
- CRadioEngine& aRadioEngine, MChannelListHandler& aObserver )
- {
- CFMRadioChannelListContainer* self = new (ELeave) CFMRadioChannelListContainer( aRadioEngine,
- aObserver );
- CleanupStack::PushL( self );
- self->ConstructL( aRect );
- CleanupStack::Pop( self );
- return self;
- }
-
-//
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::ConstructL
-// EPOC two phased constructor
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::ConstructL( const TRect& aRect )
- {
- CreateWindowL();
- CAknIconArray* radioTypeIcons = NULL;
-
- radioTypeIcons = new( ELeave ) CAknIconArray( 2 );
- CleanupStack::PushL( radioTypeIcons );
-
- radioTypeIcons->AppendFromResourceL( R_FMRADIO_CHANNEL_LIST_ICON_ARRAY );
-
- // Instantiate a listbox for the channel list
- iChannelList = new ( ELeave ) CAknDoubleNumberStyleListBox();
- iControls.Append( iChannelList );
- iChannelList->SetContainerWindowL( *this );
- iChannelList->SetListBoxObserver( this );
- iChannelList->ConstructL( this, CEikListBox::ELoopScrolling | EAknListBoxSelectionList ); // Looped list
- iChannelList->SetRect( aRect ); // Set boundaries for listbox
- // Create scrollbars
- iChannelList->CreateScrollBarFrameL( ETrue );
- iChannelList->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
- HBufC* emptyString = NULL;
- emptyString = StringLoader::LoadLC( R_QTN_FMRADIO_LIST_NO_STATIONS, iEikonEnv );
-
- iChannelList->View()->SetListEmptyTextL( *emptyString );
- CleanupStack::PopAndDestroy( emptyString );
-
- // The following line really takes the ownership -- must be the last item
- // there, as if leaves and the object is in cleanupstack, problems arise.
- // (Cleanup stack corruption!)
- // Set the icon array for this list. List takes ownership of the array.
- iChannelList->ItemDrawer()->FormattedCellData()->SetIconArrayL( radioTypeIcons );
- CleanupStack::Pop( radioTypeIcons );
-
- // Array for channels
- iChannelItemArray = new( ELeave ) CDesCArrayFlat( KMaxNumberOfChannelListItems );
- InitializeChannelListL();
- SetRect( aRect ); // Set its rectangle
-
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- iChannelView = static_cast<CFMRadioChannelListView*> ( appUi->View( KFMRadioChannelListViewId ) );
-
- ActivateL();
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::~CFMRadioChannelListContainer
-// Class destructor
-// ----------------------------------------------------
-//
-CFMRadioChannelListContainer::~CFMRadioChannelListContainer()
- {
- iControls.ResetAndDestroy();
- delete iChannelItemArray;
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::InitializeChannelListL
-// Create the channel list (initially all spots are set as empty)
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::InitializeChannelListL()
- {
- TBuf<KLengthOfChannelItemString> textChannelItem;
- textChannelItem.SetLength( 0 );
-
- // Pass the array to the listbox model and set the ownership type
- iChannelList->Model()->SetItemTextArray( (MDesCArray*)iChannelItemArray );
- iChannelList->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- iChannelList->HandleItemAdditionL();
- DrawDeferred();
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::UpdateChannelListContentL
-// Update the content of the channel at aIndex with the
-// values specified
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::UpdateChannelListContentL( TInt aIndex, const TDesC& aChannelName, TInt aChannelFrequency )
- {
- TBuf<KLengthOfChannelItemString> textChannelItem;
- TBuf<KLengthOfChIndexStringChList> textChIndex;
- TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
-
- textChIndex.Format( KChIndexFormatChList, aIndex+1 ); // One over index
-
- textChIconIndex.Format( KChIconIndexFormatChList, KNowPlayingIconIndexChList );
-
- //Update to display Devnagari numbers for Text Index.
- AknTextUtils::LanguageSpecificNumberConversion( textChIndex );
- //
- textChannelItem.Append( textChIndex );
- textChannelItem.Append( KColumnListSeparator );
- textChannelItem.Append( aChannelName );
- textChannelItem.Append( KColumnListSeparator );
-
- if ( aChannelFrequency )
- {
- TReal frequency = static_cast<TReal>( aChannelFrequency / static_cast<TReal>( KHzConversionFactor ));
- // Gets locale decimal separator automatically
- TRealFormat format(KFrequencyMaxLength, iRadioEngine.DecimalCount() );
- TBuf<30> frequencyString;
- frequencyString.Num( frequency, format );
-
- HBufC* stringHolder = StringLoader::LoadLC( R_QTN_FMRADIO_DOUBLE2_FREQ, frequencyString, iEikonEnv );
- //Update for display of Hindi Devnagari Numbers
- TPtr textItem2 = stringHolder->Des();
- AknTextUtils::LanguageSpecificNumberConversion(textItem2);
- textChannelItem.Append( textItem2 );
- CleanupStack::PopAndDestroy( stringHolder );
- }
-
- // Set 'Now Playing' icon to the channel item
- textChannelItem.Append( KColumnListSeparator );
-
- if ( iRadioEngine.GetPresetIndex() == aIndex )
- {
- textChannelItem.Append( textChIconIndex );
- }
-
- if( iChannelItemArray->Count() > 0 )
- {
- iChannelItemArray->Delete( aIndex );
- iChannelList->HandleItemRemovalL();
- iChannelItemArray->InsertL( aIndex, textChannelItem );
- //iChannelItemArray->AppendL( textChannelItem );
-
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelList->UpdateScrollBarsL();
- iChannelList->DrawDeferred();
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::RemoveChannelL
-// Removes channel from container list
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::RemoveChannelL( TInt aIndex )
- {
- if ( iChannelItemArray->Count() > 0 )
- {
- TInt presetIndex = iRadioEngine.GetPresetIndex();
-
- iChannelItemArray->Delete( aIndex );
- iChannelList->HandleItemRemovalL();
- iChannelList->UpdateScrollBarsL();
- iChannelList->DrawDeferred();
-
- if ( iChannelItemArray->Count() > 0 )
- {
- ReIndexAllL();
-
- if ( presetIndex > aIndex )
- {
- // update engine settings also
- iRadioEngine.SetCurrentPresetIndex( presetIndex - 1 );
- UpdateItemIconL( presetIndex - 1, KNowPlayingIconIndexChList );
- }
- else if ( presetIndex == aIndex )
- {
- iRadioEngine.TunePresetL( 0 );
- UpdateItemIconL( 0, KNowPlayingIconIndexChList );
- }
- else
- {
- // NOP
- }
- iChannelList->SetCurrentItemIndex( 0 );
- }
- else
- {
- // The last item was deleted, tune to current frequency, out of preset mode
- iRadioEngine.Tune( iRadioEngine.GetTunedFrequency(), CRadioEngine::ERadioTunerMode );
- }
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::AddChannel
-// Adds channels to container list
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::AddChannelL(
- const TDesC& aChannelName, TInt aChannelFrequency, TBool aNowPlaying )
- {
- TBuf<KLengthOfChannelItemString> textChannelItem;
- TBuf<KLengthOfChIndexStringChList> textChIndex;
- TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
-
- textChIndex.Format( KChIndexFormatChList, iChannelItemArray->Count()+1 ); // One over index
-
- if ( !AknLayoutUtils::PenEnabled() )
- {
- textChIconIndex.Format( KChIconIndexFormatChList, KNowPlayingIconIndexChList ) ;
- }
-
- //Update to display Devnagari numbers for Text Index.
- AknTextUtils::LanguageSpecificNumberConversion(textChIndex);
- //
- textChannelItem.Append( textChIndex );
- textChannelItem.Append( KColumnListSeparator );
-
- TReal frequency = static_cast<TReal>( aChannelFrequency / static_cast<TReal>( KHzConversionFactor ));
- // Gets locale decimal separator automatically
- TRealFormat format(KFrequencyMaxLength, iRadioEngine.DecimalCount() );
- TBuf<30> frequencyString;
- frequencyString.Num(frequency,format);
-
- TBool channelHasName = EFalse;
- TInt resId = 0;
- // if name exists, place it on the first line
- if ( aChannelName.Length() > 0 )
- {
- textChannelItem.Append( aChannelName );
- textChannelItem.Append( KColumnListSeparator );
- channelHasName = ETrue;
- resId = R_QTN_FMRADIO_DOUBLE2_FREQ;
- }
- else // frequency goes to first line
- {
- resId = R_QTN_FMRADIO_DOUBLE1_FREQ;
- }
-
- HBufC* stringHolder = StringLoader::LoadLC( resId, frequencyString, iEikonEnv );
- //Update for display of Hindi Devnagari Numbers
- TPtr textItem2 = stringHolder->Des();
- AknTextUtils::LanguageSpecificNumberConversion(textItem2);
- textChannelItem.Append( textItem2 );
- CleanupStack::PopAndDestroy( stringHolder );
-
- if ( !channelHasName )
- {
- // add placeholder for second line
- textChannelItem.Append( KColumnListSeparator );
- }
-
- // Set 'Now Playing' icon to the channel item
- textChannelItem.Append( KColumnListSeparator );
-
- if( !AknLayoutUtils::PenEnabled() && aNowPlaying )
- {
- textChannelItem.Append( textChIconIndex );
- }
-
- iChannelItemArray->AppendL( textChannelItem );
-
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelList->UpdateScrollBarsL();
- iChannelList->DrawDeferred();
-
- }
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::UpdateItemIconL
-// Adds icon to a list item
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::UpdateItemIconL( TInt aIndex, TInt aIconIndex )
- {
- HideIconsL();
-
- if ( aIndex >= 0 && aIndex < iChannelItemArray->Count() )
- {
- TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
- textChIconIndex.Format( KChIconIndexFormatChList, aIconIndex );
- HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString );
- channelItem->Des().Copy( iChannelItemArray->MdcaPoint( aIndex ) );
- TPtr ptr( channelItem->Des() );
- ptr.Append( textChIconIndex ); // Add icon index
-
- iChannelItemArray->Delete( aIndex );
- iChannelList->HandleItemRemovalL();
- iChannelItemArray->InsertL( aIndex, *channelItem );
- CleanupStack::PopAndDestroy( channelItem );
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelList->UpdateScrollBarsL();
- }
- // use draw now so that view is up to date during fast channel switching
- iChannelList->DrawNow();
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::HideIconsL
-// hide all icons from the list
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::HideIconsL()
- {
- for ( TInt index = 0 ; index < iChannelItemArray->Count(); index++ )
- {
- HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString );
- channelItem->Des().Copy( iChannelItemArray->MdcaPoint( index ) );
- TPtr ptr( channelItem->Des() );
-
- TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
- TPtrC iconIndexPtr( textChIconIndex );
- TInt err = TextUtils::ColumnText( iconIndexPtr, 3, &ptr );
-
- if ( iconIndexPtr.Length() > 0 )
- {
- ptr.Delete( ptr.Length() - iconIndexPtr.Length(), iconIndexPtr.Length() ); // Remove icon index
- iChannelItemArray->Delete( index );
- iChannelList->HandleItemRemovalL();
- iChannelItemArray->InsertL( index, *channelItem );
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelList->UpdateScrollBarsL();
- }
- CleanupStack::PopAndDestroy( channelItem );
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::SetFaded
-// Fades the entire window and controls in the window owned
-// by this container control.
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::SetFaded( TBool aFaded )
- {
- iFadeStatus = aFaded;
- Window().SetFaded( aFaded, RWindowTreeNode::EFadeIncludeChildren );
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::UpdateLastListenedChannel
-// Updates channel index - the highlighted channel in the list.
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::UpdateLastListenedChannel( TInt aIndex )
- {
- iLastChIndex = aIndex;
- iChannelList->SetCurrentItemIndex( iLastChIndex );
- iChannelList->ScrollToMakeItemVisible( iLastChIndex );
- iChannelList->DrawDeferred();
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::CurrentlySelectedChannel
-// Returns the index of the selected channel item from the
-// channel list.
-// ----------------------------------------------------
-//
-TInt CFMRadioChannelListContainer::CurrentlySelectedChannel() const
- {
- return iChannelList->CurrentItemIndex(); // Index of selected channel
- }
-
-// ----------------------------------------------------
-// CFMRadioChannelListContainer::HandleListBoxEventL
-// For handling listbox-, in this case, channel list events.
-// The event equals to selecting a channel item from the list.
-// ----------------------------------------------------
-//
-void CFMRadioChannelListContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/,
- TListBoxEvent aEventType )
- {
- // Check the event generated by keypress and report the event,
- // Also check for Pen Enabled touch screen event
-
- switch ( aEventType )
- {
- case EEventEnterKeyPressed:
- {
- ReportEventL( MCoeControlObserver::EEventStateChanged );
- break;
- }
- case EEventItemSingleClicked:
- {
- if ( iMoveAction )
- {
- TouchMoveEventL( CurrentlySelectedChannel() );
- }
- else
- {
- ReportEventL( MCoeControlObserver::EEventStateChanged );
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CFMRadioChannelListContainer::HandleResourceChange
-// -----------------------------------------------------------------------------
-//
-void CFMRadioChannelListContainer::HandleResourceChange(TInt aType)
- {
- CCoeControl::HandleResourceChange(aType);
- if ( aType == KEikDynamicLayoutVariantSwitch )
- {
- SizeChanged();
- }
- }
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::SizeChanged
-// Called by framework when the view size is changed
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::SizeChanged()
- {
- // The channel list fills the whole view
- iChannelList->SetRect( Rect() );
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::CountComponentControls
-// Return the number of controls in the window owned by this container
-// ---------------------------------------------------------
-//
-TInt CFMRadioChannelListContainer::CountComponentControls() const
- {
- return iControls.Count();
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::ComponentControl
-// Return the control corresponding to the specified index
-// ---------------------------------------------------------
-//
-CCoeControl* CFMRadioChannelListContainer::ComponentControl( TInt aIndex ) const
- {
- return STATIC_CAST( CCoeControl *,iControls[aIndex] );
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::OfferKeyEventL
-// Allow the channel list to process key events
-// ---------------------------------------------------------
-//
-TKeyResponse CFMRadioChannelListContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
- TEventCode aType )
- {
- TKeyResponse response = EKeyWasNotConsumed;
-
- switch ( aKeyEvent.iCode )
- {
- case EKeyLeftArrow:
- case EKeyRightArrow:
- {
- return EKeyWasNotConsumed;
- }
- case EKeyUpArrow:
- if ( iMoveAction )
- {
- MoveUpL();
- }
- else
- {
- response = iChannelList->OfferKeyEventL(aKeyEvent, aType);
- if (response == EKeyWasConsumed)
- {
- ReportEventL( MCoeControlObserver::EEventRequestFocus );
- }
- }
- return response;
- case EKeyDownArrow:
- if ( iMoveAction )
- {
- MoveDownL();
- }
- else
- {
- response = iChannelList->OfferKeyEventL(aKeyEvent, aType);
- if (response == EKeyWasConsumed)
- {
- ReportEventL( MCoeControlObserver::EEventRequestFocus );
- }
- }
- return response;
- default:
- switch ( aKeyEvent.iScanCode ) //we need to use the scan code, because we need to process the event wrt the keyUp and keyDown action
- {
- case EKeyboardKey1: // Timed key
- case EKeyboardKey2: // Normal keys
- case EKeyboardKey3:
- case EKeyboardKey4:
- case EKeyboardKey5:
- case EKeyboardKey6:
- case EKeyboardKey7:
- case EKeyboardKey8:
- case EKeyboardKey9:
- case EKeyboardKey0:
- return EKeyWasNotConsumed;
- default:
- break;
- }
- break;
- }
- return iChannelList->OfferKeyEventL(aKeyEvent, aType);
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::Draw
-// Redraw the window owned by this container
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::Draw( const TRect& aRect ) const
- {
- CWindowGc& gc = SystemGc();
- gc.SetPenStyle( CGraphicsContext::ENullPen );
- gc.SetBrushColor( KRgbGray );
- gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
- gc.DrawRect( aRect );
-
- // Fade if needed
- Window().SetFaded( iFadeStatus, RWindowTreeNode::EFadeIncludeChildren );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListContainer::GetHelpContext
-// Gets Help
-//
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListContainer::GetHelpContext(TCoeHelpContext& aContext) const
- {
-#if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE
- aContext.iMajor = TUid::Uid( KUidFMRadioApplication );
- aContext.iContext = KFMRADIO_HLP_LIST;
-#endif
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::FocusChanged(TDrawNow aDrawNow)
-//
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::FocusChanged(TDrawNow aDrawNow)
- {
- CCoeControl::FocusChanged(aDrawNow);
- if ( iChannelList )
- {
- iChannelList->SetFocus(IsFocused(), aDrawNow);
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::HandlePointerEventL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
- {
- // don't handle any pointer events if view is faded
- if ( !iFadeStatus )
- {
- CCoeControl::HandlePointerEventL( aPointerEvent );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::ActivateMove
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::ActivateMoveL()
- {
-
- iMoveAction = ETrue;
- iMoveIndex = iChannelList->CurrentItemIndex();
- iTouchMoveIndex = iMoveIndex;
- UpdateItemIconL( iMoveIndex, KMoveIconIndexChList );
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::TouchMoveEventL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::TouchMoveEventL( TInt aIndex )
- {
- HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString );
- channelItem->Des().Copy( iChannelItemArray->MdcaPoint( iTouchMoveIndex ) );
- TPtr ptr( channelItem->Des() );
-
- TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
-
- TPtrC iconIndexPtr( textChIconIndex );
-
- TInt err = TextUtils::ColumnText( iconIndexPtr, 3, &ptr );
-
- iChannelItemArray->Delete( iTouchMoveIndex );
- iChannelList->HandleItemRemovalL();
-
- iChannelItemArray->InsertL( aIndex, *channelItem );
- iChannelList->HandleItemAdditionL();
- iChannelList->UpdateScrollBarsL();
- iChannelList->SetCurrentItemIndex( aIndex );
- iChannelList->DrawDeferred();
-
- iTouchMoveIndex = aIndex;
-
- CleanupStack::PopAndDestroy( channelItem );
-
- ReIndexAllL();
- UpdateItemIconL( aIndex, KMoveIconIndexChList );
- iChannelView->MoveActionDoneL();
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::MoveDownL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::MoveDownL()
- {
- TInt index = iChannelList->CurrentItemIndex();
- TInt originalindex = index;
-
- HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString );
- channelItem->Des().Copy( iChannelItemArray->MdcaPoint( index ) );
- TPtr ptr( channelItem->Des() );
-
- iChannelItemArray->Delete( index );
- iChannelList->HandleItemRemovalL();
-
- if ( index < iChannelItemArray->Count() )
- {
- index = index+1;
-
- TBuf<KLengthOfChIndexStringChList> channelindex;
-
- TPtrC indexPtr( channelindex );
-
- TInt errori = TextUtils::ColumnText( indexPtr, 0, &ptr );
-
- ptr.Delete( 0, indexPtr.Length() );
-
- channelindex.Format( KChIndexFormatChList, index+1 );
-
- AknTextUtils::LanguageSpecificNumberConversion( channelindex );
-
- ptr.Insert( 0, channelindex );
-
- iChannelItemArray->InsertL( index, *channelItem );
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelList->UpdateScrollBarsL();
- iChannelList->SetCurrentItemIndex( index );
- iChannelList->DrawDeferred();
-
- HBufC* origchannelItem = HBufC::NewLC( KLengthOfChannelItemString );
- origchannelItem->Des().Copy( iChannelItemArray->MdcaPoint( originalindex ) );
- TPtr origptr( origchannelItem->Des() );
-
- iChannelItemArray->Delete( originalindex );
- iChannelList->HandleItemRemovalL();
- TBuf<KLengthOfChIndexStringChList> origchannelindex;
-
- TPtrC origindexPtr( origchannelindex );
-
- TextUtils::ColumnText( origindexPtr, 0, &origptr );
- origptr.Delete( 0, origindexPtr.Length() );
-
- origchannelindex.Format( KChIndexFormatChList, originalindex+1 );
-
- AknTextUtils::LanguageSpecificNumberConversion( origchannelindex );
- origptr.Insert( 0, origchannelindex );
- iChannelItemArray->InsertL( originalindex, *origchannelItem );
- iChannelList->HandleItemAdditionL();
- iChannelList->UpdateScrollBarsL();
- iChannelList->DrawDeferred();
-
- CleanupStack::PopAndDestroy( origchannelItem );
- }
- else
- {
- index = 0;
- iChannelItemArray->InsertL( index, *channelItem );
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelList->UpdateScrollBarsL();
- iChannelList->SetCurrentItemIndex( index );
- iChannelList->DrawDeferred();
-
- ReIndexAllL();
- }
-
- iChannelList->ScrollToMakeItemVisible( index );
-
- CleanupStack::PopAndDestroy( channelItem );
-
- }
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::MoveUpL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::MoveUpL()
- {
- TInt index = iChannelList->CurrentItemIndex();
- TInt originalindex = index;
-
- HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString );
- channelItem->Des().Copy( iChannelItemArray->MdcaPoint( index ) );
- TPtr ptr( channelItem->Des() );
-
- iChannelItemArray->Delete( index );
- iChannelList->HandleItemRemovalL();
-
- if ( 0 == index )
- {
- index = iChannelItemArray->Count();
-
- TBuf<KLengthOfChIndexStringChList> channelindex;
-
- TPtrC indexPtr( channelindex );
-
- iChannelItemArray->InsertL( index, *channelItem );
- iChannelList->HandleItemAdditionL();
- iChannelList->UpdateScrollBarsL();
-
- iChannelList->SetCurrentItemIndex( index );
-
- iChannelList->DrawItem( index );
-
- ReIndexAllL();
- }
- else
- {
- index = index-1;
-
- TBuf<KLengthOfChIndexStringChList> channelindex;
-
- TPtrC indexPtr( channelindex );
-
- TInt errori = TextUtils::ColumnText( indexPtr, 0, &ptr );
-
- ptr.Delete( 0, indexPtr.Length() );
-
- channelindex.Format( KChIndexFormatChList, index+1 );
-
- AknTextUtils::LanguageSpecificNumberConversion( channelindex );
- ptr.Insert( 0, channelindex ); // Remove icon index
-
- iChannelItemArray->InsertL( index, *channelItem );
- iChannelList->SetCurrentItemIndex( index );
- iChannelList->HandleItemAdditionL();
- iChannelList->UpdateScrollBarsL();
- iChannelList->DrawItem( index );
-
- HBufC* origchannelItem = HBufC::NewLC( KLengthOfChannelItemString );
- origchannelItem->Des().Copy( iChannelItemArray->MdcaPoint( originalindex ) );
- TPtr origptr( origchannelItem->Des() );
-
- iChannelItemArray->Delete( originalindex );
- iChannelList->HandleItemRemovalL();
- TBuf<KLengthOfChIndexStringChList> origchannelindex;
-
- TPtrC origindexPtr( origchannelindex );
-
- TextUtils::ColumnText( origindexPtr, 0, &origptr );
-
- origptr.Delete( 0, origindexPtr.Length() );
-
- origchannelindex.Format( KChIndexFormatChList, originalindex+1 );
-
- AknTextUtils::LanguageSpecificNumberConversion( origchannelindex );
- origptr.Insert( 0, origchannelindex );
-
- iChannelItemArray->InsertL( originalindex, *origchannelItem );
- iChannelList->HandleItemAdditionL();
- iChannelList->DrawDeferred();
-
- iChannelList->UpdateScrollBarsL();
-
- CleanupStack::PopAndDestroy( origchannelItem );
- }
-
- iChannelList->ScrollToMakeItemVisible( index );
-
- CleanupStack::PopAndDestroy( channelItem );
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::ReIndexAllL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::ReIndexAllL()
- {
- HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString );
-
- for ( TInt index = 0; index < iChannelItemArray->Count(); index++ )
- {
- channelItem->Des().Copy( iChannelItemArray->MdcaPoint( index ) );
- TPtr ptr( channelItem->Des() );
-
- iChannelItemArray->Delete( index );
- iChannelList->HandleItemRemovalL();
-
- TBuf<KLengthOfChIndexStringChList> channelindex;
-
- TPtrC indexPtr( channelindex );
-
- TInt errori = TextUtils::ColumnText( indexPtr, 0, &ptr );
-
- ptr.Delete( 0, indexPtr.Length() );
-
- channelindex.Format( KChIndexFormatChList, index+1 );
-
- AknTextUtils::LanguageSpecificNumberConversion( channelindex );
-
- ptr.Insert( 0, channelindex ); // Remove icon index
-
- iChannelItemArray->InsertL( index, *channelItem );
-
- iChannelList->HandleItemAdditionL();
- iChannelList->DrawDeferred();
- iChannelList->UpdateScrollBarsL();
- }
-
- CleanupStack::PopAndDestroy( channelItem );
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::HandleDropL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::HandleDropL()
- {
- iMoveAction = EFalse;
-
- if ( iMoveIndex != iChannelList->CurrentItemIndex() )
- {
- iObserver.UpdateChannelsL( EMoveChannels,
- iMoveIndex,
- iChannelList->CurrentItemIndex() );
- }
- HideIconsL();
- iChannelList->DrawDeferred();
- }
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::MoveDoneL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListContainer::MoveDoneL()
- {
- if ( iMoveAction )
- {
- iMoveAction = EFalse;
- }
-
- iObserver.UpdateChannelsL( EStoreAllToRepository, 0, 0 );
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::MoveCanceledL
-// ---------------------------------------------------------
-//
-TBool CFMRadioChannelListContainer::MoveCanceledL()
- {
- TBool wasmove = EFalse;
-
- if ( iMoveAction )
- {
- iMoveAction = EFalse;
-
- TInt index = iChannelList->CurrentItemIndex();
-
- HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString );
- channelItem->Des().Copy( iChannelItemArray->MdcaPoint( index ) );
- TPtr ptr( channelItem->Des() );
-
- TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
- TPtrC iconIndexPtr( textChIconIndex );
- TInt err = TextUtils::ColumnText( iconIndexPtr, 3, &ptr );
- iChannelItemArray->Delete( index );
- iChannelList->HandleItemRemovalL();
-
- iChannelItemArray->InsertL( iMoveIndex, *channelItem );
- iChannelList->HandleItemAdditionL();
- iChannelList->SetCurrentItemIndex( iMoveIndex );
- CleanupStack::PopAndDestroy( channelItem );
-
- iChannelList->ScrollToMakeItemVisible( index );
- HideIconsL();
- iChannelList->UpdateScrollBarsL();
- iChannelList->DrawDeferred();
- wasmove = ETrue;
- }
-
- return wasmove;
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListContainer::MoveAction()
-// ---------------------------------------------------------
-//
-TBool CFMRadioChannelListContainer::MoveAction()
- {
- return iMoveAction;
-
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradiochannellistview.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1062 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioChannelListView
-*
-*/
-
-
-// INCLUDE FILES
-#include <featmgr.h>
-#include <aknViewAppUi.h>
-#include <akntitle.h>
-#include <avkon.hrh>
-#include <avkon.rsg>
-#include <StringLoader.h>
-#include <eikmenup.h>
-#include <eikbtgpc.h>
-#include <fmradio.rsg>
-#include <fmradio.mbg>
-#include <fmradiouids.h>
-#include <AknQueryDialog.h>
-#include <aknnotewrappers.h>
-#include <data_caging_path_literals.hrh>
-#include <aknbutton.h>
-#include <akntoolbar.h>
-
-#include "fmradioengine.h"
-#include "fmradio.hrh"
-#include "fmradiochannellistview.h"
-#include "fmradiochannellistcontainer.h"
-#include "debug.h"
-#include "fmradiordsreceiverbase.h"
-#include "fmradiopubsub.h"
-#include "fmradiofrequencyquerydialog.h"
-#include "fmradioappui.h"
-
-const TInt KMSKControlID(3);
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::NewL
-// Two-phase constructor of CFMRadioChannelListView
-// ---------------------------------------------------------------------------
-//
-CFMRadioChannelListView* CFMRadioChannelListView::NewL(
- CRadioEngine* aRadioEngine, MChannelListHandler& aObserver )
- {
- CFMRadioChannelListView* self = new ( ELeave ) CFMRadioChannelListView( aObserver );
- CleanupStack::PushL(self);
- self->ConstructL(aRadioEngine);
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::CFMRadioChannelListView
-//
-// ---------------------------------------------------------------------------
-//
-CFMRadioChannelListView::CFMRadioChannelListView( MChannelListHandler& aObserver ) :
- iNowPlayingIndex( KErrNotFound ),
- iObserver( aObserver )
- {
- }
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::ConstructL
-// EPOC two-phased constructor
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::ConstructL(
- CRadioEngine* aRadioEngine)
- {
- iRadioEngine = aRadioEngine;
- BaseConstructL( R_FMRADIO_CH_LIST_VIEW );
- PrepareToolbar();
-
- if ( !AknLayoutUtils::PenEnabled() )
- {
- iToolbar->SetToolbarVisibility( EFalse );
- }
-
- //called here to ensure that empty channels are named in the way we want them to be.
- InitializeChannelsL();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::~CFMRadioChannelListView
-// Class destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioChannelListView::~CFMRadioChannelListView()
- {
- if ( iContainer )
- {
- AppUi()->RemoveFromViewStack( *this, iContainer );
- }
- delete iContainer;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::Id
-// Return the unique identifier corresponding to this view
-// ---------------------------------------------------------------------------
-//
-TUid CFMRadioChannelListView::Id() const
- {
- return KFMRadioChannelListViewId;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::DoActivateL
-// Activate the channel list view
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::DoActivateL(
- const TVwsViewId& /*aPrevViewId*/,
- TUid /*aCustomMessageId*/,
- const TDesC8& /*aCustomMessage*/ )
- {
- FTRACE( FPrint( _L("CFMRadioChannelListView::DoActivateL Start") ) );
-
- iRadioEngine->RdsReceiver().AddObserver(this);
-
- iFirstMoveDone = ETrue;
-
- SetTitleL( R_FMRADIO_STATIONS_VIEW_TITLE );
-
- if ( !iContainer )
- {
- FTRACE( FPrint( _L("CFMRadioChannelListView::DoActivateL inside second, not iContainer if") ) );
- iContainer = CFMRadioChannelListContainer::NewL( ClientRect(), *iRadioEngine, iObserver );
- iContainer->SetMopParent( this );
- iContainer->SetObserver( this );
- AppUi()->AddToStackL( *this, iContainer );
- }
-
- InitializeChannelsL();
-
- FadeAndShowExit( iFaded );
-
- AppUi()->HandleCommandL( EFMRadioCmdChannelListViewActive );
-
- UpdateMiddleSoftKeyL();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::HandleCommandL
-// Interprets view's menu,softkey and other commands and acts
-// accordingly by calling the appropriate command handler
-// function for further action.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::HandleCommandL( TInt aCommand )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
- switch ( aCommand )
- {
- case EFMRadioCmdMove:
- {
- MoveCurrentItemIndexL();
- break;
- }
- case EFMRadioCmdDone:
- {
- iMoveMode = EFalse;
- iFirstMoveDone = ETrue;
- Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
-
- UpdateMiddleSoftKeyL();
-
- iContainer->MoveDoneL();
- TInt currentIndex = 0;
- currentIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
- if ( currentIndex != KErrNotFound )
- {
- iRadioEngine->SetCurrentPresetIndex( currentIndex );
- SetNowPlayingChannel( currentIndex );
- }
- ShowToolbar( ETrue );
- break;
- }
- case EFMRadioCmdDrop:
- {
- iFirstMoveDone = EFalse;
- Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_GRAP_DONE );
- iContainer->HandleDropL();
- break;
- }
- case EFMRadioCmdGrap:
- {
- if ( iFirstMoveDone )
- {
- Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_DROP_CANCEL );
- }
- else
- {
- Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_DROP_DONE );
- }
- iContainer->ActivateMoveL();
- break;
- }
- case EAknSoftkeyBack: // Go back to the main view
- {
- appUi->ActivateLocalViewL( KFMRadioMainViewId );
- break;
- }
- case EEikBidCancel:
- {
- CancelMoveL();
- break;
- }
- case EAknSoftkeySelect: // Save a channel to the highlighted slot
- {
- break;
- }
- case EFMRadioCmdTuneManually:
- {
- // If manual tuning is canceled, return to previously tuned frequency.
- TUint32 prevFreq = iRadioEngine->GetTunedFrequency() / KFMRadioFreqMultiplier;
- TUint32 retFreq = prevFreq;
-
- iManualQueryDialog = CFMRadioFrequencyQueryDialog::NewL( retFreq );
- iManualQueryDialog->SetObserver( this );
-
- TInt res = iManualQueryDialog->ExecuteLD( R_FMRADIO_MANUAL_TUNING_QUERY );
-
- if ( res )
- {
- if ( iObserver.Channels()->Count() < KMaxNumberOfChannelListItems )
- {
- TInt usefreq = static_cast<TInt>( retFreq * KFMRadioFreqMultiplier );
- iRadioEngine->Tune( usefreq );
- TBuf<KPresetNameLength> stationName;
- stationName.SetLength( 0 );
-
- iObserver.AddChannelToListL( stationName, usefreq );
-
- iObserver.UpdateChannelsL( EStoreAllToRepository, 0, 0 );
-
- iContainer->AddChannelL( stationName, usefreq, ETrue );
-
- iRadioEngine->TunePresetL( iObserver.Channels()->Count()-1 );
-
- TInt index = iRadioEngine->GetPresetIndex();
-
- iContainer->UpdateItemIconL( index, KNowPlayingIconIndexChList );
-
- iContainer->UpdateLastListenedChannel( index ); // Update index
- }
- else
- {
- // Show icon, or overwrite last item, or selected item?
- CAknInformationNote* infonote = new( ELeave ) CAknInformationNote();
-
- HBufC* noteText = StringLoader::LoadLC(
- R_QTN_FMRADIO_LIST_QUERY_LIST_FULL, iCoeEnv );
-
-
- infonote->ExecuteLD( *noteText );
-
- CleanupStack::PopAndDestroy( noteText );
- }
- }
- else //cancel pressed, return to previous frequency
- {
- iRadioEngine->Tune( static_cast<TInt>( prevFreq * KFMRadioFreqMultiplier ) );
- }
- break;
- }
- case EFMRadioCmdListenCh:
- {
- if ( !AknLayoutUtils::PenEnabled() )
- {
- appUi->HandleCommandL( aCommand );
- // update msk here
- UpdateMiddleSoftKeyL();
- }
- if ( iMoveMode )
- {
- MoveActionDoneL();
- }
- break;
- }
- case EFMRadioToolbarButtonCmdToggleIhf:
- {
- if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputHeadset )
- {
- appUi->HandleCommandL( EFMRadioCmdActivateIhf );
- }
- else
- {
- appUi->HandleCommandL( EFMRadioCmdDeactivateIhf );
- }
- break;
- }
- case EFMRadioCmdErase:
- {
- TInt selectedIndex = CurrentlySelectedChannel();
-
- if ( appUi->EraseChannelL( selectedIndex ) )
- {
- if ( iContainer )
- {
- iContainer->RemoveChannelL( selectedIndex );
- }
- // Dim the rename and delete buttons in case the list is now empty
- UpdateToolbar();
- }
- break;
- }
- default: // Send all other commands to AppUi
- {
- appUi->HandleCommandL( aCommand );
- break;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::SetLastListenedChannel
-// Keep track of the last selected channel
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::SetLastListenedChannel( TInt aIndex )
- {
- iChIndex = aIndex;
- if ( iContainer && !iMoveMode )
- {
- iContainer->UpdateLastListenedChannel( aIndex ); // Update index
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::SetNowPlayingChannel
-// Keep track of the current selected channel
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::SetNowPlayingChannel( TInt aChannelIndex )
- {
- iNowPlayingIndex = aChannelIndex;
-
- if ( iContainer && !iMoveMode )
- {
- TRAP_IGNORE( iContainer->UpdateItemIconL( aChannelIndex, KNowPlayingIconIndexChList ) )
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::CurrentlyPlayingChannel
-// Returns the index of the playing channel item from the channel list.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioChannelListView::CurrentlyPlayingChannel()
- {
- return iNowPlayingIndex;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::InitializeChannelsL
-// Initialize the channels with the values currently saved in
-// the radio engine
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::InitializeChannelsL()
- {
- FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL Start") ) );
-
- if ( iContainer )
- {
- TBool nowPlaying = EFalse;
-
- CArrayFixFlat<TChannelInformation>* channels = iObserver.Channels();
- TInt channelCount = channels->Count();
-
- for ( TInt channelIndex = 0; channelCount > channelIndex; channelIndex++ )
- {
- FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL inside Channel in use") ) );
-
- iContainer->AddChannelL( channels->At( channelIndex ).iChannelInformation,
- channels->At( channelIndex ).iChannelFrequency,
- nowPlaying );
-
- UpdateMiddleSoftKeyL();
- FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL inside Channel in use Channel = %d"), iRadioEngine->GetPresetFrequencyL( channelIndex )) );
- }
-
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
-
- TInt currentPresetIndex = iRadioEngine->GetPresetIndex();
- TInt chIndexForTunedFreq = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
-
- if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
- currentPresetIndex < channelCount &&
- currentPresetIndex >= 0 )
- {
- SetLastListenedChannel( currentPresetIndex );
- SetNowPlayingChannel( currentPresetIndex );
- }
- else if ( chIndexForTunedFreq != KErrNotFound )
- {
- SetLastListenedChannel( chIndexForTunedFreq );
- SetNowPlayingChannel( chIndexForTunedFreq );
- }
- else
- {
- SetLastListenedChannel( 0 );
- }
- }
- FTRACE(FPrint(_L("InitializeChannelsL complete")));
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::ChannelInPlay
-// Return true/false to indicate whether the channel specified
-// is in play
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioChannelListView::ChannelInPlay(
- TInt aChannelIndex ) const
- {
- if( aChannelIndex == iNowPlayingIndex )
- {
- return ETrue;
- }
- else
- {
- return EFalse;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::FadeAndShowExit
-// Fade the view and all controls associated with it. Change
-// the soft keys so that "Exit" is displayed
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::FadeAndShowExit( TBool aFaded )
- {
- iFaded = aFaded;
- if( iContainer && iToolbar )
- {
- if ( aFaded ) // Fade
- {
- // In case options menu is open when headset is disconnected
- StopDisplayingMenuBar();
- iContainer->SetFaded( aFaded );
- iToolbar->SetDimmed( ETrue );
- TRAP_IGNORE( Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EXIT ) );
- }
- else
- {
- iContainer->SetFaded(aFaded);
- iToolbar->SetDimmed( EFalse );
- UpdateToolbar();
-
- if ( iMoveMode )
- {
- TRAP_IGNORE
- (
- Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EMPTY_CANCEL );
- UpdateMiddleSoftKeyL();
- )
- }
- else
- {
- TRAP_IGNORE( Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ) );
- }
- }
- Cba()->DrawDeferred();
- iToolbar->DrawDeferred();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::UpdateDisplayForFocusGained
-// Update the view after a focus gained event.
-// 1. Fade/Unfade view
-// 2. Update MSK label
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::UpdateDisplayForFocusGained()
- {
- FadeAndShowExit( iFaded );
-
- // Don't display MSK if display is faded.
- if ( !iFaded )
- {
- TRAP_IGNORE( UpdateMiddleSoftKeyL() );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::UpdateChannelListContentL
-// Make a request to the channel container to update the
-// content of the channel at aIndex with the values specified
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::UpdateChannelListContentL(
- TInt aIndex,
- const TDesC& aChannelName,
- TInt aChannelFrequency )
- {
- if ( iContainer )
- {
- iContainer->UpdateChannelListContentL( aIndex, aChannelName, aChannelFrequency );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::CurrentlySelectedChannel
-// Returns the index of the selected channel item from the
-// channel list. If the container is active get the info from
-// it, because it may have more up-to-date info.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioChannelListView::CurrentlySelectedChannel()
- {
- if ( iContainer )
- {
- iChIndex = iContainer->CurrentlySelectedChannel();
- }
- return iChIndex;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::NextChannel
-// Retrieve the index of the next channel that has been set.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioChannelListView::NextChannel()
- {
- if ( iContainer )
- {
- iChIndex = iContainer->CurrentlySelectedChannel();
- }
- else
- {
- iChIndex = iRadioEngine->GetPresetIndex();
- }
-
- iChIndex = iChIndex + 1;
-
- if ( iChIndex >= iObserver.Channels()->Count() )
- {
- iChIndex = 0;
- }
-
- return iChIndex;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::PreviousChannel
-// Retrieve the index of the previous channel that has been set.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioChannelListView::PreviousChannel()
- {
- if ( iContainer )
- {
- iChIndex = iContainer->CurrentlySelectedChannel();
- }
- else
- {
- iChIndex = iRadioEngine->GetPresetIndex();
- }
-
-
- if ( iChIndex <= 0 )
- {
- iChIndex = iObserver.Channels()->Count()-1;
- }
- else
- {
- iChIndex = iChIndex - 1;
- }
-
- return iChIndex;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::HandleControlEventL
-// Handles control event observing. In this case the interest
-// is only on the channel selection from the channel list.
-// Other events are not reported by the container,
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
- {
- if ( aControl == iContainer )
- {
- // don't change channels in move mode
- if ( !iMoveMode )
- {
- if ( aEventType == MCoeControlObserver::EEventRequestFocus )
- {
- // Don't display MSK when display is faded.
- if ( !iFaded )
- {
- if ( !AknLayoutUtils::PenEnabled() )
- {
- UpdateMiddleSoftKeyL();
- }
- else
- {
- AppUi()->HandleCommandL( EFMRadioCmdListenCh );
- }
- }
- }
-
- else if ( aEventType == MCoeControlObserver::EEventStateChanged )
- {
- // Send command to Ui
- AppUi()->HandleCommandL( EFMRadioCmdListenCh );
- }
- }
- }
-
- else if ( iManualQueryDialog && aControl == iManualQueryDialog && aEventType == MCoeControlObserver::EEventStateChanged )
- {
- TUint32 newFreq = static_cast<CFMRadioFrequencyQueryDialog*>( iManualQueryDialog )->Frequency();
- iRadioEngine->Tune( static_cast<TInt>( newFreq * KFMRadioFreqMultiplier ) );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::DoDeactivate
-// Deactivate the channel list view
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::DoDeactivate()
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>(AppUi());
- if ( appUi->RadioEngine() )
- {
- iRadioEngine->RdsReceiver().RemoveObserver( this );
- }
-
- if ( iContainer )
- {
- appUi->RemoveFromViewStack( *this, iContainer );
- }
- delete iContainer;
- iContainer = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::DynInitMenuPaneL
-// Sets the state of menu items dynamically according to the
-// state of application data.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::DynInitMenuPaneL(
- TInt aResourceId,
- CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == R_FMRADIO_CH_LIST_OPTIONS_MENU ) // Main menu
- {
- if ( iRadioEngine->IsAudioRoutingPossible() )
- {
- if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
- {
- // Delete existing menu option and add a new one
- aMenuPane->DeleteMenuItem( EFMRadioCmdActivateIhf );
- if ( iRadioEngine->IsHeadsetConnected() )
- {
- aMenuPane->SetItemTextL( EFMRadioCmdDeactivateIhf,R_QTN_FMRADIO_OPTIONS_DEACTIVATE );
- }
- }
- else
- {
- // Delete existing menu option and add a new one
- aMenuPane->DeleteMenuItem( EFMRadioCmdDeactivateIhf );
- aMenuPane->SetItemTextL( EFMRadioCmdActivateIhf,R_QTN_FMRADIO_OPTIONS_ACTIVATE );
- }
- }
- else
- {
- aMenuPane->SetItemDimmed( EFMRadioCmdDeactivateIhf, ETrue );
- aMenuPane->SetItemDimmed( EFMRadioCmdActivateIhf, ETrue );
- }
-
- // if help is not enabled, disable help option
- if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
- {
- aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioChannelListView::LayoutChangedL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::LayoutChangedL(
- TInt aType )
- {
- iContainer->SetRect( ClientRect() );
- iContainer->HandleResourceChange( aType );
- }
-
-// ---------------------------------------------------------------------------------------------
-// Sets middle softkey label.
-// ---------------------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::SetMiddleSoftKeyLabelL(
- TInt aResourceId,
- TInt aCommandId )
- {
-
- CEikButtonGroupContainer* cbaGroup = Cba();
- if ( cbaGroup )
- {
- cbaGroup->RemoveCommandFromStack( KMSKControlID, iCurrentMSKCommandId );
- HBufC* middleSKText = StringLoader::LoadLC( aResourceId, iCoeEnv );
- TPtr mskPtr = middleSKText->Des();
- cbaGroup->AddCommandToStackL(
- KMSKControlID,
- aCommandId,
- mskPtr );
- CleanupStack::PopAndDestroy( middleSKText );
- iCurrentMSKCommandId = aCommandId;
- }
- }
-
-// ---------------------------------------------------------------------------------------------
-// Updates the middle softkey functionality.
-// ---------------------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::UpdateMiddleSoftKeyL()
- {
-
- if ( ( iContainer &&
- ( iContainer->CurrentlySelectedChannel() == iRadioEngine->GetPresetIndex()
- || iObserver.Channels()->Count() == 0 ) ) ||
- iMoveMode )
- {
- SetMiddleSoftKeyLabelL(R_QTN_FMRADIO_NONE, EFMRadioCmdListenCh);
- }
- else
- {
- SetMiddleSoftKeyLabelL(R_QTN_FMRADIO_MSK_LISTEN, EFMRadioCmdListenCh);
- }
- }
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioChannelListView::SetEmptyChannelListItem
-// Set empty channel list item when preset is deleted from fmradiopresetutility
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::SetEmptyChannelListItemL( const TInt aIndex ) const
- {
- FTRACE( FPrint( _L("CFMRadioChannelListView::SetEmptyChannelListItem index = %d"), aIndex ) );
-
- if ( iContainer )
- {
- iContainer->RemoveChannelL( aIndex );
- }
-
- // Dim the rename and delete buttons in case the list is now empty
- UpdateToolbar();
- }
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioChannelListView::RdsDataProgrammeService
-//
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::RdsDataProgrammeService( const TDesC& /*aProgramService*/ )
- {
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioChannelListView::RdsDataPsNameIsStatic
-// --------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::RdsDataPsNameIsStatic( TBool aStatic )
- {
- const TDesC& programmeService = iRadioEngine->RdsReceiver().ProgrammeService();
- if ( iContainer &&
- aStatic &&
- programmeService.Length() &&
- !iMoveMode )
- {
- TInt currentPresetIx = iRadioEngine->GetPresetIndex();
- // When we haven't preset name, ps name will save as preset name
- if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
- currentPresetIx != KErrNotFound )
- {
- TBuf<KPresetNameLength> stationName;
- stationName.SetLength( 0 );
-
-
- TInt presetFreq( 0 );
-
- CArrayFixFlat<TChannelInformation>* channels = iObserver.Channels();
-
- // this checks that index is not out of bound and cause -21 error during update
- if ( currentPresetIx < channels->Count() )
- {
- stationName = channels->At( currentPresetIx ).iChannelInformation;
- presetFreq = channels->At( currentPresetIx ).iChannelFrequency;
-
- if ( stationName.Length() == 0 ) //Set and save PSname only if no name set before
- {
- TRAP_IGNORE(
- {
- iContainer->UpdateChannelListContentL( currentPresetIx,
- programmeService,
- presetFreq );
-
- iRadioEngine->SetPresetNameFrequencyL( currentPresetIx, programmeService, presetFreq );
- iObserver.Channels()->At( currentPresetIx ).iChannelInformation = programmeService;
- } );
- }
- }
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::PrepareToolbar
-// Prepare toolbar for displaying basic radio command buttons
-// --------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::PrepareToolbar()
- {
- // get toolbar from view
- iToolbar = Toolbar();
- // Set observer
- iToolbar->SetToolbarObserver( this );
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::UpdateToolbar
-// Set the dimmed status of buttons according to list state
-// --------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::UpdateToolbar() const
- {
- if ( iContainer && iToolbar && AknLayoutUtils::PenEnabled() )
- {
- if ( iRadioEngine->IsAudioRoutingPossible() )
- {
- if ( iRadioEngine->IsHeadsetConnected() )
- {
- CAknButton* centerButton = NULL;
- centerButton = static_cast<CAknButton*>( iToolbar->ControlOrNull( EFMRadioToolbarButtonCmdToggleIhf ) );
-
- iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, EFalse, ETrue );
-
- if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
- {
- if ( centerButton )
- {
- centerButton->SetCurrentState( 1, ETrue );
- }
- }
- else
- {
- if ( centerButton )
- {
- centerButton->SetCurrentState( 0, ETrue );
- }
- }
- }
- else
- {
- iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, ETrue, ETrue );
- }
- }
- else
- {
- iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, ETrue, ETrue );
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioChannelListView::OfferToolbarEventL
-// Handle commands from toolbar.
-// --------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::OfferToolbarEventL( TInt aCommandId )
- {
- HandleCommandL( aCommandId );
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListView::ShowToolbar
-// Sets toolbar visibility.
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListView::ShowToolbar( TBool aVisible )
- {
- if ( AknLayoutUtils::PenEnabled() &&
- iToolbar &&
- iContainer )
- {
- iToolbar->SetToolbarVisibility( aVisible );
- iToolbar->UpdateBackground();
- iToolbar->DrawDeferred();
- // set correct container rect with or without toolbar
- iContainer->SetRect( ClientRect() );
- }
- }
-
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioChannelListView::RdsDataRadioText
-// From MFMRadioRdsObserver, implementation not needed.
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::RdsDataRadioText( const TDesC& /*aRadioText*/ ){}
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioChannelListView::RdsAfSearchBegin
-// From MFMRadioRdsObserver, implementation not needed.
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::RdsAfSearchBegin(){}
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioChannelListView::RdsAfSearchEnd
-// From MFMRadioRdsObserver, implementation not needed.
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::RdsAfSearchEnd( TUint32 /* aFrequency*/, TInt /*aError*/ ){}
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioChannelListView::RdsAfSearchStateChange
-// From MFMRadioRdsObserver, implementation not needed.
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::RdsAfSearchStateChange( TBool /* aEnabled*/ ){}
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioChannelListView::RdsAvailable
-// From MFMRadioRdsObserver, implementation not needed.
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioChannelListView::RdsAvailable( TBool /*aAvailable*/ ){}
-
-// ---------------------------------------------------------
-// CFMRadioChannelListView::SetTitleL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListView::SetTitleL( TInt aResourceId )
- {
- HBufC* title = StringLoader::LoadLC( aResourceId, iCoeEnv );
- static_cast<CAknTitlePane*>( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) )->SetTextL( *title, ETrue );
- CleanupStack::PopAndDestroy( title );
- }
-
-
-// ---------------------------------------------------------
-// CFMRadioChannelListView::MoveCurrentItemIndexL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListView::MoveCurrentItemIndexL()
- {
- iMoveMode = ETrue;
-
- Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EMPTY_CANCEL );
- UpdateMiddleSoftKeyL();
- ShowToolbar( EFalse );
-
- iContainer->HideIconsL();
-
- iContainer->ActivateMoveL();
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListView::MoveActionDoneL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListView::MoveActionDoneL()
- {
- iMoveMode = EFalse;
- iFirstMoveDone = ETrue;
- Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
-
- UpdateMiddleSoftKeyL();
- iContainer->HandleDropL();
- iContainer->MoveDoneL();
-
- TInt currentIndex = 0;
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
- currentIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
-
- if ( currentIndex != KErrNotFound )
- {
- iRadioEngine->SetCurrentPresetIndex( currentIndex );
- SetNowPlayingChannel( currentIndex );
- }
- ShowToolbar( ETrue );
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListView::CancelMoveL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListView::CancelMoveL()
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
- TBool viewActive = appUi->ActiveView() == KFMRadioChannelListViewId && iContainer;
- if ( viewActive && ( iContainer->MoveCanceledL() || iMoveMode ) )
- {
- iMoveMode = EFalse;
- iFirstMoveDone = ETrue;
- iContainer->ReIndexAllL();
- Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
- UpdateMiddleSoftKeyL();
- TInt currentIndex = 0;
- currentIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
- if ( currentIndex != KErrNotFound )
- {
- SetNowPlayingChannel( currentIndex );
- }
- ShowToolbar( ETrue );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioChannelListView::StopSeekL
-// ---------------------------------------------------------
-//
-void CFMRadioChannelListView::StopSeekL()
- {
- // update icon if radio is in tuner mode i.e.
- // "accessory seek up/down" is launched
- if ( iContainer &&
- iRadioEngine->GetRadioMode() == CRadioEngine::ERadioTunerMode )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
- TInt tunedFrequency = iRadioEngine->GetTunedFrequency();
- const TInt index = appUi->MatchingChannelL( tunedFrequency );
-
- if ( index == KErrNotFound )
- {
- // frequency is not saved, hide now playing icon
- iContainer->HideIconsL();
- }
- else
- {
- SetNowPlayingChannel( index );
- SetLastListenedChannel( index );
- }
- }
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradiocontroleventobserverimpl.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,254 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation for the control event observer.
-*
-*/
-
-#include <aknViewAppUi.h>
-#include "fmradiocontroleventobserverimpl.h"
-
-#include "fmradio.hrh"
-// ---------------------------------------------------------------------------
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CFMRadioControlEventObserverImpl::CFMRadioControlEventObserverImpl( CFMRadioAppUi& aAppUi )
- : iAppUi( aAppUi )
- {
-
- }
-
-
-// ---------------------------------------------------------------------------
-// EPOC default constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::ConstructL()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CFMRadioControlEventObserverImpl* CFMRadioControlEventObserverImpl::NewL(
- CFMRadioAppUi& aAppUi )
- {
- CFMRadioControlEventObserverImpl* self =
- new( ELeave ) CFMRadioControlEventObserverImpl( aAppUi );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioControlEventObserverImpl::~CFMRadioControlEventObserverImpl()
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::StepToChannelL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::StepToChannelL( TFMRadioTuneDirection aDirection )
- {
- CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() );
- if( aDirection == EFMRadioDown )
- {
- appUi->HandleCommandL( EFMRadioCmdPrevChannel );
- }
- else if( aDirection == EFMRadioUp )
- {
- appUi->HandleCommandL( EFMRadioCmdNextChannel );
- }
- else
- {
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::SetChannelL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::SetChannelL( TInt /*aChannelId*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::SeekL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::SeekL( TFMRadioTuneDirection /*aDirection*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::StepToFrequencyL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::StepToFrequencyL( TFMRadioTuneDirection /*aDirection*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::SetFrequencyL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::SetFrequencyL( TUint32 /*aFreq*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::AdjustVolumeL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::AdjustVolumeL( TFMRadioVolumeSetDirection /*aDirection*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::MuteL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::MuteL( TBool /*aMute*/ )
- {
- CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() );
- TRAP_IGNORE( appUi->HandleCommandL( EFMRadioCmdMute ) );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::PlayL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::PlayL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::PauseL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::PauseL(TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::PausePlayL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::PausePlayL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::StopL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::StopL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::ForwardL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::ForwardL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::FastForwardL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::FastForwardL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::BackwardL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::BackwardL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::RewindL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::RewindL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::ChannelUpL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::ChannelUpL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::ChannelDownL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::ChannelDownL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::VolumeUpL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::VolumeUpL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::VolumeDownL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::VolumeDownL( TBool /*aDownPressed*/ )
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::ChangeViewL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::ChangeViewL(TUid /*aViewId*/, TBool /*aForceChange*/)
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::SetAudioOutputDestinationL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::SetAudioOutputDestinationL(TFMRadioOutputDestination /*aDestination*/)
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFMRadioControlEventObserverImpl::AnswerEndCallL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioControlEventObserverImpl::AnswerEndCallL()
-{
-}
--- a/fmradio/fmradio/src/fmradiodocument.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the CFMRadioDocument class, which
-* handles application data serialization. Owns the Ui
-* (controller) and the engine (model)
-*
-*/
-
-
-// INCLUDE FILES
-#include "fmradiodocument.h"
-#include "fmradioappui.h"
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CFMRadioDocument::CFMRadioDocument
-// Constructor
-// ---------------------------------------------------------
-//
-CFMRadioDocument::CFMRadioDocument( CEikApplication& aApp )
-: CAknDocument( aApp )
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioDocument::~CFMRadioDocument
-// Class destructor
-// ---------------------------------------------------------
-//
-CFMRadioDocument::~CFMRadioDocument()
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioDocument::NewL
-// Two-phase constructor of CFMRadioDelayTimer
-// ---------------------------------------------------------
-//
-CFMRadioDocument* CFMRadioDocument::NewL( CEikApplication& aApp )
- {
- CFMRadioDocument* self = new ( ELeave ) CFMRadioDocument( aApp );
- return self;
- }
-
-// ----------------------------------------------------
-// CFMRadioDocument::CreateAppUiL
-// constructs CFMRadioAppUi
-// ----------------------------------------------------
-//
-CEikAppUi* CFMRadioDocument::CreateAppUiL()
- {
- return new ( ELeave ) CFMRadioAppUi;
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradiofrequencyeditor.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,869 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Custom editor for editing radio frequencies.
-*
-*/
-
-
-#include <AknUtils.h>
-#include <barsread.h>
-#include <coemain.h>
-#include <e32base.h>
-#include <eikfctry.h>
-
-#include "fmradiofrequencyeditor.h"
-#include "fmradioengineradiosettings.h"
-#include "fmradioappui.h"
-#include "fmradiofrequencynumber.h"
-#include "fmradio.hrh"
-#include "debug.h"
-
-const TInt KNumFields = 3; // Number of fields.
-const TInt KIntField = 0; // Index of integer field.
-const TInt KDecField = 2; // Index of decimal field.
-
-const TInt KFMRadioAbsoluteMinimumIntFieldValue = 0;
-const TInt KFMRadioAbsoluteMinimumDecFieldValue = 0;
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::CFMRadioFrequencyEditor
-// ---------------------------------------------------------------------------
-//
-CFMRadioFrequencyEditor::CFMRadioFrequencyEditor() :
- iMinFreq( 0 ),
- iMaxFreq( 0 ),
- iPreviousField( KErrNotFound ),
- iTypedInDecField( EFalse ),
- iValidToReport( EFalse ),
- iDecDiv( KFMRadioFreqMultiplier ),
- iReportEditorState ( ETrue )
- {
- }
-
-
-// ---------------------------------------------------------------------------
-// Editor is contructed via this static method by the control framework.
-// ---------------------------------------------------------------------------
-//
-SEikControlInfo CFMRadioFrequencyEditor::StaticCreateCustomEditor(
- TInt aIdentifier )
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::StaticCreateCustomEditor") ) );
- SEikControlInfo customInfo;
- // zero all variables
- Mem::FillZ( &customInfo, sizeof( SEikControlInfo ) );
- if ( aIdentifier == EFMRadioFrequencyEditor )
- {
- customInfo.iControl = new CFMRadioFrequencyEditor;
- }
- return customInfo;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::ConstructL( const TUint32 aFlags )
- {
- // Creates space for the fiels in this MFNE.
- CreateFieldArrayL( KNumFields );
-
- // RadioSettings values are so widely used in this class, that it is
- // better to read them into member variables.
- CRadioEngine* radioEngine = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() )->RadioEngine();
- TInt minFreq = 0;
- TInt maxFreq = 0;
- radioEngine->GetFrequencyBandRange( minFreq, maxFreq );
- iMinFreq = minFreq / KFMRadioFreqMultiplier;
- iMaxFreq = maxFreq / KFMRadioFreqMultiplier;
- iStepFreq = radioEngine->FrequencyStepSize();
- // Maximum values of fields.
- TInt maxIntFieldValue( 0 );
- TInt maxIntFreq = iMaxFreq / KFMRadioFreqMultiplier;
- while ( maxIntFieldValue < maxIntFreq )
- {
- maxIntFieldValue = maxIntFieldValue*10 + 9;
- }
- TInt maxDecFieldValue( 0 );
- TInt decimalCounter = radioEngine->DecimalCount();
- while ( decimalCounter-- )
- {
- maxDecFieldValue = maxDecFieldValue*10 + 9;
- // Calculate also the decimal divider for later use.
- iDecDiv = iDecDiv / 10;
- }
-
- // Integer field. Ownership transfers.
- CFMRadioFrequencyNumber* field = CFMRadioFrequencyNumber::NewL( *Font(),
- KFMRadioAbsoluteMinimumIntFieldValue, maxIntFieldValue,
- KFMRadioAbsoluteMinimumIntFieldValue, aFlags );
- field->SetDigitType( AknTextUtils::NumericEditorDigitType(), *Font() );
- AddField( field );
-
- // Decimal separator field. Ownership transfers.
- HBufC* delim = HBufC::NewLC( 1 );
- TLocale loc;
- delim->Des().Append( loc.DecimalSeparator() );
- AddField( CEikMfneSeparator::NewL( delim ) );
- CleanupStack::Pop(); // delim
-
- // Decimal field. Ownership transfers.
- field = CFMRadioFrequencyNumber::NewL( *Font(), KFMRadioAbsoluteMinimumDecFieldValue,
- maxDecFieldValue, KFMRadioAbsoluteMinimumDecFieldValue,
- aFlags | CEikMfneNumber::EFillWithLeadingZeros );
- field->SetDigitType( AknTextUtils::NumericEditorDigitType(), *Font() );
- AddField( field );
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::~CFMRadioFrequencyEditor
-// ---------------------------------------------------------------------------
-//
-CFMRadioFrequencyEditor::~CFMRadioFrequencyEditor()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::SetFrequency
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::SetFrequency( const TUint32 aFreq )
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::SetFrequency (aFreq=%d) "), aFreq ) );
- TUint32 freq = aFreq;
- if ( ( iMinFreq != 0 ) && ( iMaxFreq != 0 ) )
- {
- if ( freq < iMinFreq )
- {
- freq = iMinFreq;
- }
- else if ( freq > iMaxFreq )
- {
- freq = iMaxFreq;
- }
- else {}
- }
- TInt intVal = freq / KFMRadioFreqMultiplier;
- TInt decVal = ( freq % KFMRadioFreqMultiplier ) / iDecDiv;
- static_cast<CFMRadioFrequencyNumber*>(
- Field( KIntField ) )->SetValue( intVal, *Font() );
- static_cast<CFMRadioFrequencyNumber*>(
- Field( KDecField ) )->SetValue( decVal, *Font() );
- UpdateMinimumAndMaximum();
- ValidateFields();
- DrawNow();
- }
-
-
-// ---------------------------------------------------------------------------
-// Calculates the frequency from values of the fields.
-// ---------------------------------------------------------------------------
-//
-TUint32 CFMRadioFrequencyEditor::Frequency() const
- {
- TInt intVal = static_cast<CFMRadioFrequencyNumber*>(
- Field( KIntField ) )->Value();
- TInt decVal = static_cast<CFMRadioFrequencyNumber*>(
- Field( KDecField ) )->Value();
- return ( KFMRadioFreqMultiplier * intVal ) + ( iDecDiv * decVal );
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::SetMinimumAndMaximum
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::SetMinimumAndMaximum(
- const TUint32 aMinimumFrequency, const TUint32 aMaximumFrequency )
- {
- iMinIntValue = aMinimumFrequency / KFMRadioFreqMultiplier;
- iMaxIntValue = aMaximumFrequency / KFMRadioFreqMultiplier;
- iMinDecValue = ( aMinimumFrequency % KFMRadioFreqMultiplier ) / iDecDiv;
- iMaxDecValue = ( aMaximumFrequency % KFMRadioFreqMultiplier ) / iDecDiv;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::GetMinimumAndMaximum
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::GetMinimumAndMaximum( TUint32& aMinimumFrequency,
- TUint32& aMaximumFrequency ) const
- {
- aMinimumFrequency = ( KFMRadioFreqMultiplier * iMinIntValue ) +
- ( iDecDiv*iMinDecValue );
- aMaximumFrequency = ( KFMRadioFreqMultiplier * iMaxIntValue ) +
- ( iDecDiv * iMaxDecValue );
- }
-
-
-// ---------------------------------------------------------------------------
-// From class CCoeControl.
-// CFMRadioFrequencyEditor::ConstructFromResourceL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::ConstructFromResourceL(
- TResourceReader& aResourceReader )
- {
- TUint32 flags = aResourceReader.ReadUint8();
- ConstructL( EAknEditorFlagDeliverVirtualKeyEventsToApplication );
- }
-
-
-// ---------------------------------------------------------------------------
-// From class CEikMfne.
-// Every key press may cause some recalculations and/or validations in
-// the fields.
-// ---------------------------------------------------------------------------
-//
-TKeyResponse CFMRadioFrequencyEditor::OfferKeyEventL( const TKeyEvent& aKeyEvent,
- TEventCode aType )
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::OfferKeyEventL ") ) );
- iPreviousField = CurrentField();
-
- TKeyResponse resp( EKeyWasNotConsumed );
-
- CEikMfneField* currField = Field( CurrentField() );
-
- // Check only once per key press.
- if ( aType == EEventKey )
- {
- TBool dataAltered = EFalse;
- TBool error = EFalse;
- TInt changeField = 0;
- TInt newCurrentField = CurrentField();
-
- switch ( aKeyEvent.iCode )
- {
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '0':
- {
- currField->HandleKey( *Font(), aKeyEvent, EFalse, dataAltered,
- changeField );
-
- // If after number key press we are still on decimal field
- // (and were before).
- if ( ( !changeField ) && ( CurrentField() == KDecField ) )
- {
- // This can mean only that user has typed one number in
- // the decimal field and system is waiting for the other.
- iTypedInDecField = ETrue;
- }
- else
- {
- iTypedInDecField = EFalse;
- }
- // If after number key press system moved to another field
- // (previous field was filled with numbers).
- if ( changeField )
- {
- if ( CurrentField() == KIntField )
- {
- // First check if the changed value is within limits.
- error = ValidateIntField();
- // Calculate new minimums and maximums.
- UpdateMinimumAndMaximum();
- // Now have to check also whether the other field is
- // within new limits.
- ValidateDecField();
- }
- else if ( CurrentField() == KDecField )
- {
- error = ValidateDecField();
- }
- else {}
- }
- break;
- }
- case EKeyBackspace:
- {
- // Pressing "c"-key in a field will set the field in
- // "typed" state.
- currField->HandleKey( *Font(), aKeyEvent, EFalse, dataAltered,
- changeField );
- if ( CurrentField() == KDecField )
- {
- iTypedInDecField = ETrue;
- }
- break;
- }
- case EKeyLeftArrow: // fall-through intended here
- case EKeyRightArrow:
- {
- currField->HandleKey( *Font(), aKeyEvent, EFalse, dataAltered,
- changeField );
- FillDecimalField();
- ValidateFields();
- // Minimums and maximums may have to be changed.
- UpdateMinimumAndMaximum();
- // Validate according to new minimums and maximums.
- ValidateFields();
- break;
- }
- default:
- {
- break;
- }
- }
-
- if ( changeField )
- {
- if ( CurrentField() == KIntField )
- {
- newCurrentField = KDecField;
- }
- else
- {
- newCurrentField = KIntField;
- }
- }
- TBuf<3> fieldText;
- TInt fieldVal = 0;
- TRAPD( err, fieldVal = static_cast<CFMRadioFrequencyNumber*>( currField )->Value() )
- if ( !err )
- {
- fieldText.Num( static_cast<TInt64>( fieldVal ) );
- }
- CEikMfne::HandleInteraction( changeField, newCurrentField,
- Font()->TextWidthInPixels( fieldText ),
- currField->HighlightType(),
- dataAltered,
- error );
-
- DrawAndReportL( EFalse );
- }
-
- return resp;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::FillDecimalField
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::FillDecimalField()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::FillDecimalField") ) );
- if ( iTypedInDecField )
- {
- CFMRadioFrequencyNumber* field =
- static_cast<CFMRadioFrequencyNumber*>( Field( KDecField ) );
- // Multiply value by iDecDiv.
- field->SetValue( iDecDiv*field->Value(), *Font() );
- iTypedInDecField = EFalse;
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::CanLeaveEditorL
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioFrequencyEditor::CanLeaveEditorL()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::CanLeaveEditorL") ) );
- TBool ret = ETrue;
-
- FillDecimalField();
-
- if ( CurrentField() == KIntField )
- {
- // First check if the changed value is within limits.
- ret = !ValidateIntField();
- // Calculate new minimums and maximums.
- UpdateMinimumAndMaximum();
- // Now have to check also whether the other field is within new
- // limits.
- ValidateDecField();
- }
- else if ( CurrentField() == KDecField )
- {
- ret = !ValidateDecField();
- }
- else {}
-
- PrepareForFocusLossL();
-
- // Draw immediately, otherwise a wrong number is displayed in decimal
- // field (for example: 03 instead of 30)
- DrawAndReportL( ETrue );
-
- return ret;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::IncrementCurrentField
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::IncrementCurrentField()
- {
- CEikMfneField* currField = Field( CurrentField() );
- // If user is not in the middle of typing numbers.
- if ( currField->HighlightType() ==
- CEikMfneField::EInverseVideo )
- {
- if ( CurrentField() == KIntField )
- {
- IncrementIntField();
- }
- else if ( CurrentField() == KDecField )
- {
- IncrementDecField();
- }
- else {}
- // Minimums and maximums may have to be changed.
- UpdateMinimumAndMaximum();
- // Validate according to new minimums and maximums.
- ValidateFields();
- }
-
- TRAP_IGNORE( DrawAndReportL( EFalse ) );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::DecrementCurrentField
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::DecrementCurrentField()
- {
- CEikMfneField* currField = Field( CurrentField() );
- // If user is not in the middle of typing numbers.
- if ( currField->HighlightType() ==
- CEikMfneField::EInverseVideo )
- {
- if ( CurrentField() == KIntField )
- {
- DecrementIntField();
- }
- else if ( CurrentField() == KDecField )
- {
- DecrementDecField();
- }
- else {}
- // Minimums and maximums may have to be changed.
- UpdateMinimumAndMaximum();
- // Validate according to new minimums and maximums.
- ValidateFields();
- }
- TRAP_IGNORE( DrawAndReportL( EFalse ) );
- }
-
-// ---------------------------------------------------------------------------
-// Field decrement step is 1.
-// If field value is already at maximum, it set to minimum.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::IncrementIntField()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::IncrementIntField") ) );
- CFMRadioFrequencyNumber* field =
- static_cast<CFMRadioFrequencyNumber*>( Field( KIntField ) );
- CFMRadioFrequencyNumber* decField =
- static_cast<CFMRadioFrequencyNumber*>( Field( KDecField ) );
-
- if ( field->Value() < iMaxIntValue )
- {
- field->SetValue( field->Value() + 1, *Font() );
- }
- else if ( field->Value() == iMaxIntValue && decField->Value() == iMaxDecValue)
- {
- field->SetValue( iMinIntValue, *Font() );
- }
- else
- {
- decField->SetValue( iMaxDecValue, *Font() );
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// Field decrement step is 1.
-// If field value is already at minimum, it set to maximum.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::DecrementIntField()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::DecrementIntField") ) );
- CFMRadioFrequencyNumber* field =
- static_cast<CFMRadioFrequencyNumber*>( Field( KIntField ) );
- CFMRadioFrequencyNumber* decField =
- static_cast<CFMRadioFrequencyNumber*>( Field( KDecField ) );
-
- if ( field->Value() > iMinIntValue )
- {
- field->SetValue( field->Value() - 1, *Font() );
- }
- else if ( field->Value() == iMinIntValue && decField->Value() == iMinDecValue)
- {
- field->SetValue( iMaxIntValue, *Font() );
- }
- else
- {
- decField->SetValue( iMinDecValue, *Font() );
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// Field inrement step is defined in RadioSettings.
-// If field value is already at maximum, integer field
-// has to be incremented and this field set to minimum.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::IncrementDecField()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::IncrementDecField") ) );
- CFMRadioFrequencyNumber* field =
- static_cast<CFMRadioFrequencyNumber*>( Field( KDecField ) );
- if ( field->Value() < iMaxDecValue )
- {
- field->SetValue( field->Value() + iStepFreq/iDecDiv, *Font() );
- }
- else if ( field->Value() == iMaxDecValue )
- {
- IncrementIntField();
- // This is done because min of this field may change when integer
- // field is set to it's minimum.
- UpdateMinimumAndMaximum();
- field->SetValue( iMinDecValue, *Font() );
- }
- else {}
- }
-
-
-// ---------------------------------------------------------------------------
-// Field decrement step is defined in RadioSettings.
-// If field value is already at minimum, integer field
-// has to be decremented and this field set to maximum.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::DecrementDecField()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::DecrementDecField") ) );
- CFMRadioFrequencyNumber* field =
- static_cast<CFMRadioFrequencyNumber*>( Field( KDecField ) );
- if ( field->Value() > iMinDecValue )
- {
- field->SetValue( field->Value() - iStepFreq/iDecDiv, *Font() );
- }
- else if ( field->Value() == iMinDecValue )
- {
- DecrementIntField();
- // This is done because max of this field may change when integer
- // field is set to it's maximum.
- UpdateMinimumAndMaximum();
- field->SetValue( iMaxDecValue, *Font() );
- }
- else {}
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::ValidateFields
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::ValidateFields()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::ValidateFields") ) );
- ValidateIntField();
- ValidateDecField();
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::ValidateIntField
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioFrequencyEditor::ValidateIntField()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::ValidateIntField") ) );
- TBool ret = EFalse;
-
- // Check if integer field value is within limits.
- CFMRadioFrequencyNumber* field =
- static_cast<CFMRadioFrequencyNumber*>( Field( KIntField ) );
- if ( field->Value() < iMinIntValue )
- {
- field->SetValue( iMinIntValue, *Font() );
- ret = ETrue;
- }
- else if ( field->Value() > iMaxIntValue )
- {
- field->SetValue( iMaxIntValue, *Font() );
- ret = ETrue;
- }
- else {}
-
- return ret;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::ValidateDecField
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioFrequencyEditor::ValidateDecField()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::ValidateDecField") ) );
- TBool ret = EFalse;
-
- // Check if decimal field value is within limits.
- CFMRadioFrequencyNumber* field =
- static_cast<CFMRadioFrequencyNumber*>( Field( KDecField ) );
- if ( field->Value() < iMinDecValue )
- {
- field->SetValue( iMinDecValue, *Font() );
- ret = ETrue;
- }
- else if ( field->Value() > iMaxDecValue )
- {
- field->SetValue( iMaxDecValue, *Font() );
- ret = ETrue;
- }
- else
- {
- // Check if decimal field value is within a step.
- TInt remainder = static_cast<TUint32>(
- ( field->Value()-iMinDecValue ) ) % ( iStepFreq/iDecDiv );
- if ( remainder != 0 )
- {
- field->SetValue( field->Value()-remainder, *Font() );
- ret = ETrue;
- }
- }
-
- return ret;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::UpdateMinimumAndMaximum
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::UpdateMinimumAndMaximum()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyEditor::UpdateMinimumAndMaximum") ) );
- TInt minIntValue( 0 );
- TInt maxIntValue( 0 );
- TInt minDecValue( 0 );
- TInt maxDecValue( 0 );
-
- minIntValue = iMinFreq / KFMRadioFreqMultiplier;
- maxIntValue = iMaxFreq / KFMRadioFreqMultiplier;
-
- if ( ( Frequency() / KFMRadioFreqMultiplier > iMinFreq / KFMRadioFreqMultiplier ) &&
- ( Frequency() / KFMRadioFreqMultiplier < iMaxFreq / KFMRadioFreqMultiplier ) )
- {
- // Remainder of the gap from min freq to next int value.
- minDecValue = ( ( ( KFMRadioFreqMultiplier * ( minIntValue + 1 ) ) - iMinFreq )
- % iStepFreq ) / iDecDiv;
- // Same kind of thing vice versa.
- maxDecValue = ( ( ( iMinFreq - ( KFMRadioFreqMultiplier * ( minIntValue ) ) )
- % iStepFreq ) / iDecDiv ) + KFMRadioFreqMultiplier / iDecDiv
- - ( iStepFreq / iDecDiv );
- }
- else if ( Frequency() / KFMRadioFreqMultiplier == iMinFreq / KFMRadioFreqMultiplier )
- {
- minDecValue = ( iMinFreq % KFMRadioFreqMultiplier ) / iDecDiv;
- // Same kind of thing vice versa.
- maxDecValue = ( ( ( iMinFreq - ( KFMRadioFreqMultiplier * ( minIntValue ) ) )
- % iStepFreq ) / iDecDiv ) + KFMRadioFreqMultiplier / iDecDiv
- - ( iStepFreq / iDecDiv );
- }
- else if ( Frequency() / KFMRadioFreqMultiplier == iMaxFreq / KFMRadioFreqMultiplier )
- {
- // Remainder of the gap from min freq to next int value.
- minDecValue = ( ( ( KFMRadioFreqMultiplier * ( minIntValue + 1 ) ) - iMinFreq )
- % iStepFreq ) / iDecDiv;
- maxDecValue = ( iMaxFreq % KFMRadioFreqMultiplier ) / iDecDiv;
- }
- else {}
-
- SetMinimumAndMaximum(
- ( KFMRadioFreqMultiplier * minIntValue ) + ( iDecDiv * minDecValue ),
- ( KFMRadioFreqMultiplier * maxIntValue ) + ( iDecDiv * maxDecValue ) );
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::IsValid
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioFrequencyEditor::IsValid() const
- {
- return ( Field( CurrentField() )->HighlightType() ==
- CEikMfneField::EInverseVideo );
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::IsValidToReport
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioFrequencyEditor::IsValidToReport() const
- {
- return iValidToReport;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::DrawAndReportL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::DrawAndReportL( TBool /*aForceDrawNow*/ )
- {
- //Switched to always do DrawNow() - DrawDeferred() is too slow for rapid
- //frequency changing (long press accelerates after a while)
-// if ( !aForceDrawNow && ( DrawableWindow() && !IsBackedUp() ) )
-// {
-// // Flicker-free redraw.
-// DrawDeferred();
-// }
-// else
-// {
-// DrawNow();
-// }
-
- DrawNow();
-
-
- if ( iReportEditorState )
- {
- iValidToReport = ETrue;
- }
- else
- {
- iValidToReport = EFalse;
- }
- // Report back finally to main container.
- ReportEventL( MCoeControlObserver::EEventStateChanged );
- iValidToReport = EFalse;
- }
-
-
-// ---------------------------------------------------------------------------
-// From class CCoeControl.
-// CFMRadioFrequencyEditor::FocusChanged
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::FocusChanged( TDrawNow /*aDrawNow*/ )
- {
- if ( Field( CurrentField() )->HighlightType() ==
- CEikMfneField::EInverseVideo )
- {
- CFMRadioFrequencyNumber* field =
- static_cast<CFMRadioFrequencyNumber*>( Field( KIntField ) );
- field->SetDigitType( AknTextUtils::NumericEditorDigitType(),
- *Font() );
- field = NULL;
- field = static_cast<CFMRadioFrequencyNumber*>( Field( KDecField ) );
- field->SetDigitType( AknTextUtils::NumericEditorDigitType(),
- *Font() );
- }
-
- if ( DrawableWindow() && !IsBackedUp() )
- {
- // Flicker-free redraw.
- reinterpret_cast<RWindow*>( DrawableWindow() )->Invalidate();
- }
- else
- {
- DrawNow();
- }
- }
-
-void CFMRadioFrequencyEditor::SetEditorReportState( const TBool aReport )
- {
- iReportEditorState = aReport;
- }
-
-// ---------------------------------------------------------------------------
-// From class CCoeControl.
-// CFMRadioFrequencyEditor::HandlePointerEventL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::HandlePointerEventL( const TPointerEvent& aPointerEvent )
- {
- if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
- {
- TBool dataAltered = EFalse;
- TInt newCurrentField = CurrentField();
- TInt error = KErrNone;
-
- CEikMfneField* currField = Field( CurrentField() );
- TInt fieldWidth = iEditorFrameRect.Width() / 2;
- TRect fieldRect;
-
- if ( CurrentField() == KIntField )
- {
- newCurrentField = KDecField;
- TPoint fieldPos( iEditorFrameRect.iTl );
- fieldPos.iX += iEditorFrameRect.Width() - fieldWidth;
- fieldRect.SetRect( fieldPos, TSize( fieldWidth , iEditorFrameRect.Height() ) );
- }
- else
- {
- newCurrentField = KIntField;
- fieldRect.SetRect( iEditorFrameRect.iTl, TSize( fieldWidth , iEditorFrameRect.Height() ) );
- }
-
- if ( fieldRect.Contains( aPointerEvent.iPosition ) )
- {
- FillDecimalField();
- ValidateFields();
- // Minimums and maximums may have to be changed.
- UpdateMinimumAndMaximum();
- // Validate according to new minimums and maximums.
- ValidateFields();
-
- TBuf<3> fieldText;
- TInt fieldVal = 0;
- TRAPD( err, fieldVal = static_cast<CFMRadioFrequencyNumber*>( currField )->Value() )
- if ( !err )
- {
- fieldText.Num( static_cast<TInt64>( fieldVal ) );
- }
- CEikMfne::HandleInteraction( ETrue,
- newCurrentField,
- Font()->TextWidthInPixels( fieldText ),
- currField->HighlightType(),
- dataAltered,
- error );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioFrequencyEditor::SetEditorFrameRect
-// ---------------------------------------------------------------------------
-//
-void CFMRadioFrequencyEditor::SetEditorFrameRect( const TRect& aRect )
- {
- iEditorFrameRect = aRect;
- }
-
-// End of file
--- a/fmradio/fmradio/src/fmradiofrequencynumber.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,390 +0,0 @@
-/*
-* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Frequency number handling for manual tuning dialog
-*
-*/
-
-
-// INCLUDE FILES
-
-#include <aknappui.h>
-#include <aknsoundsystem.h>
-#include <AknTextDecorationMetrics.h>
-#include <numberconversion.h>
-#include <EIKCTL.rsg>
-
-#include "fmradiofrequencynumber.h"
-#include "debug.h"
-
-// ================= MEMBER FUNCTIONS =======================
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CFMRadioFrequencyNumber::CFMRadioFrequencyNumber(TInt aMinimumValue, TInt aMaximumValue, TUint32 aFlags)
- : iMinimumValue(aMinimumValue), iMaximumValue(aMaximumValue), iFlags(aFlags)
- {
- // Get maximum number of digits.
- TBuf<16> maxText;
- maxText.AppendNum(static_cast<TInt64>(aMaximumValue));
- iMaxDigits = maxText.Length();
- }
-
-// EPOC default constructor can leave.
-void CFMRadioFrequencyNumber::ConstructL(const CFont& aFont, TInt aInitialValue)
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::ConstructL") ) );
- // Init text field containing the value.
- iText = HBufC::NewL(iMaxDigits);
- SetValue(aInitialValue, aFont);
- }
-
-// Two-phased constructor.
-CFMRadioFrequencyNumber* CFMRadioFrequencyNumber::NewL(const CFont& aFont, TInt aMinimumValue, TInt aMaximumValue, TInt aInitialValue, TUint32 aFlags)
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::NewL") ) );
- CFMRadioFrequencyNumber* self = new (ELeave) CFMRadioFrequencyNumber(aMinimumValue, aMaximumValue, aFlags);
- CleanupStack::PushL(self);
- self->ConstructL(aFont, aInitialValue);
- CleanupStack::Pop();
- return self;
- }
-
-
-// Destructor
-CFMRadioFrequencyNumber::~CFMRadioFrequencyNumber()
- {
- delete iText;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::MaximumWidthInPixels
-// TInt addedWith is calculated same way than in TInt CEikMfneField::AdditionalWidthForHighlights,
-// which is public but not exported method.
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TInt CFMRadioFrequencyNumber::MaximumWidthInPixels(const CFont& aFont, TBool /*aShrinkToMinimumSize*/)
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::MaximumWidthInPixels") ) );
- TInt addedWidth = 0;
- if ( IsEditable() )
- {
- TInt rightHighlight = 0;
- TAknTextDecorationMetrics metrics( &aFont );
- // Width is increased only by leftHighlight. This is a compromise in that glyphs already have
- // spacing within them to achieve character spacing. This spacing is generally (for numbers) on the right.
- metrics.GetLeftAndRightMargins( addedWidth, rightHighlight ); // rightHighlight is not used
- }
-
- return (iMaxDigits * TFindWidthOfWidestDigitType(iDigitType).MaximumWidthInPixels(aFont)) + addedWidth;
- }
-
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::InputCapabilities
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TCoeInputCapabilities CFMRadioFrequencyNumber::InputCapabilities() const
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::InputCapabilities") ) );
- return TCoeInputCapabilities::EWesternNumericIntegerPositive;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::Text
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-const TDesC& CFMRadioFrequencyNumber::Text() const
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::Text") ) );
-
- if (iFlags & EIsUninitialised)
- {
- return KNullDesC();
- }
-
- return *iText;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::SetValue
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyNumber::SetValue(TInt aValue, const CFont& aFont)
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::SetValue") ) );
- iFlags &= ~EIsUninitialised;
- TPtr text = iText->Des();
- text.SetLength(0);
- TInt firstUnsetCharacter = text.Length();
- text.SetLength(firstUnsetCharacter + iMaxDigits);
- TInt lastUnsetCharacter = text.Length() - 1;
-
- if (aValue == 0)
- {
- text[lastUnsetCharacter--] = TText(iDigitType);
- }
- else
- {
- for (; aValue; aValue/=10)
- {
- text[lastUnsetCharacter--] = (TText)(TText(iDigitType) + (aValue%10));
- }
- }
-
- if (lastUnsetCharacter >= firstUnsetCharacter)
- {
- if (iFlags & EFillWithLeadingZeros)
- {
- while (lastUnsetCharacter >= firstUnsetCharacter)
- {
- text[lastUnsetCharacter--] = TText(iDigitType);
- }
- }
- else
- {
- text.Delete(firstUnsetCharacter, (lastUnsetCharacter + 1) - firstUnsetCharacter);
- }
- }
-
- if (iFlags & EPreserveOldWidthBeforeEditing)
- {
- iMinimumWidthInPixels = aFont.TextWidthInPixels(Text());
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::Value
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TInt CFMRadioFrequencyNumber::Value() const
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::Value") ) );
- if (iText->Length() == 0)
- {
- CAknKeySoundSystem* soundPlayer = (static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi()))->KeySounds();
- if (soundPlayer)
- {
- soundPlayer->PlaySound(EAvkonSIDWarningTone);
- }
- CBaActiveScheduler::LeaveNoAlert();
- }
-
- return ValueFromText();
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::IsValid
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TBool CFMRadioFrequencyNumber::IsValid() const
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::IsValid") ) );
- return (iText->Length() != 0);
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::IsEditable
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TBool CFMRadioFrequencyNumber::IsEditable() const
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::IsEditable") ) );
- return ETrue;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::HighlightType
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-CEikMfneField::THighlightType CFMRadioFrequencyNumber::HighlightType() const
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::HighlightType") ) );
- return (iFlags & EIsBeingEditedWithCursor) ? ECursor : EInverseVideo;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::HandleKey
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyNumber::HandleKey(const CFont& /*aFont*/, const TKeyEvent& aKeyEvent, TBool /*aInterpretLeftAndRightAsEarEvents*/, TBool& aDataAltered, TInt& aHighlightIncrement)
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::HandleKey") ) );
- TChar ch = aKeyEvent.iCode;
- TPtr text = iText->Des();
- TInt textLength = text.Length();
-
- switch (ch)
- {
- case EKeyLeftArrow:
- case EKeyRightArrow:
- {
- HandleLeftOrRightArrow(ch, aDataAltered, aHighlightIncrement);
- break;
- }
- case EKeyBackspace:
- {
- if (textLength)
- {
- iFlags |= EIsBeingEditedWithCursor;
- text.SetLength(textLength-1);
- aDataAltered = ETrue;
- iFlags &= ~EIsUninitialised;
- }
- break;
- }
- default:
- {
- // Number key:
- if (ch.GetNumericValue() != KErrNotFound)
- {
- if (~iFlags & EIsBeingEditedWithCursor)
- {
- // If only one number field, do not change to cursor mode.
- if (iMaxDigits > 1)
- {
- iFlags |= EIsBeingEditedWithCursor;
- }
- text.SetLength(0);
- }
-
- TBuf<1> normCh;
- normCh.Append(ch);
- NumberConversion::ConvertDigits(normCh, iDigitType);
- text.Append(normCh[0]);
- aDataAltered = ETrue;
- iFlags &= ~EIsUninitialised;
- if (iText->Length() >= iMaxDigits)
- {
- aHighlightIncrement = 1;
- }
- }
- break;
- }
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::HandleDeHighlight
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyNumber::HandleDeHighlight(const CFont& aFont, CEikonEnv& aEikonEnv, TBool& aDataAltered, TBool& aError)
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::HandleDeHighlight") ) );
- iFlags &= ~EIsBeingEditedWithCursor;
-
- if (iText->Length() == 0)
- {
- SetValue(iMaximumValue, aFont);
- aDataAltered = ETrue;
- aError = ETrue;
- aEikonEnv.InfoMsg(R_EIK_TBUF_NO_NUMBER_ENTERED);
- return;
- }
-
- TInt value = ValueFromText();
- TBuf<128> oldText = *iText;
- TBool unInit = iFlags & EIsUninitialised;
- SetValue(value, aFont);
-
- if (oldText != *iText)
- {
- aDataAltered = ETrue;
- }
- else
- {
- if (unInit)
- {
- iFlags |= EIsUninitialised;
- }
- else
- {
- iFlags &= ~EIsUninitialised;
- }
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::ValueFromText
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TInt CFMRadioFrequencyNumber::ValueFromText() const
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::ValueFromText") ) );
- if (!iText->Length())
- {
- return iMinimumValue;
- }
-
- TInt i = 0;
- TInt valueFromText = 0;
- TInt textLength = iText->Length();
-
- for (; i<textLength; ++i)
- {
- TText digit = (*iText)[i];
- valueFromText = (valueFromText * 10) + (TInt)(digit - TText(iDigitType));
- }
-
- return valueFromText;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::SetDigitType
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyNumber::SetDigitType(TDigitType aDigitType, const CFont& aFont)
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::SetDigitType") ) );
- TInt value = Value();
- iDigitType = aDigitType;
- SetValue(value, aFont);
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyNumber::DigitType
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TDigitType CFMRadioFrequencyNumber::DigitType() const
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyNumber::DigitType") ) );
- return iDigitType;
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradiofrequencyquerycontrol.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1187 +0,0 @@
-/*
-* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Manual tuning dialog for FMRadio
-*
-*/
-
-
-// INCLUDE FILES
-#include <aknappui.h>
-#include <AknsFrameBackgroundControlContext.h>
-#include <aknbutton.h>
-#include <AknLayoutDef.h>
-#include <AknLayout2ScalableDef.h>
-#include <aknlayoutscalable_avkon.cdl.h>
-#include <avkon.mbg>
-#include <avkon.rsg>
-#include <barsread.h>
-#include <eiklabel.h>
-#include <skinlayout.cdl.h>
-#include <AknsDrawUtils.h>
-#include <StringLoader.h>
-#include <aknconsts.h>
-#include <fmradio.rsg>
-
-#include "fmradiofrequencyquerycontrol.h"
-#include "fmradiofrequencyeditor.h"
-#include "fmradio.hrh"
-#include "debug.h"
-
-// CONSTANTS
-
-const TInt KFMRadioButtonLongPressDelay = 450; //microseconds after long press event is reported
-const TInt KFMRadioButtonRepeatDelay = 500; //microseconds after repeat event is reported
-const TInt KFMRadioButtonRepeatInterval = 200; //microseconds after repeat event is repeated
-const TInt KFMRadioButtonRepeatDelayMicroseconds(KFMRadioButtonRepeatDelay*1000);
-const TInt KFMRadioButtonRepeatIntervalMicrosecondsAccelerated(KFMRadioButtonRepeatInterval*500);
-const TInt KFMRadioButtonRepeatAccelerationDelay(2000000); //Two seconds until accelerate long press repeat
-
-const TInt KEditorFrameCustomLRMargins = 50;
-const TInt KEditorFrameCustomAdditionHeight = 30;
-
-const TInt KFMRadioEditorCustomInnerFrameSize = 15;
-const TInt KFMRadioEditorCustomButtonMarginToLeftFrame = 1;
-const TInt KFMRadioEditorCustomButtonSize = 16;
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CFMRadioFrequencyQueryControl::CFMRadioFrequencyQueryControl() : CAknQueryControl()
- {
- }
-
-// Destructor
-CFMRadioFrequencyQueryControl::~CFMRadioFrequencyQueryControl()
- {
- if (iFreqEditor)
- AknsUtils::DeregisterControlPosition(iFreqEditor);
- delete iFreqEditor;
- delete iMyPrompt;
- delete iMyEditorIndicator;
- delete iEditorContext;
-
- if ( iLongPressAccelerationTimer )
- {
- iLongPressAccelerationTimer->Cancel();
- delete iLongPressAccelerationTimer;
- }
- if ( iLongPressTimer)
- {
- iLongPressTimer->Cancel();
- delete iLongPressTimer;
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::StaticCreateCustomControl
-// ---------------------------------------------------------
-//
-SEikControlInfo CFMRadioFrequencyQueryControl::StaticCreateCustomControl(TInt aIdentifier)
-{
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryControl::StaticCreateCustomControl -- ENTER") ) );
- SEikControlInfo customInfo;
- Mem::FillZ(&customInfo, sizeof(SEikControlInfo)); // zero all variables
-
- if (aIdentifier == EFMRadioCtFrequencyQuery)
- {
- customInfo.iControl = new CFMRadioFrequencyQueryControl;
- }
-
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryControl::StaticCreateCustomControl -- EXIT") ) );
- return customInfo;
-}
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::ConstructQueryL
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::ConstructQueryL(TResourceReader& aRes)
- {
-
- iFreqEditor = new (ELeave) CFMRadioFrequencyEditor;
- iFreqEditor->SetContainerWindowL(*this);
- iFreqEditor->ConstructFromResourceL(aRes);
- iFreqEditor->SetObserver(this);
- iFreqEditor->SetSkinTextColorL( EAknsCIQsnTextColorsCG27 );//query text input field
-
- iMyPrompt = new (ELeave) CEikLabel;
- iMyPrompt->SetContainerWindowL( *this );
- HBufC* promptTxt = StringLoader::LoadLC( R_QTN_FMRADIO_MANUAL_TUNE_FREQ );
- iMyPrompt->SetTextL( *promptTxt );
- CleanupStack::PopAndDestroy( promptTxt );
-
- iMyEditorIndicator = CFMRadioManualTuningEditorIndicator::NewL( this );
-
- // Construct editor context
- iEditorContext = CAknsFrameBackgroundControlContext::NewL(
- KAknsIIDQsnFrInput, TRect(0,0,1,1), TRect(0,0,1,1), EFalse );
-
- if ( AknLayoutUtils::PenEnabled() )
- {
- // Buttons with correct icons
- iIncreaseValueButton =
- CAknButton::NewL(KAvkonBitmapFile,
- EMbmAvkonQgn_indi_button_increase,
- EMbmAvkonQgn_indi_button_increase_mask,
- -1,
- -1,
- EMbmAvkonQgn_indi_button_increase_pressed,
- EMbmAvkonQgn_indi_button_increase_pressed_mask,
- -1,
- -1,
- KNullDesC,
- KNullDesC,
- KAknButtonNoFrame /*| KAknButtonKeyRepeat*/ | KAknButtonReportOnLongPress,
- 0,
- KAknsIIDQgnIndiButtonIncrease,
- KAknsIIDNone,
- KAknsIIDQgnIndiButtonIncreasePressed,
- KAknsIIDNone );
- iIncreaseValueButton->SetContainerWindowL(*this);
- iIncreaseValueButton->SetParent(this);
- iIncreaseValueButton->SetObserver(this);
- iIncreaseValueButton->MakeVisible(ETrue);
- iIncreaseValueButton->SetFocusing(EFalse);
- iIncreaseValueButton->SetKeyRepeatInterval( KFMRadioButtonRepeatDelay, KFMRadioButtonRepeatInterval );
- iIncreaseValueButton->SetLongPressInterval( KFMRadioButtonLongPressDelay );
-
- iDecreaseValueButton =
- CAknButton::NewL(KAvkonBitmapFile,
- EMbmAvkonQgn_indi_button_decrease,
- EMbmAvkonQgn_indi_button_decrease_mask,
- -1,
- -1,
- EMbmAvkonQgn_indi_button_decrease_pressed,
- EMbmAvkonQgn_indi_button_decrease_pressed_mask,
- -1,
- -1,
- KNullDesC,
- KNullDesC,
- KAknButtonNoFrame /*| KAknButtonKeyRepeat*/ | KAknButtonReportOnLongPress,
- 0,
- KAknsIIDQgnIndiButtonDecrease,
- KAknsIIDNone,
- KAknsIIDQgnIndiButtonDecreasePressed,
- KAknsIIDNone );
- iDecreaseValueButton->SetContainerWindowL(*this);
- iDecreaseValueButton->SetParent(this);
- iDecreaseValueButton->SetObserver(this);
- iDecreaseValueButton->MakeVisible(ETrue);
- iDecreaseValueButton->SetFocusing(EFalse);
- iDecreaseValueButton->SetKeyRepeatInterval( KFMRadioButtonRepeatDelay, KFMRadioButtonRepeatInterval );
- iDecreaseValueButton->SetLongPressInterval( KFMRadioButtonLongPressDelay );
- }
-
- iLongPressAccelerationTimer = CPeriodic::NewL( CActive::EPriorityStandard );
- iLongPressTimer = CPeriodic::NewL( CActive::EPriorityStandard );
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::ComponentControl
-// ---------------------------------------------------------
-//
-CCoeControl* CFMRadioFrequencyQueryControl::ComponentControl(TInt aIndex) const
- {
- /*lint -save -e1763*/
- CCoeControl* ccontrol = NULL;
-
- switch (aIndex)
- {
- case 0:
- {
- ccontrol = iMyPrompt;
- break;
- }
- case 1:
- {
- ccontrol = iMyEditorIndicator;
- break;
- }
- case 2:
- {
- ccontrol = iFreqEditor;
- break;
- }
- case 3:
- {
- if ( AknLayoutUtils::PenEnabled() )
- {
- ccontrol = iIncreaseValueButton;
- }
- break;
- }
-
- case 4:
- {
- if ( AknLayoutUtils::PenEnabled() )
- {
- ccontrol = iDecreaseValueButton;
- }
- break;
- }
-
- default:
- {
- ccontrol = NULL;
- break;
- }
- }
- return ccontrol;
- /*lint -restore*/
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::CountComponentControls
-// ---------------------------------------------------------
-//
-TInt CFMRadioFrequencyQueryControl::CountComponentControls() const
- {
- if ( AknLayoutUtils::PenEnabled() )
- {
- return 5;
- }
- else
- {
- return 3;
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::FocusChanged
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::FocusChanged(TDrawNow aDrawNow)
- {
- if (iFreqEditor)
- {
- iFreqEditor->SetFocus(IsFocused(), aDrawNow);
- SizeChanged();
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::PrepareForFocusLossL
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::PrepareForFocusLossL()
- {
- if (iFreqEditor)
- {
- iFreqEditor->PrepareForFocusLossL();
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::SetAcceleratedLongPress
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::SetAcceleratedLongPress(TBool aAccelerated)
- {
- iLongPressAccelerationTimer->Cancel();
- iLongPressTimer->Cancel();
-
- if( aAccelerated)
- {
- //add more speed
- iLongPressTimer->Start(KFMRadioButtonRepeatIntervalMicrosecondsAccelerated,
- KFMRadioButtonRepeatIntervalMicrosecondsAccelerated,
- TCallBack(LongPressTimerCallBack, this));
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::LongPressAccelerateCallBack
-// ---------------------------------------------------------
-//
-TInt CFMRadioFrequencyQueryControl::LongPressAccelerateCallBack( TAny* aAny )
- {
- ((CFMRadioFrequencyQueryControl*)(aAny))->SetAcceleratedLongPress(ETrue);
- return KErrNone;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::LongPressTimerCallBack
-// ---------------------------------------------------------
-//
-TInt CFMRadioFrequencyQueryControl::LongPressTimerCallBack( TAny* aAny )
- {
- ((CFMRadioFrequencyQueryControl*)(aAny))->DoIncrementOrDecrement();
- return KErrNone;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::DoIncrementOrDecrement
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::DoIncrementOrDecrement()
- {
- if(iChangeDirectionIncrease)
- {
- iFreqEditor->IncrementCurrentField();
- }
- else
- {
- iFreqEditor->DecrementCurrentField();
- }
-
- iKeyPressReported = ETrue;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::StartKeypress
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::StartKeypress()
- {
- iKeyPressReported = EFalse;
- iLongPressAccelerationTimer->Cancel();
- iLongPressAccelerationTimer->Start(KFMRadioButtonRepeatAccelerationDelay, 0,
- TCallBack(LongPressAccelerateCallBack, this));
- iLongPressTimer->Start(KFMRadioButtonRepeatDelayMicroseconds,
- KFMRadioButtonRepeatDelayMicroseconds,
- TCallBack(LongPressTimerCallBack, this));
- iFreqEditor->SetEditorReportState( EFalse );
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::OfferKeyEventL
-// ---------------------------------------------------------
-//
-TKeyResponse CFMRadioFrequencyQueryControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
- {
- if ( aType == EEventKeyDown &&
- (aKeyEvent.iScanCode == EStdKeyUpArrow || aKeyEvent.iScanCode == EStdKeyDownArrow) )
- {
- iChangeDirectionIncrease = (aKeyEvent.iScanCode == EStdKeyUpArrow);
- StartKeypress();
-
- return EKeyWasConsumed;
- }
- else if ( aType == EEventKeyUp &&
- (aKeyEvent.iScanCode == EStdKeyUpArrow || aKeyEvent.iScanCode == EStdKeyDownArrow) )
- {
- if(!iKeyPressReported)
- {
- //was not a long press
- DoIncrementOrDecrement();
- }
-
- SetAcceleratedLongPress(EFalse);
- iFreqEditor->SetEditorReportState( ETrue );
- iFreqEditor->DrawAndReportL( EFalse );
-
- return EKeyWasConsumed;
- }
-
- //eat all up and down events, this is for EEventKey
- if(aKeyEvent.iScanCode == EStdKeyUpArrow || aKeyEvent.iScanCode == EStdKeyDownArrow)
- {
- return EKeyWasConsumed;
- }
-
- return iFreqEditor->OfferKeyEventL(aKeyEvent, aType);
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::HandleControlEventL
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType)
- {
- if ( aEventType == CAknButton::ELongPressEndedEvent )
- {
- SetAcceleratedLongPress(EFalse);
- iFreqEditor->SetEditorReportState( ETrue );
- iFreqEditor->DrawAndReportL( EFalse );
- }
-
- if ( (aControl == iIncreaseValueButton || aControl == iDecreaseValueButton )
- && aEventType == CAknButton::ELongPressEvent )
- {
- iChangeDirectionIncrease = (aControl == iIncreaseValueButton);
- StartKeypress();
- return;
- }
-
- //single presses
- if ( aControl == iIncreaseValueButton && aEventType == EEventStateChanged )
- {
- iFreqEditor->IncrementCurrentField();
- return;
- }
-
- else if ( aControl == iDecreaseValueButton && aEventType == EEventStateChanged )
- {
- iFreqEditor->DecrementCurrentField();
- return;
- }
-
- //finally tune to the frequency
- if (iQueryControlObserver && aEventType == EEventStateChanged)
- {
- if ( iFreqEditor->IsValidToReport() )
- {
- MAknQueryControlObserver::TQueryValidationStatus validity = MAknQueryControlObserver::EEditorValueValid;
- if ( !iFreqEditor->IsValid() )
- {
- validity = MAknQueryControlObserver::EEditorValueNotParsed;
- }
- iQueryControlObserver->HandleQueryEditorStateEventL( this, MAknQueryControlObserver::EQueryControlEditorStateChanging, validity );
- }
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::SetFrequency
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::SetFrequency(const TUint32 aFreq)
- {
- if (iFreqEditor)
- {
- iFreqEditor->SetFrequency(aFreq);
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::Frequency
-// ---------------------------------------------------------
-//
-TUint32 CFMRadioFrequencyQueryControl::Frequency() const
- {
- if (iFreqEditor)
- {
- return iFreqEditor->Frequency();
- }
- return 0;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::ControlByLayoutOrNull
-// ---------------------------------------------------------
-//
-CCoeControl* CFMRadioFrequencyQueryControl::ControlByLayoutOrNull(TInt /*aLayout*/)
- {
- return iFreqEditor;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::EditorContentIsValidL
-// ---------------------------------------------------------
-//
-TBool CFMRadioFrequencyQueryControl::EditorContentIsValidL() const
- {
- TInt ret = EFalse;
- if (iFreqEditor)
- {
- CEikMfne* editor = iFreqEditor;
- ret = editor->Field(editor->CurrentField())->IsValid();
- }
- return ret;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::SetAndUseFlags
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::SetAndUseFlags(TBitFlags16 aFlags)
- {
- iFlags = aFlags;
- iMyEditorIndicator->SetFlags(aFlags);
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::LayoutEditor
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::LayoutEditor(const TLayoutMethod& aLayoutM)
- {
- TIndex LAFIndex(NbrOfPromptLines());
- iHasEditor = ETrue;
- LayoutEditorFrame(aLayoutM);
- LayoutEditorIndicator(aLayoutM);
-
- CEikMfne* edwin = NULL;
-
- if ( iFreqEditor )
- {
- edwin = iFreqEditor;
- }
-
- if ( edwin )
- {
- TInt variety( LAFIndex.PromptLine() );
- if ( AknLayoutUtils::PenEnabled() )
- {
- variety = NbrOfPromptLines() != 0 ? ( 6 - NbrOfPromptLines() ) : 5;
- }
- TAknWindowLineLayout lineLayout( AknLayoutScalable_Avkon::query_popup_pane( variety ) );
- TAknTextComponentLayout textLayout( AknLayoutScalable_Avkon::query_popup_pane_t1() );
- if ( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- {
- lineLayout.it = iDialogSize.iHeight / 2 - lineLayout.iH / 2;
- }
-
- AknLayoutUtils::LayoutMfne( edwin, LayoutRect(),
- TAknWindowComponentLayout::ComposeText(
- lineLayout,
- textLayout ) );
-
-
- edwin->SetBorder( TGulBorder::ENone );
- if ( IsFocused() && !edwin->IsFocused() )
- {
- edwin->SetFocus( ETrue );
- }
- edwin->SetUpAndDownKeysConsumed( ETrue );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::LayoutPrompt
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::LayoutPrompt(const TLayoutMethod& /*aLayoutM*/)
- {
- if (iMyPrompt)
- {
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
- TRgb color;
- TInt error = AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19 );
-
- AknLayoutUtils::LayoutLabel(iMyPrompt, LayoutRect(), AKN_LAYOUT_TEXT_Code_query_pop_up_window_texts_Line_1(0) );
-
- if (!error)
- {
- TRAP_IGNORE(AknLayoutUtils::OverrideControlColorL( *iMyPrompt, EColorLabelText, color ) )
- }
- }
-
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::LayoutImageOrAnim
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::LayoutImageOrAnim(const TLayoutMethod& /*aLayoutM*/)
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::LayoutEditorFrame
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::LayoutEditorFrame(const TLayoutMethod& /*aLayoutM*/)
- {
- TIndex LAFIndex(NbrOfPromptLines());
- TRect rect = LayoutRect();
-
- TInt variety( LAFIndex.PromptLine() );
- TAknWindowLineLayout lineLayout(AKN_LAYOUT_WINDOW_Code_query_pop_up_window_elements_Line_1( variety ));
- lineLayout.il += KEditorFrameCustomLRMargins;
- lineLayout.ir += KEditorFrameCustomLRMargins;
- lineLayout.it -= KEditorFrameCustomAdditionHeight/2;
- lineLayout.ib -= KEditorFrameCustomAdditionHeight/2;
- lineLayout.iH += KEditorFrameCustomAdditionHeight;
- if( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- {
- lineLayout.it = iDialogSize.iHeight/ 2 - lineLayout.iH / 2;
- }
- iEditorVerShadow.LayoutRect( rect, lineLayout );
-
- lineLayout = AKN_LAYOUT_WINDOW_Code_query_pop_up_window_elements_Line_2( variety );
- lineLayout.il += KEditorFrameCustomLRMargins;
- lineLayout.ir += KEditorFrameCustomLRMargins;
- lineLayout.it -= KEditorFrameCustomAdditionHeight/2;
- lineLayout.ib -= KEditorFrameCustomAdditionHeight/2;
- lineLayout.iH += KEditorFrameCustomAdditionHeight;
- if( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- {
- lineLayout.it = iDialogSize.iHeight/ 2 - lineLayout.iH / 2;
- }
- iEditorHorShadow.LayoutRect( rect, lineLayout );
-
- // variety needs to be adjusted for touch layouts.
- if ( AknLayoutUtils::PenEnabled() )
- {
- variety = NbrOfPromptLines() != 0 ? ( 6 - NbrOfPromptLines() ) : 5;
- }
- lineLayout = AknLayoutScalable_Avkon::query_popup_pane( variety );
- lineLayout.il += KEditorFrameCustomLRMargins;
- lineLayout.ir += KEditorFrameCustomLRMargins;
- lineLayout.it -= KEditorFrameCustomAdditionHeight/2;
- lineLayout.ib -= KEditorFrameCustomAdditionHeight/2;
- lineLayout.iH += KEditorFrameCustomAdditionHeight;
- if( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- {
- lineLayout.it = iDialogSize.iHeight/ 2 - lineLayout.iH / 2;
- }
- iEditorFrame.LayoutRect( rect, lineLayout );
- iFreqEditor->SetEditorFrameRect( iEditorFrame.Rect() );
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::LayoutEditorIndicator
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::LayoutEditorIndicator(const TLayoutMethod& /*aLayoutM*/)
- {
- TIndex LAFIndex(NbrOfPromptLines());
-
- if (!iMyEditorIndicator)
- return;
-
- TInt variety( LAFIndex.PromptLine() );
- if ( AknLayoutUtils::PenEnabled() )
- {
- // adjust layout variety for touch
- variety = 5 - variety;
- }
- TAknWindowLineLayout lineLayout(AknLayoutScalable_Avkon::indicator_popup_pane( variety ));
- lineLayout.ir += KEditorFrameCustomLRMargins;
- lineLayout.it -= KEditorFrameCustomAdditionHeight/2;
- if( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- {
- lineLayout.it = iDialogSize.iHeight / 2 - lineLayout.iH - iEditorFrame.Rect().Height()/2;
- }
- AknLayoutUtils::LayoutControl(iMyEditorIndicator, LayoutRect(), lineLayout );
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::LayoutRect
-// ---------------------------------------------------------
-//
-TRect CFMRadioFrequencyQueryControl::LayoutRect()
- {
- TPoint topLeft = Position();
- TRect parent( TPoint(0,0), iDialogSize );
- TAknLayoutRect layout;
-
- layout.LayoutRect(parent, AKN_LAYOUT_WINDOW_Note_pop_up_window_graphics_Line_5(parent));
-
- TRect rect(layout.Rect());
- topLeft.iX -= rect.iTl.iX;
- topLeft.iY -= rect.iTl.iY;
-
- TPoint bottomRight (topLeft);
- TSize size (iDialogSize);
- bottomRight.iY += size.iHeight;
- bottomRight.iX += size.iWidth;
- return TRect(topLeft,bottomRight);
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::SetLineWidthsL
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::SetLineWidthsL()
- {
- if (!iLineWidths)
- return;
-
- iLineWidths->Reset();
- TAknWindowLineLayout lineLayout(AknLayoutScalable_Avkon::popup_query_code_window(0));
- if( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- lineLayout.it += KFMRadioFrequencyQueryDialogCustomAdditionHeight / 2;
-
- TAknLayoutRect parentLayoutRect;
- parentLayoutRect.LayoutRect(iAvkonAppUi->ClientRect(), lineLayout);
-
- TAknLayoutText textRect;
- for (TInt i = 0; i < 3; i++)
- {
- TAknTextLineLayout textLineLayout = AKN_LAYOUT_TEXT_Code_query_pop_up_window_texts_Line_1(i);
- if ( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- {
- textLineLayout.iB -= KFMRadioFrequencyQueryDialogCustomAdditionHeight / 2;
- }
- textRect.LayoutText(parentLayoutRect.Rect(), textLineLayout);
- iLineWidths->AppendL(textRect.TextRect().Width());
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::Draw
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::Draw(const TRect& /*aRect*/) const
- {
- CWindowGc& gc=SystemGc();
- TRect rect(Rect());
-
- TRect dialogRect(TPoint(0,0), iDialogSize );
- rect.iBr.iY += dialogRect.iBr.iY;
-
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-
- TRgb color;
- TInt error = AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19 );
- if ( !error )
- {
- TRAP_IGNORE(AknLayoutUtils::OverrideControlColorL( *(CAknQueryControl*)this, EColorLabelText, color ) );
- }
-
- MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
- AknsDrawUtils::Background( skin, cc, this, gc, rect );
- DrawFrequencyEditorFrame(gc,rect);
- }
-
-/**
- * Draw frequency editor frame and shadow
- */
-void CFMRadioFrequencyQueryControl::DrawFrequencyEditorFrame(CWindowGc& aGc,TRect& /*aRect*/) const
- {
- if (iHasEditor)
- {
- TBool skinnedDraw( EFalse );
- skinnedDraw = AknsDrawUtils::Background(
- AknsUtils::SkinInstance(),
- iEditorContext,
- aGc,
- iEditorFrame.Rect() );
-
- if( !skinnedDraw )
- {
- iEditorFrame.DrawOutLineRect(aGc);
- iEditorVerShadow.DrawRect(aGc);
- iEditorHorShadow.DrawRect(aGc);
- }
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::SizeChanged.
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::SizeChanged()
- {
- if (iMyPrompt)
- {
- iMyPrompt->SetRect(LayoutRect());
- LayoutPrompt(ETimeQueryLayoutM);
- }
- if (iFreqEditor)
- {
- LayoutEditor(ETimeQueryLayoutM);
- }
-
- if( iHasEditor && iEditorContext )
- {
- // Layout editor context
- TAknLayoutRect topLeft;
- TAknLayoutRect bottomRight;
-
- TAknWindowLineLayout lineLayout(SkinLayout::Input_field_skin_placing__general__Line_2());
- topLeft.LayoutRect(iEditorFrame.Rect(), lineLayout );
- bottomRight.LayoutRect(TRect(iEditorFrame.Rect().iBr, iEditorFrame.Rect().iBr), SkinLayout::Input_field_skin_placing__general__Line_5());
-
- TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
- TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
-
- outerRect.iTl.iY -= KFMRadioEditorCustomInnerFrameSize;
- outerRect.iBr.iY += KFMRadioEditorCustomInnerFrameSize;
-
- innerRect.iTl.iY -= KFMRadioEditorCustomInnerFrameSize;
- innerRect.iBr.iY += KFMRadioEditorCustomInnerFrameSize;
-
- iEditorContext->SetFrameRects( outerRect, innerRect );
- // Chain with the background (since the frame doesn't occupy the entire
- // layout and it may even be transparent)
- iEditorContext->SetParentContext( AknsDrawUtils::ControlContextOfParent( this ) );
-
- if ( AknLayoutUtils::PenEnabled() )
- {
- if ( !iIncreaseValueButton )
- {
- TRAPD( err, iIncreaseValueButton =
- CAknButton::NewL(KAvkonBitmapFile,
- EMbmAvkonQgn_indi_button_increase,
- EMbmAvkonQgn_indi_button_increase_mask,
- -1,
- -1,
- EMbmAvkonQgn_indi_button_increase_pressed,
- EMbmAvkonQgn_indi_button_increase_pressed_mask,
- -1,
- -1,
- KNullDesC,
- KNullDesC,
- KAknButtonNoFrame | KAknButtonKeyRepeat | KAknButtonReportOnLongPress,
- 0,
- KAknsIIDQgnIndiButtonIncrease,
- KAknsIIDNone,
- KAknsIIDQgnIndiButtonIncreasePressed,
- KAknsIIDNone );
- iIncreaseValueButton->SetContainerWindowL(*this);
- );
-
- if ( err == KErrNone )
- {
- iIncreaseValueButton->SetParent(this);
- iIncreaseValueButton->SetObserver(this);
- iIncreaseValueButton->MakeVisible(ETrue);
- iIncreaseValueButton->SetFocusing(EFalse);
- iIncreaseValueButton->SetKeyRepeatInterval( KFMRadioButtonRepeatDelay, KFMRadioButtonRepeatInterval );
- iIncreaseValueButton->SetLongPressInterval( KFMRadioButtonLongPressDelay );
- }
- }
-
- if ( !iDecreaseValueButton )
- {
- TRAPD( err, iDecreaseValueButton = CAknButton::NewL(KAvkonBitmapFile,
- EMbmAvkonQgn_indi_button_decrease,
- EMbmAvkonQgn_indi_button_decrease_mask,
- -1,
- -1,
- EMbmAvkonQgn_indi_button_decrease_pressed,
- EMbmAvkonQgn_indi_button_decrease_pressed_mask,
- -1,
- -1,
- KNullDesC,
- KNullDesC,
- KAknButtonNoFrame | KAknButtonKeyRepeat | KAknButtonReportOnLongPress,
- 0,
- KAknsIIDQgnIndiButtonDecrease,
- KAknsIIDNone,
- KAknsIIDQgnIndiButtonDecreasePressed,
- KAknsIIDNone );
- iDecreaseValueButton->SetContainerWindowL(*this);
- );
-
- if ( err == KErrNone )
- {
- iDecreaseValueButton->SetParent(this);
- iDecreaseValueButton->SetObserver(this);
- iDecreaseValueButton->MakeVisible(ETrue);
- iDecreaseValueButton->SetFocusing(EFalse);
- iDecreaseValueButton->SetKeyRepeatInterval( KFMRadioButtonRepeatDelay, KFMRadioButtonRepeatInterval );
- iDecreaseValueButton->SetLongPressInterval( KFMRadioButtonLongPressDelay );
- }
- }
- // Position the buttons according to LAF
-
- TIndex LAFIndex(NbrOfPromptLines());
- TInt variety( 5 - LAFIndex.PQCWindow() );
-
- AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation();
- TInt offset = 0;
- if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight)
- {
- offset = 3;
- }
- else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft)
- {
- offset = 6;
- }
- variety += offset;
-
- TAknWindowComponentLayout btnSpaceLayout;
-
- btnSpaceLayout = AknLayoutScalable_Avkon::button_value_adjust_pane( variety );
-
- if ( iIncreaseValueButton )
- {
- TAknWindowLineLayout buttonIncr = TAknWindowComponentLayout::Compose(
- btnSpaceLayout,
- AknLayoutScalable_Avkon::button_value_adjust_pane_g1()).LayoutLine();
-
- TInt marginToNumberFrame = KEditorFrameCustomLRMargins -
- KFMRadioEditorCustomButtonMarginToLeftFrame - KFMRadioEditorCustomButtonSize;
-
- buttonIncr.ir += marginToNumberFrame;
- buttonIncr.iH += KFMRadioEditorCustomButtonSize;
- buttonIncr.iW += KFMRadioEditorCustomButtonSize;
-
- if ( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- {
- buttonIncr.it = iDialogSize.iHeight / 2 - buttonIncr.iH;
- }
-
- TAknLayoutRect increaseValueButtonRect;
- increaseValueButtonRect.LayoutRect( LayoutRect(), buttonIncr );
- iIncreaseValueButton->SetRect(increaseValueButtonRect.Rect());
- }
-
- if ( iDecreaseValueButton)
- {
- TAknWindowLineLayout buttonDecr = TAknWindowComponentLayout::Compose(
- btnSpaceLayout,
- AknLayoutScalable_Avkon::button_value_adjust_pane_g2()).LayoutLine();
-
- TInt marginToNumberFrame = KEditorFrameCustomLRMargins -
- KFMRadioEditorCustomButtonMarginToLeftFrame - KFMRadioEditorCustomButtonSize;
-
- buttonDecr.ir += marginToNumberFrame;
- buttonDecr.iH += KFMRadioEditorCustomButtonSize;
- buttonDecr.iW += KFMRadioEditorCustomButtonSize;
-
- if ( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- {
- buttonDecr.it = iDialogSize.iHeight / 2;
- }
- TAknLayoutRect decreaseValueButtonRect;
- decreaseValueButtonRect.LayoutRect( LayoutRect(), buttonDecr );
- iDecreaseValueButton->SetRect(decreaseValueButtonRect.Rect());
- }
- }
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::MopSupplyObject
-// ---------------------------------------------------------
-//
-TTypeUid::Ptr CFMRadioFrequencyQueryControl::MopSupplyObject(TTypeUid aId)
- {
- if( (aId.iUid == MAknsControlContext::ETypeId) &&
- iEditorContext && iHasEditor )
- {
- // Return specific context iff editor exists and the context
- // has been constructed.
- return MAknsControlContext::SupplyMopObject(
- aId, iEditorContext );
- }
-
- if ( aId.iUid == CAknQueryControl::ETypeId )
- {
- return aId.MakePtr( this );
- }
-
- return SupplyMopObject(aId, iMyEditorIndicator);
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::WindowLayout
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::WindowLayout( TAknWindowLineLayout& aLayout ) const
- {
- TIndex LAFIndex(NbrOfPromptLines());
-
- aLayout = AknLayoutScalable_Avkon::popup_query_code_window(LAFIndex.PQCWindow());
- if( KFMRadioFrequencyQueryDialogCustomAdditionHeight )
- {
- aLayout.iH += KFMRadioFrequencyQueryDialogCustomAdditionHeight;
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::CanLeaveEditorL
-// ---------------------------------------------------------
-//
-TBool CFMRadioFrequencyQueryControl::CanLeaveEditorL()
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryControl::CanLeaveEditorL") ) );
-
- if (iFreqEditor)
- {
- return iFreqEditor->CanLeaveEditorL();
- }
- return ETrue;
- }
-
-
-/*********************************
- * CFMRadioManualTuningEditorIndicator
- *********************************/
-
-CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator* CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::NewL(CCoeControl* aControl)
- {
- CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator* self = new(ELeave)CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator();
- CleanupStack::PushL(self);
- self->ConstructL(aControl);
- CleanupStack::Pop(self);
- return self;
- }
-
-CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::~CFMRadioManualTuningEditorIndicator()
- {
- }
-
-CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::CFMRadioManualTuningEditorIndicator() : CAknIndicatorContainer(CAknIndicatorContainer::EQueryEditorIndicators)
- {
- }
-
-void CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::ConstructL(CCoeControl* aControl)
- {
- CreateWindowL(aControl);
-
- TResourceReader reader;
- iCoeEnv->CreateResourceReaderLC(reader, R_AVKON_NAVI_PANE_EDITOR_INDICATORS);
- ConstructFromResourceL(reader);
- CleanupStack::PopAndDestroy(); // resource reader
-
- SetExtent(TPoint(0,0), TSize(0,0));
- MakeVisible( EFalse );
- //ActivateL();
- }
-
-void CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::SetState(TAknEditingState aState)
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::SetState (%d)"), (int)aState ) );
- if (AknLayoutUtils::Variant() == EEuropeanVariant)
- {
- SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorNumberCase), (aState == ENumeric) ? EAknIndicatorStateOn : EAknIndicatorStateOff, EFalse);
- SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorArabicIndicNumberCase), (aState == EArabicIndicNumeric) ? EAknIndicatorStateOn : EAknIndicatorStateOff, EFalse);
- SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorQuery), (aState == EStateNone) ? EAknIndicatorStateOff : EAknIndicatorStateOn, EFalse);
- }
- else
- {
- SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorNumberCase), (aState == ENumeric) ? EAknIndicatorStateOn : EAknIndicatorStateOff, EFalse);
- SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorQuery), (aState == EStateNone) ? EAknIndicatorStateOff : EAknIndicatorStateOn, EFalse);
- }
-
- MakeVisible( EFalse );
- //DrawDeferred();
- }
-
-CAknIndicatorContainer* CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::IndicatorContainer()
- {
- return this;
- }
-
-void CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::SetFlags(TBitFlags16 aFlags)
- {
- iBitFlags = aFlags;
- }
-
-void CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::Reserved_1()
- {
- }
-
-/*****************************************************************
- * CFMRadioFrequencyQueryControl::TIndex
- *
- * Manage indexes into LAF tables
- *
- * PN stands for "Popup Note"
- *
- * PQD stands for "Popup Query Data'
- *
- * PQC stands for "Popup Query Code'
- *
- * 'DPQ' stands for "Data Query Popup"
- ******************************************************************/
-
-
-CFMRadioFrequencyQueryControl::TIndex::TIndex(TInt aNumberOfPromptLines)
- : iNumberOfPromptLines(aNumberOfPromptLines)
- {
- }
-
-/**
- * Return index into LAF tables that depend directly on number of prompt lines,
- * index is equal to number of prompt lines minus one unless there are no prompt
- * lines in which case the index is zero
- */
-TInt CFMRadioFrequencyQueryControl::TIndex::PromptLine() const
- {
- return iNumberOfPromptLines > 0 ? iNumberOfPromptLines - 1 : 0;
- }
-
-/**
- * Return index into Main Pane PQDC Window, which
- * depends on total number of prompt lines minus 2, e.g.
- * index 0 for 2 prompt lines total.
- *
- */
-TInt CFMRadioFrequencyQueryControl::TIndex::DQPWindowTextsLine2(TInt aLineNum) const
- {
- static const TInt KDataQueryPopupWindowTextsLine2Index[3][5] =
- { {0, 1, 2, 3, 4}, //1 PROMPT LINE
- {5, 6, 7, 8, 9}, //2 PROMPT LINES
- {10, 10, 10, 10, 10} }; //3 PROMPT LINES
-
- return KDataQueryPopupWindowTextsLine2Index[PromptLine()][aLineNum-1];
- }
-
-TInt CFMRadioFrequencyQueryControl::TIndex::PNWindow() const
- {
- static const TInt KPopupNoteWindowIndex[5] = { 0,0,0,1,2 };
-
- AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation();
- if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight)
- {
- // variety numbers for right CBA are 3,4 and 5
- return (KPopupNoteWindowIndex[PromptLine()] + 3);
- }
- else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft)
- {
- /// variety numbers for left CBA are 6,7 and 8
- return (KPopupNoteWindowIndex[PromptLine()] + 6);
- }
- else // bottom
- {
- return KPopupNoteWindowIndex[PromptLine()];
- }
- }
-
-TInt CFMRadioFrequencyQueryControl::TIndex::PQDWindow(TInt aLineNum) const
- {
- AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation();
-
- if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight)
- {
- static const TInt KPopupQueryDataWindowIndex[7] =
- {13, 12, 11, 10, 9, 8, 7}; // variety numbers for right CBA are 7-13
- return KPopupQueryDataWindowIndex[PromptLine()+aLineNum-1];
- }
- else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft)
- {
- static const TInt KPopupQueryDataWindowIndex[7] =
- {20, 19, 18, 17, 16, 15, 14}; // variety numbers for left CBA are 14-20
- return KPopupQueryDataWindowIndex[PromptLine()+aLineNum-1];
- }
- else // bottom
- {
- static const TInt KPopupQueryDataWindowIndex[7] =
- {0, 1, 2, 3, 4, 5, 6}; // variety numbers for bottom CBA are 0-6
- return KPopupQueryDataWindowIndex[PromptLine()+aLineNum-1];
- }
- }
-
-TInt CFMRadioFrequencyQueryControl::TIndex::PQCWindow() const
- {
- AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation();
-
- if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight)
- {
- // variety numbers for right CBA are 3,4 and 5
- return iNumberOfPromptLines > 0 ? (iNumberOfPromptLines - 1 + 3) : 3;
- }
- else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft)
- {
- // variety numbers for left CBA are 6,7 and 8
- return iNumberOfPromptLines > 0 ? (iNumberOfPromptLines - 1 + 6) : 6;
- }
- else // bottom
- {
- // variety numbers for bottom CBA are 0,1 and 2
- return iNumberOfPromptLines > 0 ? (iNumberOfPromptLines - 1) : 0;
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryControl::HandlePointerEventL
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryControl::HandlePointerEventL( const TPointerEvent& aPointerEvent )
- {
- CCoeControl::HandlePointerEventL( aPointerEvent );
- iFreqEditor->HandlePointerEventL( aPointerEvent );
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradiofrequencyquerydialog.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
-* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Manual tuning dialog for FMRadio
-*
-*/
-
-
-// INCLUDE FILES
-#include <aknborders.h>
-#include <eikcapc.h>
-
-#include <aknlayoutscalable_avkon.cdl.h>
-
-#include "fmradiofrequencyquerydialog.h"
-#include "fmradiofrequencyquerycontrol.h"
-#include "fmradio.hrh"
-#include "debug.h"
-
-// ================= MEMBER FUNCTIONS =======================
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CFMRadioFrequencyQueryDialog::CFMRadioFrequencyQueryDialog(TUint32& aFreq, const TTone& aTone) : CAknQueryDialog(aTone), iFreq(aFreq)
- {
- }
-
-// Two-phased constructor.
-CFMRadioFrequencyQueryDialog* CFMRadioFrequencyQueryDialog::NewL(TUint32& aFreq, const TTone& aTone)
- {
- CFMRadioFrequencyQueryDialog* self = new (ELeave) CFMRadioFrequencyQueryDialog(aFreq, aTone);
- CleanupStack::PushL(self);
- CEikonEnv::Static()->AddLibraryL(CFMRadioFrequencyQueryControl::StaticCreateCustomControl);
- CleanupStack::Pop(self);
- return self;
- }
-
-
-// Destructor
-CFMRadioFrequencyQueryDialog::~CFMRadioFrequencyQueryDialog()
- {
- CEikonEnv::Static()->RemoveLibrary(CFMRadioFrequencyQueryControl::StaticCreateCustomControl);
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryDialog::QueryControl
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-CAknQueryControl* CFMRadioFrequencyQueryDialog::QueryControl() const
- {
- CEikCaptionedControl* controlPtr = NULL;
- const TInt KMaxNumPages = GetNumberOfPages();
- for (TInt pageCount=0; pageCount<KMaxNumPages; pageCount++)
- {
- const TInt KMaxNumLinesOnThisPage= GetNumberOfLinesOnPage(pageCount);
- for (TInt lineCount=0; lineCount< KMaxNumLinesOnThisPage; lineCount++)
- {
- controlPtr = GetLineByLineAndPageIndex(lineCount, pageCount);
- if (controlPtr && controlPtr->iControlType == EFMRadioCtFrequencyQuery)
- {
- return static_cast<CAknQueryControl*>(controlPtr->iControl);
- }
- }
- }
- return 0;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryDialog::PreLayoutDynInitL
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryDialog::PreLayoutDynInitL()
- {
- // SetBorder(AknBorderId::EAknBorderNotePopup);
- SetBorder( TGulBorder::ENone );
- SetEditableL(ETrue) ;
-
- CFMRadioFrequencyQueryControl* control = static_cast<CFMRadioFrequencyQueryControl*>(QueryControl());
- if (control)
- {
- control->SetQueryControlObserver(this);
- control->SetFrequency(iFreq);
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryDialog::HandleQueryEditorStateEventL
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TBool CFMRadioFrequencyQueryDialog::HandleQueryEditorStateEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType, TQueryValidationStatus aStatus)
- {
- FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryDialog::HandleQueryEditorStateEventL") ) );
- CAknQueryDialog::HandleQueryEditorStateEventL(aQueryControl, aEventType, aStatus);
- CFMRadioFrequencyQueryControl* control = static_cast<CFMRadioFrequencyQueryControl*>(aQueryControl);
- if ((control) && (aStatus == MAknQueryControlObserver::EEditorValueValid) && (iFreq != control->Frequency()))
- {
- iFreq = control->Frequency();
- ReportEventL(EEventStateChanged);
- }
- return ETrue;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryDialog::Frequency
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TUint32 CFMRadioFrequencyQueryDialog::Frequency() const
- {
- return iFreq;
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryDialog::UpdateLeftSoftKeyL
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CFMRadioFrequencyQueryDialog::UpdateLeftSoftKeyL()
- {
- CFMRadioFrequencyQueryControl* control = static_cast<CFMRadioFrequencyQueryControl*>(QueryControl());
- if ( control )
- {
- TBool showCommand = control->EditorContentIsValidL();
- ButtonGroupContainer().MakeCommandVisibleByPosition( CEikButtonGroupContainer::ELeftSoftkeyPosition, showCommand );
- ButtonGroupContainer().MakeCommandVisibleByPosition( CEikButtonGroupContainer::EMiddleSoftkeyPosition, showCommand );
- ButtonGroupContainer().DrawDeferred();
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioFrequencyQueryDialog::OkToExitL
-// ---------------------------------------------------------
-//
-TBool CFMRadioFrequencyQueryDialog::OkToExitL(TInt /*aButtonId*/)
- {
- CFMRadioFrequencyQueryControl* control = static_cast<CFMRadioFrequencyQueryControl*>(QueryControl());
- return control->CanLeaveEditorL();
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradioglobalconfirmationquery.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
-* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Source file of CFMRadioGlobalConfirmationQuery
-*
-*/
-
-
-#include <AknGlobalConfirmationQuery.h>
-
-#include "fmradiodefines.h"
-#include "fmradioapp.h"
-#include "fmradioglobalconfirmationquery.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CFMRadioGlobalConfirmationQuery::CFMRadioGlobalConfirmationQuery
-// ---------------------------------------------------------------------------
-//
-CFMRadioGlobalConfirmationQuery::CFMRadioGlobalConfirmationQuery(MFMRadioGlobalConfirmationQueryObserver* aObserver)
- : CActive( CActive::EPriorityStandard ), iObserver(aObserver)
- {
- CActiveScheduler::Add( this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioGlobalConfirmationQuery::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioGlobalConfirmationQuery::ConstructL()
- {
- iAknGlobalConfirmationQuery = CAknGlobalConfirmationQuery::NewL();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioGlobalConfirmationQuery::NewL
-// ---------------------------------------------------------------------------
-//
-CFMRadioGlobalConfirmationQuery* CFMRadioGlobalConfirmationQuery::NewL(MFMRadioGlobalConfirmationQueryObserver* aObserver)
- {
- CFMRadioGlobalConfirmationQuery* self = CFMRadioGlobalConfirmationQuery::NewLC(aObserver);
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioGlobalConfirmationQuery::NewLC
-// ---------------------------------------------------------------------------
-//
-CFMRadioGlobalConfirmationQuery* CFMRadioGlobalConfirmationQuery::NewLC(MFMRadioGlobalConfirmationQueryObserver* aObserver)
- {
- CFMRadioGlobalConfirmationQuery* self = NULL;
- self = new( ELeave ) CFMRadioGlobalConfirmationQuery(aObserver);
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioGlobalConfirmationQuery::~CFMRadioGlobalConfirmationQuery
-// ---------------------------------------------------------------------------
-//
-CFMRadioGlobalConfirmationQuery::~CFMRadioGlobalConfirmationQuery()
- {
- Cancel();
- delete iAknGlobalConfirmationQuery;
- delete iText;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioGlobalConfirmationQuery::ShowQueryL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioGlobalConfirmationQuery::ShowQueryL(const TDesC& aText, TInt aSoftkeys, TInt aAnimation/*, TInt aDialogId*/)
- {
- Cancel();
- delete iText;
- iText = NULL;
- iText = aText.AllocL();
- iAknGlobalConfirmationQuery->ShowConfirmationQueryL( iStatus, *iText, aSoftkeys, aAnimation );
- SetActive();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioGlobalConfirmationQuery::DoCancel
-// ---------------------------------------------------------------------------
-//
-void CFMRadioGlobalConfirmationQuery::DoCancel()
- {
- if ( iAknGlobalConfirmationQuery )
- {
- iAknGlobalConfirmationQuery->CancelConfirmationQuery();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioGlobalConfirmationQuery::RunL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioGlobalConfirmationQuery::RunL()
- {
- if ( iObserver )
- {
- iObserver->GlobalConfirmationQueryDismissedL(iStatus.Int());
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioGlobalConfirmationQuery::RunError
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioGlobalConfirmationQuery::RunError(TInt /*aError*/)
- {
- return KErrNone;
- }
--- a/fmradio/fmradio/src/fmradioidlecontroller.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: fmradio media idle controller
-*
-*/
-
-#include "fmradioidlecontroller.h"
-#include "fmradioidlecontrolinterface.h"
-#include "debug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ----------------------------------------------------------------------------
-// CFMRadioIdleController::CFMRadioIdleController
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioIdleController::CFMRadioIdleController()
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioIdleController::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioIdleController::ConstructL()
- {
- FTRACE( FPrint( _L("CFMRadioIdleController::ConstructL()") ) );
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioIdleController::NewL
-// Two-phase constructor of CFMRadioPreset
-// ---------------------------------------------------------------------------
-//
-CFMRadioIdleController* CFMRadioIdleController::NewL()
- {
- FTRACE( FPrint( _L("CFMRadioIdleController::NewL()") ) );
- CFMRadioIdleController* self = new ( ELeave ) CFMRadioIdleController();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioIdleController::~CFMRadioIdleController
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioIdleController::~CFMRadioIdleController()
- {
- FTRACE( FPrint( _L("CFMRadioIdleController::~CFMRadioIdleController()") ) );
- iControlArray.Close();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioIdleController::AddControlItem
-// ---------------------------------------------------------------------------
-//
-void CFMRadioIdleController::AddControlItem( const MFMRadioIdleControlInterface& aControl )
- {
- TInt index = iControlArray.FindInAddressOrder( &aControl );
- if ( index == KErrNotFound )
- {
- iControlArray.InsertInAddressOrder( &aControl );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioIdleController::ShowControl
-// ---------------------------------------------------------------------------
-//
-void CFMRadioIdleController::ShowControl( const MFMRadioIdleControlInterface& aControl )
- {
- for ( TInt i = 0; i < iControlArray.Count(); i++ )
- {
- MFMRadioIdleControlInterface* controlItem = iControlArray[i];
- // show requested item
- if ( &aControl == controlItem )
- {
- controlItem->Show();
- }
- else // hide rest of the items
- {
- controlItem->Hide();
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioIdleController::HideAllControls
-// ---------------------------------------------------------------------------
-//
-void CFMRadioIdleController::HideAllControls()
- {
- FTRACE( FPrint( _L("CFMRadioIdleController::HideAllControls()") ) );
- for ( TInt i = 0; i < iControlArray.Count(); i++ )
- {
- iControlArray[i]->Hide();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioIdleController::DeactivateControls
-// ---------------------------------------------------------------------------
-//
-void CFMRadioIdleController::DeactivateControls()
- {
- FTRACE( FPrint( _L("CFMRadioIdleController::DeactivateControls()") ) );
- for ( TInt i = 0; i < iControlArray.Count(); i++ )
- {
- iControlArray[i]->Deactivate();
- }
- }
-
-// end of file
--- a/fmradio/fmradio/src/fmradiologo.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,353 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioLogo
-*
-*/
-
-
-// INCLUDE FILES
-
-#include <AknUtils.h>
-#include <alf/alfenv.h>
-#include <alf/alfimagevisual.h>
-#include <alf/alfevent.h>
-#include <alf/alfanchorlayout.h>
-#include <aknlayoutscalable_apps.cdl.h>
-#include <data_caging_path_literals.hrh>
-#include <fmradio.mbg>
-
-#include "fmradiologo.h"
-#include "fmradioalfrdsviewobserver.h"
-#include "fmradiodefines.h"
-#include "debug.h"
-#include "fmradiologoobserver.h"
-
-// CONSTANTS
-
-const TInt KLogoFadeInDefaultDurationTime = 500;
-const TInt KLogoFadeOutDefaultDurationTime = 500;
-const TInt KLogoDisplayPeriod = 2000; // milliseconds = 2 sec
-const TReal KDefaultOpacityInVisibleState = 1.0f;
-const TReal KDefaultOpacityInHiddenState = 0.0f;
-const TInt KLAFVarietyBackgroundImagePortrait = 0;
-const TInt KLAFVarietyBackgroundImageLandscape = 1;
-// bitmap file for the background of the display
-_LIT8( KBitmapAnchorTag, "BitmapAnchorTag" );
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::NewL
-// Two-phase constructor of CFMRadioAlfLogo
-// ---------------------------------------------------------------------------
-//
-CFMRadioLogo* CFMRadioLogo::NewL( CAlfEnv& aEnv )
- {
- CFMRadioLogo* self = new ( ELeave ) CFMRadioLogo();
- CleanupStack::PushL( self );
- self->ConstructL( aEnv );
- CleanupStack::Pop( self );
- return self;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioLogo::CFMRadioLogo
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioLogo::CFMRadioLogo()
-: iOpacityInVisibleState( KDefaultOpacityInVisibleState ),
- iOpacityInHiddenState( KDefaultOpacityInHiddenState ),
- iIsVisible( ETrue ) // visible by default
- {
- //No implementation needed
- }
-
-
-// ----------------------------------------------------------------------------
-// CFMRadioLogo::SetObserver
-// Sets observer
-// ----------------------------------------------------------------------------
-//
-void CFMRadioLogo::SetObserver( MFMRadioLogoObserver* aObserver )
- {
- FTRACE( FPrint( _L( "CFMRadioLogo::SetObserver" ) ) );
- TInt index = iObservers.FindInAddressOrder( aObserver );
- if ( index == KErrNotFound )
- {
- iObservers.InsertInAddressOrder( aObserver );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioLogo::RemoveObserver
-// Removes observer
-// ----------------------------------------------------------------------------
-//
-void CFMRadioLogo::RemoveObserver( MFMRadioLogoObserver* aObserver )
- {
- FTRACE( FPrint( _L( "CFMRadioLogo::RemoveObserver" ) ) );
- TInt index = iObservers.FindInAddressOrder( aObserver );
-
- if ( index >= 0 )
- {
- iObservers.Remove( index );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioLogo::ConstructL
-// Symbian 2nd phase constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CFMRadioLogo::ConstructL( CAlfEnv& aEnv )
- {
- FTRACE( FPrint( _L( "CFMRadioLogo::ConstructL" ) ) );
- CAlfControl::ConstructL( aEnv );
- CreateImageVisualsL();
- }
-
-// ---------------------------------------------------------------------------
-// ~CFMRadioLogo::~CFMRadioLogo
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioLogo::~CFMRadioLogo()
- {
- FTRACE( FPrint( _L( "CFMRadioLogo::Destructor" ) ) );
- Env().CancelCustomCommands( this );
- iObservers.Close();
- delete iBackgroundBitmapFileName;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::OfferEventL
-// From CAlfControl, takes care of alfred event handling.
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioLogo::OfferEventL( const TAlfEvent& aEvent )
- {
- FTRACE( FPrint( _L( "CFMRadioLogo::OfferEventL" ) ) );
- TBool eventHandled = EFalse;
-
- if ( aEvent.IsCustomEvent() )
- {
- switch( aEvent.CustomParameter() )
- {
- case EFadeInCompleted:
- {
- eventHandled = ETrue;
- Env().Send( TAlfCustomEventCommand( ELogoDisplayTimerCompleted, this ), KLogoDisplayPeriod );
- break;
- }
- case ELogoDisplayTimerCompleted:
- {
- eventHandled = ETrue;
- for ( TInt i = 0 ; i < iObservers.Count() ; i++ )
- {
- iObservers[i]->LogoDisplayTimeCompleted();
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- return eventHandled;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::SetRect
-// Sets the logo rectangle.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioLogo::SetRect( const TRect& aRect )
- {
- iRect = aRect;
- if ( iLogoAnchor )
- {
- SetAbsoluteCornerAnchors( iLogoAnchor, 0, iRect.iTl, iRect.iBr );
- iLogoAnchor->UpdateChildrenLayout();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::CreateImageVisualsL
-// Creates visual for the logo
-// ---------------------------------------------------------------------------
-//
-void CFMRadioLogo::CreateImageVisualsL()
- {
- // locate source mbm
- CCoeEnv* coeEnv = CCoeEnv::Static();
- TFindFile finder( coeEnv->FsSession() );
- TInt err = finder.FindByDir( KFMRadioBmpFile, KDC_APP_BITMAP_DIR );
- if ( err == KErrNone )
- {
- iBackgroundBitmapFileName = finder.File().AllocL();
- }
-
- iLogoAnchor = CAlfAnchorLayout::AddNewL( *this );
- iLogoAnchor->SetTagL( KBitmapAnchorTag );
-
- iImageVisual = CAlfImageVisual::AddNewL( *this, iLogoAnchor );
-
- // read bitmap size from layout data
- TRect temp;
- TAknLayoutRect bitmapLayout;
- bitmapLayout.LayoutRect(
- temp,
- AknLayoutScalable_Apps::area_fmrd2_visual_pane_g1( KLAFVarietyBackgroundImagePortrait ).LayoutLine() );
-
- // image for portrait
- iPortraitImage = TAlfImage( KAknsIIDNone,
- bitmapLayout.Rect().Size(),
- EAspectRatioPreserved,
- iBackgroundBitmapFileName,
- EMbmFmradioQgn_indi_radio_default,
- EMbmFmradioQgn_indi_radio_default_mask );
-
- // image for landscape
- bitmapLayout.LayoutRect(
- temp,
- AknLayoutScalable_Apps::area_fmrd2_visual_pane_g1( KLAFVarietyBackgroundImageLandscape ).LayoutLine() );
-
- iLandscapeImage = TAlfImage( KAknsIIDNone,
- bitmapLayout.Rect().Size(),
- EAspectRatioPreserved,
- iBackgroundBitmapFileName,
- EMbmFmradioQgn_indi_radio_default,
- EMbmFmradioQgn_indi_radio_default_mask );
-
- iImageVisual->SetImage( iPortraitImage );
- iImageVisual->SetSecondaryImage( iLandscapeImage );
- }
-
-// ---------------------------------------------------------
-// CFMRadioLogo::Show
-// Fades in the logo with predefined opacity value.
-// ---------------------------------------------------------
-//
-void CFMRadioLogo::Show()
- {
- // change status only, fade in and the event are allways triggered so don't
- // check visibility here
- iIsVisible = ETrue;
- Env().CancelCustomCommands( this );
- Fade( iImageVisual, KLogoFadeInDefaultDurationTime, iOpacityInVisibleState );
- Env().Send( TAlfCustomEventCommand( EFadeInCompleted, this ), KLogoFadeInDefaultDurationTime );
- }
-
-// ---------------------------------------------------------
-// CFMRadioLogo::Hide
-// Fades out the logo with predefined opacity value.
-// ---------------------------------------------------------
-//
-void CFMRadioLogo::Hide()
- {
- if ( iIsVisible )
- {
- iIsVisible = EFalse;
- Fade( iImageVisual, KLogoFadeOutDefaultDurationTime, iOpacityInHiddenState );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::SetOpacityInVisibleState
-// Sets the indicator opacity in visible state.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioLogo::SetOpacityInVisibleState( const TReal aOpacity )
- {
- iOpacityInVisibleState = aOpacity;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::SetOpacityInHiddenState
-// Sets the logo opacity value in hidden state.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioLogo::SetOpacityInHiddenState( const TReal aOpacity )
- {
- iOpacityInHiddenState = aOpacity;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::SetAbsoluteCornerAnchors
-// Sets absolute rect of the anchor by top left and bottom right points.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioLogo::SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
- TInt aOrdinal,
- const TPoint& aTopLeftPosition,
- const TPoint& aBottomRightPosition )
- {
- if ( aAnchor )
- {
- // Set top/left anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeTopLeft,
- TAlfXYMetric( TAlfMetric( aTopLeftPosition.iX ), TAlfMetric( aTopLeftPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
-
-
- // Set bottom/right anchor.
- aAnchor->Attach( aOrdinal,
- EAlfAnchorTypeBottomRight,
- TAlfXYMetric( TAlfMetric( aBottomRightPosition.iX ), TAlfMetric( aBottomRightPosition.iY ) ),
- EAlfAnchorAttachmentOriginTopLeft );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::Fade
-// Sets the fading animation to the CAlfVisual object.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioLogo::Fade( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity )
- {
- TAlfTimedValue opacity;
- opacity.SetTarget( aOpacity, aFadingTime );
- aVisual->SetOpacity( opacity );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::SwitchToLandscapeImage
-// Use secondary image for landscape and primary for portrait
-// ---------------------------------------------------------------------------
-//
-void CFMRadioLogo::SwitchToLandscapeImage( TBool aShow )
- {
- if ( aShow )
- {
- iImageVisual->SetSecondaryAlpha( TAlfTimedValue( 1.0 ) );
- }
- else
- {
- iImageVisual->SetSecondaryAlpha( TAlfTimedValue( 0.0 ) );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioLogo::Deactivate
-// from MFMRadioIdleControlInterface
-// ---------------------------------------------------------------------------
-//
-void CFMRadioLogo::Deactivate()
- {
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradiomaincontainer.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,815 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioMainContainer
-*
-*/
-
-
-// INCLUDE FILES
-
-#include <alf/alfcontrolgroup.h>
-#include <alf/alfdisplay.h>
-#include <alf/alfroster.h>
-#include <alf/alflayoutmetrics.h>
-#include <AknLayoutFont.h>
-#include <aknlayoutscalable_apps.cdl.h>
-#include <AknsBasicBackgroundControlContext.h>
-#include <AknsDrawUtils.h>
-#include <AknsSkinInstance.h>
-#include <AknsUtils.h>
-#include <aknconsts.h>
-#include <AknDef.h>
-#include <StringLoader.h>
-#include <barsread.h>
-#include <w32std.h>
-#include <e32base.h>
-#include <fontids.hrh>
-#include <gulfont.h>
-#include <fmradio.rsg>
-#include <fmradiouids.h>
-
-#include "fmradiomaincontainer.h"
-#if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE
-#include "radio.hlp.hrh"
-#endif
-#include "fmradioengine.h"
-#include "fmradioalfrdsviewer.h"
-#include "fmradioalfvisualizer.h"
-#include "fmradioalfmediaidle.h"
-#include "fmradioalfindicator.h"
-#include "fmradiologo.h"
-#include "fmradiordsreceiverbase.h"
-#include "fmradioalfrdsviewer.h"
-#include "fmradiomainview.h"
-#include "fmradioidlecontroller.h"
-#include "debug.h"
-
-
-// ~3 seconds, 10 frames / second is used
-const TInt KFadeFrames = 30;
-const TInt KTenMilliSecondsInMicroSeconds = 100000;
-// values from fmradio LAF document
-const TInt KLAFVarietyRDSViewerPortrait = 0;
-const TInt KLAFVarietyRDSViewerLandscape = 1;
-const TInt KLAFVarietyRDSPlusIndicatorPortrait = 0;
-const TInt KLAFVarietyRDSPlusIndicatorLandscape = 1;
-const TInt KLAFVarietyAFIndicatorPortrait = 0;
-const TInt KLAFVarietyAFIndicatorLandscape = 1;
-const TInt KLAFVarietyRDSIndicatorPortrait = 0;
-const TInt KLAFVarietyRDSIndicatorLandscape = 1;
-const TInt KLAFVarietyLogoImagePortrait = 0;
-const TInt KLAFVarietyLogoImageLandscape = 1;
-const TInt KLAFVarietyIndicatorPanePortrait = 0;
-const TInt KLAFVarietyIndicatorPaneLandscape = 1;
-const TInt KLAFVarietyVisualPanePortrait = 0;
-const TInt KLAFVarietyVisualPaneLandscape = 1;
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------------------------------
-// CFMRadioTimer::CFMRadioTimer
-// ---------------------------------------------------------------------------------
-CFMRadioTimer::CFMRadioTimer( MFMRadioTimer* aTimerObserver ) :
- CActive( EPriorityStandard ),
- iTimerObserver( aTimerObserver )
- {
- CActiveScheduler::Add( this );
- }
-
-// ---------------------------------------------------------------------------------
-// CFMRadioTimer::~CFMRadioTimer
-// ---------------------------------------------------------------------------------
-CFMRadioTimer::~CFMRadioTimer()
- {
-
- Cancel();
- }
-
-// ---------------------------------------------------------------------------------
-// CFMRadioTimer::RunL
-// ---------------------------------------------------------------------------------
-void CFMRadioTimer::RunL()
- {
-
- iTimerObserver->TimerTimeOut( iStatus.Int() );
- }
-
-// ---------------------------------------------------------------------------------
-// CFMRadioTimer::DoCancel
-// ---------------------------------------------------------------------------------
-void CFMRadioTimer::DoCancel()
- {
-
- TInt ret = KErrCancel;
- iTimerObserver->TimerTimeOut( ret );
- }
-
-// ---------------------------------------------------------------------------------
-// CFMRadioTimer::Activate
-// ---------------------------------------------------------------------------------
-void CFMRadioTimer::Activate()
- {
- SetActive();
- }
-
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::NewL
-// Two-phase constructor of CFMRadioDelayTimer
-// --------------------------------------------------------------------------------
-//
-CFMRadioMainContainer* CFMRadioMainContainer::NewL(
- const TRect& aRect,
- CAlfEnv& aAlfEnv,
- CRadioEngine& aRadioEngine )
- {
- CFMRadioMainContainer* self = new (ELeave) CFMRadioMainContainer( aAlfEnv, aRadioEngine );
- CleanupStack::PushL( self );
- self->ConstructL( aRect );
- CleanupStack::Pop( self );
- return self;
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::CFMRadioMainContainer
-// Default constructor
-// --------------------------------------------------------------------------------
-//
-CFMRadioMainContainer::CFMRadioMainContainer( CAlfEnv& aAlfEnv, CRadioEngine& aRadioEngine ) :
- iAlfEnv ( aAlfEnv ),
- iRadioEngine (aRadioEngine ),
- iLightsOffCounter(0)
- {
- //No implementation needed
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::ConstructL
-// EPOC two phased constructor
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::ConstructL(
- const TRect& aRect )
- {
- iCoeEnv = CCoeEnv::Static();
-
- TRAP_IGNORE( iLight = CHWRMLight::NewL(this) );
- iTimer = new(ELeave) CFMRadioTimer( this );
- timer.CreateLocal();
-
- // check the layout orientation
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- TBool isLandscape = appUi->IsLandscapeOrientation();
-
- TRgb color;
-
- AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
- //CreateWindowL(); // create a window for the container
-
- // Create alfred display
- CAlfDisplay* display = NULL;
- if ( iAlfEnv.DisplayCount() > 0 )
- {
- display = &(iAlfEnv.PrimaryDisplay());
- }
- else
- {
- display = &(iAlfEnv.NewDisplayL( aRect, CAlfEnv::ENewDisplayAsCoeControl ));
- }
-
- // Setup background.
- display->SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground );
-
- // Create the control group for HUI visual controls
- CAlfControlGroup* group;
- if( display->Roster().Count() > 0)
- {
- group = &( iAlfEnv.ControlGroup( KFMRadioVisualControlsGroupId ) );
-
- iVisualControl = static_cast<CFMRadioAlfVisualizer*>
- ( display->Roster().FindControl( KFMRadioVisualControlId ) );
- iMediaIdle = static_cast<CFMRadioAlfMediaIdle*>
- ( display->Roster().FindControl( KFMRadioMediaIdleId ) );
- iRdsIndicator = static_cast<CFMRadioAlfIndicator*>
- ( display->Roster().FindControl( KFMRadioRdsIndicatorId ) );
- iRdsAfIndicator = static_cast<CFMRadioAlfIndicator*>
- ( display->Roster().FindControl( KFMRadioRdsAfIndicatorId ) );
- iRdsViewer = static_cast<CFMRadioAlfRDSViewer*>
- ( display->Roster().FindControl( KFMRadioRdsViewer ) );
- iRdsInteractionIndicator = static_cast<CFMRadioAlfIndicator*>
- ( display->Roster().FindControl( KFMRadioRdsInteractionIndicatorId ) );
-
- iRadioLogo = static_cast<CFMRadioLogo*>
- ( display->Roster().FindControl( KFMRadioLogoId ) );
- }
- else
- {
- group = &(iAlfEnv.NewControlGroupL( KFMRadioVisualControlsGroupId ) );
- // Create the vizualizer control for information of the FMRadio
- iVisualControl = CFMRadioAlfVisualizer::NewL( iAlfEnv );
- iVisualControl->SetId( KFMRadioVisualControlId );
- // Create the media idle
- iMediaIdle = CFMRadioAlfMediaIdle::NewL( iAlfEnv );
- iMediaIdle->SetId( KFMRadioMediaIdleId );
-
- // RDS
- HBufC* rdsText = StringLoader::LoadLC( R_QTN_FMRADIO_RDS, iCoeEnv );
- iRdsIndicator = CFMRadioAlfIndicator::NewL( iAlfEnv );
- iRdsIndicator->SetId( KFMRadioRdsIndicatorId );
- iRdsIndicator->SetTextColor( color );
- iRdsIndicator->SetTextL( *rdsText );
- iRdsIndicator->SetOpacityInHiddenState( KFMRadioIndicatorOpacityInHiddenState );
- CleanupStack::PopAndDestroy( rdsText );
-
- // AF
- HBufC* afText = StringLoader::LoadLC( R_QTN_FMRADIO_AF, iCoeEnv );
- iRdsAfIndicator = CFMRadioAlfIndicator::NewL( iAlfEnv );
- iRdsAfIndicator->SetId( KFMRadioRdsAfIndicatorId );
- iRdsAfIndicator->SetTextColor( color );
- iRdsAfIndicator->SetTextL( *afText );
- iRdsAfIndicator->SetOpacityInHiddenState( KFMRadioIndicatorOpacityInHiddenState );
- CleanupStack::PopAndDestroy( afText );
-
- iRdsViewer = CFMRadioAlfRDSViewer::NewL( iAlfEnv );
- iRdsViewer->SetId( KFMRadioRdsViewer );
- iRdsViewer->SetTextColor( color );
- iRdsViewer->SetOpacityInHiddenState( KFMRadioRdsViewerOpacityHidden );
-
- // +
- HBufC* interactionText = StringLoader::LoadLC( R_QTN_FMRADIO_RTPLUS_INDICATOR_TEXT, iCoeEnv );
- iRdsInteractionIndicator = CFMRadioAlfIndicator::NewL( iAlfEnv );
- iRdsInteractionIndicator->SetId( KFMRadioRdsInteractionIndicatorId );
- iRdsInteractionIndicator->SetTextColor( color );
- iRdsInteractionIndicator->SetTextL( *interactionText );
- iRdsInteractionIndicator->SetOpacityInHiddenState( KFMRadioIndicatorOpacityInHiddenState );
- CleanupStack::PopAndDestroy( interactionText );
-
- // radio icon
- iRadioLogo = CFMRadioLogo::NewL( iAlfEnv );
- iRadioLogo->SetId( KFMRadioLogoId );
-
- // Append the controls into the control group.
- group->AppendL( iMediaIdle );
- group->AppendL( iVisualControl );
- group->AppendL( iRdsIndicator );
- group->AppendL( iRdsAfIndicator );
- group->AppendL( iRdsViewer );
- group->AppendL( iRdsInteractionIndicator );
- group->AppendL( iRadioLogo );
- }
-
- iIdleController = CFMRadioIdleController::NewL();
- // Add media idle visuals to the controller.
- // Only one of the media idle visuals is visible at a time.
- iIdleController->AddControlItem( *iRdsViewer );
- iIdleController->AddControlItem( *iMediaIdle );
- iIdleController->AddControlItem( *iRadioLogo );
-
- iMainPaneRect = aRect;
-
- UpdateTextColorFromSkin();
- SizeChanged();
- //Make the control group active on the display
- display->Roster().ShowL( *group );
- display->SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground );
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::Destructor
-// --------------------------------------------------------------------------------
-//
-CFMRadioMainContainer::~CFMRadioMainContainer()
- {
- if ( iTimer->IsActive() )
- {
- iTimer->Cancel();
- }
-
- delete iTimer;
- iTimer = NULL;
- timer.Close();
-
- delete iLight;
- iLight = NULL;
- delete iIdleController;
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::SetFaded
-// Fades the entire window and controls in the window owned
-// by this container control.
-// -------------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::SetFaded( TBool aFaded )
- {
- iFadeStatus = aFaded;
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::DisplayChannelInfoL
-// Display the channel information
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::DisplayChannelInfoL(
- TInt aChannelNumber,
- const TDesC& aStationName,
- TFMRadioStationChangeType aChangeType,
- TInt aFrequency )
- {
- HBufC* firstLine = NULL;
- HBufC* secondLine = NULL;
- TBool programmeServiceNameExists = iRadioEngine.RdsReceiver().ProgrammeService().Length();
- CFMRadioRdsReceiverBase::TFMRadioProgrammeSeviceType PSNameType =
- iRadioEngine.RdsReceiver().ProgrammeServiceNameType();
-
- TBool useStaticPsName = EFalse;
- if ( !aStationName.Length() &&
- PSNameType == CFMRadioRdsReceiverBase::EFMRadioPSNameStatic &&
- programmeServiceNameExists )
- {
- useStaticPsName = ETrue;
- }
- const TDesC& stationName = useStaticPsName ? iRadioEngine.RdsReceiver().ProgrammeService() : aStationName;
-
- if ( !stationName.Length() )
- {
- // PS Name is concidered as dynamic
- if( aChannelNumber == KErrNotFound )
- {
- firstLine = FormattedFrequencyStringL( aFrequency, R_QTN_FMRADIO_FREQ );
- CleanupStack::PushL( firstLine );
- if( programmeServiceNameExists )
- {
- secondLine = iRadioEngine.RdsReceiver().ProgrammeService().AllocL();
- }
- }
- else
- {
- TReal frequency = static_cast<TReal>( aFrequency / static_cast<TReal>( KHzConversionFactor ));
-
- // Gets locale decimal separator automatically
- TInt maxDecimalPlaces = iRadioEngine.DecimalCount();
- TRealFormat format( KFrequencyMaxLength, maxDecimalPlaces );
- TBuf<KFrequencyMaxLength> frequencyString;
- frequencyString.Num( frequency, format );
- AknTextUtils::LanguageSpecificNumberConversion( frequencyString );
-
- firstLine = StringLoader::LoadLC( R_QTN_FMRADIO_MEM_LOCATION_FREQ,
- frequencyString, aChannelNumber, iCoeEnv );
-
- if( programmeServiceNameExists )
- {
- secondLine = iRadioEngine.RdsReceiver().ProgrammeService().AllocL();
- }
- }
- }
- else
- {
- if( aChannelNumber == KErrNotFound )
- {
- firstLine = stationName.AllocLC();
- }
- else
- {
- firstLine = StringLoader::LoadLC( R_QTN_FMRADIO_MEM_LOCATION_NAME,
- stationName, aChannelNumber, iCoeEnv );
- }
-
- if ( programmeServiceNameExists &&
- PSNameType == CFMRadioRdsReceiverBase::EFMRadioPSNameDynamic )
- {
- // PS Name is concidered as dynamic
- secondLine = iRadioEngine.RdsReceiver().ProgrammeService().AllocL();
- }
- else
- {
- secondLine = FormattedFrequencyStringL( aFrequency, R_QTN_FMRADIO_FREQ );
- }
- }
- CleanupStack::PushL( secondLine );
-
- if( AknLayoutUtils::LayoutMirrored() )
- {
- // Add right to left mark in the beginning so that the text is laid out correctly
- firstLine = firstLine->ReAllocL( firstLine->Length() + KRightToLeftMark().Length() );
- CleanupStack::Pop( 2 ); // secondLine and old firstLine
- CleanupStack::PushL( firstLine );
- CleanupStack::PushL( secondLine );
- firstLine->Des().Insert( 0, KRightToLeftMark );
-
- if ( secondLine )
- {
- secondLine = secondLine->ReAllocL( secondLine->Length() + KRightToLeftMark().Length() );
- CleanupStack::Pop(); // old secondLine
- CleanupStack::PushL( secondLine );
- secondLine->Des().Insert( 0, KRightToLeftMark );
- }
- }
-
- iVisualControl->ChangeStationL( aChangeType, *firstLine, secondLine );
-
- HBufC* frequencyString = FormattedFrequencyStringL( aFrequency, R_QTN_FMRADIO_MEDIA_IDLE_FREQ );
- CleanupStack::PushL( frequencyString );
- iMediaIdle->AddMediaIdleContentL( *frequencyString );
- CleanupStack::PopAndDestroy( frequencyString );
- if( aStationName.Length() )
- {
- iMediaIdle->AddMediaIdleContentL( stationName );
- }
- if ( aStationName != iRadioEngine.RdsReceiver().ProgrammeService() &&
- PSNameType == CFMRadioRdsReceiverBase::EFMRadioPSNameStatic )
- {
- iMediaIdle->AddPsNameToMediaIdleL( iRadioEngine.RdsReceiver().ProgrammeService() );
- }
-
- CleanupStack::PopAndDestroy( 2, firstLine );
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::FormattedFrequencyStringL
-// Format the frequency
-// --------------------------------------------------------------------------------
-//
-HBufC* CFMRadioMainContainer::FormattedFrequencyStringL( TInt aFrequency, TInt aResourceId )
- {
- TReal frequency = static_cast<TReal>( aFrequency / static_cast<TReal>( KHzConversionFactor ));
-
- // Gets locale decimal separator automatically
- TInt maxDecimalPlaces = iRadioEngine.DecimalCount();
- TRealFormat format( KFrequencyMaxLength, maxDecimalPlaces );
- TBuf<KFrequencyMaxLength> frequencyString;
- frequencyString.Num( frequency, format );
- AknTextUtils::LanguageSpecificNumberConversion( frequencyString );
-
- return StringLoader::LoadL( aResourceId, frequencyString, iCoeEnv );;
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::ShowRTPlusInteractionIndicator
-// Hide/show the RT+ interaction indicator with optional fade effecct
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::ShowRTPlusInteractionIndicator( TBool aVisible, TBool aFadeEffect)
- {
- if (aVisible)
- iRdsInteractionIndicator->Show( aFadeEffect );
- else
- iRdsInteractionIndicator->Hide( aFadeEffect );
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainContainer::ShowRdsInfo
-// ---------------------------------------------------------
-//
-void CFMRadioMainContainer::ShowRdsInfo( TBool aShow, TBool aFade, TBool aShowAfMarquee )
- {
- if( aShow )
- {
- iRdsIndicator->Show( aFade );
-
- if( aShowAfMarquee )
- {
- iRdsAfIndicator->Show( aFade );
- }
- else
- {
- iRdsAfIndicator->Hide( aFade );
- }
- }
- else
- {
- iRdsIndicator->Hide( aFade );
-
- iRdsAfIndicator->Hide( aFade );
- }
- }
-
-// ----------------------------------------------------------------------------------------------------
-// CFMRadioMainContainer::HandleResourceChange
-// Handles resource changes
-// ----------------------------------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::HandleResourceChange( TInt aType )
- {
- if ( aType == KEikDynamicLayoutVariantSwitch )
- {
- AknLayoutUtils::LayoutMetricsRect(
- AknLayoutUtils::EMainPane, iMainPaneRect);
- SizeChanged();
- TRAP_IGNORE( iAlfEnv.NotifyLayoutChangedL() )
- iIdleController->ShowControl( *iRadioLogo );
- }
- else if ( aType == KAknsMessageSkinChange )
- {
- UpdateTextColorFromSkin();
- TRAP_IGNORE( iAlfEnv.NotifySkinChangedL() );
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::SetRect
-// Sets rectangle of the alfred display
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::SetRect( const TRect& aRect )
- {
- iMainPaneRect = aRect;
- SizeChanged();
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::SizeChanged
-// Called when the view size is changed
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::SizeChanged()
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
-
- iAlfEnv.PrimaryDisplay().ForceSetVisibleArea( iMainPaneRect );
-
- TAknLayoutRect layoutRect;
- TAknLayoutText textLayout;
- TAknLayoutRect indicatorLayoutRect;
- TAknLayoutRect visualPaneLayoutRect;
-
- TRect displayRect( iMainPaneRect.Size() );
-
- iVisualControl->SetMirrored( appUi->IsLayoutMirrored() );
- TBool isLandscape = appUi->IsLandscapeOrientation();
-
- TDisplayOrientation alfDisplayOrientation = EPortrait;
- CFMRadioAlfMediaIdle::TOrientation mediaIdleOrientation = CFMRadioAlfMediaIdle::EPortrait;
-
- TInt lafVarietyRdsIndicator = 0;
- TInt lafVarietyAfIndicator = 0;
- TInt lafVarietyPlusIndicator = 0;
- TInt lafVarietyRdsText = 0;
- TInt lafVarietyLogo = 0;
- TInt lafVarietyIndicatorPane = 0;
- TInt lafVarietyVisualPane = 0;
- TBool useLandscapeImage = EFalse;
-
- if ( isLandscape )
- {
- alfDisplayOrientation = ELandscape;
- mediaIdleOrientation = CFMRadioAlfMediaIdle::ELandscape;
-
- lafVarietyRdsIndicator = KLAFVarietyRDSIndicatorLandscape;
- lafVarietyAfIndicator = KLAFVarietyAFIndicatorLandscape;
- lafVarietyPlusIndicator = KLAFVarietyRDSPlusIndicatorLandscape;
- lafVarietyRdsText = KLAFVarietyRDSViewerLandscape;
- lafVarietyLogo = KLAFVarietyLogoImageLandscape;
- lafVarietyIndicatorPane = KLAFVarietyIndicatorPaneLandscape;
- lafVarietyVisualPane = KLAFVarietyVisualPaneLandscape;
- useLandscapeImage = ETrue;
- }
- else
- {
- lafVarietyRdsIndicator = KLAFVarietyRDSIndicatorPortrait;
- lafVarietyAfIndicator = KLAFVarietyAFIndicatorPortrait;
- lafVarietyPlusIndicator = KLAFVarietyRDSPlusIndicatorPortrait;
- lafVarietyRdsText = KLAFVarietyRDSViewerPortrait;
- lafVarietyLogo = KLAFVarietyLogoImagePortrait;
- lafVarietyIndicatorPane = KLAFVarietyIndicatorPanePortrait;
- lafVarietyVisualPane = KLAFVarietyVisualPanePortrait;
- }
- // indicator pane
- indicatorLayoutRect.LayoutRect( displayRect,
- AknLayoutScalable_Apps::fmrd2_indi_pane( lafVarietyIndicatorPane ) );
-
- // RDS indicator
- textLayout.LayoutText( indicatorLayoutRect.Rect(),
- AknLayoutScalable_Apps::fmrd2_indi_pane_t3( lafVarietyRdsIndicator ).LayoutLine() );
-
- iRdsIndicator->SetRect( textLayout.TextRect() );
-
- // AF indicator
- textLayout.LayoutText( indicatorLayoutRect.Rect(),
- AknLayoutScalable_Apps::fmrd2_indi_pane_t2( lafVarietyAfIndicator ).LayoutLine() );
-
- iRdsAfIndicator->SetRect( textLayout.TextRect() );
-
- // + indicator
- textLayout.LayoutText( indicatorLayoutRect.Rect(),
- AknLayoutScalable_Apps::fmrd2_indi_pane_t1( lafVarietyPlusIndicator ).LayoutLine() );
-
- iRdsInteractionIndicator->SetRect( textLayout.TextRect() );
-
- // RDS Text pane
- layoutRect.LayoutRect( displayRect,
- AknLayoutScalable_Apps::area_fmrd2_visual_pane( lafVarietyRdsText ).LayoutLine() );
-
- iRdsViewer->SetRect( layoutRect.Rect() );
-
- // radio icon
- visualPaneLayoutRect.LayoutRect( displayRect,
- AknLayoutScalable_Apps::area_fmrd2_visual_pane( lafVarietyVisualPane ).LayoutLine() );
-
- layoutRect.LayoutRect( visualPaneLayoutRect.Rect(),
- AknLayoutScalable_Apps::area_fmrd2_visual_pane_g1( lafVarietyLogo ).LayoutLine() );
-
- // change image
- iRadioLogo->SwitchToLandscapeImage( useLandscapeImage );
- iRadioLogo->SetRect( layoutRect.Rect() );
-
- iVisualControl->SetOrientation( alfDisplayOrientation );
- iVisualControl->UpdateLayout( );
- iMediaIdle->SetOrientation( mediaIdleOrientation );
- iMediaIdle->UpdateLayout( );
- }
-
-// --------------------------------------------------------------------------------------------------
-// CFMRadioMainContainer::GetHelpContext
-// --------------------------------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::GetHelpContext( TCoeHelpContext& aContext ) const
- {
-#if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE
- aContext.iMajor = TUid::Uid( KUidFMRadioApplication );
- aContext.iContext = KFMRADIO_HLP_MAIN;
-#endif
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::UpdateTextColorFromSkin
-// Handles updating main area text colors using current skin.
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::UpdateTextColorFromSkin()
- {
- // Update text using skin color
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-
- TRgb color( KRgbBlue );
- AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
-
- iVisualControl->SetStationInformationTextColor( color );
-
- iMediaIdle->SetPrimaryColor( color );
-
- AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 );
-
- iMediaIdle->SetSecondaryColor( color );
- }
-
-// ----------------------------------------------------------------------------------------------------
-// CFMRadioMainContainer::VisualControl
-// Returns a pointer to the station information visualizer
-// ----------------------------------------------------------------------------------------------------
-//
-CFMRadioAlfVisualizer* CFMRadioMainContainer::VisualControl()
- {
- return iVisualControl;
- }
-
-// ----------------------------------------------------------------------------------------------------
-// CFMRadioMainContainer::MediaIdle
-// Returns a pointer to Media Idle
-// ----------------------------------------------------------------------------------------------------
-//
-CFMRadioAlfMediaIdle& CFMRadioMainContainer::MediaIdle()
- {
- return *iMediaIdle;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainContainer::SetRdsRadioTextL
-// Updates the rds information.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::SetRdsRadioTextL( const TDesC& aRadioText )
- {
- // Trim the text and check if there is actual content before showing it
- HBufC* text = aRadioText.AllocLC();
- text->Des().Trim();
- if ( text->Length() )
- {
- if ( iRdsViewer->SetTextL( *text ) )
- {
- iIdleController->ShowControl( *iRdsViewer );
- }
- }
- CleanupStack::PopAndDestroy( text );
- }
-
-// ----------------------------------------------------------------------------------------------------
-// TimerTimeOut
-// ----------------------------------------------------------------------------------------------------
-void CFMRadioMainContainer::TimerTimeOut( TInt aErrorStatus )
- {
-
- if ( aErrorStatus == KErrNone && iLightsOffCounter < KFadeFrames )
- {
- iAlfEnv.RefreshCallBack( &( iAlfEnv ) );
- TTimeIntervalMicroSeconds32 time( KTenMilliSecondsInMicroSeconds );
-
- timer.After(iTimer->iStatus, time );
-
- iTimer->Activate();
-
- iLightsOffCounter++;
-
- }
- else
- {
- timer.Cancel();
- }
-
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioAlfMediaIdle::LightStatusChangedL
-// From MHWRMLightObserver
-// Prepares media idle to handle new channel information
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainContainer::LightStatusChanged(TInt aTarget,
- CHWRMLight::TLightStatus aStatus)
- {
- FTRACE( FPrint( _L("CFMRadioMainContainer::LightStatusChanged( Target: %d Lights: %d )"), aTarget, aStatus ) );
- if ( CHWRMLight::ELightOff == aStatus && aTarget == 1 )
- {
- CAlfDisplay* display = NULL;
-
- if( iAlfEnv.DisplayCount() > 0 )
- {
- display = &(iAlfEnv.PrimaryDisplay());
-
- if ( display->Roster().Count() > 0 )
- {
- iIdleController->DeactivateControls();
-
-
- iAlfEnv.RefreshCallBack( &(iAlfEnv) );
-
- if ( !iTimer->IsActive() )
- {
- TTimeIntervalMicroSeconds32 time( KTenMilliSecondsInMicroSeconds );
- // Just to make sure, that dimming is really happening
- iLightsOffCounter = 0;
- timer.After(iTimer->iStatus, time );
- iTimer->Activate();
- }
- }
- }
- }
- else if ( CHWRMLight::ELightOn == aStatus && aTarget == 1 )
- {
- if ( iTimer )
- {
- if ( iTimer->IsActive() )
- {
- iTimer->Cancel();
- }
- }
-
- if ( iLightsOffCounter != 0 )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- CFMRadioMainView* mainView = static_cast<CFMRadioMainView*>( appUi->View( KFMRadioMainViewId ) );
- mainView->DetermineActiveMediaIdleComponent();
-
- iLightsOffCounter = 0;
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::RdsViewer
-// --------------------------------------------------------------------------------
-//
-CFMRadioAlfRDSViewer& CFMRadioMainContainer::RdsViewer() const
- {
- return *iRdsViewer;
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::IdleController
-// --------------------------------------------------------------------------------
-//
-CFMRadioIdleController& CFMRadioMainContainer::IdleController() const
- {
- return *iIdleController;
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainContainer::Logo
-// --------------------------------------------------------------------------------
-//
-CFMRadioLogo& CFMRadioMainContainer::Logo() const
- {
- return *iRadioLogo;
- }
-// End of File
--- a/fmradio/fmradio/src/fmradiomainview.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1404 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioMainView
-*
-*/
-
-// INCLUDE FILES
-#include <featmgr.h>
-#include <aknViewAppUi.h>
-#include <akntitle.h>
-#include <avkon.hrh>
-#include <avkon.rsg>
-#include <avkon.mbg>
-#include <data_caging_path_literals.hrh>
-#include <akntoolbar.h>
-#include <fmradio.rsg>
-#include <StringLoader.h>
-#include <aknbutton.h>
-#include <aknconsts.h>
-#include <aknmessagequerydialog.h>
-#include <fmradio.mbg>
-#include <fmradiouids.h>
-#include <akntoolbarextension.h>
-
-#include "fmradiomusicstorehandler.h"
-#include "fmradiobacksteppingservicewrapper.h"
-#include "fmradiodocument.h"
-#include "fmradiordsreceiverbase.h"
-#include "fmradioalfvisualizer.h"
-#include "fmradioengine.h"
-#include "fmradiomainview.h"
-#include "fmradiomaincontainer.h"
-#include "fmradioappui.h"
-#include "fmradio.hrh"
-#include "fmradioengineradiosettings.h"
-#include "fmradioalfmediaidle.h"
-#include "fmradiopubsub.h"
-#include "fmradioalfrdsviewer.h"
-#include "fmradioidlecontroller.h"
-#include "fmradiologo.h"
-#include "debug.h"
-
-// A debug flag which is used for differentiating between original version and updated
-// version, when set will add identifier on Main View title. Used for testing purposes
-#undef __FM_UPDATE_PACKAGE__
-
-// CONSTANTS
-
-#ifdef __FM_UPDATE_PACKAGE__
-_LIT( KFMRadioUpdated, " *" );
-#endif
-
-// Delay in milliseconds for fading out the RDS indicator
-const TInt KFMRadioRdsSignalFadeOutDelay = 1000;
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CFMRadioMainView::NewL
-// Two-phase constructor of CFMRadioMainView
-// ---------------------------------------------------------
-//
-CFMRadioMainView* CFMRadioMainView::NewL(
- CRadioEngine* aRadioEngine, CAlfEnv& aAlfEnv, MChannelListHandler& aObserver )
- {
- CFMRadioMainView* self = new (ELeave) CFMRadioMainView( aRadioEngine, aAlfEnv, aObserver );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::ConstructL
-// EPOC two-phased constructor
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::ConstructL()
- {
- BaseConstructL( R_FMRADIO_MAIN_VIEW );
- PrepareToolbar();
-
- if ( !AknLayoutUtils::PenEnabled() )
- {
- ShowToolbar( EFalse );
- }
-
- iRdsSignalTimer = CPeriodic::NewL(CActive::EPriorityStandard);
- iMusicStoreHandler = CFMRadioMusicStoreHandler::NewL( R_FMRADIO_MAIN_OPTIONS_MENU );
- iMusicStoreHandler->EnableMusicStore( ETrue );
-
- CAknToolbarExtension* toolbarExt = iToolbar->ToolbarExtension();
- CAknButton* operatorStoreButton = NULL;
- operatorStoreButton = static_cast<CAknButton*>( toolbarExt->ControlOrNull( EFMRadioToolbarButtonCmdOperatorMusicStore ) );
- const TDesC& storeName = iMusicStoreHandler->OperatorMusicStoreName();
-
- if ( operatorStoreButton )
- {
- // set text for button name and tooltip
- operatorStoreButton->State()->SetTextL( storeName );
- operatorStoreButton->State()->SetHelpTextL( storeName );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::CFMRadioMainView
-// default constructor
-// ---------------------------------------------------------
-//
-CFMRadioMainView::CFMRadioMainView(
- CRadioEngine* aRadioEngine,
- CAlfEnv& /*aAlfEnv*/,
- MChannelListHandler& aObserver)
- : iRadioEngine( aRadioEngine ),
- iSeeking( EFalse ),
- iChangeDirection( EFMRadioStationChangeNone ),
- iStartUp( ETrue ),
- iObserver( aObserver )
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::~CFMRadioMainView
-// Class destructor
-// ---------------------------------------------------------
-//
-CFMRadioMainView::~CFMRadioMainView()
- {
- if( iRdsSignalTimer && iRdsSignalTimer->IsActive() )
- {
- iRdsSignalTimer->Cancel();
- }
- if ( iRdsSignalTimer )
- {
- delete iRdsSignalTimer;
- iRdsSignalTimer = NULL;
- }
-
- CAlfEnv* alfEnv = CAlfEnv::Static();
- if ( alfEnv && iContainer )
- {
- iContainer->RdsViewer().RemoveObserver( this );
- iContainer->Logo().RemoveObserver( this );
- }
-
- delete iContainer;
- iContainer = NULL;
-
- delete iMusicStoreHandler;
- }
-
-// ---------------------------------------------------------
-// TUid CFMRadioMainView::Id
-// Return the unique identifier corresponding to this view
-// ---------------------------------------------------------
-//
-TUid CFMRadioMainView::Id() const
- {
- return KFMRadioMainViewId;
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::StopSeekL
-// Seek operation has completed. Update the view to reflect
-// this fact.
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::StopSeekL()
- {
- FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL Start") ) );
- if ( iContainer && iSeeking)
- {
- FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL inside first if") ) );
- if ( !AknLayoutUtils::PenEnabled() )
- {
- Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); // Change softkeys
- Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, 0, KNullDesC );
- }
- else
- {
- Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT ); // Change softkeys
- }
-
- SetToolbarDimmedState( EFalse );
- iContainer->VisualControl()->StopTuningAnimation();
- iSeeking = EFalse;
- Cba()->DrawDeferred(); // Redraw softkeys
- }
-
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
-
- TInt presetIndex = iRadioEngine->GetPresetIndex();
- TInt channelCount = iObserver.Channels()->Count();
-
- if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
- channelCount > 0 &&
- presetIndex < channelCount )
- {
- DisplayChannelL( presetIndex );
- FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL ERadioPresetMode preset index = %d"),iRadioEngine->GetPresetIndex() ) );
- }
- else
- {
- FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL inside else") ) );
- TInt channelIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() ); //, need to get here!
- if ( channelIndex != KErrNotFound )
- {
- FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL if channelIndex is found, channelIndex = %d"),channelIndex ) );
- iRadioEngine->TunePresetL( channelIndex ); //update engine to let it know that we've locked onto a preset.
- }
- else
- {
- FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL else, get tuned freq = %d"),iRadioEngine->GetTunedFrequency() ) );
- DisplayChannelL( KErrNotFound );
- }
- }
-
- // show default radio logo
- if ( iContainer )
- {
- iContainer->IdleController().ShowControl( iContainer->Logo() );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::FadeAndShowExit
-// Fade the view and all controls associated with it. Change
-// the soft keys so that "Exit" is displayed
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::FadeAndShowExit(
- TBool aFaded )
- {
- iFaded = aFaded;
-
- if ( iContainer )
- {
- if ( aFaded || iRadioEngine->IsInCall() ) // Needs to be faded - headset missing
- {
- StopDisplayingMenuBar(); // In case options menu is open when headset is disconnected
- SetToolbarDimmedState( ETrue );
- TRAP_IGNORE( Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EXIT ) ); // Change softkeys
- }
- else // Unfade
- {
- SetToolbarDimmedState( EFalse );
- if ( !AknLayoutUtils::PenEnabled() )
- {
- TRAP_IGNORE( Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); // Change softkeys
- Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, 0, KNullDesC ); )
- }
- else
- {
- TRAP_IGNORE ( Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT ); )// Change softkeys
- }
- }
- iContainer->SetFaded( aFaded ); // Unfade controls inside container
- Cba()->DrawDeferred(); // Redraw softkeys
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::UpdateDisplayForFocusGained
-// Update display to override default behavior
-// Can be removed when auto resume is implemented
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::UpdateDisplayForFocusGained()
- {
- FTRACE( FPrint( _L("CFMRadioMainView::UpdateDisplayForFocusGained") ) );
- FadeAndShowExit( iFaded );
- DetermineActiveMediaIdleComponent();
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::SeekL
-// Tells the window owning container to display seek note
-// and updates softkeys
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::SeekL()
- {
- if ( iContainer )
- {
- HBufC* seekString = StringLoader::LoadLC( R_QTN_FMRADIO_TUNING, iCoeEnv );
- iContainer->VisualControl()->SetStaticInfoTextL( iChangeDirection, *seekString );
- CleanupStack::PopAndDestroy( seekString );
- iContainer->RdsViewer().Reset();
- iContainer->MediaIdle().ResetMediaIdleContent();
- iContainer->ShowRTPlusInteractionIndicator( EFalse, ETrue );
- iContainer->IdleController().ShowControl( iContainer->Logo() );
- iContainer->VisualControl()->StartTuningAnimation();
- iSeeking = ETrue;
- SetToolbarDimmedState( ETrue );
- // force update for toolbar extension view
- iToolbar->ToolbarExtension()->SetShown( EFalse );
- }
- Cba()->SetCommandSetL( R_FMRADIO_MAIN_VIEW_TUNING_STATE_SOFTKEYS );
-
- Cba()->DrawDeferred(); // Redraw softkeys
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::ShowToolbar
-// Sets toolbar visibility.
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::ShowToolbar( TBool aVisible )
- {
- if ( iToolbar )
- {
- iToolbar->SetToolbarVisibility( aVisible );
- iToolbar->UpdateBackground();
- iToolbar->DrawDeferred();
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::HandleForegroundEventL
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::HandleForegroundEventL(TBool aForeground)
- {
- CAknView::HandleForegroundEventL(aForeground);
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
- if ( aForeground )
- {
- if ( iStartUp )
- {
- iStartUp = EFalse;
- CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
- TBool afEnabled = iRadioEngine->RadioSettings().IsRdsAfSearchEnabled();
- iContainer->ShowRdsInfo( receiver.SignalAvailable(), ETrue, afEnabled );
- TBool showMusicStore = IsRTPlusInterActionIndicatorNeeded();
- iContainer->ShowRTPlusInteractionIndicator(showMusicStore, ETrue);
- }
- }
- else
- {
- CAlfEnv* env = CAlfEnv::Static();
- if ( iContainer && env )
- {
- iContainer->IdleController().DeactivateControls();
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::RdsDataProgrammeService
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::RdsDataProgrammeService( const TDesC& aProgramService )
- {
- TRAP_IGNORE(
- RdsDataProgrammeServiceL( aProgramService )
- );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::RdsDataPsNameIsStatic
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::RdsDataPsNameIsStatic( TBool aStatic )
- {
- TRAP_IGNORE( HandleStaticProgrammeServiceL( aStatic ) )
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::RdsDataProgrammeServiceL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::RdsDataProgrammeServiceL( const TDesC& aProgramService )
- {
- FTRACE(FPrint(_L("CFMRadioMainView::RdsDataProgrammeServiceL('%S')"), &aProgramService));
- if( iContainer )
- {
- CAlfEnv* alfEnv = CAlfEnv::Static();
- if( alfEnv )
- {
- if( aProgramService.Length() > 0 )
- {
- TInt presetIndexToDisplay = KErrNotFound;
- TInt presetIndex = iRadioEngine->GetPresetIndex();
- // When we haven't preset name, ps name will save as preset name
- if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
- presetIndex < iObserver.Channels()->Count() )
- {
- presetIndexToDisplay = presetIndex;
- }
- SetStationChangeType( EFMRadioStationChangeNone );
- DisplayChannelL( presetIndexToDisplay );
- }
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::HandleStaticProgrammeServiceL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::HandleStaticProgrammeServiceL( TBool aStatic )
- {
- FTRACE(FPrint(_L("CFMRadioMainView::HandleStaticProgrammeServiceL(%d)"), aStatic));
-
- if( iContainer )
- {
- if ( aStatic )
- {
- // When we haven't got a name for preset, a static ps name will be saved
- TInt channelCount = iObserver.Channels()->Count();
- TInt currentPresetIx = iRadioEngine->GetPresetIndex();
-
- if ( aStatic && iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
- currentPresetIx != KErrNotFound &&
- channelCount > 0 &&
- currentPresetIx < channelCount )
- {
- TDesC& stationName = iObserver.Channels()->At( currentPresetIx ).iChannelInformation;
- TInt presetFreq = iObserver.Channels()->At( currentPresetIx ).iChannelFrequency;
-
- if ( stationName.Length() == 0 &&
- presetFreq != KErrNotFound &&
- iRadioEngine->RdsReceiver().ProgrammeService().Length() )
- {
- iObserver.Channels()->At( currentPresetIx ).iChannelInformation = iRadioEngine->RdsReceiver().ProgrammeService();
- iObserver.UpdateChannelsL( EStoreIndexToRepository, currentPresetIx, 0 );
- // Update station information display
- DisplayChannelL( currentPresetIx );
- }
- }
- iContainer->MediaIdle().AddPsNameToMediaIdleL( iRadioEngine->RdsReceiver().ProgrammeService() );
- }
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::RdsDataRadioText
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::RdsDataRadioText( const TDesC& aRadioText )
- {
- FTRACE(FPrint(_L("CFMRadioMainView::RdsDataRadioText('%S')"), &aRadioText));
- if ( iContainer && aRadioText.Length() > 0 )
- {
- TRAP_IGNORE( iContainer->SetRdsRadioTextL( aRadioText ) );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::RdsDataRadioTextPlus
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::RdsDataRadioTextPlus( const TInt /*aRadioTextPlusClass*/, const TDesC& /*aRadioText*/ )
- {
- if ( IsRTPlusInterActionIndicatorNeeded() )
- {
- iContainer->ShowRTPlusInteractionIndicator( ETrue, ETrue );
- if ( !iRadioEngine->MusicStoreNoteDisplayed() )
- {
- TRAP_IGNORE( ShowRTPlusFirstTimeDialogL() )
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::IsRTPlusInterActionIndicatorNeeded
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioMainView::IsRTPlusInterActionIndicatorNeeded()
- {
- CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
- TBool songInformation = receiver.RtPlusSong().Length() ||
- receiver.RtPlusArtist().Length() ||
- receiver.RtPlusAlbum().Length();
- TBool webLink = receiver.RtPlusProgramUrl().Length() &&
- iRadioEngine->GetRTPlusSupportLevel() == EFMRadioAllInteractions;
-
- return songInformation || webLink;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::ShowRTPlusFirstTimeDialogL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::ShowRTPlusFirstTimeDialogL()
- {
- // to avoid further calls
- iRadioEngine->SetMusicStoreNoteDisplayed();
-
- HBufC* noteTxt = StringLoader::LoadLC( R_QTN_FMRADIO_RTPLUS_FIRSTTIME, iCoeEnv );
-
- CAknMessageQueryDialog* rdsFirstTimeDialog = new (ELeave) CAknMessageQueryDialog;
- CleanupStack::PushL( rdsFirstTimeDialog );
- rdsFirstTimeDialog->SetMessageTextL( *noteTxt );
- CleanupStack::Pop( rdsFirstTimeDialog );
- rdsFirstTimeDialog->ExecuteLD( R_FMRADIO_RTPLUS_FIRSTTIME_NOTE );
-
- CleanupStack::PopAndDestroy( noteTxt );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::RdsAfSearchBegin
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::RdsAfSearchBegin()
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::RdsAfSearchEnd
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::RdsAfSearchEnd( TUint32 /*aFrequency*/, TInt /*aError*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::RdsAfSearchStateChange
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::RdsAfSearchStateChange( TBool aEnabled )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>(AppUi());
- if( appUi->ActiveView() == KFMRadioMainViewId )
- {
- CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
- TBool show = receiver.SignalAvailable();
- iContainer->ShowRdsInfo( show, ETrue, aEnabled );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::RdsAvailable
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::RdsAvailable( TBool aAvailable )
- {
- CAlfEnv* alfEnv = CAlfEnv::Static();
- if( alfEnv )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>(AppUi());
-
- if( appUi->ActiveView() == KFMRadioMainViewId )
- {
- if( aAvailable )
- {
- iRdsSignalTimer->Cancel();
- TBool afEnabled = iRadioEngine->RadioSettings().IsRdsAfSearchEnabled();
- iContainer->ShowRdsInfo( ETrue, ETrue, afEnabled );
- }
- else
- {
- // Start timer only if it wasn't activated before
- if( !iRdsSignalTimer->IsActive() )
- {
- // Used for conversing milliseconds to format timer understand, ie. microseconds
- const TInt timerMultiplier = 1000;
-
- // Start timer to fade rds icon after a delay
- iRdsSignalTimer->Start( TTimeIntervalMicroSeconds32( KFMRadioRdsSignalFadeOutDelay * timerMultiplier ),
- TTimeIntervalMicroSeconds32(0), TCallBack( StaticRdsSignalTimerCallback, this ) );
- }
- }
- }
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::StaticRdsSignalTimerCallback
-// ---------------------------------------------------------
-TInt CFMRadioMainView::StaticRdsSignalTimerCallback( TAny* aSelfPtr )
- {
- CFMRadioMainView* self = reinterpret_cast<CFMRadioMainView*>(aSelfPtr);
- if(self)
- {
- self->iRdsSignalTimer->Cancel();
- if(self->iContainer)
- {
- self->iContainer->ShowRdsInfo(EFalse, ETrue);
- }
- }
- return KErrNone;
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::DisplayChannelL
-// Inform the window owning container that it should display
-// the frequency and name of the channel specified.
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::DisplayChannelL( TInt aChannelIndex )
- {
- FTRACE(FPrint(_L("DisplayChannelL Start, index: %d "), aChannelIndex));
-
- if ( iContainer )
- {
- iContainer->MediaIdle().ResetMediaIdleContent();
-
- if ( aChannelIndex != KErrNotFound )
- {
- CRadioEngine::TStationName stationName;
- TInt channelNumber = aChannelIndex + 1;
- TInt channelFrequency = KErrNotFound;
-
- iRadioEngine->GetPresetNameAndFrequencyL( aChannelIndex, stationName, channelFrequency );
-
- TFMRadioStationChangeType seekDirection = iChangeDirection;
-
- // Hide index number as the frequency was set by RDS AF search.
- if ( iRadioEngine->FrequencySetByRdsAf() && channelFrequency != iRadioEngine->GetTunedFrequency() )
- {
- channelNumber = KErrNotFound;
- channelFrequency = iRadioEngine->GetTunedFrequency();
- seekDirection = EFMRadioStationChangeNone;
- }
-
- // Update view
- iContainer->DisplayChannelInfoL( channelNumber,
- stationName,
- seekDirection,
- channelFrequency );
- }
- else
- {
- iContainer->DisplayChannelInfoL( aChannelIndex,
- KNullDesC,
- iChangeDirection,
- iRadioEngine->GetTunedFrequency() );
- }
-
- FTRACE( FPrint(_L("DisplayChannelL End") ) );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::HandleCommandL
-// All commands are handled by the AppUi
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::HandleCommandL( TInt aCommand )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
- switch ( aCommand )
- {
- case EAknSoftkeyBack:
- {
- const TVwsViewId viewId( TUid::Uid( KUidFMRadioApplication ), Id() );
- if ( !appUi->BackSteppingWrapper().HandleBackCommandL( viewId ) )
- {
- // Command not consumed by Back Stepping Service, handle here by going background
- TApaTask task( iEikonEnv->WsSession() );
- task.SetWgId( iEikonEnv->RootWin().Identifier() );
- task.SendToBackground();
- }
- break;
- }
- case EMPXPbvCmdInternetGoToWeb:
- {
- LaunchBrowserL( aCommand );
- break;
- }
- case EFMRadioCmdChannelList:
- {
- HandleSaveChannelQueryL();
- appUi->HandleCommandL( aCommand );
- break;
- }
- case EFMRadioRockerButtonKeyUp:
- case EFMRadioRockerButtonKeyDown:
- {
- // NOP
- break;
- }
- case EAknSoftkeySelect: // MSK
- {
- if ( !iFaded && !iSeeking )
- {
- HandleSaveChannelQueryL();
- appUi->HandleCommandL( EFMRadioCmdChannelList );
- }
- break;
- }
- case EFMRadioRockerButtonKeyLeft:
- {
- if ( !iFaded && !iSeeking )
- {
- appUi->HandleCommandL( EFMRadioCmdPrevChannel );
- }
- break;
- }
- case EFMRadioRockerButtonKeyLeftLong:
- {
- if ( !iFaded && !iSeeking )
- {
- appUi->HandleCommandL( EFMRadioCmdSeekDown );
- }
- break;
- }
- case EFMRadioRockerButtonKeyRight:
- {
- if ( !iFaded && !iSeeking )
- {
- appUi->HandleCommandL( EFMRadioCmdNextChannel );
- }
- break;
- }
- case EFMRadioRockerButtonKeyRightLong:
- {
- if ( !iFaded && !iSeeking )
- {
- appUi->HandleCommandL( EFMRadioCmdSeekUp );
- }
- break;
- }
- case EFMRadioCmdErase:
- {
- if ( appUi->EraseChannelL( iRadioEngine->GetPresetIndex() ) )
- {
- // delete has been confirmed, update station info
- SetStationChangeType( EFMRadioStationChangeNone );
- iRadioEngine->SetTunerModeOn();
- DisplayChannelL( KErrNotFound );
- }
- break;
- }
- case EFMRadioToolbarButtonCmdToggleIhf:
- {
- if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputHeadset )
- {
- appUi->HandleCommandL( EFMRadioCmdActivateIhf );
- }
- else
- {
- appUi->HandleCommandL( EFMRadioCmdDeactivateIhf );
- }
- break;
- }
- default:
- {
- if ( iMusicStoreHandler->IsMusicStoreCommandId( aCommand ) )
- {
- LaunchBrowserL( aCommand );
- }
- else
- {
- appUi->HandleCommandL( aCommand );
- }
- break;
- }
- }
- }
-
-// ----------------------------------------
-// Launch Browser
-// ----------------------------------------
-void CFMRadioMainView::LaunchBrowserL( TInt aCommandId )
- {
- CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
- switch ( aCommandId )
- {
- case EMPXPbvCmdInternetGoToWeb:
- iMusicStoreHandler->LaunchWebPageL( receiver.RtPlusProgramUrl() );
- break;
- default:
- iMusicStoreHandler->LaunchMusicStoreL( aCommandId,
- receiver.RtPlusSong(),
- receiver.RtPlusArtist(),
- receiver.RtPlusAlbum() );
- break;
- }
- }
-
-// ----------------------------------------------------------------------------------------------------
-// CFMRadioMainView::NotifyRdsTextTimerCompletion()
-// From MFMRadioAlfRdsViewObserver
-// Called when same RT has stayed on display for 60 sec.
-// ----------------------------------------------------------------------------------------------------
-//
-void CFMRadioMainView::NotifyRdsTextTimerCompletion()
- {
- DetermineActiveMediaIdleComponent();
- }
-// ---------------------------------------------------------
-// CFMRadioMainView::DoActivateL
-// Activate the main view
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::DoActivateL(
- const TVwsViewId& /*aPrevViewId*/,
- TUid /*aCustomMessageId*/,
- const TDesC8& /*aCustomMessage*/)
- {
- CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
- titlePane->SetTextToDefaultL();
-#ifdef __FM_UPDATE_PACKAGE__
- const TDesC* titleText = titlePane->Text();
- TBufC<2> titleAddition( KFMRadioUpdated );
- HBufC* newTitle = HBufC::NewLC( titleText->Length() + titleAddition.Length() );
- newTitle->Des().Copy( *titleText );
- newTitle->Des().Append( titleAddition );
- titlePane->SetTextL( *newTitle, ETrue );
- CleanupStack::PopAndDestroy( newTitle );
-#endif
-
- if ( !iContainer )
- {
- CAlfEnv* alfEnv = CAlfEnv::Static();
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
- iContainer = CFMRadioMainContainer::NewL( ClientRect() , *alfEnv, *iRadioEngine );
- iContainer->RdsViewer().SetObserver( this );
- iContainer->Logo().SetObserver( this );
- }
- if ( !AknLayoutUtils::PenEnabled() )
- {
- // explicitly remove the middle softkey that shouldn't be there.
- Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, 0, KNullDesC );
- }
-
- SetStationChangeType( EFMRadioStationChangeNone );
-
- if ( !iStartUp )
- {
- StopSeekL(); //used to trigger a UI update
- }
- else
- {
- AppUi()->HandleCommandL( EFMRadioCmdUpdateVolume );
- }
-
- AppUi()->HandleCommandL( EFMRadioCmdMainViewActive );
-
- iRadioEngine->RdsReceiver().AddObserver( this );
-
- TBool afEnabled = iRadioEngine->RadioSettings().IsRdsAfSearchEnabled();
-
- iContainer->ShowRdsInfo( iRadioEngine->RdsReceiver().SignalAvailable(), EFalse, afEnabled );
- FadeAndShowExit(iFaded);
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::DoDeactivate
-// Deactivate the main view
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::DoDeactivate()
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>(AppUi());
-
- if ( appUi->RadioEngine() )
- {
- iRadioEngine->RdsReceiver().RemoveObserver( this );
- }
-
- if ( iContainer )
- {
- CAlfEnv* alfEnv = CAlfEnv::Static();
- if ( alfEnv )
- {
- iContainer->RdsViewer().RemoveObserver( this );
- iContainer->RdsViewer().Reset();
- iContainer->Logo().RemoveObserver( this );
- iContainer->IdleController().HideAllControls();
- }
- delete iContainer;
- iContainer = NULL;
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::DynInitMenuPaneL
-// Sets the state of menu items dynamically according to the
-// state of application data.
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- iMusicStoreHandler->InitializeMenuL( aResourceId, aMenuPane );
-
- if ( aResourceId == R_FMRADIO_MAIN_OPTIONS_MENU ) // Main menu
- {
- if ( IsWebLinkAvailable() )
- {
- aMenuPane->SetItemDimmed( EMPXPbvCmdInternetGoToWeb, EFalse );
- }
- else
- {
- aMenuPane->SetItemDimmed( EMPXPbvCmdInternetGoToWeb, ETrue );
- }
-
- if ( iRadioEngine->IsAudioRoutingPossible() )
- {
- if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
- {
- // Delete existing menu option and add a new one
- aMenuPane->DeleteMenuItem( EFMRadioCmdActivateIhf );
- if ( iRadioEngine->IsHeadsetConnected() )
- {
- aMenuPane->SetItemTextL( EFMRadioCmdDeactivateIhf, R_QTN_FMRADIO_OPTIONS_DEACTIVATE );
- }
- else
- {
- aMenuPane->DeleteMenuItem( EFMRadioCmdDeactivateIhf );
- }
- }
- else
- {
- // Delete existing menu option and add a new one
- aMenuPane->DeleteMenuItem( EFMRadioCmdDeactivateIhf );
- aMenuPane->SetItemTextL( EFMRadioCmdActivateIhf,R_QTN_FMRADIO_OPTIONS_ACTIVATE );
- }
- }
- else
- {
- aMenuPane->SetItemDimmed( EFMRadioCmdDeactivateIhf, ETrue );
- aMenuPane->SetItemDimmed( EFMRadioCmdActivateIhf, ETrue );
- }
-
- // if help is not enabled, disable help option
- if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
- {
- aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
- }
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- if ( appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() ) == KErrNotFound ) // current frequency not saved
- {
- aMenuPane->SetItemDimmed( EFMRadioCmdRename, ETrue );
- aMenuPane->SetItemDimmed( EFMRadioCmdSaveChannel, EFalse );
- aMenuPane->SetItemDimmed( EFMRadioCmdErase, ETrue );
- }
- else
- {
- aMenuPane->SetItemDimmed( EFMRadioCmdRename, EFalse );
- aMenuPane->SetItemDimmed( EFMRadioCmdSaveChannel, ETrue );
- aMenuPane->SetItemDimmed( EFMRadioCmdErase, EFalse );
- }
- }
-
- if ( aResourceId == R_FMRADIO_OPTIONS_AF_SUB_MENU ) // Rds af search sub menu
- {
- TBool afEnabled = iRadioEngine->RadioSettings().IsRdsAfSearchEnabled();
- if ( afEnabled )
- {
- aMenuPane->SetItemButtonState( EFMRadioCmdDisableRdsAfSearch, EEikMenuItemSymbolIndeterminate );
- aMenuPane->SetItemButtonState( EFMRadioCmdEnableRdsAfSearch, EEikMenuItemSymbolOn );
- }
- else
- {
- aMenuPane->SetItemButtonState( EFMRadioCmdEnableRdsAfSearch, EEikMenuItemSymbolIndeterminate );
- aMenuPane->SetItemButtonState( EFMRadioCmdDisableRdsAfSearch, EEikMenuItemSymbolOn );
- }
- }
-
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::LayoutChangedL
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::LayoutChangedL( TInt aType )
- {
- if ( iContainer )
- {
- iContainer->HandleResourceChange( aType );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::SetStationChangeType
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::SetStationChangeType( TFMRadioStationChangeType aChangeType )
- {
- iChangeDirection = aChangeType;
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::PrepareViewForChannelChange
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::PrepareViewForChannelChange()
- {
- TRAP_IGNORE( PrepareViewForChannelChangeL() );
- }
-
-// ---------------------------------------------------------
-// CFMRadioMainView::PrepareViewForChannelChangeL
-// ---------------------------------------------------------
-//
-void CFMRadioMainView::PrepareViewForChannelChangeL()
- {
- switch ( iChangeDirection )
- {
- case EFMRadioStationChangeNext: // fall through
- case EFMRadioStationChangePrevious:
- case EFMRadioStationChangeScanUp:
- case EFMRadioStationChangeScanDown:
- {
- if( iContainer )
- {
- iContainer->VisualControl()->ScrollOutCurrentStationInformationL( iChangeDirection );
- }
- }
- break;
- default:
- {
- break;
- }
- }
- if ( iContainer )
- {
- iContainer->RdsViewer().Reset();
- }
-
- if ( iContainer )
- {
- iContainer->ShowRTPlusInteractionIndicator( EFalse, ETrue);
- }
- // force update for toolbar extension view
- iToolbar->ToolbarExtension()->SetShown( EFalse );
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::PrepareToolbar
-// Prepare toolbar for displaying basic radio command buttons
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainView::PrepareToolbar()
- {
- // get toolbar from view
- iToolbar = Toolbar();
-
- // Set observer
- iToolbar->SetToolbarObserver( this );
-
- CAknButton* leftButton = NULL;
- CAknButton* rightButton = NULL;
- leftButton = static_cast<CAknButton*>( iToolbar->ControlOrNull( EFMRadioToolbarButtonCmdTuneDown ) );
- rightButton = static_cast<CAknButton*>( iToolbar->ControlOrNull( EFMRadioToolbarButtonCmdTuneUp) );
-
- //set delay after buttons report long key press
- if ( leftButton )
- {
- leftButton->SetLongPressInterval( KLongPressDelayValueInMicroseconds );
- }
- if ( rightButton )
- {
- rightButton->SetLongPressInterval( KLongPressDelayValueInMicroseconds );
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::OfferToolbarEventL
-// Handle commands from toolbar.
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainView::OfferToolbarEventL( TInt aCommandId )
- {
- // Event modifiers are valid only during CAknToolbar::OfferToolbarEventL
- TBool isHandled = EFalse;
- if ( iToolbar->EventModifiers() == CAknToolbar::ELongPress )
- {
- switch( aCommandId )
- {
- case EFMRadioToolbarButtonCmdTuneDown:
- {
- isHandled = ETrue;
- AppUi()->HandleCommandL( EFMRadioCmdSeekDown );
- break;
- }
- case EFMRadioToolbarButtonCmdTuneUp:
- {
- isHandled = ETrue;
- AppUi()->HandleCommandL( EFMRadioCmdSeekUp );
- break;
- }
- default:
- {
- // fall through.
- // dont break here because extension list buttons
- // seem to report longpress also after the tuning buttons
- // are pressed long.
- }
- }
- }
-
- if ( iToolbar->EventModifiers() != CAknToolbar::ELongPress &&
- iToolbar->EventModifiers() != CAknToolbar::ELongPressEnded )
- {
- switch( aCommandId )
- {
- case EFMRadioToolbarButtonCmdTuneDown:
- {
- isHandled = ETrue;
- AppUi()->HandleCommandL( EFMRadioCmdPrevChannel );
- break;
- }
- case EFMRadioToolbarButtonCmdTuneUp:
- {
- isHandled = ETrue;
- AppUi()->HandleCommandL( EFMRadioCmdNextChannel );
- break;
- }
- default:
- {
- // fall through.
- // dont break here because extension list buttons
- // seem to report longpress also after the tuning buttons
- // are pressed long.
- }
- }
- }
- if ( !isHandled )
- {
- switch( aCommandId )
- {
- case EFMRadioToolbarButtonCmdNokiaMusicStore:
- {
- HandleCommandL( EFMRadioMusicStoreNokiaMusicShop );
- break;
- }
- case EFMRadioToolbarButtonCmdOperatorMusicStore:
- {
- HandleCommandL( EFMRadioMusicStoreOperator );
- break;
- }
- case EFMRadioCmdRename:
- {
- iToolbar->ToolbarExtension()->SetShown( EFalse );
- HandleCommandL( aCommandId );
- break;
- }
- case EFMRadioCmdErase:
- {
- iToolbar->ToolbarExtension()->SetShown( EFalse );
- HandleCommandL( aCommandId );
- break;
- }
- case EFMRadioCmdChannelList:
- {
- iToolbar->ToolbarExtension()->SetShown( EFalse );
- HandleCommandL( aCommandId );
- break;
- }
- default:
- {
- HandleCommandL( aCommandId );
- break;
- }
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::DynInitToolbarL
-// from MAknToolbarObserver
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainView::DynInitToolbarL( TInt /*aResourceId*/, CAknToolbar* aToolbar )
- {
- if ( iToolbar == aToolbar )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- CAknToolbarExtension* toolbarExtension = iToolbar->ToolbarExtension();
-
- if ( appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() ) == KErrNotFound )
- {
- // current frequency not saved
- // show save
- toolbarExtension->HideItemL( EFMRadioCmdSaveChannel, EFalse );
- // hide rename
- toolbarExtension->HideItemL( EFMRadioCmdRename, ETrue );
- // dim delete
- toolbarExtension->SetItemDimmed( EFMRadioCmdErase, ETrue );
- }
- else
- {
- // show rename
- toolbarExtension->HideItemL( EFMRadioCmdRename, EFalse );
- // hide save
- toolbarExtension->HideItemL( EFMRadioCmdSaveChannel, ETrue );
- // undim delete
- toolbarExtension->SetItemDimmed( EFMRadioCmdErase, EFalse );
- }
-
- if ( IsWebLinkAvailable() )
- {
- // show web button
- toolbarExtension->HideItemL( EMPXPbvCmdInternetGoToWeb, EFalse );
- }
- else
- {
- // hide web button
- toolbarExtension->HideItemL( EMPXPbvCmdInternetGoToWeb, ETrue );
- }
-
- TBool musicStoreEnabled = iMusicStoreHandler->IsMusicStoreEnabled();
-
- if ( iMusicStoreHandler->OperatorMusicStoreAvailable() && musicStoreEnabled )
- {
- // show operator store
- toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdOperatorMusicStore, EFalse );
- // hide speaker button
- toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdToggleIhf, ETrue );
- }
- else
- {
- // hide operator store
- toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdOperatorMusicStore, ETrue );
- // show and update speaker button
- UpdateToolbarSpeakerButtonStatus();
- toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdToggleIhf, EFalse );
- }
-
- if ( iMusicStoreHandler->NokiaMusicStoreAvailable() && musicStoreEnabled )
- {
- // show Nokia Music Store
- toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdNokiaMusicStore, EFalse );
- }
- else
- {
- // hide Nokia Music Store
- toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdNokiaMusicStore, ETrue );
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::SetToolbarDimmedState
-// Set the current state of the buttons in the button group
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainView::SetToolbarDimmedState( TBool aState )
- {
- iToolbar->SetDimmed( aState );
- iToolbar->DrawDeferred();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMainView::HandleSaveChannelQueryL
-// show query if the current channel is not saved
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMainView::HandleSaveChannelQueryL()
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- TInt channelIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
-
- if ( KErrNotFound == channelIndex )
- {
- TBool accepted = EFalse; // Operation accepted or discarded
- CAknQueryDialog* saveQuery = CAknQueryDialog::NewL();
- accepted = saveQuery->ExecuteLD( R_FMRADIO_QUERY_SAVE_CURRENT );
-
- if ( accepted )
- {
- AppUi()->HandleCommandL( EFMRadioCmdSaveChannel );
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::SetEmphasis
-// From MEikMenuObserver.
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainView::SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis )
- {
- CAknView::SetEmphasis( aMenuControl, aEmphasis );
-
- if ( iContainer )
- {
- if ( aEmphasis ) // options menu opened
- {
- iOptionsMenuOpen = ETrue;
- // deactivate controls to help improve UI performance
- iContainer->IdleController().DeactivateControls();
- }
- else
- {
- if ( iOptionsMenuOpen )
- {
- // menu has been been really opened so update status
- iOptionsMenuOpen = EFalse;
- DetermineActiveMediaIdleComponent();
- }
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::LogoDisplayTimeCompleted
-// from MFMRadioAlfLogoObserver
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainView::LogoDisplayTimeCompleted()
- {
- DetermineActiveMediaIdleComponent();
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::DetermineActiveMediaIdleComponent
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainView::DetermineActiveMediaIdleComponent()
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*> (AppUi());
- TBool wizardHandled = appUi->IsStartupWizardHandled();
-
- if ( iContainer &&
- !iOptionsMenuOpen &&
- wizardHandled &&
- IsForeground() )
- {
-
- if ( iContainer->RdsViewer().IsRdsTextVisibilityTimerCompleted() )
- {
- // same text displayed for a while, ok to start idle
- iContainer->IdleController().ShowControl( iContainer->MediaIdle() );
- }
- else
- {
- // display the rds text until the NotifyRdsTextTimerCompletion() callback
- iContainer->IdleController().ShowControl( iContainer->RdsViewer() );
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::IsWebLinkAvailabe
-// --------------------------------------------------------------------------------
-//
-TBool CFMRadioMainView::IsWebLinkAvailable()
- {
- TBool response = EFalse;
- CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
- if ( receiver.RtPlusProgramUrl().Length() &&
- iRadioEngine->GetRTPlusSupportLevel() == EFMRadioAllInteractions )
- {
- response = ETrue;
- }
- return response;
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::UpdateToolbarSpeakerButtonStatus
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainView::UpdateToolbarSpeakerButtonStatus()
- {
- if ( iToolbar && iContainer )
- {
- CAknToolbarExtension* toolbarExtension = iToolbar->ToolbarExtension();
-
- if ( iRadioEngine->IsAudioRoutingPossible() )
- {
- toolbarExtension->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, EFalse );
- CAknButton* speakerButton = NULL;
-
- speakerButton = static_cast<CAknButton*>( toolbarExtension->ControlOrNull( EFMRadioToolbarButtonCmdToggleIhf ) );
-
- if ( speakerButton )
- {
- if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
- {
- speakerButton->SetCurrentState( 1, ETrue );
- }
- else
- {
- speakerButton->SetCurrentState( 0, ETrue );
- }
- }
- }
- else
- {
- toolbarExtension->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, ETrue );
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioMainView::ShowDefaultLogo
-// --------------------------------------------------------------------------------
-//
-void CFMRadioMainView::ShowDefaultLogo()
- {
- // show default radio logo
- if ( iContainer )
- {
- iContainer->IdleController().ShowControl( iContainer->Logo() );
- }
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradiomusicstorehandler.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,693 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation for music store integration.
-*
-*/
-
-#include <apgcli.h>
-#include <apgtask.h>
-#include <centralrepository.h>
-#include <e32base.h>
-#include <e32property.h>
-#include <eikenv.h>
-#include <eikmenup.h>
-#include <eikmenub.h>
-#include <fmradio.rsg>
-#include <mpxfindinmusicshop.h>
-#include <mpxfindinmusicshopcommon.h> //for p&s keys
-
-#include "fmradio.hrh"
-#include "fmradiomusicstorehandler.h"
-#include "debug.h"
-
-// Some debug flags
-
-// If defined, forces Operator specific music shop to be enabled,
-// regardless if it is supported or not. For debugging purposes
-#undef FORCE_OPERATOR_MUSIC_SHOP
-
-// Following constants are from mpxmusicplayer_101FFCDC.crml
-const TUid KCRUidMPXMPSettings = {0x101FFCDC}; // UID for Music Store Settings CenRep
-const TUint32 KMPXMusicStoreUID = 0x3;
-const TUint32 KOperatorMusicStore = 0x4;
-const TUint32 KOperatorMusicStoreType = 0x5;
-const TUint32 KOperatorMusicStoreDisplayName = 0x6;
-const TUint32 KOperatorMusicStoreNativeUid = 0x7;
-const TUint32 KOperatorMusicStoreWebPage = 0x9;
-const TUint32 KOperatorMusicStoreURI = 0xA;
-const TInt TUInt32HexLength = 8;
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::CMusicStoreHandler
-// C++ class constructor.
-// ----------------------------------------------------
-//
-CFMRadioMusicStoreHandler::CFMRadioMusicStoreHandler( TInt aResourceId )
-: iResourceId( aResourceId )
- {
- // Nothing to do
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::~CMusicStoreHandler
-// Default destructor.
-// ----------------------------------------------------
-//
-CFMRadioMusicStoreHandler::~CFMRadioMusicStoreHandler()
- {
- iOperatorMusicStoreName.Close();
- iOperatorStoreWebsite.Close();
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::NewL
-// Two-phased class constructor.
-// ----------------------------------------------------
-//
-CFMRadioMusicStoreHandler* CFMRadioMusicStoreHandler::NewL( TInt aResourceId )
- {
- CFMRadioMusicStoreHandler* self = new (ELeave) CFMRadioMusicStoreHandler( aResourceId );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::NewL
-// Second phase class constructor.
-// ----------------------------------------------------
-//
-void CFMRadioMusicStoreHandler::ConstructL()
- {
- iCoeEnv = CEikonEnv::Static();
- CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings );
- CleanupStack::PushL( repository );
-
- RBuf8 uidDes;
- uidDes.CleanupClosePushL();
- uidDes.CreateL( TUInt32HexLength );
- TInt error = KErrNone;
- error = repository->Get( KMPXMusicStoreUID, uidDes );
-
- // Check for availability of Nokia Music store
- if ( !error )
- {
- iMusicStoreUID = Uint32Presentation( uidDes );
- iMusicStoreAppInstalled = IsAppInstalledL( TUid::Uid( iMusicStoreUID ) );
- }
-
- if ( NokiaMusicStoreAvailable() )
- {
- InitializeMusicStore( TUid::Uid( iMusicStoreUID ) );
- }
-
- // Check if operator provided a music store
- TFMRadioOperatorAppType appType = CheckOperatorMusicStoreTypeL( *repository );
- if ( appType != EFMRadioAppNotAvailable )
- {
- // Get the name of the music store
- const TInt initialNameLength = 11;
- iOperatorMusicStoreName.CreateL( initialNameLength );
- TInt realLength = KErrNotFound;
- error = repository->Get( KOperatorMusicStoreDisplayName, iOperatorMusicStoreName, realLength );
- if ( error == KErrOverflow )
- {
- iOperatorMusicStoreName.ReAllocL( realLength );
- error = repository->Get( KOperatorMusicStoreDisplayName, iOperatorMusicStoreName );
- }
- User::LeaveIfError( error );
-#ifdef FORCE_OPERATOR_MUSIC_SHOP
- if ( !iOperatorMusicStoreName.Length() )
- {
- _LIT( KHardCodedName, "O'MusicShop" ); // length <= initialNameLength
- iOperatorMusicStoreName.Copy( KHardCodedName );
- }
-#endif
-
- // Get application type specific parameters
- InitializeParametersL( *repository, appType );
- }
- CleanupStack::PopAndDestroy( 2 ); // uidDes, repository
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::CheckOperatorMusicStoreTypeL
-// ----------------------------------------------------
-//
-CFMRadioMusicStoreHandler::TFMRadioOperatorAppType CFMRadioMusicStoreHandler::CheckOperatorMusicStoreTypeL(
- CRepository& aRepository )
- {
- TFMRadioOperatorAppType appType = EFMRadioAppNotAvailable;
- // Check if operator provided a music store
- TBool operatorStorePresent = EFalse;
- TInt error = aRepository.Get( KOperatorMusicStore, operatorStorePresent );
- if ( error != KErrNotFound )
- {
- User::LeaveIfError( error );
- }
- if ( operatorStorePresent )
- {
- TInt appTypeCR;
- error = aRepository.Get( KOperatorMusicStoreType, appTypeCR );
- User::LeaveIfError( error );
- if ( appTypeCR == 0 ) // 0 = Native app
- {
- appType = EFMRadioNativeApp;
- }
- else // 1 = Java app
- {
- appType = EFMRadioJavaApp;
- }
- }
-
- // The code assumes that if both application and website is available then
- // website is preferred type
- TInt website;
- error = aRepository.Get( KOperatorMusicStoreWebPage, website );
- User::LeaveIfError( error );
-#ifdef FORCE_OPERATOR_MUSIC_SHOP
- website = ETrue;
-#endif
- if ( website )
- {
- appType = EFMRadioWebsite;
- }
-
- return appType;
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::InitializeParametersL
-// ----------------------------------------------------
-//
-void CFMRadioMusicStoreHandler::InitializeParametersL(
- CRepository& aRepository,
- TFMRadioOperatorAppType aAppType )
- {
- TInt error = KErrNone;
- switch ( aAppType )
- {
- case EFMRadioNativeApp:
- {
- RBuf8 operatorUidDes;
- operatorUidDes.CleanupClosePushL();
- operatorUidDes.CreateL( TUInt32HexLength );
-
- TInt error = KErrNone;
- error = aRepository.Get( KOperatorMusicStoreNativeUid, operatorUidDes );
-
- if ( !error )
- {
- iOperatorStoreNativeUID = Uint32Presentation( operatorUidDes );
- // It is assumed that both Nokia Music Shop and operator specific music store use
- // same kind of interface to communicate
- InitializeMusicStore( TUid::Uid( iOperatorStoreNativeUID ) );
- }
- CleanupStack::PopAndDestroy( &operatorUidDes );
- break;
- }
- case EFMRadioJavaApp:
- // Java application not supported currently
- break;
- case EFMRadioWebsite:
- {
- const TInt initialSize = 5;
- TInt realLength = KErrNotFound;
- iOperatorStoreWebsite.Create( initialSize );
- error = aRepository.Get( KOperatorMusicStoreURI, iOperatorStoreWebsite, realLength );
- if ( error == KErrOverflow )
- {
- iOperatorStoreWebsite.ReAllocL( realLength );
- error = aRepository.Get( KOperatorMusicStoreURI, iOperatorStoreWebsite );
- }
- User::LeaveIfError( error );
-#ifdef FORCE_OPERATOR_MUSIC_SHOP
- if ( !iOperatorStoreWebsite.Length() )
- {
- _LIT( KHardCodedName, "http://www.google.com/" );
- iOperatorStoreWebsite.ReAllocL( KHardCodedName().Length() );
- iOperatorStoreWebsite.Copy( KHardCodedName );
- }
-#endif
- break;
- }
- default:
- break;
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::InitializeMusicShop
-// ----------------------------------------------------
-//
-void CFMRadioMusicStoreHandler::InitializeMusicStore( TUid aMusicstoreUid )
- {
- //MusicShop CenRep initialization values
- _LIT_SECURITY_POLICY_C1(KMPlayerRemoteReadPolicy, ECapabilityReadUserData);
- _LIT_SECURITY_POLICY_C1(KMPlayerRemoteWritePolicy, ECapabilityWriteUserData);
- TInt retval(KErrNone);
- // P/S key for music shop
- retval = RProperty::Define( aMusicstoreUid,
- KMShopCategoryId,
- RProperty::EInt,
- KMPlayerRemoteReadPolicy,
- KMPlayerRemoteWritePolicy );
-
- if( retval != KErrAlreadyExists)
- {
- RProperty::Set( aMusicstoreUid,
- KMShopCategoryId,
- KFindInMShopKeyInValid ); // initialize Find In Musicshop was not called
-
- RProperty::Define( aMusicstoreUid,
- KMShopCategoryName,
- RProperty::ELargeText,
- KMPlayerRemoteReadPolicy,
- KMPlayerRemoteWritePolicy );
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::GetUint32Presentation
-// ----------------------------------------------------
-//
-TUint32 CFMRadioMusicStoreHandler::Uint32Presentation( const TDesC8& aBuf )
- {
- TUint32 result = 0;
-
- const TInt KProEngByteLength( 8 );
- const TInt length( aBuf.Length() );
- const TInt maxBitShift( KProEngByteLength * ( length - 1 ) );
-
- for ( TInt i( 0 ); i < length; ++i )
- {
- result |= ( aBuf[i] <<
- ( maxBitShift - ( KProEngByteLength * i ) ) );
- }
- return result;
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::IsMusicStoreCommandId
-// Goes through known command ids and compares to them
-// ----------------------------------------------------
-//
-TBool CFMRadioMusicStoreHandler::IsMusicStoreCommandId( TInt aCommandId )
- {
- TBool isHandled = EFalse;
- switch( aCommandId )
- {
- case EFMRadioMusicStore:
- case EFMRadioMusicStoreGoogle:
- case EFMRadioMusicStoreWikipedia:
- case EFMRadioMusicStoreAmg:
- case EFMRadioMusicStoreNokiaMusicShop:
- case EFMRadioMusicStoreMusicPortl:
- case EFMRadioMusicStoreOperator:
- isHandled = ETrue;
- break;
- default:
- break;
- }
- return isHandled;
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::MusicStoreCount
-// ----------------------------------------------------
-//
-TInt CFMRadioMusicStoreHandler::MusicStoreCount()
- {
- TInt count = 0;
- if ( NokiaMusicStoreAvailable() )
- {
- count++;
- }
- if ( OperatorMusicStoreAvailable() )
- {
- count++;
- }
- return count;
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::OperatorMusicStoreAvailable
-// ----------------------------------------------------
-//
-TBool CFMRadioMusicStoreHandler::OperatorMusicStoreAvailable()
- {
- return ( iOperatorMusicStoreName.Length() != 0 );
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::NokiaMusicStoreAvailable
-// ----------------------------------------------------
-//
-TBool CFMRadioMusicStoreHandler::NokiaMusicStoreAvailable()
- {
- TBool response = EFalse;
-
- if ( iMusicStoreUID != 0 && iMusicStoreAppInstalled )
- {
- response = ETrue;
- }
- return response;
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::InitializeMenuL
-// Takes care of dynamically initializing menu items related to Music shop.
-// Takes care of adding either menu item or cascaded menuitem
-// based on how many Music shops there is available. Fills the
-// cascaded menuitem automatically.
-// ----------------------------------------------------
-//
-TBool CFMRadioMusicStoreHandler::InitializeMenuL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- TBool resourceHandled = EFalse;
-
- if ( aResourceId == R_FMRADIO_OPTIONS_MUSIC_STORE_SUB_MENU )
- {
- if ( NokiaMusicStoreAvailable() )
- {
- aMenuPane->SetItemDimmed( EFMRadioMusicStoreNokiaMusicShop, EFalse );
- }
- else
- {
- aMenuPane->SetItemDimmed( EFMRadioMusicStoreNokiaMusicShop, ETrue );
- }
- if ( OperatorMusicStoreAvailable() )
- {
- aMenuPane->SetItemTextL( EFMRadioMusicStoreOperator, iOperatorMusicStoreName );
- aMenuPane->SetItemDimmed( EFMRadioMusicStoreOperator, EFalse );
- }
- else
- {
- aMenuPane->SetItemDimmed( EFMRadioMusicStoreOperator, ETrue );
- }
- resourceHandled = ETrue;
- }
- else if ( iResourceId == aResourceId )
- {
- const TInt firstIndex = 0;
- TInt firstCommand = aMenuPane->MenuItemCommandId( firstIndex );
- if ( MusicStoreCount() > 1 || OperatorMusicStoreAvailable() )
- {
- aMenuPane->AddMenuItemsL( R_FMRADIO_OPTIONS_MUSIC_STORE_WITH_SUB_MENU, firstCommand );
- }
- else
- {
- aMenuPane->AddMenuItemsL( R_FMRADIO_OPTIONS_MUSIC_STORE, firstCommand );
- }
-
- // Show or hide menu item based on Music store state
- if ( iState == EFMRadioMusicStoreDisabled || iState == EFMRadioMusicStoreUninitialized )
- {
- aMenuPane->SetItemDimmed( EFMRadioMusicStore, ETrue );
- }
- else if ( iState == EFMRadioMusicStoreEnabled && !MusicStoreCount() )
- {
- aMenuPane->SetItemDimmed( EFMRadioMusicStore, ETrue );
- }
- else
- {
- aMenuPane->SetItemDimmed( EFMRadioMusicStore, EFalse );
- }
- }
- else
- {
- //NOP
- }
- return resourceHandled;
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::EnableMusicStore
-// Shows or hides Music store related functionality
-// ----------------------------------------------------
-//
-void CFMRadioMusicStoreHandler::EnableMusicStore( TBool aEnable, TBool aForce )
- {
- if ( aForce && aEnable )
- {
- iState = EFMRadioMusicStoreForceEnabled;
- }
- else if ( aEnable )
- {
- iState = EFMRadioMusicStoreEnabled;
- }
- else
- {
- iState = EFMRadioMusicStoreDisabled;
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::LaunchMusicStoreL
-// Launches appropriate Music Store functionality based on parameters.
-// ----------------------------------------------------
-//
-void CFMRadioMusicStoreHandler::LaunchMusicStoreL(
- TInt aCommandId,
- const TDesC& aTitle,
- const TDesC& aArtist,
- const TDesC& aAlbum )
- {
- if ( aCommandId == EFMRadioMusicStore )
- {
- aCommandId = EFMRadioMusicStoreNokiaMusicShop;
- }
-
- HBufC* searchString = NULL;
-
- TBool isHandled = ETrue;
- switch( aCommandId )
- {
- case EFMRadioMusicStoreGoogle:
- case EFMRadioMusicStoreWikipedia:
- case EFMRadioMusicStoreAmg:
- case EFMRadioMusicStoreMusicPortl:
- isHandled = EFalse;
- break;
- case EFMRadioMusicStoreNokiaMusicShop:
- searchString = NokiaMusicShopSearchLC( aTitle, aArtist, aAlbum );
- break;
- case EFMRadioMusicStoreOperator:
- if ( iOperatorStoreWebsite.Length() != 0 )
- {
- searchString = iOperatorStoreWebsite.AllocLC();
-
- }
- else if ( iOperatorStoreNativeUID )
- {
- // It is assumed that both Nokia Music Shop and operator specific music store use
- // same kind of interface to communicate
- searchString = NokiaMusicShopSearchLC( aTitle, aArtist, aAlbum );
- }
- else
- {
- isHandled = EFalse;
- }
- break;
- default:
- FTRACE( FPrint( _L("CFMRadioMusicStoreHandler::LaunchMusicStoreL - Unknown id = %d"), aCommandId ) );
- isHandled = EFalse;
- break;
- }
-
- if ( isHandled )
- {
- switch( aCommandId )
- {
- case EFMRadioMusicStoreNokiaMusicShop:
- {
- TUid musicshopUid( TUid::Uid( iMusicStoreUID ) );
- LaunchMusicShopL( musicshopUid, *searchString );
- break;
- }
- case EFMRadioMusicStoreOperator:
- LaunchOperatorMusicStoreL( *searchString );
- break;
- default:
- LaunchWebPageL( *searchString );
- break;
- }
- CleanupStack::PopAndDestroy( searchString );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CFMRadioMusicStoreHandler::LaunchOperatorMusicStoreL
-// -----------------------------------------------------------------------------
-//
-void CFMRadioMusicStoreHandler::LaunchOperatorMusicStoreL( const TDesC& aSearchString )
- {
- if ( iOperatorStoreWebsite.Length() != 0 )
- {
- LaunchWebPageL( aSearchString );
- }
- else if ( iOperatorStoreNativeUID )
- {
- // It is assumed that both Nokia Music Shop and operator specific music store use
- // same kind of interface to communicate
- TUid musicshopUid( TUid::Uid( iOperatorStoreNativeUID ) );
- LaunchMusicShopL( musicshopUid, aSearchString );
- }
- else
- {
- //NOP
- }
- }
-
-// -----------------------------------------------------------------------------
-// CFMRadioMusicStoreHandler::NokiaMusicShopSearchL
-// -----------------------------------------------------------------------------
-//
-HBufC* CFMRadioMusicStoreHandler::NokiaMusicShopSearchLC(
- const TDesC& aSongName,
- const TDesC& aArtistName,
- const TDesC& aAlbumName )
- {
- CMPXFindInMShop* finder = CMPXFindInMShop::NewL(); //ECom Plugin
- CleanupStack::PushL( finder );
- HBufC* url = finder->CreateSearchURLL( aSongName,
- aArtistName,
- aAlbumName,
- KNullDesC, // Composer - Not used
- KNullDesC ); // Genre - Not used
-
- CleanupStack::PopAndDestroy( finder ); // finder
- REComSession::FinalClose();
- CleanupStack::PushL( url );
- return url;
- }
-
-// -----------------------------------------------------------------------------
-// CFMRadioMusicStoreHandler::LaunchMusicShopL
-// Launch Nokia music shop application
-// -----------------------------------------------------------------------------
-//
-void CFMRadioMusicStoreHandler::LaunchMusicShopL( TUid aMusicshopUid, const TDesC& aSearchString )
- {
- RProperty::Set( aMusicshopUid,
- KMShopCategoryName,
- aSearchString );
-
- RProperty::Set( aMusicshopUid,
- KMShopCategoryId,
- KFindInMShopKeyValid ); // Set Key to Valid
-
- TApaTaskList taskList( iCoeEnv->WsSession() );
- TApaTask task = taskList.FindApp( aMusicshopUid );
-
- if ( task.Exists() )
- {
- task.BringToForeground();
- }
- else
- {
- RApaLsSession session;
- User::LeaveIfError( session.Connect() );
- TThreadId threadId;
- session.CreateDocument( KNullDesC, aMusicshopUid, threadId );
- session.Close();
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::LaunchWebPageL
-// Opens web site based on the string
-// ----------------------------------------------------
-//
-void CFMRadioMusicStoreHandler::LaunchWebPageL( const TDesC& aWebpage )
- {
- _LIT( KCommand, "4 ");
- RBuf param;
- param.CreateL( KCommand().Length() + aWebpage.Length() );
- param.CleanupClosePushL();
- param.Copy( KCommand() ); //Web Browser requires this in order to fetch url.
- param.Append( aWebpage );
-
- const TInt KWebBrowserUid = 0x10008D39;
- TUid browserId( TUid::Uid( KWebBrowserUid ) );
- TApaTaskList taskList( iCoeEnv->WsSession() );
- TApaTask task = taskList.FindApp( browserId );
- if ( task.Exists() )
- {
- HBufC8* param8 = HBufC8::NewLC( param.Length() );
- param8->Des().Append( param );
- task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used
- CleanupStack::PopAndDestroy( param8 );
- }
- else
- {
- RApaLsSession session;
- User::LeaveIfError( session.Connect() );
- TThreadId threadId;
- session.StartDocument( param, browserId, threadId );
- session.Close();
- }
- CleanupStack::PopAndDestroy( ¶m );
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::IsMusicStoreLaunchable
-// ----------------------------------------------------
-//
-TBool CFMRadioMusicStoreHandler::IsMusicStoreEnabled()
- {
- TBool musicStoreLaunchable = EFalse;
-
- if ( iState != CFMRadioMusicStoreHandler::EFMRadioMusicStoreDisabled &&
- iState != CFMRadioMusicStoreHandler::EFMRadioMusicStoreUninitialized )
- {
- musicStoreLaunchable = ETrue;
- }
- return musicStoreLaunchable;
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::OperatorMusicStoreName
-// ----------------------------------------------------
-//
-const TDesC& CFMRadioMusicStoreHandler::OperatorMusicStoreName() const
- {
- return iOperatorMusicStoreName;
- }
-
-// ----------------------------------------------------
-// CFMRadioMusicStoreHandler::IsAppInstalled
-// ----------------------------------------------------
-//
-TBool CFMRadioMusicStoreHandler::IsAppInstalledL( const TUid& aAppUid )
- {
- TBool response = EFalse;
-
- RApaLsSession apaSession;
- CleanupClosePushL( apaSession );
- User::LeaveIfError( apaSession.Connect() );
- apaSession.GetAllApps();
-
- TApaAppInfo appInfo;
- TInt err = apaSession.GetAppInfo( appInfo, aAppUid );
- CleanupStack::PopAndDestroy( &apaSession );
-
- if ( !err )
- {
- // app was found
- response = ETrue;
- }
- return response;
- }
--- a/fmradio/fmradio/src/fmradiopreset.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: fmradio preset station information
-*
-*/
-
-#include "fmradiopreset.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ----------------------------------------------------------------------------
-// CFMRadioPreset::CFMRadioPreset
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioPreset::CFMRadioPreset() : iNameIsValid( ETrue )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPreset::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPreset::ConstructL()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioPreset::NewL
-// Two-phase constructor of CFMRadioPreset
-// ---------------------------------------------------------------------------
-//
-CFMRadioPreset* CFMRadioPreset::NewL()
- {
- CFMRadioPreset* self = new ( ELeave ) CFMRadioPreset;
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioPreset::~CFMRadioPreset
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioPreset::~CFMRadioPreset()
- {
- iStationName.Close();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPreset::SetPresetNameL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPreset::SetPresetNameL( const TDesC& aName )
- {
- iStationName.Close();
- iStationName.CreateL( aName );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPreset::PresetName
-// ---------------------------------------------------------------------------
-//
-TDesC& CFMRadioPreset::PresetName()
- {
- return iStationName;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPreset::SetPresetNameValid
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPreset::SetPresetNameValid( TBool aValid )
- {
- iNameIsValid = aValid;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPreset::PresetNameValid
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioPreset::PresetNameValid()
- {
- return iNameIsValid;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPreset::SetPresetFrequency
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPreset::SetPresetFrequency( TInt aFrequency )
- {
- iStationFrequency = aFrequency;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPreset::PresetFrequency
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioPreset::PresetFrequency()
- {
- return iStationFrequency;
- }
--- a/fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,606 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioScanLocalStationsContainer
-*
-*/
-
-
-// INCLUDE FILES
-#include <e32math.h>
-#include <AknsSkinInstance.h>
-#include <AknsUtils.h>
-#include <AknsDrawUtils.h>
-#include <AknsBasicBackgroundControlContext.h>
-#include <akntoolbar.h>
-#include <gulutil.h>
-#include <w32std.h>
-#include <fmradio.rsg>
-#include <StringLoader.h>
-#include <eiklabel.h>
-#include <AknWaitDialog.h>
-#include <eikclbd.h>
-#include <AknIconArray.h>
-#include <gulicon.h>
-#include <fmradiouids.h>
-
-#if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE
-#include "radio.hlp.hrh"
-#endif
-#include "fmradioapp.h"
-#include "fmradioappui.h"
-#include "fmradioscanlocalstationscontainer.h"
-#include "fmradioscanlocalstationsview.h"
-
-// CONSTANTS
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ----------------------------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::CFMRadioScanLocalStationsContainer
-// Default constructor
-// ----------------------------------------------------------------------------
-//
-CFMRadioScanLocalStationsContainer::CFMRadioScanLocalStationsContainer( CRadioEngine& aRadioEngine ):
- iRadioEngine( aRadioEngine )
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::NewL
-// Two-phase constructor of CFMRadioScanLocalStationsContainer
-// ---------------------------------------------------------
-//
-CFMRadioScanLocalStationsContainer* CFMRadioScanLocalStationsContainer::NewL( const TRect& aRect, CRadioEngine& aRadioEngine )
- {
- CFMRadioScanLocalStationsContainer* self = new (ELeave) CFMRadioScanLocalStationsContainer( aRadioEngine );
- CleanupStack::PushL( self );
- self->ConstructL( aRect );
- CleanupStack::Pop( self );
- return self;
- }
-
-//
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::ConstructL
-// EPOC two phased constructor
-// ----------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::ConstructL( const TRect& aRect )
- {
- // check the layout orientation
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- TBool isLandscape = appUi->IsLandscapeOrientation();
- CreateWindowL();
-
- // Create the new context with image: KAknsIIDQsnBgAreaMain, and parent absolute layout is not used.
- iBackground = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain, Rect(), EFalse );
- iSkin = AknsUtils::SkinInstance();
-
- // Instantiate a listbox for the channel list
- iChannelList = new ( ELeave ) CAknSingleNumberStyleListBox();
- iControls.Append( iChannelList );
- iChannelList->SetContainerWindowL( *this );
- iChannelList->SetListBoxObserver( this );
- iChannelList->ConstructL( this, CEikListBox::ELoopScrolling | EAknListBoxSelectionList ); // Looped list
- // Create scrollbars
- iChannelList->CreateScrollBarFrameL( ETrue );
-
- CAknIconArray* radioTypeIcons = NULL;
- radioTypeIcons = new ( ELeave ) CAknIconArray( 2 );
- CleanupStack::PushL( radioTypeIcons );
- radioTypeIcons->AppendFromResourceL( R_FMRADIO_CHANNEL_LIST_ICON_ARRAY );
- // The following line really takes the ownership -- must be the last item
- // there, as if leaves and the object is in cleanupstack, problems arise.
- // (Cleanup stack corruption!)
- // Set the icon array for this list. List takes ownership of the array.
- iChannelList->ItemDrawer()->ColumnData()->SetIconArray( radioTypeIcons );
- CleanupStack::Pop( radioTypeIcons );
-
- // Array for channels
- iChannelItemArray = new( ELeave ) CDesCArrayFlat( KMaxNumberOfChannelListItems );
- InitializeChannelListL();
- SetRect( aRect );
-
- CFMRadioScanLocalStationsView* searchStationsView = static_cast<CFMRadioScanLocalStationsView*> ( appUi->View( KFMRadioScanLocalStationsViewId ) );
-
- ActivateL();
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::~CFMRadioScanLocalStationsContainer
-// Class destructor
-// ----------------------------------------------------
-//
-CFMRadioScanLocalStationsContainer::~CFMRadioScanLocalStationsContainer()
- {
- iControls.ResetAndDestroy();
- delete iChannelItemArray;
- if ( iBackground )
- {
- delete iBackground;
- iBackground = NULL;
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::InitializeChannelListL
-// Create the channel list (initially all spots are set as empty)
-// ----------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::InitializeChannelListL()
- {
- iChannelList->Reset();
- iChannelItemArray->Reset();
- iChannelList->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
- // Pass the array to the listbox model and set the ownership type
- iChannelList->Model()->SetItemTextArray( (MDesCArray*) iChannelItemArray );
- iChannelList->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- iChannelList->HandleItemAdditionL();
- DrawDeferred();
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::UpdateChannelListContentL
-// Update the content of the channel at aIndex with the
-// values specified
-// ----------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::UpdateChannelListContentL( TInt aIndex, const TDesC& aInfoText, TInt aChannelFrequency, TBool aNowPlaying, TBool aInfoTextPlacement )
- {
- TBuf<KLengthOfChannelItemString> textChannelItem;
- TBuf<KLengthOfChIndexStringChList> textChIndex;
- TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
-
- //textChIndex.Format( KChIndexFormatChList, aIndex+1 ); // One over index
- textChIndex.SetLength( 0 );
-
- textChIconIndex.Format( KChIconIndexFormatChList, KNowPlayingIconIndexChList ) ;
- //Update to display Devnagari numbers for Text Index.
- //AknTextUtils::LanguageSpecificNumberConversion(textChIndex);
- textChannelItem.Append( textChIndex );
- textChannelItem.Append( KColumnListSeparator );
-
- TReal frequency = static_cast<TReal>( aChannelFrequency / static_cast<TReal>( KHzConversionFactor ));
- // Gets locale decimal separator automatically
- TRealFormat format(KFrequencyMaxLength, iRadioEngine.DecimalCount() );
- TBuf<30> frequencyString;
- frequencyString.Num( frequency, format );
-
- HBufC* listItemString = NULL;
- if ( aInfoTextPlacement ) // frequency and PS name
- {
- const TInt granularity = 2;
-
- CDesCArray* stringsArray = new ( ELeave ) CDesCArrayFlat( granularity );
- CleanupStack::PushL( stringsArray );
- stringsArray->AppendL( frequencyString );
- stringsArray->AppendL( aInfoText );
-
- listItemString = StringLoader::LoadL( R_QTN_FMRADIO_SINGLE_FREQ_NAME, *stringsArray, iEikonEnv );
- CleanupStack::PopAndDestroy( stringsArray );
- CleanupStack::PushL( listItemString );
- }
- else // frequency
- {
- listItemString = StringLoader::LoadLC( R_QTN_FMRADIO_SINGLE_FREQ, frequencyString, iEikonEnv );
- }
-
- // Update for display of Hindi Devnagari Numbers
- TPtr listItemStringPtr = listItemString->Des();
- AknTextUtils::LanguageSpecificNumberConversion( listItemStringPtr );
-
- textChannelItem.Append( *listItemString );
- CleanupStack::PopAndDestroy( listItemString );
-
- // Set 'Now Playing' icon to the channel item
- textChannelItem.Append( KColumnListSeparator );
-
- if ( aNowPlaying )
- {
- textChannelItem.Append( textChIconIndex );
- }
-
- if( aIndex <= ( iChannelItemArray->Count() - 1 ) )
- {
- iChannelItemArray->Delete( aIndex );
- iChannelList->HandleItemRemovalL();
- iChannelItemArray->InsertL( aIndex, textChannelItem );
- }
- else
- {
- iChannelItemArray->AppendL( textChannelItem );
- }
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelList->UpdateScrollBarsL();
- iChannelList->DrawDeferred();
- }
-
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::InsertScannedChannelToListL
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::InsertScannedChannelToListL( TInt aIndex, TInt aChannelFrequency )
- {
- TBuf<KLengthOfChannelItemString> textChannelItem;
- TBuf<KLengthOfChIndexStringChList> textChIndex;
-
- textChannelItem.Append( textChIndex );
- textChannelItem.Append( KColumnListSeparator );
-
- TReal frequency = static_cast<TReal>( aChannelFrequency / static_cast<TReal>( KHzConversionFactor ));
- // Gets locale decimal separator automatically
- TRealFormat format(KFrequencyMaxLength, iRadioEngine.DecimalCount() );
- TBuf<30> frequencyString;
- frequencyString.Num( frequency, format );
-
- HBufC* listItemString = listItemString = StringLoader::LoadLC( R_QTN_FMRADIO_SINGLE_FREQ, frequencyString, iEikonEnv );
- // Update for display of Hindi Devnagari Numbers
- TPtr listItemStringPtr = listItemString->Des();
- AknTextUtils::LanguageSpecificNumberConversion( listItemStringPtr );
- textChannelItem.Append( *listItemString );
- CleanupStack::PopAndDestroy( listItemString );
-
- // Set 'Now Playing' icon to the channel item
- textChannelItem.Append( KColumnListSeparator );
-
- if ( aIndex <= ( iChannelItemArray->Count() - 1 ) )
- {
- iChannelItemArray->InsertL( aIndex, textChannelItem );
- }
- else
- {
- iChannelItemArray->AppendL( textChannelItem );
- }
-
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelList->UpdateScrollBarsL();
- iChannelList->DrawDeferred();
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::RemoveChannelListContentL
-//
-// ----------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::RemoveChannelListContentL( TInt aIndex )
- {
- if ( aIndex < iChannelItemArray->Count() )
- {
- iChannelItemArray->Delete( aIndex );
- iChannelList->HandleItemRemovalL();
- iChannelList->UpdateScrollBarsL();
-
- TInt channelCount = iChannelItemArray->Count();
- // check if the last channel is saved and update current item
- if ( aIndex == channelCount && channelCount > 0 )
- {
- iChannelList->SetCurrentItemIndex( channelCount - 1 );
- }
- iChannelList->DrawDeferred();
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::UpdateNowPlayingIconL
-// Displays 'Now Playing' icon in the current selected channel item.
-// ----------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::UpdateNowPlayingIconL( TInt aNewIndex, TInt aOldIndex )
- {
- HideNowPlayingIconL( aOldIndex, EFalse );
-
- if ( aNewIndex >= 0 && aNewIndex < iChannelItemArray->Count() )
- {
- TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
- textChIconIndex.Format( KChIconIndexFormatChList, KNowPlayingIconIndexChList );
- HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString );
- channelItem->Des().Copy( iChannelItemArray->MdcaPoint( aNewIndex ) );
- TPtr ptr( channelItem->Des() );
- ptr.Append( textChIconIndex ); // Add icon index
-
- iChannelItemArray->InsertL( aNewIndex, *channelItem );
- CleanupStack::PopAndDestroy( channelItem );
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelItemArray->Delete( aNewIndex + 1 );
- iChannelList->HandleItemRemovalL();
- iChannelList->UpdateScrollBarsL();
- }
- // required for fast channel browsing
- iChannelList->DrawNow();
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::HideNowPlayingIconL
-// Hides 'Now Playing' icon from the last selected channel.
-// ----------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::HideNowPlayingIconL( TInt aIndex, TBool aDraw )
- {
- if ( aIndex >= 0 && aIndex < iChannelItemArray->Count() )
- {
- HBufC* channelItem = HBufC::NewLC( KLengthOfChannelItemString );
- channelItem->Des().Copy( iChannelItemArray->MdcaPoint( aIndex ) );
- TPtr ptr( channelItem->Des() );
-
- TBuf<KLengthOfChannelItemIconIndexString> textChIconIndex;
- TPtrC iconIndexPtr( textChIconIndex );
- TInt err = TextUtils::ColumnText( iconIndexPtr, 2, &ptr );
-
- if ( iconIndexPtr.Length() > 0 )
- {
- ptr.Delete( ptr.Length() - iconIndexPtr.Length(), iconIndexPtr.Length() ); // Remove icon index
- iChannelItemArray->InsertL( aIndex, *channelItem );
- iChannelList->HandleItemAdditionL(); // Update list
- iChannelItemArray->Delete( aIndex + 1 );
- iChannelList->HandleItemRemovalL();
- iChannelList->UpdateScrollBarsL();
-
- }
- CleanupStack::PopAndDestroy( channelItem );
- if ( aDraw )
- {
- iChannelList->DrawDeferred();
- }
- }
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::SetFaded
-// Fades the entire window and controls in the window owned
-// by this container control.
-// ----------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::SetFaded( TBool aFaded )
- {
- iFadeStatus = aFaded;
- Window().SetFaded( aFaded, RWindowTreeNode::EFadeIncludeChildren );
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::UpdateLastListenedChannel
-// Updates channel index - the highlighted channel in the list.
-// ----------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::UpdateLastListenedChannel( TInt aIndex )
- {
- if ( aIndex < iChannelItemArray->Count() &&
- aIndex > -1 )
- {
- iLastChIndex = aIndex;
-
- iChannelList->SetCurrentItemIndex( iLastChIndex );
- iChannelList->ScrollToMakeItemVisible( iLastChIndex );
- DrawDeferred();
- }
-
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::CurrentlySelectedChannel
-// Returns the index of the selected channel item from the
-// channel list.
-// ----------------------------------------------------
-//
-TInt CFMRadioScanLocalStationsContainer::CurrentlySelectedChannel() const
- {
- return iChannelList->CurrentItemIndex(); // Index of selected channel
- }
-
-// ----------------------------------------------------
-// CFMRadioScanLocalStationsContainer::HandleListBoxEventL
-// For handling listbox-, in this case, channel list events.
-// The event equals to selecting a channel item from the list.
-// ----------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/,
- TListBoxEvent aEventType )
- {
- // Check the event generated by keypress and report the event,
- // Also check for Pen Enabled touch screen event
- switch ( aEventType )
- {
- case EEventEnterKeyPressed:
- case EEventItemSingleClicked: // new event for item activation
- {
- ReportEventL( MCoeControlObserver::EEventStateChanged );
- break;
- }
- default:
- {
- break;
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::HandleResourceChange
-// -----------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::HandleResourceChange( TInt aType )
- {
- CCoeControl::HandleResourceChange( aType );
- if ( aType == KEikDynamicLayoutVariantSwitch )
- {
- SizeChanged();
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::SizeChanged
-// Called by framework when the view size is changed
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::SizeChanged()
- {
- iChannelList->SetRect( Rect() );
-
- if ( iBackground )
- {
- iBackground->SetRect( Rect() );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::CountComponentControls
-// Return the number of controls in the window owned by this container
-// ---------------------------------------------------------
-//
-TInt CFMRadioScanLocalStationsContainer::CountComponentControls() const
- {
- return iControls.Count();
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::ComponentControl
-// Return the control corresponding to the specified index
-// ---------------------------------------------------------
-//
-CCoeControl* CFMRadioScanLocalStationsContainer::ComponentControl( TInt aIndex ) const
- {
- return STATIC_CAST( CCoeControl*, iControls[aIndex] );
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::OfferKeyEventL
-// Allow the channel list to process key events
-// ---------------------------------------------------------
-//
-TKeyResponse CFMRadioScanLocalStationsContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
- TEventCode aType )
- {
- TKeyResponse response = EKeyWasNotConsumed;
-
- switch ( aKeyEvent.iCode )
- {
- case EKeyLeftArrow:
- case EKeyRightArrow:
- return EKeyWasNotConsumed;
-
- case EKeyUpArrow:
- case EKeyDownArrow:
- response = iChannelList->OfferKeyEventL( aKeyEvent, aType );
- if (response == EKeyWasConsumed)
- {
- ReportEventL( MCoeControlObserver::EEventRequestFocus );
- }
- return response;
-
-
- default:
- switch ( aKeyEvent.iScanCode ) //we need to use the scan code, because we need to process the event wrt the keyUp and keyDown action
- {
- case EKeyboardKey1: // Timed key
- case EKeyboardKey2: // Normal keys
- case EKeyboardKey3:
- case EKeyboardKey4:
- case EKeyboardKey5:
- case EKeyboardKey6:
- case EKeyboardKey7:
- case EKeyboardKey8:
- case EKeyboardKey9:
- case EKeyboardKey0:
- return EKeyWasNotConsumed;
- default:
- break;
- }
- break;
- }
- return iChannelList->OfferKeyEventL( aKeyEvent, aType );
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::Draw
-// Redraw the window owned by this container
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::Draw( const TRect& aRect ) const
- {
- CWindowGc& gc = SystemGc();
- gc.Clear();
-
- if ( iBackground )
- {
- if ( !AknsDrawUtils::Background( iSkin, iBackground, this, gc, aRect) )
- {
- // The background was not drawn
- iBackground->UpdateContext();
- }
- }
- // Fade if needed
- Window().SetFaded( iFadeStatus, RWindowTreeNode::EFadeIncludeChildren );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::GetHelpContext
-// Gets Help
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::GetHelpContext( TCoeHelpContext& aContext ) const
- {
-#if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE
- aContext.iMajor = TUid::Uid( KUidFMRadioApplication );
- aContext.iContext = KFMRADIO_HLP_SEARCH;
-#endif
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::FocusChanged(TDrawNow aDrawNow)
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::FocusChanged( TDrawNow aDrawNow )
- {
- CCoeControl::FocusChanged( aDrawNow );
- if ( iChannelList )
- {
- iChannelList->SetFocus( IsFocused(), aDrawNow );
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::ResetChannelListL
-// Sets toolbar visibility
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::ResetChannelListL()
- {
- iChannelItemArray->Reset();
- iChannelList->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
- iChannelList->HandleItemRemovalL();
- iChannelList->DrawDeferred();
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::SetStationListEmptyTextL
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::SetStationListEmptyTextL( const TDesC& aText )
- {
- iChannelList->View()->SetListEmptyTextL( aText );
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::HandlePointerEventL
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
- {
- // don't handle any pointer events if view is faded
- if ( !iFadeStatus )
- {
- CCoeControl::HandlePointerEventL( aPointerEvent );
- }
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradioscanlocalstationsview.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1709 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the class CFMRadioScanLocalStationsView
-*
-*/
-
-
-// INCLUDE FILES
-#include <AknWaitDialog.h>
-#include <featmgr.h>
-#include <aknViewAppUi.h>
-#include <aknnotedialog.h>
-#include <akntitle.h>
-#include <aknnotewrappers.h> // for basic note
-#include <aknbutton.h>
-#include <avkon.hrh>
-#include <avkon.rsg>
-#include <StringLoader.h>
-#include <eikmenup.h>
-#include <eikbtgpc.h>
-#include <fmradio.rsg>
-#include <fmradio.mbg>
-#include <fmradiouids.h>
-#include <data_caging_path_literals.hrh>
-#include <akntoolbar.h>
-
-#include "fmradiobacksteppingservicewrapper.h"
-#include "fmradioengine.h"
-#include "fmradiordsreceiverbase.h"
-#include "fmradio.hrh"
-#include "fmradioscanlocalstationsview.h"
-#include "fmradiopreset.h"
-#include "fmradioscanlocalstationscontainer.h"
-#include "debug.h"
-#include "fmradioappui.h"
-
-
-const TInt KMSKControlID(3);
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::NewL
-// Two-phase constructor of CFMRadioScanLocalStationsView
-// ---------------------------------------------------------------------------
-//
-CFMRadioScanLocalStationsView* CFMRadioScanLocalStationsView::NewL( CRadioEngine& aRadioEngine,
- MChannelListHandler& aObserver )
- {
- CFMRadioScanLocalStationsView* self = new (ELeave) CFMRadioScanLocalStationsView( aRadioEngine,
- aObserver );
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::CFMRadioScanLocalStationsView
-// Parameter constructor ( default constructor )
-// ---------------------------------------------------------------------------
-//
-CFMRadioScanLocalStationsView::CFMRadioScanLocalStationsView( CRadioEngine& aRadioEngine,
- MChannelListHandler& aObserver ):
- iNowPlayingIndex( KErrNotFound ),
- iScanAndSaveActivated( EFalse ),
- iScanCancelled( EFalse ),
- iRadioEngine( aRadioEngine ),
- iTuneRequested( EFalse ),
- iObserver( aObserver ),
- iCancelType( EFMRadioCancelScanDefault )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::ConstructL
-// EPOC two-phased constructor
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::ConstructL()
- {
- BaseConstructL( R_FMRADIO_SEARCH_STATIONS_VIEW );
- PrepareToolbar();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::~CFMRadioScanLocalStationsView
-// Class destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioScanLocalStationsView::~CFMRadioScanLocalStationsView()
- {
- if ( iContainer )
- {
- AppUi()->RemoveFromViewStack( *this, iContainer );
- delete iContainer;
- iContainer = NULL;
- }
-
- if ( iScanningNote )
- {
- TRAP_IGNORE( iScanningNote->ProcessFinishedL() );
- iScanningNote = NULL;
- }
- iScannedChannels.ResetAndDestroy();
- iScannedChannels.Close();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::Id
-// Return the unique identifier corresponding to this view
-// ---------------------------------------------------------------------------
-//
-TUid CFMRadioScanLocalStationsView::Id() const
- {
- return KFMRadioScanLocalStationsViewId;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::DoActivateL
-// Activate the channel list view
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
- TUid /*aCustomMessageId*/,
- const TDesC8& /*aCustomMessage*/ )
- {
- FTRACE( FPrint( _L("CFMRadioScanLocalStationsView::DoActivateL Start") ) );
- Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
- Cba()->DrawDeferred(); // Redraw softkeys
-
-
- HBufC* title = StringLoader::LoadLC( R_FMRADIO_SEARCH_STATIONS_VIEW_TITLE, iCoeEnv );
- static_cast<CAknTitlePane*>( StatusPane()->ControlL(
- TUid::Uid( EEikStatusPaneUidTitle ) ) )->SetTextL( *title );
- CleanupStack::PopAndDestroy( title );
-
- if ( !iContainer )
- {
- FTRACE( FPrint( _L("CFMRadioScanLocalStationsView::DoActivateL inside second, not iContainer if") ) );
- iContainer = CFMRadioScanLocalStationsContainer::NewL( ClientRect(), iRadioEngine );
- iContainer->SetMopParent( this );
- iContainer->SetObserver( this );
- AppUi()->AddToStackL( *this, iContainer );
- }
- AppUi()->HandleCommandL( EFMRadioCmdScanLocalStationsViewActive );
-
- ResetListAndStartScanL();
- iRadioEngine.RdsReceiver().AddObserver( this );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::HandleCommandL
-// Interprets view's menu,softkey and other commands and acts
-// accordingly by calling the appropriate command handler
-// function for further action.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::HandleCommandL( TInt aCommand )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
- switch ( aCommand )
- {
- case EAknSoftkeyBack: // go back to the main view
- {
- const TVwsViewId viewId( TUid::Uid( KUidFMRadioApplication ), Id() );
- if ( appUi->BackSteppingWrapper().HandleBackCommandL( viewId ) )
- {
- // Command was consumed
- break;
- }
- // Fall through to activate previous view
- }
- case EEikBidCancel:
- {
- if ( iFaded )
- {
- appUi->HandleCommandL( aCommand );
- }
- else
- {
- appUi->ActivateLocalViewL( KFMRadioChannelListViewId );
- }
- break;
- }
- case EFMRadioCmdSaveChannel:
- {
- HandleOneChannelSaveL();
- break;
- }
- case EFMRadioCmdSaveAllChannels:
- SaveAllChannelsL();
- break;
- case EFMRadioCmdScanLocalStationsScan: // start station scanning
- {
- Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
- Cba()->DrawDeferred(); // Redraw softkeys
- //reset all counters, make station list empty
- ResetListAndStartScanL();
- break;
- }
-
- case EFMRadioCmdListenCh:
- {
- PlayCurrentlySelectedChannelL();
- SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR_SAVE );
- break;
- }
- default: // Send all other commands to AppUi
- appUi->HandleCommandL( aCommand );
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::SetLastListenedChannel
-// Keep track of the last selected channel
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::SetLastListenedChannel( TInt aIndex )
- {
- iChIndex = aIndex;
- if ( iContainer )
- {
- iContainer->UpdateLastListenedChannel( aIndex ); // Update index
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::SetNowPlayingChannelL
-// Keep track of the current selected channel
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::SetNowPlayingChannelL( TInt aChannelIndex )
- {
- TInt oldIndex = iNowPlayingIndex;
- iNowPlayingIndex = aChannelIndex;
-
- if ( iContainer && ( aChannelIndex != oldIndex ) )
- {
- if ( ChannelInUse( oldIndex ) &&
- !iScannedChannels[ oldIndex ]->PresetNameValid() )
- {
- // Remove dynamic ps name
- iContainer->UpdateChannelListContentL( oldIndex,
- KNullDesC,
- iScannedChannels[ oldIndex ]->PresetFrequency(),
- EFalse,
- EFalse );
- }
- iContainer->UpdateNowPlayingIconL( iNowPlayingIndex, oldIndex );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::CurrentlyPlayingChannel
-// Returns the index of the playing channel item from the channel list.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioScanLocalStationsView::CurrentlyPlayingChannel()
- {
- return iNowPlayingIndex;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::ChannelInPlay
-// Return true/false to indicate whether the channel specified
-// is in play
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioScanLocalStationsView::ChannelInPlay( TInt aChannelIndex ) const
- {
- if( aChannelIndex == iNowPlayingIndex )
- {
- return ETrue;
- }
- else
- {
- return EFalse;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::ChannelInUse
-// Return true/false to indicate whether the channel specified
-// is in use
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioScanLocalStationsView::ChannelInUse( const TInt aChannelIndex ) const
- {
- TBool ret = EFalse;
- FTRACE( FPrint( _L("CFMRadioScanLocalStationsView::ChannelInUse Start") ) );
-
- if ( aChannelIndex >= KMinNumberOfChannelListItems &&
- aChannelIndex < iScannedChannels.Count() )
- {
- ret = ETrue;
- }
- return ret;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::FadeAndShowExit
-// Fade the view and all controls associated with it. Change
-// the soft keys so that "Exit" is displayed
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::FadeAndShowExit( TBool aFaded )
- {
- TInt err = KErrNone;
- iFaded = aFaded;
- if( iContainer )
- {
- if ( aFaded ) // Fade
- {
- // In case options menu is open when headset is disconnected
- StopDisplayingMenuBar();
- SetToolbarDimmedState( ETrue );
- iContainer->SetFaded( aFaded );
- TRAP( err,Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EXIT ) );
- }
- else
- {
- SetToolbarDimmedState( EFalse );
- iContainer->SetFaded(aFaded);
- TRAP( err,Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ) );
- // Update index to be sure it is up-to-date (in case if list was scrolled in idle state)
- iContainer->UpdateLastListenedChannel( iChIndex );
-
- if( iScannedChannels.Count() > 0 )
- {
- TRAP_IGNORE( SetMiddleSoftKeyIconL(); )
-
- if ( ( CurrentlyPlayingChannel() == CurrentlySelectedChannel() ) )
- {
- SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR_SAVE );
- }
- else
- {
- SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR );
- }
- }
- }
- Cba()->DrawDeferred();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::UpdateDisplayForFocusGained
-// Update the view after a focus gained event.
-// 1. Fade/Unfade view
-// 2. Update MSK label
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::UpdateDisplayForFocusGained()
- {
- FadeAndShowExit( iFaded );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::UpdateChannelListContentL
-// Make a request to the channel container to update the
-// content of the channel at aIndex with the values specified
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::UpdateChannelListContentL( TInt aIndex,
- TInt aChannelFrequency )
- {
- TBool nowPlaying = EFalse;
- if( ChannelInPlay( aIndex ) )
- {
- nowPlaying = ETrue;
- }
- else
- {
- nowPlaying = EFalse;
- }
- if ( iContainer )
- {
- iContainer->UpdateChannelListContentL( aIndex, KNullDesC, aChannelFrequency, nowPlaying );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::CurrentlySelectedChannel
-// Returns the index of the selected channel item from the
-// channel list. If the container is active get the info from
-// it, because it may have more up-to-date info.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioScanLocalStationsView::CurrentlySelectedChannel()
- {
- if ( iContainer )
- {
- iChIndex = iContainer->CurrentlySelectedChannel();
- }
- return iChIndex;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::NextChannel
-// Retrieve the index of the next channel that has been set.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioScanLocalStationsView::NextChannel()
- {
- if ( iContainer )
- {
- iChIndex = iContainer->CurrentlySelectedChannel();
- }
- else
- {
- iChIndex = iRadioEngine.GetPresetIndex();
- }
-
- TInt nextChannel = iChIndex;
- for ( TInt i = iChIndex + 1; i < KMaxNumberOfChannelListItems; i++ )
- {
- if ( ChannelInUse( i ) )
- {
- nextChannel = i;
- break;
- }
- }
- if ( nextChannel == iChIndex )
- {
- for ( TInt i = 0; i < iChIndex; i++ )
- {
- if ( ChannelInUse( i ) )
- {
- nextChannel = i;
- break;
- }
- }
- }
- return nextChannel;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::PreviousChannel
-// Retrieve the index of the previous channel that has been set.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioScanLocalStationsView::PreviousChannel()
- {
- if ( iContainer )
- {
- iChIndex = iContainer->CurrentlySelectedChannel();
- }
- else
- {
- iChIndex = iRadioEngine.GetPresetIndex();
- }
-
- TInt previousChannel = iChIndex;
-
- for ( TInt i = iChIndex - 1; i >= 0; i-- )
- {
- if ( ChannelInUse( i ) )
- {
- previousChannel = i;
- break;
- }
- }
- if ( previousChannel == iChIndex )
- {
- for ( TInt i = KMaxNumberOfChannelListItems - 1; i > iChIndex; i-- )
- {
- if ( ChannelInUse( i ) )
- {
- previousChannel = i;
- break;
- }
- }
- }
- return previousChannel;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::HandleControlEventL
-// Handles control event observing. In this case the interest
-// is only on the channel selection from the channel list.
-// Other events are not reported by the container,
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::HandleControlEventL( CCoeControl* aControl,
- TCoeEvent aEventType )
- {
- if ( aControl == iContainer )
- {
- if ( aEventType == MCoeControlObserver::EEventRequestFocus )
- {
- // Don't display MSK when display is faded.
- if ( !iFaded && !AknLayoutUtils::PenEnabled() )
- {
- // event sent if up or down arrow keys are pressed
- if ( ( CurrentlyPlayingChannel() == CurrentlySelectedChannel() ) )
- {
- SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR_SAVE );
- }
- else
- {
- SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR );
- }
- }
- else if ( ChannelInUse( CurrentlySelectedChannel() ) )
- {
- PlayCurrentlySelectedChannelL();
- }
- }
- else if ( aEventType == MCoeControlObserver::EEventStateChanged
- && ChannelInUse( CurrentlySelectedChannel() ) )
- {
- PlayCurrentlySelectedChannelL();
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::DoDeactivate
-// Deactivate the channel list view
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::DoDeactivate()
- {
- FTRACE( FPrint( _L("CFMRadioScanLocalStationsView::DoDeactivate") ) );
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
-
- if ( iToolbar )
- {
- // hide toolbar so it is not visible when activating view again
- iToolbar->SetToolbarVisibility( EFalse );
- }
-
- if ( appUi->RadioEngine() )
- {
- iRadioEngine.RdsReceiver().RemoveObserver( this );
- }
- if ( iContainer )
- {
- appUi->RemoveFromViewStack( *this, iContainer );
- }
-
- iScanAndSaveActivated = EFalse;
-
- // If exiting, iRadioEngine is no longer valid object
- if( appUi->RadioEngine() )
- {
- appUi->RadioEngine()->CancelScanLocalStationsScan();
- // Stop seek doesn't get called automatically as this is not active view anymore
- TRAP_IGNORE( StopSeekL() )
- }
-
- delete iContainer;
- iContainer = NULL;
- // release allocated memory for scanned stations
- iScannedChannels.ResetAndDestroy();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::DynInitMenuPaneL
-// Sets the state of menu items dynamically according to the
-// state of application data.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::DynInitMenuPaneL( TInt aResourceId,
- CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == R_FMRADIO_SEARCH_STATIONS_OPTIONS_MENU ) // Main menu
- {
- if ( iRadioEngine.IsAudioRoutingPossible() )
- {
- if ( iRadioEngine.GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
- {
- // Delete existing menu option and add a new one
- aMenuPane->DeleteMenuItem( EFMRadioCmdActivateIhf );
- if ( iRadioEngine.IsHeadsetConnected() )
- {
- aMenuPane->SetItemTextL( EFMRadioCmdDeactivateIhf, R_QTN_FMRADIO_OPTIONS_DEACTIVATE );
- }
- }
- else
- {
- // Delete existing menu option and add a new one
- aMenuPane->DeleteMenuItem( EFMRadioCmdDeactivateIhf );
- aMenuPane->SetItemTextL( EFMRadioCmdActivateIhf, R_QTN_FMRADIO_OPTIONS_ACTIVATE );
- }
- }
- else
- {
- aMenuPane->SetItemDimmed( EFMRadioCmdDeactivateIhf, ETrue );
- aMenuPane->SetItemDimmed( EFMRadioCmdActivateIhf, ETrue );
- }
-
- if ( iScannedChannels.Count() < 2 )
- {
- aMenuPane->DeleteMenuItem( EFMRadioCmdSaveAllChannels );
- }
-
- // if help is not enabled, disable help option
- if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
- {
- aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::LayoutChangedL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::LayoutChangedL( TInt aType )
- {
- if( iContainer )
- {
- iContainer->SetRect( ClientRect() );
- iContainer->HandleResourceChange( aType );
- }
- }
-
-// ---------------------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::SetMiddleSoftKeyLabelL
-// Sets middle softkey label.
-// ---------------------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::SetMiddleSoftKeyLabelL( const TInt aResourceId,
- const TInt aCommandId )
- {
- if ( !AknLayoutUtils::PenEnabled() )
- {
- CEikButtonGroupContainer* cbaGroup = Cba();
- if ( cbaGroup )
- {
- cbaGroup->RemoveCommandFromStack( KMSKControlID, iCurrentMSKCommandId );
- HBufC* middleSKText = StringLoader::LoadLC( aResourceId, iCoeEnv );
- TPtr mskPtr = middleSKText->Des();
- cbaGroup->AddCommandToStackL(
- KMSKControlID,
- aCommandId,
- mskPtr );
- CleanupStack::PopAndDestroy( middleSKText );
- iCurrentMSKCommandId = aCommandId;
- }
- }
- }
-
-// ---------------------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::SetMiddleSoftKeyIconL
-// Sets middle softkey icon.
-// ---------------------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::SetMiddleSoftKeyIconL()
- {
- if ( !AknLayoutUtils::PenEnabled() )
- {
- CEikButtonGroupContainer* cbaGroup = Cba();
- CFbsBitmap* bitmap = NULL;
- CFbsBitmap* mask = NULL;
- if ( cbaGroup )
- {
- TFileName mbmFileName;
- TFindFile finder( iCoeEnv->FsSession() );
- TInt err = finder.FindByDir( KFMRadioBmpFile, KDC_APP_BITMAP_DIR );
- if ( err == KErrNone )
- {
- mbmFileName.Copy( finder.File() );
- }
-
- AknsUtils::CreateColorIconL(
- AknsUtils::SkinInstance(),
- KAknsIIDQgnPropMskMenu,
- KAknsIIDQsnComponentColors,
- EAknsCIQsnComponentColorsCG13,
- bitmap,
- mask,
- mbmFileName,
- EMbmFmradioQgn_prop_msk_menu,
- EMbmFmradioQgn_prop_msk_menu_mask,
- KRgbBlack );
-
- CleanupStack::PushL( bitmap );
- CleanupStack::PushL( mask );
-
- cbaGroup->RemoveCommandFromStack( KMSKControlID, iCurrentMSKCommandId );
- cbaGroup->AddCommandToStackL(
- KMSKControlID,
- EAknSoftkeyContextOptions,
- *bitmap,
- *mask );
-
- iCurrentMSKCommandId = EAknSoftkeyContextOptions;
-
- CleanupStack::PopAndDestroy( 2, bitmap );
- }
- }
- }
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::SaveAllChannelsL
-// Saves all the scanned channels into Radio Engine's presets.
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::SaveAllChannelsL()
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
-
- if ( appUi->NumberOfChannelsStored() > 0 )
- {
- //We have some tuned channels,
- //so we have to check does the user want to
- //add new channes or replace the old ones.
- TInt numberOfEmptySlots = KMaxNumberOfChannelListItems - appUi->NumberOfChannelsStored();
- if( numberOfEmptySlots >= iScannedChannels.Count() )
- {
- //more vacant than new channels
- //we can add or replace
- TInt index(0);
- CAknListQueryDialog* query = new (ELeave) CAknListQueryDialog( &index );
- query->PrepareLC( R_FMRADIO_LISTQUERY_SAVE_ALL_REPLACE_APPEND );
- if( query->RunLD() )
- {
- const TInt KIndexOfSaveAllReplaceExistingCmd = 0;
- const TInt KIndexOfSaveAllAppendCmd = 1;
- if( index == KIndexOfSaveAllReplaceExistingCmd )
- {
- SaveFoundChannelsToPresetsL( EReplace );
- }
- else if( index == KIndexOfSaveAllAppendCmd )
- {
- SaveFoundChannelsToPresetsL( EAppend );
- }
- }
- else
- {
- ShowToolbar( ETrue );
- }
- }
- else
- {
- //no room for all the channels
- if( numberOfEmptySlots == 0 )
- {
- CAknQueryDialog* query = CAknQueryDialog::NewL();
- if ( query->ExecuteLD( R_FMRADIO_REPLACE_EXISTING_CHANNELS_QUERY ) )
- {
- SaveFoundChannelsToPresetsL( EReplace );
- }
- else
- {
- ShowToolbar( ETrue );
- }
- }
- else
- {
- TInt index(0);
- CAknListQueryDialog* query = new (ELeave) CAknListQueryDialog( &index );
- query->PrepareLC( R_FMRADIO_LISTQUERY_SAVE_ALL_REPLACE_APPEND_LIST_ALMOST_FULL );
- if( query->RunLD() )
- {
- const TInt KIndexOfSaveAllAppendCmd = 0;
- const TInt KIndexOfSaveAllReplaceExistingCmd = 1;
- if( index == KIndexOfSaveAllReplaceExistingCmd )
- {
- SaveFoundChannelsToPresetsL( EReplace );
- }
- else if( index == KIndexOfSaveAllAppendCmd )
- {
- SaveFoundChannelsToPresetsL( EAppend );
- }
- }
- else
- {
- ShowToolbar( ETrue );
- }
- }
- }
- }
- else
- {
- //No previous channels
- SaveFoundChannelsToPresetsL( EReplace );
- }
- }
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::ShowConfirmationQueryL
-// Get confirmation from user.
-// -----------------------------------------------------------------------------------------------
-//
-TInt CFMRadioScanLocalStationsView::ShowConfirmationQueryL(TInt aResText, TInt aResQuery)
- {
- TInt accepted = EFalse;
- HBufC* prompt = StringLoader::LoadLC( aResText, iEikonEnv );
- CAknQueryDialog* queryDlg = CAknQueryDialog::NewL();
- accepted = queryDlg->ExecuteLD( aResQuery, *prompt );
- CleanupStack::PopAndDestroy( prompt );
- return accepted;
- }
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::StopSeekL
-// Invoked by AppUi when a seek is completed or aborted.
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::StopSeekL()
- {
- FTRACE( FPrint( _L("CFMRadioScanLocalStationsView::StopSeekL") ) );
-
- if ( iTuneRequested )
- {
- iTuneRequested = EFalse;
-
- // if tune request comes from scan all (= ResetListAndStartScanL )
- // then start the whole scan
- if ( iScanAndSaveActivated )
- {
- AppUi()->HandleCommandL( EFMRadioCmdScanLocalStationsScan );
- }
- }
- else if ( iScanAndSaveActivated )
- {
- // No channels found or user has canceled search before any channels are found
- if ( iRadioEngine.GetTunedFrequency() == iLowerFrequencyBound &&
- iScannedChannels.Count() == 0 )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
-
- if ( appUi->IsStartupWizardRunning() )
- {
- //no stations are found in Wizard
- if (iCancelType == EFMRadioCancelScanDefault)
- {
- HBufC* string = NULL;
- string = StringLoader::LoadLC( R_QTN_FMRADIO_NO_STATIONS_FOUND, iEikonEnv );
- CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); // waiting
- note->ExecuteLD( *string );
- CleanupStack::PopAndDestroy( string );
- }
-
- iScanAndSaveActivated = EFalse;
-
- RemoveScanningInProgressNoteL();
- RestoreRadio( EFalse );
- appUi->AutoTuneInMainView(ETrue);
-
- ActivateMainViewL();
- }
- else
- {
- if( iContainer )
- {
- HBufC* listEmptyText = NULL;
- listEmptyText = StringLoader::LoadLC( R_QTN_FMRADIO_LIST_NO_STATIONS_FOUND, iEikonEnv );
- iContainer->SetStationListEmptyTextL( *listEmptyText );
- CleanupStack::PopAndDestroy( listEmptyText );
-
- iContainer->ResetChannelListL();
- }
-
- iScanAndSaveActivated = EFalse;
- Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
- Cba()->DrawDeferred(); // Redraw softkeys
- RemoveScanningInProgressNoteL();
-
- UpdateToolbar();
- ShowToolbar( ETrue );
- RestoreRadio();
- }
- }
- else
- {
- AddTunedFrequencyToListL();
- }
- }
- else
- {
- RemoveScanningInProgressNoteL();
- TBool restoreFrequency = EFalse;
- TInt tunedFrequency = iRadioEngine.GetTunedFrequency();
-
- if ( tunedFrequency == iLowerFrequencyBound &&
- iScannedChannels.Count() == 0 )
- {
- restoreFrequency = ETrue;
- }
- UpdateToolbar();
- RestoreRadio( restoreFrequency );
-
- // update now playing index if the tuning is triggered from accessory
- TInt frequencyIndex = FrequencyIndex( tunedFrequency );
-
- if ( frequencyIndex != KErrNotFound )
- {
- SetNowPlayingChannelL( frequencyIndex );
- SetLastListenedChannel( frequencyIndex );
- }
- else // frequency is not in the list, remove now playing channel status
- {
- SetNowPlayingChannelL( KErrNotFound );
- }
- }
- }
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::RestoreRadio
-// Restores the radio after scanning
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::RestoreRadio( TBool aTuneInitialFrequency )
- {
- FTRACE( FPrint( _L("CFMRadioScanLocalStationsView::RestoreRadio") ) );
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- // if iInitialTunedFrequency is 0, radio has already been restored
- if ( iInitialTunedFrequency )
- {
- if ( aTuneInitialFrequency )
- {
- iTuneRequested = ETrue;
- iRadioEngine.Tune( iInitialTunedFrequency );
- }
- //unmute radio
- iRadioEngine.SetMuteOn( EFalse );
- iInitialTunedFrequency = 0;
- }
- appUi->SetStartupWizardRunning( EFalse );
- }
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::AddTunedFrequencyToListL
-// Updates found channels to the list.
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::AddTunedFrequencyToListL()
- {
- FTRACE( FPrint( _L("CFMRadioScanLocalStationsView::AddTunedFrequencyToListL") ) );
- TInt tunedFrequency = iRadioEngine.GetTunedFrequency();
-
- if ( KErrNotFound == FrequencyIndex( tunedFrequency ) )
- {
- // the frequency is new and may be added
- CFMRadioPreset* channel = CFMRadioPreset::NewL();
- CleanupStack::PushL( channel );
- channel->SetPresetFrequency( tunedFrequency );
- // Make the name invalid by default so that possibly dynamic PS name won't get saved
- channel->SetPresetNameValid( EFalse );
-
- TInt freqIndex = SortedFrequencyListIndex( tunedFrequency );
-
- if ( freqIndex < ( iScannedChannels.Count() - 1 ) )
- {
- iScannedChannels.Insert( channel, freqIndex );
- }
- else
- {
- iScannedChannels.AppendL( channel );
- }
- CleanupStack::Pop( channel );
-
- // update a radiostation slot in the list
- // check if there is place
- if ( iContainer )
- {
- iContainer->InsertScannedChannelToListL( freqIndex, tunedFrequency );
- iContainer->DrawDeferred();
- }
- // scan for another frequency
- AppUi()->HandleCommandL( EFMRadioCmdScanLocalStationsScan );
- }
- else
- {
- //stop scanning
- iScanAndSaveActivated = EFalse;
- Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
- Cba()->DrawDeferred(); // Redraw softkeys
-
- RemoveScanningInProgressNoteL();
- SetMiddleSoftKeyIconL();
- SetContextMenu( R_FMRADIO_SCAN_STATIONS_CTX_MENUBAR_SAVE );
-
- if ( iContainer )
- {
- iContainer->UpdateLastListenedChannel( 0 ); // select the first channel
- PlayCurrentlySelectedChannelL();
- iContainer->DrawDeferred();
- }
-
- //unmute radio
- iRadioEngine.SetMuteOn( EFalse );
-
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
-
- if ( appUi->IsStartupWizardRunning() )
- {
- appUi->SetStartupWizardRunning( EFalse );
-
- if ( iScanCancelled )
- {
- iScanCancelled = EFalse;
- ActivateMainViewL();
- }
- else
- {
- SaveAllChannelsL();
- }
- }
- else
- {
- UpdateToolbar();
- ShowToolbar( ETrue );
- }
- }
- }
-
-// -----------------------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::ResetCountersL
-// Called when a new scan is activated.
-// -----------------------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::ResetListAndStartScanL()
- {
- User::LeaveIfNull( iContainer );
- iNowPlayingIndex = KErrNotFound;
- ShowToolbar( EFalse );
- iContainer->SetStationListEmptyTextL( KNullDesC );
- iScanAndSaveActivated = ETrue;
- DisplayScanningInProgressNoteL();
-
- iInitialTunedFrequency = 0;
- iScanCancelled = EFalse;
- iCancelType = EFMRadioCancelScanDefault;
- iScannedChannels.ResetAndDestroy();
- iContainer->InitializeChannelListL();
-
- //mute radio
- if ( !iRadioEngine.IsMuteOn() )
- {
- iRadioEngine.SetMuteOn( ETrue );
- }
-
- //update upper and lower frequency bands
- iRadioEngine.GetFrequencyBandRange( iLowerFrequencyBound, iUpperFrequencyBound );
-
- iInitialTunedFrequency = iRadioEngine.GetTunedFrequency();
-
- if ( iRadioEngine.GetTunedFrequency() != iLowerFrequencyBound )
- {
- iTuneRequested = ETrue;
- iRadioEngine.Tune( iLowerFrequencyBound );
- }
- else
- {
- AppUi()->HandleCommandL( EFMRadioCmdScanLocalStationsScan );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::DisplayScanningInProgressNoteL
-// Display a wait note while the channel fill is occuring.
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::DisplayScanningInProgressNoteL()
- {
- iScanningNote = new (ELeave) CAknWaitDialog(REINTERPRET_CAST(CEikDialog**, &iScanningNote));
- iScanningNote->SetCallback( this );
-
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
-
- if ( appUi->IsStartupWizardRunning() )
- {
- iScanningNote->PrepareLC( R_FMRADIO_SEARCH_STATIONS_WAIT_CANCEL_NOTE );
- }
- else
- {
- iScanningNote->PrepareLC( R_FMRADIO_SEARCH_STATIONS_WAIT_NOTE );
- }
-
- iScanningNote->RunLD();
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::RemoveScanningInProgressNoteL
-// Remove and destroy the scanning fill note.
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::RemoveScanningInProgressNoteL()
- {
- FTRACE(FPrint(_L("CFMRadioScanLocalStationsView::RemoveScanningInProgressNoteL")));
- if ( iScanningNote )
- {
- iScanningNote->ProcessFinishedL(); // Inform seek note to stop and hide it
- iScanningNote = NULL;
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::DialogDismissedL
-// Called when user cancels waiting note or process finishes
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::DialogDismissedL( TInt aButtonId )
- {
- FTRACE(FPrint(_L("CFMRadioScanLocalStationsView::DialogDismissedL")));
- iScanningNote = NULL;
- if ( aButtonId == EAknSoftkeyCancel )
- {
- // cancel any process in here
- /*Dialog get this button ID when dismissed, if headset is pulled off
- we don't want to change the cancel type*/
- if( iCancelType != EFMRadioCancelScanByHeadsetDisconnect)
- {
- SetScanCanceled(EFMRadioCancelScanBySoftkey);
- }
- iRadioEngine.CancelScanLocalStationsScan();
- }
- }
-
-void CFMRadioScanLocalStationsView::SetScanCanceled( TFMRadioCancelScanType aType )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
-
- if ( appUi->IsStartupWizardRunning() )
- {
- FTRACE(FPrint(_L("CFMRadioScanLocalStationsView::SetScanCanceled")));
- iScanCancelled = ETrue;
- iCancelType = aType;
- }
- else
- {
- iScanCancelled = EFalse;
- iCancelType = EFMRadioCancelScanDefault;
- }
- }
-
-TFMRadioCancelScanType CFMRadioScanLocalStationsView::CancelType()
- {
- return iCancelType;
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsContainer::SaveFoundChannelsToPresets
-// Save scanned channels to presets
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::SaveFoundChannelsToPresetsL( TSavingMode aSavingMode )
- {
- FTRACE(FPrint(_L("CFMRadioScanLocalStationsView::SaveFoundChannelsToPresetsL Mode %d"), aSavingMode ) );
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
-
- //store as much as the list is keeping
- TInt limit;
- TInt chCount = iScannedChannels.Count();
-
- if ( chCount >= KMaxNumberOfChannelListItems )
- {
- limit = KMaxNumberOfChannelListItems;
- }
- else
- {
- limit = chCount;
- }
-
- TInt savedChannelCount = 0;
-
- if( aSavingMode == EAppend )
- {
- /** Append found channels to preset list */
- for( TInt freqIx = 0; KMaxNumberOfChannelListItems > iObserver.Channels()->Count() &&
- chCount > freqIx; freqIx++ )
- {
- const TDesC& name = iScannedChannels[ freqIx ]->PresetNameValid() ?
- iScannedChannels[ freqIx ]->PresetName() : KNullDesC;
-
- iObserver.AddChannelToListL( name,
- iScannedChannels[ freqIx ]->PresetFrequency() );
-
- savedChannelCount++;
-
- }
-
- iObserver.UpdateChannelsL( EStoreAllToRepository, 0, 0 );
-
- }
- else // Replace
- {
- iObserver.UpdateChannelsL( ERemoveAllFromRepository, 0, 0 );
-
- for ( TInt index = 0; index < limit; index++ )
- {
- const TDesC& name = iScannedChannels[ index ]->PresetNameValid() ?
- iScannedChannels[ index ]->PresetName() : KNullDesC;
- iObserver.AddChannelToListL( name,
- iScannedChannels[ index ]->PresetFrequency() );
- savedChannelCount++;
- }
- iObserver.UpdateChannelsL( EStoreAllToRepository, 0, 0 );
- }
-
- // display note about how many many channels were saved to the preset list
- HBufC* string = NULL;
- string = StringLoader::LoadLC( R_QTN_FMRADIO_STATIONS_SAVED, savedChannelCount, iEikonEnv );
- CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue ); // waiting
- note->ExecuteLD( *string );
- CleanupStack::PopAndDestroy( string );
-
- ActivateMainViewL();
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsView::PlayCurrentlySelectedChannel
-// Play currently selected channel from scan local stations list
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::PlayCurrentlySelectedChannelL()
- {
- FTRACE(FPrint(_L("CFMRadioScanLocalStationsView::PlayCurrentlySelectedChannelL")));
-
- TInt selectedChannel = CurrentlySelectedChannel();
- if ( ChannelInUse( selectedChannel ) )
- {
- TInt selectedFrequency = iScannedChannels[ selectedChannel ]->PresetFrequency();
-
- if ( iRadioEngine.GetTunedFrequency() != selectedFrequency )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- iTuneRequested = ETrue;
- SetNowPlayingChannelL( selectedChannel );
- SetLastListenedChannel( selectedChannel );
- appUi->TuneL( selectedFrequency );
- }
- else
- {
- SetNowPlayingChannelL( selectedChannel );
- SetLastListenedChannel( selectedChannel );
- }
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsView::ShowToolbar
-// Sets toolbar visibility.
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::ShowToolbar( TBool aVisible )
- {
- if ( iToolbar && AknLayoutUtils::PenEnabled() )
- {
- iToolbar->SetToolbarVisibility( aVisible );
- iToolbar->UpdateBackground();
- iToolbar->DrawDeferred();
- // just to make sure container has the right rect when toolbar is displayed
- if ( aVisible && iContainer )
- {
- iContainer->SetRect( ClientRect() );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::RdsDataProgrammeService
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::RdsDataProgrammeService( const TDesC& aProgramService )
- {
- FTRACE(FPrint(_L("CFMRadioScanLocalStationsView::RdsDataProgrammeService")));
- if ( iContainer && !iTuneRequested && aProgramService.Length() > 0 )
- {
- TInt tunedChannel = CurrentlyPlayingChannel();
-
- TRAP_IGNORE
- (
- if ( ChannelInUse( tunedChannel ) )
- {
- iContainer->UpdateChannelListContentL( tunedChannel,
- aProgramService,
- iScannedChannels[ tunedChannel ]->PresetFrequency(),
- ETrue,
- ETrue );
-
- // update PS name also to the list containing the scanned preset values
- iScannedChannels[ tunedChannel ]->SetPresetNameL( aProgramService );
- iContainer->DrawDeferred();
- }
- )
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::RdsDataPsNameIsStatic
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::RdsDataPsNameIsStatic( TBool aStatic )
- {
- TInt tunedChannel = CurrentlyPlayingChannel();
- if( ChannelInUse( tunedChannel ) )
- {
- iScannedChannels[ tunedChannel ]->SetPresetNameValid( aStatic );
- }
- }
-
-// ---------------------------------------------------------
-// CFMRadioScanLocalStationsView::RdsDataRadioText
-// ---------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::RdsDataRadioText( const TDesC&/* aRadioText */)
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::RdsAfSearchBegin
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::RdsAfSearchBegin()
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::RdsAfSearchEnd
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::RdsAfSearchEnd( TUint32 /*aFrequency*/, TInt /*aError*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::RdsAfSearchStateChange
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::RdsAfSearchStateChange( TBool /*aEnabled*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::RdsAvailable
-// ---------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::RdsAvailable( TBool /*aAvailable*/ )
- {
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::PrepareToolbar
-// Prepare toolbar for displaying basic radio command buttons
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::PrepareToolbar()
- {
- if ( AknLayoutUtils::PenEnabled() )
- {
- iToolbar = Toolbar();
- iToolbar->SetToolbarVisibility( EFalse );
- // Set observer
- iToolbar->SetToolbarObserver( this );
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::OfferToolbarEventL
-// Handle commands from toolbar.
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::OfferToolbarEventL( TInt aCommandId )
- {
- switch ( aCommandId )
- {
- case EFMRadioToolbarButtonCmdSaveAll:
- {
- HandleCommandL( EFMRadioCmdSaveAllChannels );
- break;
- }
- case EFMRadioToolbarButtonCmdScan:
- {
- HandleCommandL( EFMRadioCmdScanLocalStationsScan );
- break;
- }
- case EFMRadioToolbarButtonCmdToggleIhf:
- {
- if ( iRadioEngine.GetAudioOutput() == CRadioEngine::EFMRadioOutputHeadset )
- {
- AppUi()->HandleCommandL( EFMRadioCmdActivateIhf );
- }
- else
- {
- AppUi()->HandleCommandL( EFMRadioCmdDeactivateIhf );
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::SetToolbarDimmedState
-// set toolbar buttons dimmed state
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::SetToolbarDimmedState( const TBool aState )
- {
- if ( iToolbar && AknLayoutUtils::PenEnabled() )
- {
- iToolbar->SetDimmed( aState );
- if ( !aState )
- {
- UpdateToolbar();
- }
- iToolbar->DrawDeferred();
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::UpdateToolbar
-// Set save buttons dimming state
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::UpdateToolbar()
- {
- if ( iContainer && iToolbar && AknLayoutUtils::PenEnabled() )
- {
- if ( iRadioEngine.IsAudioRoutingPossible() )
- {
- if ( iRadioEngine.IsHeadsetConnected() )
- {
- CAknButton* centerButton = NULL;
- centerButton = static_cast<CAknButton*>( iToolbar->ControlOrNull( EFMRadioToolbarButtonCmdToggleIhf ) );
-
- iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, EFalse, ETrue );
-
- if ( iRadioEngine.GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
- {
- if ( centerButton )
- {
- centerButton->SetCurrentState( 1, ETrue );
- }
- }
- else
- {
- if ( centerButton )
- {
- centerButton->SetCurrentState( 0, ETrue );
- }
- }
- }
- else
- {
- iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, ETrue, ETrue );
- }
- }
- else
- {
- iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, ETrue, ETrue );
- }
-
- TInt chCount = iScannedChannels.Count();
- if ( chCount == 0 )
- { //dim save buttons
- iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdSaveAll, ETrue, ETrue );
- }
- else if ( chCount == 1 )
- { //dim 'save all' button.
- iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdSaveAll, ETrue, ETrue );
- }
- else
- { //undim both
- iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdSaveAll, EFalse, ETrue );
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::IsFrequencyScanned
-// check if the frequency is already found
-// --------------------------------------------------------------------------------
-//
-TInt CFMRadioScanLocalStationsView::FrequencyIndex( TInt aFrequency )
- {
- TInt frequencyIndex = KErrNotFound;
- TInt chCount = iScannedChannels.Count();
-
- for ( TInt i = 0; i < chCount; i++ )
- {
- if ( aFrequency == iScannedChannels[ i ]->PresetFrequency() )
- {
- frequencyIndex = i;
- break;
- }
- }
- return frequencyIndex;
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::HandleOneChannelSaveL
-// Handle single channel save
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::HandleOneChannelSaveL()
- {
- TInt currentPresetCount = iObserver.Channels()->Count();
- TInt chIndex = iContainer->CurrentlySelectedChannel();
- TBool continueWithSave = ETrue;
-
- if ( !ChannelInUse( chIndex ) )
- {
- User::Leave( KErrNotFound );
- }
- // check if the channel list is full and show replace query if necessary
- if ( currentPresetCount == KMaxNumberOfChannelListItems )
- {
- CAknQueryDialog* query = CAknQueryDialog::NewL();
- if ( query->ExecuteLD( R_FMRADIO_REPLACE_EXISTING_CHANNELS_QUERY ) )
- {
- iObserver.UpdateChannelsL( ERemoveAllFromRepository, 0, 0 );
- }
- else
- {
- continueWithSave = EFalse;
- }
- }
- if ( continueWithSave )
- {
- const TDesC& name = iScannedChannels[ chIndex ]->PresetNameValid() ?
- iScannedChannels[ chIndex ]->PresetName() : KNullDesC;
- TInt presetFrequency = iScannedChannels[ chIndex ]->PresetFrequency();
- iObserver.AddChannelToListL( name,
- presetFrequency );
- iObserver.UpdateChannelsL( EStoreAllToRepository, 0, 0 );
-
- TBool updateNowPlayingIcon = EFalse;
- TInt tunedIndex = CurrentlyPlayingChannel();
- // update now playing icon and list index
- if ( chIndex == tunedIndex )
- {
- // channel is going be deleted so now playing index is not in the list
- iNowPlayingIndex = KErrNotFound;
- }
- else if ( chIndex < tunedIndex )
- {
- iNowPlayingIndex = tunedIndex - 1;
- iContainer->HideNowPlayingIconL( tunedIndex, ETrue );
- updateNowPlayingIcon = ETrue;
- }
- else
- {
- // NOP
- }
-
- // remove also from the UI list
- iContainer->RemoveChannelListContentL( chIndex );
-
- if ( updateNowPlayingIcon )
- {
- iContainer->UpdateNowPlayingIconL( tunedIndex - 1 );
- }
- // received PS name is shown
- if ( name.Length() > 0 )
- {
- HBufC* nameSavedString = StringLoader::LoadLC( R_QTN_FMRADIO_SAVING_DONE_ONE, name, iEikonEnv );
- CAknConfirmationNote* saveInfoNote = new ( ELeave ) CAknConfirmationNote( ETrue ); // waiting
- saveInfoNote->ExecuteLD( *nameSavedString );
- CleanupStack::PopAndDestroy( nameSavedString );
- }
- else // show frequency
- {
- TReal frequency = static_cast<TReal>( presetFrequency / static_cast<TReal>( KHzConversionFactor ) );
- TRealFormat format( KFrequencyMaxLength, iRadioEngine.DecimalCount() );
- TBuf<KFrequencyMaxLength> frequencyString;
- frequencyString.Num( frequency, format );
- AknTextUtils::LanguageSpecificNumberConversion( frequencyString );
-
- HBufC* freqSavedString = StringLoader::LoadLC( R_QTN_FMRADIO_SAVING_DONE_ONE_NO_NAME, frequencyString, iEikonEnv );
- CAknConfirmationNote* saveInfoNote = new ( ELeave ) CAknConfirmationNote( ETrue ); // waiting
- saveInfoNote->ExecuteLD( *freqSavedString );
- CleanupStack::PopAndDestroy( freqSavedString );
- }
- // channel info is removed after save
- delete iScannedChannels[ chIndex ];
- iScannedChannels.Remove( chIndex );
- iScannedChannels.Compress();
- }
- UpdateToolbar();
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::ActivateMainViewL
-// Activates main view
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::ActivateMainViewL()
- {
- CAknViewAppUi* appUi = AppUi();
-
- if ( !appUi->IsForeground() )
- {
- // don't bring radio automatically to the foreground
- // if the view is about to change
- // and we are still in the background
- appUi->SetCustomControl( 1 );
- appUi->ActivateLocalViewL( KFMRadioMainViewId );
- appUi->SetCustomControl( 0 );
- }
- else
- {
- appUi->ActivateLocalViewL( KFMRadioMainViewId );
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::SetContextMenu
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::SetContextMenu( TInt aMenuTitleResourceId )
- {
- if ( !AknLayoutUtils::PenEnabled() )
- {
- CEikMenuBar* menubar = MenuBar();
- if ( menubar )
- {
- menubar->SetContextMenuTitleResourceId( aMenuTitleResourceId );
- menubar->SetMenuType( CEikMenuBar::EMenuContext );
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::HandleScanListRemConEventL
-// --------------------------------------------------------------------------------
-//
-void CFMRadioScanLocalStationsView::HandleScanListRemConEventL( TAccessoryEvent aEvent )
- {
- TInt scannedChannelCount = iScannedChannels.Count();
-
- if ( scannedChannelCount >= 1 )
- {
- TInt selectedChannelIndex = CurrentlySelectedChannel();
- TInt nextChannellIndex = 0;
-
- if ( aEvent == EForward )
- {
- nextChannellIndex = selectedChannelIndex + 1;
-
- if ( nextChannellIndex >= scannedChannelCount )
- {
- // go around the the list to the first channnel
- nextChannellIndex = 0;
- }
- }
- else if ( aEvent == ERewind )
- {
- nextChannellIndex = selectedChannelIndex - 1;
-
- if ( nextChannellIndex < KMinNumberOfChannelListItems )
- {
- // jump to the last item
- nextChannellIndex = scannedChannelCount - 1;
- }
- }
- // check that index is really a valid one
- if ( ChannelInUse( nextChannellIndex ) )
- {
- TInt nextChannelFrequency = iScannedChannels[ nextChannellIndex ]->PresetFrequency();
- // tune if necessary
- if ( iRadioEngine.GetTunedFrequency() != nextChannelFrequency )
- {
- CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
- appUi->TuneL( nextChannelFrequency );
- }
- }
- }
- }
-
-// --------------------------------------------------------------------------------
-// CFMRadioScanLocalStationsView::SortedFrequencyListIndex
-// --------------------------------------------------------------------------------
-//
-TInt CFMRadioScanLocalStationsView::SortedFrequencyListIndex( TInt aFrequency )
- {
- TInt channelCount = iScannedChannels.Count();
- TInt sortedIndex = 0;
-
- for ( TInt i = 0; i < channelCount; i++ )
- {
- TInt presetFreq = iScannedChannels[i]->PresetFrequency();
-
- if ( aFrequency > presetFreq )
- {
- sortedIndex = i + 1;
- }
- else if ( aFrequency < presetFreq )
- {
- sortedIndex = i;
- break;
- }
- }
- return sortedIndex;
- }
-
-// End of File
--- a/fmradio/fmradio/src/fmradiosvkevents.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,384 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Class which implements handling Side Volume Key events (SVK).
-* This class implements methods of MRemConCoreApiTargetObserver
-*
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <remconcoreapitarget.h>
-#include <remconcoreapitargetobserver.h>
-#include <RemConCallHandlingTarget.h>
-#include <RemConCallHandlingTargetObserver.h>
-#include <remconinterfaceselector.h>
-#include <aknconsts.h> // KAknStandardKeyboardRepeatRate
-#include <aknViewAppUi.h>
-
-#include "fmradiosvkevents.h"
-
-
-// CONSTANTS
-const TInt KVolumeControlExpiryPeriod = 2000000;
-const TInt KVolumeFirstChangePeriod = KAknStandardKeyboardRepeatRate;
-const TInt KVolumeChangePeriod = KAknStandardKeyboardRepeatRate;
-const TInt KVolumeChangeUp = 1;
-const TInt KVolumeChangeDown = -1;
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ----------------------------------------------------------------------------
-// CFMRadioSvkEvents
-// ----------------------------------------------------------------------------
-//
-CFMRadioSvkEvents* CFMRadioSvkEvents::NewL( MFMRadioSvkEventsObserver& aObserver )
- {
-#ifdef _DEBUG
- RDebug::Print(_L("CFMRadioSvkEvents::NewL"));
-#endif
- CFMRadioSvkEvents* self = new ( ELeave ) CFMRadioSvkEvents( aObserver );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioSvkEvents
-// ----------------------------------------------------------------------------
-//
-CFMRadioSvkEvents::CFMRadioSvkEvents( MFMRadioSvkEventsObserver& aObserver ) :
- iObserver( aObserver )
- {
- }
-
-
-// ----------------------------------------------------------------------------
-// CFMRadioSvkEvents::~CFMRadioSvkEvents
-// ----------------------------------------------------------------------------
-//
-CFMRadioSvkEvents::~CFMRadioSvkEvents()
- {
-#ifdef _DEBUG
- RDebug::Print(_L("CFMRadioSvkEvents::~CFMRadioSvkEvents"));
-#endif
- delete iRemoveTimer;
- delete iVolumeTimer;
- delete iInterfaceSelector;
- iCoreTarget = NULL; // For LINT. Owned by iInterfaceSelector
- iCallTarget = NULL; // For LINT. Owned by iInterfaceSelector
- }
-
-// ----------------------------------------------------------------------------
-// ConstructL
-// ----------------------------------------------------------------------------
-//
-void CFMRadioSvkEvents::ConstructL( )
- {
-#ifdef _DEBUG
- RDebug::Print(_L("CFMRadioSvkEvents::ConstructL"));
-#endif
-
- iTargetOpen = EFalse;
- iInterfaceSelector = CRemConInterfaceSelector::NewL();
-
- // owned by iInterfaceSelector
- iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
- iCallTarget = CRemConCallHandlingTarget::NewL(*iInterfaceSelector, *this);
-
- if (!iTargetOpen)
- {
- iInterfaceSelector->OpenTargetL();
- iTargetOpen = ETrue ;
- }
-
- // Remote control server command repeat timer.
- iVolumeTimer = CPeriodic::NewL( EPriorityNormal );
- iRemoveTimer = CPeriodic::NewL( EPriorityNormal );
- }
-
-// ----------------------------------------------------------------------------
-// CFMRadioSvkEvents::MrccatoCommand
-// Handles side volume key events.
-// ----------------------------------------------------------------------------
-//
-void CFMRadioSvkEvents::MrccatoCommand( TRemConCoreApiOperationId aOperationId,
- TRemConCoreApiButtonAction aButtonAct )
- {
-#ifdef _DEBUG
- RDebug::Print(_L("CFMRadioSvkEvents::MrccatoCommand, Operation ID [%d]"), aOperationId);
-#endif
- switch ( aOperationId )
- {
- case ERemConCoreApiVolumeUp: // Volume Up
- {
- HandleVolumeButtons( aButtonAct, KVolumeChangeUp );
- break;
- }
- case ERemConCoreApiVolumeDown: // Volume Down
- {
- HandleVolumeButtons( aButtonAct, KVolumeChangeDown );
- break;
- }
- case ERemConCoreApiBackward: // Backward
- {
- iObserver.FMRadioHeadsetEvent( ERewind );
- break;
- }
- case ERemConCoreApiForward: // Forward
- {
- iObserver.FMRadioHeadsetEvent( EForward );
- break;
- }
- case ERemConCoreApiRewind: // Tune down
- {
- if ( aButtonAct == ERemConCoreApiButtonPress )
- {
- TuneChannel( EFMRadioCmdSeekDown );
- }
- break;
- }
- case ERemConCoreApiFastForward: // Tune up
- {
- if ( aButtonAct == ERemConCoreApiButtonPress )
- {
- TuneChannel( EFMRadioCmdSeekUp );
- }
- break;
- }
- case ERemConCoreApiPausePlayFunction:
- {
- iObserver.FMRadioHeadsetEvent( EPausePlay );
- break;
- }
- case ERemConCoreApiStop:
- {
- iObserver.FMRadioHeadsetEvent( EStop );
- break;
- }
- default :
- {
- // Don’t Panic or do anything here. Other events such as Stop, Rewind, Forward will fall here.
- break;
- }
- }
- }
-
-
-// ----------------------------------------------------------------------------
-// StartRemoveTimerL
-//
-// ----------------------------------------------------------------------------
-//
-void CFMRadioSvkEvents::StartRemoveTimerL( )
- {
-#ifdef _DEBUG
- RDebug::Print(_L("CFMRadioSvkEvents::StartRemoveTimerL" ));
-#endif
- iRemoveTimer->Cancel();
- iRemoveTimer->Start( KVolumeControlExpiryPeriod,
- KVolumeControlExpiryPeriod,
- TCallBack( RemoveControl, this ) );
- }
-
-// ----------------------------------------------------------------------------
-// CancelRemoveTimer
-// ----------------------------------------------------------------------------
-//
-void CFMRadioSvkEvents::CancelRemoveTimer( )
- {
- iRemoveTimer->Cancel();
- }
-
-// ----------------------------------------------------------------------------
-// DoChangeVolume
-//
-// ----------------------------------------------------------------------------
-//
-void CFMRadioSvkEvents::DoChangeVolume( )
- {
-#ifdef _DEBUG
- RDebug::Print(_L("CFMRadioSvkEvents::DoChangeVolume" ));
-#endif
- TRAP_IGNORE( iObserver.FMRadioSvkChangeVolumeL( iChange ) );
- iRemoveTimer->Cancel();
- iRemoveTimer->Start( KVolumeControlExpiryPeriod,
- KVolumeControlExpiryPeriod,
- TCallBack( RemoveControl, this ) );
- }
-
-
-// ----------------------------------------------------------------------------
-// TuneChannel
-//
-// ----------------------------------------------------------------------------
-//
-void CFMRadioSvkEvents::TuneChannel( TFMRadioCommandIds aDirection )
- {
- CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() );
- TRAP_IGNORE( appUi->HandleCommandL( aDirection ) );
- }
-
-// ----------------------------------------------------------------------------
-// RemoveControlL
-//
-// ----------------------------------------------------------------------------
-//
-void CFMRadioSvkEvents::RemoveControlL( )
- {
- iRemoveTimer->Cancel();
- iObserver.FMRadioSvkRemoveVolumeL( );
- }
-
-
-
-// ----------------------------------------------------------------------------
-// ChangeVolume
-//
-// ----------------------------------------------------------------------------
-//
-TInt CFMRadioSvkEvents::ChangeVolume( TAny* aObject )
- {
- // cast, and call non-static function
- static_cast<CFMRadioSvkEvents*>( aObject )->DoChangeVolume( );
- return KErrNone;
- }
-
-// ----------------------------------------------------------------------------
-// RemoveControl
-//
-// ----------------------------------------------------------------------------
-//
-TInt CFMRadioSvkEvents::RemoveControl( TAny* aObject )
- {
- // cast, and call non-static function
- TRAP_IGNORE( static_cast<CFMRadioSvkEvents*>( aObject )->RemoveControlL() );
- return KErrNone;
- }
-
-
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::AnswerCall
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::AnswerCall()
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::AnswerEndCall
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::AnswerEndCall()
- {
- iObserver.FMRadioHeadsetEvent(EForward);
- }
-
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::DialCall
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::DialCall( const TDesC8& /*aTelNumber*/ )
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::EndCall
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::EndCall()
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::GenerateDTMF
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::GenerateDTMF( const TChar /*aChar*/ )
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::LastNumberRedial
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::LastNumberRedial()
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::MultipartyCalling
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::MultipartyCalling( const TDesC8& /*aData*/ )
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::SpeedDial
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::SpeedDial( const TInt /*aIndex*/ )
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::VoiceDial
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::VoiceDial( const TBool /*aActivate*/ )
- {
- }
-// ---------------------------------------------------------
-// CFMRadioSvkEvents::HandleVolumeButtons
-// ---------------------------------------------------------
-//
-void CFMRadioSvkEvents::HandleVolumeButtons( TRemConCoreApiButtonAction aButtonAct, TInt aDirection )
- {
- switch( aButtonAct )
- {
- case ERemConCoreApiButtonPress:
- {
- // Volume up hold down for 0,6 seconds
- iVolumeTimer->Cancel();
- iVolumeTimer->Start( KVolumeFirstChangePeriod,
- KVolumeChangePeriod,
- TCallBack( ChangeVolume, this ) );
- iChange = aDirection;
- DoChangeVolume( );
- break;
- }
- case ERemConCoreApiButtonRelease:
- {
- iVolumeTimer->Cancel();
- break;
- }
- case ERemConCoreApiButtonClick:
- {
- iChange = aDirection;
- DoChangeVolume( );
- break;
- }
- default:
- {
- // Never hits this
- break;
- }
- }
- }
-// End of File
--- a/fmradio/fmradioactionhandler/group/bld.inf Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Component definition for the
-* FM Radio Action Handler plugin.
-*
-*/
-
-#include <platform_paths.hrh>
-
-// Platforms the component needs to be built on
-//
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-fmradioactionhandler.mmp
-
-// End of file
--- a/fmradio/fmradioactionhandler/group/fmradioactionhandler.mmp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project
-* FM Radio Action Handler plugin.
-*
-*/
-
-// To get the APP_LAYER_SYSTEMINCLUDE-definition
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-#include "../resources/fmradioactionhandler.hrh"
-
-TARGET fmradioactionhandler.dll
-TARGETTYPE PLUGIN
-UID 0x10009D8D KFMRadioActionHandlerDllUid
-
-CAPABILITY CAP_ECOM_PLUGIN
-VENDORID VID_DEFAULT
-
-PAGED
-
-SOURCEPATH ../resources
-START RESOURCE 2001f498.rss
-TARGET fmradioactionhandler.rsc
-TARGETPATH ECOM_RESOURCE_DIR
-END
-
-
-APP_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../resources
-USERINCLUDE ../../fmradio/inc
-USERINCLUDE ../../fmradioengine/inc
-
-SOURCEPATH ../src
-SOURCE fmradioactionhandler.cpp
-
-LIBRARY ecom.lib
-LIBRARY euser.lib
-LIBRARY liwservicehandler.lib
-LIBRARY ws32.lib
-LIBRARY apgrfx.lib
-LIBRARY apparc.lib
-
-DEBUGLIBRARY flogger.lib
-// End of File
--- a/fmradio/fmradioactionhandler/inc/fmradioactionhandler.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration for the class CFMRadioActionHandler.
-*
-*/
-
-#ifndef FMRADIOACTIONHANDLER_H
-#define FMRADIOACTIONHANDLER_H
-
-#include <ahplugin.h>
-
-/**
- * Action handler provides LIW -based interface for external use (e.g. Homescreen)
- *
- * The action handler communicates with FM Radio via FM Radio's Publish & Subscribe API.
- *
- * @lib fmradioactionhandler.lib
- */
-NONSHARABLE_CLASS( CFMRadioActionHandler ) : public CAHPlugin
- {
-public:
- /**
- * Two-phased constructor.
- */
- static CFMRadioActionHandler* NewL();
-
- /**
- * Destructor
- */
- ~CFMRadioActionHandler();
-
- // From base class CAHPlugin
- TInt ExecuteActionL( const CLiwMap* aMap );
-
-private:
- /**
- * C++ constructor.
- */
- CFMRadioActionHandler();
-
- /**
- * Second phase constructor.
- */
- void ConstructL();
-
-private:
- /**
- * Invokes step to previous preset.
- */
- void StepPrevious();
-
- /**
- * Invokes step to next preset.
- */
- void StepNext();
-
- /**
- * Mutes radio.
- */
- void Mute();
-
- /**
- * Unmutes radio.
- */
- void Unmute();
-
- /**
- * Invokes seek up.
- */
- void SeekUp();
-
- /**
- * Invokes seek down.
- */
- void SeekDown();
-
- /**
- * Invokes to go to now playing view.
- */
- void StartToNowPlayingL();
-
- /**
- * Generates start now playing command tail.
- *
- * @return start now playing command tail.
- */
- const TPtrC8 GenerateStartNowPlayingCommandTail();
-
- /**
- * Extracts the value of the given mapname to given string.
- * Reserves memory to argument aString.
- *
- * @param aMap The map containing the mapname-string pairs.
- * @param aString Descriptor where the value is extracted.
- * @param aMapName The searched map name.
- */
- TInt ExtractStringL( const CLiwMap* aMap, RBuf& aString, const TDesC8& aMapName );
- };
-
-#endif /* FMRADIOACTIONHANDLER_H*/
--- a/fmradio/fmradioactionhandler/inc/fmradioactionhandlerdefs.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions for the FM Radio Action Handler.
-*
-*/
-
-#ifndef FMRADIOACTIONHANDLERDEFS_H
-#define FMRADIOACTIONHANDLERDEFS_H
-
-#include <e32base.h>
-
-_LIT8( KFMRadioCommand, "command" );
-_LIT( KFMRadioCommandValueStepPrevious, "stepprevious" );
-_LIT( KFMRadioCommandValueStepNext, "stepnext" );
-_LIT( KFMRadioCommandValueMute, "mute" );
-_LIT( KFMRadioCommandValueUnmute, "unmute" );
-_LIT( KFMRadioCommandValueSeekUp, "seekup" );
-_LIT( KFMRadioCommandValueSeekDown, "seekdown" );
-_LIT( KFMRadioCommandValueStartNowPlaying, "startnowplaying" );
-
-#endif /* FMRADIOACTIONHANDLERDEFS_H */
--- a/fmradio/fmradioactionhandler/resources/2001f498.rss Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: ECom plugin registration resource for FM Radio Action Handler Plugin.
-*
-*/
-
-#include <ahpluginuids.hrh>
-#include <ecom/registryinfov2.rh>
-
-#include "fmradioactionhandler.hrh"
-
-// ---------------------------------------------------------------------------
-// Resource information for the ECOM DLL.
-// ---------------------------------------------------------------------------
-//
-RESOURCE REGISTRY_INFO theInfo
- {
- resource_format_version = RESOURCE_FORMAT_VERSION_2;
-
- dll_uid = KFMRadioActionHandlerDllUid;
-
- interfaces =
- {
- INTERFACE_INFO
- {
- // AH plugin interface
- interface_uid = KAHPluginInterfaceUid;
-
- implementations =
- {
- // FM Radio Action handler AH plugin implementation
- IMPLEMENTATION_INFO
- {
- implementation_uid = KFMRadioActionHandlerImplementationUid;
- version_no = 1;
- display_name = "";
- default_data = "";
- opaque_data = "";
- rom_only = 0;
- }
- };
- }
- };
- }
--- a/fmradio/fmradioactionhandler/resources/fmradioactionhandler.hrh Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions for the FM Radio Action Handler plugin.
-*
-*/
-
-#ifndef FMRADIOACTIONHANDLER_HRH
-#define FMRADIOACTIONHANDLER_HRH
-
-// Ecom DLL UID for FM Radio Action Handler plugin.
-#define KFMRadioActionHandlerDllUid 0x2001F498
-
-// Ecom implementation UID for FM Radio Action Handler plugin.
-#define KFMRadioActionHandlerImplementationUid 0x2001FCB8
-
-#endif /* FMRADIOACTIONHANDLER_HRH */
--- a/fmradio/fmradioactionhandler/src/fmradioactionhandler.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation for the FM Radio Action Handler Plugin.
-*
-*/
-
-#include <e32cmn.h>
-#include <e32property.h>
-#include <e32std.h>
-#include <w32std.h>
-#include <ecom/implementationproxy.h>
-#include <liwvariant.h>
-#include <apgtask.h>
-#include <apgcli.h>
-#include <apacmdln.h>
-#include <fmradiocommandlineparams.h>
-#include <fmradiointernalpskeys.h>
-#include <fmradiouids.h>
-
-#include "fmradioactionhandler.h"
-#include "fmradioactionhandler.hrh"
-#include "fmradioactionhandlerdefs.h"
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::NewL
-// ---------------------------------------------------------
-//
-CFMRadioActionHandler* CFMRadioActionHandler::NewL()
- {
- CFMRadioActionHandler* self = new ( ELeave ) CFMRadioActionHandler();
- CleanupStack::PushL( self );
-
- self->ConstructL();
-
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::~CFMRadioActionHandler
-// ---------------------------------------------------------
-//
-CFMRadioActionHandler::~CFMRadioActionHandler()
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::CFMRadioActionHandler
-// ---------------------------------------------------------
-//
-CFMRadioActionHandler::CFMRadioActionHandler()
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::ConstructL
-// ---------------------------------------------------------
-//
-void CFMRadioActionHandler::ConstructL()
- {
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::ExecuteActionL
-// ---------------------------------------------------------
-//
-TInt CFMRadioActionHandler::ExecuteActionL( const CLiwMap* aMap )
- {
- TInt retValue( KErrNone );
- RBuf command;
- CleanupClosePushL( command );
-
- retValue = ExtractStringL( aMap, command, KFMRadioCommand);
- if ( retValue == KErrNone )
- {
- if ( !command.CompareF( KFMRadioCommandValueStepPrevious ) )
- {
- StepPrevious();
- }
- else if ( !command.CompareF( KFMRadioCommandValueStepNext ) )
- {
- StepNext();
- }
- else if ( !command.CompareF( KFMRadioCommandValueMute) )
- {
- Mute();
- }
- else if ( !command.CompareF( KFMRadioCommandValueUnmute ) )
- {
- Unmute();
- }
- else if ( !command.CompareF( KFMRadioCommandValueSeekUp ) )
- {
- SeekUp();
- }
- else if ( !command.CompareF( KFMRadioCommandValueSeekDown ) )
- {
- SeekDown();
- }
- else if ( !command.CompareF( KFMRadioCommandValueStartNowPlaying ) )
- {
- StartToNowPlayingL();
- }
- else
- {
- retValue = KErrNotSupported;
- }
- }
- CleanupStack::PopAndDestroy( &command );
- return retValue;
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::StepPrevious
-// ---------------------------------------------------------
-//
-void CFMRadioActionHandler::StepPrevious()
- {
- RProperty::Set( KFMRadioPSUid, KFMRadioPSControlStepToChannel, EFMRadioPSStepToChannelDown );
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::StepNext
-// ---------------------------------------------------------
-//
-void CFMRadioActionHandler::StepNext()
- {
- RProperty::Set( KFMRadioPSUid, KFMRadioPSControlStepToChannel, EFMRadioPSStepToChannelUp );
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::Mute
-// ---------------------------------------------------------
-//
-void CFMRadioActionHandler::Mute()
- {
- RProperty::Set( KFMRadioPSUid, KFMRadioPSControlSetRadioMuteState, EFMRadioPSMuteStateOn );
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::Unmute
-// ---------------------------------------------------------
-//
-void CFMRadioActionHandler::Unmute()
- {
- RProperty::Set( KFMRadioPSUid, KFMRadioPSControlSetRadioMuteState, EFMRadioPSMuteStateOff );
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::SeekUp
-// ---------------------------------------------------------
-//
-void CFMRadioActionHandler::SeekUp()
- {
- //RProperty::Set( KFMRadioPSUid, KFMRadioPSControlSeek, EFMRadioPSSeekUp );
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::SeekDown
-// ---------------------------------------------------------
-//
-void CFMRadioActionHandler::SeekDown()
- {
- //RProperty::Set( KFMRadioPSUid, KFMRadioPSControlSeek, EFMRadioPSSeekDown );
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::StartToNowPlayingL
-// ---------------------------------------------------------
-//
-void CFMRadioActionHandler::StartToNowPlayingL()
- {
- RWsSession wsSession;
-
- User::LeaveIfError(wsSession.Connect() );
- CleanupClosePushL( wsSession );
-
- TApaTaskList taskList( wsSession );
- TUid appUid = TUid::Uid( KUidFMRadioApplication );
- TApaTask fmRadioTask = taskList.FindApp( appUid );
-
- const TInt KFMRadioViewIdLength = 3;
- RBuf8 params;
- params.CreateL( KFMRadioCommandActivateView().Length() + KFMRadioViewIdLength );
- params.Copy( KFMRadioCommandActivateView );
- params.Append( _L(" ") );
- params.AppendNum( KFMRadioMainViewId.iUid );
- params.CleanupClosePushL();
-
- if ( !fmRadioTask.Exists() )
- {
- RApaLsSession apaSession;
- CleanupClosePushL( apaSession );
-
- User::LeaveIfError( apaSession.Connect() );
- User::LeaveIfError( apaSession.GetAllApps() );
-
- TApaAppInfo appInfo;
- User::LeaveIfError( apaSession.GetAppInfo( appInfo, appUid ) );
-
- CApaCommandLine* startParams = CApaCommandLine::NewLC();
- startParams->SetExecutableNameL( appInfo.iFullName );
- startParams->SetCommandL( EApaCommandRun );
- startParams->SetTailEndL( params );
- User::LeaveIfError( apaSession.StartApp( *startParams ) );
- CleanupStack::PopAndDestroy( 2, &apaSession );
- }
- else
- {
- User::LeaveIfError( fmRadioTask.SendMessage( appUid, params ) );
- }
- CleanupStack::PopAndDestroy( 2 );
- }
-
-// ---------------------------------------------------------
-// CFMRadioActionHandler::ExtractStringLC
-// ---------------------------------------------------------
-//
-TInt CFMRadioActionHandler::ExtractStringL( const CLiwMap* aMap, RBuf& aString, const TDesC8& aMapName )
- {
- TInt err( KErrNotFound );
- TLiwVariant variant;
- variant.PushL();
- TPtrC tempString( KNullDesC );
- if ( aMap->FindL( aMapName, variant ) )
- {
- variant.Get( tempString );
- aString.Close();
- aString.CreateL( tempString );
- err = KErrNone;
- }
- CleanupStack::PopAndDestroy( &variant );
- return err;
- }
-
-/** Provides a key-value pair table, that is used to identify the correct construction function for the requested interface. */
-const TImplementationProxy KFMRadioActionHandlerImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( KFMRadioActionHandlerImplementationUid, CFMRadioActionHandler::NewL )
- };
-
-const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount );
-
-// ---------------------------------------------------------------------------
-// Returns the implementations provided by this ECOM plugin DLL.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
- {
- aTableCount = sizeof( KFMRadioActionHandlerImplementationTable ) / sizeof( TImplementationProxy );
- return KFMRadioActionHandlerImplementationTable;
- }
--- a/fmradio/fmradioengine/bwins/fmradioengineacu.def Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-EXPORTS
- ?SetCurrentPresetIndex@CRadioEngine@@QAEXH@Z @ 1 NONAME ; void CRadioEngine::SetCurrentPresetIndex(int)
- ?PublishRDSProgramServiceL@CFMRadioPubSub@@QBEXABVTDesC16@@@Z @ 2 NONAME ; void CFMRadioPubSub::PublishRDSProgramServiceL(class TDesC16 const &) const
- ?SetVolume@CRadioEngine@@QAEXH@Z @ 3 NONAME ; void CRadioEngine::SetVolume(int)
- ?RdsReceiver@CRadioEngine@@QAEAAVCFMRadioRdsReceiverBase@@XZ @ 4 NONAME ; class CFMRadioRdsReceiverBase & CRadioEngine::RdsReceiver(void)
- ?SetRegionIdL@CRadioEngine@@QBEXH@Z @ 5 NONAME ; void CRadioEngine::SetRegionIdL(int) const
- ?SetMuteOn@CRadioEngine@@QAEXH@Z @ 6 NONAME ; void CRadioEngine::SetMuteOn(int)
- ?GetAudioOutput@CRadioEngine@@QBE?AW4TFMRadioAudioOutput@1@XZ @ 7 NONAME ; enum CRadioEngine::TFMRadioAudioOutput CRadioEngine::GetAudioOutput(void) const
- ?PublishPresetCountL@CFMRadioPubSub@@QBEXH@Z @ 8 NONAME ; void CFMRadioPubSub::PublishPresetCountL(int) const
- ?RegionId@CRadioEngine@@QBEHXZ @ 9 NONAME ; int CRadioEngine::RegionId(void) const
- ?GetVolume@CRadioEngine@@QBEHXZ @ 10 NONAME ; int CRadioEngine::GetVolume(void) const
- ?PublishApplicationRunningStateL@CFMRadioPubSub@@QBEXW4TFMRadioPSApplicationRunningState@@@Z @ 11 NONAME ; void CFMRadioPubSub::PublishApplicationRunningStateL(enum TFMRadioPSApplicationRunningState) const
- ?GetRTPlusSupportLevel@CRadioEngine@@QAE?AW4TFMRadioRTPlusLevel@@XZ @ 12 NONAME ; enum TFMRadioRTPlusLevel CRadioEngine::GetRTPlusSupportLevel(void)
- ?GetPresetNameL@CRadioEngine@@QAEAAV?$TBuf@$0CA@@@H@Z @ 13 NONAME ; class TBuf<32> & CRadioEngine::GetPresetNameL(int)
- ?IsMuteOn@CRadioEngine@@QBEHXZ @ 14 NONAME ; int CRadioEngine::IsMuteOn(void) const
- ?GetMaxVolume@CRadioEngine@@QBEHXZ @ 15 NONAME ; int CRadioEngine::GetMaxVolume(void) const
- ?SignalAvailable@CFMRadioRdsReceiverBase@@QBEHXZ @ 16 NONAME ; int CFMRadioRdsReceiverBase::SignalAvailable(void) const
- ?SetRdsAfSearchEnable@CRadioEngine@@QAEXH@Z @ 17 NONAME ; void CRadioEngine::SetRdsAfSearchEnable(int)
- ?RadioOn@CRadioEngine@@QAEXXZ @ 18 NONAME ; void CRadioEngine::RadioOn(void)
- ?SetMusicStoreNoteDisplayed@CRadioEngine@@QAEXXZ @ 19 NONAME ; void CRadioEngine::SetMusicStoreNoteDisplayed(void)
- ?RequestTunerControl@CRadioEngine@@QBEXXZ @ 20 NONAME ; void CRadioEngine::RequestTunerControl(void) const
- ?CancelScanLocalStationsScan@CRadioEngine@@QAEXXZ @ 21 NONAME ; void CRadioEngine::CancelScanLocalStationsScan(void)
- ?GetPresetNameAndFrequencyL@CRadioEngine@@QAEXHAAVTDes16@@AAH@Z @ 22 NONAME ; void CRadioEngine::GetPresetNameAndFrequencyL(int, class TDes16 &, int &)
- ?GetRegionL@CRadioEngine@@QBE?AW4TFMRadioRegionSetting@@XZ @ 23 NONAME ; enum TFMRadioRegionSetting CRadioEngine::GetRegionL(void) const
- ?GetPresetFrequencyL@CRadioEngine@@QBEHH@Z @ 24 NONAME ; int CRadioEngine::GetPresetFrequencyL(int) const
- ?ProgrammeServiceNameType@CFMRadioRdsReceiverBase@@QBE?AW4TFMRadioProgrammeSeviceType@1@XZ @ 25 NONAME ; enum CFMRadioRdsReceiverBase::TFMRadioProgrammeSeviceType CFMRadioRdsReceiverBase::ProgrammeServiceNameType(void) const
- ?GetFrequencyBandRange@CRadioEngine@@QAEHAAH0@Z @ 26 NONAME ; int CRadioEngine::GetFrequencyBandRange(int &, int &)
- ?RegionIdAtIndex@CRadioEngine@@QBE?AW4TFMRadioRegionSetting@@H@Z @ 27 NONAME ; enum TFMRadioRegionSetting CRadioEngine::RegionIdAtIndex(int) const
- ?SetPresetNameFrequencyL@CRadioEngine@@QAEXHABV?$TBuf@$0CA@@@H@Z @ 28 NONAME ; void CRadioEngine::SetPresetNameFrequencyL(int, class TBuf<32> const &, int)
- ?FrequencyStepSize@CRadioEngine@@QBEKXZ @ 29 NONAME ; unsigned long CRadioEngine::FrequencyStepSize(void) const
- ?PubSubL@CRadioEngine@@QBEAAVCFMRadioPubSub@@XZ @ 30 NONAME ; class CFMRadioPubSub & CRadioEngine::PubSubL(void) const
- ?IsInCall@CRadioEngine@@QBEHXZ @ 31 NONAME ; int CRadioEngine::IsInCall(void) const
- ?Tune@CRadioEngine@@QAEXHW4TRadioMode@1@@Z @ 32 NONAME ; void CRadioEngine::Tune(int, enum CRadioEngine::TRadioMode)
- ?ScanDown@CRadioEngine@@QAEXXZ @ 33 NONAME ; void CRadioEngine::ScanDown(void)
- ?CancelScan@CRadioEngine@@QAEXXZ @ 34 NONAME ; void CRadioEngine::CancelScan(void)
- ?InitializeRadio@CRadioEngine@@QAEXXZ @ 35 NONAME ; void CRadioEngine::InitializeRadio(void)
- ?ScanUp@CRadioEngine@@QAEXXZ @ 36 NONAME ; void CRadioEngine::ScanUp(void)
- ?AddObserver@CFMRadioRdsReceiverBase@@QAEXPAVMFMRadioRdsObserver@@@Z @ 37 NONAME ; void CFMRadioRdsReceiverBase::AddObserver(class MFMRadioRdsObserver *)
- ?IsRadioOn@CRadioEngine@@QAEHXZ @ 38 NONAME ; int CRadioEngine::IsRadioOn(void)
- ?GetRadioMode@CRadioEngine@@QBE?AW4TRadioMode@1@XZ @ 39 NONAME ; enum CRadioEngine::TRadioMode CRadioEngine::GetRadioMode(void) const
- ?NewL@CRadioEngine@@SAPAV1@AAVMRadioEngineStateChangeCallback@@@Z @ 40 NONAME ; class CRadioEngine * CRadioEngine::NewL(class MRadioEngineStateChangeCallback &)
- ?SetControlEventObserver@CFMRadioPubSub@@QAEXPAVMFMRadioControlEventObserver@@@Z @ 41 NONAME ; void CFMRadioPubSub::SetControlEventObserver(class MFMRadioControlEventObserver *)
- ?ProgrammeService@CFMRadioRdsReceiverBase@@QBEABVTDesC16@@XZ @ 42 NONAME ; class TDesC16 const & CFMRadioRdsReceiverBase::ProgrammeService(void) const
- ?PublishStateL@CFMRadioPubSub@@QBEXH@Z @ 43 NONAME ; void CFMRadioPubSub::PublishStateL(int) const
- ?IsHeadsetConnected@CRadioEngine@@QBEHXZ @ 44 NONAME ; int CRadioEngine::IsHeadsetConnected(void) const
- ?RadioOff@CRadioEngine@@QAEXXZ @ 45 NONAME ; void CRadioEngine::RadioOff(void)
- ?FrequencySetByRdsAf@CRadioEngine@@QBEHXZ @ 46 NONAME ; int CRadioEngine::FrequencySetByRdsAf(void) const
- ?GetAudioMode@CRadioEngine@@QBEHXZ @ 47 NONAME ; int CRadioEngine::GetAudioMode(void) const
- ?IsRdsAfSearchEnabled@TRadioSettings@@QAEHXZ @ 48 NONAME ; int TRadioSettings::IsRdsAfSearchEnabled(void)
- ?PublishFrequencyL@CFMRadioPubSub@@QBEXK@Z @ 49 NONAME ; void CFMRadioPubSub::PublishFrequencyL(unsigned long) const
- ?IsAudioRoutingPossible@CRadioEngine@@QBEHXZ @ 50 NONAME ; int CRadioEngine::IsAudioRoutingPossible(void) const
- ?RtPlusAlbum@CFMRadioRdsReceiverBase@@QBEABVTDesC16@@XZ @ 51 NONAME ; class TDesC16 const & CFMRadioRdsReceiverBase::RtPlusAlbum(void) const
- ?RtPlusSong@CFMRadioRdsReceiverBase@@QBEABVTDesC16@@XZ @ 52 NONAME ; class TDesC16 const & CFMRadioRdsReceiverBase::RtPlusSong(void) const
- ?RtPlusArtist@CFMRadioRdsReceiverBase@@QBEABVTDesC16@@XZ @ 53 NONAME ; class TDesC16 const & CFMRadioRdsReceiverBase::RtPlusArtist(void) const
- ?MusicStoreNoteDisplayed@CRadioEngine@@QAEHXZ @ 54 NONAME ; int CRadioEngine::MusicStoreNoteDisplayed(void)
- ?SetAudioMode@CRadioEngine@@QAEXW4TFMRadioAudioMode@1@@Z @ 55 NONAME ; void CRadioEngine::SetAudioMode(enum CRadioEngine::TFMRadioAudioMode)
- ?SetAudioOutput@CRadioEngine@@QAEXW4TFMRadioAudioOutput@1@@Z @ 56 NONAME ; void CRadioEngine::SetAudioOutput(enum CRadioEngine::TFMRadioAudioOutput)
- ?RadioSettings@CRadioEngine@@QAEAAVTRadioSettings@@XZ @ 57 NONAME ; class TRadioSettings & CRadioEngine::RadioSettings(void)
- ?IsOfflineProfileL@CRadioEngine@@QAEHXZ @ 58 NONAME ; int CRadioEngine::IsOfflineProfileL(void)
- ?GetTunedFrequency@CRadioEngine@@QBEHXZ @ 59 NONAME ; int CRadioEngine::GetTunedFrequency(void) const
- ?DecimalCount@CRadioEngine@@QBEHXZ @ 60 NONAME ; int CRadioEngine::DecimalCount(void) const
- ?PublishChannelNameL@CFMRadioPubSub@@QBEXABVTDesC16@@@Z @ 61 NONAME ; void CFMRadioPubSub::PublishChannelNameL(class TDesC16 const &) const
- ?RemoveObserver@CFMRadioRdsReceiverBase@@QAEXPAVMFMRadioRdsObserver@@@Z @ 62 NONAME ; void CFMRadioRdsReceiverBase::RemoveObserver(class MFMRadioRdsObserver *)
- ?IsFlightModeEnabled@CRadioEngine@@QBEHXZ @ 63 NONAME ; int CRadioEngine::IsFlightModeEnabled(void) const
- ??1CRadioEngine@@UAE@XZ @ 64 NONAME ; CRadioEngine::~CRadioEngine(void)
- ?UpdatedStartupCount@CRadioEngine@@QBEHXZ @ 65 NONAME ; int CRadioEngine::UpdatedStartupCount(void) const
- ?TunePresetL@CRadioEngine@@QAEXH@Z @ 66 NONAME ; void CRadioEngine::TunePresetL(int)
- ?FillListWithRegionDataL@CRadioEngine@@QBEXAAVCDesC16Array@@@Z @ 67 NONAME ; void CRadioEngine::FillListWithRegionDataL(class CDesC16Array &) const
- ?AutomaticSwitchingEnabled@CFMRadioRdsReceiverBase@@QBEHXZ @ 68 NONAME ; int CFMRadioRdsReceiverBase::AutomaticSwitchingEnabled(void) const
- ?GetPresetIndex@CRadioEngine@@QBEHXZ @ 69 NONAME ; int CRadioEngine::GetPresetIndex(void) const
- ?PublishRDSRadioTextL@CFMRadioPubSub@@QBEXABVTDesC16@@@Z @ 70 NONAME ; void CFMRadioPubSub::PublishRDSRadioTextL(class TDesC16 const &) const
- ?RtPlusProgramUrl@CFMRadioRdsReceiverBase@@QBEABVTDesC16@@XZ @ 71 NONAME ; class TDesC16 const & CFMRadioRdsReceiverBase::RtPlusProgramUrl(void) const
- ?SetTunerModeOn@CRadioEngine@@QAEXXZ @ 72 NONAME ; void CRadioEngine::SetTunerModeOn(void)
-
Binary file fmradio/fmradioengine/cenrep/2001b25e.cre has changed
Binary file fmradio/fmradioengine/cenrep/2001b25e.txt has changed
--- a/fmradio/fmradioengine/data/fmradioengine.rss Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Resource file for fmradioengine
-*
-*/
-// RESOURCE IDENTIFIER
-NAME FMEN
-
-// INCLUDES
-#include <uikon.rh>
-
-#include <fmradio.loc>
-#include "fmradioengine.hrh"
-
-// RESOURCE DEFINITIONS
-
-// ---------------------------------------------------------
-//
-//
-// Resource signature
-//
-// ---------------------------------------------------------
-//
-
-RESOURCE RSS_SIGNATURE { }
-
-// Non-operator customisable settings
-
-
-STRUCT RADIO_REGION
- {
- WORD id;
- WORD stepsize;
- LONG minfrequency;
- LONG maxfrequency;
- WORD decimalcount;
- LTEXT countrycodes[] = {""};
- LTEXT regionname;
- LTEXT regionsettingname;
- }
-
-STRUCT RADIO_REGION_ARRAY
- {
- LLINK regions[];
- }
-
-// ---------------------------------------------------------
-//
-// r_radio_regions_all
-// Array of all the supported regions
-//
-// ---------------------------------------------------------
-//
-RESOURCE RADIO_REGION_ARRAY r_radio_regions_all
- {
- regions =
- {
- r_radio_region_japan,
- r_radio_region_america,
- r_radio_region_default
- };
- }
-
-// ---------------------------------------------------------
-//
-// r_radio_regions_without_japan
-// Array of supported regions without Japan
-//
-// ---------------------------------------------------------
-//
-RESOURCE RADIO_REGION_ARRAY r_radio_regions_without_japan
- {
- regions =
- {
- r_radio_region_america,
- r_radio_region_default
- };
- }
-
-// ---------------------------------------------------------
-//
-// r_radio_region_japan
-// Region settings for Japan
-// Check country codes from:
-// "COMPLEMENT TO ITU-T RECOMMENDATION E.212, LIST OF MOBILE COUNTRY OR GEOGRAPHICAL AREA CODES"
-// ---------------------------------------------------------
-//
-RESOURCE RADIO_REGION r_radio_region_japan
- {
- id = EFMRadioRegionJapan;
- stepsize = 100;
- minfrequency = 76000;
- maxfrequency = 90000;
- decimalcount = 1;
- countrycodes =
- {
- "440",
- "441"
- };
- regionname = qtn_fmradio_reg_japan;
- }
-
-// ---------------------------------------------------------
-//
-// r_radio_region_america
-// Region settings for America
-// "COMPLEMENT TO ITU-T RECOMMENDATION E.212, LIST OF MOBILE COUNTRY OR GEOGRAPHICAL AREA CODES"
-//
-// ---------------------------------------------------------
-//
-RESOURCE RADIO_REGION r_radio_region_america
- {
- id = EFMRadioRegionAmerica;
- stepsize = 200;
- minfrequency = 88100;
- maxfrequency = 107900;
- decimalcount = 1;
- countrycodes =
- {
- "302", // Canada
- "310", // USA
- "311", // USA
- "312", // USA
- "313", // USA
- "314", // USA
- "315", // USA
- "316", // USA
- "332", // USA
- "334", // Mexico
- "338", // Jamaica
- "342", // Barbados
- "344", // Antigua and Barbuda
- "352", // Grenada
- "360", // Saint Vincent and the Grenadines
- "364", // Bahamas
- "366", // Common Wealth of Dominica
- "370", // Dominican Republic
- "372", // Haiti
- "374", // Trinidad and Tobago
- "368", // Cuba
- "702", // Belize
- "704", // Guatemala
- "706", // El Salvador
- "708", // Honduras
- "710", // Nicaragua
- "712", // Costa Rica
- "714", // Panama
- "716", // Peru
- "724", // Brazil
- "730", // Chile
- "732", // Colombia
- "734", // Venezuela
- "736", // Bolivia
- "738", // Guyana
- "740", // Ecuador
- "744", // Paraguay
- "746", // Suriname
- "748" // Uruguay
- };
- regionname = qtn_fmradio_reg_america;
- }
-
-// ---------------------------------------------------------
-//
-// r_radio_region_default
-// Region settings for default region
-//
-// ---------------------------------------------------------
-//
-RESOURCE RADIO_REGION r_radio_region_default
- {
- id = EFMRadioRegionDefault;
- stepsize = 50;
- minfrequency = 87500;
- maxfrequency = 108000;
- decimalcount = 2;
- regionname = qtn_fmradio_reg_other;
- }
--- a/fmradio/fmradioengine/eabi/fmradioengineacu.def Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-EXPORTS
- _ZN12CRadioEngine10CancelScanEv @ 1 NONAME
- _ZN12CRadioEngine11RdsReceiverEv @ 2 NONAME
- _ZN12CRadioEngine11TunePresetLEi @ 3 NONAME
- _ZN12CRadioEngine12SetAudioModeENS_17TFMRadioAudioModeE @ 4 NONAME
- _ZN12CRadioEngine13RadioSettingsEv @ 5 NONAME
- _ZN12CRadioEngine14GetPresetNameLEi @ 6 NONAME
- _ZN12CRadioEngine14SetAudioOutputENS_19TFMRadioAudioOutputE @ 7 NONAME
- _ZN12CRadioEngine14SetTunerModeOnEv @ 8 NONAME
- _ZN12CRadioEngine15InitializeRadioEv @ 9 NONAME
- _ZN12CRadioEngine17IsOfflineProfileLEv @ 10 NONAME
- _ZN12CRadioEngine20SetRdsAfSearchEnableEi @ 11 NONAME
- _ZN12CRadioEngine21GetFrequencyBandRangeERiS0_ @ 12 NONAME
- _ZN12CRadioEngine21GetRTPlusSupportLevelEv @ 13 NONAME
- _ZN12CRadioEngine21SetCurrentPresetIndexEi @ 14 NONAME
- _ZN12CRadioEngine23MusicStoreNoteDisplayedEv @ 15 NONAME
- _ZN12CRadioEngine23SetPresetNameFrequencyLEiRK4TBufILi32EEi @ 16 NONAME
- _ZN12CRadioEngine26GetPresetNameAndFrequencyLEiR6TDes16Ri @ 17 NONAME
- _ZN12CRadioEngine26SetMusicStoreNoteDisplayedEv @ 18 NONAME
- _ZN12CRadioEngine27CancelScanLocalStationsScanEv @ 19 NONAME
- _ZN12CRadioEngine4NewLER31MRadioEngineStateChangeCallback @ 20 NONAME
- _ZN12CRadioEngine4TuneEiNS_10TRadioModeE @ 21 NONAME
- _ZN12CRadioEngine6ScanUpEv @ 22 NONAME
- _ZN12CRadioEngine7RadioOnEv @ 23 NONAME
- _ZN12CRadioEngine8RadioOffEv @ 24 NONAME
- _ZN12CRadioEngine8ScanDownEv @ 25 NONAME
- _ZN12CRadioEngine9IsRadioOnEv @ 26 NONAME
- _ZN12CRadioEngine9SetMuteOnEi @ 27 NONAME
- _ZN12CRadioEngine9SetVolumeEi @ 28 NONAME
- _ZN12CRadioEngineD0Ev @ 29 NONAME
- _ZN12CRadioEngineD1Ev @ 30 NONAME
- _ZN12CRadioEngineD2Ev @ 31 NONAME
- _ZN14CFMRadioPubSub23SetControlEventObserverEP28MFMRadioControlEventObserver @ 32 NONAME
- _ZN14TRadioSettings20IsRdsAfSearchEnabledEv @ 33 NONAME
- _ZN23CFMRadioRdsReceiverBase11AddObserverEP19MFMRadioRdsObserver @ 34 NONAME
- _ZN23CFMRadioRdsReceiverBase14RemoveObserverEP19MFMRadioRdsObserver @ 35 NONAME
- _ZNK12CRadioEngine10GetRegionLEv @ 36 NONAME
- _ZNK12CRadioEngine12DecimalCountEv @ 37 NONAME
- _ZNK12CRadioEngine12GetAudioModeEv @ 38 NONAME
- _ZNK12CRadioEngine12GetMaxVolumeEv @ 39 NONAME
- _ZNK12CRadioEngine12GetRadioModeEv @ 40 NONAME
- _ZNK12CRadioEngine12SetRegionIdLEi @ 41 NONAME
- _ZNK12CRadioEngine14GetAudioOutputEv @ 42 NONAME
- _ZNK12CRadioEngine14GetPresetIndexEv @ 43 NONAME
- _ZNK12CRadioEngine15RegionIdAtIndexEi @ 44 NONAME
- _ZNK12CRadioEngine17FrequencyStepSizeEv @ 45 NONAME
- _ZNK12CRadioEngine17GetTunedFrequencyEv @ 46 NONAME
- _ZNK12CRadioEngine18IsHeadsetConnectedEv @ 47 NONAME
- _ZNK12CRadioEngine19FrequencySetByRdsAfEv @ 48 NONAME
- _ZNK12CRadioEngine19GetPresetFrequencyLEi @ 49 NONAME
- _ZNK12CRadioEngine19IsFlightModeEnabledEv @ 50 NONAME
- _ZNK12CRadioEngine19RequestTunerControlEv @ 51 NONAME
- _ZNK12CRadioEngine19UpdatedStartupCountEv @ 52 NONAME
- _ZNK12CRadioEngine22IsAudioRoutingPossibleEv @ 53 NONAME
- _ZNK12CRadioEngine23FillListWithRegionDataLER12CDesC16Array @ 54 NONAME
- _ZNK12CRadioEngine7PubSubLEv @ 55 NONAME
- _ZNK12CRadioEngine8IsInCallEv @ 56 NONAME
- _ZNK12CRadioEngine8IsMuteOnEv @ 57 NONAME
- _ZNK12CRadioEngine8RegionIdEv @ 58 NONAME
- _ZNK12CRadioEngine9GetVolumeEv @ 59 NONAME
- _ZNK14CFMRadioPubSub13PublishStateLEi @ 60 NONAME
- _ZNK14CFMRadioPubSub17PublishFrequencyLEm @ 61 NONAME
- _ZNK14CFMRadioPubSub19PublishChannelNameLERK7TDesC16 @ 62 NONAME
- _ZNK14CFMRadioPubSub19PublishPresetCountLEi @ 63 NONAME
- _ZNK14CFMRadioPubSub20PublishRDSRadioTextLERK7TDesC16 @ 64 NONAME
- _ZNK14CFMRadioPubSub25PublishRDSProgramServiceLERK7TDesC16 @ 65 NONAME
- _ZNK14CFMRadioPubSub31PublishApplicationRunningStateLE33TFMRadioPSApplicationRunningState @ 66 NONAME
- _ZNK23CFMRadioRdsReceiverBase10RtPlusSongEv @ 67 NONAME
- _ZNK23CFMRadioRdsReceiverBase11RtPlusAlbumEv @ 68 NONAME
- _ZNK23CFMRadioRdsReceiverBase12RtPlusArtistEv @ 69 NONAME
- _ZNK23CFMRadioRdsReceiverBase15SignalAvailableEv @ 70 NONAME
- _ZNK23CFMRadioRdsReceiverBase16ProgrammeServiceEv @ 71 NONAME
- _ZNK23CFMRadioRdsReceiverBase16RtPlusProgramUrlEv @ 72 NONAME
- _ZNK23CFMRadioRdsReceiverBase24ProgrammeServiceNameTypeEv @ 73 NONAME
- _ZNK23CFMRadioRdsReceiverBase25AutomaticSwitchingEnabledEv @ 74 NONAME
- _ZTI12CRadioEngine @ 75 NONAME
- _ZTI14CFMRadioPubSub @ 76 NONAME
- _ZTI18CRadioStateHandler @ 77 NONAME
- _ZTI24CFMRadioPropertyObserver @ 78 NONAME
- _ZTI25CCentralRepositoryHandler @ 79 NONAME
- _ZTI25CFMRadioAccessoryObserver @ 80 NONAME
- _ZTI27CFMRadioSystemEventDetector @ 81 NONAME
- _ZTV12CRadioEngine @ 82 NONAME
- _ZTV14CFMRadioPubSub @ 83 NONAME
- _ZTV18CRadioStateHandler @ 84 NONAME
- _ZTV24CFMRadioPropertyObserver @ 85 NONAME
- _ZTV25CCentralRepositoryHandler @ 86 NONAME
- _ZTV25CFMRadioAccessoryObserver @ 87 NONAME
- _ZTV27CFMRadioSystemEventDetector @ 88 NONAME
-
--- a/fmradio/fmradioengine/group/backup_registration.xml Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" standalone="yes"?>
-<backup_registration version="1.0">
- <proxy_data_manager sid = "0x10202BE9" />
- <restore requires_reboot = "no"/>
-</backup_registration>
-
--- a/fmradio/fmradioengine/group/bld.inf Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project build file for FMRadioEngine
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-// Platforms the component needs to be built on
-//
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-// Source files which are copied to their following destinations
-../inc/fmradiointernalpskeys.h APP_LAYER_PLATFORM_EXPORT_PATH(fmradiointernalpskeys.h)
-
-//Backup registartion file
-backup_registration.xml z:/private/2001b25e/backup_registration.xml
-
-// iby file
-../rom/fmradioengine.iby CORE_APP_LAYER_IBY_EXPORT_PATH(fmradioengine.iby)
-
-../cenrep/2001b25e.txt z:/private/10202be9/2001b25e.txt
-
-
-// *.mmp files required for building the needed component
-//
-PRJ_MMPFILES
-fmradioengine.mmp
-
-
-// *.mmp files required for building any test programs
-//
-//PRJ_TESTMMPFILES
-//../internal/fmradioenginetest/tfmradioengine.mmp
-
-
-
-// End of file
--- a/fmradio/fmradioengine/group/fmradioengine.mmp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
-* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project file for FMRadioEngine
-*
-*/
-
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-#include "../../inc/fmradiovariant.hrh"
-
-TARGET fmradioengine.dll
-TARGETTYPE DLL
-CAPABILITY CAP_GENERAL_DLL ReadUserData
-VENDORID VID_DEFAULT
-UID 0x1000008D 0x2001B25E
-
-VERSION 10.0
-
-PAGED
-
-SOURCEPATH ../data
-START RESOURCE fmradioengine.rss
-HEADER
-TARGETPATH RESOURCE_FILES_DIR
-LANGUAGE_IDS
-END // RESOURCE
-
-
-SOURCEPATH ../src
-SOURCE fmradioaccessoryobserver.cpp
-SOURCE fmradioengine.cpp
-SOURCE fmradioenginecentralrepositoryhandler.cpp
-SOURCE fmradioengineradiosettings.cpp
-SOURCE fmradioengineradiostatehandler.cpp
-SOURCE fmradiomobilenetworkinfolistener.cpp
-SOURCE fmradiopropertyobserver.cpp
-SOURCE fmradiopubsub.cpp
-SOURCE fmradiordsreceiver.cpp
-SOURCE fmradiordsreceiverbase.cpp
-SOURCE fmradiordsreceiversimulator.cpp
-SOURCE fmradioregion.cpp
-SOURCE fmradiosystemeventdetector.cpp
-
-#ifndef __ACCESSORY_FW
-SOURCE fmradioenginedosserverobserver.cpp
-#endif
-
-USERINCLUDE ../cenrep
-USERINCLUDE ../src
-USERINCLUDE ../inc
-USERINCLUDE ../../inc
-
-APP_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE /epoc32/include/mmf/common
-#ifdef __FMRADIO_ADVANCED_AUTO_RESUME
-SYSTEMINCLUDE /epoc32/include/internal
-#endif // __FMRADIO_ADVANCED_AUTO_RESUME
-
-LIBRARY accmonitor.lib
-LIBRARY radio_utility.lib
-LIBRARY fmpresetutility.lib
-LIBRARY cenrepnotifhandler.lib
-LIBRARY centralrepository.lib
-LIBRARY euser.lib
-LIBRARY estor.lib
-LIBRARY audiooutputrouting.lib
-LIBRARY cone.lib
-LIBRARY efsrv.lib
-LIBRARY bafl.lib
-LIBRARY etel.lib
-LIBRARY etelmm.lib
-LIBRARY commsdat.lib
-LIBRARY accclient.lib
-
-DEBUGLIBRARY flogger.lib
-
-#ifdef __ACCESSORY_FW
-DEFFILE fmradioengineac.def
-#endif
--- a/fmradio/fmradioengine/inc/debug.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Central place for nice debug-type macros & functions
-*
-*/
-
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-//INCLUDES
-#include <f32file.h>
-#ifdef _DEBUG
-#define FTRACE(a) {a;}
-#define FDEBUGVAR(a) a
-#else
-#define FTRACE(a)
-#define FDEBUGVAR(a)
-#endif // _DEBUG
-
-
- /**
- * Declare the FPrint function
- * @since Series 60 2.7
- * @return none
- */
-inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
- {
- VA_LIST list;
- VA_START(list,aFmt);
- TInt tmpInt = VA_ARG(list, TInt);
- TInt tmpInt2 = VA_ARG(list, TInt);
- TInt tmpInt3 = VA_ARG(list, TInt);
- VA_END(list);
- #ifdef _DEBUG
- RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3);
- #endif
- }
-
-#endif // DEBUG_H
-
-// End of File
--- a/fmradio/fmradioengine/inc/fmradioaccessoryobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Observer of accessory states.
-*
-*/
-
-
-#ifndef CFMRADIOACCESSORYOBSERVER_H
-#define CFMRADIOACCESSORYOBSERVER_H
-
-#include <AccessoryServer.h>
-#include <AccessoryMode.h>
-#include <AccPolAccessoryMode.h>
-
-class MFMRadioHeadsetEventObserver;
-
-/**
- * Observer of accessory states.
- *
- * Instance of this class observes notifications of headset state changes.
- * In its turn it sends notifications to its observer of those changes.
- *
- */
-class CFMRadioAccessoryObserver : public CActive
- {
-public:
-
- /**
- * C++ default constructor.
- */
- CFMRadioAccessoryObserver();
-
- /**
- * Static constructor.
- */
- static CFMRadioAccessoryObserver* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CFMRadioAccessoryObserver();
-
- /**
- * Sets observer. The observer will be notified when headset has been
- * pressed or headset is connected/disconnected.
- *
- * @param aObserver Observer
- */
- void SetObserver( MFMRadioHeadsetEventObserver* aObserver );
-
- /**
- * Returns accessory connection state.
- *
- * @return <code>ETrue </code> if accessory is connected,
- * <code>EFalse</code> otherwise
- */
- TBool IsHeadsetAccessoryConnected() const;
-
- // from base class CActive
- /**
- * From CActive
- *
- * @see CActive::RunL()
- */
- void RunL();
-
- /**
- * From CActive
- *
- * @see CActive::DoCancel()
- */
- void DoCancel();
-
-protected:
-
-private:
-
- /**
- * By default Symbian 2nd phase constructor is private.
- */
- void ConstructL();
-
-public:
-
-protected:
-
- /**
- * Instance that gets notifications of the headset state changes
- */
- MFMRadioHeadsetEventObserver* iObserver;
-
-private: // Data
-
- /**
- * Session for The Accessory Server.
- */
- RAccessoryServer iAccessoryServer;
-
- /**
- * Accessory Mode sub-session
- */
- RAccessoryMode iAccessoryModeSession;
-
-
- /**
- * Accessory Mode structure, with active audio information.
- */
- TAccPolAccessoryMode iAccPolAccessoryMode;
- TAccPolAccessoryMode iPrevAccMode;
- };
-
-#endif // CFMRADIOACCESSORYOBSERVER_H
-
-
--- a/fmradio/fmradioengine/inc/fmradioaudioutils.hrh Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: FM Radio audio related definitions
-*
-*/
-
-#ifndef FMRADIOAUDIOUTILS_HRH
-#define FMRADIOAUDIOUTILS_HRH
-
-/**
-* Output sources.
-*/
-enum TFMRadioOutputDestination
- {
- EFMRadioHeadset = 0, /**< Headset in use. */
- EFMRadioSpeaker = 1 /**< Speaker in use. */
- };
-
-#endif // FMRADIOAUDIOUTILS_HRH
--- a/fmradio/fmradioengine/inc/fmradiocontroleventobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration for the control event observer interface
-*
-*/
-
-#ifndef MFMRADIOCONTROLEVENTOBSERVER_H
-#define MFMRADIOCONTROLEVENTOBSERVER_H
-
-#include "fmradioaudioutils.hrh"
-#include "fmradiosystemutils.h"
-
-/**
- * MFMRadioControlEventObserver
- *
- * MFMRadioControlEventObserver defines observer interface for FM Radio control events.
- */
-class MFMRadioControlEventObserver
- {
-
-public:
-
- /**
- * Called when "step to channel" request occurs.
- *
- * @param aDirection EFMRadioUp for stepping up, EFMRadioDown for stepping down
- */
- virtual void StepToChannelL( TFMRadioTuneDirection aDirection ) = 0;
-
- /**
- * Called when "set channel" request occurs.
- *
- * @param aChannelId Channel id to set
- */
- virtual void SetChannelL( TInt aChannelId ) = 0;
-
- /**
- * Called when "seek" request occurs.
- *
- * @param aDirection If EFMRadioUp seeks up, otherwise seeks down
- */
- virtual void SeekL( TFMRadioTuneDirection aDirection ) = 0;
-
- /**
- * Called when "step to frequency up" request occurs.
- *
- * @param aDirection EFMRadioUp for stepping up, EFMRadioDown for stepping down
- */
- virtual void StepToFrequencyL( TFMRadioTuneDirection aDirection ) = 0;
-
- /**
- * Called when "set frequency" request occurs.
- *
- * @param aFreq Frequency to set
- */
- virtual void SetFrequencyL( TUint32 aFreq ) = 0;
-
- /**
- * Called when "adjust volume" request occurs.
- *
- * @param aDirection If EFMRadioDecVolume decreases, otherwise increases
- * volume
- */
- virtual void AdjustVolumeL( TFMRadioVolumeSetDirection aDirection ) = 0;
-
- /**
- * Called when "mute" request occurs.
- *
- * @param aMute if ETrue mutes, else unmutes radio
- */
- virtual void MuteL( TBool aMute ) = 0;
-
- /**
- * Called when "play" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void PlayL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "pause" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void PauseL(TBool aDownPressed ) = 0;
-
- /**
- * Called when "play", "pause" or "pauseplay" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void PausePlayL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "stop" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void StopL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "forward" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void ForwardL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "fast forward" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void FastForwardL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "backward" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void BackwardL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "rewind" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void RewindL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "channel up" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void ChannelUpL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "channel down" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void ChannelDownL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "volume up" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void VolumeUpL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "volume down" request occurs.
- *
- * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
- */
- virtual void VolumeDownL( TBool aDownPressed ) = 0;
-
- /**
- * Called when "change view" request occurs
- *
- * @param aViewId the id of activated view
- * @param aForceChange if ETrue, view changing is forced and state
- * of FM Radio is not checked
- */
- virtual void ChangeViewL(TUid aViewId, TBool aForceChange) = 0;
-
- /**
- * Called when output source is changed
- * @param aDestination the current output source
- */
- virtual void SetAudioOutputDestinationL(TFMRadioOutputDestination aDestination) = 0;
-
- /**
- * Called when headset button answer/end call is pressed
- */
- virtual void AnswerEndCallL() = 0;
- };
-
-#endif // MFMRADIOCONTROLEVENTOBSERVER_H
-
-
--- a/fmradio/fmradioengine/inc/fmradioengine.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,848 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The class implements the core functionality of the
-* Radio Engine
-*
-*/
-
-
-#ifndef FMRADIOENGINE_H
-#define FMRADIOENGINE_H
-
-#include <e32base.h>
-#include <AccMonitorCapabilities.h>
-#include <fmradiointernalpskeys.h>
-#include <RadioUtility.h>
-#include <RadioFmTunerUtility.h>
-#include <RadioPlayerUtility.h>
-#include <RadioPresetUtility.h>
-#include <RadioFmPresetUtility.h>
-#include <etelmm.h>
-
-#include "fmradiosystemeventdetectorobserver.h"
-#include "fmradionetworkchangeobserver.h"
-#include "fmradiordsobserver.h"
-#include "fmradioengine.hrh"
-#include "fmradioheadseteventobserver.h"
-
-#ifndef __ACCESSORY_FW
-#include <DosSvrServices.h>
-#endif
-
-// CONSTANTS
-const TUint8 KPresetNameLength = 32;
-const TInt KDefaultRadioFrequency = 87500000;
-_LIT(KFMRadioEngineResourceFile, "fmradioengine.rsc");
-const TInt KFMRadioFreqMultiplier = 1000;
-
-// FORWARD DECLARATIONS
-class CAudioOutput;
-class CCentralRepositoryHandler;
-class CDesC16Array;
-class CFMRadioAccessoryObserver;
-class CFMRadioContextPublisher;
-class CFMRadioMobileNetworkInfoListener;
-class CFMRadioPubSub;
-class CFMRadioRdsReceiverBase;
-class CFMRadioSystemEventDetector;
-class CRadioStateHandler;
-class MRadioEngineStateChangeCallback;
-class TRadioSettings;
-
-#ifndef __ACCESSORY_FW
-class RDosServer;
-class CDosServerObserver;
-#endif
-
-// CLASS DECLARATION
-
-/**
- * This class implements the core functionality of the Radio Engine
- *
- * @since S60 3.2
- */
-class CRadioEngine : public CBase,
- public MRadioPlayerObserver,
- public MRadioFmTunerObserver,
- public MRadioPresetObserver,
- public MFMRadioSystemEventDetectorObserver,
- public MFMRadioNetworkChangeObserver,
- public MFMRadioRdsObserver,
- public MFMRadioHeadsetEventObserver
-
- {
-public:
-
- typedef TBuf<KPresetNameLength> TStationName;
-
- enum TRadioMode
- {
- ERadioTunerMode,
- ERadioPresetMode
- };
-
- enum TFMRadioAudioMode
- {
- EFMRadioStereo = 0,
- EFMRadioMono
- };
-
- enum TFMRadioAudioOutput
- {
- EFMRadioOutputHeadset = 0,
- EFMRadioOutputIHF
- };
-
-public:
-
- /**
- * Two-phased class constructor.
- * @return pointer to CRadioEngine class instance
- */
- IMPORT_C static CRadioEngine* NewL( MRadioEngineStateChangeCallback& aCallback );
- /**
- * Destructor of CRadioEngine class.
- */
- IMPORT_C virtual ~CRadioEngine();
-
-public: // New functions
-
- /**
- * Set radio settings to their default values.
- * @since Series 60 3.0
- * @return none
- */
- IMPORT_C void InitializeRadio();
- /**
- * Retrieves the current radio mode .
- * @since Series 60 3.0
- * @return tune/preset
- */
- IMPORT_C TRadioMode GetRadioMode() const;
-
- /**
- * Gets the current audio mode.
- * @since Series 60 3.0
- * @return stereo/mono
- * @retval 0 = stereo
- * @retval 1 = mono
- */
- IMPORT_C TInt GetAudioMode() const;
-
- /**
- * Set the radio's audio mode.
- * @since Series 60 3.0
- * @param aAudioMode the new audio mode
- * @return none
- */
- IMPORT_C void SetAudioMode( const TFMRadioAudioMode aAudioMode );
-
- /**
- * get the currently selected channel index.
- * @since Series 60 3.0
- * @return none
- */
- IMPORT_C TInt GetPresetIndex() const;
-
- /**
- * Update the channel located at the index to use the frequency specified.
- * @since Series 60 3.0
- * @param aIndex index into the channel array.
- * @param aStationName name of the channel
- * @param aFrequency frequency value to be used.
- * @return none
- */
- IMPORT_C void SetPresetNameFrequencyL( TInt aIndex, const TStationName& aStationName, TInt aFrequency );
-
- /**
- * Retrieve the channel frequency at the index specified
- * @since Series 60 3.0
- * @param aIndex index into the channel array.
- * @return the frequency
- */
- IMPORT_C TInt GetPresetFrequencyL(TInt aIndex) const;
-
- /**
- * Retrieve the channel name at the index specified
- * @since Series 60 3.0
- * @param aIndex index into the channel array.
- * @return the channel name
- */
- IMPORT_C CRadioEngine::TStationName& GetPresetNameL( TInt aIndex );
-
- /**
- * Retrieve the channel name and the frequency at the index specified
- * @param aIndex station index
- * @param aName stored station name
- * @param aFrequency preset frequency
- */
- IMPORT_C void GetPresetNameAndFrequencyL( TInt aIndex, TDes& aName, TInt& aFrequency );
-
- /**
- * Starts the radio.
- * @since Series 60 3.0
- * @return none
- */
- IMPORT_C void RadioOn();
-
- /**
- * Stops the radio.
- * @since Series 60 3.0
- * @return none
- */
- IMPORT_C void RadioOff();
-
- /**
- * Returns the radio status
- * @since ??
- * @return ETrue = radio is on, EFalse = radio is off
- */
- IMPORT_C TBool IsRadioOn();
-
- /**
- * Checks if offine profile is current active profile
- * @since ??
- * @return True / False
- */
- IMPORT_C TBool IsOfflineProfileL();
-
- /**
- * Tune to the specified frequency
- * @since Series 60 3.0
- * @param aFrequency - frequency to lock onto.
- * @param aRadioMode - The radio mode to be used. Tuner mode by default
- * @return none
- */
- IMPORT_C void Tune( TInt aFrequency, TRadioMode aRadioMode = ERadioTunerMode );
-
- /*
- * Sets tuner mode on i.e. preset channel is not active.
- * Active preset Channel P&S data is also cleared.
- * Useful for example when preset channel is deleted.
- */
- IMPORT_C void SetTunerModeOn();
-
- /**
- * Scan up to the next available frequency.
- * @since Series 60 3.0
- * @return none
- */
- IMPORT_C void ScanUp();
-
- /**
- * Scan down to the last available frequency.
- * @since Series 60 3.0
- * @return none
- */
- IMPORT_C void ScanDown();
-
- /**
- * Cancel previously requested scan, and
- * return to the already tuned frequency.
- * @since Series 60 3.0
- * @return none
- */
- IMPORT_C void CancelScan();
-
- /**
- * Sets the audio mute state
- * @since Series 60 3.0
- * @param aMuteOn - flag to determine whether mute should be turned on or off
- * @return none
- */
- IMPORT_C void SetMuteOn(TBool aMuteOn);
-
- /**
- * Gets the audio mute state
- * @since Series 60 3.0
- * @return ETrue or EFalse to indicate whether mute is currently on.
- */
- IMPORT_C TBool IsMuteOn() const;
-
- /**
- * Sets the volume level of the FM radio
- * @since Series 60 3.0
- * @param aVolume - the volume to be used.
- * @return none
- */
- IMPORT_C void SetVolume(TInt aVolume);
-
- /**
- * Gets the volumelevel.
- * @since Series 60 3.0
- * @return the current volume
- */
- IMPORT_C TInt GetVolume() const;
-
- /**
- * Gets the max volumelevel.
- * @since Series 60 3.0
- * @return the max volume
- */
- IMPORT_C TInt GetMaxVolume() const;
-
- /**
- * Sets the audio Output
- * @since Series 60 3.0
- * @param aAudioOutput - where should the audio be routed?
- * @return none
- */
- IMPORT_C void SetAudioOutput( const TFMRadioAudioOutput aAudioOutput );
-
- /**
- * Sets the rds af search enabled
- * @param aEnabled ETrue if rds af search is enabled; EFalse otherwise.
- * @return none
- */
- IMPORT_C void SetRdsAfSearchEnable( TBool aEnabled );
-
- /**
- * Check whether flight mode is currently enabled
- * @since Series 60 3.0
- * @return ETrue or EFalse dependent on whether flightmode is enabled
- */
- IMPORT_C TBool IsRdsAfSearchEnabled() const;
-
- /**
- * @return reference to settings
- */
- IMPORT_C TRadioSettings& RadioSettings( );
-
- /**
- * Retrieve the current audio output
- * @since Series 60 3.0
- * @return EFMRadioOutputIHF or EFMRadioOutputHeadset
- */
- IMPORT_C TFMRadioAudioOutput GetAudioOutput() const;
-
- /**
- * Tunes to the chosen channel.
- * @since Series 60 3.0
- * @param aIndex - the index number of the channel you wish to tune to.
- * @return none
- */
- IMPORT_C void TunePresetL(TInt aIndex);
-
- /**
- * Retrieves the current frequency.
- * @since Series 60 3.0
- * @return the frequency
- */
- IMPORT_C TInt GetTunedFrequency() const;
-
- /**
- * Check whether flight mode is currently enabled
- * @since Series 60 3.0
- * @return ETrue or EFalse dependent on whether flightmode is enabled
- */
- IMPORT_C TBool IsFlightModeEnabled() const;
-
- /**
- * Get the frequency range (in Hertz) of the specified band.
- * This function should be used to enquire the frequency range
- * of the bands that GetCapabilities reports as supported.
- * @since Series 60 3.0
- * @param aBottomFrequency The variable to set to the lowest frequency allowed
- * @param aTopFrequency The variable to set to the highest frequency allowed
- * @return A standard system error code
- **/
- IMPORT_C TInt GetFrequencyBandRange( TInt& aBottomFrequency, TInt& aTopFrequency );
-
- /**
- * Check whether call is in progress
- * @since Series 60 3.1
- * @return ETrue or EFalse to indicate whether call is in progress
- */
- IMPORT_C TBool IsInCall() const;
-
- /**
- * Has the frequency been set by RDS AF search or not.
- *
- * @return ETrue if frequency was set by RDS AF, otherwise EFalse
- */
- IMPORT_C TBool FrequencySetByRdsAf() const;
-
- /**
- * Getter for RDS receiver
- *
- * @return Reference to CFMRadioRdsReceiver
- */
- IMPORT_C CFMRadioRdsReceiverBase& RdsReceiver();
- /**
- * Notifies UI that the headset button has been pressed
- */
- void HandleHeadsetButtonPress();
- /**
- * Switches the engine into flight mode, and notifies the UI of
- * the change in status.
- */
- void HandleFlightModeEnabled();
- /**
- * Switches the engine out of flight mode, and notifies the UI of
- * the change in status
- */
- void HandleFlightModeDisabled();
- /**
- * Calls the User Interface callback function, indicating the event code and
- * error code.
- */
- void HandleCallback(TInt aEventCode, TInt aErrorCode );
-
- /**
- * Gets the headset status
- * @return ETrue if headset connected
- */
- IMPORT_C TBool IsHeadsetConnected() const;
-
- /**
- * From MRadioPlayerObserver.
- * Called when Radio state changed.
- *
- * @since S60 3.2
- * @param aState Radio player state
- * @param aError A standard system error code, only used when aState is ERadioPlayerIdle
- */
- void MrpoStateChange( TPlayerState aState, TInt aError );
-
- /**
- * From MRadioPlayerObserver.
- * Called when volume changes. This may be caused by other applications.
- *
- * @since S60 3.2
- * @param aVolume Current volume.
- */
- void MrpoVolumeChange( TInt aVolume );
-
- /**
- * From MRadioPlayerObserver.
- * Called when mute setting changes. This may be caused by other applications.
- *
- * @since S60 3.2
- * @param aMute ETrue indicates audio is muted.
- */
- void MrpoMuteChange( TBool aMute );
-
- /**
- * From MRadioPlayerObserver.
- * Called when mute setting changes. This may be caused by other applications.
- *
- * Called when balance setting changes. This may be caused by other applications.
- *
- * @since S60 3.2
- * @param aLeftPercentage
- * Left speaker volume percentage. This can be any value from zero to 100.
- * Zero value means left speaker is muted.
- * @param aRightPercentage
- * Right speaker volume percentage. This can be any value from zero to 100.
- * Zero value means right speaker is muted.
- */
- void MrpoBalanceChange( TInt aLeftPercentage, TInt aRightPercentage );
-
-
- /**
- * From MRadioFmTunerObserver.
- * Called when Request for tuner control completes.
- *
- * @since S60 3.2
- * @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
- */
- void MrftoRequestTunerControlComplete( TInt aError );
-
- /**
- * From MRadioFmTunerObserver.
- * Set frequency range complete event. This event is asynchronous and is received after
- * a call to CRadioFmTunerUtility::SetFrequencyRange.
- *
- * @since S60 3.2
- * @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
- */
- void MrftoSetFrequencyRangeComplete( TInt aError );
-
- /**
- * From MRadioFmTunerObserver.
- * Set frequency complete event. This event is asynchronous and is received after a call to
- * CRadioFmTunerUtility::SetFrequency.
- *
- * @since S60 3.2
- * @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
- */
- void MrftoSetFrequencyComplete( TInt aError );
-
- /**
- * From MRadioFmTunerObserver.
- * Station seek complete event. This event is asynchronous and is received after a call to
- * CRadioFmTunerUtility::StationSeek.
- *
- * @since S60 3.2
- * @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
- * @param aFrequency The frequency(Hz) of the radio station that was found.
- */
- void MrftoStationSeekComplete( TInt aError, TInt aFrequency );
-
- /**
- * From MRadioFmTunerObserver.
- * Called when FM Transmitter status changes (if one is present in the device). Tuner receiver
- * is forced to be turned off due to hardware conflicts when FM transmitter is activated.
- *
- * @since S60 3.2
- * @param aActive ETrue if FM transmitter is active; EFalse otherwise.
- */
- void MrftoFmTransmitterStatusChange( TBool aActive );
-
- /**
- * From MRadioFmTunerObserver.
- * Called when antenna status changes.
- *
- * @since S60 3.2
- * @param aAttached ETrue if antenna is attached; EFalse otherwise.
- */
- void MrftoAntennaStatusChange( TBool aAttached );
-
- /**
- * From MRadioFmTunerObserver.
- * Called when offline mode status changes.
- * @since S60 3.2
- *
- * @param aOfflineMode ETrue if offline mode is enabled; EFalse otherwise.
- */
- void MrftoOfflineModeStatusChange( TBool aOfflineMode );
-
- /**
- * From MRadioFmTunerObserver.
- * Called when the frequency range changes. This may be caused by other applications.
- *
- * @since S60 3.2
- * @param aBand New frequency range.
- */
- void MrftoFrequencyRangeChange(TFmRadioFrequencyRange aBand );
-
- /**
- * From MRadioFmTunerObserver.
- * Called when the tuned frequency changes. This may be caused by other
- * applications or RDS if AF/TA is enabled.
- *
- * @since S60 3.2
- * @param aNewFrequency The new tuned frequency(Hz).
- */
- void MrftoFrequencyChange( TInt aNewFrequency );
-
- /**
- * From MRadioFmTunerObserver.
- * Called when the forced mono status change. This may be caused by other applications.
- *
- * @since S60 3.2
- * @param aForcedMono ETrue if forced mono mode is enabled; EFalse otherwise.
- */
- void MrftoForcedMonoChange( TBool aForcedMono );
-
- /**
- * From MRadioFmTunerObserver.
- * Called when the squelch (muting the frequencies without broadcast) status change.
- * This may be caused by other applications.
- *
- * @since S60 3.2
- * @param aSquelch ETrue if squelch is enabled; EFalse otherwise.
- */
- void MrftoSquelchChange( TBool aSquelch );
-
- /**
- * From MRadioPresetObserver.
- * Called when a preset changes.
- *
- * NOTE: EPresetDeleted with aIndex == 0, indicates that all presets have been deleted.
- *
- * @since S60 3.2
- * @param aChange Change event type
- * @param aIndex Index to the preset that has changed. Zero means all presets.
- */
- void MrpeoPresetChanged( TPresetChangeEvent aChange, TInt aIndex );
- /**
- * From base class MFMRadioSystemEventDetectorObserver
- * This callback notifies when networks comes up.
- */
- void NetworkUpCallbackL();
- /**
- * From base class MFMRadioSystemEventDetectorObserver
- * This callback notifies when network goes down.
- */
- void NetworkDownCallbackL();
-
- /**
- * From base class MFMRadioSystemEventDetectorObserver
- * This callback notifies when audio resources become available.
- */
- void AudioResourcesAvailableL();
-
- /**
- * From base class MFMRadioSystemEventDetectorObserver
- * This callback notifies when audio auto resuming is forbidden.
- */
- void AudioAutoResumeForbiddenL();
- /**
- * From base class MFMRadioSystemEventDetectorObserver
- * This callback notifies when call becomes active.
- */
- void CallActivatedCallbackL();
-
- /**
- * From base class MFMRadioSystemEventDetectorObserver
- * This callback notifies when call becomes deactive.
- */
- void CallDeactivatedCallbackL();
- /**
- * From base class MFMRadioNetworkChangeObserver
- *
- * @see MFMRadioNetworkChangeObserver::NetworkIdChanged();
- */
- void NetworkIdChanged();
-
- // from base class MFMRAdioRdsObserver
- void RdsDataProgrammeService( const TDesC& aProgramService );
- void RdsDataPsNameIsStatic( TBool aStatic );
- void RdsDataRadioText( const TDesC& aRadioText );
- void RdsDataRadioTextPlus( const TInt aRTPlusClass, const TDesC& aRadioTextPlus );
-
- void RdsAfSearchBegin();
- void RdsAfSearchEnd( TUint32 aFrequency, TInt aError );
- void RdsAfSearchStateChange( TBool aEnabled );
- void RdsAvailable( TBool aAvailable );
-
- // from MFMRadioHeadsetEventObserver
- void HeadsetAccessoryConnectedCallbackL();
- void HeadsetAccessoryDisconnectedCallbackL();
-
- /**
- * Initialize fmradioengine resource file information
- */
- void InitializeResourceLoadingL();
- /**
- * Convert FMRadio region info to frequency range used by fmradiotunerutility
- * @param aRegionId fmradio region
- * @return frequency range used by fmradiotunerutility
- */
- TFmRadioFrequencyRange TunerFrequencyRangeForRegionId( const TInt aRegionId ) const;
- /**
- * Determine current region
- * @return fmradio region
- */
- IMPORT_C TFMRadioRegionSetting GetRegionL() const;
- /**
- * fill the given list with fmradio regions
- * @param aArray array to add regions
- */
- IMPORT_C void FillListWithRegionDataL( CDesC16Array& aArray ) const;
- /**
- * Returns region from the array of supported regions
- * @param aIndex index for region
- * @return fmradio region
- */
- IMPORT_C TFMRadioRegionSetting RegionIdAtIndex( const TInt aIndex ) const;
- /**
- * Returns current region Id
- * @return current region Id.
- */
- IMPORT_C TInt RegionId() const;
- /**
- * Change current region
- * @param aRegion region to set
- */
- IMPORT_C void SetRegionIdL( TInt aRegion ) const;
- /**
- * Request tuner control from fmradiotunerutility
- */
- IMPORT_C void RequestTunerControl() const;
- /**
- * Returns decimal count for current region MHz information
- * @return decimal count for current region
- */
- IMPORT_C TInt DecimalCount() const;
- /**
- * Return step size for tuning.
- * @return step size
- */
- IMPORT_C TUint32 FrequencyStepSize() const;
- /**
- * Returns a reference to P&S interface.
- * Method leaves if iPubSub is not allocated
- *
- * @return PS& interface.
- */
- IMPORT_C CFMRadioPubSub& PubSubL() const;
- /**
- * increases startup count by one and returns amount of app startups.
- *
- * @return app startup count
- */
- IMPORT_C TInt UpdatedStartupCount() const;
- /**
- * Cancel seek and notify UI
- */
- IMPORT_C void CancelScanLocalStationsScan();
- /**
- * Is routing between loudspeaker and headset possible
- *
- * @return ETrue, if routing is possible
- */
- IMPORT_C TBool IsAudioRoutingPossible() const;
-
- /**
- * Has RT+ interaction tutorial dialog been shown to user.
- *
- * @return ETrue after the first time user sees the dialog.
- */
- IMPORT_C TBool MusicStoreNoteDisplayed();
-
- /**
- * Sets music store tutorial note displayed value to true.
- * It needs to be false only before supported RT+ features
- * become available for the first time.
- */
- IMPORT_C void SetMusicStoreNoteDisplayed();
-
- /**
- * Get level of support for RT+ interactions.
- * Values are defined in fmradioengine.hrh:TFMRadioRTPlusLevel.
- *
- * @return which interactions are supported as a TFMRadioRTPlusLevel value
- */
- IMPORT_C TFMRadioRTPlusLevel GetRTPlusSupportLevel();
-
- /**
- * Sets the currently active preset index
- * @param aIndex new active preset index
- */
- IMPORT_C void SetCurrentPresetIndex( const TInt aIndex );
-
-private:
-
- /**
- * Default class constructor.
- */
- CRadioEngine( MRadioEngineStateChangeCallback& aCallback );
-
- /**
- * Second phase class constructor.
- */
- void ConstructL();
-
- /**
- * ConnectLineL
- */
- void ConnectLineL();
-
- /**
- * Updates the frequency into settings and P&S
- *
- * @param aFrequency The frequency to be set
- */
- void StoreAndPublishFrequency( TInt aFrequency );
-
- /**
- * Scans all current presets and sets stored frequencies to KErrNotFound
- * if the preset name is empty.
- */
- void ResetPresetsL();
-
- /**
- * Resolves if BT audio accessory is connected
- * @return ETrue if BT Audio connected
- */
- TBool IsBTAccessoryConnectedL();
-private:
-
- //the internal radio engine states
- enum TRadioEngineState
- {
- EStateRadioOff,
- EStateRadioOn,
- };
-
- // The Radio Utility
- CRadioUtility* iRadioUtility; // own
- // The Tuner Utility
- CRadioFmTunerUtility* iFmTunerUtility;
- // The Player Utility
- CRadioPlayerUtility* iPlayerUtility;
- // The Preset Utility
- CRadioFmPresetUtility* iPresetUtility; // own
- // Receives and notifies of the RDS data
- CFMRadioRdsReceiverBase* iRdsReceiver;
- // Capabilities of the tuner
- TFmTunerCapabilities iTunerCaps;
- // Multiplier used to scale UI volume setting to volume level used by the player utility
- TReal iUiVolumeFactor;
- // pointer to DosServerObserver
-#ifndef __ACCESSORY_FW
- CDosServerObserver *iDosServerObserver; //own
-#endif
- // Audio routing API
- CAudioOutput* iAudioOutput; //own
- // pointer to CCentralRepositoryHandler
- CCentralRepositoryHandler* iCentralRepositoryHandler; // own
- // Used to provide async behavior in some callbacks
- CRadioStateHandler *iStateHandler;
- // flag to indicate if auto resume is supported
- TBool iAutoResume;
- // flag to indicate if a call is in progress
- TBool iInCall;
- // pointer to TRadioSettings
- TRadioSettings* iRadioSettings; // own
- // the current radio state
- TRadioEngineState iCurrentRadioState;
- // a reference of MRadioEngineStateChangeCallback object
- MRadioEngineStateChangeCallback& iCallback;
- // temperary frequency
- TInt iTempFrequency;
- // a flag indicating if tune prset is requestd
- TBool iTunePresetRequested;
- // Indicates a request to initialized the radio is pending
- TBool iInitializeRadioRequestExists;
- // Indicates if the tuner control has been granted.
- TBool iTunerControl;
- // High and low frequency of the current band.
- TInt iBottomFrequency;
- TInt iTopFrequency;
- // ETrue if frequency was set by RDS AF
- TBool iFrequencySetByRdsAf;
- //Listens changes in network availability
- CFMRadioSystemEventDetector* iSystemEventDetector;
- // for fmradio engine resource file
- TInt iFMRadioEngineResourceOffset;
- //Listens changes in network ID and country code
- CFMRadioMobileNetworkInfoListener* iNetworkInfoListener;
- //P&S interaction interface for FMRadio actions.
- CFMRadioPubSub* iPubSub;
- // accessory observer
- CFMRadioAccessoryObserver* iHeadsetObserver;
- // tel server session
- RTelServer iTelServer;
- // phone
- RMobilePhone iPhone;
- // line
- RMobileLine iLine;
- // tsy name
- TFileName iTsyName;
- // conrrectly constructer
- TBool ilineConstructed;
- // for storing station name for method GetPresetNameL
- TStationName iStationName;
- // Local cache for tuning state so that it doesn't get published before should
- TFMRadioPSTuningState iTuningState;
- // If last time audio is set to IHF with no headset connected.
- TBool iHFOptionActivated;
- };
-
-#endif //FMRADIOENGINE_H
-
-// End of file
--- a/fmradio/fmradioengine/inc/fmradioengine.hrh Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration of radio related enumerations
-*
-*/
-
-
-#ifndef FMRADIOENGINE_HRH
-#define FMRADIOENGINE_HRH
-
-/** Regions*/
-enum TFMRadioRegionSetting
- {
- EFMRadioRegionNone = -1,
- EFMRadioRegionDefault,
- EFMRadioRegionJapan,
- EFMRadioRegionAmerica,
- EFMRadioRegionPoland
- };
-
-enum TFMRadioRTPlusLevel
- {
- EFMRadioMusicStoreOnly = 0,
- EFMRadioAllInteractions
- };
-
-#endif // FMRADIOENGINE_HRH
--- a/fmradio/fmradioengine/inc/fmradioenginecentralrepositoryhandler.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Defines APIs to communicate with Central Repository
-*
-*/
-
-
-#ifndef FMRADIOENGINECENTRALREPOSITORYHANDLER_H
-#define FMRADIOENGINECENTRALREPOSITORYHANDLER_H
-
-// INCLUDES
-#include "fmradioregion.h"
-
-// CONSTANTS
-const TInt KBufferLength = 20;
-const TInt KStreamBufferSize = 100;
-
-// Forward declare implementation class
-class TRadioSettings;
-class CRepository;
-
-// CLASS DECLARATION
-
-/**
-* it is a wrapper of Central Repository, responsible for the operations that need to access
-* the central respositorhy.
-*
-* @lib FMRadioEngine.lib
-* @since Series 60 3.0_version
-*/
-class CCentralRepositoryHandler : public CBase
- {
- public:
- /**
- * Two-phased class constructor.
- * @param aRadioSettings pointer to the CRadioSettings class
- */
- static CCentralRepositoryHandler* NewL(TRadioSettings& aRadioSettings);
- /**
- * Destructor of CCentralRepositoryHandler class.
- */
- virtual ~CCentralRepositoryHandler();
- public:
- /**
- * Save all engine related persistent info back to Central Repository
- * @since Series 60 3.0
- * @return none
- */
- void SaveEngineSettings();
-
- TInt CountRegions() const;
- CFMRadioRegion& Region( TInt aIndex ) const;
- TInt RegionId() const;
- TUint32 FrequencyStepSize() const;
- TUint32 MaxFrequency() const;
- TUint32 MinFrequency() const;
- TInt DecimalCount() const;
-
- void SetRegionIdL( TInt aRegion );
-
- /**
- * Determines if RT+ interaction tutorial dialog has been shown.
- * See CFMRadioEngine::MusicStoreNoteDisplayed().
- */
- TBool MusicStoreNoteDisplayed();
- /**
- * Sets RT+ interaction tutorial dialog as displayed.
- * See CFMRadioEngine::SetMusicStoreNoteDisplayed().
- */
- void SetMusicStoreNoteDisplayed();
- /**
- * Gets supported RT+ interactions. See CFMradioEngine::GetRTPlusSupportLevel().
- */
- TInt GetRTPlusSupportLevel();
-
- /**
- * Checks if offine profile is current active profile
- * @return true/false
- */
- TBool IsOfflineProfileActiveL();
- /**
- * Increases startup time by one and returns amount of program startups.
- * Also updates count to the repository.
- */
- void IncreaseStartupCount() const;
- /*
- * Save headset volume level to the repository
- */
- void SaveHeadsetVolumeSetting() const;
- /*
- * Save speaker volume level to the repository
- */
- void SaveSpeakerVolumeSetting() const;
-
- private:
- /**
- * Default class constructor.
- * @param aRadioSettings - pointer to the CRadioSettings class
- */
- CCentralRepositoryHandler(TRadioSettings& aRadioSettings);
- /**
- * Second phase class constructor.
- */
- void ConstructL();
- /**
- * Retrieves persistent settings from Central Repository.
- */
- void RetrieveInitialSettings();
- /**
- * Initializes the regions as defined in the resource file.
- */
- void InitializeRegionsL();
-
- /**
- * Converts Region ID to index
- *
- * @param aRegionId The region ID that is wanted to convert
- * @return The region index, KErrNotFound if no match found
- */
- TInt RegionIndexForId( TInt aRegionId ) const;
-
- /**
- * Updates the current region index
- *
- * @param aRegionId The new region ID
- */
- void UpdateCurrentRegionIdx( TInt aRegionId );
- /*
- * Set emulator networkinfo
- *
- */
- #ifdef __WINS__
- void SetInitialSettings();
- #endif //__WINS__
- /**
- * Checks if frequency is in the current region range
- *
- * @param aFrequency Frequency to check
- */
- TBool IsFrequencyValid( TUint32 aFrequency ) const;
-
- private: // data
-
- // Handle to Central Repository server
- CRepository* iCentralRepository;
- // Reference to RadioSetting object
- TRadioSettings* iRadioSettings;
- /** The current region. */
- TInt iCurrentRegionIdx;
- /** The available regions. */
- RPointerArray<CFMRadioRegion> iRegions;
-
-
-
- };
-
-#endif // FMRADIOENGINECENTRALREPOSITORYHANDLER_H
-
-// end of file
--- a/fmradio/fmradioengine/inc/fmradioenginecrkeys.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definition of central repository keys for FM Radio Engine.
-*
-*/
-
-
-#ifndef FMRADIOENGINECRKEYS_H
-#define FMRADIOENGINECRKEYS_H
-
-// FM Radio Engine UID
-const TUid KCRUidFMRadioEngine = {0x2001B25E};
-
-// Radio headset volume
-const TUint32 KRadioHeadsetVolume = 0x00000001;
-
-// Radio speaker volume
-const TUint32 KRadioSpeakerVolume = 0x00000002;
-
-// The last played radio frequency
-const TUint32 KFmRadioFrequency = 0x00000003;
-
-// The last played radio channel
-const TUint32 KFmRadioChannel = 0x00000004;
-
-// The radio mode before radio off
-const TUint32 KFmRadioMode = 0x00000005;
-
-// Country code + network ID
-const TUint32 KFMRadioCREmulatorNetworkInfo = 0x00000006;
-
-// number of startups
-const TUint32 KRadioCRStartupCount = 0x00000007;
-
-// currently active region
-const TUint32 KFMCRCurrentRegion = 0x00000008;
-
-// Japan region support on/off
-const TUint32 KFMCRJapanRegionAllowed = 0x00000050;
-
-// Rds af seacrh enabled
-const TUint32 KFMCRRdsAfSearchEnabled = 0x00000009;
-
-// The first preset channel's location in central repository
-const TUint32 KFmRadioPresetChannel1 = 0x0000000A;
-
-// Is note "'Music Store' got enabled..." viewed already?
-const TUint32 KRadioMusicStoreNoteDisplayed = 0x0000000B;
-
-// Which RT+ interactions are supported?
-const TUint32 KRadioRTPlusSupportLevel = 0x0000000C;
-
-// Application UID of the song recognition service
-const TUint32 KFmRadioSongRecognitionUid = 0x0000000D;
-
-#endif // FMRADIOENGINECRKEYS_H
-
-// End of file
-
-
--- a/fmradio/fmradioengine/inc/fmradioenginedosserverobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Contains implementation of the CDosServerObserver class. which is the
-* notification interface to the DOS Server.
-*
-*/
-
-#ifndef __DOSSERVEROBSERVER_H
-#define __DOSSERVEROBSERVER_H
-
-// INCLUDES
-#include <DosSvrServices.h>
-
-#include "fmradioengineradiosettings.h"
-
-class CRadioEngine;
-
-// CLASS DECLARATION
-
-/**
-* This class implements theis the notification interface to the DOS Server.
-*/
-class CDosServerObserver : public CDosEventListenerBase
- {
- public:
- virtual ~CDosServerObserver();
- /**
- * Two-phased class constructor.
- * @param aEngine - pointer to the CRadioEngine instance (used for callbacks)
- * @param aRadioSettings - pointer to the CRadioSettings class
- * @return pointer to CDosServerObserver class instance
- */
- static CDosServerObserver* NewL(CRadioEngine* aEngine, TRadioSettings* aRadioSettings);
-
- /**
- * Sets the current audio routing.
- * @param aAudioOutput Audio output to be used
- * @return Symbian error code
- */
-
- TInt SetAudioRouting(CRadioEngine::TFMRadioAudioOutput aAudioOutput);
-
- /**
- * From CDosEventListenerBase
- * It notifies about a headset button state change
- * @param aState State of button
- */
- void HeadsetButtonChangedL(EPSButtonState aState);
-
- private:
- /**
- * Default class constructor.
- * @param aEngine - pointer to the CRadioEngine instance (used for callbacks)
- * @param aRadioSettings - pointer to the CRadioSettings class
- */
- CDosServerObserver(CRadioEngine* aEngine, TRadioSettings* aRadioSettings);
- /**
- * Second phase class constructor.
- */
- void ConstructL();
-
- private:
- CRadioEngine *iEngine;
- TRadioSettings *iRadioSettings;
- RDosAudio iDosAudio;
- };
-
-#endif // __DOSSERVEROBSERVER_H
-
-// End of file
--- a/fmradio/fmradioengine/inc/fmradioengineradiosettings.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,326 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Contains implementation of the TRadioSettings class, which holds
-* the RadioEngine settings.
-*
-*/
-
-
-#ifndef FMRADIOSETTINGS_H
-#define FMRADIOSETTINGS_H
-
-#include "fmradioengine.h"
-
-// CONSTANTS
-const TInt KDefaultRadioVolume = 3;
-
-// CLASS DECLARATION
-//class CRadioEngine;
-
-
-/**
-* TRadioSettings class.
-* Maintain the radio setting data.
-*
-*/
-class TRadioSettings
- {
- public:
- /**
- * default constructor.
- */
- TRadioSettings();
-
- /**
- * return current headset volume.
- * @since Series 60 2.7
- * @return current headset volume
- */
- TInt HeadsetVolume() const;
- /**
- * return current speaker volume.
- * @since Series 60 2.7
- * @return current speaker volume
- */
- TInt SpeakerVolume() const;
- /**
- * return current preset number.
- * @since Series 60 2.7
- * @return current preset number
- */
- TInt CurrentPreset() const;
- /**
- * return current frequency.
- * @since Series 60 2.7
- * @return current frequency
- */
- TInt Frequency() const;
- /**
- * return max frequency.
- * @return max frequency
- */
- TUint32 MaxFrequency() const;
- /**
- * return min frequency.
- * @return min frequency
- */
- TUint32 MinFrequency() const;
- /**
- * return step size for tuning.
- * @return step size
- */
- TUint32 FrequencyStepSize() const;
- /**
- * Returns decimal count for current region MHz information
- * @return decimal count for current region
- */
- TInt DecimalCount() const;
- /**
- * return current audio mode.
- * @since Series 60 2.7
- * @return stereo/mono
- */
- CRadioEngine::TFMRadioAudioMode AudioMode() const;
- /**
- * return current audio output destination.
- * @since Series 60 2.7
- * @return headset/IHF
- */
- CRadioEngine::TFMRadioAudioOutput AudioOutput() const;
- /**
- * check if radio is mute.
- * @since Series 60 2.7
- * @return true/false
- */
- TBool IsMuteOn() const;
- /**
- * check if radio is on.
- * @since Series 60 2.7
- * @return true/false
- */
- TBool IsRadioOn() const;
- /**
- * return radio mode.
- * @since Series 60 2.7
- * @return tune/preset mode
- */
- CRadioEngine::TRadioMode RadioMode() const;
- /**
- * check if headset is connected.
- * @since Series 60 2.7
- * @return true/false
- */
- TBool IsHeadsetConnected() const;
- /**
- * check if flight mode is enabled.
- * @since Series 60 2.7
- * @return true/false
- */
- TBool IsFlightModeEnabled() const;
- /**
- * Retrieves the RDS alternate frequency search setting
- *
- * @return ETrue if AF search is enabled, otherwise EFalse
- */
- IMPORT_C TBool IsRdsAfSearchEnabled();
- /**
- * set speaker volume.
- * @since Series 60 2.7
- * @param aVolume the new volume
- * @return none
- */
- void SetSpeakerVolume(const TInt aVolume);
- /**
- * set headset volume.
- * @since Series 60 2.7
- * @param aVolume the new volume
- * @return none
- */
- void SetHeadsetVolume(const TInt aVolume);
- /**
- * Set current preset number.
- * @since Series 60 2.7
- * @return current preset number
- */
- void SetCurrentPreset(const TInt aChannel);
- /**
- * set current frequency .
- * @since Series 60 2.7
- * @param aFrequency the frequency to be set
- * @return none
- */
- void SetFrequency(const TInt aFrequency);
- /**
- * set max frequency.
- * @param aMaxFrequency the frequency to be set
- * @return none
- */
- void SetMaxFrequency( const TUint32 aMaxFrequency );
- /**
- * set min frequency.
- * @param aMinFrequency the frequency to be set
- * @return none
- */
- void SetMinFrequency( const TUint32 aMinFrequency );
- /**
- * set step size for manual tuning.
- * @param aFrequencyStepSize frequency step
- * @return none
- */
- void SetFrequencyStepSize( const TUint32 aFrequencyStepSize );
- /**
- * Set decimal count for current region MHz information
- * @param aDecimalCount decimals used
- * @return none
- */
- void SetDecimalCount( const TInt aDecimalCount );
- /**
- * set audio mode.
- * @since Series 60 2.7
- * @param aAudioMode stereo/mono
- * @return none
- */
- void SetAudioMode(CRadioEngine::TFMRadioAudioMode aAudioMode);
- /**
- * set audio output.
- * @since Series 60 2.7
- * @param aAudioOutput headset/IHF
- */
- void SetAudioOutput(const CRadioEngine::TFMRadioAudioOutput aAudioOutput );
- /**
- * set mute on.
- * @since Series 60 2.7
- * @return none
- */
- void SetMuteOn();
- /**
- * set mute on.
- * @since Series 60 2.7
- * @return none
- */
- void SetMuteOff();
- /**
- * set radio on.
- * @since Series 60 2.7
- * @return none
- */
- void SetRadioOn();
- /**
- * set radio off.
- * @since Series 60 2.7
- * @return none
- */
- void SetRadioOff();
- /**
- * set radio mode.
- * @since Series 60 2.7
- * @param aRadioMode preset/tune mode
- * @return none
- */
- void SetRadioMode(const CRadioEngine::TRadioMode aRadioMode);
- /**
- * set headset connected.
- * @since Series 60 2.7
- * @return none
- */
- void SetHeadsetConnected();
- /**
- * set headset disconnected.
- * @since Series 60 2.7
- * @return none
- */
- void SetHeadsetDisconnected();
- /**
- * set flight mode.
- * @since Series 60 2.7
- * @param aEnabled true/false
- * @return none
- */
- void SetFlightMode( TBool aEnabled );
- /**
- * set startup count
- * @param aStartupCount number of app startups
- */
- void SetStartupCount( const TInt aStartupCount );
- /**
- * return startup count
- * @return number of app startups
- */
- TInt StartupCount() const;
-
- /**
- * Set rds af search enabled.
- * @return none
- */
- void SetRdsAfSearchEnabled();
- /**
- * Set rds af search disabled.
- * @return none
- */
- void SetRdsAfSearchDisabled();
- /**
- * Set Japan region support on/off.
- * @param aAllowed true/false
- * @return none
- */
- void SetJapanRegionAllowed( const TBool aAllowed );
- /**
- * Return status of the Japan region support
- * @return ETrue if supported
- */
- TBool IsJapanRegionAllowed() const;
-
- private:
- /// current headset volume level
- TInt iFMRadioHeadsetVolume;
- /// current speaker volume level
- TInt iFMRadioSpeakerVolume;
- /// currently selected channel.
- TInt iCurrentPreset;
- /// current frequency
- TInt iFrequency;
- // max frequency
- TUint32 iMaxFrequency;
- // min frequency
- TUint32 iMinFrequency;
- // step size
- TUint32 iFrequencyStepSize;
- // decimal count
- TInt iDecimalCount;
- /// stereo or mono
- CRadioEngine::TFMRadioAudioMode iAudioMode;
- /// audio output
- CRadioEngine::TFMRadioAudioOutput iAudioOutput;
- /// current mute state
- TBool iMuteOn;
- // radio on/off flag
- TBool iRadioOn;
- /// preset or direct frequency flag
- CRadioEngine::TRadioMode iRadioMode;
- /// headset connected flag
- TBool iIsHeadsetConnected;
- /// flight mode enabled flag
- TBool iFlightModeEnabled;
- // first startup case flag
- TInt iStartupCount;
- // rds af search enabled flag
- TBool iRdsAfSearchEnabled;
- // Japan region support flag
- TBool iJapanRegionAllowed;
-
- };
-
-#endif // FMRADIOSETTINGS_H
-
-// End of File
--- a/fmradio/fmradioengine/inc/fmradioengineradiostatehandler.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The class implements functions handling radio engine state changes
-*
-*/
-
-
-#ifndef FMRADIOENGINERADIOSTATEHANDLER_H
-#define FMRADIOENGINERADIOSTATEHANDLER_H
-
-//INCLUDES
-#include "fmradioenginestatechangecallback.h"
-
-// CONSTANTS
-const TUint8 KRadioStateEventCallback = 0x01;
-
-// FORWARD DECLARATIONS
-class CRadioEngine;
-
-
-// CLASS DECLARATION
-/**
-* This class implements the state machines for radio engine state transition.
-*/
-class CRadioStateHandler : public CActive
- {
- public:
- /**
- * Method for creating new instances of this class.
- * @param aEngine a pointer to CRadioEngine
- * @return - A pointer to new CRadioEngineTimer object
- **/
- static CRadioStateHandler *NewL(CRadioEngine* aEngine);
- /**
- * Destructor
- **/
- virtual ~CRadioStateHandler();
- public:
- /**
- * Trigger the active object to call the client callback function.
- * @since Series 60 2.7
- * @return none
- */
- void Callback(MRadioEngineStateChangeCallback::TFMRadioNotifyEvent aEventCode, TInt aErrorCode );
- private:
- /**
- * c++ default constructor
- **/
- CRadioStateHandler(CRadioEngine* aEngine);
- /**
- * 2nd phase constructor
- **/
- void ConstructL();
- /**
- * Cancel the timeout timer. This generally means that a response was received from the chip, so the
- * timeout is no longer needed or the state machine was transitioned.
- * @since Series 60 2.7
- * @return none
- **/
- void DoCancel();
- /**
- * State Change Request/timeout handler
- * @since Series 60 2.7
- * @return none
- */
- void RunL();
- /**
- * handle any errors that occur in the RunL
- * @since Series 60 2.7
- * @return none
- */
- TInt RunError( TInt aError );
- private:
- // pointer to the session who's timeout we are mananging.
- CRadioEngine* iEngine;
- // Temporary storage for event code
- TInt iCallbackEventCode;
- // Temporary storage for error code
- TInt iCallbackErrorCode;
-
- }; // FMRADIOENGINERADIOSTATEHANDLER_H
-
-// End of File
-
-#endif
--- a/fmradio/fmradioengine/inc/fmradioenginestatechangecallback.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration of a simple interface to integrate the FM Radio
-* application engine and Ui.
-* Ui is derived from this class and Ui implements
-* the virtual method HandleRadioEngineCallBackL in class
-* CFMRadioAppUi. Radio engine then calls this virtual function
-* when it needs to pass information i.e. about its changed
-* state where Ui must react to. The traffic between Ui and
-* engine goes like:
-* Ui::RequestToEngine() -> Engine() -> Ui::DoAndShowItAndUpdateState()
-*
-*/
-
-
-#ifndef FMRADIOENGINESTATECHANGECALLBACK_H
-#define FMRADIOENGINESTATECHANGECALLBACK_H
-
-// Class declaration
-
-/**
-* It is interface to integrate the FM Radio
-* application engine and Ui.
-* @lib FMRadioEngine.lib
-* @since Series 60 2.7
-*/
-class MRadioEngineStateChangeCallback
-{
- public:
- /**
- * Event codes for identifying the event that
- * caused the change in engine's internal state.
- * Also, the possible error context is determined
- * from the event code. See the TFMRadioErrorCode
- * decalaration below for further information.
- */
- enum TFMRadioNotifyEvent
- {
- // Radio functionality events
- EFMRadioEventNone = 0x00,
- EFMRadioEventTunerReady,
- EFMRadioEventRadioOn,
- EFMRadioEventRadioOff,
- EFMRadioEventTune,
- EFMRadioEventVolumeUpdated,
- EFMRadioEventSetAudioMode,
- EFMRadioEventSetAudioOutput,
- EFMRadioEventHeadsetDisconnected,
- EFMRadioEventHeadsetReconnected,
- EFMRadioEventButtonPressed,
- EFMRadioEventFlightModeEnabled,
- EFMRadioEventFlightModeDisabled,
- EFMRadioEventStandbyMode,
- EFMRadioEventSetMuteState,
- EFMRadioEventAudioResourceAvailable,
- EFMRadioEventAudioResourcePaused,
- EFMRadioEventAudioResourceLost,
- EFMRadioEventCallStarted,
- EFMRadioEventCallEnded,
- EFMRadioEventFMRadioInitialized,
- EFMRadioEventFMTransmitterOn,
- EFMRadioEventFreqRangeChanged,
- EFMRadioEventRDSNotSupported,
- EFMRadioEventScanLocalStationsCanceled
-
- };
- public:
- /**
- * Interface method to get the callback from the
- * radio engine to radio Ui.
- *
- * @param aEventCode Predefined code of the event which
- * caused the change in engine's internal state.
- * @param aErrorCode Predefined code of the error if
- * one was generated. If no errors, value is 0x00 (NULL).
- * @return none
- */
- virtual void HandleRadioEngineCallBack(TFMRadioNotifyEvent aEventCode, TInt aErrorCode ) = 0;
-};
-
-#endif //FMRADIOENGINESTATECHANGECALLBACK_H
-
-// End of file
--- a/fmradio/fmradioengine/inc/fmradioheadseteventobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: headset event observer interface
-*
-*/
-
-
-#ifndef MFMRADIOHEADSETEVENTOBSERVER_H
-#define MFMRADIOHEADSETEVENTOBSERVER_H
-
-
-// CLASS DECLARATION
-
-class MFMRadioHeadsetEventObserver
- {
-
- public: // New functions
-
- /**
- * This callback will notify of the Headset to be connected
- */
- virtual void HeadsetAccessoryConnectedCallbackL() = 0;
-
- /**
- * This callback will notify of the Headset to be disconnected
- */
- virtual void HeadsetAccessoryDisconnectedCallbackL() = 0;
- };
-
-#endif // MFMRADIOHEADSETEVENTOBSERVER_H
-
-// End of File
--- a/fmradio/fmradioengine/inc/fmradiointernalpskeys.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: P&S data for FMRadio
-*
-*/
-#ifndef FMRADIOINTERNALPSKEYS_H
-#define FMRADIOINTERNALPSKEYS_H
-
-#include <e32cmn.h>
-#include <fmradiouids.h>
-
-// FMRadio Application UID
-const TUid KFMRadioPSUid = { KUidFMRadioApplication };
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ///
-/// Data properties. These properties are published by fmradio and used by other applications. ///
-/// ///
-///////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-* Currently active channel's ID.
-* Value <code>KErrNotFound</code> means that no preset channel is active.
-* Type <code>RProperty::EInt</code>.
-*/
-const TUint32 KFMRadioPSDataChannel = 0x00000000;
-
-/**
-* Currently active frequency.
-* Frequency unit is in kHz.
-* Type <code>RProperty::EInt</code>.
-*/
-const TUint32 KFMRadioPSDataFrequency = 0x00000001;
-
-/**
-* Current power state of the radio.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSRadioPowerState.
-*/
-const TUint32 KFMRadioPSDataRadioPowerState = 0x00000002;
-
-/**
-* Power state of the radio.
-*/
-enum TFMRadioPSRadioPowerState
- {
- EFMRadioPSRadioPowerStateUninitialized, /**< The key is not yet initialized. */
- EFMRadioPSRadioPowerOn, /**< Radio power on. */
- EFMRadioPSRadioPowerOff /**< Radio power off. */
- };
-
-/**
-* Current volume level.
-* Scale is from 1-10.
-* Type <code>RProperty::EInt</code>.
-*/
-const TUint32 KFMRadioPSDataVolume = 0x00000003;
-
-/**
-* Changing of this value means that channel
-* data of specified channel ID has changed.
-* The value remains indicating the last changed channel ID.
-* Value <code>KErrNone</code> means that no channel data has been changed yet.
-* Type <code>RProperty::EInt</code>.
-*/
-const TUint32 KFMRadioPSDataChannelDataChanged = 0x00000004;
-
-/**
-* The current tuning state.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSTuningState.
-*/
-const TUint32 KFMRadioPSDataTuningState = 0x00000006;
-
-/**
-* Possible tuning states.
-*/
-enum TFMRadioPSTuningState
- {
- EFMRadioPSTuningUninitialized, /**< Currently not tuning. */
- EFMRadioPSTuningStarted, /**< Tuning has been started an lasted less than one second. */
- EFMRadioPSTuningContinues /**< Tuning has taken more than one second. */
- };
-
-/**
-* Current mute state of radio.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSRadioMuteState.
-*/
-const TUint32 KFMRadioPSDataRadioMuteState = 0x00000007;
-
-/**
-* Mute state of radio.
-*/
-enum TFMRadioPSRadioMuteState
- {
- EFMRadioPSMuteStateUninitialized, /**< The key has not yet been initialized. */
- EFMRadioPSMuteStateOn, /**< Radio mute state is on. */
- EFMRadioPSMuteStateOff /**< Radio mute state is off. */
- };
-
-/**
-* Indicates if FM Radio is running or closing.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSApplicationRunningState.
-*/
-const TUint32 KFMRadioPSDataApplicationRunning = 0x00000008;
-
-/**
-* FM Radio application running states.
-*/
-enum TFMRadioPSApplicationRunningState
- {
- EFMRadioPSApplicationUninitialized, /**< FM Radio application's state is not yet initialized. */
- EFMRadioPSApplicationRunning, /**< FM Radio application is running. */
- EFMRadioPSApplicationClosing /**< FM Radio application is closing. */
- };
-
-/**
-* Indicates the current antenna connectivity status.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSHeadsetStatus
-*/
-const TUint32 KFMRadioPSDataHeadsetStatus = 0x00000009;
-
-/**
-* Current antenna status.
-*/
-enum TFMRadioPSHeadsetStatus
- {
- EFMRadioPSHeadsetUninitialized, /**< The antenna status is uninitialized. */
- EFMRadioPSHeadsetDisconnected, /**< The antenna is disconnected. */
- EFMRadioPSHeadsetConnected /**< The antenna is connected. */
- };
-
-/**
-* The current frequency decimal count.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSFrequencyDecimalCount.
-*/
-const TUint32 KFMRadioPSDataFrequencyDecimalCount = 0x00000010;
-
-/**
-* The current frequency decimal count.
-*/
-enum TFMRadioPSFrequencyDecimalCount
- {
- EFMRadioPSFrequencyDecimalCountUninitialized, /**< Frequency decimal count has not yet been initialized. */
- EFMRadioPSFrequencyOneDecimal, /**< Frequency accuracy is one decimal. */
- EFMRadioPSFrequencyTwoDecimals, /**< Frequency accuracy is two decimals. */
- EFMRadioPSFrequencyThreeDecimals /**< Frequency accuracy is three decimals. */
- };
-
-/**
-* Current moving state of application.
-* Note that even if user activates the moving state,
-* the move can be still canceled.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSMovingState
-*/
-const TUint32 KFMRadioPSDataMovingState = 0x00000011;
-
-/**
-* The current moving state.
-*/
-enum TFMRadioPSMovingState
- {
- EFMRadioPSMovingStateUninitialized, /**< Moving state is uninitialized. */
- EFMRadioPSMovingStateOn, /**< User has activated moving state. */
- EFMRadioPSMovingStatePerforming, /**< User has performed a channel move. */
- EFMRadioPSMovingStateOff /**< Moving state is off. */
- };
-
-/**
-* Flag to indicate if we're connected to the network.
-*/
-const TUint32 KFMRadioPSDataNetworkConnected = 0x00000014;
-
-/**
-* Flag to indicate if loudspeaker is in use
-*/
-const TUint32 KFMRadioPSDataLoudspeakerStatus = 0x00000015;
-/**
-* Current speaker status.
-*/
-enum TFMRadioPSLoudspeakerStatus
- {
- EFMRadioPSLoudspeakerUninitialized, /**< The speaker status is uninitialized. */
- EFMRadioPSLoudspeakerNotInUse, /**< The speaker is not in use. */
- EFMRadioPSLoudpeakerInUse /**< The speaker is in use. */
- };
-
-/**
-* RDS Program Service information, property type is text.
-*/
-
-const TUint32 KFMRadioPSDataRDSProgramService = 0x00000016;
-
-/**
-* RDS Radio Text information.
-* Type <code>RProperty::EText</code>.
-*/
-const TUint32 KFMRadioPSDataRDSRadioText = 0x00000017;
-
-/**
- * Name of the current channel.
- * Type <code>RProperty::EText</code>.
- */
-const TUint32 KFMRadioPSDataChannelName = 0x00000018;
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ///
-/// Control properties. These properties are published by other applications and used by FMRadio. ///
-/// ///
-//////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-* Sets mute state on or off.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSRadioMuteState.
-*/
-const TUint32 KFMRadioPSControlSetRadioMuteState = 0x00001006;
-
-
-/**
-* Increases or decreases volume level.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSAdjustVolume.
-*/
-const TUint32 KFMRadioPSControlAdjustVolume = 0x00001005;
-
-/**
-* Volume step direction.
-*/
-enum TFMRadioPSAdjustVolume
- {
- EFMRadioPSAdjustVolumeUninitialized = 0, /**< The key has not yet been initialized. */
- EFMRadioPSIncreaseVolume, /**< Increase volume. */
- EFMRadioPSDecreaseVolume /**< Decrease volume. */
- };
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ///
-/// Control properties. These properties are published by other applications and used by FM Radio. ///
-/// ///
-//////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-* Steps up or down a channel in channel list.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSStepToChannel.
-*/
-const TUint32 KFMRadioPSControlStepToChannel = 0x00001000;
-
-/**
-* Step direction of channel step.
-*/
-enum TFMRadioPSStepToChannel
- {
- EFMRadioPSStepToChannelUninitialized, /**< Value of the key has not yet been initialized. */
- EFMRadioPSStepToChannelUp, /**< Step to next channel up. */
- EFMRadioPSStepToChannelDown /**< Step to next channel down. */
- };
-
-/**
-* Seeks to next active frequency up or down.
-* Type <code>RProperty::EInt</code>.
-* @see TFMRadioPSSeek.
-*/
-const TUint32 KFMRadioPSControlSeek = 0x00001002;
-
-/**
-* Seek direction.
-*/
-enum TFMRadioPSSeek
- {
- EFMRadioPSSeekUninitialized, /**< Value of the key has not yet been initialized. */
- EFMRadioPSSeekUp, /**< Seek up. */
- EFMRadioPSSeekDown /**< Seek down. */
- };
-
-const TUint32 KFMRadioActiveIdlePresetListCount = 0x00001003;
-const TUint32 KFMRadioActiveIdlePresetListFocus = 0x00001004;
-
-
-#endif
--- a/fmradio/fmradioengine/inc/fmradiomobilenetworkinfolistener.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Header file for CFMRadioMobileNetworkInfoListener.
-*
-*/
-
-
-#ifndef FMRADIOMOBILENETWORKINFOLISTENER_H
-#define FMRADIOMOBILENETWORKINFOLISTENER_H
-
-#include <e32base.h>
-#include <etelmm.h>
-
-
-const TInt KFMRadioCREmulatorCountryCodeLength = 3;
-namespace CommsDat { class CCDIAPRecord; }
-
-class MFMRadioNetworkChangeObserver;
-/**
- * Listens changes in network ID and country code.
- *
- * @ingroup Utils
- */
-NONSHARABLE_CLASS(CFMRadioMobileNetworkInfoListener) : public CActive
- {
-public:
-
- /**
- * Creates a new mobile network info listener.
- * @return The newly created mobile network info listener.
- */
- static CFMRadioMobileNetworkInfoListener* NewL(
- MFMRadioNetworkChangeObserver & aObserver);
-
- /**
- * Destructor.
- */
- ~CFMRadioMobileNetworkInfoListener();
-
- /**
- * Return current combined network ID and country code as TInt.
- * @return An integer composed of the current network ID and country code.
- */
- TInt CompoundNetworkId() const;
-
- /**
- * Returns current country code.
- * @return The current country code.
- */
- const TDesC& CountryCode() const;
-
- /**
- * SubscriberId
- * @return subscriber id
- */
- const TDesC& SubscriberId() const;
-
-private:
-
- /**
- * Constructor.
- */
- CFMRadioMobileNetworkInfoListener(MFMRadioNetworkChangeObserver & aObserver);
-
- /**
- * By default Symbian 2nd phase constructor is private.
- */
- void ConstructL();
-
- /**
- * Saves fetched network info to local variables.
- */
- void SaveNetworkInfo();
-
-#ifdef __WINS__
- /**
- * Gets network info from Central Repository.
- */
- void GetCenRepNetworkInfoL();
-#endif
-
-// from base class CActive
- void RunL();
- void DoCancel();
-
-private: // Data
-
- /** interface to report a condition when network id has changed */
- MFMRadioNetworkChangeObserver & iNetworkChangeObserver;
-#ifdef __WINS__
- /** Central repository */
- CRepository* iRepository;
- /** Network info from repository */
- HBufC* iEmulatorNetworkInfo;
-#else
- /** Telephony server. */
- RTelServer iTelServer;
- /** Mobile phone. */
- RMobilePhone iPhone;
- /** Network info of mobile phone. */
- RMobilePhone::TMobilePhoneNetworkInfoV1 iNetworkInfo;
- /** Location of mobile phone. */
- RMobilePhone::TMobilePhoneLocationAreaV1 iLocation;
- /** Packaged network info object. */
- RMobilePhone::TMobilePhoneNetworkInfoV1Pckg iNetworkInfoPckg;
-#endif
- /** Current network ID. */
- RMobilePhone::TMobilePhoneNetworkIdentity iNetworkId;
- /** Current country code. */
- RMobilePhone::TMobilePhoneNetworkCountryCode iCountryCode;
- /** Combined network ID and country code. */
- TInt iCompoundNetworkId;
- /** Previous known non-null combined country code */
- TInt iPreviousCompoundNetworkId;
- /** Subsriber (IMSI code) id that has been picked up at the startup */
- HBufC* iSubscriberId;
- };
-
-#endif // FMRADIOMOBILENETWORKINFOLISTENER_H
--- a/fmradio/fmradioengine/inc/fmradionetworkchangeobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: An interface for notifying about network id changes
-*
-*/
-/**
- * An interface for notifying about network id changes
- */
-class MFMRadioNetworkChangeObserver
- {
-
-public:
-
- /**
- * Used for notifying that the network id has changed
- */
- virtual void NetworkIdChanged() = 0;
- };
--- a/fmradio/fmradioengine/inc/fmradiopropertyobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,264 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Abstract interface for handling property change events.
-*
-*/
-
-
-#ifndef CFMRADIOPROPERTYOBSERVER_H
-#define CFMRADIOPROPERTYOBSERVER_H
-
-#include <e32base.h>
-#include <e32property.h>
-
-/**
- * MFMRadioPropertyChangeObserver
- *
- * Abstract interface for handling property change events.
- */
-class MFMRadioPropertyChangeObserver
-{
-
-public:
-
- /**
- * This is a callback function which is called when a property value of
- * type int is changed.
- *
- * @param aCategory UID of Publish And Subscribe category
- * @param aKey subkey to specify the category event; to be used with
- * Publish And Subscribe
- *
- * @param aValue the new value
- */
- virtual void HandlePropertyChangeL(
- const TUid& aCategory,
- const TUint aKey,
- const TInt aValue ) = 0;
-
- /**
- * This is a callback function which is called when a property value of
- * type text is changed.
- *
- * @param aCategory UID of Publish And Subscribe category
- * @param aKey subkey to specify the category event; to be used with
- * Publish And Subscribe
- * @param aValue the new value
- **/
- virtual void HandlePropertyChangeL(
- const TUid& aCategory,
- const TUint aKey,
- const TDesC& aValue ) = 0;
-
- /**
- * This is a callback function which is called when a property value of
- * type byte array is changed.
- *
- * @param aCategory UID of Publish And Subscribe category
- * @param aKey subkey to specify the category event; to be used with
- * Publish And Subscribe
- * @param aValue the new value
- **/
- virtual void HandlePropertyChangeL(
- const TUid& aCategory,
- const TUint aKey,
- const TDesC8& aValue ) = 0;
-
- /**
- * This is a callback function which is called when a P&S components
- * returns an error
- *
- * @param aCategory UID of Publish And Subscribe category
- * @param aKey subkey to specify the category event
- * @param aError an error code
- */
- virtual void HandlePropertyChangeErrorL(
- const TUid& aCategory,
- const TUint aKey,
- TInt aError) = 0;
-};
-
-
-
-/**
- * Observer class that observes changes of Property values and propogates
- * them further.
- * The class defines a handle to a property, a single data value representing
- * an item of state information.
- *
- */
- class CFMRadioPropertyObserver : public CActive
- {
-
- public:
-
- /**
- * Property type. Cannot use RProperty::TType because EByteArray == EText.
- */
- enum TFMRadioPropertyType
- {
- EFMRadioPropertyInt, // Integral property type.
- EFMRadioPropertyByteArray, // Byte-array (8 bit), max size 512 bytes
- EFMRadioPropertyText // Text (16 bit), max size 512 bytes
- };
-
- /**
- * Two-phased constructor.
- *
- * @param aObserver a reference to the observer interface implementer
- * @param aCategory UID of Publish And Subscribe category
- * @param aKey subkey to specify the category event; to be used with
- * Publish And Subscribe
- * @param aPropertyType property type to observe
- */
- static CFMRadioPropertyObserver* NewL(
- MFMRadioPropertyChangeObserver& aObserver,
- const TUid& aCategory,
- const TUint aKey,
- const TFMRadioPropertyType aPropertyType);
-
- /**
- * Two-phased constructor.
- *
- * @param aObserver a reference to the observer interface implementer
- * @param aCategory UID of Publish And Subscribe category
- * @param aKey subkey to specify the category event; to be used with
- * Publish And Subscribe
- * @param aPropertyType property type to observe
- */
- static CFMRadioPropertyObserver* NewLC(
- MFMRadioPropertyChangeObserver& aObserver,
- const TUid& aCategory,
- const TUint aKey,
- const TFMRadioPropertyType aPropertyType);
-
- /**
- * Destructor.
- */
- ~CFMRadioPropertyObserver();
-
- /**
- * Subscribes the object to listen to the specified key. Does nothing if already active.
- * Must be called after construction, or after calling Cancel().
- */
- void ActivateL();
-
- /**
- * Returns current integer property value
- * @param aUpdate ETrue if the cache value should be updated
- *
- * @return int value
- */
- TInt ValueInt( TBool aUpdate = EFalse );
-
- /**
- * Returns current byte array property value
- ** @param aUpdate ETrue if the cache value should be updated
- *
- * @return byte array value
- */
- const TDesC8& ValueDes8( TBool aUpdate = EFalse );
-
- /**
- * Returns current text property value
- * * @param aUpdate ETrue if the cache value should be updated
- *
- * @return text value
- */
- const TDesC& ValueDes( TBool aUpdate = EFalse );
-
-private:
-
- /**
- * C++ default constructor overload.
- * Two-phased constructor.
- *
- * @param aObserver a reference to the observer interface implementer
- * @param aCategory UID of Publish And Subscribe category
- * @param aKey subkey to specify the category event; to be used with
- * Publish And Subscribe
- * @param aPropertyType property type to observe
- */
- CFMRadioPropertyObserver(
- MFMRadioPropertyChangeObserver& aObserver,
- const TUid& aCategory,
- const TUint aKey,
- const TFMRadioPropertyType aPropertyType);
-
- /**
- * By default Symbian 2nd phase constructor is private.
- **/
- void ConstructL();
-
- // from base class Cactive
- /**
- * From CActive
- *
- * @see CActive::RunL()
- */
- void RunL();
-
- /**
- * From CActive,
- *
- * @see CActive::DoCancel()
- */
- void DoCancel();
-
-private: // data
-
- /**
- * Value of a subscribed category property of type int.
- */
- TInt iValueInt;
-
- /**
- * Value of a subscribed category property of type byte array.
- */
- HBufC8* iValueByteArray;
-
- /**
- * Value of a subscribed category property of type text.
- */
- HBufC* iValueText;
-
- /**
- * Handle to Publish And Subscribe component
- */
- RProperty iProperty;
-
- /**
- * Observer to be notified when particular Property value has changed
- */
- MFMRadioPropertyChangeObserver& iObserver;
-
- /**
- * UID of Publish And Subscribe category
- */
- TUid iCategory;
-
- /**
- * Subkey to be used with Publish And Subscribe
- */
- TUint iKey;
-
- /**
- * Type of the observed property.
- */
- TFMRadioPropertyType iPropertyType;
-
- };
-
-#endif // CFMRADIOPROPERTYOBSERVER_H
-
--- a/fmradio/fmradioengine/inc/fmradiopubsub.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Header file for CFMRadioPubSub
-*
-*/
-
-
-#ifndef CFMRADIOPUBSUB_H
-#define CFMRADIOPUBSUB_H
-
-#include <fmradiointernalpskeys.h>
-
-#include "fmradiopropertyobserver.h"
-
-class MFMRadioControlEventObserver;
-
-/**
- * Publish&Subscribe interface of FMRadioEngine
- */
-class CFMRadioPubSub :
- public CBase,
- public MFMRadioPropertyChangeObserver
- {
-
-public: // Methods
-
- /**
- * Static constructor.
- */
- static CFMRadioPubSub* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CFMRadioPubSub();
-
- /**
- * Publishes active channel number to P&S.
- *
- * @param aChannelId The channel ID to publish.
- */
- void PublishChannelL( TInt aChannelId ) const;
-
- /**
- * Publishes active frequency to P&S.
- *
- * @param aFreq The frequency to publish.
- */
- IMPORT_C void PublishFrequencyL( TUint32 aFreq ) const;
-
- /**
- * Publishes radio power state to P&S.
- *
- * @param aPowerOn The radio power state to publish.
- */
- IMPORT_C void PublishStateL( TBool aPowerOn ) const;
-
- /**
- * Publishes current volume level to P&S.
- *
- * @param aVol The current volume level to publish.
- */
- void PublishVolumeL( TInt aVol ) const;
-
- /**
- * Publishes changed channel number to P&S.
- *
- * @param aChannelId The channel ID to publish.
- */
- void PublishChannelDataChangedL(TInt aChannelId) const;
-
- /**
- * Publishes the tuning state to P&S.
- * @param aTuningState The tuning state to publish.
- */
- void PublishTuningStateL( TFMRadioPSTuningState aTuningState ) const;
-
- /**
- * Publishes radio mute state to P&S.
- *
- * @param aMuted The radio mute state to publish.
- */
- void PublishRadioMuteStateL( TBool aMuted ) const;
-
- /**
- * Publishes application running state to P&S.
- *
- * @param aRunningState The application running state.
- */
- IMPORT_C void PublishApplicationRunningStateL(
- TFMRadioPSApplicationRunningState aRunningState ) const;
-
- /**
- * Publishes the antenna status to P&S.
- *
- * @param aAntennaStatus The antenna's status.
- */
- void PublishAntennaStatusL( TFMRadioPSHeadsetStatus aAntennaStatus ) const;
-
- /**
- * Publishes the frequency decimal count to P&S.
- * @param aDecimalCount The decimal count.
- */
- void PublishFrequencyDecimalCountL(
- TFMRadioPSFrequencyDecimalCount aDecimalCount ) const;
-
- /**
- * Publishes speaker status. Before state is set for first time it is in
- * <code>EFMRadioPSLoudspeakerUninitialized</code> state.
- *
- * @param aLoudspeakerStatus Status of the speaker
- */
- void PublishLoudspeakerStatusL( TFMRadioPSLoudspeakerStatus aLoudspeakerStatus ) const;
-
- /**
- * Publishes RDS Program Service information.
- *
- * @param aProgramService Service text
- */
- IMPORT_C void PublishRDSProgramServiceL( const TDesC& aProgramService ) const;
- IMPORT_C void PublishRDSRadioTextL( const TDesC& aRadioText ) const;
- IMPORT_C void PublishChannelNameL( const TDesC& aName ) const;
-
- IMPORT_C void PublishPresetCountL( TInt aVal ) const;
-
-// from base class MFMRadioPropertyChangeObserver
- void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TInt aValue );
- void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TDesC8& aValue );
- void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TDesC& aValue );
- void HandlePropertyChangeErrorL( const TUid& aCategory, const TUint aKey, TInt aError );
-
- /**
- * Sets the UI side control event observer.
- * @param aControlEventObserver the observer for control events
- */
- IMPORT_C void SetControlEventObserver( MFMRadioControlEventObserver* aControlEventObserver );
-
-private: //Methods
-
- /**
- * C++ default constructor.
- */
- CFMRadioPubSub();
-
- /**
- * By default Symbian 2nd phase constructor is private.
- */
- void ConstructL();
-
- /**
- * Defines a property.
- *
- * @param aKey The key of the property.
- * @param aAttr Attributes of the property.
- * @param aDataProperty ETrue if the property is a data property, EFalse
- * if it is a control property
- */
- void DefinePropertyL(
- TUint aKey,
- TInt aAttr,
- TBool aDataProperty ) const;
-
- /**
- * Deletes a property.
- *
- * @param aKey The key of the property.
- */
- void DeleteProperty( TUint aKey ) const;
-
- /**
- * Gets the integer value stored in a property.
- *
- * @param aKey The key of the property.
- * @return The value contained in the property.
- */
- TInt PropertyValueIntL( TUint aKey ) const;
-
- /**
- * Sets the value in an integer property.
- *
- * @param aKey The key of the property.
- * @param aValue The value to set.
- */
- void SetPropertyValueL( TUint aKey, TInt aValue ) const;
-
- /**
- * Sets the value in a text property.
- *
- * @param aKey The key of the property.
- * @param aValue The value to set.
- */
- void SetPropertyValueL( TUint aKey, const TDesC& aValue ) const;
-
-private: // Data
-
- /**
- * Pointer to observer in UI side, can be NULL. Not owned.
- */
- MFMRadioControlEventObserver* iObserver;
-
- /**
- * An array of handlers to P&S interface.
- */
- RPointerArray<CFMRadioPropertyObserver> iPropertyArray;
-
- };
-
-#endif // CFMRADIOPUBSUB_H
--- a/fmradio/fmradioengine/inc/fmradiordsobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
-* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Observer interface for RDS events
-*
-*/
-
-
-#ifndef MFMRADIORDSOBSERVER_H
-#define MFMRADIORDSOBSERVER_H
-
-class MFMRadioRdsObserver
- {
-public:
-
- /**
- * Programme Service data available
- *
- * @param aProgramService The new Programme Service data
- */
- virtual void RdsDataProgrammeService( const TDesC& aProgramService ) = 0;
-
- /**
- * Reports if the programme service name is detected as dynamically changing or not
- *
- * @param aStatic ETrue if the name is static, EFalse if it is dynamic
- */
- virtual void RdsDataPsNameIsStatic( TBool aStatic ) = 0;
-
- /**
- * Radio text data available
- *
- * @param aRadioText The new Radio text data
- */
- virtual void RdsDataRadioText( const TDesC& aRadioText ) = 0;
-
- /**
- * Radio text plus data available
- *
- * @param aRTPlusClass The type of RT+ text
- * @param aRadioTextPlus The new Radio text data
- */
- virtual void RdsDataRadioTextPlus( const TInt aRTPlusClass, const TDesC& aRadioTextPlus ) = 0;
-
- /**
- * Notifies of the beginning of Alternate Frequency search
- */
- virtual void RdsAfSearchBegin() = 0;
-
- /**
- * Notifies of the completed Alternate Frequency search
- *
- * @param aFrequency The new frequency
- * @param aError A standard system error code
- */
- virtual void RdsAfSearchEnd( TUint32 aFrequency, TInt aError ) = 0;
-
- /**
- * Notifies of the changed Alternate Frequency search state
- *
- * @param aEnabled ETrue if AF search was enabled, otherwise EFalse
- */
- virtual void RdsAfSearchStateChange( TBool aEnabled ) = 0;
-
- /**
- * Notifies of the status of RDS signal
- *
- * @param aAvailable is RDS available
- */
- virtual void RdsAvailable( TBool aAvailable ) = 0;
- };
-
-#endif // MFMRADIORDSOBSERVER_H
--- a/fmradio/fmradioengine/inc/fmradiordsreceiver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The RDS receiver implementation for FM Radio
-*
-*/
-
-
-#ifndef CFMRADIORDSRECEIVER_H
-#define CFMRADIORDSRECEIVER_H
-
-#include "fmradioengineradiosettings.h"
-#include "fmradiordsobserver.h"
-#include "fmradiordsreceiverbase.h"
-
-NONSHARABLE_CLASS( CFMRadioRdsReceiver ) : public CFMRadioRdsReceiverBase
- {
-public:
-
- /**
- * The two-phased constructor
- *
- * @param aSettings The radio settings
- */
- static CFMRadioRdsReceiver* NewL( TRadioSettings& aSettings );
-
- /**
- * The destructor
- */
- virtual ~CFMRadioRdsReceiver();
-
- // from CFMRadioRdsReceiverBase
- void InitL( CRadioUtility& aRadioUtility, CFMRadioPubSub* aPubSub );
- void SetAutomaticSwitchingL( TBool aEnable );
- void StartReceiver();
- void StopReceiver();
-
-private:
-
- /**
- * The default constructor
- *
- * @param aSettings The radio settings
- */
- CFMRadioRdsReceiver( TRadioSettings& aSettings );
-
- /**
- * Second phase constructor
- */
- void ConstructL();
-
-private: // data
-
- /** The RDS utility */
- CRadioRdsUtility* iRdsUtility;
-
- /** State of the RDS receiver */
- TBool iStarted;
- };
-
-#endif // CFMRADIORDSRECEIVER_H
--- a/fmradio/fmradioengine/inc/fmradiordsreceiverbase.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-/*
-* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The RDS receiver base class for FM Radio
-*
-*/
-
-
-#ifndef CFMRADIORDSRECEIVERBASE_H
-#define CFMRADIORDSRECEIVERBASE_H
-
-#include <RadioRdsUtility.h>
-
-#include "fmradiordsobserver.h"
-
-class TRadioSettings;
-class CRadioUtility;
-class CFMRadioPubSub;
-
-NONSHARABLE_CLASS( CFMRadioRdsReceiverBase ) : public CBase, public MRadioRdsObserver
- {
-public:
-
- enum TFMRadioProgrammeSeviceType
- {
- EFMRadioPSNameStaticAssumed = 0,// Default, determination is ongoing
- EFMRadioPSNameStatic, // PS name is static
- EFMRadioPSNameDynamic // PS name is dynamic
- };
-
- /**
- * The destructor
- */
- virtual ~CFMRadioRdsReceiverBase();
-
- /**
- * Initializes the RDS receiver
- *
- * @param aRadioUtility A reference to the radio utility
- * @param aPubSub Pointer to Publish&Subscribe object
- */
- virtual void InitL( CRadioUtility& aRadioUtility, CFMRadioPubSub* aPubSub ) = 0;
-
- /**
- * Adds an observer wich will be notified of the new RDS data
- * If observer already exists, it is not added
- *
- * @param aObserver pointer of the observer instance.
- */
- IMPORT_C void AddObserver(MFMRadioRdsObserver* aObserver);
-
- /**
- * Removes the rds observer.
- */
- IMPORT_C void RemoveObserver(MFMRadioRdsObserver* aObserver);
-
- /**
- * Getter for automatic switching state of alternate frequencies
- *
- * @return ETrue if automatic switching is enabled
- */
- IMPORT_C TBool AutomaticSwitchingEnabled() const;
-
- /**
- * Getter for the programme service name
- *
- * @return Programme service name
- */
- IMPORT_C const TDesC& ProgrammeService() const;
-
- /**
- * Returns the nature of the PS name
- *
- * @return The type of PS name
- */
- IMPORT_C TFMRadioProgrammeSeviceType ProgrammeServiceNameType() const;
-
- /**
- * Getter for the RDS signal availability
- *
- * @return ETrue if RDS signal is available, otherwise EFalse
- */
- IMPORT_C TBool SignalAvailable() const;
-
- /**
- * Getter for the RDS Text+ station URL
- * @return The cached web URL of the station
- */
- IMPORT_C const TDesC& RtPlusProgramUrl() const;
-
- /**
- * Getter for the RDS Text+ artist name
- * @return The cached artist name
- */
- IMPORT_C const TDesC& RtPlusArtist() const;
-
- /**
- * Getter for the RDS Text+ album name
- * @return The cached album name
- */
- IMPORT_C const TDesC& RtPlusAlbum() const;
-
- /**
- * Getter for the RDS Text+ song name
- * @return The cached song name
- */
- IMPORT_C const TDesC& RtPlusSong() const;
-
- /**
- * Setter for automatic switching of alternate frequencies
- * If this method is overridden, the base implementation should be called
- *
- * @param aEnable ETrue, if automatic swithing is to be enabled
- */
- virtual void SetAutomaticSwitchingL( TBool aEnable );
-
- /**
- * Clears the RDS information
- */
- void ClearRdsInformation();
-
- /**
- * Starts receiving the RDS information
- */
- virtual void StartReceiver() = 0;
-
- /**
- * Stops receiving the RDS information
- */
- virtual void StopReceiver() = 0;
-
-protected:
-
- /**
- * The default constructor
- *
- * @param aSettings The radio settings
- */
- CFMRadioRdsReceiverBase( TRadioSettings& aSettings );
-
- /**
- * Second phase constructor
- */
- void BaseConstructL();
-
- /**
- * Static callback for the RDS PS name timer
- *
- * @param aSelf Pointer to self.
- * @return KErrNone
- */
- static TInt StaticPsNameTimerCallback( TAny* aSelf );
-
- /**
- * Handles the received RT+ data and passes it to observers
- * @param aRtPlusClass The RT+ class
- * @param aRtPlusData The received data
- */
- void HandleRdsDataRTplusL( TRdsRTplusClass aRtPlusClass, TRdsRadioText& aRtPlusData );
-
-// from base class MRadioRdsObserver
- void MrroStationSeekByPTYComplete( TInt aError, TInt aFrequency );
- void MrroStationSeekByTAComplete( TInt aError, TInt aFrequency );
- void MrroStationSeekByTPComplete( TInt aError, TInt aFrequency );
- void MrroGetFreqByPTYComplete( TInt aError, RArray<TInt>& aFreqList );
- void MrroGetFreqByTAComplete( TInt aError, RArray<TInt>& aFreqList );
- void MrroGetPSByPTYComplete( TInt aError, RArray<TRdsPSName>& aPsList );
- void MrroGetPSByTAComplete( TInt aError, RArray<TRdsPSName>& aPsList );
- void MrroRdsDataPI( TInt aPi );
- void MrroRdsDataPTY( TRdsProgrammeType aPty );
- void MrroRdsDataPS( TRdsPSName& aPs );
- void MrroRdsDataRT( TRdsRadioText& aRt );
- void MrroRdsDataCT( TDateTime& aCt );
- void MrroRdsDataTA( TBool aTaOn );
- void MrroRdsDataRTplus( TRdsRTplusClass aRtPlusClass, TRdsRadioText& aRtPlusData );
- void MrroRdsSearchBeginAF();
- void MrroRdsSearchEndAF( TInt aError, TInt aFrequency );
- void MrroRdsStationChangeTA( TInt aFrequency );
- void MrroRdsEventAutomaticSwitchingChange( TBool aAuto );
- void MrroRdsEventAutomaticTrafficAnnouncement( TBool aAuto );
- void MrroRdsEventSignalChange( TBool aSignal );
-
-protected: // data
- /** The radio settings */
- TRadioSettings& iSettings;
-
- /** Publish&Subscribe object. Can be NULL. Not owned. */
- CFMRadioPubSub* iPubSub;
-
-private: // data
-
- /** Array of RDS observers. */
- RPointerArray<MFMRadioRdsObserver> iObservers;
-
- /** The programme service name cache */
- HBufC* iPsName;
-
- /** The radio text data cache */
- HBufC* iRadioText;
-
- /** The cached web URL of the station */
- RBuf iProgramWebUrl;
-
- /** The cached artist name */
- RBuf iArtistName;
-
- /** The cached song name */
- RBuf iSongName;
-
- /** The cached album name */
- RBuf iAlbumName;
-
- /** ETrue if the RDS signal is available */
- TBool iSignalAvailable;
-
- /** ETrue if AF is enabled */
- TBool iAfEnabled;
-
- /** Timer to track the PS name changes */
- CPeriodic* iPsNameTimer;
-
- /** The type of the PS name */
- TFMRadioProgrammeSeviceType iPsNameType;
- };
-
-#endif // CFMRADIORDSRECEIVERBASE_H
--- a/fmradio/fmradioengine/inc/fmradiordsreceiversimulator.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
-* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The RDS receiver simulator for FM Radio
-*
-*/
-
-
-#ifndef CFMRADIORDSRECEIVERSIMULATOR_H
-#define CFMRADIORDSRECEIVERSIMULATOR_H
-
-#include "fmradioengineradiosettings.h"
-#include "fmradiordsobserver.h"
-#include "fmradiordsreceiverbase.h"
-
-NONSHARABLE_CLASS( CFMRadioRdsReceiverSimulator ) : public CFMRadioRdsReceiverBase
- {
-public:
-
- /**
- * The two-phased constructor
- *
- * @param aSettings The radio settings
- */
- static CFMRadioRdsReceiverSimulator* NewL( TRadioSettings& aSettings );
-
- /**
- * The destructor
- */
- virtual ~CFMRadioRdsReceiverSimulator();
-
- // from CFMRadioRdsReceiverBase
- void InitL( CRadioUtility& aRadioUtility, CFMRadioPubSub* aPubSub );
- void StartReceiver();
- void StopReceiver();
-
- /**
- * For simulate MrftoFrequencyChange method from MRadioFmTunerObserver
- */
- void SetRadioEngineForRadioFmTunerSimulation( CRadioEngine* aEngine );
-private:
-
- /** The simulated events */
- enum TFMRadioRdsSimulationEvent
- {
- EFMRadioRdsEventSignalOn,
- EFMRadioRdsEventSignalOff,
- EFMRadioRdsEventPS,
- EFMRadioRdsEventRadioText,
- EFMRadioRdsEventAFBegin,
- EFMRadioRdsEventAFEnd,
- EFMRadioRdsEventRadioTextPlus
- };
-
- /**
- * The default constructor
- *
- * @param aSettings The radio settings
- */
- CFMRadioRdsReceiverSimulator( TRadioSettings& aSettings );
-
- /**
- * Second phase constructor
- */
- void ConstructL();
-
- /**
- * StaticRdsSimulationCallback Callback for RDS simulation
- */
- static TInt StaticRdsSimulationCallback( TAny* aSelfPtr );
-
-private: // data
-
- /** Timer for RDS event simulation */
- CPeriodic* iEventSimulatorTimer;
-
- /** The iterator for RDS events */
- TInt iEventIterator;
-
- /** The iterator for PS names */
- TInt iPsIterator;
-
- /** The iterator for radio texts */
- TInt iRadioTextIterator;
-
- /** The iterator for frequencies */
- TInt iFrequencyIterator;
-
- /** The iterator for radio text plus'*/
- TInt iRadioTextPlusIterator;
-
- /** Pointer to the engine for simulate MrftoFrequencyChange method from MRadioFmTunerObserver */
- CRadioEngine* iEngine;
- };
-
-#endif // CFMRADIORDSRECEIVERSIMULATOR_H
--- a/fmradio/fmradioengine/inc/fmradioregion.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Header file for CFMRadioRegion
-*
-*/
-
-
-#ifndef FMRADIOREGION_H
-#define FMRADIOREGION_H
-
-// INCLUDES
-#include <e32base.h>
-#include "fmradioengine.hrh"
-
-// FORWARD DECLARATIONS
-class CFMRadioRegion;
-class TResourceReader;
-
-// DATA TYPES
-typedef RPointerArray<CFMRadioRegion> RFMRadioRegionArray;
-typedef RPointerArray<HBufC16> RFMRadioCountryCodeArray;
-
-// CLASS DECLARATION
-
-/**
-* Class CFMRadioRegion provides information about FM region
-*/
-NONSHARABLE_CLASS( CFMRadioRegion ) : public CBase
- {
- public: // Methods
-
- // Constructors and destructor
-
- /**
- * Static constructor.
- */
- static CFMRadioRegion* NewL(TResourceReader& aRr);
-
- /**
- * Destructor.
- */
- ~CFMRadioRegion();
-
-
- // New methods
-
- /**
- * Id Get the id of region
- * @return id of region
- */
- TFMRadioRegionSetting Id() const;
-
- /**
- * StepSize Get the step interval of region
- * @return Step size
- */
- TUint32 StepSize() const;
-
- /**
- * Get the minimum frequency of region
- * @return Minimum frequency
- */
- TUint32 MinFrequency() const;
-
- /**
- * Get the maximum frequency of region
- * @return Maximum frequency
- */
- TUint32 MaxFrequency() const;
-
- /**
- * Get the decimal count of region.
- * @return Decimal count.
- */
- TInt DecimalCount() const;
-
- /**
- * CountryCode Get the country code of region
- * @return Country code, or empty descriptor if country code doesn't exist
- */
- const RFMRadioCountryCodeArray& CountryCodes();
-
- /**
- * Name Get the name of region
- * @return Name of region
- */
- const TDesC16& Name() const;
-
- /**
- * SettingItemName Get the name of region for setting item
- * @return Name of region
- */
- const TDesC16& SettingItemName() const;
-
- private: //Methods
-
- /**
- * C++ default constructor.
- */
- CFMRadioRegion();
-
- /**
- * By default Symbian 2nd phase constructor is private.
- */
- void ConstructL(TResourceReader& aRr);
-
-
- private: // Data
-
- /** Id of the region*/
- TFMRadioRegionSetting iId;
-
- /** Step interval*/
- TUint16 iStepSize;
-
- /** Min frequency */
- TUint32 iMinFreq;
-
- /** Max frequency */
- TUint32 iMaxFreq;
-
- /** Decimal count */
- TInt iDecimalCount;
-
- /** Country code*/
- RFMRadioCountryCodeArray iCountryCodes;
-
- /** Region name*/
- HBufC16* iName;
-
- /** Region name for setting item*/
- HBufC16* iSettingName;
-
- };
-
-#endif // FMRADIOREGION_H
-
-// End of File
--- a/fmradio/fmradioengine/inc/fmradiosystemeventdetector.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Header file for CFMRadioSystemEventDetector.
-*
-*/
-
-
-#ifndef CFMRADIOSYSTEMEVENTDETECTOR_H
-#define CFMRADIOSYSTEMEVENTDETECTOR_H
-
-#include <e32base.h>
-
-#include "fmradiopropertyobserver.h"
-
-class MFMRadioSystemEventDetectorObserver;
-
-/** System properties mappings */
-enum TFMRadioSystemEvents
- {
- EFMRadioNetworkCoverageProperty = 0,
- EFMRadioCallProperty,
- EFMRadioAudioResourcesProperty,
- EFMRadioVoiceUiProperty
- };
-
-/**
-* Catches notification of the call and network state changes.
-*
-* Class provides implementation to detect system events and notify UI components of the event,
-* Class keeps several instances of CFMRadioPropertyObserver, and those instances send event notifications
-* about the particular system component state change.
-*/
-class CFMRadioSystemEventDetector : public CBase, public MFMRadioPropertyChangeObserver
- {
- public:
-
- /**
- * Two-phased constructor.
- * @param aObserver a reference to the observer interface implementer
- */
- static CFMRadioSystemEventDetector* NewL(MFMRadioSystemEventDetectorObserver& aObserver);
-
- /**
- * Destructor.
- */
- virtual ~CFMRadioSystemEventDetector();
-
- /**
- * Returns network coverage state.
- */
- TBool IsNetworkCoverage() const;
-
- /** Is Auto resume allowed; based on categories */
- TBool IsAutoResumePossible() const;
-
- /**
- * Returns current call state.
- */
- TBool IsCallActive() const;
-
-
-
- private:
-
- /**
- * By default EPOC constructor is private.
- */
- void ConstructL();
-
- /**
- * C++ default constructor.
- * @param aObserver a reference to the observer interface implementer
- */
- CFMRadioSystemEventDetector(MFMRadioSystemEventDetectorObserver& aObserver);
- /**
- * Callback for auto resume timer
- * @param aSelfPtr pointer to itself
- */
- static TInt StaticAutoResumeTimerCallback( TAny* aSelfPtr );
- /**
- * Report audio resource availability to observers.
- */
- void NotifyAudioResourcesAvailability();
-
- // From base class MFMRadioPropertyChangeObserver
- void HandlePropertyChangeL(const TUid& aCategory, const TUint aKey, const TInt aValue);
- void HandlePropertyChangeL(const TUid& aCategory, const TUint aKey, const TDesC8& aValue);
- void HandlePropertyChangeL(const TUid& aCategory, const TUint aKey, const TDesC& aValue);
- void HandlePropertyChangeErrorL(const TUid& aCategory, const TUint aKey, TInt aError);
-
- private: // Data
-
- /** Array of audio policy categories that radio must not resume after. */
- RArray<TInt> iNoAutoResumeAudioCategories;
-
- /**Observer which will be notified of the call and network state changes*/
- MFMRadioSystemEventDetectorObserver& iObserver;
-
- /**An array of handlers to Publish & Subscribe interface*/
- RPointerArray<CFMRadioPropertyObserver> iPropertyArray;
-
- /**Indicator for the network status*/
- TBool iIsNetworkCoverage;
- // for tracking currently playing audio clients
- TInt iNumberOfActiveAudioClients;
- /** Indicator for Voice UI status. */
- TBool iIsVoiceUiActive;
- /** flag for call status */
- TBool iIsCallActive;
- /** call status observer */
- CFMRadioPropertyObserver* iCallStatusObserver;
- /* timer for audio auto resume */
- CPeriodic* iAutoResumeTimer;
-
- };
-
-#endif // CFMRADIOSYSTEMEVENTDETECTOR_H
-
--- a/fmradio/fmradioengine/inc/fmradiosystemeventdetectorobserver.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Interface to observe system events.
-* Implementer will be notified each time particular system component
-* state has changed.
-*
-*/
-
-
-#ifndef MFMRADIOSYSTEMEVENTDETECTOROBSERVER_H
-#define MFMRADIOSYSTEMEVENTDETECTOROBSERVER_H
-
-// CLASS DECLARATION
-/**
-*
-* Observer for the call and network state. Implementer will be notified each time the state has changed
-*/
-class MFMRadioSystemEventDetectorObserver
- {
- public: // New functions
-
- /**
- * This callback notifies when networks comes up.
- */
- virtual void NetworkUpCallbackL() = 0;
-
- /**
- * This callback notifies when network goes down.
- */
- virtual void NetworkDownCallbackL() = 0;
-
- /**
- * This callback notifies when audio resources become available.
- */
- virtual void AudioResourcesAvailableL() = 0;
-
- /**
- * This callback notifies when audio auto resuming is forbidden.
- */
- virtual void AudioAutoResumeForbiddenL() = 0;
-
- /**
- * This callback notifies when call becomes active.
- */
- virtual void CallActivatedCallbackL() = 0;
-
- /**
- * This callback notifies when call becomes deactive.
- */
- virtual void CallDeactivatedCallbackL() = 0;
-
- };
-
-#endif // MFMRADIOSYSTEMEVENTDETECTOROBSERVER_H
-
-// End of File
--- a/fmradio/fmradioengine/inc/fmradiosystemutils.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: FM Radio related definitions
-*
-*/
-
-#ifndef FMRADIOSYSTEMUTILS_H
-#define FMRADIOSYSTEMUTILS_H
-
-#include <e32std.h>
-
-/** Direction of tuning */
-enum TFMRadioTuneDirection
- {
- EFMRadioDown,
- EFMRadioUp
- };
-
-/** Direction when setting the volume */
-enum TFMRadioVolumeSetDirection
- {
- EFMRadioDecVolume,
- EFMRadioIncVolume
- };
-
-#endif // FMRADIOSYSTEMUTILS_H
-
-
--- a/fmradio/fmradioengine/rom/fmradioengine.iby Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: File for listing dll's needed
-*
-*/
-
-
-
-#ifndef FMRADIOENGINE_IBY
-#define FMRADIOENGINE_IBY
-
-#include <bldvariant.hrh>
-#ifdef __S60_FM_RADIO_APPLICATION
-file=ABI_DIR\BUILD_DIR\fmradioengine.dll SHARED_LIB_DIR\fmradioengine.dll
-
-// Backup
-data=ZPRIVATE\2001B25E\backup_registration.xml PRIVATE\2001B25E\backup_registration.xml
-// Cenrep
-data=ZPRIVATE\10202BE9\2001B25E.txt PRIVATE\10202BE9\2001B25E.txt
-
-#endif // __S60_FM_RADIO_APPLICATION
-#endif // FMRADIOENGINE_IBY
-
-
--- a/fmradio/fmradioengine/src/fmradioaccessoryobserver.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: accessory observer
-*
-*/
-
-
-#include <AccPolGenericID.h>
-
-#include "fmradioaccessoryobserver.h"
-#include "fmradioheadseteventobserver.h"
-#include "debug.h"
-
-// ---------------------------------------------------------------------------
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CFMRadioAccessoryObserver::CFMRadioAccessoryObserver() :
- CActive( CActive::EPriorityStandard ),
- iObserver( NULL )
- {
- FTRACE( FPrint(_L("CFMRadioAccessoryObserver::CFMRadioAccessoryObserver()") ) );
- }
-
-
-// ---------------------------------------------------------------------------
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAccessoryObserver::ConstructL()
- {
- FTRACE( FPrint(_L("CFMRadioAccessoryObserver::ConstructL() -- ENTER") ) )
- User::LeaveIfError( iAccessoryServer.Connect() );
-
- // Creates a new sub-session within an existing session.
- User::LeaveIfError( iAccessoryModeSession.CreateSubSession( iAccessoryServer ) );
- User::LeaveIfError( iAccessoryModeSession.GetAccessoryMode( iAccPolAccessoryMode ) );
-
- iPrevAccMode = iAccPolAccessoryMode;
-
- CActiveScheduler::Add( this );
- // Accessory mode is always listened
- iAccessoryModeSession.NotifyAccessoryModeChanged( iStatus, iAccPolAccessoryMode );
- SetActive();
- FTRACE( FPrint(_L("CFMRadioAccessoryObserver::ConstructL() -- EXIT") ) )
- }
-
-
-// ---------------------------------------------------------------------------
-// Static constructor.
-// ---------------------------------------------------------------------------
-//
-CFMRadioAccessoryObserver* CFMRadioAccessoryObserver::NewL()
- {
- CFMRadioAccessoryObserver* self = new( ELeave ) CFMRadioAccessoryObserver;
-
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
-
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioAccessoryObserver::~CFMRadioAccessoryObserver()
- {
- Cancel();
- iAccessoryModeSession.CloseSubSession();
- iAccessoryServer.Close();
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioAccessoryObserver::IsHeadsetAccessoryConnected
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioAccessoryObserver::IsHeadsetAccessoryConnected() const
- {
- TBool accessoryConnected;
-
-#ifdef __WINS__
- accessoryConnected = ETrue;
-#else
- switch ( iAccPolAccessoryMode.iAccessoryMode )
- {
- case EAccModeWiredHeadset: // Falls through.
- case EAccModeLoopset: // Falls through.
- case EAccModeHeadphones:
- {
- accessoryConnected = ETrue;
- break;
- }
- default:
- {
- accessoryConnected = EFalse;
- break;
- }
- }
-#endif
- return accessoryConnected;
- }
-
-
-// ---------------------------------------------------------------------------
-// CFMRadioAccessoryObserver::SetObserver
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAccessoryObserver::SetObserver( MFMRadioHeadsetEventObserver* aObserver )
- {
- iObserver = aObserver;
- }
-
-
-// ---------------------------------------------------------------------------
-// From class CActive
-// CFMRadioAccessoryObserver::RunL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAccessoryObserver::RunL()
- {
- TRequestStatus status = iStatus;
- if ( status == KErrNone )
- {
- // Accessory mode may change when combined connection status changes
- // or when audio routing status changes.
- if ( iObserver )
- {
- if ( iPrevAccMode.iAccessoryMode == iAccPolAccessoryMode.iAccessoryMode &&
- iPrevAccMode.iAudioOutputStatus != iAccPolAccessoryMode.iAudioOutputStatus )
- {
- // do nothing since we don't want another callback from same event
- }
- else
- {
- if ( IsHeadsetAccessoryConnected() )
- {
- iObserver->HeadsetAccessoryConnectedCallbackL();
- }
- else
- {
- iObserver->HeadsetAccessoryDisconnectedCallbackL();
- }
- }
- iPrevAccMode = iAccPolAccessoryMode;
- }
- }
- iAccessoryModeSession.NotifyAccessoryModeChanged( iStatus, iAccPolAccessoryMode );
- SetActive();
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive
-// CFMRadioAccessoryObserver::DoCancel
-// ---------------------------------------------------------------------------
-//
-void CFMRadioAccessoryObserver::DoCancel()
- {
- iAccessoryModeSession.CancelNotifyAccessoryModeChanged();
- }
--- a/fmradio/fmradioengine/src/fmradioengine.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2073 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The class implements the core functionality of the Radio Engine
-*
-*/
-
-
-// INCLUDE FILES
-#include <AudioOutput.h>
-#include <AccMonitor.h>
-#include <bautils.h>
-#include <coemain.h>
-#include <ctsydomainpskeys.h>
-#include <data_caging_path_literals.hrh>
-#include <e32property.h>
-
-#include "fmradioengine.h"
-#include "fmradioenginestatechangecallback.h"
-#include "debug.h"
-#include "fmradioengineradiosettings.h"
-#include "fmradioengineradiostatehandler.h"
-#include "fmradioenginecentralrepositoryhandler.h"
-#include "fmradioenginecrkeys.h"
-#include "fmradiosystemeventdetector.h"
-#include "fmradiomobilenetworkinfolistener.h"
-#include "fmradiopubsub.h"
-#include "fmradiordsreceiver.h"
-#include "fmradiordsreceiversimulator.h"
-#include "fmradioaccessoryobserver.h"
-#ifndef __ACCESSORY_FW
-#include "fmradioenginedosserverobserver.h"
-#endif
-
-// CONSTANTS
-
-const TInt KFMRadioNumberOfVolumeSteps = 20;
-
-// ============================ MEMBER FUNCTIONS ===============================
-// ----------------------------------------------------
-// CRadioEngine::CRadioEngine
-// Default class constructor.
-// ----------------------------------------------------
-//
-CRadioEngine::CRadioEngine(
- MRadioEngineStateChangeCallback& aCallback)
- :
- iAutoResume(EFalse),
- iCurrentRadioState(EStateRadioOff),
- iCallback(aCallback),
- iTempFrequency(KDefaultRadioFrequency),
- iTunePresetRequested(EFalse),
- iInitializeRadioRequestExists(EFalse),
- ilineConstructed( EFalse ),
- iHFOptionActivated ( EFalse )
- {
- }
-
-// ----------------------------------------------------
-// CRadioEngine::ConstructL
-// Second phase class constructor.
-// ----------------------------------------------------
-//
-void CRadioEngine::ConstructL()
- {
- FTRACE(FPrint(_L("CRadioEngine::ConstructL()")));
-
- TRAP_IGNORE( ConnectLineL() );
-
- InitializeResourceLoadingL();
-
- iRadioSettings = new ( ELeave ) TRadioSettings;
-
- iCentralRepositoryHandler = CCentralRepositoryHandler::NewL( *iRadioSettings );
-
-#ifdef __WINS__
- // NetworkInfoListener takes care of listening to the network id and country code.
- iNetworkInfoListener = CFMRadioMobileNetworkInfoListener::NewL( *this );
-#endif
-
- // for monitoring network availability
- iSystemEventDetector = CFMRadioSystemEventDetector::NewL( *this );
-
- // create an instance of Radio Utility factory and indicate
- // FM Radio is a primary client
- iRadioUtility = CRadioUtility::NewL( ETrue );
-
- // Get a tuner utility
- iFmTunerUtility = &iRadioUtility->RadioFmTunerUtilityL( *this );
-
- // Get a player utility
- iPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this );
-
- TInt maxVolume = 0;
- iPlayerUtility->GetMaxVolume( maxVolume );
- FTRACE(FPrint(_L("CRadioEngine::ConstructL() maxVolume %d"), maxVolume ) );
- // calculate multiplier for scaling the UI volume to the value used by DevSound
- iUiVolumeFactor = ( static_cast<TReal> ( maxVolume ) / KFMRadioNumberOfVolumeSteps );
-
-
- // Get a preset utility
- iPresetUtility = CRadioFmPresetUtility::NewL( *this );
-
-#ifdef __WINS__
- iRdsReceiver = CFMRadioRdsReceiverSimulator::NewL( *iRadioSettings );
- static_cast<CFMRadioRdsReceiverSimulator*> ( iRdsReceiver )->SetRadioEngineForRadioFmTunerSimulation( this );
-#else
- iRdsReceiver = CFMRadioRdsReceiver::NewL( *iRadioSettings );
-#endif
-
- iRdsReceiver->AddObserver( this );
-
- iStateHandler = CRadioStateHandler::NewL( this );
-
-#ifndef __ACCESSORY_FW
- iDosServerObserver = CDosServerObserver::NewL( this, iRadioSettings );
-#else
-#ifndef __WINS
- TRAP_IGNORE( iAudioOutput = CAudioOutput::NewL( *iPlayerUtility ) );
-#endif
-#endif
-
- iTopFrequency = 0;
- iBottomFrequency = 0;
-
- TInt callState = KErrUnknown;
- RMobileCall::TMobileCallStatus linestatus;
- iLine.GetMobileLineStatus( linestatus );
- RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState);
-
- // check status from line
- if ( linestatus != RMobileCall::EStatusIdle &&
- linestatus != RMobileCall::EStatusUnknown )
- {
- // Pre-empted due to phone call, start Call State Observer
- iInCall = ETrue;
- }
- // accessory observer
- iHeadsetObserver = CFMRadioAccessoryObserver::NewL();
- iHeadsetObserver->SetObserver( this );
- // Set audio output to current setting
- if ( iHeadsetObserver->IsHeadsetAccessoryConnected() )
- {
- SetAudioOutput( EFMRadioOutputHeadset );
- }
- else
- {
- SetAudioOutput( EFMRadioOutputIHF );
- }
- // Assume headset is connected, we'll be notified later if it's not.
- iRadioSettings->SetHeadsetConnected();
-
-
- // Create P&S interface.
- iPubSub = CFMRadioPubSub::NewL();
-
- // Publish antenna status as connected, we'll be notified later if it's not.
- iPubSub->PublishAntennaStatusL( EFMRadioPSHeadsetConnected );
-
- iPubSub->PublishFrequencyDecimalCountL(
- TFMRadioPSFrequencyDecimalCount( iRadioSettings->DecimalCount() ) );
-
- if ( iRadioSettings->StartupCount() == 0 )
- {
- ResetPresetsL();
- }
-
- FTRACE(FPrint(_L("CRadioEngine::ConstructL() End ")));
- }
-
-// ----------------------------------------------------
-// CRadioEngine::ConnectLineL
-// Connects etel server
-// ----------------------------------------------------
-//
-void CRadioEngine::ConnectLineL()
- {
- User::LeaveIfError( iTelServer.Connect() );
-
- iTelServer.GetTsyName( 0, iTsyName );
-
- User::LeaveIfError( iTelServer.LoadPhoneModule( iTsyName ) );
- TInt numberOfPhones( 0 );
- User::LeaveIfError( iTelServer.EnumeratePhones( numberOfPhones ) );
-
- RTelServer::TPhoneInfo phoneInfo;
-
- // Only possible thing to do is leave. We definately need phone.
- User::LeaveIfError( iTelServer.GetPhoneInfo( 0, phoneInfo ) );
-
- // Only possible thing to do is leave. We definately need phone.
- User::LeaveIfError( iPhone.Open( iTelServer, phoneInfo.iName ));
-
-
- RPhone::TLineInfo lineInfo;
-
- User::LeaveIfError( iPhone.GetLineInfo( 0, lineInfo ) );
-
- User::LeaveIfError( iLine.Open( iPhone, lineInfo.iName ) );
-
- ilineConstructed = ETrue;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::NewL
-// Two-phased class constructor.
-// ----------------------------------------------------
-//
-EXPORT_C CRadioEngine* CRadioEngine::NewL(
- MRadioEngineStateChangeCallback& aCallback )
- {
- CRadioEngine* self = new (ELeave) CRadioEngine( aCallback );
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::~CRadioEngine
-// Destructor of CRadioEngine class.
-// ----------------------------------------------------
-////
-EXPORT_C CRadioEngine::~CRadioEngine()
- {
- FTRACE(FPrint(_L("CRadioEngine::~CRadioEngine()")));
- if ( iCentralRepositoryHandler)
- {
- iCentralRepositoryHandler->SaveEngineSettings();
- delete iCentralRepositoryHandler;
- }
-
- delete iPubSub;
- delete iHeadsetObserver;
-
- RadioOff();
-
- delete iNetworkInfoListener;
- delete iSystemEventDetector;
- delete iPresetUtility;
- delete iRadioSettings;
- delete iStateHandler;
-
- if ( iAudioOutput )
- {
- TRAP_IGNORE(iAudioOutput->SetAudioOutputL(CAudioOutput::EPrivate));
- delete iAudioOutput;
- }
-
- if ( iRdsReceiver )
- {
- iRdsReceiver->RemoveObserver( this );
- }
-
- delete iRdsReceiver;
-
- if ( iFmTunerUtility )
- {
- iFmTunerUtility->Close();
- }
-
- if ( iPlayerUtility )
- {
- iPlayerUtility->Close();
- }
-
- delete iRadioUtility;
-
- #ifndef __ACCESSORY_FW
- if (iDosServerObserver)
- {
- iDosServerObserver->SetAudioRouting(EFMRadioOutputHeadset);
- delete iDosServerObserver;
- }
- #endif
-
- if ( iFMRadioEngineResourceOffset > 0 )
- {
- CCoeEnv::Static()->DeleteResourceFile( iFMRadioEngineResourceOffset );
- }
-
- if ( ilineConstructed )
- {
- iLine.Close();
- iPhone.Close();
- iTelServer.UnloadPhoneModule( iTsyName );
- iTelServer.Close();
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::InitializeRadio
-// Set radio settings to their default values.
-// Returns: None
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::InitializeRadio()
- {
- FTRACE(FPrint(_L("CRadioEngine::InitializeRadio()")));
- iInitializeRadioRequestExists = ETrue;
- Tune( iRadioSettings->Frequency() );
-#ifdef __WINS__
- // MrftoRequestTunerControlComplete never completes in WINS, so initialize RdsReceiver here
- TRAP_IGNORE( iRdsReceiver->InitL( *iRadioUtility, iPubSub ) );
-#endif
- }
-
-// ----------------------------------------------------
-// CRadioEngine::RadioOn
-// Start the radio.
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::RadioOn()
- {
- FTRACE(FPrint(_L("CRadioEngine::RadioOn()")));
- if ( !iRadioSettings->IsRadioOn() )
- {
- FTRACE(FPrint(_L("CRadioEngine::RadioOn() - Turning Radio on, calling play")));
- iRadioSettings->SetRadioOn();
- iPlayerUtility->Play();
-
- if ( iPubSub )
- {
- TRAP_IGNORE( iPubSub->PublishStateL( ETrue ) );
- }
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::RadioOff
-// Stops the radio.
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::RadioOff()
- {
- FTRACE(FPrint(_L("CRadioEngine::RadioOff()")));
- if ( iStateHandler )
- {
- iStateHandler->Cancel();
- }
-
- iCurrentRadioState = EStateRadioOff;
-
- if( iFmTunerUtility &&
- iRadioSettings &&
- iRadioSettings->RadioMode() == ERadioTunerMode )
- {
- CancelScan();
- }
-
- if ( iPlayerUtility &&
- iPlayerUtility->PlayerState() == ERadioPlayerPlaying )
- {
- iPlayerUtility->Stop();
- }
-
- if ( iPubSub )
- {
- TRAP_IGNORE( iPubSub->PublishStateL( EFalse ) );
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::IsRadioOn
-// Returns the radio status.
-// ----------------------------------------------------
-//
-EXPORT_C TBool CRadioEngine::IsRadioOn()
- {
- return iRadioSettings->IsRadioOn();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::IsOfflineProfileL
-// Checks if offine profile is current active profile
-// Returns: true/false
-// ----------------------------------------------------
-//
-EXPORT_C TBool CRadioEngine::IsOfflineProfileL()
- {
- return iCentralRepositoryHandler->IsOfflineProfileActiveL();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::Tune
-// Tune to the specified frequency
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::Tune( TInt aFrequency, TRadioMode aRadioMode )
- {
- FTRACE(FPrint(_L("CRadioEngine::Tune()")));
- iTempFrequency = aFrequency;
-
- iRadioSettings->SetRadioMode( aRadioMode );
- if ( iTunerControl )
- {
- iFmTunerUtility->SetFrequency( aFrequency );
- }
- else
- {
- StoreAndPublishFrequency( aFrequency );
- }
- if ( iPubSub )
- {
- TRAP_IGNORE
- (
- iPubSub->PublishFrequencyL( aFrequency );
- if( aRadioMode == ERadioTunerMode )
- {
- iPubSub->PublishChannelNameL( KNullDesC );
- iPubSub->PublishChannelL( KErrNotFound );
- }
- )
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::SetTunerModeOn
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetTunerModeOn()
- {
- FTRACE(FPrint(_L("CRadioEngine::SetTunerModeOn()")));
-
- iRadioSettings->SetRadioMode( ERadioTunerMode );
-
- if ( iPubSub )
- {
- TRAP_IGNORE
- (
- iPubSub->PublishChannelNameL( KNullDesC );
- iPubSub->PublishChannelL( KErrNotFound );
- )
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::ScanUp
-// Scan up to the next available frequency
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::ScanUp()
- {
- iRadioSettings->SetRadioMode(ERadioTunerMode);
- iFmTunerUtility->StationSeek( ETrue );
- TRAP_IGNORE
- (
- iTuningState = EFMRadioPSTuningStarted;
- iPubSub->PublishTuningStateL( iTuningState );
- iPubSub->PublishChannelNameL( KNullDesC );
- iPubSub->PublishChannelL( KErrNotFound );
- )
- }
-
-// ----------------------------------------------------
-// CRadioEngine::ScanDown
-// Scan down to the last available frequency
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::ScanDown()
- {
- iRadioSettings->SetRadioMode(ERadioTunerMode);
- iFmTunerUtility->StationSeek( EFalse );
- TRAP_IGNORE
- (
- iTuningState = EFMRadioPSTuningStarted;
- iPubSub->PublishTuningStateL( iTuningState );
- iPubSub->PublishChannelNameL( KNullDesC );
- iPubSub->PublishChannelL( KErrNotFound );
- )
- }
-
-// ----------------------------------------------------
-// CRadioEngine::CancelScan
-// Cancel previously requested scan, and return to the
-// already tuned frequency
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::CancelScan()
- {
- if( iFmTunerUtility )
- {
- iFmTunerUtility->CancelStationSeek();
- iTuningState = EFMRadioPSTuningUninitialized;
- TRAP_IGNORE(iPubSub->PublishTuningStateL( iTuningState ));
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::IsHeadsetConnected
-// Check whether the headset is currently connected
-// Returns: true/false
-// ----------------------------------------------------
-//
-EXPORT_C TBool CRadioEngine::IsHeadsetConnected() const
- {
- return iRadioSettings->IsHeadsetConnected();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::IsFlightmodeEnabled
-// Check whether flight mode is currently enabled
-// Returns: true/false
-// ----------------------------------------------------
-//
-EXPORT_C TBool CRadioEngine::IsFlightModeEnabled() const
- {
- return iRadioSettings->IsFlightModeEnabled();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::SetMuteOn
-// Sets the audio mute state
-// Returns: None
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetMuteOn(
- TBool aMuteOn) // a flag indicating if set mute on
- {
- FTRACE(FPrint(_L("CRadioEngine::SetMuteOn()")));
- TInt error = KErrNone;
- if ( IsMuteOn() && (!aMuteOn) )
- {
- error = iPlayerUtility->Mute( EFalse );
- if( !error )
- {
- FTRACE(FPrint(_L("CRadioEngine::SetMuteOn() setting mute off")));
- iRadioSettings->SetMuteOff();
- TRAP_IGNORE(iPubSub->PublishRadioMuteStateL(EFalse));
- }
- }
- else if ( !IsMuteOn() && aMuteOn )
- {
- error = iPlayerUtility->Mute( ETrue );
- if( !error )
- {
- FTRACE(FPrint(_L("CRadioEngine::SetMuteOn() setting mute on")));
- iRadioSettings->SetMuteOn();
- TRAP_IGNORE(iPubSub->PublishRadioMuteStateL(ETrue));
- }
- }
- iStateHandler->Callback( MRadioEngineStateChangeCallback::EFMRadioEventSetMuteState, error );
- }
-
-
-// ----------------------------------------------------
-// CRadioEngine::IsMuteOn
-// Gets the audio mute state
-// Returns: true/false
-// ----------------------------------------------------
-//
-EXPORT_C TBool CRadioEngine::IsMuteOn() const
- {
- return iRadioSettings->IsMuteOn();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetPresetIndex
-// Retrieve the currently selected channel
-// Returns: the preset channel index
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::GetPresetIndex() const
- {
- return iRadioSettings->CurrentPreset();
- }
-
-
-// ----------------------------------------------------
-// CRadioEngine::SetPresetFrequency
-// Update the channel located at the index to use the frequency specified.
-// Returns: None
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetPresetNameFrequencyL(
- TInt aIndex, // preset channel index
- const TStationName& aStationName,
- TInt aFrequency) // preset channel frequency
- {
- iPresetUtility->SetPresetL(aIndex, aStationName, aFrequency);
- if( aIndex == iRadioSettings->CurrentPreset() )
- {
- iPubSub->PublishChannelNameL( aStationName );
- if( aFrequency == 0 )
- {
- // Current preset was deleted
- iPubSub->PublishChannelL( KErrNotFound );
- }
- }
- iPubSub->PublishChannelDataChangedL( aIndex );
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetPresetFrequency
-// Retrieve the channel frequency at the index specified
-// Returns: tmpFrequency: preset frequency
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::GetPresetFrequencyL(
- TInt aIndex) const // preset channel index
- {
- TInt tmpFrequency = KDefaultRadioFrequency;
- TStationName tmpStationName;
-
- iPresetUtility->GetPresetL( aIndex, tmpStationName, tmpFrequency );
-
- FTRACE(FPrint(_L("CRadioEngine::GetPresetFrequencyL() aIndex %d"), aIndex));
- FTRACE(FPrint(_L("CRadioEngine::GetPresetFrequencyL() Freq %d"), tmpFrequency));
- FTRACE(FPrint(_L("CRadioEngine::GetPresetFrequencyL() Name %S"), &tmpStationName));
- return tmpFrequency;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetPresetName
-// Retrieve the channel name at the index specified
-// Returns: tmpStationName: the channel name
-// ----------------------------------------------------
-//
-EXPORT_C CRadioEngine::TStationName& CRadioEngine::GetPresetNameL( TInt aIndex )
- {
- TInt tmpFrequency;
-
- iPresetUtility->GetPresetL(aIndex, iStationName, tmpFrequency);
- FTRACE(FPrint(_L("CRadioEngine::GetPresetFrequencyL() Freq %d"),tmpFrequency));
- FTRACE(FPrint(_L("CRadioEngine::GetPresetFrequencyL() Name %S"),&iStationName));
- return iStationName;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetPresetNameAndFrequencyL
-// get preset name frequency from the preset utility
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::GetPresetNameAndFrequencyL( TInt aIndex, TDes& aName, TInt& aFrequency )
- {
- TInt tmpFrequency;
- TStationName tmpStationName;
-
- iPresetUtility->GetPresetL( aIndex, tmpStationName, tmpFrequency );
-
- aFrequency = tmpFrequency;
- aName = tmpStationName;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetTunedFrequency
-// Retrieves the current frequency.
-// Returns: channel frequency
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::GetTunedFrequency() const
- {
- return iRadioSettings->Frequency();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::SetVolume
-// Sets the volume level of the FM radio
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetVolume(
- TInt aVolume )
- {
- FTRACE(FPrint(_L("CRadioEngine::SetVolume( %d )"), aVolume ));
-
- if ( aVolume < 0 )
- {
- aVolume = 0;
- }
- else if ( aVolume > KFMRadioNumberOfVolumeSteps )
- {
- aVolume = KFMRadioNumberOfVolumeSteps;
- }
-
- TInt playerVolume = ( iUiVolumeFactor * aVolume );
-
- FTRACE(FPrint(_L("CRadioEngine::SetVolume() playerVolume %d"), playerVolume ));
-
- TInt error = iPlayerUtility->SetVolume( playerVolume );
-
- if ( !error )
- {
- if ( iRadioSettings->AudioOutput() == EFMRadioOutputHeadset )
- {
- iRadioSettings->SetHeadsetVolume( aVolume );
- iCentralRepositoryHandler->SaveHeadsetVolumeSetting();
- }
- else
- {
- iRadioSettings->SetSpeakerVolume( aVolume );
- iCentralRepositoryHandler->SaveSpeakerVolumeSetting();
- }
- }
- else
- {
- iStateHandler->Callback( MRadioEngineStateChangeCallback::EFMRadioEventVolumeUpdated, error );
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetRadioMode
-// Retrieves the current radio mode (tuner or preset).
-// Returns: radio mode
-// ----------------------------------------------------
-//
-EXPORT_C CRadioEngine::TRadioMode CRadioEngine::GetRadioMode() const
- {
- return iRadioSettings->RadioMode();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetVolume
-// Gets the volumelevel.
-// Returns: volume
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::GetVolume() const
- {
- if ( iRadioSettings->AudioOutput() == EFMRadioOutputHeadset )
- {
- return iRadioSettings->HeadsetVolume();
- }
- else
- {
- return iRadioSettings->SpeakerVolume();
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetMaxVolume
-// Gets the max volumelevel.
-// Returns: max volume
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::GetMaxVolume() const
- {
- TInt maxVolume;
- iPlayerUtility->GetMaxVolume( maxVolume );
- return maxVolume;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetAudioMode
-// Gets the current audio mode.
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::GetAudioMode() const
- {
- return iRadioSettings->AudioMode();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::SetAudioMode
-// Set the radio's audio mode (stereo or mono)
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetAudioMode( const TFMRadioAudioMode aAudioMode )
- {
- FTRACE(FPrint(_L("CRadioEngine::SetAudioMode")));
- TBool forcedMono = EFalse;
- TInt res = KErrNone;
- TFMRadioAudioMode audioMode = iRadioSettings->AudioMode();
- if (audioMode != aAudioMode)
- {
- if ( aAudioMode == EFMRadioMono )
- {
- forcedMono = ETrue;
- }
- res = iFmTunerUtility->ForceMonoReception( forcedMono );
- if ( res )
- {
- iRadioSettings->SetAudioMode( aAudioMode );
- }
- }
- iStateHandler->Callback( MRadioEngineStateChangeCallback::EFMRadioEventSetAudioMode, res );
- }
-
-// ----------------------------------------------------
-// CRadioEngine::GetAudioOutput
-// Retrieve the current audio output
-// Returns: audio output
-// ----------------------------------------------------
-//
-EXPORT_C CRadioEngine::TFMRadioAudioOutput CRadioEngine::GetAudioOutput() const
- {
- return iRadioSettings->AudioOutput();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::SetAudioOutput
-// Sets the audio Output
-// Returns: None
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetAudioOutput( const TFMRadioAudioOutput aAudioOutput )
- {
- FTRACE(FPrint(_L("CRadioEngine::SetAudioOutput() Output = %d"), aAudioOutput));
- TInt tempError = KErrNone;
- // use mute here to avoid any audio peaks during output change
- SetMuteOn( ETrue );
-
- TBool btAudioConnected = EFalse;
- TRAPD( err, btAudioConnected = IsBTAccessoryConnectedL(); )
- if ( err != KErrNone )
- {
- btAudioConnected = ETrue;
- }
-
-#ifndef __ACCESSORY_FW
-
- tempError = iDosServerObserver->SetAudioRouting(aAudioOutput);
- FTRACE(FPrint(_L("CRadioEngine::SetAudioOutput() tempError = %d"), tempError));
-
-#else
-
- CAudioOutput::TAudioOutputPreference outputPreference = CAudioOutput::EPrivate;
-
- if( btAudioConnected && !iHeadsetObserver->IsHeadsetAccessoryConnected() )
- {
- FTRACE(FPrint(_L("CRadioEngine::SetAudioOutput() EPublic don't route to BT")));
- outputPreference = CAudioOutput::EPublic;
- }
- else if ( EFMRadioOutputHeadset == aAudioOutput )
- {
- FTRACE(FPrint(_L("CRadioEngine::SetAudioOutput() Headset is set to Output")));
- outputPreference = CAudioOutput::EPrivate;
- }
- else if ( EFMRadioOutputIHF == aAudioOutput )
- {
- FTRACE(FPrint(_L("CRadioEngine::SetAudioOutput() IHF is set to Output")));
-
- if ( iHeadsetObserver->IsHeadsetAccessoryConnected() )
- { //user has chosen 'Activate IHF' in options menu
- iHFOptionActivated = ETrue;
- }
- outputPreference = CAudioOutput::EPublic;
- }
-
-#ifndef __WINS
- if ( iAudioOutput )
- {
- TRAP( tempError, iAudioOutput->SetAudioOutputL( outputPreference ) );
- }
-#endif
-
-#endif
-
- if ( KErrNone == tempError )
- {
- if ( !iHeadsetObserver->IsHeadsetAccessoryConnected() )
- {
- iRadioSettings->SetAudioOutput( EFMRadioOutputIHF );
- }
- else
- {
- iRadioSettings->SetAudioOutput( aAudioOutput );
- }
- }
-
- iStateHandler->Callback( MRadioEngineStateChangeCallback::EFMRadioEventSetAudioOutput, tempError );
- }
-
-// ----------------------------------------------------
-// CRadioEngine::SetRdsAfSearchEnable
-// Sets the rds af search enabled
-// Returns: None
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetRdsAfSearchEnable( TBool aEnabled )
- {
- TRAP_IGNORE( iRdsReceiver->SetAutomaticSwitchingL( aEnabled ) );
- aEnabled ? iRadioSettings->SetRdsAfSearchEnabled() : iRadioSettings->SetRdsAfSearchDisabled();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::RadioSettings
-// ----------------------------------------------------
-//
-EXPORT_C TRadioSettings& CRadioEngine::RadioSettings( )
- {
- return *iRadioSettings;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::TunePreset
-// Tunes to the chosen channel.
-// Returns: None
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::TunePresetL( TInt aIndex )
- {
- FTRACE(FPrint(_L("CRadioEngine::TunePresetL()")));
- iRadioSettings->SetCurrentPreset( aIndex );
- TInt tmpFrequency = 0;// changed back to zero
- TStationName name;
-
- iPresetUtility->GetPresetL( aIndex, name, tmpFrequency );
- // Should not tune if the radio is not on.
- if ( iRadioSettings->IsRadioOn())
- {
- FTRACE(FPrint(_L("CRadioEngine::TunePresetL() inside if")));
- iTunePresetRequested = ETrue;
- iTempFrequency = tmpFrequency;
- Tune(tmpFrequency, ERadioPresetMode);
- }
- else
- {
- StoreAndPublishFrequency( tmpFrequency );
- }
- iPubSub->PublishChannelNameL( name );
- iPubSub->PublishChannelL( aIndex );
- iRadioSettings->SetRadioMode(ERadioPresetMode);
- FTRACE(FPrint(_L("CRadioEngine::TunePresetL() end %d"),tmpFrequency));
- }
-
-// ----------------------------------------------------
-// CRadioEngine::5
-// Return min and max freq for the specified range (band)
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::GetFrequencyBandRange(
- TInt& aBottomFrequency,
- TInt& aTopFrequency)
- {
- TBool err = KErrNone;
-
- aBottomFrequency = iCentralRepositoryHandler->MinFrequency() * KFMRadioFreqMultiplier;
- aTopFrequency = iCentralRepositoryHandler->MaxFrequency() * KFMRadioFreqMultiplier;
-
- return err;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::IsInCall
-// ----------------------------------------------------
-//
-EXPORT_C TBool CRadioEngine::IsInCall() const
- {
- return iInCall;
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::FrequencySetByRdsAf
-// ---------------------------------------------------------
-//
-EXPORT_C TBool CRadioEngine::FrequencySetByRdsAf() const
- {
- return iFrequencySetByRdsAf;
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::RdsReceiver
-// ---------------------------------------------------------
-//
-EXPORT_C CFMRadioRdsReceiverBase& CRadioEngine::RdsReceiver()
- {
- return *iRdsReceiver;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::HandleFlightModeEnabled
-// Switches the engine into flight mode, and notifies the UI of
-// the change in status.
-// ----------------------------------------------------
-//
-void CRadioEngine::HandleFlightModeEnabled()
- {
- FTRACE(FPrint(_L("CRadioEngine::HandleFlightModeEnabled()")));
- iRadioSettings->SetFlightMode(ETrue);
- HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventFlightModeEnabled, KErrNone);
- }
-
-// ----------------------------------------------------
-// CRadioEngine::HandleFlightModeDisabled
-// Switches the engine out of flight mode, and notifies the UI of
-// the change in status
-// ----------------------------------------------------
-//
-void CRadioEngine::HandleFlightModeDisabled()
- {
- FTRACE(FPrint(_L("CRadioEngine::HandleFlightModeDisabled()")));
- iRadioSettings->SetFlightMode(EFalse);
- HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventFlightModeDisabled, KErrNone);
- }
-
-
-// ----------------------------------------------------
-// CRadioEngine::HandleCallback
-// Calls the User Interface callback function, indicating the event code and
-// error code.
-// ----------------------------------------------------
-//
-void CRadioEngine::HandleCallback(TInt aEventCode, TInt aCode )
- {
- FTRACE(FPrint(_L("CRadioEngine::HandleCallback(aEventCode %d, aCode %d "), aEventCode, aCode ) );
- iCallback.HandleRadioEngineCallBack((MRadioEngineStateChangeCallback::TFMRadioNotifyEvent)aEventCode, aCode);
- }
-
-// ----------------------------------------------------
-// CRadioEngine::HandleHeadsetButtonPress
-// Notifies UI that the headset button has been pressed
-// ----------------------------------------------------
-//
-void CRadioEngine::HandleHeadsetButtonPress()
- {
- FTRACE(FPrint(_L("CRadioEngine::HandleHeadsetButtonPress()")));
- iStateHandler->Callback(MRadioEngineStateChangeCallback::EFMRadioEventButtonPressed, KErrNone);
- }
-
-// ----------------------------------------------------
-// CRadioEngine::HeadsetAccessoryConnectedCallbackL
-// ----------------------------------------------------
-//
-void CRadioEngine::HeadsetAccessoryConnectedCallbackL()
- {
- FTRACE(FPrint(_L("CRadioEngine::HeadsetAccessoryConnectedCallbackL")));
- // forward volume changes to headset
- if ( iHFOptionActivated )
- {
- iHFOptionActivated = EFalse;
- }
- else
- {
- SetAudioOutput( EFMRadioOutputHeadset );
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::HeadsetAccessoryDisconnectedCallbackL
-// ----------------------------------------------------
-//
-void CRadioEngine::HeadsetAccessoryDisconnectedCallbackL()
- {
- FTRACE(FPrint(_L("CRadioEngine::HeadsetAccessoryDisconnectedCallbackL")));
- // forward volume changes to speakers
- SetAudioOutput( EFMRadioOutputIHF );
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MrftoRequestTunerControlComplete
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoRequestTunerControlComplete(
- TInt aError )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrftoRequestTunerControlComplete() - Error = %d"), aError));
-
- if ( aError == KErrNone )
- {
- iTunerControl = ETrue;
- // Headset must be connected
- iRadioSettings->SetHeadsetConnected();
- iFmTunerUtility->GetCapabilities( iTunerCaps );
-
- if( iTunerCaps.iTunerFunctions & TFmTunerCapabilities::ETunerRdsSupport )
- {
- TRAP_IGNORE( iRdsReceiver->InitL( *iRadioUtility, iPubSub ) )
- }
-
- TFmRadioFrequencyRange japanFreqRange = EFmRangeJapan;
-
- if ( TunerFrequencyRangeForRegionId( RegionId() ) == japanFreqRange )
- {
- // region is Japan so we need to change the freq range from the default
- iFmTunerUtility->SetFrequencyRange( japanFreqRange );
- }
- else
- {
- // allready on correct freq range
- HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
- }
- }
- else if ( aError == KFmRadioErrAntennaNotConnected )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrftoRequestTunerControlComplete() - KFmRadioErrAntennaNotConnected")));
- iRadioSettings->SetHeadsetDisconnected();
- HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventHeadsetDisconnected, KErrNone );
- }
- else if ( aError == KErrAlreadyExists )
- {
- iTunerControl = ETrue;
- // Headset must be connected
- iRadioSettings->SetHeadsetConnected();
- iFmTunerUtility->GetCapabilities( iTunerCaps );
- TInt frequency;
- iFmTunerUtility->GetFrequency( frequency );
- StoreAndPublishFrequency( frequency );
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, KErrNone );
- }
- else if ( aError == KFmRadioErrFmTransmitterActive )
- {
- iTunerControl = EFalse;
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFMTransmitterOn, KErrNone );
- }
- else if ( aError == KFmRadioErrOfflineMode )
- {
- iTunerControl = EFalse;
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFlightModeEnabled, KErrNone );
- }
- else
- {
- //pass
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MrftoSetFrequencyRangeComplete
-//
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoSetFrequencyRangeComplete(
- TInt aError )
- {
- if ( aError == KErrNone )
- {
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
- }
-
- FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyRangeComplete() - error = %d"), aError));
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MrftoSetFrequencyComplete
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoSetFrequencyComplete(
- TInt aError )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyComplete() - aError = %d"), aError));
-
-
- if ( !aError )
- {
- iRdsReceiver->ClearRdsInformation();
- StoreAndPublishFrequency( iTempFrequency );
- if ( iTunePresetRequested )
- {
- iCentralRepositoryHandler->SaveEngineSettings();
- iTunePresetRequested = EFalse;
- }
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, aError );
-
- if ( iInitializeRadioRequestExists )
- {
- iInitializeRadioRequestExists = EFalse;
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFMRadioInitialized, KErrNone );
- }
- }
- else
- {
- iInitializeRadioRequestExists = EFalse;
-
- FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyComplete() - Sending event to UI")));
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, aError );
- }
-
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MrftoStationSeekComplete
-//
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoStationSeekComplete(
- TInt aError,
- TInt aFrequency )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrftoStationSeekComplete() - Frequency = %d"), aFrequency));
- FTRACE(FPrint(_L("CRadioEngine::MrftoStationSeekComplete() - error = %d"), aError));
-
- if ( !aError )
- {
- StoreAndPublishFrequency( aFrequency );
-
- iRdsReceiver->ClearRdsInformation();
- StoreAndPublishFrequency( aFrequency );
- if ( iTunePresetRequested )
- {
- iCentralRepositoryHandler->SaveEngineSettings();
- iTunePresetRequested = EFalse;
- }
- iTuningState = EFMRadioPSTuningUninitialized;
- // Process the callback first because it might change the tuning state and we must avoid switching it back and forth
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, aError );
- TRAP_IGNORE(iPubSub->PublishTuningStateL( iTuningState ));
-
- if ( iInitializeRadioRequestExists )
- {
- iInitializeRadioRequestExists = EFalse;
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFMRadioInitialized, KErrNone );
- }
- }
- else
- {
- iInitializeRadioRequestExists = EFalse;
-
- FTRACE(FPrint(_L("CRadioEngine::MrftoStationSeekComplete() - Sending event to UI")));
- iTuningState = EFMRadioPSTuningUninitialized;
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, aError );
- TRAP_IGNORE(iPubSub->PublishTuningStateL( iTuningState ));
- }
- }
-
-
-// ----------------------------------------------------
-// CRadioEngine::MrftoFmTransmitterStatusChange
-// The FM tuner is turned off when FM transmitter is on.
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoFmTransmitterStatusChange(
- TBool aActive )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrftoFmTransmitterStatusChange() - Active = %d"), aActive));
- if ( aActive )
- {
- // loses tuner control
- iTunerControl = EFalse;
- }
- }
-
-
-// ----------------------------------------------------
-// CRadioEngine::MrftoAntennaStatusChange
-// Called when antenna status changes.
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoAntennaStatusChange(
- TBool aAttached )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrftoAntennaStatusChange() - Antenna Status = %d"), aAttached));
- if ( aAttached )
- {
- if ( !iTunerControl )
- {
- iFmTunerUtility->RequestTunerControl();
- }
- iRadioSettings->SetHeadsetConnected();
- TRAP_IGNORE( iPubSub->PublishAntennaStatusL( EFMRadioPSHeadsetConnected ) );
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventHeadsetReconnected, KErrNone );
- }
- else
- {
- iRadioSettings->SetHeadsetDisconnected();
- TRAP_IGNORE( iPubSub->PublishAntennaStatusL( EFMRadioPSHeadsetDisconnected ) );
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventHeadsetDisconnected, KErrNone );
- }
- }
-
-
-// ----------------------------------------------------
-// CRadioEngine::FlightModeChanged
-// Called when offline mode status changes
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoOfflineModeStatusChange(
- TBool aOfflineMode )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrftoOfflineModeStatusChange() - Offline Mode = %d"), aOfflineMode));
-
- if( aOfflineMode )
- {
- HandleFlightModeEnabled();
- }
- else
- {
- if ( !iTunerControl )
- {
- iFmTunerUtility->RequestTunerControl();
- }
- HandleFlightModeDisabled();
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MrftoFrequencyRangeChange
-//
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoFrequencyRangeChange(
- TFmRadioFrequencyRange FDEBUGVAR( aNewRange ) )
- {
- FTRACE( FPrint(_L("CRadioEngine::MrftoFrequencyRangeChange() - Band = %d"), aNewRange ) );
- }
-
- // ----------------------------------------------------
-// CRadioEngine::MrftoFrequencyChange
-// Called when the tuned frequency changes
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoFrequencyChange(
- TInt aNewFrequency )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrftoFrequencyChange() - New Frequency = %d"), aNewFrequency));
-
- if ( iRadioSettings->Frequency() != aNewFrequency )
- {
- iRdsReceiver->ClearRdsInformation();
- StoreAndPublishFrequency( aNewFrequency );
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, KErrNone );
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MTsoForcedMonoChanged
-// Called when a client enables/disabled forced mono reception
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoForcedMonoChange(
- TBool aForcedMono )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrftoForcedMonoChange() - Forced Mono = %d"), aForcedMono));
- if ( aForcedMono )
- {
- iRadioSettings->SetAudioMode( EFMRadioMono );
- }
- else
- {
- iRadioSettings->SetAudioMode( EFMRadioStereo );
- }
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventSetAudioMode, KErrNone );
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MrftoSquelchChange
-//
-// error code.
-// ----------------------------------------------------
-//
-void CRadioEngine::MrftoSquelchChange(
- TBool /*aSquelch*/ )
- {
- }
-
-
-// ----------------------------------------------------
-// CRadioEngine::MrpoStateChange This is Tuner State
-// Called when the state of the tuner changes
-// ----------------------------------------------------
-//
-void CRadioEngine::MrpoStateChange(
- TPlayerState aState,
- TInt aError )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() - State Change = %d, Error = %d"), aState, aError));
-
- if ( !aError )
- {
- if ( aState == ERadioPlayerPlaying )
- {
- iRadioSettings->SetRadioOn();
- iCurrentRadioState = EStateRadioOn;
- FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() Resource Available Error = %d"), aError ));
- iRdsReceiver->StartReceiver();
- HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventRadioOn, KErrNone);
- }
- else
- {
- iRdsReceiver->StopReceiver();
- iRadioSettings->SetRadioOff();
- iCurrentRadioState = EStateRadioOff;
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventRadioOff, KErrNone );
- }
- }
- else
- {
- if ( aState == ERadioPlayerIdle && iRadioSettings->IsRadioOn() )
- {
- MRadioEngineStateChangeCallback::TFMRadioNotifyEvent ret =
- MRadioEngineStateChangeCallback::EFMRadioEventAudioResourcePaused;
- iCurrentRadioState = EStateRadioOff;
- iRdsReceiver->StopReceiver();
- iRadioSettings->SetRadioOff();
- if ( ( aError == KErrDied ) ||
- ( aError == KErrAccessDenied ) ||
- ( aError == KErrNotReady ) ||
- ( aError == KErrInUse ) )
- {
- TInt callState = KErrUnknown;
-
- RMobileCall::TMobileCallStatus linestatus;
-
- if ( ilineConstructed )
- {
- iLine.GetMobileLineStatus( linestatus );
- }
- FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() linestatus = %d"), linestatus));
-
- TInt err = RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState);
- FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() callState = %d"), callState));
-
- // check status from line
- if ( linestatus != RMobileCall::EStatusIdle &&
- linestatus != RMobileCall::EStatusUnknown ||
- iSystemEventDetector->IsCallActive() )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() EFMRadioEventCallStarted") ) );
- iInCall = ETrue;
- ret = MRadioEngineStateChangeCallback::EFMRadioEventCallStarted;
- }
- }
- else if ( aError == KErrHardwareNotAvailable ) // Radio is interrupted by FM Transmitter activation.
- {
- ret = MRadioEngineStateChangeCallback::EFMRadioEventFMTransmitterOn;
- }
- HandleCallback( ret, aError );
- }
- }
- if( iRadioSettings->IsRadioOn() )
- {
- TRAP_IGNORE( iPubSub->PublishStateL( ETrue ) )
- }
- else
- {
- TRAP_IGNORE
- (
- iTuningState = EFMRadioPSTuningUninitialized;
- iPubSub->PublishTuningStateL( iTuningState );
- iPubSub->PublishStateL( EFalse );
- )
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MrpoVolumeChange
-//
-// ----------------------------------------------------
-//
-void CRadioEngine::MrpoVolumeChange( TInt FDEBUGVAR( aVolume ) )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrpoVolumeChange() - Volume = %d"), aVolume) );
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventVolumeUpdated, KErrNone );
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MrpoMuteChange
-//
-// ----------------------------------------------------
-//
-void CRadioEngine::MrpoMuteChange( TBool aMute )
- {
- FTRACE(FPrint(_L("CRadioEngine::MrpoMuteChange() - Mute = %d"), aMute));
-
- if ( aMute && !iRadioSettings->IsMuteOn() )
- {
- iRadioSettings->SetMuteOn();
- HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventSetMuteState, KErrNone);
- }
- else if ( !aMute && iRadioSettings->IsMuteOn() )
- {
- iRadioSettings->SetMuteOff();
- HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventSetMuteState, KErrNone);
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::MrpoBalanceChange
-//
-// ----------------------------------------------------
-//
-void CRadioEngine::MrpoBalanceChange(
- TInt /*aLeftPercentage*/,
- TInt /*aRightPercentage*/ )
- {
- // Not supported.
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::MrpeoPresetChanged
-// Observer for Presets
-// -----------------------------------------------------------------------------
-void CRadioEngine::MrpeoPresetChanged(
- TPresetChangeEvent /*aChange*/,
- TInt /*aIndex*/ )
- {
-
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::NetworkUpCallbackL
-// callback notifies when networks comes up
-// -----------------------------------------------------------------------------
-//
-void CRadioEngine::NetworkUpCallbackL()
- {
-#ifndef __WINS__
-
- if ( !iNetworkInfoListener )
- {
- // NetworkInfoListener takes care of listening to the network id and country code.
- iNetworkInfoListener = CFMRadioMobileNetworkInfoListener::NewL( *this );
- }
-#endif
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::NetworkDownCallbackL
-// callback notifies when network goes down
-// -----------------------------------------------------------------------------
-//
-void CRadioEngine::NetworkDownCallbackL()
- {
- // No implementation needed
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::NetworkIdChanged
-// Used for notifying that the network id has changed
-// -----------------------------------------------------------------------------
-//
-void CRadioEngine::NetworkIdChanged()
- {
- // No implementation needed
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::AudioResourcesAvailableL
-// This callback notifies when audio resources become available.
-// -----------------------------------------------------------------------------
-//
-void CRadioEngine::AudioResourcesAvailableL()
- {
- FTRACE( FPrint( _L("CRadioEngine::AudioResourcesAvailableL()" ) ) );
- if ( iPubSub && !iInCall && iTunerControl ) // if iPubSub exists, then the ConstructL has been successfully completed
- {
- HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventAudioResourceAvailable, KErrNone );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::AudioAutoResumeForbiddenL
-// This callback notifies when audio auto resuming is forbidden.
-// -----------------------------------------------------------------------------
-//
-void CRadioEngine::AudioAutoResumeForbiddenL()
- {
- FTRACE( FPrint( _L("CRadioEngine::AudioAutoResumeForbiddenL()" ) ) );
- if ( iPubSub ) // if iPubSub exists, then the ConstructL has been successfully completed
- {
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventAudioResourceLost, KErrNone );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::CallActivatedCallbackL
-// This callback notifies when call becomes active.
-// -----------------------------------------------------------------------------
-//
-void CRadioEngine::CallActivatedCallbackL()
- {
- FTRACE( FPrint( _L("CRadioEngine::CallActivatedCallbackL()" ) ) );
- // no implementation needed, CRadioEngine::MrpoStateChange handles call startup
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::CallDeactivatedCallbackL
-// This callback notifies when call becomes deactive.
-// -----------------------------------------------------------------------------
-//
-void CRadioEngine::CallDeactivatedCallbackL()
- {
- FTRACE( FPrint( _L("CRadioEngine::CallDeactivatedCallbackL()" ) ) );
- iInCall = EFalse;
- if ( iPubSub ) // if iPubSub exists, then the ConstructL has been successfully completed
- {
- HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventCallEnded, KErrNone );
- }
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::RdsDataProgrammeService
-// ---------------------------------------------------------
-//
-void CRadioEngine::RdsDataProgrammeService( const TDesC& /*aProgramService*/ )
- {
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::RdsDataPsNameIsStatic
-// ---------------------------------------------------------
-//
-void CRadioEngine::RdsDataPsNameIsStatic( TBool /*aStatic*/ )
- {
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::RdsDataRadioText
-// ---------------------------------------------------------
-//
-void CRadioEngine::RdsDataRadioText( const TDesC& /*aRadioText*/ )
- {
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::RdsDataRadioTextPlus
-// ---------------------------------------------------------
-//
-void CRadioEngine::RdsDataRadioTextPlus( const TInt /*aRTPlusClass*/, const TDesC& /*aRadioText*/ )
- {
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::RdsAfSearchBegin
-// ---------------------------------------------------------
-//
-void CRadioEngine::RdsAfSearchBegin()
- {
- iFrequencySetByRdsAf = ETrue;
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::RdsAfSearchEnd
-// ---------------------------------------------------------
-//
-void CRadioEngine::RdsAfSearchEnd( TUint32 /*aFrequency*/, TInt aError )
- {
- if( aError != KErrNone )
- {
- iFrequencySetByRdsAf = EFalse;
- }
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::RdsAfSearchStateChange
-// ---------------------------------------------------------
-//
-void CRadioEngine::RdsAfSearchStateChange( TBool /*aEnabled*/ )
- {
- }
-
-// ---------------------------------------------------------
-// CRadioEngine::RdsAvailable
-// ---------------------------------------------------------
-//
-void CRadioEngine::RdsAvailable( TBool /*aAvailable*/ )
- {
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::InitializeResourceLoadingL
-// add resource file information
-// -----------------------------------------------------------------------------
-//
-void CRadioEngine::InitializeResourceLoadingL()
- {
- CCoeEnv* coeEnv = CCoeEnv::Static();
- RFs fs( coeEnv->FsSession() );
- TFileName fileName;
- TFileName baseResource;
- TFindFile finder( fs );
- TLanguage language( ELangNone );
-
- TParsePtrC parse( KFMRadioEngineResourceFile );
- _LIT( resourceFileWildExt, ".r*" );
-
- // Make sure to find all resource files, not only .rsc files as it may be so
- // that there is only .r01, .r02, etc. files available
- fileName.Copy( parse.Name() );
- fileName.Append( resourceFileWildExt );
-
- // TFindFile applies search order that is from
- // drive Y to A, then Z
- CDir* entries = NULL;
- TInt err = finder.FindWildByDir( fileName , KDC_RESOURCE_FILES_DIR, entries );
- delete entries;
- entries = NULL;
- TBool found = EFalse;
- while ( !found && err == KErrNone )
- {
- // Found file
- fileName.Zero();
- TParsePtrC foundPath( finder.File() );
- fileName.Copy( foundPath.DriveAndPath() );
- fileName.Append( KFMRadioEngineResourceFile );
- BaflUtils::NearestLanguageFile( fs, fileName, language );
- if ( language != ELangNone && BaflUtils::FileExists( fs, fileName ) )
- {
- found = ETrue;
- iFMRadioEngineResourceOffset = coeEnv->AddResourceFileL( fileName );
- }
- else
- {
- if ( language == ELangNone &&
- !baseResource.Compare( KNullDesC ) &&
- BaflUtils::FileExists( fs, fileName ) )
- {
- baseResource.Copy( fileName );
- }
- err = finder.FindWild( entries );
- delete entries;
- entries = NULL;
- }
- }
-
- if ( !found && baseResource.Compare( KNullDesC ) )
- {
- // If we found *.rsc then better to use that than nothing
- if ( BaflUtils::FileExists( fs, baseResource ) )
- {
- iFMRadioEngineResourceOffset = coeEnv->AddResourceFileL( baseResource );
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::TunerFrequencyRangeForRegionId
-// convert FMRadio region info to tuner utility frequency range
-// -----------------------------------------------------------------------------
-//
-TFmRadioFrequencyRange CRadioEngine::TunerFrequencyRangeForRegionId( const TInt aRegionId ) const
- {
- FTRACE( FPrint( _L("CRadioEngine::TunerFrequencyRangeForRegionId(TInt aRegionID = %d)"), aRegionId ) );
- TFmRadioFrequencyRange result = EFmRangeEuroAmerica;
- switch( aRegionId )
- {
- case EFMRadioRegionDefault:
- {
- result = EFmRangeEuroAmerica;
- break;
- }
- case EFMRadioRegionJapan:
- {
- result = EFmRangeJapan;
- break;
- }
- case EFMRadioRegionAmerica:
- {
- result = EFmRangeEuroAmerica;
- break;
- }
- default:
- break;
- }
- return result;
- }
-
-// -----------------------------------------------------------------------------
-// CRadioEngine::GetRegionL
-// determine current region
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TFMRadioRegionSetting CRadioEngine::GetRegionL() const
- {
- FTRACE( FPrint( _L("CRadioEngine::GetRegionL()" ) ) );
- TInt regionCount = iCentralRepositoryHandler->CountRegions();
- TFMRadioRegionSetting reg = EFMRadioRegionNone;
-
- if ( iSystemEventDetector->IsNetworkCoverage() )
- {
- TBool countryCodeMatch( EFalse );
- // Choose the frequency range according to country code
- const TDesC& countryCode =
- iNetworkInfoListener->CountryCode();
- for ( TInt i = 0 ; i < regionCount ; i++ )
- {
- const RFMRadioCountryCodeArray& regionCountryCodes =
- iCentralRepositoryHandler->Region( i ).CountryCodes();
-
- for ( TInt j = 0 ; j < regionCountryCodes.Count() ; j++ )
- {
- if ( countryCode == *regionCountryCodes[j] )
- {
- // We have a match
- countryCodeMatch = ETrue;
- reg = iCentralRepositoryHandler->Region(i).Id();
- }
- }
- }
- if ( !countryCodeMatch )
- {
- // All regions have been searched and no direct match found,
- // use default one
- reg = EFMRadioRegionDefault;
- }
- }
- else
- {
- if ( iCentralRepositoryHandler->RegionId() != EFMRadioRegionNone )
- {
- reg = static_cast<TFMRadioRegionSetting>(
- iCentralRepositoryHandler->RegionId() );
- }
- }
- return reg;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::FillListWithRegionDataL
-// fill given list with fmradio regions
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::FillListWithRegionDataL( CDesC16Array& aArray ) const
- {
- TInt regionCount = iCentralRepositoryHandler->CountRegions();
-
- for ( TInt i = 0 ; i < regionCount ; i++ )
- {
- aArray.AppendL( iCentralRepositoryHandler->Region( i ).Name() );
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::RegionIdAtIndex
-// return region from the array of supported regions
-// ----------------------------------------------------
-//
-EXPORT_C TFMRadioRegionSetting CRadioEngine::RegionIdAtIndex( const TInt aIndex ) const
- {
- return iCentralRepositoryHandler->Region( aIndex ).Id();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::RegionId
-// Return current region Id.
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::RegionId() const
- {
- return iCentralRepositoryHandler->RegionId();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::SetRegionIdL
-// Change the the current region Id.
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetRegionIdL( TInt aRegionId ) const
- {
- if ( iCentralRepositoryHandler->RegionId() != aRegionId )
- {
- // Change only when necessary as it changes also the default tuned frequency
- //iSetters.SetRegionIdL( aRegionId );
- iCentralRepositoryHandler->SetRegionIdL( aRegionId );
- iPubSub->PublishFrequencyDecimalCountL(
- TFMRadioPSFrequencyDecimalCount( iRadioSettings->DecimalCount() ) );
- }
- }
-
-// ----------------------------------------------------
-// CRadioEngine::RequestTunerControl
-// request tuner control from RadioFmTunerUtility
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::RequestTunerControl() const
- {
- // Before first RequestTunerControl() call it is ok to enable offline mode without checking capabilities
- iFmTunerUtility->EnableTunerInOfflineMode( ETrue );
- iFmTunerUtility->RequestTunerControl();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::DecimalCount
-// return decimal count for current region MHz information
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::DecimalCount() const
- {
- return iCentralRepositoryHandler->DecimalCount();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::FrequencyStepSize
-// return step size for tuning.
-// ----------------------------------------------------
-//
-EXPORT_C TUint32 CRadioEngine::FrequencyStepSize() const
- {
- return iRadioSettings->FrequencyStepSize();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::PubSubL
-// Returns a reference to P&S interface
-// ----------------------------------------------------
-//
-EXPORT_C CFMRadioPubSub& CRadioEngine::PubSubL() const
- {
- User::LeaveIfNull( iPubSub );
- return *iPubSub;
- }
-
-// ----------------------------------------------------
-// CRadioEngine::StartupCount
-// increases startup count by one and returns amount of app startups.
-// ----------------------------------------------------
-//
-EXPORT_C TInt CRadioEngine::UpdatedStartupCount() const
- {
- FTRACE( FPrint( _L("CRadioEngine::UpdatedStartupCount()" ) ) );
- iCentralRepositoryHandler->IncreaseStartupCount();
- return iRadioSettings->StartupCount();
- }
-
-// ----------------------------------------------------
-// CRadioEngine::CancelScanLocalStationsScan
-// Cancel seek and notify UI
-// ----------------------------------------------------
-//
-EXPORT_C void CRadioEngine::CancelScanLocalStationsScan()
- {
- FTRACE( FPrint( _L("CRadioEngine::CancelScanLocalStationsScan()" ) ) );
- CancelScan();
- TInt error = KErrNone;
- iStateHandler->Callback( MRadioEngineStateChangeCallback::EFMRadioEventScanLocalStationsCanceled, error );
- }
-
-// ---------------------------------------------------------------------------
-// CRadioEngine::IsAudioRoutingPossible
-// Routing is not possible when headset is not available or radio is off
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CRadioEngine::IsAudioRoutingPossible() const
- {
- FTRACE( FPrint( _L("CRadioEngine::IsAudioRoutingPossible()" ) ) );
- TBool isAudioRoutingPossible = EFalse;
-
- TBool headsetConnected = iHeadsetObserver->IsHeadsetAccessoryConnected();
- TBool radioOn = iRadioSettings->IsRadioOn();
-
- if ( headsetConnected && radioOn )
- {
- isAudioRoutingPossible = ETrue;
- }
-
- return isAudioRoutingPossible;
- }
-
-// ---------------------------------------------------------------------------
-// CRadioEngine::MusicStoreNoteDisplayed
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CRadioEngine::MusicStoreNoteDisplayed()
- {
- return iCentralRepositoryHandler->MusicStoreNoteDisplayed();
- }
-
-// ---------------------------------------------------------------------------
-// CRadioEngine::SetMusicStoreNoteDisplayed
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetMusicStoreNoteDisplayed()
- {
- iCentralRepositoryHandler->SetMusicStoreNoteDisplayed();
- }
-
-// ---------------------------------------------------------------------------
-// CRadioEngine::MusicStoreNoteDisplayed
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TFMRadioRTPlusLevel CRadioEngine::GetRTPlusSupportLevel()
- {
- TInt value = iCentralRepositoryHandler->GetRTPlusSupportLevel();
-
- //do not return the value directly - make sure we return a valid value
- if ( value == EFMRadioAllInteractions )
- {
- return EFMRadioAllInteractions;
- }
- return EFMRadioMusicStoreOnly;
- }
-
-// ---------------------------------------------------------------------------
-// CRadioEngine::SetCurrentPresetIndex
-// sets current preset index if the preset database changes
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CRadioEngine::SetCurrentPresetIndex( const TInt aIndex )
- {
- TInt maxNumberOfPresets;
- iPresetUtility->GetMaxNumberOfPresets( maxNumberOfPresets );
-
- if ( ( aIndex >= KErrNotFound ) && ( aIndex < maxNumberOfPresets ) )
- {
- iRadioSettings->SetCurrentPreset( aIndex );
- if ( aIndex >= 0 )
- {
- // publish current preset
- TRAP_IGNORE
- (
- TInt frequency = 0;
- TStationName name;
- iPresetUtility->GetPresetL( aIndex, name, frequency );
- iPubSub->PublishChannelNameL( name );
- iPubSub->PublishChannelL( aIndex );
- )
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CRadioEngine::StoreAndPublishFrequency
-// Updates the frequency into settings and P&S
-// ---------------------------------------------------------------------------
-//
-void CRadioEngine::StoreAndPublishFrequency( TInt aFrequency )
- {
- iRadioSettings->SetFrequency( aFrequency );
- TRAP_IGNORE( iPubSub->PublishFrequencyL( aFrequency ); )
- }
-
-// ---------------------------------------------------------------------------
-// CRadioEngine::ResetPresetsL
-// initialize channel frequencies
-// ---------------------------------------------------------------------------
-//
-void CRadioEngine::ResetPresetsL()
- {
- FTRACE( FPrint( _L("CRadioEngine::ResetPresetsL()" ) ) );
- TInt maxNumberOfPresets;
- TStationName channelName;
- TInt channelFrequency;
-
- iPresetUtility->GetMaxNumberOfPresets( maxNumberOfPresets );
-
- for ( TInt i = 0; i < maxNumberOfPresets; i++ )
- {
- iPresetUtility->GetPresetL( i, channelName, channelFrequency );
-
- if ( channelName.Length() == 0 && channelFrequency != KErrNotFound )
- {
- // set empty name and frequency to KErrNotFound
- iPresetUtility->SetPresetL( i, channelName, KErrNotFound );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CRadioEngine::IsBTAccessoryConnectedL
-// Returns ETrue if queried accessory is connected
-// ---------------------------------------------------------------------------
-//
-TBool CRadioEngine::IsBTAccessoryConnectedL ( )
- {
- FTRACE(FPrint(_L("CRadioEngine::IsBTAccessoryConnectedL ()" ) ) );
- TBool result = EFalse;
- CAccMonitor* accMonitor = CAccMonitor::NewLC();
-
- RConnectedAccessories connectedAccessories;
- CleanupClosePushL( connectedAccessories );
-
- accMonitor->GetConnectedAccessoriesL( connectedAccessories );
- CAccMonitorInfo* accInfo = CAccMonitorInfo::NewLC();
- TInt countOfArray = connectedAccessories.Count();
-
- for( TInt i = 0; i != countOfArray; i++ )
- {
- TAccMonCapability connectionType = connectedAccessories[ i ]->AccPhysicalConnection();
- if( connectionType == KAccMonBluetooth )
- {
- accInfo->CopyL( connectedAccessories[ i ] );
- if ( accInfo->Exists(KAccMonStereoAudio) ||
- accInfo->Exists(KAccMonMonoAudio) )
- {
- result = ETrue;
- }
- }
- }
- // Destroy the pointers from the array, because those are owned by the client
- CleanupStack::PopAndDestroy( accInfo );
- CleanupStack::PopAndDestroy( &connectedAccessories );
- CleanupStack::PopAndDestroy( accMonitor );
- return result;
- }
-// End of file
--- a/fmradio/fmradioengine/src/fmradioenginecentralrepositoryhandler.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,494 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Contains implementation of the CCentralRepositoryHandler class.
-*
-*/
-
-
-// INCLUDE FILES
-#include <centralrepository.h>
-#include <s32mem.h>
-#include <coemain.h>
-#include <barsread.h>
-#include <ProfileEngineSDKCRKeys.h>
-#include <fmradioengine.rsg>
-
-#include "fmradioenginecentralrepositoryhandler.h"
-#include "fmradioengineradiosettings.h"
-#include "fmradioenginecrkeys.h"
-#include "debug.h"
-
-
-// CONSTANTS
-const TInt KRadioMaxStartupCountToTrack = 5;
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ----------------------------------------------------
-// CCentralRepositoryHandler::CCentralRepositoryHandler
-// Default class constructor.
-// ----------------------------------------------------
-//
-CCentralRepositoryHandler::CCentralRepositoryHandler(
- TRadioSettings& aRadioSettings) // a reference to aRadioSettings
- :iRadioSettings(&aRadioSettings)
- {
- FTRACE(FPrint(_L("calling CCentralRepositoryHandler::NewL()")));
- }
-
-// ----------------------------------------------------
-// CCentralRepositoryHandler::ConstructL
-// Second phase class constructor.
-// ----------------------------------------------------
-//
-void CCentralRepositoryHandler::ConstructL()
- {
- iCentralRepository = CRepository::NewL( KCRUidFMRadioEngine );
-
- RetrieveInitialSettings();
- InitializeRegionsL();
-
- #ifdef __WINS__
- SetInitialSettings();
- #endif //__WINS__
- }
-
-// ----------------------------------------------------
-// CCentralRepositoryHandler::NewL
-// Two-phased class constructor.
-// ----------------------------------------------------
-//
-CCentralRepositoryHandler* CCentralRepositoryHandler::NewL(
- TRadioSettings& aRadioSettings) // a reference to aRadioSettings
- {
- CCentralRepositoryHandler *self = new(ELeave) CCentralRepositoryHandler(aRadioSettings);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// ----------------------------------------------------
-// CCentralRepositoryHandler::~CCentralRepositoryHandler
-// Destructor of CCentralRepositoryHandler class.
-// ----------------------------------------------------
-//
-CCentralRepositoryHandler::~CCentralRepositoryHandler()
- {
- iRadioSettings = NULL;
- if ( iCentralRepository )
- {
- delete iCentralRepository;
- }
- iRegions.ResetAndDestroy();
- iRegions.Close();
- }
-
-
-// ----------------------------------------------------
-// CCentralRepositoryHandler::RetrieveInitialSettings
-// Retrieves persistent settings from shared data.
-// Returns: None
-// ----------------------------------------------------
-//
-void CCentralRepositoryHandler::RetrieveInitialSettings()
- {
- FTRACE(FPrint(_L("calling CCentralRepositoryHandler::RetrieveInitialSettings() Start")));
- TInt tempData;
-
- if ( iCentralRepository->Get( KRadioHeadsetVolume, tempData ) == KErrNone )
- {
- iRadioSettings->SetHeadsetVolume( tempData );
- }
-
- if ( iCentralRepository->Get( KRadioSpeakerVolume, tempData ) == KErrNone )
- {
- iRadioSettings->SetSpeakerVolume( tempData );
- }
-
- if ( iCentralRepository->Get( KFmRadioFrequency, tempData ) == KErrNone )
- {
- iRadioSettings->SetFrequency( tempData );
- }
-
- if ( iCentralRepository->Get( KFmRadioChannel, tempData ) == KErrNone )
- {
- iRadioSettings->SetCurrentPreset( tempData );
- }
-
- if ( iCentralRepository->Get( KFmRadioMode, tempData ) == KErrNone)
- {
- iRadioSettings->SetRadioMode( static_cast<CRadioEngine::TRadioMode>( tempData ) );
- }
-
- if ( iCentralRepository->Get( KFMCRCurrentRegion, tempData ) != KErrNone )
- {
- iCentralRepository->Set( KFMCRCurrentRegion, KErrNotFound );
- }
-
- if ( iCentralRepository->Get( KRadioCRStartupCount, tempData ) == KErrNone )
- {
- iRadioSettings->SetStartupCount( tempData );
- }
-
- if ( iCentralRepository->Get( KFMCRRdsAfSearchEnabled, tempData ) == KErrNone )
- {
- if ( static_cast<TBool> ( tempData ) )
- {
- iRadioSettings->SetRdsAfSearchEnabled();
- }
- else
- {
- iRadioSettings->SetRdsAfSearchDisabled();
- }
- }
-
- if ( iCentralRepository->Get( KFMCRJapanRegionAllowed, tempData ) == KErrNone )
- {
- iRadioSettings->SetJapanRegionAllowed( static_cast<TBool>( tempData ) );
- }
- }
-
-#ifdef __WINS__
-// ----------------------------------------------------
-// CCentralRepositoryHandler::SetInitialSettings
-// Set network info for emulator testing purposes
-// ----------------------------------------------------
-//
-void CCentralRepositoryHandler::SetInitialSettings()
- {
- _LIT(KNetworkInfoForEmulator, "358123");
- iCentralRepository->Set( KFMRadioCREmulatorNetworkInfo, KNetworkInfoForEmulator );
- }
-#endif //__WINS__
-
-// ----------------------------------------------------
-// CCentralRepositoryHandler::SaveEngineSettings
-// Save all engine related persistent info back to shared data
-// Returns: None
-// ----------------------------------------------------
-//
-void CCentralRepositoryHandler::SaveEngineSettings()
- {
- if ( IsFrequencyValid( iRadioSettings->Frequency() / KFMRadioFreqMultiplier ) )
- {
- iCentralRepository->Set( KFmRadioFrequency, iRadioSettings->Frequency() );
- }
- else
- {
- TInt freq = MinFrequency() * KFMRadioFreqMultiplier;
- iCentralRepository->Set( KFmRadioFrequency, freq );
- }
-
- iCentralRepository->Set( KFmRadioChannel, iRadioSettings->CurrentPreset() );
- iCentralRepository->Set( KFmRadioMode, iRadioSettings->RadioMode() );
- iCentralRepository->Set( KFMCRRdsAfSearchEnabled, iRadioSettings->IsRdsAfSearchEnabled() );
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::CountRegions
-// Return count of fmradio regions in regions array
-// ---------------------------------------------------------------------------
-//
-TInt CCentralRepositoryHandler::CountRegions() const
- {
- return iRegions.Count();
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::Region
-// Returns fmradio region at given index
-// ---------------------------------------------------------------------------
-//
-CFMRadioRegion& CCentralRepositoryHandler::Region( TInt aIndex ) const
- {
- if( aIndex == KErrNotFound )
- {
- aIndex = RegionIndexForId( static_cast<TInt>( EFMRadioRegionDefault ) );
- }
-
- return *iRegions[aIndex];
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::RegionId
-// Return current region Id.
-// ---------------------------------------------------------------------------
-//
-TInt CCentralRepositoryHandler::RegionId() const
- {
- TInt regionId;
- iCentralRepository->Get( KFMCRCurrentRegion, regionId );
- return regionId;
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::SetRegionIdL
-// Change the the current region Id.
-// ---------------------------------------------------------------------------
-//
-void CCentralRepositoryHandler::SetRegionIdL( TInt aRegion )
- {
- iCentralRepository->Set( KFMCRCurrentRegion, aRegion );
- UpdateCurrentRegionIdx( aRegion );
-
- iRadioSettings->SetFrequency( Region( iCurrentRegionIdx ).MinFrequency() * KFMRadioFreqMultiplier );
- iRadioSettings->SetMinFrequency( MinFrequency() );
- iRadioSettings->SetMaxFrequency( MaxFrequency() );
- iRadioSettings->SetFrequencyStepSize( FrequencyStepSize() );
- iRadioSettings->SetDecimalCount( DecimalCount() );
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::FrequencyStepSize
-// Returns frequency step size used for current region
-// ---------------------------------------------------------------------------
-//
-TUint32 CCentralRepositoryHandler::FrequencyStepSize() const
- {
- return Region( iCurrentRegionIdx ).StepSize();
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::MaxFrequency
-// Returns highest allowed frequency for current region
-// ---------------------------------------------------------------------------
-//
-TUint32 CCentralRepositoryHandler::MaxFrequency() const
- {
- return Region( iCurrentRegionIdx ).MaxFrequency();
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::MinFrequency
-// Returns lowest allowed frequency for current region
-// ---------------------------------------------------------------------------
-//
-TUint32 CCentralRepositoryHandler::MinFrequency() const
- {
- return Region( iCurrentRegionIdx ).MinFrequency();
- }
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::DecimalCount
-// return decimal count for current region Mhz information
-// ---------------------------------------------------------------------------
-//
-TInt CCentralRepositoryHandler::DecimalCount() const
- {
- return Region( iCurrentRegionIdx ).DecimalCount();
- }
-
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::InitializeRegionsL
-// Initializes the regions based on resources.
-// ---------------------------------------------------------------------------
-//
-void CCentralRepositoryHandler::InitializeRegionsL()
- {
- iRegions.ResetAndDestroy();
-
- TResourceReader reader;
-
- CCoeEnv* coeEnv = CCoeEnv::Static();
-
- if ( iRadioSettings->IsJapanRegionAllowed() )
- {
- coeEnv->CreateResourceReaderLC( reader, R_RADIO_REGIONS_ALL );
- }
- else // Japan region is not allowed so read region resources without Japan
- {
- coeEnv->CreateResourceReaderLC( reader, R_RADIO_REGIONS_WITHOUT_JAPAN );
- }
-
- TInt regionCount = reader.ReadInt16();
-
- for( TInt i = 0 ; i < regionCount; i++ )
- {
- TInt resId = reader.ReadInt32(); // The next resource ID to read.
- TResourceReader regionReader;
- coeEnv->CreateResourceReaderLC( regionReader, resId );
- User::LeaveIfError( iRegions.Append( CFMRadioRegion::NewL( regionReader ) ) );
- CleanupStack::PopAndDestroy();
- }
-
- CleanupStack::PopAndDestroy();
-
- UpdateCurrentRegionIdx( RegionId() );
-
- iRadioSettings->SetMinFrequency( MinFrequency() * KFMRadioFreqMultiplier );
- iRadioSettings->SetMaxFrequency( MaxFrequency() * KFMRadioFreqMultiplier );
- iRadioSettings->SetFrequencyStepSize( FrequencyStepSize() );
- iRadioSettings->SetDecimalCount( DecimalCount() );
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::RegionIndexForId
-// Converts Region ID to index
-// ---------------------------------------------------------------------------
-//
-TInt CCentralRepositoryHandler::RegionIndexForId( TInt aRegionId ) const
- {
- TInt idx = KErrNotFound;
- for( TInt i = 0 ; i < CountRegions(); i++ )
- {
- if( Region( i ).Id() == static_cast<TFMRadioRegionSetting>( aRegionId ) )
- {
- idx = i;
- /*lint -save -e960 (Note -- Violates MISRA Required Rule 58, non-switch break used)*/
- break;
- /*lint -restore*/
- }
- }
- return idx;
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::UpdateCurrentRegionIdx
-// Updates the current region
-// ---------------------------------------------------------------------------
-//
-void CCentralRepositoryHandler::UpdateCurrentRegionIdx( TInt aRegionId )
- {
- iCurrentRegionIdx = RegionIndexForId( aRegionId );
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::IsOfflineProfileActiveL
-// Checks if offine profile is current active profile
-// Returns: true/false
-// ---------------------------------------------------------------------------
-//
-TBool CCentralRepositoryHandler::IsOfflineProfileActiveL()
- {
- CRepository* repository = CRepository::NewLC( KCRUidProfileEngine );
-
- TInt profileId(0);
-
- // Get ID of current profile
- User::LeaveIfError( repository->Get( KProEngActiveProfile, profileId ) );
-
- CleanupStack::PopAndDestroy( repository );
-
- // Check value to determine the active profile
- // 5 = Offline profile
- if ( profileId == 5 )
- {
- // Current profile is the offline profile
- return ETrue;
- }
-
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::IsFrequencyValid
-// Checks if frequency is in the current region range
-// ---------------------------------------------------------------------------
-//
-TBool CCentralRepositoryHandler::IsFrequencyValid( TUint32 aFrequency ) const
- {
- TBool ret( EFalse );
- if( !aFrequency )
- {
- aFrequency = iRadioSettings->Frequency();
- }
- if ( aFrequency >= MinFrequency() && aFrequency <= MaxFrequency() )
- {
- ret = ETrue;
- }
- return ret;
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::IncreaseStartupCount
-// Increases startup time by one and sets the value to the repository
-// ---------------------------------------------------------------------------
-//
-void CCentralRepositoryHandler::IncreaseStartupCount() const
- {
- TInt startCount = iRadioSettings->StartupCount();
- // Dont update if maximum tracking count is reached
- if ( startCount < KRadioMaxStartupCountToTrack )
- {
- startCount++;
- iRadioSettings->SetStartupCount( startCount );
- iCentralRepository->Set( KRadioCRStartupCount, startCount );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::SaveHeadsetVolumeSetting
-// Save headset volume level to the repository
-// ---------------------------------------------------------------------------
-//
-void CCentralRepositoryHandler::SaveHeadsetVolumeSetting() const
- {
- FTRACE( FPrint(_L("CCentralRepositoryHandler::SaveHeadsetVolumeSetting()") ) );
- iCentralRepository->Set( KRadioHeadsetVolume, iRadioSettings->HeadsetVolume() );
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::SaveSpeakerVolumeSetting
-// Save speaker volume level to the repository
-// ---------------------------------------------------------------------------
-//
-void CCentralRepositoryHandler::SaveSpeakerVolumeSetting() const
- {
- FTRACE( FPrint(_L("CCentralRepositoryHandler::SaveSpeakerVolumeSetting()") ) );
- iCentralRepository->Set( KRadioSpeakerVolume, iRadioSettings->SpeakerVolume() );
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::MusicStoreNoteDisplayed
-// ---------------------------------------------------------------------------
-//
-TBool CCentralRepositoryHandler::MusicStoreNoteDisplayed()
- {
- TBool result;
- TInt err = iCentralRepository->Get( KRadioMusicStoreNoteDisplayed, result );
- if ( err != KErrNone )
- {
- result = EFalse;
- }
- return result;
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::SetMusicStoreNoteDisplayed
-// ---------------------------------------------------------------------------
-//
-void CCentralRepositoryHandler::SetMusicStoreNoteDisplayed()
- {
- iCentralRepository->Set( KRadioMusicStoreNoteDisplayed, 1 );
- }
-
-// ---------------------------------------------------------------------------
-// CCentralRepositoryHandler::GetRTPlusSupportLevel
-// ---------------------------------------------------------------------------
-//
-TInt CCentralRepositoryHandler::GetRTPlusSupportLevel()
- {
- //See fmradioengine.hrh:TFMRadioRTPlusLevel for correct values
- TInt result;
- TInt err = iCentralRepository->Get( KRadioRTPlusSupportLevel, result );
- if ( err != KErrNone )
- {
- result = KErrNotFound;
- }
-
- return result;
- }
-
-// end of file
-
--- a/fmradio/fmradioengine/src/fmradioenginedosserverobserver.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Contains implementation of the CDosServerObserver class. which is the
-* notification interface to the DOS Server.
-*
-*/
-
-
-// INCLUDES
-#include <DosSvrServices.h>
-
-#include "debug.h"
-#include "fmradioengine.h"
-#include "fmradioengineradiosettings.h"
-#include "fmradioenginedosserverobserver.h"
-
-// ----------------------------------------------------
-// CDosServerObserver::CDosServerObserver
-// Default class constructor.
-// ----------------------------------------------------
-//
-CDosServerObserver::CDosServerObserver(CRadioEngine* aEngine, TRadioSettings* aRadioSettings)
- : iEngine(aEngine), iRadioSettings(aRadioSettings)
- {
- }
-
-// ----------------------------------------------------
-// CDosServerObserver::NewL
-// Two-phased class constructor.
-// ----------------------------------------------------
-//
-CDosServerObserver *CDosServerObserver::NewL(CRadioEngine* aEngine, TRadioSettings* aRadioSettings)
- {
- CDosServerObserver *self = new (ELeave)CDosServerObserver(aEngine, aRadioSettings);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-
-// ----------------------------------------------------
-// CDosServerObserver::ConstructL
-// Second phase class constructor.
-// ----------------------------------------------------
-//
-void CDosServerObserver::ConstructL()
- {
- iRadioSettings->SetHeadsetConnected();
- RDosServer* server = const_cast< RDosServer* >( &DosServer() );
- User::LeaveIfError( iDosAudio.Open(*server) );
- TRegisterEvent eventList[] = {{KHandsfreeModeChanged, sizeof(EPSHandsFreeMode),EOnlyLast}, {KHeadsetButtonChanged,sizeof(EPSButtonState), EQueue} };
- StartListeningL(eventList,sizeof(eventList)/sizeof(TRegisterEvent));
- }
-
-// ----------------------------------------------------
-// CDosServerObserver::~CDosServerObserver
-// Destructor of CDosServerObserver class.
-// ----------------------------------------------------
-//
-CDosServerObserver::~CDosServerObserver()
- {
- Stop();
- }
-
-
-// ---------------------------------------------------------
-// CDosServerObserver::SetAudioRouting
-// ---------------------------------------------------------
-//
-TInt CDosServerObserver::SetAudioRouting(CRadioEngine::TFMRadioAudioOutput aAudioOutput)
- {
- TInt err(KErrNone);
- EPSHandsFreeMode mode = (aAudioOutput == CRadioEngine::EFMRadioOutputHeadset) ? EPSIhfOff : EPSIhfOn;
- err = iDosAudio.SetHandsfreeMode(mode);
- return err;
- }
-
-// ---------------------------------------------------------
-// CDosServerObserver::HeadsetButtonChangedL
-// Handling notification about headset button state change.
-// (other items were commented in a header).
-// Status : Draft/Proposal/Approved
-// ---------------------------------------------------------
-//
-void CDosServerObserver::HeadsetButtonChangedL(EPSButtonState aState)
- {
- if(aState == EPSButtonUp)
- {
- iEngine->HandleHeadsetButtonPress();
- }
-
- }
-// end of file
--- a/fmradio/fmradioengine/src/fmradioengineradiosettings.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,490 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Contains implementation of the TRadioSettings class, which holds
-* the RadioEngine settings.
-*
-*/
-
-
-// INCLUDES
-#include "fmradioengine.h"
-#include "fmradioengineradiosettings.h"
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ----------------------------------------------------
-// TRadioSettings::TRadioSettings
-// Default class constructor.
-// ----------------------------------------------------
-//
-TRadioSettings::TRadioSettings():
- iFMRadioHeadsetVolume( KDefaultRadioVolume ),
- iFMRadioSpeakerVolume( KDefaultRadioVolume ),
- iCurrentPreset( 0 ),
- iFrequency( KDefaultRadioFrequency ),
- iMaxFrequency( 0 ),
- iMinFrequency( 0 ),
- iFrequencyStepSize( 0 ),
- iDecimalCount( 0 ),
- iAudioMode( CRadioEngine::EFMRadioStereo ),
- iAudioOutput(CRadioEngine::EFMRadioOutputHeadset ),
- iMuteOn(EFalse),
- iRadioOn( EFalse),
- iRadioMode( CRadioEngine::ERadioPresetMode ),
- iIsHeadsetConnected( EFalse ),
- iFlightModeEnabled( EFalse ),
- iStartupCount( 0 ),
- iRdsAfSearchEnabled( EFalse ),
- iJapanRegionAllowed( ETrue )
- {
- }
-
-// ----------------------------------------------------
-// TRadioSettings::Volume
-// retrieve current headset volume level
-// Returns: iFMRadioHeadsetVolume: headset volume
-// ----------------------------------------------------
-//
-TInt TRadioSettings::HeadsetVolume() const
- {
- return iFMRadioHeadsetVolume;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SpeakerVolume
-// retrieve current speaker volume level
-// Returns: iFMRadioSpeakerVolume: speaker volume
-// ----------------------------------------------------
-//
-TInt TRadioSettings::SpeakerVolume() const
- {
- return iFMRadioSpeakerVolume;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::CurrentPreset
-// retrieve currently selected channel
-// Returns: iCurrentPreset: current preset index number
-// ----------------------------------------------------
-//
-TInt TRadioSettings::CurrentPreset() const
- {
- return iCurrentPreset;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::Frequency
-// retrieve current frequency
-// Returns: iFrequency: current frequency
-// ----------------------------------------------------
-//
-TInt TRadioSettings::Frequency() const
- {
- return iFrequency;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::MaxFrequency
-// retrieve max frequency
-// ----------------------------------------------------
-//
-TUint32 TRadioSettings::MaxFrequency() const
- {
- return iMaxFrequency;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::MinFrequency
-// retrieve min frequency
-// ----------------------------------------------------
-//
-TUint32 TRadioSettings::MinFrequency() const
- {
- return iMinFrequency;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::FrequencyStepSize
-// return step size for tuning
-// ----------------------------------------------------
-//
-TUint32 TRadioSettings::FrequencyStepSize() const
- {
- return iFrequencyStepSize;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::DecimalCount
-// Returns decimal count for current region MHz information
-// ----------------------------------------------------
-//
-TInt TRadioSettings::DecimalCount() const
- {
- return iDecimalCount;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::AudioMode
-// retrieve current audio mode (stereo or mono)
-// Returns: iAudioMode: current mode
-// ----------------------------------------------------
-//
-CRadioEngine::TFMRadioAudioMode TRadioSettings::AudioMode() const
- {
- return iAudioMode;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::AudioOutput
-// retrieve current audio output (headset/ihf)
-// Returns: iAudioOutput: current audio output
-// ----------------------------------------------------
-//
-CRadioEngine::TFMRadioAudioOutput TRadioSettings::AudioOutput() const
- {
- return iAudioOutput;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::IsMuteOn
-// retrieve current mute state (on/off)
-// Returns: iMuteOn: mute flag
-// ----------------------------------------------------
-//
-TBool TRadioSettings::IsMuteOn() const
- {
- return iMuteOn;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::IsRadioOn
-// retrieve current radio on state (on/off)
-// Returns: iRadioOn: a flag indicating radio on/off
-// ----------------------------------------------------
-//
-TBool TRadioSettings::IsRadioOn() const
- {
- return iRadioOn;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::RadioMode
-// retrieve the current radio mode (preset or direct frequency)
-// Returns: iRadioMode: a flag indicating radio mode
-// ----------------------------------------------------
-//
-CRadioEngine::TRadioMode TRadioSettings::RadioMode() const
- {
- return iRadioMode;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::IsHeadsetConnected
-// retrieve the current headset mode (connected or disconnected)
-// Returns: iIsHeadsetConnected: a flag indicating if headset is connected
-// ----------------------------------------------------
-//
-TBool TRadioSettings::IsHeadsetConnected() const
- {
- return iIsHeadsetConnected;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::IsFlightModeEnabled
-// retrieve the current flight mode status (on/off)
-// Returns: iFlightModeEnabled: a flag indicating if flight mode is enabled
-// ----------------------------------------------------
-//
-TBool TRadioSettings::IsFlightModeEnabled() const
- {
- return iFlightModeEnabled;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::IsRdsAfSearchEnabled
-// ----------------------------------------------------
-//
-EXPORT_C TBool TRadioSettings::IsRdsAfSearchEnabled()
- {
- return iRdsAfSearchEnabled;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetHeadsetVolume
-// set the current fm radio headset volume
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetHeadsetVolume(
- const TInt aVolume) // the new volume
- {
- iFMRadioHeadsetVolume = aVolume;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetSpeakerVolume
-// set the current fm radio speaker volume
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetSpeakerVolume(
- const TInt aVolume) // new volume
- {
- iFMRadioSpeakerVolume = aVolume;
- }
-
-
-// ----------------------------------------------------
-// TRadioSettings::SetCurrentPreset
-// set the current preset
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetCurrentPreset(
- const TInt aChannel) //new channel to be set
- {
- iCurrentPreset = aChannel;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetFrequency
-// set the current frequency
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetFrequency(
- const TInt aFrequency) // new frequency
- {
- iFrequency = aFrequency;
- // if (iFrequency < 87500000 || iFrequency > 108000000)
- // iFrequency = 87500000;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetMaxFrequency
-// set the max frequency
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetMaxFrequency( const TUint32 aMaxFrequency )
- {
- iMaxFrequency = aMaxFrequency;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetMinFrequency
-// set min frequency
-// Returns: none
-// ----------------------------------------------------
-//
- void TRadioSettings::SetMinFrequency( const TUint32 aMinFrequency )
- {
- iMinFrequency = aMinFrequency;
- }
-
- // ----------------------------------------------------
- // TRadioSettings::SetFrequencyStepSize
- // set step size for manual tuning.
- // Returns: none
- // ----------------------------------------------------
- //
- void TRadioSettings::SetFrequencyStepSize( const TUint32 aFrequencyStepSize )
- {
- iFrequencyStepSize = aFrequencyStepSize;
- }
-
- // ----------------------------------------------------
- // TRadioSettings::SetDecimalCount
- // Set decimal count for current region MHz information
- // Returns: none
- // ----------------------------------------------------
- //
- void TRadioSettings::SetDecimalCount( const TInt aDecimalCount )
- {
- iDecimalCount = aDecimalCount;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetAudioMode
-// set the current audio mode
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetAudioMode(
- const CRadioEngine::TFMRadioAudioMode aAudioMode) // new audio mode
- {
- iAudioMode = aAudioMode;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetAudioOutput
-// set the current audio output
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetAudioOutput(
- const CRadioEngine::TFMRadioAudioOutput aAudioOutput) // new audio output
- {
- iAudioOutput = aAudioOutput;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetMuteOn
-// set mute state to on
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetMuteOn()
- {
- iMuteOn = ETrue;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetMuteOff
-// set mute state to off
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetMuteOff()
- {
- iMuteOn = EFalse;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetRadioOn
-// set radio state to "on"
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetRadioOn()
- {
- iRadioOn = ETrue;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetRadioOff
-// set radio state to "off"
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetRadioOff()
- {
- iRadioOn = EFalse;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetRadioMode
-// set radio mode
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetRadioMode(
- const CRadioEngine::TRadioMode aRadioMode) // new radio mode
- {
- iRadioMode = aRadioMode;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetHeadsetConnected
-// set headset connected
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetHeadsetConnected()
- {
- iIsHeadsetConnected = ETrue;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetHeadsetDisconnected
-// set headset disconnected
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetHeadsetDisconnected()
- {
- iIsHeadsetConnected = EFalse;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetFlightMode
-// set flightmode status
-// Returns: none
-// ----------------------------------------------------
-//
-void TRadioSettings::SetFlightMode(
- TBool aEnabled) // indicating enable/disable
- {
- iFlightModeEnabled = aEnabled;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetStartupCount
-// set startup count
-// ----------------------------------------------------
-//
-void TRadioSettings::SetStartupCount( const TInt aStartupCount )
- {
- iStartupCount = aStartupCount;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::StartupCount
-// return startup count
-// ----------------------------------------------------
-//
-TInt TRadioSettings::StartupCount() const
- {
- return iStartupCount;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetRdsAfSearchEnabled
-// ----------------------------------------------------
-//
-void TRadioSettings::SetRdsAfSearchEnabled()
- {
- iRdsAfSearchEnabled = ETrue;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetRdsAfSearchDisabled
-// ----------------------------------------------------
-//
-void TRadioSettings::SetRdsAfSearchDisabled()
- {
- iRdsAfSearchEnabled = EFalse;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::SetJapanRegionAllowed
-// ----------------------------------------------------
-//
-void TRadioSettings::SetJapanRegionAllowed( const TBool aAllowed )
- {
- iJapanRegionAllowed = aAllowed;
- }
-
-// ----------------------------------------------------
-// TRadioSettings::IsJapanRegionAllowed
-// ----------------------------------------------------
-//
-TBool TRadioSettings::IsJapanRegionAllowed() const
- {
- return iJapanRegionAllowed;
- }
-
-// end of file
-
--- a/fmradio/fmradioengine/src/fmradioengineradiostatehandler.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The class implements the powerup/down, and scan and store
-* state machines.
-*
-*/
-
-
-// INCLUDES
-#include <f32file.h>
-
-#include "fmradioengineradiostatehandler.h"
-#include "fmradioengine.h"
-#include "debug.h"
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ----------------------------------------------------
-// CRadioStateHandler::CRadioStateHandler
-// c++ default constructor
-// ----------------------------------------------------
-//
-CRadioStateHandler::CRadioStateHandler(CRadioEngine* aEngine)
- : CActive(EPriorityStandard), iEngine(aEngine)
- {
- CActiveScheduler::Add(this);
- }
-
-// ----------------------------------------------------
-// CRadioStateHandler::ConstructL
-// 2nd phase constructor
-// ----------------------------------------------------
-//
-void CRadioStateHandler::ConstructL()
- {
- }
-
-// ----------------------------------------------------
-// CRadioStateHandler::NewL
-// Method for creating new instances of this class.
-// ----------------------------------------------------
-//
-CRadioStateHandler* CRadioStateHandler::NewL(
- CRadioEngine* aEngine) //a pointer to CRadioEngine object
- {
- CRadioStateHandler *self = new(ELeave) CRadioStateHandler(aEngine);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// Destructor
-CRadioStateHandler::~CRadioStateHandler()
- {
- Cancel();
- }
-
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-
-// ----------------------------------------------------
-// CRadioStateHandler::Callback
-// Trigger the active object to call the client callback function
-// Returns: None
-// ----------------------------------------------------
-//
-void CRadioStateHandler::Callback(
- MRadioEngineStateChangeCallback::TFMRadioNotifyEvent aEventCode, // a event code
- TInt aErrorCode ) // a error code
- {
- iCallbackEventCode = aEventCode;
- iCallbackErrorCode = aErrorCode;
- Cancel();
- SetActive();
- TRequestStatus* status=&iStatus;
- User::RequestComplete(status, KRadioStateEventCallback);
- }
-
-
-// ----------------------------------------------------
-// CRadioStateHandler::DoCancel
-// Cancel the timeout timer. This generally means that a
-// response was received, so the timeout is no longer needed.
-// Returns: None
-// ----------------------------------------------------
-//
-void CRadioStateHandler::DoCancel()
- {
- }
-
-// ----------------------------------------------------
-// CRadioStateHandler::RunL
-// State Change Request/timeout handler
-// Returns: None
-// ----------------------------------------------------
-//
-void CRadioStateHandler::RunL()
- {
- FTRACE(FPrint(_L("inside runL()")));
-
- if (iStatus.Int() == KRadioStateEventCallback)
- {
- iEngine->HandleCallback(iCallbackEventCode, iCallbackErrorCode);
- }
- }
-
-// ---------------------------------------------------------
-// CRadioStateHandler::RunError
-// handle any errors that occur in the RunL
-// Returns: aError: the error code
-// ---------------------------------------------------------
-//
-TInt CRadioStateHandler::RunError(
- TInt aError ) // error code
- {
- FTRACE( FPrint( _L("CRadioStateHandler::RunError()") ) );
- return aError;
- }
-
- // end of file
--- a/fmradio/fmradioengine/src/fmradiomobilenetworkinfolistener.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Gets country code and network info from mobile network
-*
-*/
-
-
-// INCLUDES
-#ifdef __WINS__
-#include <centralrepository.h>
-#else
-#include <commsdattypesv1_1.h>
-#include <etel.h>
-#include <etelmm.h>
-#include <commsdat_partner.h>
-#endif
-
-#include "fmradionetworkchangeobserver.h"
-#include "fmradiomobilenetworkinfolistener.h"
-#include "fmradioenginecrkeys.h"
-
-using namespace CommsDat;
-
-
-#ifdef __WINS__
-// Default size for the cenrep query
-const TInt KFMRadioDefaultNetworkInfoBufferSize = 0x80;
-#endif
-
-// ================= MEMBER FUNCTIONS =======================
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-#ifdef __WINS__
-CFMRadioMobileNetworkInfoListener::CFMRadioMobileNetworkInfoListener(MFMRadioNetworkChangeObserver & aObserver) :
- CActive(CActive::EPriorityStandard), iNetworkChangeObserver(aObserver)
-#else
-CFMRadioMobileNetworkInfoListener::CFMRadioMobileNetworkInfoListener(MFMRadioNetworkChangeObserver & aObserver) :
- CActive(CActive::EPriorityStandard), iNetworkChangeObserver(aObserver), iNetworkInfo(), iNetworkInfoPckg(iNetworkInfo)
-#endif
- {
- }
-
-// EPOC default constructor can leave.
-void CFMRadioMobileNetworkInfoListener::ConstructL()
- {
-
-#ifdef __WINS__
- iSubscriberId = KNullDesC().AllocL();
-
- TRAPD( err, iRepository = CRepository::NewL( KCRUidFMRadioEngine ) )
- if ( err == KErrNotFound )
- {
- // Central Repository not found, so don't request a notification
- }
- else if ( err != KErrNone )
- {
- User::Leave( err );
- }
- else
- {
- // Read initial values from Central Repository
- GetCenRepNetworkInfoL();
- SaveNetworkInfo();
- // Start listening
- CActiveScheduler::Add( this );
- User::LeaveIfError( iRepository->NotifyRequest( KFMRadioCREmulatorNetworkInfo, iStatus ) );
- SetActive();
- }
-#else
- // Get default TSY from database.
-
- CMDBSession * db = CMDBSession::NewL(CMDBSession::LatestVersion());
- CleanupStack::PushL(db);
-
- CMDBRecordSet<CCDModemBearerRecord> * set = new (ELeave) CMDBRecordSet<CCDModemBearerRecord>(KCDTIdModemBearerRecord);
- CleanupStack::PushL(set);
-
- set->LoadL(*db);
-
- TInt index = 0;
- CCDModemBearerRecord * record = static_cast<CCDModemBearerRecord*>(set->iRecords[index++]);
-
- if(record->iTsyName.IsNull() && set->iRecords.Count() > index) // the first item is normally only a template
- {
- record = static_cast<CCDModemBearerRecord*>(set->iRecords[index++]);
- }
-
- TPtrC name(static_cast<const TDesC&>(record->iTsyName));
- TBuf<KMaxTextLength> tsyName;
- tsyName.Copy(name);
-
- CleanupStack::PopAndDestroy(set);
- CleanupStack::PopAndDestroy(db);
-
- // Open phone
- User::LeaveIfError(iTelServer.Connect());
-
- // TSY module gets automatically unloaded when tel.Close() is called ( and tel is is CU-stack),
- // so loaded TSY is also leave-safe
- User::LeaveIfError(iTelServer.LoadPhoneModule(tsyName));
-
- // Get number of phones.
- TInt phones(0);
- User::LeaveIfError(iTelServer.EnumeratePhones(phones));
-
- // Get phone info of first legal phone.
- TInt legalPhoneIndex = KErrNotFound;
- RTelServer::TPhoneInfo phoneInfo;
- for (TInt i=0; i<phones && legalPhoneIndex == KErrNotFound; i++)
- {
- if (iTelServer.GetPhoneInfo(i, phoneInfo) == KErrNone)
- {
- if (phoneInfo.iNetworkType == RTelServer::ENetworkTypeMobileDigital)
- {
- legalPhoneIndex = i;
- }
- }
- }
- User::LeaveIfError(legalPhoneIndex);
-
- // Open legal phone.
- User::LeaveIfError(iPhone.Open(iTelServer, phoneInfo.iName));
-
- TUint32 networkCaps;
- User::LeaveIfError(iPhone.GetNetworkCaps(networkCaps));
- TUint32 identityCaps;
- User::LeaveIfError(iPhone.GetIdentityCaps(identityCaps));
- // Check if we are allowed to get network info.
- if (networkCaps & RMobilePhone::KCapsGetCurrentNetwork)
- {
- // Gather initial information synchronically.
- iPhone.GetCurrentNetwork(iStatus, iNetworkInfoPckg, iLocation);
- User::WaitForRequest(iStatus);
- User::LeaveIfError(iStatus.Int());
- SaveNetworkInfo();
- // Start first notify request (if allowed).
- if (networkCaps & RMobilePhone::KCapsNotifyCurrentNetwork)
- {
- CActiveScheduler::Add(this);
- iPhone.NotifyCurrentNetworkChange(iStatus, iNetworkInfoPckg, iLocation);
- SetActive();
- }
- }
- else
- {
- // Leave if we are not allowed to get network info.
- // Other action could also be considered!!!!
- User::Leave(KErrNotSupported);
- }
- if(identityCaps & RMobilePhone::KCapsGetSubscriberId)
- {
- TRequestStatus stat;
- RMobilePhone::TMobilePhoneSubscriberId subId;
- iPhone.GetSubscriberId(stat, subId);
- User::WaitForRequest(stat);
- if(!stat.Int())
- {
- iSubscriberId = subId.AllocL();
- }
- else
- {
- iSubscriberId = KNullDesC().AllocL();
- }
- }
-#endif
- }
-
-
-// Two-phased constructor.
-CFMRadioMobileNetworkInfoListener* CFMRadioMobileNetworkInfoListener::NewL(MFMRadioNetworkChangeObserver & aObserver)
- {
- CFMRadioMobileNetworkInfoListener* self = new (ELeave) CFMRadioMobileNetworkInfoListener(aObserver);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-
-// Destructor
-CFMRadioMobileNetworkInfoListener::~CFMRadioMobileNetworkInfoListener()
- {
- Cancel();
-#ifdef __WINS__
- delete iRepository;
- delete iEmulatorNetworkInfo;
-#else
- iPhone.Close();
- iTelServer.Close();
-#endif
- delete iSubscriberId;
- }
-
-
-// ---------------------------------------------------------
-// CFMRadioMobileNetworkInfoListener::RunL
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CFMRadioMobileNetworkInfoListener::RunL()
- {
-#ifdef __WINS__
- GetCenRepNetworkInfoL();
- SaveNetworkInfo();
-
- User::LeaveIfError( iRepository->NotifyRequest( KFMRadioCREmulatorNetworkInfo, iStatus ) );
- SetActive();
-#else
- TInt statusCode = iStatus.Int();
- if (statusCode == KErrNone) // No other codes are returned (except error).
- {
- SaveNetworkInfo();
- }
- // Start new notify request.
- iPhone.NotifyCurrentNetworkChange(iStatus, iNetworkInfoPckg, iLocation);
- SetActive();
-#endif
- }
-
-
-// ---------------------------------------------------------
-// CFMRadioMobileNetworkInfoListener::DoCancel
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CFMRadioMobileNetworkInfoListener::DoCancel()
- {
-#ifdef __WINS__
- iRepository->NotifyCancel( KFMRadioCREmulatorNetworkInfo );
-#else
- iPhone.CancelAsyncRequest(EMobilePhoneNotifyCurrentNetworkChange);
-#endif
- }
-
-// ---------------------------------------------------------
-// CFMRadioMobileNetworkInfoListener::SaveNetworkInfo
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CFMRadioMobileNetworkInfoListener::SaveNetworkInfo()
- {
-#ifdef __WINS__
- // iEmulatorNetworkInfo contains country code + network ID
- if ( iEmulatorNetworkInfo && iEmulatorNetworkInfo->Length() > KFMRadioCREmulatorCountryCodeLength )
- {
- iCountryCode.Copy( iEmulatorNetworkInfo->Left( KFMRadioCREmulatorCountryCodeLength ) );
- iNetworkId.Copy( iEmulatorNetworkInfo->Mid( KFMRadioCREmulatorCountryCodeLength,
- Min( iEmulatorNetworkInfo->Length() - KFMRadioCREmulatorCountryCodeLength,
- iNetworkId.MaxLength() ) ) );
- }
- else
- {
- iCountryCode.Zero();
- iNetworkId.Zero();
- }
-#else
- iNetworkInfo = iNetworkInfoPckg();
- iNetworkId.Copy(iNetworkInfo.iNetworkId);
- iCountryCode.Copy(iNetworkInfo.iCountryCode);
-#endif
-
- // Create combine network ID and country code.
- TBuf<20> compNetworkId;
- compNetworkId.Append(iCountryCode);
- // have to add '0' digit to the string to get correct id
- // 24401 instead 2441, for example
- if(iNetworkId.Length() < 2)
- {
- compNetworkId.AppendNum(static_cast<TInt64>(0));
- }
- compNetworkId.Append(iNetworkId);
- TLex lexer(compNetworkId);
- lexer.Val(iCompoundNetworkId);
- if(iCompoundNetworkId != 0 && iPreviousCompoundNetworkId != iCompoundNetworkId)
- {
- if(iPreviousCompoundNetworkId != 0)
- {
- iNetworkChangeObserver.NetworkIdChanged();
- }
- iPreviousCompoundNetworkId = iCompoundNetworkId;
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// Reads network info from Central Repository
-// ---------------------------------------------------------------------------
-//
-#ifdef __WINS__
-void CFMRadioMobileNetworkInfoListener::GetCenRepNetworkInfoL()
- {
- TInt length = KFMRadioDefaultNetworkInfoBufferSize;
- HBufC* valueString = HBufC::NewLC( length );
- TInt error( KErrTooBig );
-
- do
- {
- TPtr ptr = valueString->Des();
-
- error = iRepository->Get( KFMRadioCREmulatorNetworkInfo, ptr );
- if ( error == KErrTooBig )
- {
- CleanupStack::PopAndDestroy( valueString );
- length = 2 * length;
- valueString = HBufC::NewLC( length );
- }
- } while ( error == KErrTooBig );
-
- if ( error )
- {
- TPtr ptr = valueString->Des();
- ptr.Copy( KNullDesC() );
- }
-
- CleanupStack::Pop( valueString );
- delete iEmulatorNetworkInfo;
- iEmulatorNetworkInfo = valueString;
- }
-#endif
-
-
-// ---------------------------------------------------------
-// CFMRadioMobileNetworkInfoListener::CompoundNetworkId
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-TInt CFMRadioMobileNetworkInfoListener::CompoundNetworkId() const
- {
- return iCompoundNetworkId;
- }
-
-// ---------------------------------------------------------
-// CFMRadioMobileNetworkInfoListener::CountryCode
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-const TDesC& CFMRadioMobileNetworkInfoListener::CountryCode() const
- {
- return iCountryCode;
- }
-
-// ---------------------------------------------------------
-// CFMRadioMobileNetworkInfoListener::SubscriberId
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-const TDesC& CFMRadioMobileNetworkInfoListener::SubscriberId() const
- {
- return *iSubscriberId;
- }
-
-// End of File
--- a/fmradio/fmradioengine/src/fmradiopropertyobserver.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Observer for FMRadio property values
-*
-*/
-
-
-#include "fmradiopropertyobserver.h"
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// C++ default constructor can NOT contain any code, that might leave.
-// -----------------------------------------------------------------------------
-//
-CFMRadioPropertyObserver::CFMRadioPropertyObserver(MFMRadioPropertyChangeObserver& aObserver, const TUid& aCategory, const TUint aKey, const TFMRadioPropertyType aPropertyType)
- : CActive( CActive::EPriorityStandard ),
- iObserver( aObserver ),
- iCategory( aCategory ),
- iKey( aKey ),
- iPropertyType( aPropertyType )
- {
- }
-
-// -----------------------------------------------------------------------------
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CFMRadioPropertyObserver::ConstructL()
- {
- switch (iPropertyType)
- {
- case EFMRadioPropertyInt:
- {
- break;
- }
- case EFMRadioPropertyByteArray:
- {
- iValueByteArray = HBufC8::NewL( RProperty::KMaxPropertySize );
- break;
- }
- case EFMRadioPropertyText:
- {
- // Max size in bytes, length is size / 2
- iValueText = HBufC::NewL( RProperty::KMaxPropertySize / 2 );
- break;
- }
- default:
- {
- break;
- }
- }
-
- User::LeaveIfError( iProperty.Attach( iCategory, iKey ) );
- CActiveScheduler::Add( this );
- }
-
-// -----------------------------------------------------------------------------
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CFMRadioPropertyObserver* CFMRadioPropertyObserver::NewL( MFMRadioPropertyChangeObserver& aObserver,
- const TUid& aCategory,
- const TUint aKey,
- const TFMRadioPropertyType aPropertyType )
- {
- CFMRadioPropertyObserver* self = NewLC( aObserver,
- aCategory,
- aKey,
- aPropertyType );
- CleanupStack::Pop( self );
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CFMRadioPropertyObserver* CFMRadioPropertyObserver::NewLC( MFMRadioPropertyChangeObserver& aObserver,
- const TUid& aCategory,
- const TUint aKey,
- const TFMRadioPropertyType aPropertyType )
- {
- CFMRadioPropertyObserver* self = new( ELeave )CFMRadioPropertyObserver( aObserver,
- aCategory,
- aKey,
- aPropertyType );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-//
-CFMRadioPropertyObserver::~CFMRadioPropertyObserver()
- {
- Cancel();
- iProperty.Close();
- delete iValueByteArray;
- delete iValueText;
- }
-
-// ---------------------------------------------------------------------------
-// Subscribes to a property and reads the value, if not already active.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPropertyObserver::ActivateL()
- {
- if ( !IsActive() )
- {
- RunL();
- }
- }
-
-// -----------------------------------------------------------------------------
-// CFMRadioPropertyObserver::RunL
-// -----------------------------------------------------------------------------
-//
-void CFMRadioPropertyObserver::RunL()
- {
- iProperty.Subscribe( iStatus );
- SetActive();
-
- TInt err(KErrNone);
-
- switch (iPropertyType)
- {
- case EFMRadioPropertyInt:
- {
- err = iProperty.Get( iValueInt );
- if (!err)
- {
- iObserver.HandlePropertyChangeL( iCategory, iKey, iValueInt );
- }
- break;
- }
- case EFMRadioPropertyByteArray:
- {
- TPtr8 ptr8( iValueByteArray->Des() );
- err = iProperty.Get( ptr8 );
- if (!err)
- {
- iObserver.HandlePropertyChangeL( iCategory, iKey, *iValueByteArray );
- }
- break;
- }
- case EFMRadioPropertyText:
- {
- TPtr ptr( iValueText->Des() );
- err = iProperty.Get( ptr );
- if (!err)
- {
- iObserver.HandlePropertyChangeL( iCategory, iKey, *iValueText );
- }
- break;
- }
-
- default:
- {
- break;
- }
- }
-
- if (err)
- {
- iObserver.HandlePropertyChangeErrorL(iCategory, iKey, err);
- }
- }
-
-// -----------------------------------------------------------------------------
-// Cancels an outstanding active request
-// -----------------------------------------------------------------------------
-//
-void CFMRadioPropertyObserver::DoCancel()
- {
- iProperty.Cancel();
- }
-
-// -----------------------------------------------------------------------------
-// Getter for integer value
-// -----------------------------------------------------------------------------
-//
-TInt CFMRadioPropertyObserver::ValueInt( TBool aUpdate )
- {
- if( aUpdate )
- {
- iProperty.Get( iValueInt );
- }
- return iValueInt;
- }
-
-// -----------------------------------------------------------------------------
-// Getter for byte array value
-// -----------------------------------------------------------------------------
-//
-const TDesC8& CFMRadioPropertyObserver::ValueDes8( TBool aUpdate )
- {
- if( aUpdate )
- {
- TPtr8 ptr8( iValueByteArray->Des() );
- iProperty.Get( ptr8 );
- }
- return *iValueByteArray;
- }
-
-// -----------------------------------------------------------------------------
-// Getter for text value
-// -----------------------------------------------------------------------------
-//
-const TDesC& CFMRadioPropertyObserver::ValueDes( TBool aUpdate )
- {
- if( aUpdate )
- {
- TPtr ptr( iValueText->Des() );
- iProperty.Get( ptr );
- }
- return *iValueText;
- }
-
--- a/fmradio/fmradioengine/src/fmradiopubsub.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,516 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Publish&Subscribe component of FM Radio
-*
-*/
-
-#include "fmradiocontroleventobserver.h"
-
-#include "fmradiopubsub.h"
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------------------------
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CFMRadioPubSub::CFMRadioPubSub()
- {
- }
-
-// ---------------------------------------------------------------------------
-// EPOC default constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::ConstructL()
- {
- // Define data properties.
- DefinePropertyL( KFMRadioPSDataChannel, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataFrequency, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataRadioPowerState, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataVolume, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataChannelDataChanged, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataTuningState, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataRadioMuteState, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataApplicationRunning, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataHeadsetStatus, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataFrequencyDecimalCount, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataLoudspeakerStatus, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioPSDataRDSProgramService, RProperty::EText, ETrue );
- DefinePropertyL( KFMRadioPSDataRDSRadioText, RProperty::EText, ETrue );
- DefinePropertyL( KFMRadioPSDataChannelName, RProperty::EText, ETrue );
-
- // Define control properties.
- DefinePropertyL( KFMRadioPSControlStepToChannel, RProperty::EInt, EFalse );
- DefinePropertyL( KFMRadioPSControlSeek, RProperty::EInt, EFalse );
- DefinePropertyL( KFMRadioPSControlSetRadioMuteState , RProperty::EInt, EFalse );
- // Observe control properties.
- DefinePropertyL( KFMRadioActiveIdlePresetListCount, RProperty::EInt, ETrue );
- DefinePropertyL( KFMRadioActiveIdlePresetListFocus, RProperty::EInt, ETrue );
-
-
- CFMRadioPropertyObserver* observer = CFMRadioPropertyObserver::NewLC( *this,
- KFMRadioPSUid, KFMRadioPSControlStepToChannel, CFMRadioPropertyObserver::EFMRadioPropertyInt);
- iPropertyArray.AppendL( observer );
- CleanupStack::Pop( observer );
-
- observer = CFMRadioPropertyObserver::NewLC( *this,
- KFMRadioPSUid, KFMRadioPSControlSeek, CFMRadioPropertyObserver::EFMRadioPropertyInt );
- iPropertyArray.AppendL( observer );
- CleanupStack::Pop( observer );
-
- observer = CFMRadioPropertyObserver::NewLC( *this,
- KFMRadioPSUid, KFMRadioPSControlSetRadioMuteState, CFMRadioPropertyObserver::EFMRadioPropertyInt );
- iPropertyArray.AppendL( observer );
- CleanupStack::Pop( observer );
-
- observer = CFMRadioPropertyObserver::NewLC( *this,
- KFMRadioPSUid, KFMRadioActiveIdlePresetListCount, CFMRadioPropertyObserver::EFMRadioPropertyInt );
- iPropertyArray.AppendL( observer );
- CleanupStack::Pop( observer );
-
- for ( TInt i = 0; i < iPropertyArray.Count(); i++ )
- {
- iPropertyArray[i]->ActivateL();
- }
- }
-
-// -------------------------------------------------------f--------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CFMRadioPubSub* CFMRadioPubSub::NewL()
- {
- CFMRadioPubSub* self = new (ELeave) CFMRadioPubSub();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioPubSub::~CFMRadioPubSub()
- {
- iPropertyArray.ResetAndDestroy();
- iPropertyArray.Close();
-
- DeleteProperty( KFMRadioPSDataChannel );
- DeleteProperty( KFMRadioPSDataFrequency );
- DeleteProperty( KFMRadioPSDataRadioPowerState );
- DeleteProperty( KFMRadioPSDataVolume );
- DeleteProperty( KFMRadioPSDataChannelDataChanged );
- DeleteProperty( KFMRadioPSDataTuningState );
- DeleteProperty( KFMRadioPSDataRadioMuteState );
- DeleteProperty( KFMRadioPSDataApplicationRunning );
- DeleteProperty( KFMRadioPSDataHeadsetStatus );
- DeleteProperty( KFMRadioPSDataFrequencyDecimalCount );
- DeleteProperty( KFMRadioPSDataLoudspeakerStatus );
- DeleteProperty( KFMRadioPSDataRDSProgramService );
- DeleteProperty( KFMRadioPSDataRDSRadioText );
- DeleteProperty( KFMRadioPSDataChannelName );
-
- DeleteProperty( KFMRadioPSControlStepToChannel );
- DeleteProperty( KFMRadioPSControlSeek );
- DeleteProperty( KFMRadioPSControlSetRadioMuteState );
- DeleteProperty ( KFMRadioActiveIdlePresetListCount);
- DeleteProperty ( KFMRadioActiveIdlePresetListFocus);
- }
-
-// ---------------------------------------------------------------------------
-// Defines a property.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::DefinePropertyL( TUint aKey, TInt aAttr, TBool aDataProperty ) const
- {
- /*lint -save -e648*/
- _LIT_SECURITY_POLICY_PASS( KFMRadioExternalAccessPolicy );
- /*lint -restore*/
- _LIT_SECURITY_POLICY_S0( KFMRadioInternalAccessPolicy, KUidFMRadioApplication );
-
- TInt err = KErrNone;
- if ( aDataProperty )
- {
- // For data properties, grant read access for all, but write access only for FMRadioEngine
- err = RProperty::Define( KFMRadioPSUid, aKey, aAttr, KFMRadioExternalAccessPolicy, KFMRadioInternalAccessPolicy );
- }
- else
- {
- // For control properties, grant read access only for FMRadioEngine , but write access for all
- err = RProperty::Define( KFMRadioPSUid, aKey, aAttr, KFMRadioInternalAccessPolicy, KFMRadioExternalAccessPolicy );
- }
-
-
- if ( err && err != KErrAlreadyExists )
- {
- User::Leave( err );
- }
- }
-
-// ---------------------------------------------------------------------------
-// Deletes a property
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::DeleteProperty( TUint aKey ) const
- {
- RProperty::Delete( KFMRadioPSUid, aKey );
- }
-
-// ---------------------------------------------------------------------------
-// Gets the integer value stored in a property.
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioPubSub::PropertyValueIntL( TUint aKey ) const
- {
- TInt value;
- User::LeaveIfError( RProperty::Get( KFMRadioPSUid, aKey, value ) );
- return value;
- }
-
-// ---------------------------------------------------------------------------
-// Sets a property's value.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::SetPropertyValueL( TUint aKey, TInt aValue ) const
- {
- User::LeaveIfError( RProperty::Set( KFMRadioPSUid, aKey, aValue ) );
- }
-
-// ---------------------------------------------------------------------------
-// Sets a text property value
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::SetPropertyValueL( TUint aKey, const TDesC& aValue ) const
- {
- User::LeaveIfError( RProperty::Set( KFMRadioPSUid, aKey, aValue ) );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::HandlePropertyChangeL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TInt aValue )
- {
- if (aCategory != KFMRadioPSUid)
- {
- User::Leave(KErrArgument);
- }
-
- if (iObserver)
- {
- if (aKey == KFMRadioPSControlStepToChannel)
- {
- switch (aValue)
- {
- case EFMRadioPSStepToChannelUninitialized:
- {
- break;
- }
- case EFMRadioPSStepToChannelUp:
- {
- iObserver->StepToChannelL(EFMRadioUp);
- break;
- }
- case EFMRadioPSStepToChannelDown:
- {
- iObserver->StepToChannelL(EFMRadioDown);
- break;
- }
- default:
- {
- break;
- }
- }
- }
- else if (aKey == KFMRadioPSControlSeek)
- {
- switch (aValue)
- {
- case EFMRadioPSSeekUninitialized:
- {
- break;
- }
- case EFMRadioPSSeekUp:
- {
- iObserver->SeekL(EFMRadioUp);
- break;
- }
- case EFMRadioPSSeekDown:
- {
- iObserver->SeekL(EFMRadioDown);
- break;
- }
- default:
- {
- break;
- }
- }
- }
- else if (aKey == KFMRadioPSControlSetRadioMuteState)
- {
- switch (aValue)
- {
- case EFMRadioPSMuteStateUninitialized:
- {
- break;
- }
- case EFMRadioPSMuteStateOn:
- {
- iObserver->MuteL(ETrue);
- break;
- }
- case EFMRadioPSMuteStateOff:
- {
- iObserver->MuteL(EFalse);
- break;
- }
- default:
- {
- break;
- }
- }
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Currently empty implementation because we don't listen byte array type properties.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::HandlePropertyChangeL(const TUid& /*aCategory*/, const TUint /*aKey*/, const TDesC8& /*aValue*/)
- {
- }
-
-// ---------------------------------------------------------------------------
-// Currently empty implementation because we don't listen text type properties.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::HandlePropertyChangeL(const TUid& /*aCategory*/, const TUint /*aKey*/, const TDesC& /*aValue*/)
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::HandlePropertyChangeErrorL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::HandlePropertyChangeErrorL (const TUid& /*aCategory*/, const TUint /*aKey*/, TInt /*aError*/ )
- {
- //NOP
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishChannelL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::PublishChannelL(TInt aChannelId) const
- {
- TInt oldChannelId = PropertyValueIntL( KFMRadioPSDataChannel );
-
- if ( aChannelId != oldChannelId )
- {
- SetPropertyValueL( KFMRadioPSDataChannel, aChannelId );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishFrequencyL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioPubSub::PublishFrequencyL( TUint32 aFreq ) const
- {
- TInt oldFreq = PropertyValueIntL( KFMRadioPSDataFrequency );
-
- if ( aFreq != oldFreq )
- {
- SetPropertyValueL( KFMRadioPSDataFrequency, aFreq );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishStateL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioPubSub::PublishStateL( TBool aPowerOn ) const
- {
- // If application process gets killed, power on state remains published.
- // Must not compare state transition here, because then power on might not be published.
- TFMRadioPSRadioPowerState newState = aPowerOn ? EFMRadioPSRadioPowerOn : EFMRadioPSRadioPowerOff;
- SetPropertyValueL( KFMRadioPSDataRadioPowerState, newState );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishVolumeL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::PublishVolumeL( TInt aVol ) const
- {
- TInt oldVol = PropertyValueIntL( KFMRadioPSDataVolume );
-
- if ( aVol != oldVol )
- {
- SetPropertyValueL( KFMRadioPSDataVolume, aVol );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishPresetCountL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioPubSub::PublishPresetCountL( TInt aVal ) const
- {
- TInt oldVal = PropertyValueIntL( KFMRadioActiveIdlePresetListCount );
-
- if ( aVal != oldVal )
- {
- SetPropertyValueL( KFMRadioActiveIdlePresetListCount, aVal );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishChannelDataChangedL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::PublishChannelDataChangedL( TInt aChannelId ) const
- {
- // Channel data changed notifications are allowed for the same channel multiple times, as the same channel's
- // data can be changed many times in a row.
-
- SetPropertyValueL( KFMRadioPSDataChannelDataChanged, aChannelId );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishTuningStateL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::PublishTuningStateL( TFMRadioPSTuningState aTuningState ) const
- {
- TFMRadioPSTuningState oldState = static_cast<TFMRadioPSTuningState>( PropertyValueIntL( KFMRadioPSDataTuningState ) );
-
- if ( aTuningState != oldState )
- {
- SetPropertyValueL( KFMRadioPSDataTuningState, aTuningState );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishMuteStateL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::PublishRadioMuteStateL( TBool aMuted ) const
- {
- TFMRadioPSRadioMuteState oldState = static_cast<TFMRadioPSRadioMuteState>( PropertyValueIntL( KFMRadioPSDataRadioMuteState ) );
- TFMRadioPSRadioMuteState newState = aMuted ? EFMRadioPSMuteStateOn : EFMRadioPSMuteStateOff;
-
- if ( newState != oldState )
- {
- SetPropertyValueL( KFMRadioPSDataRadioMuteState, newState );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishApplicationRunningStateL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioPubSub::PublishApplicationRunningStateL( TFMRadioPSApplicationRunningState aRunningState ) const
- {
- // If application process gets killed, wrong running state remains published.
- // Must not compare state transition here, because then application start might not be published.
- SetPropertyValueL( KFMRadioPSDataApplicationRunning, aRunningState );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishAntennaStatusL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::PublishAntennaStatusL( TFMRadioPSHeadsetStatus aAntennaStatus ) const
- {
- TFMRadioPSHeadsetStatus oldState = static_cast<TFMRadioPSHeadsetStatus>( PropertyValueIntL( KFMRadioPSDataHeadsetStatus ) );
-
- if ( aAntennaStatus != oldState )
- {
- SetPropertyValueL( KFMRadioPSDataHeadsetStatus, aAntennaStatus );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishFrequencyDecimalCountL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::PublishFrequencyDecimalCountL( TFMRadioPSFrequencyDecimalCount aDecimalCount ) const
- {
- TFMRadioPSFrequencyDecimalCount oldCount = static_cast<TFMRadioPSFrequencyDecimalCount>( PropertyValueIntL( KFMRadioPSDataFrequencyDecimalCount ) );
-
- if ( aDecimalCount != oldCount )
- {
- SetPropertyValueL( KFMRadioPSDataFrequencyDecimalCount, aDecimalCount );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishLoudspeakerStatusL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioPubSub::PublishLoudspeakerStatusL(
- TFMRadioPSLoudspeakerStatus aLoudspeakerStatus ) const
- {
- TFMRadioPSLoudspeakerStatus oldLoudspeakerStatus
- = static_cast<TFMRadioPSLoudspeakerStatus>(
- PropertyValueIntL(KFMRadioPSDataLoudspeakerStatus) );
-
- if(oldLoudspeakerStatus != aLoudspeakerStatus)
- {
- SetPropertyValueL( KFMRadioPSDataLoudspeakerStatus, aLoudspeakerStatus);
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishRDSProgramServiceL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioPubSub::PublishRDSProgramServiceL( const TDesC& aProgramService ) const
- {
- SetPropertyValueL( KFMRadioPSDataRDSProgramService, aProgramService );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishRDSRadioTextL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioPubSub::PublishRDSRadioTextL( const TDesC& aRadioText ) const
- {
- SetPropertyValueL( KFMRadioPSDataRDSRadioText, aRadioText );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::PublishChannelNameL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioPubSub::PublishChannelNameL( const TDesC& aName ) const
- {
- SetPropertyValueL( KFMRadioPSDataChannelName, aName );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioPubSub::SetControlEventObserver
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioPubSub::SetControlEventObserver( MFMRadioControlEventObserver* aControlEventObserver )
- {
- iObserver = aControlEventObserver;
- }
-
--- a/fmradio/fmradioengine/src/fmradiordsreceiver.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The RDS receiver implementation for FM Radio
-*
-*/
-
-
-#include "fmradiordsreceiver.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiver::CFMRadioRdsReceiver
-// ---------------------------------------------------------------------------
-//
-CFMRadioRdsReceiver::CFMRadioRdsReceiver( TRadioSettings& aSettings ) : CFMRadioRdsReceiverBase(aSettings)
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiver::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiver::ConstructL()
- {
- BaseConstructL();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiver::NewL
-// ---------------------------------------------------------------------------
-//
-CFMRadioRdsReceiver* CFMRadioRdsReceiver::NewL( TRadioSettings& aSettings )
- {
- CFMRadioRdsReceiver* self = new ( ELeave ) CFMRadioRdsReceiver( aSettings );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiver::~CFMRadioRdsReceiver
-// ---------------------------------------------------------------------------
-//
-CFMRadioRdsReceiver::~CFMRadioRdsReceiver()
- {
- if( iRdsUtility )
- {
- iRdsUtility->Close();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiver::InitL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiver::InitL( CRadioUtility& aRadioUtility, CFMRadioPubSub* aPubSub )
- {
- iPubSub = aPubSub;
-
- iRdsUtility = &aRadioUtility.RadioRdsUtilityL( *this );
-
- SetAutomaticSwitchingL( iSettings.IsRdsAfSearchEnabled() );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiver::SetAutomaticSwitchingL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiver::SetAutomaticSwitchingL( TBool aEnable )
- {
- if( iRdsUtility )
- {
- User::LeaveIfError( iRdsUtility->SetAutomaticSwitching( aEnable ) );
- }
-
- CFMRadioRdsReceiverBase::SetAutomaticSwitchingL( aEnable );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiver::StartReceiver
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiver::StartReceiver()
- {
- TRdsData rdsData;
- rdsData.iRdsFunctions = ERdsProgrammeService | ERdsAlternateFrequency | ERdsRadioText | ERdsRadioTextPlus;
- rdsData.iAdditionalFunctions1 = 0;
- rdsData.iAdditionalFunctions2 = 0;
-
- if( iRdsUtility && !iStarted)
- {
- if( iRdsUtility->NotifyRdsDataChange( rdsData ) == KErrNone )
- {
- // Avoid further calls
- iStarted = ETrue;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiver::StopReceiver
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiver::StopReceiver()
- {
- if( iRdsUtility )
- {
- iRdsUtility->CancelNotifyRdsDataChange();
- }
- iStarted = EFalse;
- }
--- a/fmradio/fmradioengine/src/fmradiordsreceiverbase.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,524 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The RDS receiver implementation for FM Radio
-*
-*/
-
-
-#include "fmradiordsreceiverbase.h"
-#include "fmradiopubsub.h"
-#include "fmradioengineradiosettings.h"
-
-// The delay, in microseconds, after which RDS PS name is concidered static
-const TInt KFMRadioStaticRdsPsNameDelay = 10000000;
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::CFMRadioRdsReceiverBase
-// ---------------------------------------------------------------------------
-//
-CFMRadioRdsReceiverBase::CFMRadioRdsReceiverBase( TRadioSettings& aSettings ) : iSettings(aSettings)
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::BaseConstructL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::BaseConstructL()
- {
- iPsName = HBufC::NewL( TRdsPSName().MaxLength() );
- iRadioText = HBufC::NewL( TRdsRadioText().MaxLength() );
- iPsNameTimer = CPeriodic::NewL( CActive::EPriorityStandard );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::~CFMRadioRdsReceiverBase
-// ---------------------------------------------------------------------------
-//
-CFMRadioRdsReceiverBase::~CFMRadioRdsReceiverBase()
- {
- iObservers.Close();
- delete iPsName;
- delete iRadioText;
- delete iPsNameTimer;
-
- iProgramWebUrl.Close();
- iArtistName.Close();
- iSongName.Close();
- iAlbumName.Close();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::AddObserver
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioRdsReceiverBase::AddObserver( MFMRadioRdsObserver* aObserver )
- {
- TInt index = iObservers.FindInAddressOrder( aObserver );
- if( index == KErrNotFound )
- {
- iObservers.InsertInAddressOrder( aObserver );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::RemoveObserver
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFMRadioRdsReceiverBase::RemoveObserver( MFMRadioRdsObserver* aObserver )
- {
- TInt index = iObservers.FindInAddressOrder( aObserver );
-
- if( index >= 0 )
- {
- iObservers.Remove( index );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::AutomaticSwitchingEnabled
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CFMRadioRdsReceiverBase::AutomaticSwitchingEnabled() const
- {
- return iAfEnabled;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::ProgrammeService
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CFMRadioRdsReceiverBase::ProgrammeService() const
- {
- return *iPsName;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::ProgrammeServiceNameType
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CFMRadioRdsReceiverBase::TFMRadioProgrammeSeviceType CFMRadioRdsReceiverBase::ProgrammeServiceNameType() const
- {
- return iPsNameType;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::SignalAvailable
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CFMRadioRdsReceiverBase::SignalAvailable() const
- {
- return iSignalAvailable;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::RtPlusWebUrl
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CFMRadioRdsReceiverBase::RtPlusProgramUrl() const
- {
- return iProgramWebUrl;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::RtPlusArtist
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CFMRadioRdsReceiverBase::RtPlusArtist() const
- {
- return iArtistName;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::RtPlusAlbum
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CFMRadioRdsReceiverBase::RtPlusAlbum() const
- {
- return iAlbumName;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::RtPlusSong
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CFMRadioRdsReceiverBase::RtPlusSong() const
- {
- return iSongName;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::SetAutomaticSwitchingL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::SetAutomaticSwitchingL( TBool aEnable )
- {
- iAfEnabled = aEnable;
- for( TInt i = 0 ; i < iObservers.Count() ; i++ )
- {
- iObservers[i]->RdsAfSearchStateChange( iAfEnabled );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::ClearRdsInformation
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::ClearRdsInformation()
- {
- TRdsPSName name;
- TRdsRadioText radioText;
- iPsNameTimer->Cancel();
- iPsNameType = EFMRadioPSNameStaticAssumed;
- MrroRdsDataPS( name );
- MrroRdsDataRT( radioText );
- iProgramWebUrl.Close();
- iArtistName.Close();
- iSongName.Close();
- iAlbumName.Close();
- MrroRdsEventSignalChange( EFalse );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::StaticPsNameTimerCallback
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioRdsReceiverBase::StaticPsNameTimerCallback( TAny* aSelf )
- {
- CFMRadioRdsReceiverBase* self = static_cast<CFMRadioRdsReceiverBase*>( aSelf );
- if( self )
- {
- self->iPsNameTimer->Cancel();
- if ( self->iPsNameType == EFMRadioPSNameStaticAssumed )
- {
- self->iPsNameType = EFMRadioPSNameStatic;
- for( TInt i = 0 ; i < self->iObservers.Count() ; i++ )
- {
- self->iObservers[i]->RdsDataPsNameIsStatic( ETrue );
- }
- }
- }
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::HandleRdsDataRTplusL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::HandleRdsDataRTplusL( TRdsRTplusClass aRtPlusClass, TRdsRadioText& aRtPlusData )
- {
- TBool dataChanged = EFalse;
- switch (aRtPlusClass)
- {
- case ERTplusItemTitle:
- if ( aRtPlusData != iSongName )
- {
- dataChanged = ETrue;
- iSongName.Close();
- iSongName.CreateL( aRtPlusData );
- }
- break;
- case ERTplusItemArtist:
- case ERTplusItemBand:
- if ( aRtPlusData != iArtistName )
- {
- dataChanged = ETrue;
- iArtistName.Close();
- iArtistName.CreateL( aRtPlusData );
- }
- break;
- case ERTplusItemAlbum:
- if ( aRtPlusData != iAlbumName )
- {
- dataChanged = ETrue;
- iAlbumName.Close();
- iAlbumName.CreateL( aRtPlusData );
- }
- break;
- case ERTplusProgramHomepage:
- {
- if ( aRtPlusData != iProgramWebUrl )
- {
- dataChanged = ETrue;
- iProgramWebUrl.Close();
- iProgramWebUrl.CreateL( aRtPlusData );
- }
- break;
- }
- default:
- // Let uncached values go through
- dataChanged = ETrue;
- break;
- }
-
- if ( dataChanged )
- {
- for( TInt i = 0 ; i < iObservers.Count() ; i++ )
- {
- iObservers[i]->RdsDataRadioTextPlus( aRtPlusClass, aRtPlusData );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroStationSeekByPTYComplete
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroStationSeekByPTYComplete( TInt /*aError*/, TInt /*aFrequency*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroStationSeekByTAComplete
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroStationSeekByTAComplete( TInt /*aError*/, TInt /*aFrequency*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroStationSeekByTPComplete
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroStationSeekByTPComplete( TInt /*aError*/, TInt /*aFrequency*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroGetFreqByPTYComplete
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroGetFreqByPTYComplete( TInt /*aError*/, RArray<TInt>& /*aFreqList*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroGetFreqByTAComplete
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroGetFreqByTAComplete( TInt /*aError*/, RArray<TInt>& /*aFreqList*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroGetPSByPTYComplete
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroGetPSByPTYComplete( TInt /*aError*/, RArray<TRdsPSName>& /*aPsList*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroGetPSByTAComplete
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroGetPSByTAComplete( TInt /*aError*/, RArray<TRdsPSName>& /*aPsList*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsDataPI
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsDataPI( TInt /*aPi*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsDataPTY
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsDataPTY( TRdsProgrammeType /*aPty*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsDataPS
-// Notifies of the New Programme Service data
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsDataPS( TRdsPSName& aPs )
- {
- TBool reportStaticState = EFalse;
- if ( iPsName->Length() && aPs.Length() )
- {
- if ( *iPsName != aPs && iPsNameTimer->IsActive() )
- {
- // PS existed and it changed, cancel the timer as it is not static name anymore
- iPsNameTimer->Cancel();
- iPsNameType = EFMRadioPSNameDynamic;
- reportStaticState = ETrue;
- }
- else
- {
- if ( iPsNameType == EFMRadioPSNameStaticAssumed && !iPsNameTimer->IsActive() )
- {
- // The timer should be reactivated in order to complete the determination
- iPsNameTimer->Start( KFMRadioStaticRdsPsNameDelay,
- 0,
- TCallBack( CFMRadioRdsReceiverBase::StaticPsNameTimerCallback, this ) );
- }
- }
- }
- else if ( !iPsName->Length() && aPs.Length() )
- {
- // PS name is set for the first time, start the timer to see if it is a static one
- iPsNameTimer->Cancel();
- iPsNameTimer->Start( KFMRadioStaticRdsPsNameDelay,
- 0,
- TCallBack( CFMRadioRdsReceiverBase::StaticPsNameTimerCallback, this ) );
- }
- else
- {
- // PS name is reset
- }
-
- iPsName->Des().Copy( aPs );
-
- if ( iPubSub )
- {
- TRAP_IGNORE( iPubSub->PublishRDSProgramServiceL( *iPsName ));
- }
-
- for( TInt i = 0 ; i < iObservers.Count() ; i++ )
- {
- iObservers[i]->RdsDataProgrammeService( *iPsName );
- if( reportStaticState )
- {
- iObservers[i]->RdsDataPsNameIsStatic( iPsNameType == EFMRadioPSNameStatic );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsDataRT
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsDataRT( TRdsRadioText& aRt )
- {
- iRadioText->Des().Copy( aRt );
- for( TInt i = 0 ; i < iObservers.Count() ; i++ )
- {
- iObservers[i]->RdsDataRadioText( *iRadioText );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsDataCT
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsDataCT( TDateTime& /*aCt*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsDataTA
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsDataTA( TBool /*aTaOn*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsDataRTplus
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsDataRTplus( TRdsRTplusClass aRtPlusClass, TRdsRadioText& aRtPlusData )
- {
- TRAP_IGNORE( HandleRdsDataRTplusL( aRtPlusClass, aRtPlusData ) )
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsSearchBeginAF
-// Notifies of the start of Alternate Frequency search
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsSearchBeginAF()
- {
- for( TInt i = 0 ; i < iObservers.Count() ; i++ )
- {
- iObservers[i]->RdsAfSearchBegin();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsSearchBeginAF
-// Notifies of the end of Alternate Frequency search
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsSearchEndAF( TInt aError, TInt aFrequency )
- {
- for( TInt i = 0 ; i < iObservers.Count() ; i++ )
- {
- // Radio utility uses Hz, UI uses kHz. It's ok to divide with 1000, possible lost fractions are useless.
- iObservers[i]->RdsAfSearchEnd( aFrequency / KFMRadioFreqMultiplier, aError );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsStationChangeTA
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsStationChangeTA( TInt /*aFrequency*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsEventAutomaticSwitchingChange
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsEventAutomaticSwitchingChange( TBool /*aAuto*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsEventAutomaticTrafficAnnouncement
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsEventAutomaticTrafficAnnouncement( TBool /*aAuto*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverBase::MrroRdsEventSignalChange
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverBase::MrroRdsEventSignalChange( TBool aSignal )
- {
- if ( aSignal )
- {
- if ( iPsName->Length() )
- {
- if ( iPsNameType == EFMRadioPSNameStaticAssumed && !iPsNameTimer->IsActive() )
- {
- iPsNameTimer->Cancel();
- iPsNameTimer->Start( KFMRadioStaticRdsPsNameDelay,
- 0,
- TCallBack( CFMRadioRdsReceiverBase::StaticPsNameTimerCallback, this ) );
- }
- }
- }
- else
- {
- // PS name type determination must be canceled on bad signal
- iPsNameTimer->Cancel();
- }
- iSignalAvailable = aSignal;
- for( TInt i = 0 ; i < iObservers.Count() ; i++ )
- {
- iObservers[i]->RdsAvailable( iSignalAvailable );
- }
- }
--- a/fmradio/fmradioengine/src/fmradiordsreceiversimulator.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,276 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The RDS receiver implementation for FM Radio
-*
-*/
-
-
-#include "fmradiordsreceiversimulator.h"
-
-const TInt KFMRadioRdsEventSimulationDelay = 3000000;
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverSimulator::CFMRadioRdsReceiverSimulator
-// ---------------------------------------------------------------------------
-//
-CFMRadioRdsReceiverSimulator::CFMRadioRdsReceiverSimulator( TRadioSettings& aSettings ) : CFMRadioRdsReceiverBase(aSettings)
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverSimulator::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverSimulator::ConstructL()
- {
- BaseConstructL();
- iEventSimulatorTimer = CPeriodic::NewL(CActive::EPriorityUserInput);
- SetAutomaticSwitchingL( iSettings.IsRdsAfSearchEnabled() );
- StartReceiver();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverSimulator::NewL
-// ---------------------------------------------------------------------------
-//
-CFMRadioRdsReceiverSimulator* CFMRadioRdsReceiverSimulator::NewL( TRadioSettings& aSettings )
- {
- CFMRadioRdsReceiverSimulator* self = new ( ELeave ) CFMRadioRdsReceiverSimulator( aSettings );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverSimulator::~CFMRadioRdsReceiverSimulator
-// ---------------------------------------------------------------------------
-//
-CFMRadioRdsReceiverSimulator::~CFMRadioRdsReceiverSimulator()
- {
- if( iEventSimulatorTimer && iEventSimulatorTimer->IsActive() )
- {
- iEventSimulatorTimer->Cancel();
- }
-
- delete iEventSimulatorTimer;
- iEventSimulatorTimer = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverSimulator::InitL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverSimulator::InitL( CRadioUtility& /*aRadioUtility*/, CFMRadioPubSub* aPubSub )
- {
- iPubSub = aPubSub;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverSimulator::StartReceiver
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverSimulator::StartReceiver()
- {
- if( !iEventSimulatorTimer->IsActive() )
- {
- iEventSimulatorTimer->Start( TTimeIntervalMicroSeconds32(KFMRadioRdsEventSimulationDelay),
- TTimeIntervalMicroSeconds32(KFMRadioRdsEventSimulationDelay),
- TCallBack(StaticRdsSimulationCallback, this));
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverSimulator::StopReceiver
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverSimulator::StopReceiver()
- {
- iEventSimulatorTimer->Cancel();
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverSimulator::SetRadioEngineForRadioFmTunerSimulation
-// ---------------------------------------------------------------------------
-//
-void CFMRadioRdsReceiverSimulator::SetRadioEngineForRadioFmTunerSimulation( CRadioEngine* aEngine )
- {
- iEngine = aEngine;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioRdsReceiverSimulator::StaticRdsSimulationCallback
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioRdsReceiverSimulator::StaticRdsSimulationCallback( TAny* aSelfPtr )
- {
- TFMRadioRdsSimulationEvent events[] = { EFMRadioRdsEventRadioTextPlus,
- EFMRadioRdsEventRadioTextPlus,
- EFMRadioRdsEventRadioTextPlus,
- EFMRadioRdsEventRadioTextPlus,
- EFMRadioRdsEventSignalOn,
- // EFMRadioRdsEventAFBegin,
- // EFMRadioRdsEventAFEnd,
- EFMRadioRdsEventPS,
- EFMRadioRdsEventRadioText,
- //EFMRadioRdsEventSignalOff,
- //EFMRadioRdsEventSignalOn,
- EFMRadioRdsEventPS,
- EFMRadioRdsEventPS,
- // EFMRadioRdsEventRadioText,
- // EFMRadioRdsEventRadioText
- EFMRadioRdsEventAFBegin,
- EFMRadioRdsEventPS,
- EFMRadioRdsEventAFEnd,
- EFMRadioRdsEventSignalOff,
- EFMRadioRdsEventRadioTextPlus};
-
- TRdsPSName serviceNames[] =
- {
- _L("RadioXYZ"),
- _L("Some"),
- _L("program"),
- _L("service"),
- _L("text")
- };
-
- TRdsRadioText radioTexts[] =
- {
- _L("radio text"),
- _L("radio text radio text radio text"),
- _L("full radio text full radio text full radio text full radio textt")
- };
-
- TRdsRadioText radioTextsPlus[] =
- {
- _L("The rock song"),
- _L("Album of the year"),
- _L("Rock 'n' Rollers"),
- _L("http://www.symbianfoundation.org/"),
- _L("Disco Dancers"),
- _L("The disco song"),
- _L("The Greatest"),
- _L("http://developer.symbian.org/"),
- };
-
- TRdsRTplusClass radioTextsPlusClasses[] =
- {
- ERTplusItemTitle,
- ERTplusItemAlbum,
- ERTplusItemArtist,
- ERTplusProgramHomepage,
- ERTplusItemArtist,
- ERTplusItemTitle,
- ERTplusItemAlbum,
- ERTplusProgramHomepage,
- };
-
- TInt frequencies[] = { 103100000, 95800000 }; // Frequencies in hz
-
- TInt numEvents = sizeof( events ) / sizeof( TFMRadioRdsSimulationEvent );
- TInt numServiceNames = sizeof( serviceNames ) / sizeof( TRdsPSName );
- TInt numRadioTexts = sizeof( radioTexts ) / sizeof( TRdsRadioText );
- TInt numRadioTextsPlus = sizeof( radioTextsPlus ) / sizeof( TRdsRadioText );
- TInt numFrequencies = sizeof( frequencies ) / sizeof( TInt );
-
- CFMRadioRdsReceiverSimulator* self = static_cast<CFMRadioRdsReceiverSimulator*>(aSelfPtr);
- if( self )
- {
- switch( events[self->iEventIterator] )
- {
- case EFMRadioRdsEventSignalOn:
- {
- self->MrroRdsEventSignalChange( ETrue );
- break;
- }
-
- case EFMRadioRdsEventSignalOff:
- {
- self->MrroRdsEventSignalChange( EFalse );
- break;
- }
-
- case EFMRadioRdsEventPS:
- {
- self->MrroRdsDataPS( serviceNames[self->iPsIterator] );
- self->iPsIterator++;
- if( self->iPsIterator >= numServiceNames )
- {
- self->iPsIterator = 0;
- }
- break;
- }
- case EFMRadioRdsEventRadioText:
- {
- self->MrroRdsDataRT( radioTexts[self->iRadioTextIterator] );
- self->iRadioTextIterator++;
- if( self->iRadioTextIterator >= numRadioTexts )
- {
- self->iRadioTextIterator = 0;
- }
- break;
- }
- case EFMRadioRdsEventAFBegin:
- {
- if ( self->AutomaticSwitchingEnabled() )
- {
- self->MrroRdsSearchBeginAF();
- }
- break;
- }
-
- case EFMRadioRdsEventAFEnd:
- {
- if ( self->AutomaticSwitchingEnabled() )
- {
- // Simulate MrftoFrequencyChange method from MRadioFmTunerObserver
- if( self->iEngine )
- {
- self->iEngine->MrftoFrequencyChange( frequencies[self->iFrequencyIterator] );
- }
-
- self->MrroRdsSearchEndAF( KErrNone, frequencies[self->iFrequencyIterator] );
-
- self->iFrequencyIterator++;
- if( self->iFrequencyIterator >= numFrequencies )
- {
- self->iFrequencyIterator = 0;
- }
- }
- break;
- }
- case EFMRadioRdsEventRadioTextPlus:
- {
- self->MrroRdsDataRTplus( radioTextsPlusClasses[self->iRadioTextPlusIterator],
- radioTextsPlus[self->iRadioTextPlusIterator]);
- self->iRadioTextPlusIterator++;
- if( self->iRadioTextPlusIterator >= numRadioTextsPlus )
- {
- self->iRadioTextPlusIterator = 0;
- }
- break;
- }
- default:
- break;
- }
- self->iEventIterator++;
- if( self->iEventIterator >= numEvents )
- {
- self->iEventIterator = 0;
- }
- }
- return KErrNone;
- }
--- a/fmradio/fmradioengine/src/fmradioregion.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: provides information about FM region
-*
-*/
-
-
-// INCLUDE FILES
-#include <barsread.h>
-#include "fmradioregion.h"
-
-// ================= MEMBER FUNCTIONS =======================
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CFMRadioRegion::CFMRadioRegion()
- {
- }
-
-// EPOC default constructor can leave.
-void CFMRadioRegion::ConstructL(TResourceReader& aRr)
- {
- iId = static_cast<TFMRadioRegionSetting>(aRr.ReadUint16());
- iStepSize = static_cast<TUint16>( aRr.ReadUint16() );
- iMinFreq = aRr.ReadUint32();
- iMaxFreq = aRr.ReadUint32();
- iDecimalCount = aRr.ReadInt16();
-
- TInt countryCodeCount = aRr.ReadInt16();
- for(TInt i = 0 ; i < countryCodeCount ; i++)
- {
- TPtrC code;
- code.Set(aRr.ReadTPtrC());
- User::LeaveIfError(iCountryCodes.Append(code.AllocL()));
- }
-
- iName = aRr.ReadHBufC16L();
- iSettingName = aRr.ReadHBufC16L();
- }
-
-// Two-phased constructor.
-CFMRadioRegion* CFMRadioRegion::NewL(TResourceReader& aRr)
- {
- CFMRadioRegion* self = new (ELeave) CFMRadioRegion;
-
- CleanupStack::PushL(self);
- self->ConstructL(aRr);
- CleanupStack::Pop();
-
- return self;
- }
-
-
-// Destructor
-CFMRadioRegion::~CFMRadioRegion()
- {
- iCountryCodes.ResetAndDestroy();
- iCountryCodes.Close();
- delete iName;
- delete iSettingName;
- }
-
-// ---------------------------------------------------------
-// CFMRadioRegion::Id
-// Get the id of region
-// ---------------------------------------------------------
-//
-TFMRadioRegionSetting CFMRadioRegion::Id() const
- {
- return iId;
- }
-
-// ---------------------------------------------------------
-// CFMRadioRegion::StepSize
-// Get the step interval of region
-// ---------------------------------------------------------
-//
-TUint32 CFMRadioRegion::StepSize() const
- {
- return iStepSize;
- }
-
-// ---------------------------------------------------------
-// CFMRadioRegion::MinFreq
-// ---------------------------------------------------------
-//
-TUint32 CFMRadioRegion::MinFrequency() const
- {
- return iMinFreq;
- }
-
-// ---------------------------------------------------------
-// CFMRadioRegion::MaxFreq
-// ---------------------------------------------------------
-//
-TUint32 CFMRadioRegion::MaxFrequency() const
- {
- return iMaxFreq;
- }
-
-// ---------------------------------------------------------
-// CFMRadioRegion::DecimalCount
-// ---------------------------------------------------------
-//
-TInt CFMRadioRegion::DecimalCount() const
- {
- return iDecimalCount;
- }
-
-// ---------------------------------------------------------
-// CFMRadioRegion::CountryCode
-// Get the country code of region
-// ---------------------------------------------------------
-//
-const RFMRadioCountryCodeArray& CFMRadioRegion::CountryCodes()
- {
- return iCountryCodes;
- }
-
-// ---------------------------------------------------------
-// CFMRadioRegion::Name
-// Get the name of region
-// ---------------------------------------------------------
-//
-const TDesC16& CFMRadioRegion::Name() const
- {
- return *iName;
- }
-
-// ---------------------------------------------------------
-// CFMRadioRegion::SettingItemName
-// Get the name of region
-// ---------------------------------------------------------
-//
-const TDesC16& CFMRadioRegion::SettingItemName() const
- {
- return *iSettingName;
- }
-
-// End of File
--- a/fmradio/fmradioengine/src/fmradiosystemeventdetector.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,427 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Observer for system events
-*
-*/
-
-#include "fmradiovariant.hrh" // include first for variation
-#include <e32def.h> // Define before audiopolicy defs
-#include <e32std.h> // Define before audiopolicy defs
-#include <eikdef.h>
-#include <sacls.h>
-#include <voiceuidomainpskeys.h>
-#include <ctsydomainpskeys.h>
-#ifndef __WINS__
-
-#ifdef __FMRADIO_ADVANCED_AUTO_RESUME
-
-const TInt KFMRadioAudioCategoryArrayGranularity = 3;
-#include <internal/audiopolicypubsubdata.h>
-#include <internal/audiosw_pubsubkeys.h>
-
-#else
-
-#include <AudioClientsListPSData.h>
-#include <AudioClientsListPSKeys.h>
-
-#endif // __FMRADIO_ADVANCED_AUTO_RESUME
-
-#endif //__WINS__
-
-#include "debug.h"
-#include "fmradiosystemeventdetector.h"
-#include "fmradiosystemeventdetectorobserver.h"
-
-const TInt KFMRadioAutoResumeDelay = 2000000; // micro seconds -> 2 seconds
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::CFMRadioSystemEventDetector
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CFMRadioSystemEventDetector::CFMRadioSystemEventDetector(MFMRadioSystemEventDetectorObserver& aObserver)
- : iObserver( aObserver ),
- iIsNetworkCoverage( EFalse),
- iIsVoiceUiActive( EFalse )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::ConstructL
-// EPOC default constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioSystemEventDetector::ConstructL()
- {
- CFMRadioPropertyObserver* networkObserver =
- CFMRadioPropertyObserver::NewLC( *this,
- KUidSystemCategory,
- KUidNetworkStatusValue,
- CFMRadioPropertyObserver::EFMRadioPropertyInt );
-
- iPropertyArray.AppendL( networkObserver );
- CleanupStack::Pop( networkObserver );
-
- CFMRadioPropertyObserver* voiceUiObserver =
- CFMRadioPropertyObserver::NewLC( *this,
- KPSUidVoiceUiAccMonitor,
- KVoiceUiOpenKey,
- CFMRadioPropertyObserver::EFMRadioPropertyInt );
-
- iPropertyArray.AppendL( voiceUiObserver );
- CleanupStack::Pop( voiceUiObserver );
- // Initialize call state observer.
- iCallStatusObserver = CFMRadioPropertyObserver::NewL( *this,
- KPSUidCtsyCallInformation,
- KCTsyCallState,
- CFMRadioPropertyObserver::EFMRadioPropertyInt);
-
- iCallStatusObserver->ActivateL();
- iIsCallActive = iCallStatusObserver->ValueInt() != EPSCTsyCallStateNone;
-
- iAutoResumeTimer = CPeriodic::NewL( CActive::EPriorityStandard );
-
-#ifndef __WINS__
-#ifdef __FMRADIO_ADVANCED_AUTO_RESUME
- // Define audio types for not resuming.
- // Audio categories are currently defined by adaptation of each hw platform.
- // Nokia adaptation uses following definitions, which must be replaced by corresponding
- // adaptation specific definitions of licensee adaptation.
- // No general Symbian Foundation definitions for categories exists yet.
- iNoAutoResumeAudioCategories = RArray<TInt>( KFMRadioAudioCategoryArrayGranularity );
- iNoAutoResumeAudioCategories.AppendL( ECatMediaPlayer );
- iNoAutoResumeAudioCategories.AppendL( ECatMobileTv );
- iNoAutoResumeAudioCategories.AppendL( ECatUnknownPlayer );
- iNoAutoResumeAudioCategories.Compress();
-#endif // __FMRADIO_ADVANCED_AUTO_RESUME
- // Start listening audio client events.
- CFMRadioPropertyObserver* audioPolicyObserver =
- CFMRadioPropertyObserver::NewLC( *this,
- KPSUidMMFAudioServer,
- KAudioPolicyAudioClients,
- CFMRadioPropertyObserver::EFMRadioPropertyByteArray );
-
- iPropertyArray.AppendL( audioPolicyObserver );
- CleanupStack::Pop( audioPolicyObserver );
-#endif
- for ( TInt i = 0; i < iPropertyArray.Count(); i++ )
- {
- iPropertyArray[i]->ActivateL();
- }
-
- TInt networkAvailability = iPropertyArray[EFMRadioNetworkCoverageProperty]->ValueInt();
-
- if (networkAvailability == ESANetworkAvailable)
- {
- iIsNetworkCoverage = ETrue;
- }
- else
- {
- iIsNetworkCoverage = EFalse;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::~CFMRadioSystemEventDetector
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CFMRadioSystemEventDetector::~CFMRadioSystemEventDetector()
- {
- delete iCallStatusObserver;
- iPropertyArray.ResetAndDestroy();
- iPropertyArray.Close();
- iNoAutoResumeAudioCategories.Close();
- delete iAutoResumeTimer;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::NewL
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CFMRadioSystemEventDetector* CFMRadioSystemEventDetector::NewL(
- MFMRadioSystemEventDetectorObserver& aObserver)
- {
- CFMRadioSystemEventDetector* self = new (ELeave) CFMRadioSystemEventDetector(aObserver);
-
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
-
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::HandlePropertyChangeL
-// Handling of the int property changes is done here.
-// Observer components are getting notifications in correspondence with what
-// has changed
-// ---------------------------------------------------------------------------
-//
-void CFMRadioSystemEventDetector::HandlePropertyChangeL( const TUid& aCategory,
- const TUint aKey,
- const TInt aValue )
- {
- if (aCategory == KUidSystemCategory && aKey == KUidNetworkStatusValue)
- {
- switch (aValue)
- {
- case ESANetworkAvailable:
- {
- if (!iIsNetworkCoverage)
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector - iObserver NetworkUpCallbackL") ) );
- iIsNetworkCoverage = ETrue;
- iObserver.NetworkUpCallbackL();
- }
- break;
- }
- case ESANetworkUnAvailable:
- {
- if (iIsNetworkCoverage)
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector - iObserver NetworkDownCallbackL") ) );
- iIsNetworkCoverage = EFalse;
- iObserver.NetworkDownCallbackL();
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- else if ( aCategory == KPSUidCtsyCallInformation && aKey == KCTsyCallState )
- {
- if ( ( !iIsCallActive ) && ( aValue > EPSCTsyCallStateNone ) )
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector - iObserver iIsCallActive = ETrue;") ) );
- iIsCallActive = ETrue;
- iObserver.CallActivatedCallbackL();
- }
- else if ( ( iIsCallActive ) && ( aValue <= EPSCTsyCallStateNone ) )
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector - iObserver iIsCallActive = EFalse;") ) );
- iIsCallActive = EFalse;
- iObserver.CallDeactivatedCallbackL();
- }
- else
- {
- // No change
- }
- }
- else if ( aCategory == KPSUidVoiceUiAccMonitor && aKey == KVoiceUiOpenKey )
- {
- switch (aValue)
- {
- case KVoiceUiIsClose:
- {
- if (iIsVoiceUiActive)
- {
- iIsVoiceUiActive = EFalse;
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector - iObserver KVoiceUiIsClose") ) );
- if ( iNumberOfActiveAudioClients == 0 )
- {
- NotifyAudioResourcesAvailability();
- }
- }
- break;
- }
- case KVoiceUiIsOpen:
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector - iObserver KVoiceUiIsOpen") ) );
- if (!iIsVoiceUiActive)
- {
- iIsVoiceUiActive = ETrue;
-
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- else // NOP
- {
- }
-
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::HandlePropertyChangeErrorL
-// This is a callback function which is called when a P&S components returns
-// an error
-// ---------------------------------------------------------------------------
-//
-void CFMRadioSystemEventDetector::HandlePropertyChangeErrorL( const TUid& /*aCategory*/,
- const TUint /*aKey*/,
- TInt /*aError*/ )
- {
- }
-
-#ifndef __WINS__
-// ---------------------------------------------------------------------------
-// Handling of the byte array property changes is done here.
-// Observer components are getting notifications in correspondence with what
-// has changed
-// ---------------------------------------------------------------------------
-//
-void CFMRadioSystemEventDetector::HandlePropertyChangeL( const TUid& aCategory,
- const TUint aKey,
- const TDesC8& aValue)
- {
- if ( aCategory == KPSUidMMFAudioServer )
- {
- if ( aKey == KAudioPolicyAudioClients )
- {
- TAudioClientList audioClients;
- audioClients.Copy( aValue );
-
- iNumberOfActiveAudioClients = audioClients().iNumOfProcesses;
- FTRACE(FPrint(_L("CFMRadioSystemEventDetector::HandlePropertyChangeL() number of audio clients: = %d"), iNumberOfActiveAudioClients));
-
- TBool autoResumePossible = ETrue;
-
- if ( iNumberOfActiveAudioClients > 0 )
- {
- // cancel any previously started audio resume call
- iAutoResumeTimer->Cancel();
- }
-
- // Check all playing audios!
- for ( TInt i = 0; i < iNumberOfActiveAudioClients; i++ )
- {
- TInt cat = audioClients().iClientCategoryList[i];
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector - audio category %d"), cat ) );
-
- if ( iNoAutoResumeAudioCategories.Find(cat) != KErrNotFound )
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector - Radio audio will not be resumed") ) );
- autoResumePossible = EFalse;
- }
- else
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector - radio audio might be resumed") ) );
- }
- }
-
- // Decide audio resource availability from audio category info.
- if ( !autoResumePossible )
- {
- // Auto resume forbidden
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector::HandlePropertyChangeL - AudioAutoResumeForbiddenL ") ) );
- iObserver.AudioAutoResumeForbiddenL();
- }
- else if ( iNumberOfActiveAudioClients == 0 )
- {
- if ( !iIsVoiceUiActive )
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector::HandlePropertyChangeL - NotifyAudioResourcesAvailabilityL") ) );
- NotifyAudioResourcesAvailability();
- }
- }
- else
- {
- // NOP. Some auto resume neutral audio is playing
- }
- }
- }
- }
-
-
-#endif //__WINS__
-
-#ifdef __WINS__
-// ---------------------------------------------------------------------------
-// Dummy version for WINS in order to avoid compiler warnings.
-// The real implementation of function is above.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioSystemEventDetector::HandlePropertyChangeL( const TUid& /*aCategory*/,
- const TUint /*aKey*/,
- const TDesC8& /*aValue*/)
- {
- }
-#endif // __WINS__
-
-// Handling of the text property changes is done here.
-// Observer components are getting notifications in correspondence with what
-// has changed
-// ---------------------------------------------------------------------------
-//
-void CFMRadioSystemEventDetector::HandlePropertyChangeL( const TUid& /*aCategory*/,
- const TUint /*aKey*/,
- const TDesC& /*aValue*/)
- {
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::IsNetworkCoverage
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioSystemEventDetector::IsNetworkCoverage() const
- {
-#ifdef __WINS__
- return ETrue;
-#else
- return iIsNetworkCoverage;
-#endif
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::IsCallActive
-// ---------------------------------------------------------------------------
-//
-TBool CFMRadioSystemEventDetector::IsCallActive() const
- {
- return iIsCallActive;
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::NotifyAudioResourcesAvailability
-// ---------------------------------------------------------------------------
-//
-void CFMRadioSystemEventDetector::NotifyAudioResourcesAvailability()
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector::NotifyAudioResourcesAvailability") ) );
- // call observer interface after a delay
- iAutoResumeTimer->Cancel();
- iAutoResumeTimer->Start( TTimeIntervalMicroSeconds32( KFMRadioAutoResumeDelay ),
- TTimeIntervalMicroSeconds32( 0 ),
- TCallBack( StaticAutoResumeTimerCallback, this ) );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioSystemEventDetector::StaticAutoResumeTimerCallback
-// ---------------------------------------------------------------------------
-//
-TInt CFMRadioSystemEventDetector::StaticAutoResumeTimerCallback( TAny* aSelfPtr )
- {
- FTRACE( FPrint( _L("CFMRadioSystemEventDetector::StaticAutoResumeTimerCallback") ) );
- CFMRadioSystemEventDetector* self = static_cast<CFMRadioSystemEventDetector*>( aSelfPtr );
- if ( self )
- {
- self->iAutoResumeTimer->Cancel();
- TRAP_IGNORE( self->iObserver.AudioResourcesAvailableL() )
- }
- return KErrNone;
- }
-
-// end of file
--- a/fmradio/fmradiomcpplugin/group/bld.inf Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Component definition for the
-* FM Radio Content Publisher plugin.
-*
-*/
-
-#include <platform_paths.hrh>
-
-// Platforms the component needs to be built on
-//
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-fmradiomcpplugin.mmp
-
-// End of file
--- a/fmradio/fmradiomcpplugin/group/fmradiomcpplugin.mmp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project
-* FM Radio Content Publisher plugin.
-*
-*/
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-#include "../resources/fmradiomcpplugin.hrh"
-
-TARGET fmradiomcpplugin100.dll
-TARGETTYPE PLUGIN
-UID 0x10009D8D KFMRadioMCPPluginDllUid
-
-CAPABILITY CAP_ECOM_PLUGIN
-VENDORID VID_DEFAULT
-
-PAGED
-
-SOURCEPATH ../resources
-START RESOURCE 2001f497.rss
-TARGET fmradiomcpplugin100.rsc
-TARGETPATH ECOM_RESOURCE_DIR
-END
-
-START RESOURCE fmradiomcpplugin.rss
-HEADER
-TARGETPATH RESOURCE_FILES_DIR
-LANGUAGE_IDS
-END
-
-APP_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../fmradio/inc
-USERINCLUDE ../resources
-USERINCLUDE ../../activeidleengine/inc
-USERINCLUDE ../../fmradioactionhandler/inc
-USERINCLUDE ../../fmradioactionhandler/resources
-USERINCLUDE ../../fmradioengine/inc
-USERINCLUDE ../../loc
-
-SOURCEPATH ../src
-SOURCE fmradiomcpplugin.cpp
-
-LIBRARY avkon.lib
-LIBRARY bafl.lib
-LIBRARY cone.lib
-LIBRARY commonengine.lib
-LIBRARY ecom.lib
-LIBRARY efsrv.lib
-LIBRARY euser.lib
-LIBRARY liwservicehandler.lib
-LIBRARY fmradioactiveidleengine200.lib
-LIBRARY fmradioengine.lib
-
-DEBUGLIBRARY flogger.lib
-
-// End of File
--- a/fmradio/fmradiomcpplugin/inc/fmradiomcpplugin.h Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration for the class CFMRadioMCPPlugin.
-*
-*/
-
-#ifndef FMRADIOMCPPLUGIN_H
-#define FMRADIOMCPPLUGIN_H
-
-#include <fmradiointernalpskeys.h>
-#include <mcpplugin.h>
-#include <mcppluginobserver.h>
-
-#include "fmradioactiveidleenginenotifyhandler.h"
-
-class CFMRadioActiveIdleEngine;
-class MFMRadioActiveIdleEngineNotifyHandler;
-
-/**
-* Music content publisher plugin for FM Radio.
-*
-* Implements MCP plugin which publishes FM Radio state to affected parties.
-*
-* @lib fmradiomcpplugin100.lib
-*
-*/
-NONSHARABLE_CLASS( CFMRadioMCPPlugin ) : public CMCPPlugin,
- public MFMRadioActiveIdleEngineNotifyHandler
- {
-public:
-
- static CFMRadioMCPPlugin* NewL( MMCPPluginObserver* aObserver );
- ~CFMRadioMCPPlugin();
-
-// from base class CMCPPlugin
- void Deactivate();
-
-// from base class MFMRadioActiveIdleEngineNotifyHandler
- void HandleRadioVolumeChangeL( TInt aVolume );
- void HandleTuningStateChangeL( TFMRadioPSTuningState aTuningState );
- void HandleFrequencyChangeL( TInt aFrequency );
- void HandleChannelChangeL( TInt aId );
- void HandleChannelModifyL( TInt aId );
- void HandleMuteStateChangeL( TFMRadioPSRadioMuteState aMuteState );
- void HandleApplicationRunningStateChangeL( TFMRadioPSApplicationRunningState aRunningState );
- void HandleFrequencyDecimalCountChangeL( TFMRadioPSFrequencyDecimalCount aDecimalCount );
- void HandleAntennaStatusChangeL( TFMRadioPSHeadsetStatus aAntennaStatus );
- void HandlePowerStateChangeL( TFMRadioPSRadioPowerState aPowerState );
- void HandleRDSProgramServiceChangeL( const TDesC& aProgramService );
- void HandleRDSRadioTextChangeL( const TDesC& aRdsText );
- void HandleChannelNameChangeL( const TDesC& aName );
- void HandlePresetListCountChangeL( TInt aPresetCount );
- void HandlePresetListFocusChangeL( TInt aPresetFocus );
-
-private:
- void InstallFMRadioCommandActionL( const TDesC& aCommand, TMCPTriggerDestination aDestination );
- void ActivateL();
- void InstallEmptyActionL( TMCPTriggerDestination aDestination );
- void DimmNextAndPrevious();
- void PublishApplicationIconL( TMCPImageDestination aDestination );
- void PublishFrequencyL( TInt aFrequency, TMCPTextDestination aDestination );
- void UpdatePublishedToolBarL(TUint aToolBarState);
- void UpdateToolBarL( TBool aForceApplicationClosing = EFalse );
- void UpdateMusicWidgetTextL( TBool aForceApplicationClosing = EFalse );
-
- /**
- * Transfers the given frequency number as a descriptor
- * @param aFrequency The frequency to be formatted
- * @return The frequency descriptor. Pushed to Cleanup Stack. Ownership is transfered.
- */
- HBufC* FrequencyStringLC( TInt aFrequency );
-
-private:
- CFMRadioMCPPlugin( MMCPPluginObserver* aObserver );
- void ConstructL();
- void InitializeResourceLoadingL();
-
-private:
- MMCPPluginObserver* iObserver;
-
- CFMRadioActiveIdleEngine* iEngine;
- TBool iActive;
- TInt iResourceOffset;
- RBuf iAntennaNotConnectedText;
- RBuf iTuningText;
- RBuf iSavedStationFormat;
- RBuf iSavedStationFormatNoName;
- RBuf iFrequencyFormat;
-
- RBuf iSavedStationFormatMenu;
- RBuf iSavedStationFormatNoNameMenu;
- RBuf iFrequencyFormatMenu;
- RBuf iNowPlayingText;
- RBuf iLastPlayedText;
-
- TUint iTbPreviousState;
- TUint iTbMuteUnmuteState;
- TUint iTbNextState;
- TInt iPresetCount;
-
- /**
- * Name of the mif-file that provides the published icons.
- * Owned.
- */
- RBuf iMifFileName;
- };
-
-#endif /* FMRADIOMCPPLUGIN_H */
--- a/fmradio/fmradiomcpplugin/resources/2001f497.rss Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: ECom plugin registration resource for FM Radio Content Publisher Plugin.
-*
-*/
-
-#include <mcppluginuids.hrh>
-#include <ecom/registryinfov2.rh>
-
-#include "fmradiomcpplugin.hrh"
-
-// ---------------------------------------------------------------------------
-// Resource information for the ECOM DLL.
-// ---------------------------------------------------------------------------
-//
-RESOURCE REGISTRY_INFO theInfo
- {
- resource_format_version = RESOURCE_FORMAT_VERSION_2;
-
- dll_uid = KFMRadioMCPPluginDllUid;
-
- interfaces =
- {
- INTERFACE_INFO
- {
- // Plugin interface
- interface_uid = KMCPPluginUid;
-
- implementations =
- {
- // Plugin implementation
- IMPLEMENTATION_INFO
- {
- implementation_uid = KFMRadioMCPPluginImplementationUid;
- version_no = 1;
- display_name = "";
- default_data = "";
- opaque_data = "";
- rom_only = 0;
- }
- };
- }
- };
- }
--- a/fmradio/fmradiomcpplugin/resources/fmradiomcpplugin.hrh Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions for the FM Radio Content Publisher plugin.
-*
-*/
-
-#ifndef FMRADIOMCPPLUGIN_HRH
-#define FMRADIOMCPPLUGIN_HRH
-
-// Ecom DLL UID for FM Radio Music Content Publisher Plugin.
-#define KFMRadioMCPPluginDllUid 0x2001F497
-
-// Ecom implementation UID for FM Radio Music Content Publisher Plugin.
-#define KFMRadioMCPPluginImplementationUid 0x2001FCB7
-
-#endif /* FMRADIOMCPPLUGIN_HRH */
--- a/fmradio/fmradiomcpplugin/resources/fmradiomcpplugin.rss Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Resource definitions for FM Radio Content Publisher Plugin.
-*
-*/
-
-NAME FMCP
-
-#include <uikon.rh>
-#include <fmradio.loc>
-
-// ---------------------------------------------------------------------------
-// The signature of the resource file.
-// ---------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE
- {
- }
-
-// ---------------------------------------------------------------------------
-// The default document name of the application.
-// ---------------------------------------------------------------------------
-//
-RESOURCE TBUF
- {
- buf = "";
- }
-
-RESOURCE TBUF r_qtn_fmradio_widget_con_headset { buf = qtn_fmradio_widget_con_headset; }
-RESOURCE TBUF r_qtn_fmradio_widget_tuning { buf = qtn_fmradio_widget_tuning; }
-RESOURCE TBUF r_qtn_fmradio_widget_station_saved { buf = qtn_fmradio_widget_station_saved; }
-RESOURCE TBUF r_qtn_fmradio_widget_station_saved_freq { buf = qtn_fmradio_widget_station_saved_freq; }
-RESOURCE TBUF r_qtn_fmradio_widget_notsaved_frequency { buf = qtn_fmradio_widget_notsaved_frequency; }
-RESOURCE TBUF r_qtn_fmradio_suite_last_played { buf = qtn_fmradio_suite_last_played; }
-RESOURCE TBUF r_qtn_fmradio_suite_now_playing { buf = qtn_fmradio_suite_now_playing; }
-RESOURCE TBUF r_qtn_fmradio_suite_playing_saved_with_name { buf = qtn_fmradio_suite_playing_saved_with_name; }
-RESOURCE TBUF r_qtn_fmradio_suite_playing_saved_without_name { buf = qtn_fmradio_suite_playing_saved_without_name; }
-RESOURCE TBUF r_qtn_fmradio_suite_playing_not_saved { buf = qtn_fmradio_suite_playing_not_saved; }
--- a/fmradio/fmradiomcpplugin/src/fmradiomcpplugin.cpp Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,862 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation for the FM Radio Content Publisher Plugin.
-*
-*/
-
-#include <AknUtils.h>
-#include <bautils.h>
-#include <coemain.h>
-#include <data_caging_path_literals.hrh>
-#include <data_caging_paths_strings.hrh>
-#include <e32cmn.h>
-#include <ecom/implementationproxy.h>
-#include <liwvariant.h>
-#include <StringLoader.h>
-#include <aknsconstants.hrh>
-#include <AknsItemID.h>
-#include <fmradiomcpplugin.rsg>
-#include <fmradio.mbg>
-
-#include "fmradioactionhandler.h"
-#include "fmradioactionhandler.hrh"
-#include "fmradioactionhandlerdefs.h"
-#include "fmradioactiveidleengine.h"
-#include "fmradioactiveidleenginenotifyhandler.h"
-#include "fmradiodefines.h"
-#include "debug.h"
-#include "fmradiomcpplugin.h"
-#include "fmradiomcpplugin.hrh"
-#include "AknsConstants.h"
-
-_LIT( KFMRadioMifFileName, "fmradio.mif" );
-_LIT( KFMRadioMifDir, "\\resource\\apps\\" );
-
-_LIT( KFMRadioMCPPluginResourceFileName, "fmradiomcpplugin.rsc" );
-_LIT8( KFMRadioPluginUid, "plugin_id" );
-_LIT8( KFMRadioData, "data" );
-_LIT8( KType, "type" );
-
-const TUint KFMRadioPrevious = 0x001; //000000000001
-const TUint KFMRadioNext = 0x002; //000000000010
-const TUint KFMRadioMute = 0x004; //000000000100
-const TUint KFMRadioUnmute = 0x008; //000000001000
-const TUint KFMRadioPreviousDimmed = 0x010; //000000010000
-const TUint KFMRadioNextDimmed = 0x020; //000000100000
-const TUint KFMRadioMuteDimmed = 0x040; //000001000000
-const TUint KFMRadioUnmuteDimmed = 0x080; //000010000000
-
-CFMRadioMCPPlugin* CFMRadioMCPPlugin::NewL( MMCPPluginObserver* aObserver )
- {
- CFMRadioMCPPlugin* self = new ( ELeave ) CFMRadioMCPPlugin( aObserver );
- CleanupStack::PushL( self );
-
- self->ConstructL();
-
- CleanupStack::Pop( self );
- return self;
- }
-
-CFMRadioMCPPlugin::~CFMRadioMCPPlugin()
- {
- if ( iResourceOffset > 0 )
- {
- CCoeEnv::Static()->DeleteResourceFile( iResourceOffset );
- }
-
- delete iEngine;
- iNowPlayingText.Close();
- iLastPlayedText.Close();
- iAntennaNotConnectedText.Close();
- iTuningText.Close();
- iSavedStationFormat.Close();
- iSavedStationFormatNoName.Close();
- iFrequencyFormat.Close();
- iSavedStationFormatMenu.Close();
- iSavedStationFormatNoNameMenu.Close();
- iFrequencyFormatMenu.Close();
-
- iMifFileName.Close();
- }
-
-CFMRadioMCPPlugin::CFMRadioMCPPlugin( MMCPPluginObserver* aObserver )
- : iObserver( aObserver )
- {
- }
-
-void CFMRadioMCPPlugin::ConstructL()
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::ConstructL" )));
- InitializeResourceLoadingL();
-
- CCoeEnv* coeEnv = CCoeEnv::Static();
-
- iNowPlayingText.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_NOW_PLAYING, coeEnv ) );
- iLastPlayedText.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_LAST_PLAYED, coeEnv ) );
-
- iAntennaNotConnectedText.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_CON_HEADSET, coeEnv ) );
- iTuningText.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_TUNING, coeEnv ) );
- iSavedStationFormat.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_STATION_SAVED, coeEnv ) );
- iSavedStationFormatNoName.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_STATION_SAVED_FREQ, coeEnv ) );
- iFrequencyFormat.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_NOTSAVED_FREQUENCY, coeEnv ) );
-
- iSavedStationFormatMenu.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_PLAYING_SAVED_WITH_NAME, coeEnv ) );
- iSavedStationFormatNoNameMenu.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_PLAYING_SAVED_WITHOUT_NAME, coeEnv ) );
- iFrequencyFormatMenu.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_PLAYING_NOT_SAVED, coeEnv ) );
-
- // Release the resource file, because we don't want to keep file handle open.
- // That would prevent updating the binary with SIS.
- if ( iResourceOffset > 0 )
- {
- coeEnv->DeleteResourceFile( iResourceOffset );
- iResourceOffset = 0;
- }
-
- TFindFile finder( coeEnv->FsSession() );
- TInt err = finder.FindByDir( KFMRadioMifFileName, KFMRadioMifDir );
- if ( err == KErrNone )
- {
- iMifFileName.CreateL( finder.File() );
- }
-
- iEngine = CFMRadioActiveIdleEngine::NewL( *this );
- iEngine->ActivateL();
-
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::ConstructL - Exiting." )));
- }
-
-// ---------------------------------------------------------------------------
-// Initialize resource file for loading resources.
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMCPPlugin::InitializeResourceLoadingL()
- {
- CCoeEnv* coeEnv = CCoeEnv::Static();
- RFs fs( coeEnv->FsSession() );
- TFileName fileName;
- TFileName baseResource;
- TFindFile finder( fs );
- TLanguage language( ELangNone );
-
- TParsePtrC parse( KFMRadioMCPPluginResourceFileName );
- _LIT( resourceFileWildExt, ".r*" );
-
- // Make sure to find all resource files, not only .rsc files as it may be so
- // that there is only .r01, .r02, etc. files available
- fileName.Copy( parse.Name() );
- fileName.Append( resourceFileWildExt );
-
- // TFindFile applies search order that is from
- // drive Y to A, then Z
- CDir* entries = NULL;
- TInt err = finder.FindWildByDir( fileName , KDC_RESOURCE_FILES_DIR, entries );
- delete entries;
- entries = NULL;
- TBool found = EFalse;
- while ( !found && err == KErrNone )
- {
- // Found file
- fileName.Zero();
- TParsePtrC foundPath( finder.File() );
- fileName.Copy( foundPath.DriveAndPath() );
- fileName.Append( KFMRadioMCPPluginResourceFileName );
- BaflUtils::NearestLanguageFile( fs, fileName, language );
- if ( language != ELangNone && BaflUtils::FileExists( fs, fileName ) )
- {
- found = ETrue;
- iResourceOffset = coeEnv->AddResourceFileL( fileName );
- }
- else
- {
- if ( language == ELangNone &&
- !baseResource.Compare( KNullDesC ) &&
- BaflUtils::FileExists( fs, fileName ) )
- {
- baseResource.Copy( fileName );
- }
- err = finder.FindWild( entries );
- delete entries;
- entries = NULL;
- }
- }
-
- if ( !found && baseResource.Compare( KNullDesC ) )
- {
- // If we found *.rsc then better to use that than nothing
- if ( BaflUtils::FileExists( fs, baseResource ) )
- {
- iResourceOffset = coeEnv->AddResourceFileL( baseResource );
- found = ETrue;
- }
- }
-
- if( !found )
- {
- User::Leave( KErrNotFound );
- }
- }
-
-void CFMRadioMCPPlugin::Deactivate()
- {
- iActive = EFalse;
- }
-
-void CFMRadioMCPPlugin::ActivateL()
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::ActivateL()" )));
- iActive = ETrue;
- iObserver->BecameActiveL( this );
-
- iObserver->PublishTextL( this, EMusicWidgetDefaultText, KNullDesC );
-
- iObserver->PublishImageL( this, EMusicMenuMusicInfoImage1,
- KAknsIIDQgnIndiRadioDefault,
- iMifFileName,
- EMbmFmradioQgn_indi_radio_default,
- EMbmFmradioQgn_indi_radio_default_mask);
-
- iObserver->PublishImageL( this, EMusicWidgetImage1,
- KAknsIIDQgnIndiRadioDefault,
- iMifFileName,
- EMbmFmradioQgn_indi_radio_default,
- EMbmFmradioQgn_indi_radio_default_mask);
-
- InstallFMRadioCommandActionL( KFMRadioCommandValueStartNowPlaying, EMusicWidgetTrigger1 );
- InstallFMRadioCommandActionL( KFMRadioCommandValueStartNowPlaying, EMusicMenuMusicInfoTrigger );
- HandleChannelChangeL( iEngine->Channel() );
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMCPPlugin::UpdatePublishedToolBarL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMCPPlugin::UpdatePublishedToolBarL( TUint aToolBarState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - Entering." )));
- if ( iActive )
- {
- TAknsItemID iconId;
- if ( KFMRadioPrevious & aToolBarState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 1 Enter" )));
- iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnPropImageTbPrev );
- iObserver->PublishImageL( this,
- EMusicWidgetToolbarB1,
- iconId,
- iMifFileName,
- EMbmFmradioQgn_prop_image_tb_prev,
- EMbmFmradioQgn_prop_image_tb_prev_mask );
- InstallFMRadioCommandActionL( KFMRadioCommandValueStepPrevious, EMusicWidgetTB1Trigger );
- iTbPreviousState = KFMRadioPrevious;
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 1 Exit" )));
- }
-
- if ( KFMRadioPreviousDimmed & aToolBarState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 2 Enter" )));
- iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnPropImageTbPrevDimmed );
- iObserver->PublishImageL( this,
- EMusicWidgetToolbarB1,
- iconId,
- iMifFileName,
- EMbmFmradioQgn_prop_image_tb_prev_dimmed,
- EMbmFmradioQgn_prop_image_tb_prev_dimmed_mask );
- InstallEmptyActionL( EMusicWidgetTB1Trigger );
- iTbPreviousState = KFMRadioPreviousDimmed;
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 2 Exit" )));
- }
-
- if ( KFMRadioNext & aToolBarState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 3 Enter" )));
- iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnPropImageTbNext );
- iObserver->PublishImageL( this,
- EMusicWidgetToolbarB3,
- iconId,
- iMifFileName,
- EMbmFmradioQgn_prop_image_tb_next,
- EMbmFmradioQgn_prop_image_tb_next_mask );
- InstallFMRadioCommandActionL( KFMRadioCommandValueStepNext, EMusicWidgetTB3Trigger );
- iTbNextState = KFMRadioNext;
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 3 Exit" )));
- }
-
- if ( KFMRadioNextDimmed & aToolBarState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 4 Enter" )));
- iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnPropImageTbNextDimmed );
- iObserver->PublishImageL( this,
- EMusicWidgetToolbarB3,
- iconId,
- iMifFileName,
- EMbmFmradioQgn_prop_image_tb_next_dimmed,
- EMbmFmradioQgn_prop_image_tb_next_dimmed_mask );
- InstallEmptyActionL( EMusicWidgetTB3Trigger );
- iTbNextState = KFMRadioNextDimmed;
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 4 Exit" )));
- }
-
- if ( KFMRadioMute & aToolBarState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 5 Enter" )));
- iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnIndiMusicWidgetTbRadioSound );
- iObserver->PublishImageL( this,
- EMusicWidgetToolbarB2,
- iconId,
- iMifFileName,
- EMbmFmradioQgn_indi_music_widget_tb_radio_sound,
- EMbmFmradioQgn_indi_music_widget_tb_radio_sound_mask );
- InstallFMRadioCommandActionL( KFMRadioCommandValueUnmute, EMusicWidgetTB2Trigger );
- iTbMuteUnmuteState = KFMRadioMute;
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 5 Exit" )));
- }
-
- if ( KFMRadioUnmute & aToolBarState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 6 Enter" )));
- iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnIndiMusicWidgetTbRadioSoundMuted );
- iObserver->PublishImageL( this,
- EMusicWidgetToolbarB2,
- iconId,
- iMifFileName,
- EMbmFmradioQgn_indi_music_widget_tb_radio_sound_muted,
- EMbmFmradioQgn_indi_music_widget_tb_radio_sound_muted_mask );
- InstallFMRadioCommandActionL( KFMRadioCommandValueMute, EMusicWidgetTB2Trigger );
- iTbMuteUnmuteState = KFMRadioUnmute;
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 6 Exit" )));
- }
-
- if ( KFMRadioMuteDimmed & aToolBarState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 7 Enter" )));
- iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnIndiMusicWidgetTbRadioSoundDimmed );
- iObserver->PublishImageL( this,
- EMusicWidgetToolbarB2,
- iconId,
- iMifFileName,
- EMbmFmradioQgn_indi_music_widget_tb_radio_sound_dimmed,
- EMbmFmradioQgn_indi_music_widget_tb_radio_sound_dimmed_mask );
- InstallEmptyActionL( EMusicWidgetTB2Trigger );
- iTbMuteUnmuteState = KFMRadioMuteDimmed;
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 7 Exit" )));
- }
-
- if ( KFMRadioUnmuteDimmed & aToolBarState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 8 Enter" )));
- iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnIndiMusicWidgetTbRadioSoundMutedDimmed );
- iObserver->PublishImageL( this,
- EMusicWidgetToolbarB2,
- iconId,
- iMifFileName,
- EMbmFmradioQgn_indi_music_widget_tb_radio_sound_muted_dimmed,
- EMbmFmradioQgn_indi_music_widget_tb_radio_sound_muted_dimmed_mask );
- InstallEmptyActionL( EMusicWidgetTB2Trigger );
- iTbMuteUnmuteState = KFMRadioUnmuteDimmed;
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 8 Exit" )));
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMCPPlugin::UpdateToolBarL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMCPPlugin::UpdateToolBarL( TBool aForceApplicationClosing )
- {
- if ( iActive )
- {
- TUint muteDimmedState = iEngine->MuteState() == EFMRadioPSMuteStateOn ?
- KFMRadioUnmuteDimmed : KFMRadioMuteDimmed;
- // Update Next and Previous buttons.
- if ( iEngine->AntennaStatus() == EFMRadioPSHeadsetDisconnected )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 1" )));
- UpdatePublishedToolBarL( KFMRadioPreviousDimmed | muteDimmedState | KFMRadioNextDimmed);
- return;
- }
- else if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning || aForceApplicationClosing )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 2" )));
- UpdatePublishedToolBarL( KFMRadioPreviousDimmed | muteDimmedState | KFMRadioNextDimmed);
- return;
- }
- else if ( iEngine->PowerState() != EFMRadioPSRadioPowerOn )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 3" )));
- UpdatePublishedToolBarL( KFMRadioPreviousDimmed | muteDimmedState | KFMRadioNextDimmed);
- return;
- }
- else if ( iEngine->TuningState() != EFMRadioPSTuningUninitialized )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 4" )));
- UpdatePublishedToolBarL( KFMRadioPreviousDimmed | KFMRadioNextDimmed );
- }
- else if ( iPresetCount > 1 || ( iPresetCount == 1 && iEngine->Channel() == KErrNotFound ) )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 5" )));
- UpdatePublishedToolBarL( KFMRadioPrevious | KFMRadioNext );
- }
- else
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 6" )));
- UpdatePublishedToolBarL( KFMRadioPreviousDimmed | KFMRadioNextDimmed );
- }
-
- // Update Mute/Unmute button
- if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning || aForceApplicationClosing )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 7" )));
- UpdatePublishedToolBarL( muteDimmedState );
- }
- else if ( iEngine->TuningState() != EFMRadioPSTuningUninitialized )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 8" )));
- UpdatePublishedToolBarL( muteDimmedState );
- }
- else
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 9" )));
- HandleMuteStateChangeL( iEngine->MuteState() );
- }
- }
- }
-// ---------------------------------------------------------------------------
-// CFMRadioMCPPlugin::UpdateMusicWidgetTextL
-// ---------------------------------------------------------------------------
-//
-void CFMRadioMCPPlugin::UpdateMusicWidgetTextL( TBool aForceApplicationClosing )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL" )));
- if ( iActive )
- {
- TInt rightToLeftCharWidth = AknLayoutUtils::LayoutMirrored() ? sizeof(TText16) : 0;
-
- // Homescreen publishing
- if ( iEngine->AntennaStatus() == EFMRadioPSHeadsetDisconnected && !aForceApplicationClosing )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing HS antenna not connected: \"%S\""), &iAntennaNotConnectedText ));
- iObserver->PublishTextL( this, EMusicWidgetText1, iAntennaNotConnectedText );
- }
- else if ( iEngine->TuningState() != EFMRadioPSTuningUninitialized && !aForceApplicationClosing )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing HS tuning: \"%S\""), &iTuningText ));
- iObserver->PublishTextL( this, EMusicWidgetText1, iTuningText );
- }
- else if ( iPresetCount && iEngine->Channel() != KErrNotFound )
- {
- if( iEngine->ChannelName().Length() )
- {
- // Station saved and name is available
- RBuf name;
- // For widget
- // Preserve space for the channel name, format string and maximum index number
- name.CreateL( iEngine->ChannelName().Length() +
- iSavedStationFormat.Length() +
- KDefaultRealWidth +
- rightToLeftCharWidth );
- name.CleanupClosePushL();
- StringLoader::Format( name, iSavedStationFormat, KErrNotFound, iEngine->Channel() + 1 );
-
- HBufC* tempName = name.AllocL();
- StringLoader::Format( name, *tempName, KErrNotFound, iEngine->ChannelName() );
- delete tempName;
- tempName = NULL;
-
- if ( rightToLeftCharWidth )
- {
- //E.g. 1. Name -> Name .1
- name.Insert( 0, KRightToLeftMark );
- }
-
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Widget saved station: \"%S\""), &name ));
- iObserver->PublishTextL( this, EMusicWidgetText1, name );
- CleanupStack::PopAndDestroy(); // name
-
- // For Music Suite
- // Preserve space for the channel name, format string and maximum index number
- name.CreateL( iEngine->ChannelName().Length() +
- iSavedStationFormatMenu.Length() +
- KDefaultRealWidth +
- rightToLeftCharWidth );
- name.CleanupClosePushL();
- StringLoader::Format( name, iSavedStationFormatMenu, KErrNotFound, iEngine->Channel() + 1 );
-
- tempName = name.AllocL();
- StringLoader::Format( name, *tempName, KErrNotFound, iEngine->ChannelName() );
- delete tempName;
- tempName = NULL;
-
- if ( rightToLeftCharWidth )
- {
- //E.g. 1. Name -> Name .1
- name.Insert( 0, KRightToLeftMark );
- }
-
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Suite saved station: \"%S\""), &name ));
- iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, name );
- CleanupStack::PopAndDestroy(); // name
- }
- else
- {
- // Station saved, but name for it is not available
- HBufC* frequencyString = FrequencyStringLC( iEngine->Frequency() );
- RBuf formattedFrequency;
-
- // For widget
- formattedFrequency.CreateL( iSavedStationFormatNoName.Length() +
- frequencyString->Length() +
- KDefaultRealWidth +
- rightToLeftCharWidth );
- formattedFrequency.CleanupClosePushL();
- StringLoader::Format( formattedFrequency, iSavedStationFormatNoName, KErrNotFound, iEngine->Channel() + 1 );
-
- HBufC* tempFrequency = formattedFrequency.AllocL();
- StringLoader::Format( formattedFrequency, *tempFrequency, KErrNotFound, *frequencyString );
- delete tempFrequency;
- tempFrequency = NULL;
- AknTextUtils::LanguageSpecificNumberConversion( formattedFrequency );
-
- if ( rightToLeftCharWidth )
- {
- //E.g. 1. Name -> Name .1
- formattedFrequency.Insert( 0, KRightToLeftMark );
- }
-
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Widget saved station with frequency: \"%S\""), &formattedFrequency ));
- iObserver->PublishTextL( this, EMusicWidgetText1, formattedFrequency );
- CleanupStack::PopAndDestroy(); // formattedFrequency
-
- // For Music Suite
- formattedFrequency.CreateL( iSavedStationFormatNoNameMenu.Length() +
- frequencyString->Length() +
- KDefaultRealWidth +
- rightToLeftCharWidth );
- formattedFrequency.CleanupClosePushL();
- StringLoader::Format( formattedFrequency, iSavedStationFormatNoNameMenu, KErrNotFound, iEngine->Channel() + 1 );
-
- tempFrequency = formattedFrequency.AllocL();
- StringLoader::Format( formattedFrequency, *tempFrequency, KErrNotFound, *frequencyString );
- delete tempFrequency;
- tempFrequency = NULL;
-
- AknTextUtils::LanguageSpecificNumberConversion( formattedFrequency );
- if ( rightToLeftCharWidth )
- {
- //E.g. 1. Name -> Name .1
- formattedFrequency.Insert( 0, KRightToLeftMark );
- }
-
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Suite saved station with frequency: \"%S\""), &formattedFrequency ));
- iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, formattedFrequency );
- CleanupStack::PopAndDestroy( 2, frequencyString ); // formattedFrequency, frequencyString
- }
- }
- else if ( iEngine->RDSProgramService().Length() > 0 )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing HS PS name: \"%S\""), &iEngine->RDSProgramService() ));
- iObserver->PublishTextL( this, EMusicWidgetText1, iEngine->RDSProgramService() );
- iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, iEngine->RDSProgramService() );
- }
- else
- {
- TInt currentFrequency = iEngine->Frequency();
- // publish only valid frequency
- if ( currentFrequency > 0 )
- {
- HBufC* frequencyString = FrequencyStringLC( currentFrequency );
-
- RBuf formattedFrequency;
- // For widget
- // Preserve space for the format string and maximum index number
- formattedFrequency.CreateL( iFrequencyFormat.Length() +
- frequencyString->Length() +
- rightToLeftCharWidth );
- formattedFrequency.CleanupClosePushL();
- StringLoader::Format( formattedFrequency, iFrequencyFormat, KErrNotFound, *frequencyString );
- AknTextUtils::LanguageSpecificNumberConversion( formattedFrequency );
-
- if ( rightToLeftCharWidth )
- {
- //E.g. 1. Name -> Name .1
- formattedFrequency.Insert( 0, KRightToLeftMark );
- }
-
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Widget frequency: \"%S\""), &formattedFrequency ));
- iObserver->PublishTextL( this, EMusicWidgetText1, formattedFrequency );
- CleanupStack::PopAndDestroy(); // formattedFrequency
-
- // For Music Suite
- // Preserve space for the format string and maximum index number
- formattedFrequency.CreateL( iFrequencyFormatMenu.Length() +
- frequencyString->Length() +
- rightToLeftCharWidth );
- formattedFrequency.CleanupClosePushL();
- StringLoader::Format( formattedFrequency, iFrequencyFormatMenu, KErrNotFound, *frequencyString );
- AknTextUtils::LanguageSpecificNumberConversion( formattedFrequency );
-
- if ( rightToLeftCharWidth )
- {
- //E.g. 1. Name -> Name .1
- formattedFrequency.Insert( 0, KRightToLeftMark );
- }
-
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Suite frequency: \"%S\""), &formattedFrequency ));
- iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, formattedFrequency );
- CleanupStack::PopAndDestroy( 2, frequencyString ); // formattedFrequency, frequencyString
- }
- else
- {
- // Publish empty text instead of 0.00 MHz
- iObserver->PublishTextL( this, EMusicWidgetText1, KNullDesC );
- iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, KNullDesC );
- }
- }
- if( iEngine->PowerState() == EFMRadioPSRadioPowerOn && !aForceApplicationClosing )
- {
- iObserver->PublishTextL( this, EMusicMenuMusicInfoLine1, iNowPlayingText );
- }
- else
- {
- iObserver->PublishTextL( this, EMusicMenuMusicInfoLine1, iLastPlayedText );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFMRadioMCPPlugin::FrequencyStringLC
-// ---------------------------------------------------------------------------
-//
-HBufC* CFMRadioMCPPlugin::FrequencyStringLC( TInt aFrequency )
- {
- TReal frequency = static_cast<TReal>( aFrequency / static_cast<TReal>( KHzConversionFactor ));
- TRealFormat format( KFrequencyMaxLength, iEngine->FrequencyDecimalCount() );
- TBuf<KDefaultRealWidth> frequencyString;
- frequencyString.Num( frequency, format );
-
- return frequencyString.AllocLC();
- }
-
-void CFMRadioMCPPlugin::HandleRadioVolumeChangeL( TInt /* aVolume */ )
- {
- }
-
-void CFMRadioMCPPlugin::HandleTuningStateChangeL( TFMRadioPSTuningState FDEBUGVAR( aTuningState ) )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleTuningStateChangeL: aTuningState=[%d]"), aTuningState));
-
- if ( iActive )
- {
- UpdateMusicWidgetTextL();
- UpdateToolBarL();
- }
-
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleTuningStateChangeL - Exiting." )));
- }
-
-void CFMRadioMCPPlugin::HandleFrequencyChangeL( TInt FDEBUGVAR( aFrequency ) )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleFrequencyChangeL: aFrequency=%d"), aFrequency));
- }
-
-void CFMRadioMCPPlugin::HandleChannelChangeL( TInt FDEBUGVAR( aId ) )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelChangeL: aId=[%d]"), aId ));
- if ( iActive )
- {
- UpdateMusicWidgetTextL();
- UpdateToolBarL();
- }
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelChangeL - Exiting." )));
- }
-
-void CFMRadioMCPPlugin::HandleChannelModifyL( TInt aId )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelModifyL: aId=[%d]"), aId ));
- if ( iActive && aId == iEngine->Channel() )
- {
- UpdateMusicWidgetTextL();
- }
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelModifyL - Exiting." )));
- }
-
-void CFMRadioMCPPlugin::HandleMuteStateChangeL( TFMRadioPSRadioMuteState aMuteState )
- {
- if ( iActive )
- {
- switch( aMuteState )
- {
- case EFMRadioPSMuteStateOn:
- if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning )
- {
- UpdatePublishedToolBarL( KFMRadioUnmuteDimmed );
- }
- else
- {
- UpdatePublishedToolBarL( KFMRadioUnmute );
- }
- break;
- case EFMRadioPSMuteStateOff:
- case EFMRadioPSMuteStateUninitialized:
- if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning )
- {
- UpdatePublishedToolBarL( KFMRadioMuteDimmed );
- }
- else
- {
- UpdatePublishedToolBarL( KFMRadioMute );
- }
- break;
- default:break;
- }
- }
- }
-
-void CFMRadioMCPPlugin::HandleApplicationRunningStateChangeL( TFMRadioPSApplicationRunningState aRunningState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleApplicationRunningStateChangeL - aRunningState=%d"), aRunningState ));
-
- switch ( aRunningState )
- {
- case EFMRadioPSApplicationRunning:
- break;
- case EFMRadioPSApplicationClosing:
- UpdateMusicWidgetTextL( ETrue );
- UpdateToolBarL( ETrue );
- Deactivate();
- break;
- default:
- break;
- }
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleApplicationRunningStateChangeL - Exiting." )));
- }
-
-void CFMRadioMCPPlugin::HandleFrequencyDecimalCountChangeL( TFMRadioPSFrequencyDecimalCount /* aDecimalCount */ )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleFrequencyDecimalCountChangeL." )));
- if ( iActive )
- {
- UpdateMusicWidgetTextL();
- }
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleFrequencyDecimalCountChangeL - Exiting." )));
- }
-
-void CFMRadioMCPPlugin::HandleAntennaStatusChangeL( TFMRadioPSHeadsetStatus /*aAntennaStatus*/ )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleAntennaStatusChangeL - Enter")));
- if ( iActive )
- {
- UpdateMusicWidgetTextL();
- UpdateToolBarL();
- }
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleAntennaStatusChangeL - Exiting.")));
- }
-
-void CFMRadioMCPPlugin::HandlePresetListCountChangeL( TInt aPresetCount )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePresetListCountChangeL(%d) - Enter"), aPresetCount));
- iPresetCount = aPresetCount;
- if ( iActive )
- {
- if( !aPresetCount )
- {
- UpdateMusicWidgetTextL();
- }
- UpdateToolBarL();
- }
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePresetListCountChangeL - Exiting.")));
- }
-
-void CFMRadioMCPPlugin::HandlePresetListFocusChangeL( TInt FDEBUGVAR( aPresetFocus ) )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePresetListFocusChangeL - %d"), aPresetFocus ));
- }
-
-void CFMRadioMCPPlugin::HandleRDSProgramServiceChangeL( const TDesC& /*aProgramService*/ )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleRDSProgramServiceChangeL." )));
- if ( iActive )
- {
- UpdateMusicWidgetTextL();
- }
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleRDSProgramServiceChangeL - Exiting." )));
- }
-
-void CFMRadioMCPPlugin::HandleRDSRadioTextChangeL( const TDesC& /*aRdsText*/ )
- {
- }
-
-void CFMRadioMCPPlugin::HandleChannelNameChangeL( const TDesC& /*aName*/ )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelNameChangeL." )));
- }
-
-void CFMRadioMCPPlugin::HandlePowerStateChangeL( TFMRadioPSRadioPowerState aPowerState )
- {
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePowerStateChangeL(%d)."), aPowerState ));
- if( aPowerState == EFMRadioPSRadioPowerOn )
- {
- ActivateL();
- }
- if ( iActive )
- {
- UpdateMusicWidgetTextL();
- UpdateToolBarL();
- }
- FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePowerStateChangeL - Exiting." )));
- }
-
-void CFMRadioMCPPlugin::InstallEmptyActionL( TMCPTriggerDestination aDestination )
- {
- CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
- iObserver->PublishActionL( this, aDestination, mapTrigger );
- CleanupStack::PopAndDestroy( mapTrigger );
- }
-
-void CFMRadioMCPPlugin::InstallFMRadioCommandActionL( const TDesC& aCommand, TMCPTriggerDestination aDestination )
- {
- CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
- CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
-
- mapTrigger->InsertL( KFMRadioPluginUid, TLiwVariant( TUid::Uid( KFMRadioActionHandlerImplementationUid ) ) );
- mapData->InsertL( KType, TLiwVariant( aCommand ) );
- mapData->InsertL( KFMRadioCommand , TLiwVariant( aCommand ) );
- mapTrigger->InsertL( KFMRadioData, TLiwVariant( mapData ) );
-
- if ( iActive )
- {
- iObserver->PublishActionL( this, aDestination, mapTrigger );
- }
-
- CleanupStack::PopAndDestroy( mapData );
- CleanupStack::PopAndDestroy( mapTrigger );
- }
-
-/** Provides a key-value pair table, that is used to identify the correct construction function for the requested interface. */
-const TImplementationProxy KFMRadioMCPPluginImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( KFMRadioMCPPluginImplementationUid, CFMRadioMCPPlugin::NewL )
- };
-
-const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount );
-
-// ---------------------------------------------------------------------------
-// Returns the implementations provided by this ECOM plugin DLL.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
- {
- aTableCount = sizeof( KFMRadioMCPPluginImplementationTable ) / sizeof( TImplementationProxy );
- return KFMRadioMCPPluginImplementationTable;
- }
--- a/fmradio/group/bld.inf Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This file provides the information required for building the
-* whole of a FMRadio.
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-// export central repository configuration files
-../conf/fmradio.confml CONFML_EXPORT_PATH(fmradio.confml, customsw)
-../conf/fmradio_2001b25e.crml CRML_EXPORT_PATH(fmradio_2001b25e.crml, customsw)
-
-// export localization source loc file
-../loc/fmradio.loc APP_LAYER_LOC_EXPORT_PATH(fmradio.loc)
-
-PRJ_MMPFILES
-#include "../activeidleengine/group/bld.inf"
-#include "../fmradioengine/group/bld.inf"
-#include "../fmradioactionhandler/group/bld.inf"
-#include "../fmradiomcpplugin/group/bld.inf"
-#include "../fmradio/group/bld.inf"
-// Help exports
-#include "../help/group/bld.inf"
-// End of File
-
Binary file fmradio/help/data/xhtml.zip has changed
--- a/fmradio/help/group/bld.inf Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - Initial contribution
-*
-* Contributors:
-*
-*
-* Description:
-* Export help related files.
-*
-*/
-
-#include <platform_paths.hrh>
-PRJ_EXPORTS
-:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite
-:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite
-
-../inc/radio.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/radio.hlp.hrh)
-../rom/fmradiohelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(fmradiohelps_variant.iby)
--- a/fmradio/help/inc/radio.hlp.hrh Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-//
-// radio.hlp.hrh generated by CSXHelp Utilities.
-//
-
-#ifndef __RADIO_HLP_HRH__
-#define __RADIO_HLP_HRH__
-
-_LIT(KFMRADIO_HLP_MAIN, "FMRADIO_HLP_MAIN"); //
-_LIT(KFMRADIO_HLP_SEARCH, "FMRADIO_HLP_SEARCH"); //
-_LIT(KFMRADIO_HLP_LIST, "FMRADIO_HLP_LIST"); //
-
-#endif
\ No newline at end of file
--- a/fmradio/help/rom/fmradiohelps_variant.iby Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Help contents for image building
-*
-*/
-
-#ifndef __FMRADIOHELPS_VARIANT_IBY__
-#define __FMRADIOHELPS_VARIANT_IBY__
-
-#if defined(FF_S60_HELPS_IN_USE) && defined(__S60_FM_RADIO_APPLICATION)
- data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10207A89\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x10207A89\contents.zip)
- data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10207A89\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10207A89\index.xml)
- data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10207A89\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10207A89\keywords.xml)
- data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10207A89\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10207A89\meta.xml)
-#endif
-
-#endif
--- a/fmradio/inc/fmradioactiveidle.hrh Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Active idle definitions
-*
-*/
-
-
-#ifndef FMRADIOACTIVEIDLE_HRH
-#define FMRADIOACTIVEIDLE_HRH
-
-// Ecom DLL UID for FMRadio Active Idle plugin.
-#define AI_UID_ECOM_DLL_CONTENTPUBLISHER_FMRADIOPLUGIN 0x20010140
-
-// Ecom implementation UID for FMRadio Active Idle plugin.
-#define AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_FMRADIOPLUGIN 0x20010141
-
-#endif // FMRADIOACTIVEIDLE_HRH
--- a/fmradio/inc/fmradiovariant.hrh Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Local variation flags for OMA Provisioning
-*
-*/
-
-
-#ifndef FMRADIOVARIANT_HRH
-#define FMRADIOVARIANT_HRH
-
-/**
-* Local variation flags for FM Radio
-*/
-
-// flag to determine whether an internnal antenna is supported
-#define KFMRadioInternalAntennaSupported 0x02
-
-#ifdef ASW_CORE_AUDIO_PLATFORM_VERSION // Nokia specific adaptation.
-
-#define __FMRADIO_ADVANCED_AUTO_RESUME
-
-#endif // ASW_CORE_AUDIO_PLATFORM_VERSION
-
-
-#endif // FMRADIOVARIANT_HRH
-
-// End of File
--- a/fmradio/loc/fmradio.loc Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,673 +0,0 @@
-/*
-* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is a localisation file for FMRadio
-*/
-
-
-// Application titles
-//
-
-// d: Application title from list.
-// l: list_single_large_graphic_pane_t1
-//
-#define qtn_fmradio_app_menu_list "FM Radio"
-
-// d: Application title from grid.
-// l: cell_app_pane_t1
-//
-#define qtn_fmradio_app_menu_grid "FM Radio"
-
-// d: Main view title
-// l: title_pane_t2/opt9
-//
-#define qtn_fmradio_title "FM Radio"
-
-// d: Stations view title
-// l: title_pane_t2/opt9
-//
-#define qtn_fmradio_stations_title "Stations"
-
-// d: Search stations view title
-// l: title_pane_t2/opt9
-//
-#define qtn_fmradio_search_stations_title "Search stations"
-
-// Menu items
-//
-
-// d: Option list item in the Main view.
-// d: Opens Nokia Music Store when it is the only store available.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_music_store "Go to Music Store"
-
-// d: Option list item in the Main view.
-// d: Opens a submenu with Nokia Music Store and other additional stores
-// l: list_single_pane_t1_cp2/opt3
-//
-#define qtn_fmradio_options_music_store_submenu "Go to Music Store"
-
-// d: Option list submenu item in the Main view for Go to Music Store.
-// d: For enabling access to Nokia Music Store when there are
-// d: also other music stores (e.g. operator music store) available.
-// l: list_single_popup_submenu_pane_t1
-//
-#define qtn_fmradio_options_nokia_music_store "Nokia Music Store"
-
-// d: Option list item in the Main view.
-// d: Opens Web address.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_web_address "Go to Web address"
-
-// d: Option list item in the Main view.
-// d: Opens Stations view.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_stations "Stations"
-
-// d: Option list item in Main and Search stations views.
-// d: Saves a single station.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_save "Save"
-
-// d: Option list item in Main and Stations views.
-// d: Renames currently selected station.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_rename "Rename"
-
-// d: General menu string, in all views.
-// d: Activates the IHF-speaker
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_activate "Activate loudspeaker"
-
-// d: General menu string, in all views.
-// d: Deactivate the IHF-speaker.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_deactivate "Deactivate loudspeaker"
-
-// d: Option list item in the Main view for Alternative frequency (AF) setting.
-// d: Opens the submenu for AF setting.
-// l: list_single_pane_t1_cp2/opt3
-//
-#define qtn_fmradio_options_alternative_freq "Alternative frequency"
-
-// d: Option list submenu item in the Main view for Alternative frequency.
-// d: For setting alternative frequency on.
-// l: list_single_popup_submenu_pane_t1/opt1
-//
-#define qtn_fmradio_options_on "On"
-
-// d: Option list submenu item in the Main view for Alternative frequency.
-// d: For setting alternative frequency off.
-// l: list_single_popup_submenu_pane_t1/opt1
-//
-#define qtn_fmradio_options_off "Off"
-
-// d: Option list item in the Stations view.
-// d: Deletes focused station.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_delete "Delete"
-
-// d: Option list item in the Stations view.
-// d: Opens Search stations view.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_search_stations "Search stations"
-
-// d: Option list item in the Stations view.
-// d: Opens dialog for manual tuning.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_tune_manually "Tune manually"
-
-// d: Option list item in the Search stations view.
-// d: Saves all found stations and returns to Stations view.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_options_save_all "Save all"
-
-
-
-// Data queries
-//
-
-// d: Data query heading.
-// d: Query for entering a new name for saved station.
-// l: popup_query_data_window_t3/opt2
-//
-#define qtn_fmradio_query_rename "New name:"
-
-// d: Data query heading
-// d: Query for setting a frequency manually.
-// l: heading_pane_t1
-//
-#define qtn_fmradio_query_frequency "Frequency (MHz):"
-
-
-
-// List queries
-//
-
-// d: List query heading for region selection.
-// d: Opened if no network coverage, when the application is started for the first time.
-// l: heading_pane_t1
-//
-#define qtn_fmradio_popup_head_select_reg "Select region:"
-
-// d: List query item for region selection.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_reg_japan "Japan"
-
-// d: List query item for region selection.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_reg_america "America"
-
-// d: List query item for region selection.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_reg_other "Other"
-
-// d: List query heading for how the user wants the stations to be saved.
-// d: If the station list already contains saved channel(s).
-// l: heading_pane_t1
-//
-#define qtn_fmradio_list_query_save_all "Save all:"
-
-// d: List query item for save all selection.
-// d: Appends the new stations to the end of the list.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_list_query_append "Append to the Stations list"
-
-// d: List query item for save all and station list full -selections.
-// d: Replaces all existing stations with the new ones on the list.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_list_query_replace_all "Replace existing stations"
-
-// d: List query heading for how the user wants the stations to be saved,
-// d: when the stations to be saved do not fit on the stations list.
-// l: heading_pane_t1
-//
-#define qtn_fmradio_list_query_list_full "Station list full:"
-
-// d: List query item for station list full related saving.
-// d: Appends only the new stations that fits to the end of the list.
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_list_query_all_fits "Append all that fits"
-
-
-
-// Confirmation queries
-//
-
-// d: Confirmation query for the Main view.
-// d: Displayed when the user is about to change to Stations view and current frequency is not saved.
-// l: popup_note_window
-//
-#define qtn_fmradio_query_save_current "Current station is not saved. Save now?"
-
-// d: Confirmation query for the Stations view.
-// d: Displayed when the user is about to delete a station from the list.
-// d: %U is the name of the station, max length 20 characters.
-// l: popup_note_window
-//
-#define qtn_fmradio_query_delete "Delete %U?"
-
-// d: Confirmation query
-// d: Displayed when the user is about to delete a station from the list.
-// d: %U is the frequency of the saved station. max length 6 characters.
-// l: popup_note_window
-//
-#define qtn_fmradio_query_delete_mhz "Delete %U MHz?"
-
-// d: Confirmation query
-// d: Displayed when radio is started in off-line mode.
-// l: popup_note_window
-//
-#define qtn_fmradio_query_offline_activate "Activate Radio in off-line mode?"
-
-// d: Confirmation query
-// d: Displayed if the off-line mode is activated while the Radio is on.
-// l: popup_note_window
-//
-#define qtn_fmradio_query_offline_use "Continue using the Radio in off-line mode?"
-
-// d: Confirmation query
-// d: Displayed when the RT+ feature is enabled for the first time.
-// l: popup_note_window
-//
-#define qtn_fmradio_query_rtplus_enabled "’+’ mark got enabled. When this happens, additional services like Music Store are available in the Options menu."
-
-// d: Confirmation query
-// d: Shown if the 3.5mm analog audio accessory required as antenna is not connected
-// l: popup_note_window
-//
-#define qtn_fmradio_error_con_headset "Connect wired headset with 3.5mm connector"
-
-// d: Confirmation query
-// d: Replaces all existing stations with the new ones on the list.
-// l: popup_note_window
-//
-#define qtn_fmradio_query_replace_all "Replace existing stations?"
-
-// Information notes
-//
-
-// d: Information note for a start-up wizard.
-// d: No stations found with the First time usage wizard.
-// l: popup_note_window
-//
-#define qtn_fmradio_no_stations_found "No stations found"
-
-// d: Information note for radio roaming.
-// d: Displayed after the frquency band has been set.
-// l: popup_note_window
-//
-#define qtn_fmradio_conf_freq_band_set_autom "Local frequency band automatically set for radio"
-
-// d: Information note for radio roaming.
-// d: Displayed after the user has selected the region.
-// l: popup_note_window
-//
-#define qtn_fmradio_conf_freq_band_set_manual "Frequency band set for radio according to region."
-
-// d: Information note for the Search stations view.
-// d: Displayed when Save all is selected from Search stations view.
-// d: %N is the amount of saved stations, max value 100.
-// l: popup_note_window
-//
-#define qtn_fmradio_saving_done "%N stations saved to the Stations list."
-
-// d: Information note for the Search stations view.
-// d: Displayed when one station with a name is saved in Search stations view.
-// d: %U is the name of the saved station, max length 20 characters.
-// l: popup_note_window
-//
-#define qtn_fmradio_saving_done_one "%U saved to the Stations list."
-
-// d: Information note for the Search stations view.
-// d: Displayed when one station without a name is saved in Search stations view.
-// d: %U is the frequency of the saved station, max length 6 characters.
-// l: popup_note_window
-//
-#define qtn_fmradio_saving_done_one_no_name "'%U MHz' saved to the Stations list."
-
-// d: Information note when Fm Transmitter is launched when FM Radio is on, FM Radio gets closed
-// l: popup_note_window
-//
-#define qtn_fmradio_note_fmtx_close_application "FM Radio cannot be used when the FM transmitter is on. FM Radio is closed."
-
-// d: Information note when Fm Radio is tried to be launched when FM Transmitter is on. FM Radio is not launched.
-// l: popup_note_window
-//
-#define qtn_fmradio_note_fmtx_unable_to_start "FM Radio cannot be started when FM transmitter is on."
-
-
-
-// Wait notes
-//
-
-// d: Wait note
-// d: Search stations view station list fill ongoing
-// d: List fill ongoing on the background, so this note shown as small as possible.
-// l: popup_note_wait_window/opt3
-//
-#define qtn_fmradio_wait_note_scanning "Scanning..."
-
-
-
-// Main view
-//
-
-// d: Custom RDS indicator displayed on the Media Idle (Main pane).
-// l: fmrd2_indi_pane_t3
-//
-#define qtn_fmradio_rds "RDS"
-
-// d: Custom AF indicator displayed on the Media Idle (Main pane).
-// l: fmrd2_indi_pane_t2
-//
-#define qtn_fmradio_af "AF"
-
-// d: Custom RT+ indicator displayed on the Media Idle (Main pane).
-// d: Enabled, if Music Store and/or Web address access are available via
-// d: RT+ information that radio Station is possibly sending
-// l: fmrd2_indi_pane_t1
-//
-#define qtn_fmradio_rtplus "+"
-
-// d: String shown on the Media Idle (Main pane).
-// d: %U is the station frequency. Shown with one or two decimals, depending on region.
-// d: Max length for %U is 6 characters.
-// l: None
-//
-#define qtn_fmradio_media_idle_freq "%U MHz"
-
-// d: String shown on the main pane.
-// d: %U is the station frequency. Shown with one or two decimals, depending on region.
-// d: Max length for %U is 6 characters.
-// l: area_fmrd2_info_pane_t2
-//
-#define qtn_fmradio_freq "%U MHz"
-
-// d: String shown on the main pane.
-// d: %N is the station memory location and %U is the frequency.
-// d: Memory location number max value is 100.
-// d: Frequency is shown with one or two decimals, max length 6 characters.
-// l: area_fmrd2_info_pane_t1
-//
-#define qtn_fmradio_mem_location_freq "%N. %U MHz"
-
-// d: String shown on the main pane.
-// d: %N is the station memory location and %U is station name.
-// d: Memory location number max value is 100.
-// d: Station name max length 20 characters.
-// l: area_fmrd2_info_pane_t1
-//
-#define qtn_fmradio_mem_location_name "%N. %U"
-
-// d: String shown on the main pane.
-// d: Tuning animation text.
-// l: area_fmrd2_info_pane_t4
-//
-#define qtn_fmradio_scanning "Tuning"
-
-// d: String shown on the main pane.
-// d: When next/prev button is short pressed and no stations stored, this is displayed on place of the station information.
-// l: popup_note_window
-//
-#define qtn_fmradio_use_long_tap "No stations saved. You can tune stations by long pressing the previous and next buttons."
-
-
-
-// Stations view
-//
-
-// d: String shown on the stations list 1nd row.
-// d: %U is the frequency of the saved station.
-// d: Frequency is shown with one or two decimals, max length 6 characters.
-// d: Frequency shown on the 1st row, when a station has no saved name.
-// l: list_double_number_pane_t2
-//
-#define qtn_fmradio_double1_freq "%U MHz"
-
-// d: String shown on the stations list 2nd row.
-// d: %U is the frequency of the saved station, max length 6 characters.
-// d: Frequency is shown with one or two decimals.
-// d: Frequency shown on the 2nd row, when a station has a name.
-// l: list_double_number_pane_t3
-//
-#define qtn_fmradio_double2_freq "%U MHz"
-
-// d: String shown on the empty stations list.
-// l: main_list_empty_pane
-//
-#define qtn_fmradio_list_no_stations "No saved stations. You can search stations via Options->Search stations"
-
-
-
-// Search Stations view
-//
-
-// d: String shown on the search stations list row.
-// d: %U is the frequency of the saved station.
-// d: Frequency is shown with one or two decimals, max length 6 characters.
-// d: When a found station has not (yet) a name available.
-// l: list_single_pane_t1
-//
-#define qtn_fmradio_single_freq "%U MHz"
-
-// d: String shown on the search stations list row.
-// d: %0U is the frequency of the saved station and %1U is the station PSNAME.
-// d: Frequency is shown with one or two decimals, max length 6 characters.
-// d: Station name max length 20 characters.
-// l: list_single_pane_t1
-//
-#define qtn_fmradio_single_freq_name "%0U MHz %1U"
-
-// d: String shown on the empty search stations list.
-// l: main_list_empty_pane
-//
-#define qtn_fmradio_list_no_stations_found "(No stations found)"
-
-
-
-// Homescreen Widget
-//
-
-// d: String shown on the Homescreen Widget.
-// d: Shown when the application is tuning for a station.
-// l: hscr_music_header_text
-//
-#define qtn_fmradio_widget_tuning "Tuning..."
-
-// d: String shown on the Homescreen Widget.
-// d: Shown if the 3.5mm analog audio accessory required as antenna is not connected
-// l: hscr_music_header_text
-//
-#define qtn_fmradio_widget_con_headset "Connect wired headset with 3.5mm connector"
-
-// d: String shown on the Homescreen Widget.
-// d: Currently active channel index and name
-// d: separated by a dot.
-// d: Index number max value is 100.
-// d: Station name max length 20 characters.
-// l: hscr_music_header_text
-//
-#define qtn_fmradio_widget_station_saved "%N. %U"
-
-// d: String shown on the Homescreen Widget.
-// d: Currently active channel index and frequency
-// d: separated by a dot.
-// d: Index number max value is 100.
-// d: Frequency is shown with one or two decimals, max length 6 characters.
-// l: hscr_music_header_text
-//
-#define qtn_fmradio_widget_station_saved_freq "%N. %U MHz"
-
-// d: String shown on the Homescreen Widget.
-// d: Displays currently active channel frequency.
-// d: Frequency is shown with one or two decimals, max length 6 characters.
-// l: hscr_music_header_text
-//
-#define qtn_fmradio_widget_notsaved_frequency "%U MHz"
-
-
-
-// Music Suite
-//
-
-// d: The title for the most recently played radio station.
-// d: First row of Music Suite Now Playing item.
-// d: This is when the FM Radio has been the last application
-// d: to control the audio in Music Suite.
-// l: aalist_double_graphic_pane_t1
-//
-#define qtn_fmradio_suite_last_played "Last Played"
-
-
-// d: The title for the currently playing radio station.
-// d: First row of Music Suite Now Playing item.
-// d: This is when FM Radio controls the audio in Music SUite.
-// l: aalist_double_graphic_pane_t1
-//
-#define qtn_fmradio_suite_now_playing "Now Playing"
-
-// d: Second row of Music Suite Now Playing item.
-// d: Currently active channel index and name
-// d: separated by a dot.
-// d: Index number max value is 100.
-// d: Station name max length 20 characters.
-// l: list_logical_template_3_detail
-//
-#define qtn_fmradio_suite_playing_saved_with_name "%N. %U"
-
-// d: Second row of Music Suite Now Playing item.
-// d: Currently active channel index and frequency
-// d: separated by a dot.
-// d: Index number max value is 100.
-// d: Frequency is shown with one or two decimals, max length 6 characters.
-// l: list_logical_template_3_detail
-//
-#define qtn_fmradio_suite_playing_saved_without_name "%N. %U MHz"
-
-// d: Second row of Music Suite Now Playing item.
-// d: Currently active channel frequency.
-// d: Frequency is shown with one or two decimals, max length 6 characters.
-// l: list_logical_template_3_detail
-//
-#define qtn_fmradio_suite_playing_not_saved "%U MHz"
-
-
-
-// Toolbar tooltips
-//
-
-// d: Main view tooltip text.
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_stations "Stations"
-
-// d: Stations view tooltip text.
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_search_stations "Search stations"
-
-// d: Stations view tooltip text.
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_save_all "Save all"
-
-// d: Stations view tooltip text.
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_activate_loudspeaker "Activate loudspeaker"
-
-// d: Stations view tooltip text.
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_deactivate_loudspeaker "Deactivate loudspeaker"
-
-// d: Stations view tooltip text.
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_tune_manually "Tune manually"
-
-// d: main view toolbar extension tooltip
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_delete "Delete channel"
-
-// d: main view toolbar extension tooltip
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_save "Save channel"
-
-// d: main view toolbar extension tooltip
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_rename "Rename channel"
-
-// d: main view toolbar extension tooltip
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_web "Go to web adress"
-
-// d: main view toolbar extension tooltip
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_nokia_music_store "Ovi Music"
-
-// d: main view toolbar extension tooltip
-// d: extension menu button
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_extension "Expand Toolbar"
-
-// d: main view toolbar extension tooltip
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_recognise_song "Recognise song"
-
-// d: main view toolbar extension tooltip
-// l: popup_preview_text_window_t1
-//
-#define qtn_fmradio_tooltip_operator_music_store "Music Store"
-
-// Toolbar extension
-//
-
-// d: main view toolbar extension command text
-// l: cell_tb_ext_pane_t1/opt1
-//
-#define qtn_tbextension_delete "Delete"
-
-// d: main view toolbar extension command text
-// l: cell_tb_ext_pane_t1/opt1
-//
-#define qtn_tbextension_save "Save"
-
-// d: main view toolbar extension command text
-// l: cell_tb_ext_pane_t1/opt1
-//
-#define qtn_tbextension_list_view "Stations"
-
-// d: main view toolbar extension command text
-// l: cell_tb_ext_pane_t1/opt1
-//
-#define qtn_tbextension_rename "Rename"
-
-// d: main view toolbar extension command text
-// l: cell_tb_ext_pane_t1/opt1
-//
-#define qtn_tbextension_station_web "Station’s web"
-
-// d: main view toolbar extension command text
-// l: cell_tb_ext_pane_t1/opt1
-//
-#define qtn_tbextension_ovi_music "Ovi Music Store"
-
-// d: main view toolbar extension command text
-// l: cell_tb_ext_pane_t1/opt1
-//
-#define qtn_tbextension_activate_loudspeaker "Activate loudspeaker"
-
-// d: main view toolbar extension command text
-// l: cell_tb_ext_pane_t1/opt1
-//
-#define qtn_tbextension_deactivate_loudspeaker "Deactivate loudspeaker"
-
-// d: main view toolbar extension command text
-// l: cell_tb_ext_pane_t1/opt1
-//
-#define qtn_tbextension_recognise_song "Recognise song"
-
-// Stylus popup menu items
-
-// d: Stations view stylus menu text
-// l: list_single_pane_t1_cp2
-//
-#define qtn_fmradio_move "Move"
-
-// End of File
--- a/fmradio/sis/fmradio_cenrep_updated/fmradiocenrep.pkg Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description: FMRadio packet file with central repository
-;
-
-;Languages
-&EN
-
-;packet-header (name, uid, major, minor, build, type)
-#{"FMRadio Cenrep File"},(0x10202BE9),3,0,0,TYPE=SP
-
-; Localised vendor name
-%{"Symbian"}
-
-; Unique Vendor name
-:"Symbian"
-
-; FM Radio Central Repository File
-"..\..\fmradioengine\cenrep\2001B25E.cre" - "c:\private\10202be9\2001B25E.cre"
-
-; NOTE: 2001B25E.cre is the binary version of 2001B25E.txt
-; For more info, see link: http://s60wiki.nokia.com/S60Wiki/How_to_guide_for_installing_Central_Repository_ini_files#Installing_Central_Repository_ini_file_that_is_already_in_ROM
\ No newline at end of file
Binary file fmradio/sis/fmradio_cenrep_updated/fmradiocenrep.sis has changed
--- a/fmradio/sis/fmradio_cenrep_updated/package.pkg Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description: FMRadio packet file with central repository
-;
-
-;Languages
-&EN
-
-;packet-header (name, uid, major, minor, build, type)
-#{"FMRadio"},(0x10207A89),3,0,0,TYPE=SA,RU
-
-; Localised vendor name
-%{"Symbian"}
-
-; Unique Vendor name
-:"Symbian"
-
-; EXE/DLL
-"\epoc32\release\armv5\urel\fmradio.exe" -"!:\sys\bin\fmradio.exe"
-"\epoc32\release\armv5\urel\fmradioengine.dll" -"!:\sys\bin\fmradioengine.dll"
-"\epoc32\release\armv5\urel\fmradioactiveidleengine200.dll" -"!:\sys\bin\fmradioactiveidleengine200.dll"
-"\epoc32\release\armv5\urel\fmradiomcpplugin100.dll" -"!:\sys\bin\fmradiomcpplugin100.dll"
-"\epoc32\release\armv5\urel\fmradioactionhandler.dll" -"!:\sys\bin\fmradioactionhandler.dll"
-
-; Resources
-"\epoc32\data\z\private\10003a3f\import\apps\fmradio_reg.rsc" -"!:\private\10003a3f\import\apps\fmradio_reg.rsc"
-"\epoc32\data\Z\resource\apps\fmradio.rsc" -"!:\resource\apps\fmradio.rsc"
-"\epoc32\data\Z\resource\fmradioengine.rsc" -"!:\resource\fmradioengine.rsc"
-"\epoc32\data\Z\resource\fmradiomcpplugin.rsc" -"!:\resource\fmradiomcpplugin.rsc"
-"\epoc32\data\Z\resource\plugins\fmradiomcpplugin100.rsc" -"!:\resource\plugins\fmradiomcpplugin100.rsc"
-"\epoc32\data\Z\resource\plugins\fmradioactionhandler.rsc" -"!:\resource\plugins\fmradioactionhandler.rsc"
-
-
-; Other files
-"\epoc32\data\Z\resource\apps\fmradio_aif.mif" -"!:\resource\apps\fmradio_aif.mif"
-"\epoc32\data\Z\resource\apps\fmradio.mif" -"!:\resource\apps\fmradio.mif"
-
-; Cenrep update
-@"fmradiocenrep.sis", (0x10202BE9)
\ No newline at end of file
--- a/fmradio/sis/fmradio_default/package.pkg Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description: FMRadio packet file
-;
-
-;Languages
-&EN
-
-;packet-header (name, uid, major, minor, build, type)
-#{"FMRadio"},(0x10207A89),3,0,0,TYPE=SA,RU
-
-; Localised vendor name
-%{"Symbian"}
-
-; Unique Vendor name
-:"Symbian"
-
-; EXE/DLL
-"\epoc32\release\armv5\urel\fmradio.exe" -"!:\sys\bin\fmradio.exe"
-"\epoc32\release\armv5\urel\fmradioengine.dll" -"!:\sys\bin\fmradioengine.dll"
-"\epoc32\release\armv5\urel\fmradioactiveidleengine200.dll" -"!:\sys\bin\fmradioactiveidleengine200.dll"
-"\epoc32\release\armv5\urel\fmradiomcpplugin100.dll" -"!:\sys\bin\fmradiomcpplugin100.dll"
-"\epoc32\release\armv5\urel\fmradioactionhandler.dll" -"!:\sys\bin\fmradioactionhandler.dll"
-
-; Resources
-"\epoc32\data\z\private\10003a3f\import\apps\fmradio_reg.rsc" -"!:\private\10003a3f\import\apps\fmradio_reg.rsc"
-"\epoc32\data\Z\resource\apps\fmradio.rsc" -"!:\resource\apps\fmradio.rsc"
-"\epoc32\data\Z\resource\fmradioengine.rsc" -"!:\resource\fmradioengine.rsc"
-"\epoc32\data\Z\resource\fmradiomcpplugin.rsc" -"!:\resource\fmradiomcpplugin.rsc"
-"\epoc32\data\Z\resource\plugins\fmradiomcpplugin100.rsc" -"!:\resource\plugins\fmradiomcpplugin100.rsc"
-"\epoc32\data\Z\resource\plugins\fmradioactionhandler.rsc" -"!:\resource\plugins\fmradioactionhandler.rsc"
-
-; Other files
-"\epoc32\data\Z\resource\apps\fmradio_aif.mif" -"!:\resource\apps\fmradio_aif.mif"
-"\epoc32\data\Z\resource\apps\fmradio.mif" -"!:\resource\apps\fmradio.mif"
--- a/fmradio/sis/fmradio_default/stub.pkg Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description: FMRadio packet file
-;
-
-;Languages
-&EN
-
-;packet-header (name, uid, major, minor, build, type)
-#{"FMRadio"},(0x10207A89),4,0,0,TYPE=SA
-
-; Localised vendor name
-%{"Symbian"}
-
-; Unique Vendor name
-:"Symbian"
-
-; EXE/DLL
-""-"z:\sys\bin\fmradio.exe"
-""-"z:\sys\bin\fmradioengine.dll"
-""-"z:\sys\bin\fmradioactiveidleengine200.dll"
-""-"z:\sys\bin\fmradiomcpplugin100.dll"
-""-"z:\sys\bin\fmradioactionhandler.dll"
-
-; Resources
-""-"z:\private\10003a3f\import\apps\fmradio_reg.r*"
-""-"z:\resource\apps\fmradio.r*"
-""-"z:\resource\fmradioengine.r*"
-""-"z:\resource\fmradiomcpplugin.r*"
-""-"z:\resource\plugins\fmradiomcpplugin100.rsc"
-""-"z:\resource\plugins\fmradioactionhandler.rsc"
-
-; Other files
-""-"z:\resource\apps\fmradio_aif.mif"
-""-"z:\resource\apps\fmradio.mif"
\ No newline at end of file
Binary file fmradio/sis/fmradio_default/stub.sis has changed
--- a/group/bld.inf Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#include "../fmradio/group/bld.inf"
--- a/layers.sysdef.xml Tue Feb 02 00:17:10 2010 +0200
+++ b/layers.sysdef.xml Fri Mar 19 09:29:04 2010 +0200
@@ -1,13 +1,13 @@
<?xml version="1.0"?>
-<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
<!ENTITY layer_real_source_path "sf/app/radio" >
]>
-<SystemDefinition name="radio" schema="1.4.0">
+<SystemDefinition name="radio" schema="1.5.1">
<systemModel>
<layer name="app_layer">
<module name="radio">
- <unit unitID="vado.radio" mrp="" bldFile="&layer_real_source_path;/group" name="radio" />
+ <unit unitID="vado.radio" mrp="" bldFile="&layer_real_source_path;" name="radio" proFile="radio.pro" qmakeArgs="-r" />
</module>
</layer>
</systemModel>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radio.pro Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+CONFIG += ordered
+
+symbian: {
+ BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"radioengine/group/bld.inf\""
+ SUBDIRS += radioapp
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/buildflags.pri Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,124 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+
+# ##########################################################
+# Start of Flag definitions
+# Add or remove comments to disable or enable the features
+# ##########################################################
+
+# Use of some debugging controls that are not part of official UI spec
+# RADIOFLAGS += USE_DEBUGGING_CONTROLS
+
+# Reads the layout docml files and images from e:/radiotest/ folder
+# RADIOFLAGS += USE_LAYOUT_FROM_E_DRIVE
+
+# Usage of the Mobile Extensions APIs
+# RADIOFLAGS += USE_MOBILE_EXTENSIONS_API
+
+# Usage of stubbed radio engine
+# RADIOFLAGS += USE_STUBBED_RADIOENGINE
+
+# Flag to use dummy radio data read from XML file
+# RADIOFLAGS += USE_DUMMY_RADIO_DATA
+
+# Functional testing
+# RADIOFLAGS += SHOW_CALLSIGN_IN_ANY_REGION
+
+# Build flag to enable usage of the new preset utility
+# RADIOFLAGS += COMPILE_WITH_NEW_PRESET_UTILITY
+
+# Build flag to add EXPORTUNFROZEN to the pro file
+# RADIOFLAGS += USE_UNFROZEN_EXPORTS
+
+# Enables the assert macros
+# RADIOFLAGS += ENABLE_ASSERTS
+
+# ##########################################################
+# Start of Logging flag definitions
+# ##########################################################
+
+# Full logging flag that enables the full logging including also timestamps
+# Enabled by default in debug builds
+# CONFIG(debug, debug|release) : LOGGING_FLAGS += LOGGING_ENABLED
+
+# Uncomment to enable full logging in release builds
+# LOGGING_FLAGS *= LOGGING_ENABLED
+
+# Timestamp logging flag that enables only timestamp logging
+# LOGGING_FLAGS += TIMESTAMP_LOGGING_ENABLED
+
+# Marker that is printed in the beginning of each log line
+## LOGGING_FLAGS += LOGMARKER=\\\"FMRadio:\\\"
+
+# Combines Ui and Engine logs by feeding UI traces to the engine logger
+LOGGING_FLAGS += COMBINE_WITH_ENGINE_LOGGER
+
+contains(LOGGING_FLAGS, TIMESTAMP_LOGGING_ENABLED)|contains(LOGGING_FLAGS, LOGGING_ENABLED) {
+
+ # Writes debug prints to file if enabled
+ #LOGGING_FLAGS += TRACE_TO_FILE
+
+ # Settings for the log file name
+ symbian:contains(LOGGING_FLAGS, TRACE_TO_FILE) {
+ LOGGING_FLAGS += \"TRACE_OUTPUT_FILE=\\\"c:/logs/radio/fmradioui.txt\\\"\"
+ LOGGING_FLAGS += FILTER_BY_LOGMARKER=true
+ }
+}
+
+# Method for testing signal-slot connections
+# 1 - Log failed connection
+# 2 - Log failed connection and halt debugger
+LOGGING_FLAGS += CONNECT_TEST_MODE=2
+
+DEFINES += $$LOGGING_FLAGS
+
+# ##########################################################
+# End of Flag definitions
+# ##########################################################
+
+# Copy all radio flags to defines to define them as preprocessor macros
+DEFINES += $$RADIOFLAGS
+CONFIG += $$RADIOFLAGS
+CONFIG += $$LOGGING_FLAGS
+
+win32:DEFINES += BUILD_WIN32
+
+# Mobile extension headers are in a special path
+MOBILE_EXTENSIONS_PATH = /mobile_extensions/include
+!exists($$MOBILE_EXTENSIONS_PATH) {
+ CONFIG -= USE_MOBILE_EXTENSIONS_API
+ DEFINES -= USE_MOBILE_EXTENSIONS_API
+}
+USE_MOBILE_EXTENSIONS_API {
+ INCLUDEPATH += $$MOBILE_EXTENSIONS_PATH
+}
+
+USE_STUBBED_RADIOENGINE {
+ INCLUDEPATH += /epoc32/include/radioengine_stub
+}
+
+USE_UNFROZEN_EXPORTS {
+ symbian:MMP_RULES += "exportunfrozen"
+}
+
+# $$_PRO_FILE_PWD_ points to the directory of the pro file
+MOC_DIR = $$_PRO_FILE_PWD_/tmp
+RCC_DIR = $$_PRO_FILE_PWD_/tmp
+OBJECTS_DIR = $$_PRO_FILE_PWD_/tmp
+UI_DIR = $$_PRO_FILE_PWD_/tmp
+UI_HEADERS_DIR = $$_PRO_FILE_PWD_/tmp
+UI_SOURCES_DIR = $$_PRO_FILE_PWD_/tmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/bwins/radioenginewrapperu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,39 @@
+EXPORTS
+ ?frequencyStepSize@RadioEngineWrapper@@QBEIXZ @ 1 NONAME ; unsigned int RadioEngineWrapper::frequencyStepSize(void) const
+ ?region@RadioEngineWrapper@@QBE?AW4Region@RadioRegion@@XZ @ 2 NONAME ; enum RadioRegion::Region RadioEngineWrapper::region(void) const
+ ??0MethodLogger@@QAE@PBD0@Z @ 3 NONAME ; MethodLogger::MethodLogger(char const *, char const *)
+ ?tuneFrequency@RadioEngineWrapper@@QAEXIH@Z @ 4 NONAME ; void RadioEngineWrapper::tuneFrequency(unsigned int, int)
+ ?initCombinedLogger@RadioLogger@@SAXXZ @ 5 NONAME ; void RadioLogger::initCombinedLogger(void)
+ ??0RadioSettings@@AAE@XZ @ 6 NONAME ; RadioSettings::RadioSettings(void)
+ ?d_func@RadioSettings@@ABEPBVRadioSettingsPrivate@@XZ @ 7 NONAME ; class RadioSettingsPrivate const * RadioSettings::d_func(void) const
+ ?logMsg@RadioLogger@@SAXPBDW4Mode@1@@Z @ 8 NONAME ; void RadioLogger::logMsg(char const *, enum RadioLogger::Mode)
+ ?isRadioOn@RadioEngineWrapper@@QBE_NXZ @ 9 NONAME ; bool RadioEngineWrapper::isRadioOn(void) const
+ ?isMuted@RadioEngineWrapper@@QBE_NXZ @ 10 NONAME ; bool RadioEngineWrapper::isMuted(void) const
+ ?scanFrequencyBand@RadioEngineWrapper@@QAEXXZ @ 11 NONAME ; void RadioEngineWrapper::scanFrequencyBand(void)
+ ?isUsingLoudspeaker@RadioEngineWrapper@@QBE_NXZ @ 12 NONAME ; bool RadioEngineWrapper::isUsingLoudspeaker(void) const
+ ?currentFrequency@RadioEngineWrapper@@QBEIXZ @ 13 NONAME ; unsigned int RadioEngineWrapper::currentFrequency(void) const
+ ?isScanning@RadioEngineWrapper@@QBE_NXZ @ 14 NONAME ; bool RadioEngineWrapper::isScanning(void) const
+ ?cancelScanFrequencyBand@RadioEngineWrapper@@QAEXXZ @ 15 NONAME ; void RadioEngineWrapper::cancelScanFrequencyBand(void)
+ ?isAntennaAttached@RadioEngineWrapper@@QBE_NXZ @ 16 NONAME ; bool RadioEngineWrapper::isAntennaAttached(void) const
+ ?isEngineConstructed@RadioEngineWrapper@@QAE_NXZ @ 17 NONAME ; bool RadioEngineWrapper::isEngineConstructed(void)
+ ?toggleAudioRoute@RadioEngineWrapper@@QAEXXZ @ 18 NONAME ; void RadioEngineWrapper::toggleAudioRoute(void)
+ ?d_func@RadioSettings@@AAEPAVRadioSettingsPrivate@@XZ @ 19 NONAME ; class RadioSettingsPrivate * RadioSettings::d_func(void)
+ ?setVolume@RadioEngineWrapper@@QAEXH@Z @ 20 NONAME ; void RadioEngineWrapper::setVolume(int)
+ ?d_func@RadioEngineWrapper@@AAEPAVRadioEngineWrapperPrivate@@XZ @ 21 NONAME ; class RadioEngineWrapperPrivate * RadioEngineWrapper::d_func(void)
+ ?toggleShowFavorites@RadioSettings@@QAE_NXZ @ 22 NONAME ; bool RadioSettings::toggleShowFavorites(void)
+ ?toggleMute@RadioEngineWrapper@@QAEXXZ @ 23 NONAME ; void RadioEngineWrapper::toggleMute(void)
+ ?startSeeking@RadioEngineWrapper@@QAEXW4Direction@Seeking@@@Z @ 24 NONAME ; void RadioEngineWrapper::startSeeking(enum Seeking::Direction)
+ ?showFavorites@RadioSettings@@QBE_NXZ @ 25 NONAME ; bool RadioSettings::showFavorites(void) const
+ ?d_func@RadioEngineWrapper@@ABEPBVRadioEngineWrapperPrivate@@XZ @ 26 NONAME ; class RadioEngineWrapperPrivate const * RadioEngineWrapper::d_func(void) const
+ ?isFrequencyValid@RadioEngineWrapper@@QAE_NI@Z @ 27 NONAME ; bool RadioEngineWrapper::isFrequencyValid(unsigned int)
+ ?isFirstTimeStart@RadioSettings@@QAE_NXZ @ 28 NONAME ; bool RadioSettings::isFirstTimeStart(void)
+ ?minFrequency@RadioEngineWrapper@@QBEIXZ @ 29 NONAME ; unsigned int RadioEngineWrapper::minFrequency(void) const
+ ?tuneWithDelay@RadioEngineWrapper@@QAEXIH@Z @ 30 NONAME ; void RadioEngineWrapper::tuneWithDelay(unsigned int, int)
+ ?setShowFavorites@RadioSettings@@QAEX_N@Z @ 31 NONAME ; void RadioSettings::setShowFavorites(bool)
+ ?releaseCombinedLogger@RadioLogger@@SAXXZ @ 32 NONAME ; void RadioLogger::releaseCombinedLogger(void)
+ ??1RadioEngineWrapper@@QAE@XZ @ 33 NONAME ; RadioEngineWrapper::~RadioEngineWrapper(void)
+ ??1MethodLogger@@QAE@XZ @ 34 NONAME ; MethodLogger::~MethodLogger(void)
+ ?settings@RadioEngineWrapper@@QAEAAVRadioSettings@@XZ @ 35 NONAME ; class RadioSettings & RadioEngineWrapper::settings(void)
+ ?maxFrequency@RadioEngineWrapper@@QBEIXZ @ 36 NONAME ; unsigned int RadioEngineWrapper::maxFrequency(void) const
+ ??0RadioEngineWrapper@@QAE@AAVRadioStationHandlerIf@@AAVRadioEngineWrapperObserver@@@Z @ 37 NONAME ; RadioEngineWrapper::RadioEngineWrapper(class RadioStationHandlerIf &, class RadioEngineWrapperObserver &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/bwins/radiopresetstorageu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+ ??1RadioPresetStorage@@QAE@XZ @ 1 NONAME ; RadioPresetStorage::~RadioPresetStorage(void)
+ ?savePreset@RadioPresetStorage@@QAE_NABVRadioStationIf@@@Z @ 2 NONAME ; bool RadioPresetStorage::savePreset(class RadioStationIf const &)
+ ?maxNumberOfPresets@RadioPresetStorage@@QBEHXZ @ 3 NONAME ; int RadioPresetStorage::maxNumberOfPresets(void) const
+ ??0RadioPresetStorage@@QAE@XZ @ 4 NONAME ; RadioPresetStorage::RadioPresetStorage(void)
+ ?nextPreset@RadioPresetStorage@@QBEHH@Z @ 5 NONAME ; int RadioPresetStorage::nextPreset(int) const
+ ?deletePreset@RadioPresetStorage@@QAE_NH@Z @ 6 NONAME ; bool RadioPresetStorage::deletePreset(int)
+ ?firstPreset@RadioPresetStorage@@QBEHXZ @ 7 NONAME ; int RadioPresetStorage::firstPreset(void) const
+ ?readPreset@RadioPresetStorage@@QAE_NHAAVRadioStationIf@@@Z @ 8 NONAME ; bool RadioPresetStorage::readPreset(int, class RadioStationIf &)
+ ?presetCount@RadioPresetStorage@@QBEHXZ @ 9 NONAME ; int RadioPresetStorage::presetCount(void) const
+ ?d_func@RadioPresetStorage@@AAEPAVRadioPresetStoragePrivate@@XZ @ 10 NONAME ; class RadioPresetStoragePrivate * RadioPresetStorage::d_func(void)
+ ?d_func@RadioPresetStorage@@ABEPBVRadioPresetStoragePrivate@@XZ @ 11 NONAME ; class RadioPresetStoragePrivate const * RadioPresetStorage::d_func(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/bwins/radiouiengineu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,231 @@
+EXPORTS
+ ?detach@RadioPlayLogItem@@QAEXXZ @ 1 NONAME ; void RadioPlayLogItem::detach(void)
+ ?tr@RadioUiEngine@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString RadioUiEngine::tr(char const *, char const *)
+ ?isOfflineProfile@RadioUiEngine@@SA_NXZ @ 3 NONAME ; bool RadioUiEngine::isOfflineProfile(void)
+ ?currentStation@RadioStationModel@@QBEABVRadioStation@@XZ @ 4 NONAME ; class RadioStation const & RadioStationModel::currentStation(void) const
+ ?qt_metacast@RadioUiEngine@@UAEPAXPBD@Z @ 5 NONAME ; void * RadioUiEngine::qt_metacast(char const *)
+ ?parseFrequency@RadioUiEngine@@SA?AVQString@@I@Z @ 6 NONAME ; class QString RadioUiEngine::parseFrequency(unsigned int)
+ ?d_func@RadioPlayLogModel@@ABEPBVRadioPlayLogModelPrivate@@XZ @ 7 NONAME ; class RadioPlayLogModelPrivate const * RadioPlayLogModel::d_func(void) const
+ ?index@RadioStationFilterModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 8 NONAME ; class QModelIndex RadioStationFilterModel::index(int, int, class QModelIndex const &) const
+ ?parseFrequency@RadioStation@@SA?AVQString@@I@Z @ 9 NONAME ; class QString RadioStation::parseFrequency(unsigned int)
+ ??0RadioStation@@QAE@ABV0@@Z @ 10 NONAME ; RadioStation::RadioStation(class RadioStation const &)
+ ?region@RadioUiEngine@@QBE?AW4Region@RadioRegion@@XZ @ 11 NONAME ; enum RadioRegion::Region RadioUiEngine::region(void) const
+ ?frequency@RadioStation@@QBEIXZ @ 12 NONAME ; unsigned int RadioStation::frequency(void) const
+ ?skipPrevious@RadioUiEngine@@QAEXXZ @ 13 NONAME ; void RadioUiEngine::skipPrevious(void)
+ ?setFavoriteByFrequency@RadioStationModel@@QAEXI_N@Z @ 14 NONAME ; void RadioStationModel::setFavoriteByFrequency(unsigned int, bool)
+ ?findFrequency@RadioStationModel@@QAE_NIAAVRadioStation@@@Z @ 15 NONAME ; bool RadioStationModel::findFrequency(unsigned int, class RadioStation &)
+ ??4RadioPlayLogItem@@QAEAAV0@ABV0@@Z @ 16 NONAME ; class RadioPlayLogItem & RadioPlayLogItem::operator=(class RadioPlayLogItem const &)
+ ??0RadioPlayLogItem@@QAE@ABV0@@Z @ 17 NONAME ; RadioPlayLogItem::RadioPlayLogItem(class RadioPlayLogItem const &)
+ ?staticMetaObject@RadioUiEngine@@2UQMetaObject@@B @ 18 NONAME ; struct QMetaObject const RadioUiEngine::staticMetaObject
+ ?qt_metacast@RadioPlayLogModel@@UAEPAXPBD@Z @ 19 NONAME ; void * RadioPlayLogModel::qt_metacast(char const *)
+ ?stationsInRange@RadioStationModel@@QAE?AV?$QList@VRadioStation@@@@II@Z @ 20 NONAME ; class QList<class RadioStation> RadioStationModel::stationsInRange(unsigned int, unsigned int)
+ ?seekDown@RadioUiEngine@@QAEXXZ @ 21 NONAME ; void RadioUiEngine::seekDown(void)
+ ?removeAll@RadioPlayLogModel@@QAEXXZ @ 22 NONAME ; void RadioPlayLogModel::removeAll(void)
+ ?tuneWithDelay@RadioUiEngine@@QAEXIH@Z @ 23 NONAME ; void RadioUiEngine::tuneWithDelay(unsigned int, int)
+ ?trUtf8@RadioPlayLogModel@@SA?AVQString@@PBD0@Z @ 24 NONAME ; class QString RadioPlayLogModel::trUtf8(char const *, char const *)
+ ?hasPiCode@RadioStation@@QBE_NXZ @ 25 NONAME ; bool RadioStation::hasPiCode(void) const
+ ?addRadioTextPlus@RadioPlayLogModel@@AAEXHABVQString@@@Z @ 26 NONAME ; void RadioPlayLogModel::addRadioTextPlus(int, class QString const &)
+ ?setFavoriteByPreset@RadioStationModel@@QAEXH_N@Z @ 27 NONAME ; void RadioStationModel::setFavoriteByPreset(int, bool)
+ ?scanAndSaveFinished@RadioUiEngine@@IAEXXZ @ 28 NONAME ; void RadioUiEngine::scanAndSaveFinished(void)
+ ?rdsAvailabilityChanged@RadioUiEngine@@IAEX_N@Z @ 29 NONAME ; void RadioUiEngine::rdsAvailabilityChanged(bool)
+ ?findPresetIndex@RadioStationModel@@QAEHHAAVRadioStation@@@Z @ 30 NONAME ; int RadioStationModel::findPresetIndex(int, class RadioStation &)
+ ?stationHandlerIf@RadioStationModel@@QAEAAVRadioStationHandlerIf@@XZ @ 31 NONAME ; class RadioStationHandlerIf & RadioStationModel::stationHandlerIf(void)
+ ?resetCurrentSong@RadioPlayLogModel@@QAEXXZ @ 32 NONAME ; void RadioPlayLogModel::resetCurrentSong(void)
+ ?emitVolumeChanged@RadioUiEngine@@AAEXH@Z @ 33 NONAME ; void RadioUiEngine::emitVolumeChanged(int)
+ ?seekUp@RadioUiEngine@@QAEXXZ @ 34 NONAME ; void RadioUiEngine::seekUp(void)
+ ?qt_metacall@RadioUiEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 35 NONAME ; int RadioUiEngine::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?emitSeekingStarted@RadioUiEngine@@AAEXW4Direction@Seeking@@@Z @ 36 NONAME ; void RadioUiEngine::emitSeekingStarted(enum Seeking::Direction)
+ ?reset@RadioStation@@AAEXXZ @ 37 NONAME ; void RadioStation::reset(void)
+ ?isFavorite@RadioPlayLogItem@@QBE_NXZ @ 38 NONAME ; bool RadioPlayLogItem::isFavorite(void) const
+ ??1RadioStationFilterModel@@UAE@XZ @ 39 NONAME ; RadioStationFilterModel::~RadioStationFilterModel(void)
+ ?emitAudioRouteChanged@RadioUiEngine@@AAEX_N@Z @ 40 NONAME ; void RadioUiEngine::emitAudioRouteChanged(bool)
+ ??_ERadioPlayLogModel@@UAE@I@Z @ 41 NONAME ; RadioPlayLogModel::~RadioPlayLogModel(unsigned int)
+ ??4RadioStation@@QAEAAV0@ABV0@@Z @ 42 NONAME ; class RadioStation & RadioStation::operator=(class RadioStation const &)
+ ?toggleAudioRoute@RadioUiEngine@@QAEXXZ @ 43 NONAME ; void RadioUiEngine::toggleAudioRoute(void)
+ ?unsetType@RadioStation@@QAEXV?$QFlags@W4TypeFlag@RadioStation@@@@@Z @ 44 NONAME ; void RadioStation::unsetType(class QFlags<enum RadioStation::TypeFlag>)
+ ?muteChanged@RadioUiEngine@@IAEX_N@Z @ 45 NONAME ; void RadioUiEngine::muteChanged(bool)
+ ?maxFrequency@RadioUiEngine@@QBEIXZ @ 46 NONAME ; unsigned int RadioUiEngine::maxFrequency(void) const
+ ?setIcons@RadioStationModel@@QAEXABVQIcon@@0@Z @ 47 NONAME ; void RadioStationModel::setIcons(class QIcon const &, class QIcon const &)
+ ?saveStation@RadioStationModel@@QAEXAAVRadioStation@@@Z @ 48 NONAME ; void RadioStationModel::saveStation(class RadioStation &)
+ ?findUnusedPresetIndex@RadioStationModel@@AAEHXZ @ 49 NONAME ; int RadioStationModel::findUnusedPresetIndex(void)
+ ?hasChanged@RadioStation@@QBE_NXZ @ 50 NONAME ; bool RadioStation::hasChanged(void) const
+ ?isScanning@RadioUiEngine@@QBE_NXZ @ 51 NONAME ; bool RadioUiEngine::isScanning(void) const
+ ?dynamicPsCheckEnded@RadioStationModel@@AAEXXZ @ 52 NONAME ; void RadioStationModel::dynamicPsCheckEnded(void)
+ ?itemAdded@RadioPlayLogModel@@IAEXXZ @ 53 NONAME ; void RadioPlayLogModel::itemAdded(void)
+ ??0RadioPlayLogModel@@AAE@AAVRadioUiEngine@@@Z @ 54 NONAME ; RadioPlayLogModel::RadioPlayLogModel(class RadioUiEngine &)
+ ?setFrequency@RadioStation@@AAEXI@Z @ 55 NONAME ; void RadioStation::setFrequency(unsigned int)
+ ?piCodeToCallSign@RadioStation@@AAE?AVQString@@I@Z @ 56 NONAME ; class QString RadioStation::piCodeToCallSign(unsigned int)
+ ?hasLooped@RadioStationFilterModel@@QBE_NABVQModelIndex@@@Z @ 57 NONAME ; bool RadioStationFilterModel::hasLooped(class QModelIndex const &) const
+ ?setFavorite@RadioPlayLogItem@@QAEXXZ @ 58 NONAME ; void RadioPlayLogItem::setFavorite(void)
+ ?favoriteChanged@RadioStationModel@@IAEXABVRadioStation@@@Z @ 59 NONAME ; void RadioStationModel::favoriteChanged(class RadioStation const &)
+ ?radioStatusChanged@RadioUiEngine@@IAEX_N@Z @ 60 NONAME ; void RadioUiEngine::radioStatusChanged(bool)
+ ?playCount@RadioPlayLogItem@@QBEHXZ @ 61 NONAME ; int RadioPlayLogItem::playCount(void) const
+ ?addStation@RadioStationModel@@QAEXABVRadioStation@@@Z @ 62 NONAME ; void RadioStationModel::addStation(class RadioStation const &)
+ ?tr@RadioPlayLogModel@@SA?AVQString@@PBD0H@Z @ 63 NONAME ; class QString RadioPlayLogModel::tr(char const *, char const *, int)
+ ?emitheadsetStatusChanged@RadioUiEngine@@AAEX_N@Z @ 64 NONAME ; void RadioUiEngine::emitheadsetStatusChanged(bool)
+ ?createNewFilterModel@RadioUiEngine@@QAEPAVRadioStationFilterModel@@PAVQObject@@@Z @ 65 NONAME ; class RadioStationFilterModel * RadioUiEngine::createNewFilterModel(class QObject *)
+ ?tunedToFrequency@RadioUiEngine@@IAEXIH@Z @ 66 NONAME ; void RadioUiEngine::tunedToFrequency(unsigned int, int)
+ ?tr@RadioUiEngine@@SA?AVQString@@PBD0H@Z @ 67 NONAME ; class QString RadioUiEngine::tr(char const *, char const *, int)
+ ?startRadio@RadioUiEngine@@QAE_NXZ @ 68 NONAME ; bool RadioUiEngine::startRadio(void)
+ ?tunePreset@RadioUiEngine@@QAEXH@Z @ 69 NONAME ; void RadioUiEngine::tunePreset(int)
+ ?emitDataChanged@RadioStationModel@@AAEXABVRadioStation@@@Z @ 70 NONAME ; void RadioStationModel::emitDataChanged(class RadioStation const &)
+ ?decrementReferenceCount@RadioPlayLogItem@@AAEXXZ @ 71 NONAME ; void RadioPlayLogItem::decrementReferenceCount(void)
+ ?isRadioOn@RadioUiEngine@@QBE_NXZ @ 72 NONAME ; bool RadioUiEngine::isRadioOn(void) const
+ ?increasePlayCount@RadioPlayLogItem@@QAEXXZ @ 73 NONAME ; void RadioPlayLogItem::increasePlayCount(void)
+ ?modelIndexFromFrequency@RadioStationModel@@QAE?AVQModelIndex@@I@Z @ 74 NONAME ; class QModelIndex RadioStationModel::modelIndexFromFrequency(unsigned int)
+ ?data@RadioStationFilterModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 75 NONAME ; class QVariant RadioStationFilterModel::data(class QModelIndex const &, int) const
+ ?list@RadioStationModel@@QBEABV?$QMap@IVRadioStation@@@@XZ @ 76 NONAME ; class QMap<unsigned int, class RadioStation> const & RadioStationModel::list(void) const
+ ?tr@RadioStationModel@@SA?AVQString@@PBD0@Z @ 77 NONAME ; class QString RadioStationModel::tr(char const *, char const *)
+ ?hasRds@RadioStation@@QBE_NXZ @ 78 NONAME ; bool RadioStation::hasRds(void) const
+ ?flags@RadioStationModel@@UBE?AV?$QFlags@W4ItemFlag@Qt@@@@ABVQModelIndex@@@Z @ 79 NONAME ; class QFlags<enum Qt::ItemFlag> RadioStationModel::flags(class QModelIndex const &) const
+ ?detach@RadioStation@@QAEXXZ @ 80 NONAME ; void RadioStation::detach(void)
+ ?getStaticMetaObject@RadioPlayLogModel@@SAABUQMetaObject@@XZ @ 81 NONAME ; struct QMetaObject const & RadioPlayLogModel::getStaticMetaObject(void)
+ ?stationsInRange@RadioUiEngine@@QAE?AV?$QList@VRadioStation@@@@II@Z @ 82 NONAME ; class QList<class RadioStation> RadioUiEngine::stationsInRange(unsigned int, unsigned int)
+ ?trUtf8@RadioUiEngine@@SA?AVQString@@PBD0@Z @ 83 NONAME ; class QString RadioUiEngine::trUtf8(char const *, char const *)
+ ?setPiCode@RadioStation@@AAE_NHW4Region@RadioRegion@@@Z @ 84 NONAME ; bool RadioStation::setPiCode(int, enum RadioRegion::Region)
+ ?radioText@RadioStation@@QBE?AVQString@@XZ @ 85 NONAME ; class QString RadioStation::radioText(void) const
+ ?setData@RadioStationModel@@UAE_NABVQModelIndex@@ABVQVariant@@H@Z @ 86 NONAME ; bool RadioStationModel::setData(class QModelIndex const &, class QVariant const &, int)
+ ??_ERadioPlayLogItem@@UAE@I@Z @ 87 NONAME ; RadioPlayLogItem::~RadioPlayLogItem(unsigned int)
+ ?setVolume@RadioUiEngine@@QAEXH@Z @ 88 NONAME ; void RadioUiEngine::setVolume(int)
+ ?setFavorite@RadioStation@@QAEX_N@Z @ 89 NONAME ; void RadioStation::setFavorite(bool)
+ ?setFavorite@RadioPlayLogModel@@QAEXXZ @ 90 NONAME ; void RadioPlayLogModel::setFavorite(void)
+ ?addRecognizedSong@RadioUiEngine@@QAEXABVQString@@0@Z @ 91 NONAME ; void RadioUiEngine::addRecognizedSong(class QString const &, class QString const &)
+ ?d_func@RadioStationModel@@ABEPBVRadioStationModelPrivate@@XZ @ 92 NONAME ; class RadioStationModelPrivate const * RadioStationModel::d_func(void) const
+ ?emitChangeSignals@RadioStationModel@@AAEXABVRadioStation@@V?$QFlags@W4ChangeFlag@RadioStation@@@@@Z @ 93 NONAME ; void RadioStationModel::emitChangeSignals(class RadioStation const &, class QFlags<enum RadioStation::ChangeFlag>)
+ ?tr@RadioStationModel@@SA?AVQString@@PBD0H@Z @ 94 NONAME ; class QString RadioStationModel::tr(char const *, char const *, int)
+ ?setCyclic@RadioStationFilterModel@@QAEX_N@Z @ 95 NONAME ; void RadioStationFilterModel::setCyclic(bool)
+ ??1RadioStationModel@@UAE@XZ @ 96 NONAME ; RadioStationModel::~RadioStationModel(void)
+ ?isMuted@RadioUiEngine@@QBE_NXZ @ 97 NONAME ; bool RadioUiEngine::isMuted(void) const
+ ?renameStation@RadioStationModel@@QAEXHABVQString@@@Z @ 98 NONAME ; void RadioStationModel::renameStation(int, class QString const &)
+ ?genreToString@RadioUiEngine@@QAE?AVQString@@H@Z @ 99 NONAME ; class QString RadioUiEngine::genreToString(int)
+ ?currentFrequency@RadioUiEngine@@QBEIXZ @ 100 NONAME ; unsigned int RadioUiEngine::currentFrequency(void) const
+ ?d_func@RadioPlayLogModel@@AAEPAVRadioPlayLogModelPrivate@@XZ @ 101 NONAME ; class RadioPlayLogModelPrivate * RadioPlayLogModel::d_func(void)
+ ?setUserDefinedName@RadioStation@@QAEXABVQString@@@Z @ 102 NONAME ; void RadioStation::setUserDefinedName(class QString const &)
+ ?data@RadioPlayLogModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 103 NONAME ; class QVariant RadioPlayLogModel::data(class QModelIndex const &, int) const
+ ?setUrl@RadioStation@@AAEXABVQString@@@Z @ 104 NONAME ; void RadioStation::setUrl(class QString const &)
+ ?setArtist@RadioPlayLogItem@@QAEXABVQString@@@Z @ 105 NONAME ; void RadioPlayLogItem::setArtist(class QString const &)
+ ??1RadioStation@@UAE@XZ @ 106 NONAME ; RadioStation::~RadioStation(void)
+ ?isCurrentSongRecognized@RadioPlayLogModel@@QBE_NXZ @ 107 NONAME ; bool RadioPlayLogModel::isCurrentSongRecognized(void) const
+ ?callSignString@RadioStation@@AAE?AVQString@@I@Z @ 108 NONAME ; class QString RadioStation::callSignString(unsigned int)
+ ?isValid@RadioStation@@QBE_NXZ @ 109 NONAME ; bool RadioStation::isValid(void) const
+ ?isEqual@RadioStationFilterModel@@QBE_NABVQModelIndex@@0@Z @ 110 NONAME ; bool RadioStationFilterModel::isEqual(class QModelIndex const &, class QModelIndex const &) const
+ ?setTitle@RadioPlayLogItem@@QAEXABVQString@@@Z @ 111 NONAME ; void RadioPlayLogItem::setTitle(class QString const &)
+ ??1RadioPlayLogModel@@EAE@XZ @ 112 NONAME ; RadioPlayLogModel::~RadioPlayLogModel(void)
+ ?decrementReferenceCount@RadioStation@@AAEXXZ @ 113 NONAME ; void RadioStation::decrementReferenceCount(void)
+ ?trUtf8@RadioUiEngine@@SA?AVQString@@PBD0H@Z @ 114 NONAME ; class QString RadioUiEngine::trUtf8(char const *, char const *, int)
+ ??0RadioPlayLogItem@@QAE@ABVQString@@0@Z @ 115 NONAME ; RadioPlayLogItem::RadioPlayLogItem(class QString const &, class QString const &)
+ ?trUtf8@RadioStationModel@@SA?AVQString@@PBD0@Z @ 116 NONAME ; class QString RadioStationModel::trUtf8(char const *, char const *)
+ ?cancelScanFrequencyBand@RadioUiEngine@@QAEXXZ @ 117 NONAME ; void RadioUiEngine::cancelScanFrequencyBand(void)
+ ?setRadioTextPlus@RadioStation@@AAEXHABVQString@@@Z @ 118 NONAME ; void RadioStation::setRadioTextPlus(int, class QString const &)
+ ?setChangeFlags@RadioStation@@AAEXV?$QFlags@W4ChangeFlag@RadioStation@@@@@Z @ 119 NONAME ; void RadioStation::setChangeFlags(class QFlags<enum RadioStation::ChangeFlag>)
+ ?modelIndexFromFrequency@RadioStationFilterModel@@QAE?AVQModelIndex@@I@Z @ 120 NONAME ; class QModelIndex RadioStationFilterModel::modelIndexFromFrequency(unsigned int)
+ ?tuneFrequency@RadioUiEngine@@QAEXIH@Z @ 121 NONAME ; void RadioUiEngine::tuneFrequency(unsigned int, int)
+ ?stationDataChanged@RadioStationModel@@IAEXABVRadioStation@@@Z @ 122 NONAME ; void RadioStationModel::stationDataChanged(class RadioStation const &)
+ ?model@RadioUiEngine@@QAEAAVRadioStationModel@@XZ @ 123 NONAME ; class RadioStationModel & RadioUiEngine::model(void)
+ ?headsetStatusChanged@RadioUiEngine@@IAEX_N@Z @ 124 NONAME ; void RadioUiEngine::headsetStatusChanged(bool)
+ ?currentStation@RadioStationModel@@QAEAAVRadioStation@@XZ @ 125 NONAME ; class RadioStation & RadioStationModel::currentStation(void)
+ ?genre@RadioStation@@QBEHXZ @ 126 NONAME ; int RadioStation::genre(void) const
+ ?emitTunedToFrequency@RadioUiEngine@@AAEXIH@Z @ 127 NONAME ; void RadioUiEngine::emitTunedToFrequency(unsigned int, int)
+ ?updateItem@RadioPlayLogModel@@AAEXHABVRadioPlayLogItem@@_N@Z @ 128 NONAME ; void RadioPlayLogModel::updateItem(int, class RadioPlayLogItem const &, bool)
+ ?flags@RadioPlayLogModel@@UBE?AV?$QFlags@W4ItemFlag@Qt@@@@ABVQModelIndex@@@Z @ 129 NONAME ; class QFlags<enum Qt::ItemFlag> RadioPlayLogModel::flags(class QModelIndex const &) const
+ ??0RadioStation@@QAE@XZ @ 130 NONAME ; RadioStation::RadioStation(void)
+ ?metaObject@RadioPlayLogModel@@UBEPBUQMetaObject@@XZ @ 131 NONAME ; struct QMetaObject const * RadioPlayLogModel::metaObject(void) const
+ ?psType@RadioStation@@QBE?AV?$QFlags@W4PsTypeFlag@RadioStation@@@@XZ @ 132 NONAME ; class QFlags<enum RadioStation::PsTypeFlag> RadioStation::psType(void) const
+ ?d_func@RadioUiEngine@@ABEPBVRadioUiEnginePrivate@@XZ @ 133 NONAME ; class RadioUiEnginePrivate const * RadioUiEngine::d_func(void) const
+ ?qt_metacall@RadioPlayLogModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 134 NONAME ; int RadioPlayLogModel::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?addItem@RadioPlayLogModel@@AAEXABVQString@@0@Z @ 135 NONAME ; void RadioPlayLogModel::addItem(class QString const &, class QString const &)
+ ?isSongRecognitionAppAvailable@RadioUiEngine@@QAE_NXZ @ 136 NONAME ; bool RadioUiEngine::isSongRecognitionAppAvailable(void)
+ ?clearRadioTextPlus@RadioPlayLogModel@@AAEXXZ @ 137 NONAME ; void RadioPlayLogModel::clearRadioTextPlus(void)
+ ?findCurrentStation@RadioStationModel@@AAE?AVRadioStation@@I@Z @ 138 NONAME ; class RadioStation RadioStationModel::findCurrentStation(unsigned int)
+ ?setPsType@RadioStation@@AAEXV?$QFlags@W4PsTypeFlag@RadioStation@@@@@Z @ 139 NONAME ; void RadioStation::setPsType(class QFlags<enum RadioStation::PsTypeFlag>)
+ ?realIndex@RadioStationFilterModel@@QBE?AVQModelIndex@@ABV2@@Z @ 140 NONAME ; class QModelIndex RadioStationFilterModel::realIndex(class QModelIndex const &) const
+ ?url@RadioStation@@QBE?AVQString@@XZ @ 141 NONAME ; class QString RadioStation::url(void) const
+ ?setData@RadioPlayLogModel@@UAE_NABVQModelIndex@@ABVQVariant@@H@Z @ 142 NONAME ; bool RadioPlayLogModel::setData(class QModelIndex const &, class QVariant const &, int)
+ ?emitRdsAvailabilityChanged@RadioUiEngine@@AAEX_N@Z @ 143 NONAME ; void RadioUiEngine::emitRdsAvailabilityChanged(bool)
+ ?frequencyMhz@RadioStation@@QBE?AVQString@@XZ @ 144 NONAME ; class QString RadioStation::frequencyMhz(void) const
+ ?isAntennaAttached@RadioUiEngine@@QBE_NXZ @ 145 NONAME ; bool RadioUiEngine::isAntennaAttached(void) const
+ ?qt_metacast@RadioStationModel@@UAEPAXPBD@Z @ 146 NONAME ; void * RadioStationModel::qt_metacast(char const *)
+ ?emitScanAndSaveFinished@RadioUiEngine@@AAEXXZ @ 147 NONAME ; void RadioUiEngine::emitScanAndSaveFinished(void)
+ ??0RadioStationFilterModel@@QAE@AAVRadioUiEngine@@PAVQObject@@@Z @ 148 NONAME ; RadioStationFilterModel::RadioStationFilterModel(class RadioUiEngine &, class QObject *)
+ ?filterAcceptsRow@RadioStationFilterModel@@EBE_NHABVQModelIndex@@@Z @ 149 NONAME ; bool RadioStationFilterModel::filterAcceptsRow(int, class QModelIndex const &) const
+ ?presetIndex@RadioStation@@QBEHXZ @ 150 NONAME ; int RadioStation::presetIndex(void) const
+ ?staticMetaObject@RadioStationModel@@2UQMetaObject@@B @ 151 NONAME ; struct QMetaObject const RadioStationModel::staticMetaObject
+ ?emitMuteChanged@RadioUiEngine@@AAEX_N@Z @ 152 NONAME ; void RadioUiEngine::emitMuteChanged(bool)
+ ?setDynamicPsText@RadioStation@@AAEXABVQString@@@Z @ 153 NONAME ; void RadioStation::setDynamicPsText(class QString const &)
+ ?removeByPresetIndex@RadioStationModel@@QAEXH@Z @ 154 NONAME ; void RadioStationModel::removeByPresetIndex(int)
+ ?isRenamed@RadioStation@@QBE_NXZ @ 155 NONAME ; bool RadioStation::isRenamed(void) const
+ ?stationAt@RadioStationModel@@QBE?AVRadioStation@@H@Z @ 156 NONAME ; class RadioStation RadioStationModel::stationAt(int) const
+ ?removeStation@RadioStationModel@@QAEXABVRadioStation@@@Z @ 157 NONAME ; void RadioStationModel::removeStation(class RadioStation const &)
+ ?metaObject@RadioUiEngine@@UBEPBUQMetaObject@@XZ @ 158 NONAME ; struct QMetaObject const * RadioUiEngine::metaObject(void) const
+ ?dynamicPsChanged@RadioStationModel@@IAEXABVRadioStation@@@Z @ 159 NONAME ; void RadioStationModel::dynamicPsChanged(class RadioStation const &)
+ ?setType@RadioStation@@QAEXV?$QFlags@W4TypeFlag@RadioStation@@@@@Z @ 160 NONAME ; void RadioStation::setType(class QFlags<enum RadioStation::TypeFlag>)
+ ?removeByFrequency@RadioStationModel@@QAEXI@Z @ 161 NONAME ; void RadioStationModel::removeByFrequency(unsigned int)
+ ?removeAll@RadioStationModel@@QAEXXZ @ 162 NONAME ; void RadioStationModel::removeAll(void)
+ ?isUsingLoudspeaker@RadioUiEngine@@QBE_NXZ @ 163 NONAME ; bool RadioUiEngine::isUsingLoudspeaker(void) const
+ ?findPresetIndex@RadioStationModel@@QAEHH@Z @ 164 NONAME ; int RadioStationModel::findPresetIndex(int)
+ ?getStaticMetaObject@RadioStationModel@@SAABUQMetaObject@@XZ @ 165 NONAME ; struct QMetaObject const & RadioStationModel::getStaticMetaObject(void)
+ ?metaObject@RadioStationModel@@UBEPBUQMetaObject@@XZ @ 166 NONAME ; struct QMetaObject const * RadioStationModel::metaObject(void) const
+ ?audioRouteChanged@RadioUiEngine@@IAEX_N@Z @ 167 NONAME ; void RadioUiEngine::audioRouteChanged(bool)
+ ?dynamicPsText@RadioStation@@QBE?AVQString@@XZ @ 168 NONAME ; class QString RadioStation::dynamicPsText(void) const
+ ?isFirstTimeStart@RadioUiEngine@@QAE_NXZ @ 169 NONAME ; bool RadioUiEngine::isFirstTimeStart(void)
+ ?setGenre@RadioStation@@AAEXH@Z @ 170 NONAME ; void RadioStation::setGenre(int)
+ ?scanFrequencyBand@RadioUiEngine@@QAEXXZ @ 171 NONAME ; void RadioUiEngine::scanFrequencyBand(void)
+ ?rowCount@RadioPlayLogModel@@UBEHABVQModelIndex@@@Z @ 172 NONAME ; int RadioPlayLogModel::rowCount(class QModelIndex const &) const
+ ?stationAdded@RadioStationModel@@IAEXABVRadioStation@@@Z @ 173 NONAME ; void RadioStationModel::stationAdded(class RadioStation const &)
+ ?data_ptr@RadioPlayLogItem@@QAEAAPAVRadioPlayLogItemPrivate@@XZ @ 174 NONAME ; class RadioPlayLogItemPrivate * & RadioPlayLogItem::data_ptr(void)
+ ?emitRadioStatusChanged@RadioUiEngine@@AAEX_N@Z @ 175 NONAME ; void RadioUiEngine::emitRadioStatusChanged(bool)
+ ??_ERadioUiEngine@@UAE@I@Z @ 176 NONAME ; RadioUiEngine::~RadioUiEngine(unsigned int)
+ ??0RadioStationModel@@QAE@AAVRadioUiEngine@@@Z @ 177 NONAME ; RadioStationModel::RadioStationModel(class RadioUiEngine &)
+ ?setRadioText@RadioStation@@AAEXABVQString@@@Z @ 178 NONAME ; void RadioStation::setRadioText(class QString const &)
+ ?changeFlags@RadioStation@@QBE?AV?$QFlags@W4ChangeFlag@RadioStation@@@@XZ @ 179 NONAME ; class QFlags<enum RadioStation::ChangeFlag> RadioStation::changeFlags(void) const
+ ?d_func@RadioStationModel@@AAEPAVRadioStationModelPrivate@@XZ @ 180 NONAME ; class RadioStationModelPrivate * RadioStationModel::d_func(void)
+ ?skipNext@RadioUiEngine@@QAEXXZ @ 181 NONAME ; void RadioUiEngine::skipNext(void)
+ ?setDetail@RadioStationModel@@QAEXV?$QFlags@W4DetailFlag@RadioStationModel@@@@@Z @ 182 NONAME ; void RadioStationModel::setDetail(class QFlags<enum RadioStationModel::DetailFlag>)
+ ?nameOrFrequency@RadioUiEngine@@SA?AVQString@@ABVRadioStation@@I@Z @ 183 NONAME ; class QString RadioUiEngine::nameOrFrequency(class RadioStation const &, unsigned int)
+ ?rowCount@RadioStationFilterModel@@UBEHABVQModelIndex@@@Z @ 184 NONAME ; int RadioStationFilterModel::rowCount(class QModelIndex const &) const
+ ??1RadioUiEngine@@UAE@XZ @ 185 NONAME ; RadioUiEngine::~RadioUiEngine(void)
+ ?findItem@RadioPlayLogModel@@AAEHABVQString@@0AAVRadioPlayLogItem@@@Z @ 186 NONAME ; int RadioPlayLogModel::findItem(class QString const &, class QString const &, class RadioPlayLogItem &)
+ ?initialize@RadioStationModel@@QAEXPAVRadioPresetStorage@@PAVRadioEngineWrapper@@@Z @ 187 NONAME ; void RadioStationModel::initialize(class RadioPresetStorage *, class RadioEngineWrapper *)
+ ?playLogModel@RadioUiEngine@@QAEAAVRadioPlayLogModel@@XZ @ 188 NONAME ; class RadioPlayLogModel & RadioUiEngine::playLogModel(void)
+ ?isType@RadioStation@@QBE_NV?$QFlags@W4TypeFlag@RadioStation@@@@@Z @ 189 NONAME ; bool RadioStation::isType(class QFlags<enum RadioStation::TypeFlag>) const
+ ?trUtf8@RadioPlayLogModel@@SA?AVQString@@PBD0H@Z @ 190 NONAME ; class QString RadioPlayLogModel::trUtf8(char const *, char const *, int)
+ ?setTypeFilter@RadioStationFilterModel@@QAEXV?$QFlags@W4TypeFlag@RadioStation@@@@@Z @ 191 NONAME ; void RadioStationFilterModel::setTypeFilter(class QFlags<enum RadioStation::TypeFlag>)
+ ?isDetached@RadioPlayLogItem@@QBE_NXZ @ 192 NONAME ; bool RadioPlayLogItem::isDetached(void) const
+ ?volumeChanged@RadioUiEngine@@IAEXH@Z @ 193 NONAME ; void RadioUiEngine::volumeChanged(int)
+ ??0RadioPlayLogItem@@QAE@XZ @ 194 NONAME ; RadioPlayLogItem::RadioPlayLogItem(void)
+ ?resetChangeFlags@RadioStation@@QAEXXZ @ 195 NONAME ; void RadioStation::resetChangeFlags(void)
+ ??_ERadioStationFilterModel@@UAE@I@Z @ 196 NONAME ; RadioStationFilterModel::~RadioStationFilterModel(unsigned int)
+ ?data_ptr@RadioStation@@QAEAAPAVRadioStationPrivate@@XZ @ 197 NONAME ; class RadioStationPrivate * & RadioStation::data_ptr(void)
+ ?artist@RadioPlayLogItem@@QBE?AVQString@@XZ @ 198 NONAME ; class QString RadioPlayLogItem::artist(void) const
+ ?callSignChar@RadioStation@@AAEDI@Z @ 199 NONAME ; char RadioStation::callSignChar(unsigned int)
+ ??_ERadioStation@@UAE@I@Z @ 200 NONAME ; RadioStation::~RadioStation(unsigned int)
+ ?title@RadioPlayLogItem@@QBE?AVQString@@XZ @ 201 NONAME ; class QString RadioPlayLogItem::title(void) const
+ ??0RadioStation@@AAE@HI@Z @ 202 NONAME ; RadioStation::RadioStation(int, unsigned int)
+ ?qt_metacall@RadioStationModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 203 NONAME ; int RadioStationModel::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?isDetached@RadioStation@@QBE_NXZ @ 204 NONAME ; bool RadioStation::isDetached(void) const
+ ?hasDataChanged@RadioStation@@QBE_NV?$QFlags@W4ChangeFlag@RadioStation@@@@@Z @ 205 NONAME ; bool RadioStation::hasDataChanged(class QFlags<enum RadioStation::ChangeFlag>) const
+ ?name@RadioStation@@QBE?AVQString@@XZ @ 206 NONAME ; class QString RadioStation::name(void) const
+ ?data@RadioStationModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 207 NONAME ; class QVariant RadioStationModel::data(class QModelIndex const &, int) const
+ ?getStaticMetaObject@RadioUiEngine@@SAABUQMetaObject@@XZ @ 208 NONAME ; struct QMetaObject const & RadioUiEngine::getStaticMetaObject(void)
+ ?launchSongRecognition@RadioUiEngine@@QAEXXZ @ 209 NONAME ; void RadioUiEngine::launchSongRecognition(void)
+ ?staticMetaObject@RadioPlayLogModel@@2UQMetaObject@@B @ 210 NONAME ; struct QMetaObject const RadioPlayLogModel::staticMetaObject
+ ?rowCount@RadioStationModel@@UBEHABVQModelIndex@@@Z @ 211 NONAME ; int RadioStationModel::rowCount(class QModelIndex const &) const
+ ?iterateCallSign@RadioStation@@AAE?AVQString@@HH@Z @ 212 NONAME ; class QString RadioStation::iterateCallSign(int, int)
+ ?toggleMute@RadioUiEngine@@QAEXXZ @ 213 NONAME ; void RadioUiEngine::toggleMute(void)
+ ??0RadioUiEngine@@QAE@PAVQObject@@@Z @ 214 NONAME ; RadioUiEngine::RadioUiEngine(class QObject *)
+ ?tr@RadioPlayLogModel@@SA?AVQString@@PBD0@Z @ 215 NONAME ; class QString RadioPlayLogModel::tr(char const *, char const *)
+ ?d_func@RadioUiEngine@@AAEPAVRadioUiEnginePrivate@@XZ @ 216 NONAME ; class RadioUiEnginePrivate * RadioUiEngine::d_func(void)
+ ?currentSongReset@RadioPlayLogModel@@IAEXXZ @ 217 NONAME ; void RadioPlayLogModel::currentSongReset(void)
+ ?minFrequency@RadioUiEngine@@QBEIXZ @ 218 NONAME ; unsigned int RadioUiEngine::minFrequency(void) const
+ ?setPresetIndex@RadioStation@@AAEXH@Z @ 219 NONAME ; void RadioStation::setPresetIndex(int)
+ ?setName@RadioStation@@AAEXABVQString@@@Z @ 220 NONAME ; void RadioStation::setName(class QString const &)
+ ?frequencyStepSize@RadioUiEngine@@QBEIXZ @ 221 NONAME ; unsigned int RadioUiEngine::frequencyStepSize(void) const
+ ?trUtf8@RadioStationModel@@SA?AVQString@@PBD0H@Z @ 222 NONAME ; class QString RadioStationModel::trUtf8(char const *, char const *, int)
+ ?radioTextReceived@RadioStationModel@@IAEXABVRadioStation@@@Z @ 223 NONAME ; void RadioStationModel::radioTextReceived(class RadioStation const &)
+ ?isFavorite@RadioStation@@QBE_NXZ @ 224 NONAME ; bool RadioStation::isFavorite(void) const
+ ?settings@RadioUiEngine@@QAEAAVRadioSettings@@XZ @ 225 NONAME ; class RadioSettings & RadioUiEngine::settings(void)
+ ?seekingStarted@RadioUiEngine@@IAEXH@Z @ 226 NONAME ; void RadioUiEngine::seekingStarted(int)
+ ?setFavorites@RadioStationModel@@QAEXABV?$QList@VQModelIndex@@@@@Z @ 227 NONAME ; void RadioStationModel::setFavorites(class QList<class QModelIndex> const &)
+ ??_ERadioStationModel@@UAE@I@Z @ 228 NONAME ; RadioStationModel::~RadioStationModel(unsigned int)
+ ??1RadioPlayLogItem@@UAE@XZ @ 229 NONAME ; RadioPlayLogItem::~RadioPlayLogItem(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/bwins/radiowidgetsu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,104 @@
+EXPORTS
+ ?initListView@RadioStationsView@@AAEXXZ @ 1 NONAME ; void RadioStationsView::initListView(void)
+ ?engineStatusChanged@RadioWizardView@@AAEX_N@Z @ 2 NONAME ; void RadioWizardView::engineStatusChanged(bool)
+ ?startScanning@RadioWizardView@@AAEXXZ @ 3 NONAME ; void RadioWizardView::startScanning(void)
+ ??1RadioWizardView@@UAE@XZ @ 4 NONAME ; RadioWizardView::~RadioWizardView(void)
+ ?initSecondarySoftkey@RadioTuningView@@EAEXXZ @ 5 NONAME ; void RadioTuningView::initSecondarySoftkey(void)
+ ?tr@RadioTuningView@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString RadioTuningView::tr(char const *, char const *, int)
+ ?qt_metacast@RadioWizardView@@UAEPAXPBD@Z @ 7 NONAME ; void * RadioWizardView::qt_metacast(char const *)
+ ?prepareToShowDialog@RadioMainWindow@@AAE?AV?$QSharedPointer@VHbView@@@@XZ @ 8 NONAME ; class QSharedPointer<class HbView> RadioMainWindow::prepareToShowDialog(void)
+ ?trUtf8@RadioPlayLogView@@SA?AVQString@@PBD0H@Z @ 9 NONAME ; class QString RadioPlayLogView::trUtf8(char const *, char const *, int)
+ ?headsetStatusChanged@RadioMainWindow@@AAEX_N@Z @ 10 NONAME ; void RadioMainWindow::headsetStatusChanged(bool)
+ ?init@RadioStationsView@@EAEXPAVRadioMainWindow@@PAVRadioStationModel@@@Z @ 11 NONAME ; void RadioStationsView::init(class RadioMainWindow *, class RadioStationModel *)
+ ??_ERadioWizardView@@UAE@I@Z @ 12 NONAME ; RadioWizardView::~RadioWizardView(unsigned int)
+ ??_ERadioStationsView@@UAE@I@Z @ 13 NONAME ; RadioStationsView::~RadioStationsView(unsigned int)
+ ?activateStationsView@RadioMainWindow@@QAEXXZ @ 14 NONAME ; void RadioMainWindow::activateStationsView(void)
+ ??0RadioWizardView@@QAE@PAVRadioXmlUiLoader@@@Z @ 15 NONAME ; RadioWizardView::RadioWizardView(class RadioXmlUiLoader *)
+ ?getStaticMetaObject@RadioMainWindow@@SAABUQMetaObject@@XZ @ 16 NONAME ; struct QMetaObject const & RadioMainWindow::getStaticMetaObject(void)
+ ??0RadioMainWindow@@QAE@PAVQWidget@@@Z @ 17 NONAME ; RadioMainWindow::RadioMainWindow(class QWidget *)
+ ?startScanAndSavePresets@RadioStationsView@@AAEXXZ @ 18 NONAME ; void RadioStationsView::startScanAndSavePresets(void)
+ ?activateWizardView@RadioMainWindow@@QAEXXZ @ 19 NONAME ; void RadioMainWindow::activateWizardView(void)
+ ?tr@RadioMainWindow@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString RadioMainWindow::tr(char const *, char const *, int)
+ ?isOfflineUsageAllowed@RadioMainWindow@@QAE_NXZ @ 21 NONAME ; bool RadioMainWindow::isOfflineUsageAllowed(void)
+ ?getStaticMetaObject@RadioStationsView@@SAABUQMetaObject@@XZ @ 22 NONAME ; struct QMetaObject const & RadioStationsView::getStaticMetaObject(void)
+ ??1RadioPlayLogView@@UAE@XZ @ 23 NONAME ; RadioPlayLogView::~RadioPlayLogView(void)
+ ?listItemClicked@RadioStationsView@@AAEXABVQModelIndex@@@Z @ 24 NONAME ; void RadioStationsView::listItemClicked(class QModelIndex const &)
+ ?qt_metacall@RadioPlayLogView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 25 NONAME ; int RadioPlayLogView::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?qt_metacall@RadioTuningView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 26 NONAME ; int RadioTuningView::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?qt_metacall@RadioMainWindow@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 27 NONAME ; int RadioMainWindow::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?staticMetaObject@RadioMainWindow@@2UQMetaObject@@B @ 28 NONAME ; struct QMetaObject const RadioMainWindow::staticMetaObject
+ ??_ERadioPlayLogView@@UAE@I@Z @ 29 NONAME ; RadioPlayLogView::~RadioPlayLogView(unsigned int)
+ ??1RadioTuningView@@UAE@XZ @ 30 NONAME ; RadioTuningView::~RadioTuningView(void)
+ ?updateHeading@RadioStationsView@@AAEXXZ @ 31 NONAME ; void RadioStationsView::updateHeading(void)
+ ?showEvent@RadioWizardView@@EAEXPAVQShowEvent@@@Z @ 32 NONAME ; void RadioWizardView::showEvent(class QShowEvent *)
+ ?metaObject@RadioWizardView@@UBEPBUQMetaObject@@XZ @ 33 NONAME ; struct QMetaObject const * RadioWizardView::metaObject(void) const
+ ??0RadioTuningView@@QAE@PAVRadioXmlUiLoader@@@Z @ 34 NONAME ; RadioTuningView::RadioTuningView(class RadioXmlUiLoader *)
+ ?init@RadioPlayLogView@@EAEXPAVRadioMainWindow@@PAVRadioStationModel@@@Z @ 35 NONAME ; void RadioPlayLogView::init(class RadioMainWindow *, class RadioStationModel *)
+ ?trUtf8@RadioTuningView@@SA?AVQString@@PBD0H@Z @ 36 NONAME ; class QString RadioTuningView::trUtf8(char const *, char const *, int)
+ ?tr@RadioStationsView@@SA?AVQString@@PBD0H@Z @ 37 NONAME ; class QString RadioStationsView::tr(char const *, char const *, int)
+ ?dialogShown@RadioMainWindow@@AAEXV?$QSharedPointer@VHbView@@@@@Z @ 38 NONAME ; void RadioMainWindow::dialogShown(class QSharedPointer<class HbView>)
+ ?saveSelectedAsFavorites@RadioWizardView@@AAEXXZ @ 39 NONAME ; void RadioWizardView::saveSelectedAsFavorites(void)
+ ?updateHeadsetStatus@RadioStationsView@@AAEX_N@Z @ 40 NONAME ; void RadioStationsView::updateHeadsetStatus(bool)
+ ?setNowPlayingIcon@RadioStationsView@@QAEXABVHbIcon@@@Z @ 41 NONAME ; void RadioStationsView::setNowPlayingIcon(class HbIcon const &)
+ ?tr@RadioStationsView@@SA?AVQString@@PBD0@Z @ 42 NONAME ; class QString RadioStationsView::tr(char const *, char const *)
+ ?trUtf8@RadioWizardView@@SA?AVQString@@PBD0@Z @ 43 NONAME ; class QString RadioWizardView::trUtf8(char const *, char const *)
+ ?trUtf8@RadioMainWindow@@SA?AVQString@@PBD0H@Z @ 44 NONAME ; class QString RadioMainWindow::trUtf8(char const *, char const *, int)
+ ?tr@RadioWizardView@@SA?AVQString@@PBD0@Z @ 45 NONAME ; class QString RadioWizardView::tr(char const *, char const *)
+ ?showErrorMessage@RadioMainWindow@@QAEXABVQString@@@Z @ 46 NONAME ; void RadioMainWindow::showErrorMessage(class QString const &)
+ ??0RadioStationsView@@QAE@PAVRadioXmlUiLoader@@@Z @ 47 NONAME ; RadioStationsView::RadioStationsView(class RadioXmlUiLoader *)
+ ?favoriteIcon@RadioStationsView@@QBE?AVHbIcon@@XZ @ 48 NONAME ; class HbIcon RadioStationsView::favoriteIcon(void) const
+ ?setFavoriteIcon@RadioStationsView@@QAEXABVHbIcon@@@Z @ 49 NONAME ; void RadioStationsView::setFavoriteIcon(class HbIcon const &)
+ ?showVolumeLevel@RadioMainWindow@@AAEXH@Z @ 50 NONAME ; void RadioMainWindow::showVolumeLevel(int)
+ ?trUtf8@RadioStationsView@@SA?AVQString@@PBD0H@Z @ 51 NONAME ; class QString RadioStationsView::trUtf8(char const *, char const *, int)
+ ?updateCurrentStation@RadioStationsView@@AAEXXZ @ 52 NONAME ; void RadioStationsView::updateCurrentStation(void)
+ ?activateView@RadioMainWindow@@AAEXAAV?$QPointer@VRadioViewBase@@@@ABVQString@@@Z @ 53 NONAME ; void RadioMainWindow::activateView(class QPointer<class RadioViewBase> &, class QString const &)
+ ?qt_metacast@RadioMainWindow@@UAEPAXPBD@Z @ 54 NONAME ; void * RadioMainWindow::qt_metacast(char const *)
+ ?tr@RadioPlayLogView@@SA?AVQString@@PBD0@Z @ 55 NONAME ; class QString RadioPlayLogView::tr(char const *, char const *)
+ ?getStaticMetaObject@RadioPlayLogView@@SAABUQMetaObject@@XZ @ 56 NONAME ; struct QMetaObject const & RadioPlayLogView::getStaticMetaObject(void)
+ ?init@RadioWizardView@@EAEXPAVRadioMainWindow@@PAVRadioStationModel@@@Z @ 57 NONAME ; void RadioWizardView::init(class RadioMainWindow *, class RadioStationModel *)
+ ??_ERadioMainWindow@@UAE@I@Z @ 58 NONAME ; RadioMainWindow::~RadioMainWindow(unsigned int)
+ ?trUtf8@RadioTuningView@@SA?AVQString@@PBD0@Z @ 59 NONAME ; class QString RadioTuningView::trUtf8(char const *, char const *)
+ ?tr@RadioWizardView@@SA?AVQString@@PBD0H@Z @ 60 NONAME ; class QString RadioWizardView::tr(char const *, char const *, int)
+ ?init@RadioTuningView@@EAEXPAVRadioMainWindow@@PAVRadioStationModel@@@Z @ 61 NONAME ; void RadioTuningView::init(class RadioMainWindow *, class RadioStationModel *)
+ ?tr@RadioTuningView@@SA?AVQString@@PBD0@Z @ 62 NONAME ; class QString RadioTuningView::tr(char const *, char const *)
+ ??_ERadioTuningView@@UAE@I@Z @ 63 NONAME ; RadioTuningView::~RadioTuningView(unsigned int)
+ ?staticMetaObject@RadioStationsView@@2UQMetaObject@@B @ 64 NONAME ; struct QMetaObject const RadioStationsView::staticMetaObject
+ ?nowPlayingIcon@RadioStationsView@@QBE?AVHbIcon@@XZ @ 65 NONAME ; class HbIcon RadioStationsView::nowPlayingIcon(void) const
+ ?uiEngine@RadioMainWindow@@QAEAAVRadioUiEngine@@XZ @ 66 NONAME ; class RadioUiEngine & RadioMainWindow::uiEngine(void)
+ ?qt_metacast@RadioTuningView@@UAEPAXPBD@Z @ 67 NONAME ; void * RadioTuningView::qt_metacast(char const *)
+ ?qt_metacall@RadioWizardView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 68 NONAME ; int RadioWizardView::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?staticMetaObject@RadioPlayLogView@@2UQMetaObject@@B @ 69 NONAME ; struct QMetaObject const RadioPlayLogView::staticMetaObject
+ ??0RadioPlayLogView@@QAE@PAVRadioXmlUiLoader@@@Z @ 70 NONAME ; RadioPlayLogView::RadioPlayLogView(class RadioXmlUiLoader *)
+ ??1RadioStationsView@@UAE@XZ @ 71 NONAME ; RadioStationsView::~RadioStationsView(void)
+ ?showEvent@RadioStationsView@@EAEXPAVQShowEvent@@@Z @ 72 NONAME ; void RadioStationsView::showEvent(class QShowEvent *)
+ ?getStaticMetaObject@RadioWizardView@@SAABUQMetaObject@@XZ @ 73 NONAME ; struct QMetaObject const & RadioWizardView::getStaticMetaObject(void)
+ ?qt_metacast@RadioStationsView@@UAEPAXPBD@Z @ 74 NONAME ; void * RadioStationsView::qt_metacast(char const *)
+ ?metaObject@RadioTuningView@@UBEPBUQMetaObject@@XZ @ 75 NONAME ; struct QMetaObject const * RadioTuningView::metaObject(void) const
+ ?trUtf8@RadioStationsView@@SA?AVQString@@PBD0@Z @ 76 NONAME ; class QString RadioStationsView::trUtf8(char const *, char const *)
+ ?tr@RadioPlayLogView@@SA?AVQString@@PBD0H@Z @ 77 NONAME ; class QString RadioPlayLogView::tr(char const *, char const *, int)
+ ?qt_metacast@RadioPlayLogView@@UAEPAXPBD@Z @ 78 NONAME ; void * RadioPlayLogView::qt_metacast(char const *)
+ ?qt_metacall@RadioStationsView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 79 NONAME ; int RadioStationsView::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?initSecondarySoftkey@RadioWizardView@@EAEXXZ @ 80 NONAME ; void RadioWizardView::initSecondarySoftkey(void)
+ ?staticMetaObject@RadioWizardView@@2UQMetaObject@@B @ 81 NONAME ; struct QMetaObject const RadioWizardView::staticMetaObject
+ ?updateControlVisibilities@RadioStationsView@@AAEXXZ @ 82 NONAME ; void RadioStationsView::updateControlVisibilities(void)
+ ?listItemLongPressed@RadioStationsView@@AAEXPAVHbAbstractViewItem@@ABVQPointF@@@Z @ 83 NONAME ; void RadioStationsView::listItemLongPressed(class HbAbstractViewItem *, class QPointF const &)
+ ?trUtf8@RadioPlayLogView@@SA?AVQString@@PBD0@Z @ 84 NONAME ; class QString RadioPlayLogView::trUtf8(char const *, char const *)
+ ?init@RadioMainWindow@@QAEXPAVRadioUiEngine@@@Z @ 85 NONAME ; void RadioMainWindow::init(class RadioUiEngine *)
+ ?activatePlayLogView@RadioMainWindow@@QAEXXZ @ 86 NONAME ; void RadioMainWindow::activatePlayLogView(void)
+ ?listItemClicked@RadioWizardView@@AAEXABVQModelIndex@@@Z @ 87 NONAME ; void RadioWizardView::listItemClicked(class QModelIndex const &)
+ ?setOrientation@RadioTuningView@@EAEXXZ @ 88 NONAME ; void RadioTuningView::setOrientation(void)
+ ?staticMetaObject@RadioTuningView@@2UQMetaObject@@B @ 89 NONAME ; struct QMetaObject const RadioTuningView::staticMetaObject
+ ??1RadioMainWindow@@UAE@XZ @ 90 NONAME ; RadioMainWindow::~RadioMainWindow(void)
+ ?metaObject@RadioMainWindow@@UBEPBUQMetaObject@@XZ @ 91 NONAME ; struct QMetaObject const * RadioMainWindow::metaObject(void) const
+ ?deckButtonPressed@RadioStationsView@@AAEXXZ @ 92 NONAME ; void RadioStationsView::deckButtonPressed(void)
+ ?metaObject@RadioPlayLogView@@UBEPBUQMetaObject@@XZ @ 93 NONAME ; struct QMetaObject const * RadioPlayLogView::metaObject(void) const
+ ?trUtf8@RadioMainWindow@@SA?AVQString@@PBD0@Z @ 94 NONAME ; class QString RadioMainWindow::trUtf8(char const *, char const *)
+ ?getStaticMetaObject@RadioTuningView@@SAABUQMetaObject@@XZ @ 95 NONAME ; struct QMetaObject const & RadioTuningView::getStaticMetaObject(void)
+ ?trUtf8@RadioWizardView@@SA?AVQString@@PBD0H@Z @ 96 NONAME ; class QString RadioWizardView::trUtf8(char const *, char const *, int)
+ ?activateTuningView@RadioMainWindow@@QAEXXZ @ 97 NONAME ; void RadioMainWindow::activateTuningView(void)
+ ?tr@RadioMainWindow@@SA?AVQString@@PBD0@Z @ 98 NONAME ; class QString RadioMainWindow::tr(char const *, char const *)
+ ?metaObject@RadioStationsView@@UBEPBUQMetaObject@@XZ @ 99 NONAME ; struct QMetaObject const * RadioStationsView::metaObject(void) const
+ ?orientationSection@RadioMainWindow@@QAE?AVQString@@XZ @ 100 NONAME ; class QString RadioMainWindow::orientationSection(void)
+ ?toggleFavorite@RadioTuningView@@AAEXXZ @ 101 NONAME ; void RadioTuningView::toggleFavorite(void)
+ ?updateOrientation@RadioMainWindow@@AAEXW4Orientation@Qt@@@Z @ 102 NONAME ; void RadioMainWindow::updateOrientation(enum Qt::Orientation)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/eabi/radioenginewrapperu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,36 @@
+EXPORTS
+ _ZN11RadioLogger18initCombinedLoggerEv @ 1 NONAME
+ _ZN11RadioLogger21releaseCombinedLoggerEv @ 2 NONAME
+ _ZN11RadioLogger6logMsgEPKcNS_4ModeE @ 3 NONAME
+ _ZN13RadioSettings16isFirstTimeStartEv @ 4 NONAME
+ _ZN13RadioSettings16setShowFavoritesEb @ 5 NONAME
+ _ZN13RadioSettings19toggleShowFavoritesEv @ 6 NONAME
+ _ZN13RadioSettingsC1Ev @ 7 NONAME
+ _ZN13RadioSettingsC2Ev @ 8 NONAME
+ _ZN18RadioEngineWrapper10toggleMuteEv @ 9 NONAME
+ _ZN18RadioEngineWrapper12startSeekingEN7Seeking9DirectionE @ 10 NONAME
+ _ZN18RadioEngineWrapper13tuneFrequencyEji @ 11 NONAME
+ _ZN18RadioEngineWrapper13tuneWithDelayEji @ 12 NONAME
+ _ZN18RadioEngineWrapper16isFrequencyValidEj @ 13 NONAME
+ _ZN18RadioEngineWrapper16toggleAudioRouteEv @ 14 NONAME
+ _ZN18RadioEngineWrapper17scanFrequencyBandEv @ 15 NONAME
+ _ZN18RadioEngineWrapper19isEngineConstructedEv @ 16 NONAME
+ _ZN18RadioEngineWrapper23cancelScanFrequencyBandEv @ 17 NONAME
+ _ZN18RadioEngineWrapper8settingsEv @ 18 NONAME
+ _ZN18RadioEngineWrapper9setVolumeEi @ 19 NONAME
+ _ZN18RadioEngineWrapperC1ER21RadioStationHandlerIfR26RadioEngineWrapperObserver @ 20 NONAME
+ _ZN18RadioEngineWrapperC2ER21RadioStationHandlerIfR26RadioEngineWrapperObserver @ 21 NONAME
+ _ZN18RadioEngineWrapperD1Ev @ 22 NONAME
+ _ZN18RadioEngineWrapperD2Ev @ 23 NONAME
+ _ZNK13RadioSettings13showFavoritesEv @ 24 NONAME
+ _ZNK18RadioEngineWrapper10isScanningEv @ 25 NONAME
+ _ZNK18RadioEngineWrapper12maxFrequencyEv @ 26 NONAME
+ _ZNK18RadioEngineWrapper12minFrequencyEv @ 27 NONAME
+ _ZNK18RadioEngineWrapper16currentFrequencyEv @ 28 NONAME
+ _ZNK18RadioEngineWrapper17frequencyStepSizeEv @ 29 NONAME
+ _ZNK18RadioEngineWrapper17isAntennaAttachedEv @ 30 NONAME
+ _ZNK18RadioEngineWrapper18isUsingLoudspeakerEv @ 31 NONAME
+ _ZNK18RadioEngineWrapper6regionEv @ 32 NONAME
+ _ZNK18RadioEngineWrapper7isMutedEv @ 33 NONAME
+ _ZNK18RadioEngineWrapper9isRadioOnEv @ 34 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/eabi/radiopresetstorageu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+ _ZN18RadioPresetStorage10readPresetEiR14RadioStationIf @ 1 NONAME
+ _ZN18RadioPresetStorage10savePresetERK14RadioStationIf @ 2 NONAME
+ _ZN18RadioPresetStorage12deletePresetEi @ 3 NONAME
+ _ZN18RadioPresetStorageC1Ev @ 4 NONAME
+ _ZN18RadioPresetStorageC2Ev @ 5 NONAME
+ _ZN18RadioPresetStorageD1Ev @ 6 NONAME
+ _ZN18RadioPresetStorageD2Ev @ 7 NONAME
+ _ZNK18RadioPresetStorage10nextPresetEi @ 8 NONAME
+ _ZNK18RadioPresetStorage11firstPresetEv @ 9 NONAME
+ _ZNK18RadioPresetStorage11presetCountEv @ 10 NONAME
+ _ZNK18RadioPresetStorage18maxNumberOfPresetsEv @ 11 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/eabi/radiouiengineu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,239 @@
+EXPORTS
+ _ZN12RadioStation11setFavoriteEb @ 1 NONAME
+ _ZN12RadioStation12callSignCharEj @ 2 NONAME
+ _ZN12RadioStation12setFrequencyEj @ 3 NONAME
+ _ZN12RadioStation12setRadioTextERK7QString @ 4 NONAME
+ _ZN12RadioStation14callSignStringEj @ 5 NONAME
+ _ZN12RadioStation14parseFrequencyEj @ 6 NONAME
+ _ZN12RadioStation14setChangeFlagsE6QFlagsINS_10ChangeFlagEE @ 7 NONAME
+ _ZN12RadioStation14setPresetIndexEi @ 8 NONAME
+ _ZN12RadioStation15iterateCallSignEii @ 9 NONAME
+ _ZN12RadioStation16piCodeToCallSignEj @ 10 NONAME
+ _ZN12RadioStation16resetChangeFlagsEv @ 11 NONAME
+ _ZN12RadioStation16setDynamicPsTextERK7QString @ 12 NONAME
+ _ZN12RadioStation16setRadioTextPlusEiRK7QString @ 13 NONAME
+ _ZN12RadioStation18setUserDefinedNameERK7QString @ 14 NONAME
+ _ZN12RadioStation23decrementReferenceCountEv @ 15 NONAME
+ _ZN12RadioStation5resetEv @ 16 NONAME
+ _ZN12RadioStation6detachEv @ 17 NONAME
+ _ZN12RadioStation6setUrlERK7QString @ 18 NONAME
+ _ZN12RadioStation7setNameERK7QString @ 19 NONAME
+ _ZN12RadioStation7setTypeE6QFlagsINS_8TypeFlagEE @ 20 NONAME
+ _ZN12RadioStation8setGenreEi @ 21 NONAME
+ _ZN12RadioStation9setPiCodeEiN11RadioRegion6RegionE @ 22 NONAME
+ _ZN12RadioStation9setPsTypeE6QFlagsINS_10PsTypeFlagEE @ 23 NONAME
+ _ZN12RadioStation9unsetTypeE6QFlagsINS_8TypeFlagEE @ 24 NONAME
+ _ZN12RadioStationC1ERKS_ @ 25 NONAME
+ _ZN12RadioStationC1Eij @ 26 NONAME
+ _ZN12RadioStationC1Ev @ 27 NONAME
+ _ZN12RadioStationC2ERKS_ @ 28 NONAME
+ _ZN12RadioStationC2Eij @ 29 NONAME
+ _ZN12RadioStationC2Ev @ 30 NONAME
+ _ZN12RadioStationD0Ev @ 31 NONAME
+ _ZN12RadioStationD1Ev @ 32 NONAME
+ _ZN12RadioStationD2Ev @ 33 NONAME
+ _ZN12RadioStationaSERKS_ @ 34 NONAME
+ _ZN13RadioUiEngine10startRadioEv @ 35 NONAME
+ _ZN13RadioUiEngine10toggleMuteEv @ 36 NONAME
+ _ZN13RadioUiEngine10tunePresetEi @ 37 NONAME
+ _ZN13RadioUiEngine11muteChangedEb @ 38 NONAME
+ _ZN13RadioUiEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 39 NONAME
+ _ZN13RadioUiEngine11qt_metacastEPKc @ 40 NONAME
+ _ZN13RadioUiEngine12playLogModelEv @ 41 NONAME
+ _ZN13RadioUiEngine12skipPreviousEv @ 42 NONAME
+ _ZN13RadioUiEngine13genreToStringEi @ 43 NONAME
+ _ZN13RadioUiEngine13tuneFrequencyEji @ 44 NONAME
+ _ZN13RadioUiEngine13tuneWithDelayEji @ 45 NONAME
+ _ZN13RadioUiEngine13volumeChangedEi @ 46 NONAME
+ _ZN13RadioUiEngine14parseFrequencyEj @ 47 NONAME
+ _ZN13RadioUiEngine14seekingStartedEi @ 48 NONAME
+ _ZN13RadioUiEngine15emitMuteChangedEb @ 49 NONAME
+ _ZN13RadioUiEngine15nameOrFrequencyERK12RadioStationj @ 50 NONAME
+ _ZN13RadioUiEngine15stationsInRangeEjj @ 51 NONAME
+ _ZN13RadioUiEngine16isFirstTimeStartEv @ 52 NONAME
+ _ZN13RadioUiEngine16isOfflineProfileEv @ 53 NONAME
+ _ZN13RadioUiEngine16staticMetaObjectE @ 54 NONAME DATA 16
+ _ZN13RadioUiEngine16toggleAudioRouteEv @ 55 NONAME
+ _ZN13RadioUiEngine16tunedToFrequencyEji @ 56 NONAME
+ _ZN13RadioUiEngine17addRecognizedSongERK7QStringS2_ @ 57 NONAME
+ _ZN13RadioUiEngine17audioRouteChangedEb @ 58 NONAME
+ _ZN13RadioUiEngine17emitVolumeChangedEi @ 59 NONAME
+ _ZN13RadioUiEngine17scanFrequencyBandEv @ 60 NONAME
+ _ZN13RadioUiEngine18emitSeekingStartedEN7Seeking9DirectionE @ 61 NONAME
+ _ZN13RadioUiEngine18radioStatusChangedEb @ 62 NONAME
+ _ZN13RadioUiEngine19getStaticMetaObjectEv @ 63 NONAME
+ _ZN13RadioUiEngine19scanAndSaveFinishedEv @ 64 NONAME
+ _ZN13RadioUiEngine20createNewFilterModelEP7QObject @ 65 NONAME
+ _ZN13RadioUiEngine20emitTunedToFrequencyEji @ 66 NONAME
+ _ZN13RadioUiEngine20headsetStatusChangedEb @ 67 NONAME
+ _ZN13RadioUiEngine21emitAudioRouteChangedEb @ 68 NONAME
+ _ZN13RadioUiEngine21launchSongRecognitionEv @ 69 NONAME
+ _ZN13RadioUiEngine22emitRadioStatusChangedEb @ 70 NONAME
+ _ZN13RadioUiEngine22rdsAvailabilityChangedEb @ 71 NONAME
+ _ZN13RadioUiEngine23cancelScanFrequencyBandEv @ 72 NONAME
+ _ZN13RadioUiEngine23emitScanAndSaveFinishedEv @ 73 NONAME
+ _ZN13RadioUiEngine24emitheadsetStatusChangedEb @ 74 NONAME
+ _ZN13RadioUiEngine26emitRdsAvailabilityChangedEb @ 75 NONAME
+ _ZN13RadioUiEngine29isSongRecognitionAppAvailableEv @ 76 NONAME
+ _ZN13RadioUiEngine5modelEv @ 77 NONAME
+ _ZN13RadioUiEngine6seekUpEv @ 78 NONAME
+ _ZN13RadioUiEngine8seekDownEv @ 79 NONAME
+ _ZN13RadioUiEngine8settingsEv @ 80 NONAME
+ _ZN13RadioUiEngine8skipNextEv @ 81 NONAME
+ _ZN13RadioUiEngine9setVolumeEi @ 82 NONAME
+ _ZN13RadioUiEngineC1EP7QObject @ 83 NONAME
+ _ZN13RadioUiEngineC2EP7QObject @ 84 NONAME
+ _ZN13RadioUiEngineD0Ev @ 85 NONAME
+ _ZN13RadioUiEngineD1Ev @ 86 NONAME
+ _ZN13RadioUiEngineD2Ev @ 87 NONAME
+ _ZN16RadioPlayLogItem11setFavoriteEv @ 88 NONAME
+ _ZN16RadioPlayLogItem17increasePlayCountEv @ 89 NONAME
+ _ZN16RadioPlayLogItem23decrementReferenceCountEv @ 90 NONAME
+ _ZN16RadioPlayLogItem6detachEv @ 91 NONAME
+ _ZN16RadioPlayLogItem8setTitleERK7QString @ 92 NONAME
+ _ZN16RadioPlayLogItem9setArtistERK7QString @ 93 NONAME
+ _ZN16RadioPlayLogItemC1ERK7QStringS2_ @ 94 NONAME
+ _ZN16RadioPlayLogItemC1ERKS_ @ 95 NONAME
+ _ZN16RadioPlayLogItemC1Ev @ 96 NONAME
+ _ZN16RadioPlayLogItemC2ERK7QStringS2_ @ 97 NONAME
+ _ZN16RadioPlayLogItemC2ERKS_ @ 98 NONAME
+ _ZN16RadioPlayLogItemC2Ev @ 99 NONAME
+ _ZN16RadioPlayLogItemD0Ev @ 100 NONAME
+ _ZN16RadioPlayLogItemD1Ev @ 101 NONAME
+ _ZN16RadioPlayLogItemD2Ev @ 102 NONAME
+ _ZN16RadioPlayLogItemaSERKS_ @ 103 NONAME
+ _ZN17RadioPlayLogModel10updateItemEiRK16RadioPlayLogItemb @ 104 NONAME
+ _ZN17RadioPlayLogModel11qt_metacallEN11QMetaObject4CallEiPPv @ 105 NONAME
+ _ZN17RadioPlayLogModel11qt_metacastEPKc @ 106 NONAME
+ _ZN17RadioPlayLogModel11setFavoriteEv @ 107 NONAME
+ _ZN17RadioPlayLogModel16addRadioTextPlusEiRK7QString @ 108 NONAME
+ _ZN17RadioPlayLogModel16currentSongResetEv @ 109 NONAME
+ _ZN17RadioPlayLogModel16resetCurrentSongEv @ 110 NONAME
+ _ZN17RadioPlayLogModel16staticMetaObjectE @ 111 NONAME DATA 16
+ _ZN17RadioPlayLogModel18clearRadioTextPlusEv @ 112 NONAME
+ _ZN17RadioPlayLogModel19getStaticMetaObjectEv @ 113 NONAME
+ _ZN17RadioPlayLogModel7addItemERK7QStringS2_ @ 114 NONAME
+ _ZN17RadioPlayLogModel7setDataERK11QModelIndexRK8QVarianti @ 115 NONAME
+ _ZN17RadioPlayLogModel8findItemERK7QStringS2_R16RadioPlayLogItem @ 116 NONAME
+ _ZN17RadioPlayLogModel9itemAddedEv @ 117 NONAME
+ _ZN17RadioPlayLogModel9removeAllEv @ 118 NONAME
+ _ZN17RadioPlayLogModelC1ER13RadioUiEngine @ 119 NONAME
+ _ZN17RadioPlayLogModelC2ER13RadioUiEngine @ 120 NONAME
+ _ZN17RadioPlayLogModelD0Ev @ 121 NONAME
+ _ZN17RadioPlayLogModelD1Ev @ 122 NONAME
+ _ZN17RadioPlayLogModelD2Ev @ 123 NONAME
+ _ZN17RadioStationModel10addStationERK12RadioStation @ 124 NONAME
+ _ZN17RadioStationModel10initializeEP18RadioPresetStorageP18RadioEngineWrapper @ 125 NONAME
+ _ZN17RadioStationModel11qt_metacallEN11QMetaObject4CallEiPPv @ 126 NONAME
+ _ZN17RadioStationModel11qt_metacastEPKc @ 127 NONAME
+ _ZN17RadioStationModel11saveStationER12RadioStation @ 128 NONAME
+ _ZN17RadioStationModel12setFavoritesERK5QListI11QModelIndexE @ 129 NONAME
+ _ZN17RadioStationModel12stationAddedERK12RadioStation @ 130 NONAME
+ _ZN17RadioStationModel13findFrequencyEjR12RadioStation @ 131 NONAME
+ _ZN17RadioStationModel13removeStationERK12RadioStation @ 132 NONAME
+ _ZN17RadioStationModel13renameStationEiRK7QString @ 133 NONAME
+ _ZN17RadioStationModel14currentStationEv @ 134 NONAME
+ _ZN17RadioStationModel15emitDataChangedERK12RadioStation @ 135 NONAME
+ _ZN17RadioStationModel15favoriteChangedERK12RadioStation @ 136 NONAME
+ _ZN17RadioStationModel15findPresetIndexEi @ 137 NONAME
+ _ZN17RadioStationModel15findPresetIndexEiR12RadioStation @ 138 NONAME
+ _ZN17RadioStationModel15stationsInRangeEjj @ 139 NONAME
+ _ZN17RadioStationModel16dynamicPsChangedERK12RadioStation @ 140 NONAME
+ _ZN17RadioStationModel16staticMetaObjectE @ 141 NONAME DATA 16
+ _ZN17RadioStationModel16stationHandlerIfEv @ 142 NONAME
+ _ZN17RadioStationModel17emitChangeSignalsERK12RadioStation6QFlagsINS0_10ChangeFlagEE @ 143 NONAME
+ _ZN17RadioStationModel17radioTextReceivedERK12RadioStation @ 144 NONAME
+ _ZN17RadioStationModel17removeByFrequencyEj @ 145 NONAME
+ _ZN17RadioStationModel18findCurrentStationEj @ 146 NONAME
+ _ZN17RadioStationModel18stationDataChangedERK12RadioStation @ 147 NONAME
+ _ZN17RadioStationModel19dynamicPsCheckEndedEv @ 148 NONAME
+ _ZN17RadioStationModel19getStaticMetaObjectEv @ 149 NONAME
+ _ZN17RadioStationModel19removeByPresetIndexEi @ 150 NONAME
+ _ZN17RadioStationModel19setFavoriteByPresetEib @ 151 NONAME
+ _ZN17RadioStationModel21findUnusedPresetIndexEv @ 152 NONAME
+ _ZN17RadioStationModel22setFavoriteByFrequencyEjb @ 153 NONAME
+ _ZN17RadioStationModel23modelIndexFromFrequencyEj @ 154 NONAME
+ _ZN17RadioStationModel7setDataERK11QModelIndexRK8QVarianti @ 155 NONAME
+ _ZN17RadioStationModel8setIconsERK5QIconS2_ @ 156 NONAME
+ _ZN17RadioStationModel9removeAllEv @ 157 NONAME
+ _ZN17RadioStationModel9setDetailE6QFlagsINS_10DetailFlagEE @ 158 NONAME
+ _ZN17RadioStationModelC1ER13RadioUiEngine @ 159 NONAME
+ _ZN17RadioStationModelC2ER13RadioUiEngine @ 160 NONAME
+ _ZN17RadioStationModelD0Ev @ 161 NONAME
+ _ZN17RadioStationModelD1Ev @ 162 NONAME
+ _ZN17RadioStationModelD2Ev @ 163 NONAME
+ _ZN23RadioStationFilterModel13setTypeFilterE6QFlagsIN12RadioStation8TypeFlagEE @ 164 NONAME
+ _ZN23RadioStationFilterModel23modelIndexFromFrequencyEj @ 165 NONAME
+ _ZN23RadioStationFilterModel9setCyclicEb @ 166 NONAME
+ _ZN23RadioStationFilterModelC1ER13RadioUiEngineP7QObject @ 167 NONAME
+ _ZN23RadioStationFilterModelC2ER13RadioUiEngineP7QObject @ 168 NONAME
+ _ZN23RadioStationFilterModelD0Ev @ 169 NONAME
+ _ZN23RadioStationFilterModelD1Ev @ 170 NONAME
+ _ZN23RadioStationFilterModelD2Ev @ 171 NONAME
+ _ZNK12RadioStation10hasChangedEv @ 172 NONAME
+ _ZNK12RadioStation10isDetachedEv @ 173 NONAME
+ _ZNK12RadioStation10isFavoriteEv @ 174 NONAME
+ _ZNK12RadioStation11changeFlagsEv @ 175 NONAME
+ _ZNK12RadioStation11presetIndexEv @ 176 NONAME
+ _ZNK12RadioStation12frequencyMhzEv @ 177 NONAME
+ _ZNK12RadioStation13dynamicPsTextEv @ 178 NONAME
+ _ZNK12RadioStation14hasDataChangedE6QFlagsINS_10ChangeFlagEE @ 179 NONAME
+ _ZNK12RadioStation3urlEv @ 180 NONAME
+ _ZNK12RadioStation4nameEv @ 181 NONAME
+ _ZNK12RadioStation5genreEv @ 182 NONAME
+ _ZNK12RadioStation6hasRdsEv @ 183 NONAME
+ _ZNK12RadioStation6isTypeE6QFlagsINS_8TypeFlagEE @ 184 NONAME
+ _ZNK12RadioStation6psTypeEv @ 185 NONAME
+ _ZNK12RadioStation7isValidEv @ 186 NONAME
+ _ZNK12RadioStation9frequencyEv @ 187 NONAME
+ _ZNK12RadioStation9hasPiCodeEv @ 188 NONAME
+ _ZNK12RadioStation9isRenamedEv @ 189 NONAME
+ _ZNK12RadioStation9radioTextEv @ 190 NONAME
+ _ZNK13RadioUiEngine10isScanningEv @ 191 NONAME
+ _ZNK13RadioUiEngine10metaObjectEv @ 192 NONAME
+ _ZNK13RadioUiEngine12maxFrequencyEv @ 193 NONAME
+ _ZNK13RadioUiEngine12minFrequencyEv @ 194 NONAME
+ _ZNK13RadioUiEngine16currentFrequencyEv @ 195 NONAME
+ _ZNK13RadioUiEngine17frequencyStepSizeEv @ 196 NONAME
+ _ZNK13RadioUiEngine17isAntennaAttachedEv @ 197 NONAME
+ _ZNK13RadioUiEngine18isUsingLoudspeakerEv @ 198 NONAME
+ _ZNK13RadioUiEngine6regionEv @ 199 NONAME
+ _ZNK13RadioUiEngine7isMutedEv @ 200 NONAME
+ _ZNK13RadioUiEngine9isRadioOnEv @ 201 NONAME
+ _ZNK16RadioPlayLogItem10isDetachedEv @ 202 NONAME
+ _ZNK16RadioPlayLogItem10isFavoriteEv @ 203 NONAME
+ _ZNK16RadioPlayLogItem5titleEv @ 204 NONAME
+ _ZNK16RadioPlayLogItem6artistEv @ 205 NONAME
+ _ZNK16RadioPlayLogItem9playCountEv @ 206 NONAME
+ _ZNK17RadioPlayLogModel10metaObjectEv @ 207 NONAME
+ _ZNK17RadioPlayLogModel23isCurrentSongRecognizedEv @ 208 NONAME
+ _ZNK17RadioPlayLogModel4dataERK11QModelIndexi @ 209 NONAME
+ _ZNK17RadioPlayLogModel5flagsERK11QModelIndex @ 210 NONAME
+ _ZNK17RadioPlayLogModel8rowCountERK11QModelIndex @ 211 NONAME
+ _ZNK17RadioStationModel10metaObjectEv @ 212 NONAME
+ _ZNK17RadioStationModel14currentStationEv @ 213 NONAME
+ _ZNK17RadioStationModel4dataERK11QModelIndexi @ 214 NONAME
+ _ZNK17RadioStationModel4listEv @ 215 NONAME
+ _ZNK17RadioStationModel5flagsERK11QModelIndex @ 216 NONAME
+ _ZNK17RadioStationModel8rowCountERK11QModelIndex @ 217 NONAME
+ _ZNK17RadioStationModel9stationAtEi @ 218 NONAME
+ _ZNK23RadioStationFilterModel16filterAcceptsRowEiRK11QModelIndex @ 219 NONAME
+ _ZNK23RadioStationFilterModel4dataERK11QModelIndexi @ 220 NONAME
+ _ZNK23RadioStationFilterModel5indexEiiRK11QModelIndex @ 221 NONAME
+ _ZNK23RadioStationFilterModel7isEqualERK11QModelIndexS2_ @ 222 NONAME
+ _ZNK23RadioStationFilterModel8rowCountERK11QModelIndex @ 223 NONAME
+ _ZNK23RadioStationFilterModel9hasLoopedERK11QModelIndex @ 224 NONAME
+ _ZNK23RadioStationFilterModel9realIndexERK11QModelIndex @ 225 NONAME
+ _ZTI12RadioStation @ 226 NONAME
+ _ZTI13RadioUiEngine @ 227 NONAME
+ _ZTI16RadioPlayLogItem @ 228 NONAME
+ _ZTI17RadioPlayLogModel @ 229 NONAME
+ _ZTI17RadioStationModel @ 230 NONAME
+ _ZTI23RadioStationFilterModel @ 231 NONAME
+ _ZTV12RadioStation @ 232 NONAME
+ _ZTV13RadioUiEngine @ 233 NONAME
+ _ZTV16RadioPlayLogItem @ 234 NONAME
+ _ZTV17RadioPlayLogModel @ 235 NONAME
+ _ZTV17RadioStationModel @ 236 NONAME
+ _ZTV23RadioStationFilterModel @ 237 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/eabi/radiowidgetsu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,94 @@
+EXPORTS
+ _ZN15RadioMainWindow11dialogShownE14QSharedPointerI6HbViewE @ 1 NONAME
+ _ZN15RadioMainWindow11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+ _ZN15RadioMainWindow11qt_metacastEPKc @ 3 NONAME
+ _ZN15RadioMainWindow12activateViewER8QPointerI13RadioViewBaseERK7QString @ 4 NONAME
+ _ZN15RadioMainWindow15showVolumeLevelEi @ 5 NONAME
+ _ZN15RadioMainWindow16showErrorMessageERK7QString @ 6 NONAME
+ _ZN15RadioMainWindow16staticMetaObjectE @ 7 NONAME DATA 16
+ _ZN15RadioMainWindow17updateOrientationEN2Qt11OrientationE @ 8 NONAME
+ _ZN15RadioMainWindow18activateTuningViewEv @ 9 NONAME
+ _ZN15RadioMainWindow18activateWizardViewEv @ 10 NONAME
+ _ZN15RadioMainWindow18orientationSectionEv @ 11 NONAME
+ _ZN15RadioMainWindow19activatePlayLogViewEv @ 12 NONAME
+ _ZN15RadioMainWindow19getStaticMetaObjectEv @ 13 NONAME
+ _ZN15RadioMainWindow19prepareToShowDialogEv @ 14 NONAME
+ _ZN15RadioMainWindow20activateStationsViewEv @ 15 NONAME
+ _ZN15RadioMainWindow20headsetStatusChangedEb @ 16 NONAME
+ _ZN15RadioMainWindow21isOfflineUsageAllowedEv @ 17 NONAME
+ _ZN15RadioMainWindow4initEP13RadioUiEngine @ 18 NONAME
+ _ZN15RadioMainWindow8uiEngineEv @ 19 NONAME
+ _ZN15RadioMainWindowC1EP7QWidget @ 20 NONAME
+ _ZN15RadioMainWindowC2EP7QWidget @ 21 NONAME
+ _ZN15RadioMainWindowD0Ev @ 22 NONAME
+ _ZN15RadioMainWindowD1Ev @ 23 NONAME
+ _ZN15RadioMainWindowD2Ev @ 24 NONAME
+ _ZN15RadioTuningView11qt_metacallEN11QMetaObject4CallEiPPv @ 25 NONAME
+ _ZN15RadioTuningView11qt_metacastEPKc @ 26 NONAME
+ _ZN15RadioTuningView14setOrientationEv @ 27 NONAME
+ _ZN15RadioTuningView14toggleFavoriteEv @ 28 NONAME
+ _ZN15RadioTuningView16staticMetaObjectE @ 29 NONAME DATA 16
+ _ZN15RadioTuningView19getStaticMetaObjectEv @ 30 NONAME
+ _ZN15RadioTuningView20initSecondarySoftkeyEv @ 31 NONAME
+ _ZN15RadioTuningView4initEP15RadioMainWindowP17RadioStationModel @ 32 NONAME
+ _ZN15RadioTuningViewC1EP16RadioXmlUiLoader @ 33 NONAME
+ _ZN15RadioTuningViewC2EP16RadioXmlUiLoader @ 34 NONAME
+ _ZN15RadioWizardView11qt_metacallEN11QMetaObject4CallEiPPv @ 35 NONAME
+ _ZN15RadioWizardView11qt_metacastEPKc @ 36 NONAME
+ _ZN15RadioWizardView13startScanningEv @ 37 NONAME
+ _ZN15RadioWizardView15listItemClickedERK11QModelIndex @ 38 NONAME
+ _ZN15RadioWizardView16staticMetaObjectE @ 39 NONAME DATA 16
+ _ZN15RadioWizardView19engineStatusChangedEb @ 40 NONAME
+ _ZN15RadioWizardView19getStaticMetaObjectEv @ 41 NONAME
+ _ZN15RadioWizardView20initSecondarySoftkeyEv @ 42 NONAME
+ _ZN15RadioWizardView23saveSelectedAsFavoritesEv @ 43 NONAME
+ _ZN15RadioWizardView4initEP15RadioMainWindowP17RadioStationModel @ 44 NONAME
+ _ZN15RadioWizardView9showEventEP10QShowEvent @ 45 NONAME
+ _ZN15RadioWizardViewC1EP16RadioXmlUiLoader @ 46 NONAME
+ _ZN15RadioWizardViewC2EP16RadioXmlUiLoader @ 47 NONAME
+ _ZN16RadioPlayLogView11qt_metacallEN11QMetaObject4CallEiPPv @ 48 NONAME
+ _ZN16RadioPlayLogView11qt_metacastEPKc @ 49 NONAME
+ _ZN16RadioPlayLogView16staticMetaObjectE @ 50 NONAME DATA 16
+ _ZN16RadioPlayLogView19getStaticMetaObjectEv @ 51 NONAME
+ _ZN16RadioPlayLogView4initEP15RadioMainWindowP17RadioStationModel @ 52 NONAME
+ _ZN16RadioPlayLogViewC1EP16RadioXmlUiLoader @ 53 NONAME
+ _ZN16RadioPlayLogViewC2EP16RadioXmlUiLoader @ 54 NONAME
+ _ZN17RadioStationsView11qt_metacallEN11QMetaObject4CallEiPPv @ 55 NONAME
+ _ZN17RadioStationsView11qt_metacastEPKc @ 56 NONAME
+ _ZN17RadioStationsView12initListViewEv @ 57 NONAME
+ _ZN17RadioStationsView13updateHeadingEv @ 58 NONAME
+ _ZN17RadioStationsView15listItemClickedERK11QModelIndex @ 59 NONAME
+ _ZN17RadioStationsView15setFavoriteIconERK6HbIcon @ 60 NONAME
+ _ZN17RadioStationsView16staticMetaObjectE @ 61 NONAME DATA 16
+ _ZN17RadioStationsView17deckButtonPressedEv @ 62 NONAME
+ _ZN17RadioStationsView17setNowPlayingIconERK6HbIcon @ 63 NONAME
+ _ZN17RadioStationsView19getStaticMetaObjectEv @ 64 NONAME
+ _ZN17RadioStationsView19listItemLongPressedEP18HbAbstractViewItemRK7QPointF @ 65 NONAME
+ _ZN17RadioStationsView19updateHeadsetStatusEb @ 66 NONAME
+ _ZN17RadioStationsView20updateCurrentStationEv @ 67 NONAME
+ _ZN17RadioStationsView23startScanAndSavePresetsEv @ 68 NONAME
+ _ZN17RadioStationsView25updateControlVisibilitiesEv @ 69 NONAME
+ _ZN17RadioStationsView4initEP15RadioMainWindowP17RadioStationModel @ 70 NONAME
+ _ZN17RadioStationsView9showEventEP10QShowEvent @ 71 NONAME
+ _ZN17RadioStationsViewC1EP16RadioXmlUiLoader @ 72 NONAME
+ _ZN17RadioStationsViewC2EP16RadioXmlUiLoader @ 73 NONAME
+ _ZNK15RadioMainWindow10metaObjectEv @ 74 NONAME
+ _ZNK15RadioTuningView10metaObjectEv @ 75 NONAME
+ _ZNK15RadioWizardView10metaObjectEv @ 76 NONAME
+ _ZNK16RadioPlayLogView10metaObjectEv @ 77 NONAME
+ _ZNK17RadioStationsView10metaObjectEv @ 78 NONAME
+ _ZNK17RadioStationsView12favoriteIconEv @ 79 NONAME
+ _ZNK17RadioStationsView14nowPlayingIconEv @ 80 NONAME
+ _ZTI15RadioMainWindow @ 81 NONAME
+ _ZTI15RadioTuningView @ 82 NONAME
+ _ZTI15RadioWizardView @ 83 NONAME
+ _ZTI16RadioPlayLogView @ 84 NONAME
+ _ZTI17RadioStationsView @ 85 NONAME
+ _ZTV15RadioMainWindow @ 86 NONAME
+ _ZTV15RadioTuningView @ 87 NONAME
+ _ZTV15RadioWizardView @ 88 NONAME
+ _ZTV16RadioPlayLogView @ 89 NONAME
+ _ZTV17RadioStationsView @ 90 NONAME
+ _ZThn8_N15RadioMainWindowD0Ev @ 91 NONAME
+ _ZThn8_N15RadioMainWindowD1Ev @ 92 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioapp.pro Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+# Process directories in order that they are given
+CONFIG += ordered
+
+SUBDIRS += radioenginewrapper
+SUBDIRS += radiopresetstorage
+SUBDIRS += radiouiengine
+SUBDIRS += radiowidgets
+SUBDIRS += radioapplication
+
+symbian {
+ BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"../rom/bld.inf\""
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioapplication/inc/radioapplication.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef _RADIOAPPLICATION_H_
+#define _RADIOAPPLICATION_H_
+
+// System includes
+#include <hbapplication.h>
+
+//#define QT_SHAREDPOINTER_TRACK_POINTERS // Debugging support for QSharedPointer
+#include <qsharedpointer.h>
+
+// Forward declarations
+class RadioUiEngine;
+class RadioMainWindow;
+class RadioStationModel;
+
+typedef QSharedPointer<RadioMainWindow> RadioMainWindowPtr;
+
+#ifdef BUILD_WIN32
+ class Win32Window;
+#endif // BUILD_WIN32
+
+// Class declaration
+class RadioApplication : public HbApplication
+{
+ Q_OBJECT
+ Q_DISABLE_COPY( RadioApplication )
+
+public:
+
+ explicit RadioApplication( int argc, char* argv[] );
+
+ ~RadioApplication();
+
+private: // data
+
+#ifdef BUILD_WIN32
+ QScopedPointer<Win32Window> mWin32Window;
+#endif // BUILD_WIN32
+
+ /**
+ * Application main window
+ * Own
+ */
+ RadioMainWindowPtr mMainWindow;
+
+ /**
+ * Radio engine
+ * Own
+ */
+ RadioUiEngine* mUiEngine;
+
+};
+
+#endif // _RADIOAPPLICATION_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioapplication/inc/testwindow_win32.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef WIN32_WINDOW_H
+#define WIN32_WINDOW_H
+
+// System includes
+#include <qwidget>
+
+// Forward declarations
+class HbMainWindow;
+class QPushButton;
+class QGridLayout;
+
+class Win32Window : public QWidget
+{
+ Q_OBJECT
+public:
+
+ Win32Window();
+ ~Win32Window();
+
+ void addHbWindow( HbMainWindow* radioWindow );
+
+ void init();
+
+private slots:
+
+ void changeOrientation();
+ void volumeUp();
+ void volumeDown();
+ void toggleHeadsetStatus();
+ void updateWindowSize();
+ void addSong();
+ void clearSong();
+ void toggleOffline();
+
+private:
+
+ void resizeEvent( QResizeEvent* event );
+
+private: // data
+
+ QPushButton* mOrientationButton;
+
+ QPushButton* mVolUpButton;
+ QPushButton* mVolDownButton;
+
+ QPushButton* mAddSongButton;
+ QPushButton* mClearSongButton;
+
+ QPushButton* mHeadsetButton;
+ bool mHeadsetConnected;
+
+ QPushButton* mOfflineButton;
+
+ QGridLayout* mToolbarLayout;
+
+ int mVolume;
+
+ int mToolbarHeight;
+
+ HbMainWindow* mRadioWindow;
+
+ Qt::Orientation mOrientation;
+
+ int mSongIndex;
+
+};
+
+#endif // WIN32_WINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioapplication/radioapplication.pro Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+include(../buildflags.pri)
+
+TEMPLATE = app
+TARGET = qtfmradio
+TRANSLATIONS += fmradio.ts
+win32:DESTDIR = ../bin
+
+symbian: {
+ DEFINES += SYMBIAN
+ TARGET.CAPABILITY = CAP_APPLICATION MultimediaDD
+ TARGET.VID = VID_DEFAULT
+ TARGET.UID3 = 0x101FF976 # Old visual radio uid
+ TARGET.EPOCSTACKSIZE = 0x14000
+ TARGET.EPOCHEAPSIZE = 0x020000 0x2400000
+}
+
+QT = core
+CONFIG += hb
+CONFIG -= gui network svg
+
+INCLUDEPATH += . inc
+INCLUDEPATH += ../radioenginewrapper/commoninc
+INCLUDEPATH += ../radiouiengine/inc
+INCLUDEPATH += ../radiowidgets/inc
+
+win32:INCLUDEPATH += ../radioenginewrapper/inc
+win32:LIBS += -L../bin
+
+LIBS += -lradiouiengine
+LIBS += -lradiowidgets
+
+# UI does not normally depend on the wrapper, but it does on two special cases
+# 1. Logging is enabled. The logger is in the wrapper module
+# 2. Radio is built for win32 target. The test window needs to access wrapper
+LOGGING_ENABLED:LIBS += -lradioenginewrapper
+win32:LIBS += -lradioenginewrapper
+
+DEPENDPATH += $$INCLUDEPATH src
+
+# Sources
+HEADERS += radioapplication.h
+
+win32:HEADERS += testwindow_win32.h
+
+SOURCES += main.cpp
+SOURCES += radioapplication.cpp
+
+win32:SOURCES += testwindow_win32.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioapplication/src/main.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "radioapplication.h"
+#include "radiologger.h"
+
+/*!
+ * Runs the application
+ */
+int main( int argc, char* argv[] )
+{
+ INSTALL_MESSAGE_HANDLER // Installs the file tracer if enabled
+
+ LOG_TIMESTAMP( "Tesla started" );
+
+ RadioApplication app( argc, argv );
+ int returnValue = app.exec();
+
+ UNINSTALL_MESSAGE_HANDLER // Uninstalls the file tracer
+
+ return returnValue;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioapplication/src/radioapplication.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// User includes
+#include "radioapplication.h"
+#include "radiomainwindow.h"
+#include "radiouiengine.h"
+#include "radiolocalization.h"
+#include "radio_global.h"
+#include "radiologger.h"
+
+#ifdef BUILD_WIN32
+# include "testwindow_win32.h"
+# define CREATE_WIN32_TEST_WINDOW \
+ mWin32Window.reset( new Win32Window() ); \
+ mMainWindow->setParent( mWin32Window.data() ); \
+ mWin32Window->addHbWindow( mMainWindow.data() ); \
+ mWin32Window->show();
+# define INIT_WIN32_TEST_WINDOW \
+ mWin32Window->init();
+#else
+# define CREATE_WIN32_TEST_WINDOW
+# define INIT_WIN32_TEST_WINDOW
+#endif // BUILD_WIN32
+
+/*!
+ * Constructor
+ */
+RadioApplication::RadioApplication( int argc, char* argv[] ) :
+ HbApplication( argc, argv ),
+ mUiEngine( 0 )
+{
+ // Initializes the radio engine utils if UI logs are entered into the engine log
+ INIT_COMBINED_LOGGER
+
+ LOG_TIMESTAMP( "Start radio" );
+ setApplicationName( TRANSLATE( KApplicationName ) );
+
+ // MainWindow needs to be alive to be able to show the offline query dialog.
+ // The window is only constructed half-way at this point because we may need to shut down if
+ // offline usage is not allowed
+ mMainWindow = RadioMainWindowPtr( new RadioMainWindow() );
+
+ CREATE_WIN32_TEST_WINDOW
+
+ if ( RadioUiEngine::isOfflineProfile() && !mMainWindow->isOfflineUsageAllowed() ) {
+ quit();
+ return;
+ }
+
+ // Start the engine
+ mUiEngine = new RadioUiEngine( this );
+ if ( !mUiEngine->startRadio() ) {
+ mMainWindow->showErrorMessage( TRANSLATE( KErrorEngineStartFailed ) );
+ quit();
+ return;
+ }
+
+ INIT_WIN32_TEST_WINDOW
+
+ // Construct the real views
+ mMainWindow->init( mUiEngine );
+
+ mMainWindow->show();
+}
+
+/*!
+ *
+ */
+RadioApplication::~RadioApplication()
+{
+ // Destructor needs to be defined. See explanation from RadioEngineWrapperPrivate destructor.
+
+ // Releases the radio engine utils if it was initialized in the beginning
+ RELEASE_COMBINED_LOGGER
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioapplication/src/testwindow_win32.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qpushbutton>
+#include <qgridlayout>
+#include <qvboxlayout>
+#include <hbmainwindow.h>
+#include <qtimer.h>
+#include <qmessagebox>
+
+// User includes
+#include "testwindow_win32.h"
+#include "radioapplication.h"
+#include "radiologger.h"
+#include "radio_global.h"
+#include "radioenginewrapper_win32_p.h"
+
+const int KWindowWidth = 360;
+const int KWindowHeight = 640;
+
+const QString KBtnDisconnectHeadset = "Disconnect Headset";
+const QString KBtnConnectHeadset = "Connect Headset";
+
+const QString KBtnGoOffline = "Go Offline";
+const QString KBtnGoOnline = "Go Online";
+
+struct Song
+{
+ const char* mArtist;
+ const char* mTitle;
+};
+
+const Song KRecognizedSongs[] = {
+ { "Metallica", "One" },
+ { "Madonna", "Like a Virgin" },
+ { "Rammstein", "Der Meister" },
+ { "System of a Down", "Aerials" },
+ { "Buckethead", "Jordan" },
+ { "Faith No More", "Epic" }
+};
+const int KSongsCount = sizeof( KRecognizedSongs ) / sizeof( KRecognizedSongs[0] );
+
+/*!
+ *
+ */
+Win32Window::Win32Window() :
+ QWidget( 0 ),
+ mOrientationButton( new QPushButton( "Change Orientation", this ) ),
+ mVolUpButton( new QPushButton( "Volume Up", this ) ),
+ mVolDownButton( new QPushButton( "Volume Down", this ) ),
+ mHeadsetButton( new QPushButton( KBtnDisconnectHeadset, this ) ),
+ mAddSongButton( new QPushButton( "Add Song", this ) ),
+ mClearSongButton( new QPushButton( "Clear Song", this ) ),
+ mOfflineButton( new QPushButton( KBtnGoOffline, this ) ),
+ mHeadsetConnected( true ),
+ mVolume( 5 ),
+ mToolbarHeight( 0 ),
+ mRadioWindow( 0 ),
+ mSongIndex( 0 )
+{
+ connectAndTest( mOrientationButton, SIGNAL(clicked()), this, SLOT(changeOrientation()) );
+ connectAndTest( mVolUpButton, SIGNAL(clicked()), this, SLOT(volumeUp()) );
+ connectAndTest( mVolDownButton, SIGNAL(clicked()), this, SLOT(volumeDown()) );
+ connectAndTest( mHeadsetButton, SIGNAL(clicked()), this, SLOT(toggleHeadsetStatus()) );
+ connectAndTest( mAddSongButton, SIGNAL(clicked()), this, SLOT(addSong()) );
+ connectAndTest( mClearSongButton, SIGNAL(clicked()), this, SLOT(clearSong()) );
+ connectAndTest( mOfflineButton, SIGNAL(clicked()), this, SLOT(toggleOffline()) );
+
+ QTimer::singleShot( 0, this, SLOT(updateWindowSize()) );
+}
+
+/*!
+ *
+ */
+Win32Window::~Win32Window()
+{
+}
+
+/*!
+ *
+ */
+void Win32Window::addHbWindow( HbMainWindow* radioWindow )
+{
+ mRadioWindow = radioWindow;
+ mOrientation = mRadioWindow->orientation();
+ updateWindowSize();
+
+ QVBoxLayout* layout = new QVBoxLayout( this );
+ layout->setMargin( 5 );
+ layout->setSpacing( 5 );
+
+ mToolbarLayout = new QGridLayout( this );
+ mToolbarLayout->setHorizontalSpacing( 5 );
+ mToolbarLayout->setVerticalSpacing( 5 );
+
+ mToolbarLayout->addWidget( mOrientationButton, 0, 0 );
+ mToolbarLayout->addWidget( mVolUpButton, 0, 1 );
+ mToolbarLayout->addWidget( mVolDownButton, 1, 1 );
+ mToolbarLayout->addWidget( mHeadsetButton, 1, 0 );
+ mToolbarLayout->addWidget( mAddSongButton, 2, 0 );
+ mToolbarLayout->addWidget( mClearSongButton, 2, 1 );
+ mToolbarLayout->addWidget( mOfflineButton, 3, 0 );
+
+ layout->addItem( mToolbarLayout );
+ layout->addWidget( radioWindow );
+
+ setLayout( layout );
+}
+
+/*!
+ *
+ */
+void Win32Window::init()
+{
+ RadioEngineWrapperPrivate* wrapper = RadioEngineWrapperPrivate::instance();
+ if ( wrapper ) {
+ QString error = wrapper->dataParsingError();
+ if ( !error.isEmpty() ) {
+ QMessageBox msg( QMessageBox::Warning, "Unable to parse radio settings", error, QMessageBox::Ok );
+ msg.exec();
+ }
+
+ if ( wrapper->isOffline() ) {
+ mOfflineButton->setText( KBtnGoOnline );
+ }
+ }
+}
+
+/*!
+ * Private slot
+ */
+void Win32Window::changeOrientation()
+{
+ if ( mOrientation == Qt::Horizontal ) {
+ mOrientation = Qt::Vertical;
+ } else {
+ mOrientation = Qt::Horizontal;
+ }
+
+ mRadioWindow->setOrientation( mOrientation );
+ updateWindowSize();
+}
+
+/*!
+ * Private slot
+ */
+void Win32Window::volumeUp()
+{
+ if ( ++mVolume > KMaximumVolumeLevel ) {
+ mVolume = KMaximumVolumeLevel;
+ }
+ RadioEngineWrapperPrivate::instance()->setVolume( mVolume );
+}
+
+/*!
+ * Private slot
+ */
+void Win32Window::volumeDown()
+{
+ if ( --mVolume < 0 ) {
+ mVolume = 0;
+ }
+ RadioEngineWrapperPrivate::instance()->setVolume( mVolume );
+}
+
+/*!
+ * Private slot
+ */
+void Win32Window::toggleHeadsetStatus()
+{
+ mHeadsetConnected = !mHeadsetConnected;
+ if ( mHeadsetConnected ) {
+ mHeadsetButton->setText( KBtnDisconnectHeadset );
+ } else {
+ mHeadsetButton->setText( KBtnConnectHeadset );
+ }
+ RadioEngineWrapperPrivate::instance()->setHeadsetStatus( mHeadsetConnected );
+}
+
+/*!
+ * Private slot
+ */
+void Win32Window::updateWindowSize()
+{
+ if ( mOrientation == Qt::Horizontal ) {
+ resize( KWindowHeight, KWindowWidth + mToolbarHeight );
+ } else {
+ resize( KWindowWidth, KWindowHeight + mToolbarHeight );
+ }
+}
+
+/*!
+ * Private slot
+ */
+void Win32Window::addSong()
+{
+ Song song = KRecognizedSongs[mSongIndex++];
+ mSongIndex %= KSongsCount;
+
+ RadioEngineWrapperPrivate::instance()->addSong( song.mArtist, song.mTitle );
+}
+
+/*!
+ * Private slot
+ */
+void Win32Window::clearSong()
+{
+ RadioEngineWrapperPrivate::instance()->clearSong();
+}
+
+/*!
+ * Private slot
+ */
+void Win32Window::toggleOffline()
+{
+ bool offline = !RadioEngineWrapperPrivate::instance()->isOffline();
+ RadioEngineWrapperPrivate::instance()->setOffline( offline );
+ if ( offline ) {
+ mOfflineButton->setText( KBtnGoOnline );
+ } else {
+ mOfflineButton->setText( KBtnGoOffline );
+ }
+}
+
+/*!
+ *
+ */
+void Win32Window::resizeEvent( QResizeEvent* event )
+{
+ QWidget::resizeEvent( event );
+ mToolbarHeight = mToolbarLayout->contentsRect().height();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/commoninc/radio_global.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIO_GLOBAL_H_
+#define RADIO_GLOBAL_H_
+
+// System includes
+#include <qglobal.h>
+
+// Constants
+
+/**
+ * Radio frequency multiplier
+ */
+const int KFrequencyMultiplier = 1000000;
+
+/**
+ * Desired amount of steps in the volume control in the UI
+ */
+const int KMaximumVolumeLevel = 20;
+
+/**
+ * Id of the offline profile
+ */
+const int KOfflineProfileId = 5;
+
+/**
+ * Radio Text Plus tag ids
+ */
+namespace RtPlus
+{
+ enum Tag { Title = 1, Artist = 4, Homepage = 39 };
+}
+
+namespace Seeking
+{
+ enum Direction
+ {
+ Down,
+ Up
+ };
+
+ enum State
+ {
+ NotSeeking,
+ SeekingUp,
+ SeekingDown
+ };
+}
+
+namespace CommandSender
+{
+ enum Sender
+ {
+ Unspecified,
+ FrequencyStrip,
+ StationCarousel
+ };
+}
+
+namespace RadioRegion
+{
+ enum Region
+ {
+ None = -1,
+ Default,
+ Japan,
+ America,
+ Poland
+ };
+}
+
+namespace GenreEurope
+{
+ enum Europe
+ {
+ RdsNone,
+ RdsNews,
+ RdsCurrentAffairs,
+ RdsInformation,
+ RdsSport,
+ RdsEducation,
+ RdsDrama,
+ RdsCulture,
+ RdsScience,
+ RdsVariedSpeech,
+ RdsPopMusic,
+ RdsRockMusic,
+ RdsEasyListening,
+ RdsLightClassical,
+ RdsSeriousClassical,
+ RdsOtherMusic,
+ RdsWeather,
+ RdsFinance,
+ RdsChildrensProgrammes,
+ RdsSocialAffairs,
+ RdsReligion,
+ RdsPhoneIn,
+ RdsTravel,
+ RdsLeisure,
+ RdsJazzMusic,
+ RdsCountryMusic,
+ RdsNationalMusic,
+ RdsOldiesMusic,
+ RdsFolkMusic,
+ RdsDocumentary,
+ RdsAlarmTest,
+ RdsAlarm
+ };
+}
+
+namespace GenreAmerica
+{
+ enum America
+ {
+ RbdsNone,
+ RbdsNews,
+ RbdsInformation,
+ RbdsSports,
+ RbdsTalk,
+ RbdsRock,
+ RbdsClassicRock,
+ RbdsAdultHits,
+ RbdsSoftRock,
+ RbdsTop40,
+ RbdsCountry,
+ RbdsOldies,
+ RbdsSoft,
+ RbdsNostalgia,
+ RbdsJazz,
+ RbdsClassical,
+ RbdsRhythmAndBlues,
+ RbdsSoftRhythmAndBlues,
+ RbdsLanguage,
+ RbdsReligiousMusic,
+ RbdsReligiousTalk,
+ RbdsPersonality,
+ RbdsPublic,
+ RbdsCollege,
+ RbdsUnassigned1,
+ RbdsUnassigned2,
+ RbdsUnassigned3,
+ RbdsUnassigned4,
+ RbdsUnassigned5,
+ RbdsWeather,
+ RbdsEmergencyTest,
+ RbdsEmergency
+ };
+}
+
+struct GenreStruct
+ {
+ int mGenreCode;
+ struct{ const char *source; const char *comment; } mTranslation;
+ };
+
+//static const char* GenreContext = "Genre";
+
+const GenreStruct EuropeanGenres[] =
+ {
+ { GenreEurope::RdsNone, QT_TRANSLATE_NOOP3( GenreContext, "None", "txt_genre_europe_none" ) }
+ ,{ GenreEurope::RdsNews, QT_TRANSLATE_NOOP3( GenreContext, "News", "txt_genre_europe_news" ) }
+ ,{ GenreEurope::RdsCurrentAffairs, QT_TRANSLATE_NOOP3( GenreContext, "Current affairs", "txt_genre_europe_current_affairs" ) }
+ ,{ GenreEurope::RdsInformation, QT_TRANSLATE_NOOP3( GenreContext, "Information", "txt_genre_europe_information" ) }
+ ,{ GenreEurope::RdsSport, QT_TRANSLATE_NOOP3( GenreContext, "Sport", "txt_genre_europe_sport" ) }
+ ,{ GenreEurope::RdsEducation, QT_TRANSLATE_NOOP3( GenreContext, "Education", "txt_genre_europe_education" ) }
+ ,{ GenreEurope::RdsDrama, QT_TRANSLATE_NOOP3( GenreContext, "Drama", "txt_genre_europe_drama" ) }
+ ,{ GenreEurope::RdsCulture, QT_TRANSLATE_NOOP3( GenreContext, "Culture", "txt_genre_europe_culture" ) }
+ ,{ GenreEurope::RdsScience, QT_TRANSLATE_NOOP3( GenreContext, "Science", "txt_genre_europe_science" ) }
+ ,{ GenreEurope::RdsVariedSpeech, QT_TRANSLATE_NOOP3( GenreContext, "Varied speech", "txt_genre_europe_varied_speech" ) }
+ ,{ GenreEurope::RdsPopMusic, QT_TRANSLATE_NOOP3( GenreContext, "Pop music", "txt_genre_europe_pop_music" ) }
+ ,{ GenreEurope::RdsRockMusic, QT_TRANSLATE_NOOP3( GenreContext, "Rock music", "txt_genre_europe_rock_music" ) }
+ ,{ GenreEurope::RdsEasyListening, QT_TRANSLATE_NOOP3( GenreContext, "Easy listening", "txt_genre_europe_easy_listening" ) }
+ ,{ GenreEurope::RdsLightClassical, QT_TRANSLATE_NOOP3( GenreContext, "Light classical", "txt_genre_europe_light_classical" ) }
+ ,{ GenreEurope::RdsSeriousClassical, QT_TRANSLATE_NOOP3( GenreContext, "Serious classical", "txt_genre_europe_serious_classical" ) }
+ ,{ GenreEurope::RdsOtherMusic, QT_TRANSLATE_NOOP3( GenreContext, "Other music", "txt_genre_europe_other_music" ) }
+ ,{ GenreEurope::RdsWeather, QT_TRANSLATE_NOOP3( GenreContext, "Weather", "txt_genre_europe_weather" ) }
+ ,{ GenreEurope::RdsFinance, QT_TRANSLATE_NOOP3( GenreContext, "Finance", "txt_genre_europe_finance" ) }
+ ,{ GenreEurope::RdsChildrensProgrammes, QT_TRANSLATE_NOOP3( GenreContext, "Childrens programmes", "txt_genre_europe_childrens_programmes" ) }
+ ,{ GenreEurope::RdsSocialAffairs, QT_TRANSLATE_NOOP3( GenreContext, "Social affairs", "txt_genre_europe_social_affairs" ) }
+ ,{ GenreEurope::RdsReligion, QT_TRANSLATE_NOOP3( GenreContext, "Religion", "txt_genre_europe_religion" ) }
+ ,{ GenreEurope::RdsPhoneIn, QT_TRANSLATE_NOOP3( GenreContext, "Phone in", "txt_genre_europe_phone_in" ) }
+ ,{ GenreEurope::RdsTravel, QT_TRANSLATE_NOOP3( GenreContext, "Travel", "txt_genre_europe_travel" ) }
+ ,{ GenreEurope::RdsLeisure, QT_TRANSLATE_NOOP3( GenreContext, "Leisure", "txt_genre_europe_leisure" ) }
+ ,{ GenreEurope::RdsJazzMusic, QT_TRANSLATE_NOOP3( GenreContext, "Jazz music", "txt_genre_europe_jazz_music" ) }
+ ,{ GenreEurope::RdsCountryMusic, QT_TRANSLATE_NOOP3( GenreContext, "Country music", "txt_genre_europe_country_music" ) }
+ ,{ GenreEurope::RdsNationalMusic, QT_TRANSLATE_NOOP3( GenreContext, "National music", "txt_genre_europe_national_music" ) }
+ ,{ GenreEurope::RdsOldiesMusic, QT_TRANSLATE_NOOP3( GenreContext, "Oldies music", "txt_genre_europe_oldies_music" ) }
+ ,{ GenreEurope::RdsFolkMusic, QT_TRANSLATE_NOOP3( GenreContext, "Folk music", "txt_genre_europe_folk_music" ) }
+ ,{ GenreEurope::RdsDocumentary, QT_TRANSLATE_NOOP3( GenreContext, "Documentary", "txt_genre_europe_documentary" ) }
+ ,{ GenreEurope::RdsAlarmTest, QT_TRANSLATE_NOOP3( GenreContext, "Alarm test", "txt_genre_europe_alarm_test" ) }
+ ,{ GenreEurope::RdsAlarm, QT_TRANSLATE_NOOP3( GenreContext, "Alarm", "txt_genre_europe_alarm" ) }
+ };
+const int EuropeanGenresCount = sizeof( EuropeanGenres ) / sizeof ( EuropeanGenres[0] );
+
+const GenreStruct AmericanGenres[] =
+ {
+ { GenreAmerica::RbdsNone, QT_TRANSLATE_NOOP3( GenreContext, "None", "txt_genre_america_none" ) }
+ ,{ GenreAmerica::RbdsNews, QT_TRANSLATE_NOOP3( GenreContext, "News", "txt_genre_america_news" ) }
+ ,{ GenreAmerica::RbdsInformation, QT_TRANSLATE_NOOP3( GenreContext, "Information", "txt_genre_america_information" ) }
+ ,{ GenreAmerica::RbdsSports, QT_TRANSLATE_NOOP3( GenreContext, "Sports", "txt_genre_america_sports" ) }
+ ,{ GenreAmerica::RbdsRock, QT_TRANSLATE_NOOP3( GenreContext, "Rock", "txt_genre_america_rock" ) }
+ ,{ GenreAmerica::RbdsClassicRock, QT_TRANSLATE_NOOP3( GenreContext, "Classic rock", "txt_genre_america_classic_rock" ) }
+ ,{ GenreAmerica::RbdsAdultHits, QT_TRANSLATE_NOOP3( GenreContext, "Adult hits", "txt_genre_america_adult_hits" ) }
+ ,{ GenreAmerica::RbdsSoftRock, QT_TRANSLATE_NOOP3( GenreContext, "Soft rock", "txt_genre_america_soft_rock" ) }
+ ,{ GenreAmerica::RbdsTop40, QT_TRANSLATE_NOOP3( GenreContext, "Top 40", "txt_genre_america_top_40" ) }
+ ,{ GenreAmerica::RbdsCountry, QT_TRANSLATE_NOOP3( GenreContext, "Country", "txt_genre_america_country" ) }
+ ,{ GenreAmerica::RbdsOldies, QT_TRANSLATE_NOOP3( GenreContext, "Oldies", "txt_genre_america_oldies" ) }
+ ,{ GenreAmerica::RbdsSoft, QT_TRANSLATE_NOOP3( GenreContext, "Soft", "txt_genre_america_soft" ) }
+ ,{ GenreAmerica::RbdsNostalgia, QT_TRANSLATE_NOOP3( GenreContext, "Nostalgia", "txt_genre_america_nostalgia" ) }
+ ,{ GenreAmerica::RbdsJazz, QT_TRANSLATE_NOOP3( GenreContext, "Jazz", "txt_genre_america_jazz" ) }
+ ,{ GenreAmerica::RbdsClassical, QT_TRANSLATE_NOOP3( GenreContext, "Classical", "txt_genre_america_classical" ) }
+ ,{ GenreAmerica::RbdsRhythmAndBlues, QT_TRANSLATE_NOOP3( GenreContext, "Rhythm and blues", "txt_genre_america_rhythm_and_blues" ) }
+ ,{ GenreAmerica::RbdsSoftRhythmAndBlues, QT_TRANSLATE_NOOP3( GenreContext, "Soft rhythm and blues", "txt_genre_america_soft_rhythm_and_blues" ) }
+ ,{ GenreAmerica::RbdsLanguage, QT_TRANSLATE_NOOP3( GenreContext, "Language", "txt_genre_america_language" ) }
+ ,{ GenreAmerica::RbdsReligiousMusic, QT_TRANSLATE_NOOP3( GenreContext, "Religuous music", "txt_genre_america_religuous_music" ) }
+ ,{ GenreAmerica::RbdsReligiousTalk, QT_TRANSLATE_NOOP3( GenreContext, "Religuous talk", "txt_genre_america_religuous_talk" ) }
+ ,{ GenreAmerica::RbdsPersonality, QT_TRANSLATE_NOOP3( GenreContext, "Personality", "txt_genre_america_personality" ) }
+ ,{ GenreAmerica::RbdsPublic, QT_TRANSLATE_NOOP3( GenreContext, "Public", "txt_genre_america_public" ) }
+ ,{ GenreAmerica::RbdsCollege, QT_TRANSLATE_NOOP3( GenreContext, "College", "txt_genre_america_college" ) }
+ ,{ GenreAmerica::RbdsUnassigned1, QT_TRANSLATE_NOOP3( GenreContext, "Unassigned 1", "txt_genre_america_unassigned_1" ) }
+ ,{ GenreAmerica::RbdsUnassigned2, QT_TRANSLATE_NOOP3( GenreContext, "Unassigned 2", "txt_genre_america_unassigned_2" ) }
+ ,{ GenreAmerica::RbdsUnassigned3, QT_TRANSLATE_NOOP3( GenreContext, "Unassigned 3", "txt_genre_america_unassigned_3" ) }
+ ,{ GenreAmerica::RbdsUnassigned4, QT_TRANSLATE_NOOP3( GenreContext, "Unassigned 4", "txt_genre_america_unassigned_4" ) }
+ ,{ GenreAmerica::RbdsUnassigned5, QT_TRANSLATE_NOOP3( GenreContext, "Unassigned 5", "txt_genre_america_unassigned_5" ) }
+ ,{ GenreAmerica::RbdsWeather, QT_TRANSLATE_NOOP3( GenreContext, "Weather", "txt_genre_america_weather" ) }
+ ,{ GenreAmerica::RbdsEmergencyTest, QT_TRANSLATE_NOOP3( GenreContext, "Emergency test", "txt_genre_america_emergency_test" ) }
+ ,{ GenreAmerica::RbdsEmergency, QT_TRANSLATE_NOOP3( GenreContext, "Emergency", "txt_genre_america_emergency" ) }
+ };
+const int AmericanGenresCount = sizeof( AmericanGenres ) / sizeof ( AmericanGenres[0] );
+
+#endif // RADIO_GLOBAL_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/commoninc/radiologger.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef _RADIOLOGGER_H_
+#define _RADIOLOGGER_H_
+
+// System includes
+#include <qobject>
+
+// User includes
+#include "radiowrapperexport.h"
+
+class WRAPPER_DLL_EXPORT RadioLogger
+{
+public:
+
+ enum Mode { Normal, MethodEnter, MethodExit, DecIndent };
+
+ static void initCombinedLogger();
+ static void releaseCombinedLogger();
+
+ static void logMsg( const char* msg, Mode mode = Normal );
+
+private:
+ RadioLogger();
+ ~RadioLogger();
+};
+
+// ============================================================================
+// START TIMESTAMP LOGGING
+// ============================================================================
+
+#ifdef TIMESTAMP_LOGGING_ENABLED
+
+#include <qtime>
+#include <qdebug.h>
+
+/**
+ * Timestamp logging macro.
+ * When the macro is defined, timestamp logging is on
+ *
+ * Example. These lines in the code...
+ * LOG_TIMESTAMP( "Start operation" );
+ * ...
+ * LOG_TIMESTAMP( "End operation" );
+ *
+ * ... print the following log lines
+ * FMRadio: Start operation "14:13:09.042"
+ * FMRadio: End operation "14:13:09.250"
+ */
+//#define LOG_TIMESTAMP(comment) do{ qDebug() << LOGMARKER << comment << QTime::currentTime().toString("hh:mm:ss.zzz"); }while(0)
+#define LOG_TIMESTAMP(comment) LOG_FORMAT( comment ## " %s", GETSTRING( QTime::currentTime().toString("hh:mm:ss.zzz") ) )
+
+#else
+
+#define LOG_TIMESTAMP(comment)
+
+#endif // TIMESTAMP_LOGGING_ENABLED
+
+// ============================================================================
+// END TIMESTAMP LOGGING
+// ============================================================================
+
+// ============================================================================
+// START FULL LOGGING
+// ============================================================================
+
+#ifdef LOGGING_ENABLED
+
+#include <qglobal.h>
+#include <qdebug.h>
+
+// UI logs can be combined with engine logs by making the UI feed its log prints into
+// the engine logger. This requires that we initialize the radio engine utils right here
+// because the engine won't start up until much later. This is a bit ugly since the macros
+// call Symbian code directly, but it was considered to be worth it to see UI and engine
+// traces in the same file.
+#if defined COMBINE_WITH_ENGINE_LOGGER && defined LOGGING_ENABLED && !defined BUILD_WIN32
+# include "../../../radioengine/utils/api/mradioenginelogger.h"
+# include "../../../radioengine/utils/api/radioengineutils.h"
+# define WRITELOG(msg) RadioLogger::logMsg( msg );
+# define WRITELOG_METHOD_ENTER(msg) RadioLogger::logMsg( GETSTRING( msg ), RadioLogger::MethodEnter );
+# define WRITELOG_METHOD_EXIT(msg) RadioLogger::logMsg( GETSTRING( msg ), RadioLogger::MethodExit );
+# define LOGGER_DEC_INDENT RadioLogger::logMsg( "", RadioLogger::DecIndent );
+# define WRITELOG_GETSTRING(msg) WRITELOG( GETSTRING( msg ) )
+# define INIT_COMBINED_LOGGER RadioLogger::initCombinedLogger();
+# define RELEASE_COMBINED_LOGGER RadioLogger::releaseCombinedLogger();
+#else
+# define WRITELOG(msg) qDebug() << LOGMARKER << msg;
+# define WRITELOG_METHOD_ENTER(msg) WRITELOG(msg)
+# define WRITELOG_METHOD_EXIT(msg) WRITELOG(msg)
+# define WRITELOG_GETSTRING(msg) WRITELOG(msg)
+# define LOGGER_INC_INDENT
+# define LOGGER_DEC_INDENT
+# define INIT_COMBINED_LOGGER
+# define RELEASE_COMBINED_LOGGER
+#endif
+
+// Macro that simply logs a string
+// Example:
+// LOG( "This is a test" );
+#define LOG(string) do{ WRITELOG( string ) }while(0)
+
+// Helper macro to get a const char* out of a QString so that it can be logged. Can be used with LOG_FORMAT()
+#define GETSTRING(qstring) qstring.toAscii().constData()
+
+// Macro that logs a string with multiple parameters
+// Examples:
+// LOG_FORMAT( "This is an integer %d, and this is a float with two digits %.2f", 42, 3.14 );
+// LOG_FORMAT( "This is a QString %s", GETSTRING(someQString) );
+#define LOG_FORMAT(fmt,args...) do{ QString tmp; WRITELOG_GETSTRING( tmp.sprintf(fmt,args) ) }while(0)
+
+// Macro that logs function enter, exit and exception
+// Example (Simply put it in the beginning of a function):
+// LOG_METHOD;
+// Output:
+// -> SomeFunction(int,const char*)
+// <- SomeFunction(int,const char*)
+// <- SomeFunction(int,const char*): Exception raised!
+#define LOG_METHOD MethodLogger ___methodLogger( __PRETTY_FUNCTION__, "" )
+
+// Same as the previous function logging macro with the addition of logging the return value
+// Note! The return value can only be retrieved in the emulator.
+// Example (Simply put it in the beginning of a function):
+// LOG_METHOD_RET( "%d" );
+// Output:
+// -> SomeFunction(int,const char*)
+// <- SomeFunction(int,const char*) returning 42
+#define LOG_METHOD_RET(fmt) MethodLogger ___methodLogger( __PRETTY_FUNCTION__, fmt )
+
+// Logs function enter but does not log exit or leave. This is meant to be lighter than LOG_METHOD macro
+#define LOG_METHOD_ENTER LOG_FORMAT( "Enter: %s", __PRETTY_FUNCTION__ )
+
+// Assert macro for logging. If the condition is false, the expression is performed
+// Example:
+// LOG_ASSERT( thisMustBeTrue, LOG_FORMAT( "OMG! That was not true: %d", thisMustBeTrue ) );
+#define LOG_ASSERT(cond,expr) do{ if (!cond) { expr; } }while(0)
+
+// Macro to hide a function variable that is used only when debugging is enabled.
+// Expands to the variable name when debugging is enabled and to nothing when it is not
+#define DEBUGVAR(a) a
+
+// Macro to log slot function caller by its class name.
+#define LOG_SLOT_CALLER do { \
+ QObject* caller = sender(); \
+ if ( caller ) { \
+ LOG_FORMAT( "SLOT %s called by %s. Objectname: %s", __PRETTY_FUNCTION__, \
+ caller->metaObject()->className(), GETSTRING( caller->objectName() ) ); \
+ } else { \
+ LOG_FORMAT( "SLOT %s called as regular function. ", __PRETTY_FUNCTION__ ); \
+ } \
+ } while (0)
+
+// Class declaration
+class WRAPPER_DLL_EXPORT MethodLogger
+{
+public:
+
+ MethodLogger( const char* function, const char* format );
+ ~MethodLogger();
+
+private:
+
+ const char* mFunction;
+ const char* mFormat;
+
+};
+
+#else // LOGGING_ENABLED
+
+# define LOG(string)
+# define GETSTRING(qstring)
+# define LOG_FORMAT(fmt,args...)
+# define LOG_METHOD
+# define LOG_METHOD_RET(fmt)
+# define LOG_METHOD_ENTER
+# define LOG_ASSERT(cond,expr)
+# define DEBUGVAR(a)
+# define LOG_SLOT_CALLER
+# define INIT_COMBINED_LOGGER
+# define RELEASE_COMBINED_LOGGER
+
+
+// Dummy class
+class WRAPPER_DLL_EXPORT MethodLogger
+{
+public:
+ MethodLogger( const char*, const char* ) {}
+ ~MethodLogger() {}
+};
+
+#endif // LOGGING_ENABLED
+
+#ifdef TRACE_TO_FILE
+
+# define INSTALL_MESSAGE_HANDLER FileLogger::installMessageHandler(QString(TRACE_OUTPUT_FILE), FILTER_BY_LOGMARKER);
+# define UNINSTALL_MESSAGE_HANDLER FileLogger::uninstallMessageHandler();
+
+// Class declaration
+class WRAPPER_DLL_EXPORT FileLogger
+{
+public:
+
+ static void installMessageHandler( const QString& fileName, bool filterByMarker = true );
+ static void uninstallMessageHandler();
+
+private:
+
+ static void handleMessage( QtMsgType type, const char* msg );
+
+};
+
+#else
+# define INSTALL_MESSAGE_HANDLER
+# define UNINSTALL_MESSAGE_HANDLER
+#endif // TRACE_TO_FILE
+
+// ============================================================================
+// END FULL LOGGING
+// ============================================================================
+
+// ============================================================================
+// SIGNAL/SLOT CONNECTION CHECKER
+// ============================================================================
+static bool connectAndTest( const QObject* sender, const char* signal,
+ const QObject* receiver, const char* member,
+ Qt::ConnectionType type = Qt::AutoConnection )
+{
+ bool connected = QObject::connect( sender, signal, receiver, member, type );
+
+# ifdef CONNECT_TEST_MODE
+
+ if ( !connected )
+ {
+ LOG( "Failed to make a signal-slot connection!" );
+ LOG_FORMAT( "sender: %s", sender->metaObject()->className() );
+ LOG_FORMAT( "signal: %s", signal );
+ LOG_FORMAT( "receiver: %s", receiver->metaObject()->className() );
+ LOG_FORMAT( "slot/signal: %s", signal );
+
+ #if CONNECT_TEST_MODE == 2
+ Q_ASSERT( false );
+ #endif
+
+ // ----------------------------------------------------------------
+ // SIGNAL-SLOT CONNECTION FAILED!
+ // ----------------------------------------------------------------
+ }
+
+# endif
+
+ return connected;
+}
+
+#ifdef ENABLE_ASSERTS
+
+ #define RADIO_ASSERT(cond,where,what) Q_ASSERT_X(cond,where,what)
+
+#else
+# ifdef LOGGING_ENABLED
+# define RADIO_ASSERT(cond,where,what) \
+ do { \
+ if ( !cond ) { \
+ LOG_FORMAT( "ASSERT Failed! %s, %s", where, what ); \
+ } \
+ } while ( false )
+# else
+# define RADIO_ASSERT(cond,where,what)
+# endif // LOGGING_ENABLED
+#endif // ENABLE_ASSERTS
+
+#endif // _RADIOLOGGER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/commoninc/radiowrapperexport.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIO_WRAPPER_EXPORT_H_
+#define RADIO_WRAPPER_EXPORT_H_
+
+// System includes
+#include <qglobal.h>
+
+#ifdef BUILD_WRAPPER_DLL
+ #define WRAPPER_DLL_EXPORT Q_DECL_EXPORT
+#else
+ #define WRAPPER_DLL_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // RADIO_WRAPPER_EXPORT_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/commoninc/settings.xml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,92 @@
+<radiosettings>
+ <setting name="maxvolume" value="10000" />
+ <setting name="FrequencyStepSize" value="100000" />
+ <setting name="Region" value="0" />
+ <setting name="MinFrequency" value="87500000" />
+ <setting name="MaxFrequency" value="108000000" />
+
+ <Station>
+ <setting name="Frequency" value="9500000" />
+ <RdsGroup interval="3" count="100">
+ <RdsItem type="PiCode" delay="0">0x54A8</RdsItem>
+ <RdsItem type="PsName" delay="1">Yle Suomi</RdsItem>
+ </RdsGroup>
+ <RdsGroup interval="3" count="100">
+ <RdsItem type="PiCode" delay="0">0x5fA8</RdsItem>
+ <RdsItem type="PsName" delay="1">Yle Oulu</RdsItem>
+ </Rds>
+ </RdsGroup>
+ </Station>
+
+ <Station>
+ <setting name="Frequency" value="88000000" />
+ <Rds type="PsName"><!-- Static PS -->
+ <setting name="SendInterval" value="8" />
+ <setting name="SendCount" value="4" />
+ <setting name="RdsContent" value="Radio Nova" />
+ </Rds>
+ <Rds type="PiCode">
+ <setting name="SendInterval" value="8" />
+ <setting name="RdsContent" value="0x54A8" />
+ </Rds>
+ <Rds type="Rt">
+ <setting name="SendInterval" value="4" />
+ <setting name="RdsContent" value="Radio Nova runs" />
+ <setting name="RdsContent" value="some ads in the" />
+ <setting name="RdsContent" value="radio text." />
+ </Rds>
+ </Station>
+
+ <Station>
+ <setting name="Frequency" value="89000000" />
+ <Rds type="PsName">
+ <setting name="SendInterval" value="5" />
+ <setting name="SendCount" value="4" />
+ <setting name="RdsContent" value="Radio Rock" />
+ </Rds>
+ <Rds type="Pty">
+ <setting name="SendInterval" value="4" />
+ <setting name="RdsContent" value="12" />
+ </Rds>
+ </Station>
+
+ <Station>
+ <setting name="Frequency" value="98000000" />
+ <Rds type="PsName">
+ <setting name="SendInterval" value="5" />
+ <setting name="RdsContent" value="Radio Mega" />
+ </Rds>
+ <Rds type="Rt">
+ <setting name="SendInterval" value="8" />
+ <setting name="RtPlusItem" value="Now playing: [artist] - [title]">
+ <setting name="RtPlusTag" value="artist">
+ <setting name="delay" value="2" />
+ <setting name="RdsContent" value="Metallica" />
+ </setting>
+ <setting name="RtPlusTag" value="title">
+ <setting name="delay" value="2" />
+ <setting name="RdsContent" value="One" />
+ </setting>
+ </setting>
+ </Rds>
+ </Station>
+
+ <Station>
+ <setting name="Frequency" value="103000000" />
+ <Rds type="PsName"><!-- Dynamic PS -->
+ <setting name="SendInterval" value="2" />
+ <setting name="RdsContent" value="Radio Mega" />
+ <setting name="RdsContent" value="iskee" />
+ <setting name="RdsContent" value="makkarat" />
+ <setting name="RdsContent" value="ruutuun" />
+ </Rds>
+ <Rds type="Rt">
+ <setting name="SendInterval" value="4" />
+ <setting name="RdsContent" value="This is" />
+ <setting name="RdsContent" value="an example usage of" />
+ <setting name="RdsContent" value="radio text in a" />
+ <setting name="RdsContent" value="radio station." />
+ </Rds>
+ </Station>
+
+</radiosettings>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/cradioenginehandler.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef _CRADIOENGINEHANDLER_H_
+#define _CRADIOENGINEHANDLER_H_
+
+// System includes
+#include <e32base.h>
+
+#include <mw/profileenginesdkcrkeys.h>
+
+// User includes
+#include "radio_global.h"
+#include "mradioengineinitializer.h"
+
+// Forward declarations
+class CRadioEngine;
+class MRadioScanObserver;
+class MRadioRdsDataObserver;
+class CRadioRepositoryManager;
+class MRadioEngineHandlerObserver;
+class MRadioApplicationSettings;
+
+// Class declaration
+class CRadioEngineHandler : public CBase
+ , public MRadioEngineInitializer
+ {
+public:
+
+ CRadioEngineHandler( MRadioEngineHandlerObserver& aObserver );
+
+ ~CRadioEngineHandler();
+
+ void ConstructL();
+
+ /**
+ * Sets the rds data observer
+ */
+ void SetRdsObserver( MRadioRdsDataObserver* aObserver );
+
+ /**
+ * Returns the radio status
+ * @return ETrue = radio is on, EFalse = radio is off
+ */
+ TBool IsRadioOn();
+
+ /**
+ * Tune to the specified frequency
+ * @param aFrequency - frequency to lock onto.
+ */
+ void Tune( TUint aFrequency );
+
+ /**
+ * Tune to the specified frequency after a delay
+ * @param aFrequency - frequency to lock onto.
+ */
+ void TuneWithDelay( TUint aFrequency );
+
+ /**
+ * Sets the audio mute state
+ * @param aMuted - flag to determine whether mute should be turned on or off
+ */
+ void SetMuted( const TBool aMuted );
+
+ /**
+ * Gets the audio mute state
+ * @return ETrue or EFalse to indicate whether mute is currently on.
+ */
+ TBool IsMuted() const;
+
+ /**
+ * Sets the volume level of the FM radio
+ * @param aVolume - the volume to be used.
+ */
+ void SetVolume( TInt aVolume );
+
+ /**
+ * Gets the volumelevel.
+ * @return the current volume
+ */
+ TInt Volume() const;
+
+ /**
+ * Gets the max volumelevel.
+ * @return the max volume
+ */
+ TInt MaxVolume() const;
+
+ /**
+ * Increases the volume by one increment
+ */
+ void IncreaseVolume();
+
+ /**
+ * Decreases the volume by one increment
+ */
+ void DecreaseVolume();
+
+ /**
+ * Checks if the antenna is attached
+ * @return ETrue or EFalse to indicate whether antenna is currently attached.
+ */
+ TBool IsAntennaAttached() const;
+
+ /**
+ * Retrieves the current frequency.
+ * @return the frequency in hertz
+ */
+ TUint TunedFrequency() const;
+
+ /**
+ * Returns the minimum allowed frequency in the current region
+ */
+ TUint MinFrequency() const;
+
+ /**
+ * Returns the maximum allowed frequency in the current region
+ */
+ TUint MaxFrequency() const;
+
+ /**
+ * Checks if the given frequency is valid in the current region
+ */
+ TBool IsFrequencyValid( TUint aFrequency ) const;
+
+ /**
+ * Scan up to the next available frequency.
+ */
+ void Seek( Seeking::Direction direction );
+
+ /**
+ * Cancel previously requested scan.
+ */
+ void CancelSeek();
+
+ /**
+ * Returns the engine seeking state
+ */
+ Seeking::State SeekingState() const;
+
+ void StartScan( MRadioScanObserver& aObserver );
+
+ void StopScan( TInt aError = KErrCancel );
+
+ /**
+ * Rreturn step size for tuning.
+ * @return step size
+ */
+ TUint32 FrequencyStepSize() const;
+
+ /**
+ * Determine current region
+ * @return fmradio region. In case of error, returns EFMRadioRegionNone.
+ */
+ RadioRegion::Region Region() const;
+
+ /**
+ * Sets whether or not audio should be routed to loudspeaker
+ * @param aLoudspeaker ETrue if loudspeaker should be used, EFalse if not
+ */
+ void SetAudioRouteToLoudspeaker( TBool aLoudspeaker );
+
+ /**
+ * Checks if audio is routed to loudspeaker
+ * @return ETrue if loudspeaker is used, EFalse if headset is used
+ */
+ TBool IsAudioRoutedToLoudspeaker() const;
+
+ /**
+ * Returns ar reference to the publish & subscribe handler
+ */
+ CRadioPubSub& PubSub();
+
+ /**
+ * Returns the repository manager.
+ *
+ * @return The repository manager.
+ */
+ CRadioRepositoryManager& Repository() const;
+
+ MRadioApplicationSettings& ApplicationSettings() const;
+
+private:
+
+// from base class MRadioEngineInitializer
+
+ CRadioAudioRouter* InitAudioRouterL();
+ CRadioSystemEventCollector* InitSystemEventCollectorL();
+ CRadioSettings* InitSettingsL();
+ CRadioPubSub* InitPubSubL();
+
+// New functions
+
+ /**
+ * Static callback function to be used by the tune delay timer
+ * @param aSelf Pointer to this
+ * @return not used
+ */
+ static TInt TuneDelayCallback( TAny* aSelf );
+
+private: // data
+
+ /**
+ * Radio engine holder
+ * Own.
+ */
+ CRadioEngine* iEngine;
+
+ /**
+ * Radio handler observer
+ * Not own.
+ */
+ MRadioEngineHandlerObserver& iObserver;
+
+ /**
+ * Frequency used by delayed tuning
+ */
+ TUint iFrequency;
+
+ /**
+ * Timer used for delayed tuning
+ * Own.
+ */
+ CPeriodic* iDelayTimer;
+
+ /**
+ * Selected radio region
+ */
+ RadioRegion::Region iRegion;
+
+ };
+
+#endif //_CRADIOENGINEHANDLER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/mradioenginehandlerobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef _MRADIOENGINEHANDLEROBSERVER_H_
+#define _MRADIOENGINEHANDLEROBSERVER_H_
+
+// User includes
+#include "mradioengineobserver.h"
+#include "mradioaudioroutingobserver.h"
+#include "mradiosystemeventobserver.h"
+#include "mradiorepositoryentityobserver.h"
+
+// Class declaration
+NONSHARABLE_CLASS( MRadioEngineHandlerObserver ) : public MRadioEngineObserver
+ , public MRadioAudioRoutingObserver
+ , public MRadioSystemEventObserver
+ , public MRadioRepositoryEntityObserver
+{
+public:
+
+};
+
+#endif // _MRADIOENGINEHANDLEROBSERVER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radiocontroleventlistener.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOCONTROLEVENTLISTENER_H_
+#define RADIOCONTROLEVENTLISTENER_H_
+
+// System includes
+#include <qglobal.h>
+#include <qscopedpointer>
+
+// User includes
+#include "mradiocontroleventobserver.h"
+
+// Forward declarations
+class RadioEngineWrapperPrivate;
+class CRadioRemConTarget;
+
+class RadioControlEventListener : public MRadioControlEventObserver
+{
+ Q_DISABLE_COPY( RadioControlEventListener )
+
+public:
+
+ explicit RadioControlEventListener( RadioEngineWrapperPrivate& engine );
+
+ ~RadioControlEventListener();
+
+ void init();
+
+private:
+
+// from base class MRadioControlEventObserver
+
+ void StepToChannelL( RadioEngine::TRadioTuneDirection aDirection );
+ void SetChannelL( TInt aChannelId );
+ void SeekL( RadioEngine::TRadioTuneDirection aDirection );
+ void StepToFrequencyL( RadioEngine::TRadioTuneDirection aDirection );
+ void SetFrequencyL( TUint32 aFreq );
+ void AdjustVolumeL( RadioEngine::TRadioVolumeSetDirection aDirection );
+ void MuteL( TBool aMute );
+ void PlayL( TBool aDownPressed );
+ void PauseL( TBool aDownPressed );
+ void PausePlayL( TBool aDownPressed );
+ void StopL( TBool aDownPressed );
+ void ForwardL( TBool aDownPressed );
+ void FastForwardL( TBool aDownPressed );
+ void BackwardL( TBool aDownPressed );
+ void RewindL( TBool aDownPressed );
+ void ChannelUpL( TBool aDownPressed );
+ void ChannelDownL( TBool aDownPressed );
+ void VolumeUpL( TBool aDownPressed );
+ void VolumeDownL( TBool aDownPressed );
+ void ChangeViewL( TUid aViewId, TBool aForceChange );
+ void SetAudioRouteL( RadioEngine::TRadioAudioRoute aRoute );
+ void AnswerEndCallL();
+
+private: // data
+
+ RadioEngineWrapperPrivate& mEngine;
+
+ QScopedPointer<CRadioRemConTarget> mRemCon;
+
+};
+
+#endif // RADIOCONTROLEVENTLISTENER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radioenginewrapper.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOENGINEWRAPPER_H
+#define RADIOENGINEWRAPPER_H
+
+// System includes
+
+// User includes
+#include "radiowrapperexport.h"
+#include "radio_global.h"
+
+// Forward declarations
+class RadioEngineWrapperPrivate;
+class RadioSettings;
+class RadioStationHandlerIf;
+class RadioEngineWrapperObserver;
+
+// Class declaration
+class WRAPPER_DLL_EXPORT RadioEngineWrapper
+{
+ Q_DECLARE_PRIVATE_D( d_ptr, RadioEngineWrapper )
+ Q_DISABLE_COPY( RadioEngineWrapper )
+
+public:
+
+ /**
+ * Constructor and destructor
+ */
+ RadioEngineWrapper( RadioStationHandlerIf& stationHandler, RadioEngineWrapperObserver& observer );
+ ~RadioEngineWrapper();
+
+ /**
+ * Checks if the radio engine has been constructed properly
+ */
+ bool isEngineConstructed();
+
+ /**
+ * Getters for things owned by the engine
+ */
+ RadioSettings& settings();
+
+ /**
+ * Getters for region and other region dependent settings
+ */
+ RadioRegion::Region region() const;
+ uint minFrequency() const;
+ uint maxFrequency() const;
+ uint frequencyStepSize() const;
+ bool isFrequencyValid( uint frequency );
+
+ /**
+ * Getters for current radio status
+ */
+ bool isRadioOn() const;
+ bool isScanning() const;
+ uint currentFrequency() const;
+ bool isMuted() const;
+ bool isAntennaAttached() const;
+ bool isUsingLoudspeaker() const;
+
+ /**
+ * Slots to tune to given frequency or preset
+ */
+ void tuneFrequency( uint frequency, const int sender = CommandSender::Unspecified );
+ void tuneWithDelay( uint frequency, const int sender = CommandSender::Unspecified );
+
+ /*!
+ * volume update command slot for the engine
+ */
+ void setVolume( int volume );
+ void toggleMute();
+ void toggleAudioRoute();
+
+ void startSeeking( Seeking::Direction direction );
+ void scanFrequencyBand();
+ void cancelScanFrequencyBand();
+
+private: // data
+
+ /**
+ * Unmodifiable pointer to the private implementation
+ */
+ RadioEngineWrapperPrivate* const d_ptr;
+
+};
+
+#endif // RADIOENGINEWRAPPER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radioenginewrapper_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOENGINEWRAPPER_P_H
+#define RADIOENGINEWRAPPER_P_H
+
+// System includes
+#include <e32std.h>
+#include <qscopedpointer>
+
+// User includes
+#include "radioenginewrapper.h"
+#include "mradioenginehandlerobserver.h"
+
+// Forward declarations
+class CRadioEngineHandler;
+class RadioControlEventListener;
+class RadioRdsListener;
+class RadioSettings;
+class RadioFrequencyScanningHandler;
+class RadioStationHandlerIf;
+class RadioEngineWrapperObserver;
+
+// Constants
+
+// Class declaration
+class RadioEngineWrapperPrivate : public MRadioEngineHandlerObserver
+{
+ Q_DECLARE_PUBLIC( RadioEngineWrapper )
+ Q_DISABLE_COPY( RadioEngineWrapperPrivate )
+
+ friend class RadioFrequencyScanningHandler;
+
+public:
+
+ RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
+ RadioStationHandlerIf& stationHandler,
+ RadioEngineWrapperObserver& observer );
+
+ virtual ~RadioEngineWrapperPrivate();
+
+ /**
+ * Initialization and startup
+ */
+ void init();
+ bool isEngineConstructed();
+
+ /**
+ * Returns the radio settings
+ */
+ RadioSettings& settings();
+
+ /**
+ * Getter for CRadioEngineHandler instance.
+ * Returns reference to the CRadioEngineHandler
+ */
+ CRadioEngineHandler& RadioEnginehandler();
+
+ /**
+ * Functions called from slots to tune to given frequency or preset
+ */
+ void tuneFrequency( uint frequency, const int sender );
+ void tuneWithDelay( uint frequency, const int sender );
+
+ RadioEngineWrapperObserver& observer();
+
+ void startSeeking( Seeking::Direction direction );
+
+private:
+
+// from base class MRadioEngineObserver
+
+ void PowerEventL( TBool aPowerState, TInt aError );
+ void FrequencyEventL( TUint32 aFrequency, RadioEngine::TRadioFrequencyEventReason aReason, TInt aError );
+ void VolumeEventL( TInt aVolume, TInt aError );
+ void MuteEventL( TBool aMuteState, TInt aError );
+ void AudioModeEventL( TInt aAudioMode, TInt aError );
+ void AntennaEventL( TBool aAntennaAttached, TInt aError );
+ void AudioRoutingEventL( TInt aAudioDestination, TInt aError );
+ void SeekingEventL( TInt aSeekingState, TInt aError );
+ void RegionEventL( TInt aRegion, TInt aError );
+ void FmTransmitterEventL( TBool /*aActive*/ ) {}
+
+// from base class MRadioAudioRoutingObserver
+
+ void AudioRouteChangedL( RadioEngine::TRadioAudioRoute aRoute );
+
+// from base class MRadioSystemEventObserver
+
+ void HandleSystemEventL( TRadioSystemEventType aEventType );
+
+// from base class MRadioRepositoryEntityObserver
+
+ void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError );
+ void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TReal& /*aValue*/, TInt /*aError*/ ) {}
+ void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC8& /*aValue*/, TInt /*aError*/ ) {}
+ void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC16& /*aValue*/, TInt /*aError*/ ) {}
+
+// New functions
+
+ /**
+ * Called by RadioFrequencyScanningHandler when the scanning has finished
+ */
+ void frequencyScannerFinished();
+
+private: // data
+
+ /**
+ * Pointer to the public class
+ * Not own.
+ */
+ RadioEngineWrapper* q_ptr;
+
+ /**
+ * Map of radio stations read from the radio engine
+ * Own.
+ */
+ RadioStationHandlerIf& mStationHandler;
+
+ /**
+ * Reference to the wrapper observer
+ */
+ RadioEngineWrapperObserver& mObserver;
+
+ /**
+ * Radio settings handler
+ * Own.
+ */
+ QScopedPointer<RadioSettings> mSettings;
+
+ /**
+ * Radio engine handler.
+ * Own.
+ */
+ QScopedPointer<CRadioEngineHandler> mEngineHandler;
+
+ /**
+ * RemCon listener.
+ * Own.
+ */
+ QScopedPointer<RadioControlEventListener> mControlEventListener;
+
+ /**
+ * Rds listener
+ * Own.
+ */
+ QScopedPointer<RadioRdsListener> mRdsListener;
+
+ /**
+ * Preset scanning handler
+ * Own.
+ */
+ QScopedPointer<RadioFrequencyScanningHandler> mFrequencyScanningHandler;
+
+ /**
+ * Id of the sender of the last tune command. RadioFrequencyStrip or someone else
+ */
+ int mCommandSender;
+
+ /**
+ * Flag to indicate whether or not audio should be routed to loudspeaker
+ */
+ bool mUseLoudspeaker;
+
+ /**
+ * Flag to indicate whether or not the engine is seeking
+ */
+ bool mIsSeeking;
+
+};
+
+#endif // RADIOENGINEWRAPPER_P_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radioenginewrapper_win32_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOENGINEWRAPPER_P_H
+#define RADIOENGINEWRAPPER_P_H
+
+// System includes
+#include <qobject>
+#include <qscopedpointer>
+
+// User includes
+#include "radioenginewrapper.h"
+
+// Forward declarations
+class RadioControlEventListener;
+class RadioRdsListener;
+class RadioSettings;
+class RadioFrequencyScanningHandler;
+class RadioStationHandlerIf;
+class RadioEngineWrapperObserver;
+class T_RadioDataParser;
+class QSettings;
+class QTimer;
+
+// Class declaration
+class WRAPPER_DLL_EXPORT RadioEngineWrapperPrivate : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PUBLIC( RadioEngineWrapper )
+ Q_DISABLE_COPY( RadioEngineWrapperPrivate )
+
+ friend class RadioFrequencyScanningHandler;
+
+public:
+
+ RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
+ RadioStationHandlerIf& stationHandler,
+ RadioEngineWrapperObserver& observer );
+
+ ~RadioEngineWrapperPrivate();
+
+ static RadioEngineWrapperPrivate* instance();
+
+ /**
+ * Initialization and startup
+ */
+ void init();
+ bool isEngineConstructed();
+
+ /**
+ * Returns the radio settings
+ */
+ RadioSettings& settings();
+
+ /**
+ * Functions called from slots to tune to given frequency or preset
+ */
+ void tuneFrequency( uint frequency, const int sender );
+ void tuneWithDelay( uint frequency, const int sender );
+
+ RadioEngineWrapperObserver& observer();
+
+ void startSeeking( Seeking::Direction direction );
+
+// Functions used by the win32 test window
+
+ QString dataParsingError() const;
+
+ void setHeadsetStatus( bool connected );
+
+ void setVolume( int volume );
+
+ void addSong( const QString& artist, const QString& title );
+
+ void clearSong();
+
+ bool isOffline() const;
+ void setOffline( bool offline );
+
+private slots:
+
+ void frequencyEvent();
+
+private:
+
+// New functions
+
+ /**
+ * Called by RadioFrequencyScanningHandler when the scanning has finished
+ */
+ void frequencyScannerFinished();
+
+ void parseData();
+
+private: // data
+
+ /**
+ * Pointer to the public class
+ * Not own.
+ */
+ RadioEngineWrapper* q_ptr;
+
+ /**
+ * Map of radio stations read from the radio engine
+ * Own.
+ */
+ RadioStationHandlerIf& mStationHandler;
+
+ /**
+ * Reference to the wrapper observer
+ */
+ RadioEngineWrapperObserver& mObserver;
+
+ /**
+ * Radio settings handler
+ * Own.
+ */
+ QScopedPointer<RadioSettings> mSettings;
+
+ QTimer* mTuneTimer;
+
+ /**
+ * Preset scanning handler
+ * Own.
+ */
+// QScopedPointer<RadioFrequencyScanningHandler> mFrequencyScanningHandler;
+
+// QScopedPointer<T_RadioDataParser> mDataParser;
+
+ QString mParsingError;
+
+ /**
+ * Id of the sender of the last tune command. RadioFrequencyStrip or someone else
+ */
+ int mCommandSender;
+
+ /**
+ * Flag to indicate whether or not audio should be routed to loudspeaker
+ */
+ bool mUseLoudspeaker;
+
+ /**
+ * Flag to indicate whether or not the engine is seeking
+ */
+ bool mIsSeeking;
+
+ QScopedPointer<QSettings> mEngineSettings;
+
+ bool mAntennaAttached;
+
+ uint mFrequency;
+
+ int mVolume;
+
+ int mMaxVolume;
+ int mFrequencyStepSize;
+ RadioRegion::Region mRegionId;
+ uint mMinFrequency;
+ uint mMaxFrequency;
+
+};
+
+#endif // RADIOENGINEWRAPPER_P_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radioenginewrapperobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOENGINEWRAPPEROBSERVER_H_
+#define RADIOENGINEWRAPPEROBSERVER_H_
+
+#include "radio_global.h"
+
+class RadioEngineWrapperObserver
+{
+public:
+
+ virtual void tunedToFrequency( uint frequency, int commandSender ) = 0;
+ virtual void seekingStarted( Seeking::Direction direction ) = 0;
+ virtual void radioStatusChanged( bool radioIsOn ) = 0;
+
+ virtual void rdsAvailabilityChanged( bool available ) = 0;
+
+ virtual void volumeChanged( int volume ) = 0;
+ virtual void muteChanged( bool muted ) = 0;
+
+ virtual void audioRouteChanged( bool loudspeaker ) = 0;
+ virtual void scanAndSaveFinished() = 0;
+ virtual void headsetStatusChanged( bool connected ) = 0;
+
+ virtual void skipPrevious() = 0;
+ virtual void skipNext() = 0;
+
+};
+
+#endif // RADIOENGINEWRAPPEROBSERVER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radioenummapper.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOENUMMAPPER_H_
+#define RADIOENUMMAPPER_H_
+
+/*!
+ * Convenience macros to help define enum maps.
+ * Note! It is important to define the values so that the UI value is on the left
+ * and the engine value is on the right. The lookup functions expect them in this order.
+ *
+ * Example:
+ * BEGIN_ENUM_MAP( KSomeMap )
+ * ENUM_MAP_ITEM( UiNamespace::UiValue1, EngineNamespace::EEngineValue1 ),
+ * ENUM_MAP_ITEM( UiNamespace::UiValue2, EngineNamespace::EEngineValue2 )
+ * END_ENUM_MAP( KSomeMap )
+ */
+#define BEGIN_ENUM_MAP(name) const RadioEnumMapper::EnumMap name[] = {
+#define ENUM_MAP_ITEM(ui_enum, engine_enum ) { ui_enum, engine_enum }
+#define END_ENUM_MAP(name) }; const TInt name ## Count = sizeof ( name ) / sizeof ( name[0] );
+
+/*!
+ * Convenience macros to do the mappings
+ */
+#define MAP_FROM_UI_ENUM(type,uienum, map) RadioEnumMapper::FromUiEnum<type>( uienum, map, map ## Count )
+#define MAP_TO_UI_ENUM(type,uienum, map) RadioEnumMapper::ToUiEnum<type>( uienum, map, map ## Count )
+
+class RadioEnumMapper
+{
+public:
+
+ /*!
+ * Item in the enum map. Ties a value in the UI enum to its correspondent in the engine enum
+ */
+ struct EnumMap
+ {
+ int iUiEnum;
+ int iEngineEnum;
+ };
+
+ /*!
+ * Maps engine enum value to its ui correspondent.
+ *
+ * @param aValue Enum value in the engine
+ * @param aMap Enum value map
+ * @param aCount Amount of items in the map
+ * @return Enum value in the ui
+ */
+ template<typename UI_ENUM, typename ENGINE_ENUM>
+ inline static UI_ENUM ToUiEnum( ENGINE_ENUM aValue, const EnumMap* aMap, int aCount )
+ {
+ return static_cast<UI_ENUM>( MapToUiEnum( aValue, aMap, aCount ) );
+ }
+
+ /*!
+ * Maps ui enum value to its engine correspondent.
+ *
+ * @param aValue Enum value in the Ui
+ * @param aMap Enum value map
+ * @param aCount Amount of items in the map
+ * @return Enum value in the engine
+ */
+ template<typename ENGINE_ENUM, typename UI_ENUM>
+ inline static ENGINE_ENUM FromUiEnum( UI_ENUM aValue, const EnumMap* aMap, int aCount )
+ {
+ return static_cast<ENGINE_ENUM>( MapFromUiEnum( aValue, aMap, aCount ) );
+ }
+
+private:
+
+ /*!
+ * Maps engine enum value to its ui correspondent.
+ * Type-unsafe version. Not to be used directly!
+ *
+ * @param aValue Enum value in the engine
+ * @param aMap Enum value map
+ * @param aCount Amount of items in the map
+ * @return Enum value in the ui
+ */
+ static int MapToUiEnum( int aValue, const EnumMap* aMap, int aCount )
+ {
+ for ( int i = 0; i < aCount; ++i ) {
+ if ( aMap[i].iUiEnum == aValue ) {
+ return aMap[i].iEngineEnum;
+ }
+ }
+ return -1;
+ }
+
+ /*!
+ * Maps ui enum value to its engine correspondent.
+ * Type-unsafe version. Not to be used directly!
+ *
+ * @param aValue Enum value in the Ui
+ * @param aMap Enum value map
+ * @param aCount Amount of items in the map
+ * @return Enum value in the engine
+ */
+ static int MapFromUiEnum( int aValue, const EnumMap* aMap, int aCount )
+ {
+ for ( int i = 0; i < aCount; ++i ) {
+ if ( aMap[i].iEngineEnum == aValue ) {
+ return aMap[i].iUiEnum;
+ }
+ }
+ return -1;
+ }
+
+ /*
+ * Hidden constructor and destructor to prevent instantiation
+ */
+ RadioEnumMapper() {}
+ ~RadioEnumMapper() {}
+
+};
+
+#endif // RADIOENUMMAPPER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radiofrequencyscanninghandler.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOFREQUENCYSCANNINGHANDLER_H
+#define RADIOFREQUENCYSCANNINGHANDLER_H
+
+// System includes
+#include <qobject>
+#include <qmap>
+
+// User includes
+#include "mradioscanobserver.h"
+
+// Forward declarations
+class RadioEngineWrapperPrivate;
+
+// Constants
+
+// Class declaration
+class RadioFrequencyScanningHandler : public QObject
+ , public MRadioScanObserver
+ {
+ Q_OBJECT
+public:
+
+ explicit RadioFrequencyScanningHandler( RadioEngineWrapperPrivate& radioEngine );
+
+// from base class MRadioScanObserver
+
+ void ScanFrequencyEventL( TUint32 aFrequency );
+ void ScanCompletedEventL( TInt aError );
+
+// New functions
+
+ /*!
+ * Starts the scanning
+ * @param muted flag to indicate if the audio was already muted when scanning began
+ */
+ void startScanning( bool muted );
+
+ /*!
+ * Adds a new station that was found
+ * @param frequency Frequency of the found station
+ */
+ void addFoundStation( const uint frequency );
+
+ /*!
+ * Cancels the scanning process
+ */
+ void cancel();
+
+private slots:
+
+ void delayedStart();
+
+private: // data
+
+ /**
+ * Reference to the engine
+ */
+ RadioEngineWrapperPrivate& mEngine;
+
+ /**
+ * Last scanned frequency. Used to know when the scanning has looped around the
+ * frequency band and it should stop
+ */
+ uint mLastFoundFrequency;
+ };
+
+#endif // RADIOFREQUENCYSCANNINGHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radiordslistener.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIORDSLISTENER_H_
+#define RADIORDSLISTENER_H_
+
+// user includes
+#include "mradiordsdataobserver.h"
+
+class RadioStationHandlerIf;
+class RadioEngineWrapperPrivate;
+
+class RadioRdsListener : public MRadioRdsDataObserver
+{
+public:
+
+ RadioRdsListener( RadioStationHandlerIf& stationHandler, RadioEngineWrapperPrivate& wrapper );
+
+private:
+
+// from base class MFMRadioRdsObserver
+
+ void RdsAvailable( TUint32 aFrequency, TBool aAvailable );
+ void RdsAfSearchBegin();
+ void RdsAfSearchEnd( TUint32 aFrequency, TInt aError );
+ void RdsAfSearchStateChange( TBool aEnabled );
+ void RdsDataProgrammeService( TUint32 aFrequency, const TDesC& aProgramService );
+ void RdsDataRadioText( TUint32 aFrequency, const TDesC& aRadioText );
+ void RdsDataRadioTextPlus( TUint32 aFrequency, const TInt aRadioTextPlusClass, const TDesC& aRadioText );
+ void RdsDataGenre( TUint32 aFrequency, const TInt aGenre );
+ void RdsDataPiCode( TUint32 aFrequency, const TInt aPiCode );
+
+private: //data
+
+ RadioStationHandlerIf& mStationHandler;
+
+ RadioEngineWrapperPrivate& mWrapper;
+};
+
+#endif // RADIORDSLISTENER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radiosettings.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSETTINGS_H_
+#define RADIOSETTINGS_H_
+
+// User includes
+#include "radiowrapperexport.h"
+
+// Forward declarations
+class RadioSettingsPrivate;
+
+// Class declaration
+class WRAPPER_DLL_EXPORT RadioSettings
+ {
+ Q_DECLARE_PRIVATE_D( d_ptr, RadioSettings )
+ Q_DISABLE_COPY( RadioSettings )
+
+ friend class RadioEngineWrapperPrivate;
+
+public:
+
+ // First time start
+ bool isFirstTimeStart();
+
+ // Favorites
+ bool showFavorites() const;
+ void setShowFavorites( bool showFavorites );
+ bool toggleShowFavorites();
+
+private:
+
+ explicit RadioSettings();
+
+private: // data
+
+ /**
+ * Unmodifiable pointer to the private implementation
+ */
+ RadioSettingsPrivate* const d_ptr;
+
+ };
+
+#endif // RADIOSETTINGS_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radiosettings_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSETTINGS_P_H_
+#define RADIOSETTINGS_P_H_
+
+class MRadioApplicationSettings;
+
+class RadioSettingsPrivate
+{
+ Q_DECLARE_PUBLIC( RadioSettings )
+ Q_DISABLE_COPY( RadioSettingsPrivate )
+
+ /**
+ * On/Off type flags.
+ *
+ * Bit shifting in the value initialization is used to easily create
+ * progressing bit patterns like so:
+ * 1 << 0 equals 0001 equals 0x1
+ * 1 << 1 equals 0010 equals 0x2
+ * 1 << 2 equals 0100 equals 0x4
+ * 1 << 3 equals 1000 equals 0x8
+ */
+ enum ToggleFlag
+ {
+ EShowFavorites = 1 << 0
+ };
+ Q_DECLARE_FLAGS( Toggles, ToggleFlag )
+
+public:
+
+ RadioSettingsPrivate( RadioSettings* settingsPublic );
+
+ ~RadioSettingsPrivate();
+
+ void init( MRadioApplicationSettings* storage );
+
+ // First time start
+ bool isFirstTimeStart();
+
+ bool isFlagSet( ToggleFlag flag ) const;
+ void toggleFlag( ToggleFlag flag );
+ void saveFlags();
+
+private: // data
+
+ /**
+ * Pointer to the public class
+ * Not own.
+ */
+ RadioSettings* q_ptr;
+
+ Toggles mFlags;
+
+ MRadioApplicationSettings* mSettingsStorage;
+
+};
+
+#endif // RADIOSETTINGS_P_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/radiostationhandlerif.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATIONHANDLERIF_H_
+#define RADIOSTATIONHANDLERIF_H_
+
+// System includes
+#include <qglobal.h>
+
+// Forward declarations
+class RadioStationIf;
+
+class RadioStationHandlerIf
+{
+public:
+
+ virtual uint currentFrequency() const = 0;
+ virtual int currentPresetIndex() const = 0;
+
+ virtual void setCurrentStation( uint frequency ) = 0;
+
+ virtual bool containsFrequency( uint frequency ) = 0;
+
+ virtual bool containsPresetIndex( int presetIndex ) = 0;
+
+ virtual void startDynamicPsCheck() = 0;
+
+ virtual void addScannedFrequency( uint frequency ) = 0;
+
+ virtual void removeLocalStations() = 0;
+
+ virtual void setCurrentPsName( uint frequency, const QString& name ) = 0;
+ virtual void setCurrentRadioText( uint frequency, const QString& radioText ) = 0;
+ virtual void setCurrentRadioTextPlus( uint frequency, int rtClass, const QString& rtItem ) = 0;
+ virtual void setCurrentPiCode( uint frequency, int piCode ) = 0;
+ virtual void setCurrentGenre( uint frequency, int genre ) = 0;
+
+};
+
+#endif // RADIOSTATIONHANDLERIF_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/inc/t_radiodataparser.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef T_RADIODATAPARSER_H
+#define T_RADIODATAPARSER_H
+
+// System includes
+#include <qscopedpointer>
+#include <qxml.h>
+#include <qstring>
+#include <qlist>
+
+// Forward declarations
+class T_RadioDataParser;
+
+namespace RadioData
+{
+ class SettingHolder;
+
+ /**
+ * Base class for all settings
+ */
+ class Setting
+ {
+ public:
+
+ virtual ~Setting() {}
+ virtual void setValue( SettingHolder& holder,
+ T_RadioDataParser& parser ) {};
+
+ };
+
+ /**
+ * Holder to store a setting during parsing
+ */
+ class SettingHolder : public Setting
+ {
+ public:
+
+ SettingHolder();
+ ~SettingHolder();
+
+ QString mName;
+ QString mValue;
+ QList<SettingHolder*> mChildren;
+
+ };
+
+ class RdsItem : public Setting
+ {
+ public:
+ enum Type
+ {
+ Unknown
+ ,RdsPsName
+ ,RdsRadioText
+ ,RdsRadioTextPlus
+ ,RdsPty
+ ,RdsPiCode
+ };
+
+ RdsItem();
+ ~RdsItem();
+
+ void setValue( SettingHolder& holder,
+ T_RadioDataParser& parser );
+
+ void initChildren( SettingHolder& holder,
+ T_RadioDataParser& parser );
+
+ enum rtClass{ Title = 1, Artist = 4, Homepage = 39 };
+
+ class RtPlusHolder
+ {
+ public:
+
+ RtPlusHolder();
+
+ int mDelay;
+ int mRtClass;
+ QString mRtItem;
+ };
+
+ Type mType;
+ QStringList mRdsItems;
+ QList<RtPlusHolder*> mRtPlusItems;
+ int mCurrentRtPlusIndex;
+
+ };
+
+ class RdsGroup : public Setting
+ {
+ public:
+
+ RdsGroup( const QXmlAttributes& atts, T_RadioDataParser& parser );
+ ~RdsGroup();
+
+ int mInterval;
+ int mCount;
+ QList<RdsItem*> mRdsItems;
+
+ };
+
+ class Station : public Setting
+ {
+ public:
+
+ Station();
+ ~Station();
+
+ void setValue( SettingHolder& holder,
+ T_RadioDataParser& parser );
+
+ uint mFrequency;
+ QList<RdsGroup*> mRdsArray;
+
+ };
+
+ class EngineSettings : public Setting
+ {
+ public:
+
+ EngineSettings();
+
+ void setValue( SettingHolder& holder,
+ T_RadioDataParser& parser );
+
+ int mMaxVolume;
+ int mFrequencyStepSize;
+ int mRegionId;
+ uint mMinFrequency;
+ uint mMaxFrequency;
+
+ };
+
+ typedef QList<Setting*> SettingArray;
+
+}
+
+class T_RadioDataParser : public QXmlDefaultHandler
+{
+public:
+
+ T_RadioDataParser();
+ virtual ~T_RadioDataParser();
+
+ bool parse();
+
+ QString errorString() const;
+
+ int parseInt( const QString& string, int defaultVal );
+ int parseTime( const QString& string, int defaultVal );
+
+private:
+
+// from base class QXmlDefaultHandler
+
+ bool startDocument();
+ bool endDocument();
+ bool startElement( const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts );
+ bool endElement( const QString& namespaceURI, const QString& localName, const QString& qName );
+ bool characters( const QString& ch );
+ bool error( const QXmlParseException& exception );
+ bool fatalError( const QXmlParseException& exception );
+
+// New functions
+
+ void handleStartRadioSettings( const QXmlAttributes& atts );
+ void handleEndRadioSettings();
+ void handleStartSetting( const QXmlAttributes& atts );
+ void handleEndSetting();
+ void handleStartStation( const QXmlAttributes& atts );
+ void handleEndStation();
+ void handleStartRdsGroup( const QXmlAttributes& atts );
+ void handleEndRdsGroup();
+ void handleStartRdsData( const QXmlAttributes& atts );
+ void handleEndRdsData();
+
+ void pushToSettingStack( RadioData::Setting* setting, RadioData::SettingArray& array );
+ RadioData::Setting* topOfSettingStack( RadioData::SettingArray& array );
+ RadioData::Setting* popFromSettingStack( RadioData::SettingArray& array );
+
+private: // data
+
+ QScopedPointer<QXmlSimpleReader> mReader;
+ QScopedPointer<QXmlInputSource> mSource;
+
+ QString mErrorString;
+
+ int mCurrentPresetIndex;
+
+ RadioData::SettingArray mSettingStack;
+
+ RadioData::SettingArray mSettingHolderStack;
+
+public:
+
+ RadioData::EngineSettings mEngineSettings;
+
+ QList<RadioData::Station*> mStations;
+
+};
+
+#endif // T_RADIODATAPARSER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/radioenginewrapper.pro Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,102 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+include(../buildflags.pri)
+
+TEMPLATE = lib
+TARGET = radioenginewrapper
+CONFIG += dll
+DEFINES += BUILD_WRAPPER_DLL
+win32:DESTDIR = ../bin
+
+# Wrapper does not depend on QtGui or Orbit
+QT = core
+CONFIG -= gui hb
+USE_DUMMY_RADIO_DATA:QT += xml
+
+symbian: {
+ DEFINES += SYMBIAN
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+
+ INCLUDEPATH += ../../radioengine/utils/api
+ INCLUDEPATH += ../../radioengine/settings/api
+ INCLUDEPATH += ../../radioengine/engine/api
+}
+
+win32: {
+ INCLUDEPATH += inc/win32
+}
+INCLUDEPATH += inc
+INCLUDEPATH += commoninc
+
+
+USE_STUBBED_RADIOENGINE {
+ symbian:LIBS += -lfmradioengine_stub
+} else {
+ symbian:LIBS *= -lradioengineutils
+ symbian:LIBS *= -lradioenginesettings
+ symbian:LIBS *= -lradioengine
+}
+
+DEPENDPATH += $$INCLUDEPATH src
+
+# $$_PRO_FILE_PWD_ points to the directory of the pro file
+MOC_DIR = $$_PRO_FILE_PWD_/tmp
+
+# Input
+HEADERS += radiowrapperexport.h
+HEADERS += radio_global.h
+HEADERS += radiologger.h
+HEADERS += radioenginewrapper.h
+HEADERS += radiosettings.h
+HEADERS += radiostationhandlerif.h
+
+INTERNAL_HEADERS += radiosettings_p.h
+
+symbian: {
+ HEADERS += cradioenginehandler.h
+ HEADERS += mradioenginehandlerobserver.h
+ HEADERS += radiofrequencyscanninghandler.h
+ HEADERS += radiocontroleventlistener.h
+ HEADERS += radiordslistener.h
+
+ INTERNAL_HEADERS += radioenginewrapper_p.h
+}
+
+#USE_DUMMY_RADIO_DATA:HEADERS += t_radiodataparser.h
+
+win32:HEADERS += radioenginewrapper_win32_p.h
+win32:HEADERS += $$INTERNAL_HEADERS
+
+SOURCES += radiosettings.cpp
+SOURCES += radiologger.cpp
+
+symbian: {
+ SOURCES += radiosettings_p.cpp
+ SOURCES += radioenginewrapper.cpp
+ SOURCES += radioenginewrapper_p.cpp
+ SOURCES += cradioenginehandler.cpp
+ SOURCES += radiofrequencyscanninghandler.cpp
+ SOURCES += radiocontroleventlistener.cpp
+ SOURCES += radiordslistener.cpp
+}
+
+#USE_DUMMY_RADIO_DATA:SOURCES += t_radiodataparser.cpp
+
+win32:SOURCES += radiosettings_win32_p.cpp
+win32:SOURCES += radioenginewrapper_win32.cpp
+win32:SOURCES += radioenginewrapper_win32_p.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/cradioenginehandler.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,467 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifdef USE_STUBBED_RADIOENGINE
+# include "t_cradioengine.h"
+# include "t_mrdshandler.h"
+#else
+# include "cradioengine.h"
+# include "cradioaudiorouter.h"
+# include "cradiosystemeventcollector.h"
+# include "cradiosettings.h"
+# include "mradioenginesettings.h"
+# include "cradiopubsub.h"
+# include "cradiorepositorymanager.h"
+# include "mradiordsreceiver.h"
+#endif
+
+#include "cradioenginehandler.h"
+#include "mradioenginehandlerobserver.h"
+#include "radio_global.h"
+#include "radiologger.h"
+#include "radioenummapper.h"
+
+/**
+ * Delayed tuning delay
+ */
+const TInt KTuneDelay = 100000;
+
+/*!
+ * Map to translate seek direction enum from its definition in the engine to
+ * its definition in the ui and vice versa
+ */
+BEGIN_ENUM_MAP( KSeekDirectionMap )
+ ENUM_MAP_ITEM( Seeking::Down, RadioEngine::ERadioDown ),
+ ENUM_MAP_ITEM( Seeking::Up, RadioEngine::ERadioUp )
+END_ENUM_MAP( KSeekDirectionMap )
+
+/*!
+ * Convenience macro to do the mapping of seek directions
+ */
+#define MAP_FROM_UI_DIRECTION(ui_enum) MAP_FROM_UI_ENUM( RadioEngine::TRadioTuneDirection, ui_enum, KSeekDirectionMap )
+
+/*!
+ * Map to translate radio region enum from its definition in the engine to
+ * its definition in the ui and vice versa
+ */
+BEGIN_ENUM_MAP( KRegionMap )
+ ENUM_MAP_ITEM( RadioRegion::None, ERadioRegionNone ),
+ ENUM_MAP_ITEM( RadioRegion::Default, ERadioRegionDefault ),
+ ENUM_MAP_ITEM( RadioRegion::Japan, ERadioRegionJapan ),
+ ENUM_MAP_ITEM( RadioRegion::America, ERadioRegionAmerica ),
+ ENUM_MAP_ITEM( RadioRegion::Poland, ERadioRegionPoland ),
+END_ENUM_MAP( KRegionMap )
+
+/*!
+ * Convenience macros to do the mapping of radio regions
+ */
+#define MAP_FROM_UI_REGION(ui_enum) MAP_FROM_UI_ENUM( TRadioRegion, ui_enum, KRegionMap )
+#define MAP_TO_UI_REGION(engine_enum) MAP_TO_UI_ENUM( RadioRegion::Region, engine_enum, KRegionMap )
+
+/*!
+ * Map to translate seeking state enum from its definition in the engine to
+ * its definition in the ui and vice versa
+ */
+BEGIN_ENUM_MAP( KSeekingStateMap )
+ ENUM_MAP_ITEM( Seeking::NotSeeking, RadioEngine::ERadioNotSeeking ),
+ ENUM_MAP_ITEM( Seeking::SeekingUp, RadioEngine::ERadioSeekingUp ),
+ ENUM_MAP_ITEM( Seeking::SeekingDown, RadioEngine::ERadioSeekingDown )
+END_ENUM_MAP( KSeekingStateMap )
+
+/*!
+ * Convenience macro to do the mapping of seeking states
+ */
+#define MAP_TO_UI_SEEKING_STATE(ui_enum) MAP_TO_UI_ENUM( Seeking::State, ui_enum, KSeekingStateMap )
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineHandler::CRadioEngineHandler( MRadioEngineHandlerObserver& aObserver )
+ : iObserver( aObserver )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineHandler::~CRadioEngineHandler()
+ {
+ if ( iEngine ) {
+ iEngine->Settings().Repository().RemoveObserver( &iObserver );
+ }
+
+ delete iEngine;
+ delete iDelayTimer;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::ConstructL()
+ {
+ LOG_METHOD;
+
+ iDelayTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+
+ iEngine = CRadioEngine::NewL( *this );
+
+ iEngine->SystemEventCollector().AddObserverL( &iObserver );
+ iEngine->Settings().Repository().AddObserverL( &iObserver );
+ iEngine->AudioRouter().SetAudioRouteL( RadioEngine::ERadioHeadset );
+ iEngine->AddObserverL( &iObserver );
+
+ iRegion = MAP_TO_UI_REGION( iEngine->Settings().EngineSettings().RegionId() );
+
+// iEngineHolder->PubSub().SetControlEventObserver( &iObserver );
+
+// iRadioEngine->SetVolumeMuted( EFalse );
+// iRadioEngine->SetVolume( MaxVolume() );
+
+// CVRRepositoryManager::GetRepositoryValueL( KVRCRUid, KVRCRLaunchCount, usageCount );
+// CVRRepositoryManager::SetRepositoryValueL( KVRCRUid, KVRCRLaunchCount, ++usageCount );
+// iControlEventObserver = CVRControlEventObserverImpl::NewL( *this );
+// doc->PubSubL().SetControlEventObserver( iControlEventObserver );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the rds data observer
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::SetRdsObserver( MRadioRdsDataObserver* aObserver )
+ {
+ TRAP_IGNORE( iEngine->RdsReceiver().AddObserverL( aObserver ) );
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the radio status.
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineHandler::IsRadioOn()
+ {
+ return iEngine->Settings().EngineSettings().IsPowerOn();
+ }
+
+// ---------------------------------------------------------------------------
+// Tune to the specified frequency
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::Tune( TUint aFrequency )
+ {
+ iEngine->SetFrequency( aFrequency );
+ }
+
+// ---------------------------------------------------------------------------
+// Tune to the specified frequency after a delay
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::TuneWithDelay( TUint aFrequency )
+ {
+ iFrequency = aFrequency;
+ iDelayTimer->Cancel();
+ iDelayTimer->Start( KTuneDelay, KTuneDelay, TCallBack( TuneDelayCallback, this ) );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the audio mute state
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::SetMuted( const TBool aMuted )
+ {
+ iEngine->SetVolumeMuted( aMuted );
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the audio mute state
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineHandler::IsMuted() const
+ {
+ return iEngine->Settings().EngineSettings().IsVolMuted();
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the volume level of the FM radio
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::SetVolume( TInt aVolume )
+ {
+ if ( Volume() != aVolume )
+ {
+ if ( aVolume > 0 )
+ {
+ iEngine->SetVolumeMuted( EFalse );
+ }
+
+ iEngine->SetVolume( aVolume );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the volumelevel.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineHandler::Volume() const
+ {
+ return iEngine->Settings().EngineSettings().Volume();
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the max volumelevel.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineHandler::MaxVolume() const
+ {
+ return iEngine->MaxVolumeLevel();
+ }
+
+// ---------------------------------------------------------------------------
+// Increases the volume by one increment
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::IncreaseVolume()
+ {
+ iEngine->AdjustVolume( RadioEngine::ERadioIncVolume );
+ }
+
+// ---------------------------------------------------------------------------
+// Decreases the volume by one increment
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::DecreaseVolume()
+ {
+ iEngine->AdjustVolume( RadioEngine::ERadioDecVolume );
+ }
+
+// ---------------------------------------------------------------------------
+// Checks if the antenna is attached
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineHandler::IsAntennaAttached() const
+ {
+ return iEngine->IsAntennaAttached();
+ }
+
+// ---------------------------------------------------------------------------
+// Retrieves the current frequency.
+// ---------------------------------------------------------------------------
+//
+TUint CRadioEngineHandler::TunedFrequency() const
+ {
+ return iEngine->Settings().EngineSettings().TunedFrequency();
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the minimum allowed frequency in the current region
+// ---------------------------------------------------------------------------
+//
+TUint CRadioEngineHandler::MinFrequency() const
+ {
+ return iEngine->Settings().EngineSettings().MinFrequency();
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the maximum allowed frequency in the current region
+// ---------------------------------------------------------------------------
+//
+TUint CRadioEngineHandler::MaxFrequency() const
+ {
+ return iEngine->Settings().EngineSettings().MaxFrequency();
+ }
+
+// ---------------------------------------------------------------------------
+// Checks if the given frequency is valid in the current region
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineHandler::IsFrequencyValid( TUint aFrequency ) const
+ {
+ return iEngine->IsFrequencyValid( aFrequency );
+ }
+
+// ---------------------------------------------------------------------------
+// Scan up to the next available frequency
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::Seek( Seeking::Direction direction )
+ {
+ LOG_TIMESTAMP( "Seek" );
+ iEngine->Seek( MAP_FROM_UI_DIRECTION( direction ) );
+ }
+
+// ---------------------------------------------------------------------------
+// Cancel previously requested scan, and return to the
+// already tuned frequency
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::CancelSeek()
+ {
+ iEngine->CancelSeek();
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the engine seeking state
+// ---------------------------------------------------------------------------
+//
+Seeking::State CRadioEngineHandler::SeekingState() const
+ {
+ return MAP_TO_UI_SEEKING_STATE( iEngine->Seeking() );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::StartScan( MRadioScanObserver& aObserver )
+ {
+ iEngine->StartScan( aObserver );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::StopScan( TInt aError )
+ {
+ iEngine->StopScan( aError );
+ }
+
+// ---------------------------------------------------------------------------
+// return step size for tuning.
+// ---------------------------------------------------------------------------
+//
+TUint32 CRadioEngineHandler::FrequencyStepSize() const
+ {
+ return iEngine->Settings().EngineSettings().FrequencyStepSize();
+ }
+
+// ----------------------------------------------------------------------------------------------------
+// Returns the selected radio region
+// ----------------------------------------------------------------------------------------------------
+//
+RadioRegion::Region CRadioEngineHandler::Region() const
+ {
+ return iRegion;
+ }
+
+// ---------------------------------------------------------------------------
+// Sets whether or not audio should be routed to loudspeaker
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineHandler::SetAudioRouteToLoudspeaker( TBool aLoudspeaker )
+ {
+ TRAPD( err, iEngine->AudioRouter().SetAudioRouteL( aLoudspeaker ? RadioEngine::ERadioSpeaker
+ : RadioEngine::ERadioHeadset ) );
+ if ( err )
+ {
+ LOG_FORMAT( "Failed to set audioroute: UseLoudspeadker: %d", aLoudspeaker );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Checks if audio is routed to loudspeaker
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineHandler::IsAudioRoutedToLoudspeaker() const
+ {
+ return iEngine->Settings().EngineSettings().AudioRoute() == RadioEngine::ERadioSpeaker;
+ }
+
+// ---------------------------------------------------------------------------
+// Returns ar reference to the publish & subscribe handler
+// ---------------------------------------------------------------------------
+//
+CRadioPubSub& CRadioEngineHandler::PubSub()
+ {
+ return *iEngine->PubSub();
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the repository manager.
+// ---------------------------------------------------------------------------
+//
+CRadioRepositoryManager& CRadioEngineHandler::Repository() const
+ {
+ return iEngine->Settings().Repository();
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the repository manager.
+// ---------------------------------------------------------------------------
+//
+MRadioApplicationSettings& CRadioEngineHandler::ApplicationSettings() const
+ {
+ return iEngine->Settings().ApplicationSettings();
+ }
+
+// ---------------------------------------------------------------------------
+// From MRadioEngineInitializer
+//
+// ---------------------------------------------------------------------------
+//
+CRadioAudioRouter* CRadioEngineHandler::InitAudioRouterL()
+ {
+ return CRadioAudioRouter::NewL( iObserver );
+ }
+
+// ---------------------------------------------------------------------------
+// From MRadioEngineInitializer
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSystemEventCollector* CRadioEngineHandler::InitSystemEventCollectorL()
+ {
+ return CRadioSystemEventCollector::NewL();
+ }
+
+// ---------------------------------------------------------------------------
+// From MRadioEngineInitializer
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSettings* CRadioEngineHandler::InitSettingsL()
+ {
+ return CRadioSettings::NewL();
+ }
+
+// ---------------------------------------------------------------------------
+// From MRadioEngineInitializer
+//
+// ---------------------------------------------------------------------------
+//
+CRadioPubSub* CRadioEngineHandler::InitPubSubL()
+ {
+ return CRadioPubSub::NewL();
+ }
+
+// --------------------------------------------------------------------------------
+// Static callback function to be used by the tune delay timer
+// --------------------------------------------------------------------------------
+//
+TInt CRadioEngineHandler::TuneDelayCallback( TAny* aSelf )
+ {
+ CRadioEngineHandler* self = static_cast<CRadioEngineHandler*>( aSelf );
+ self->iDelayTimer->Cancel();
+ self->Tune( self->iFrequency );
+ return 0; // Not used by CPeriodic
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radiocontroleventlistener.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "radiocontroleventlistener.h"
+#include "radioenginewrapper_p.h"
+#include "radioenginewrapperobserver.h"
+#include "cradioenginehandler.h"
+#include "radiologger.h"
+#include "cradioremcontarget.h"
+/*!
+ *
+ */
+RadioControlEventListener::RadioControlEventListener( RadioEngineWrapperPrivate& engine ) :
+ mEngine( engine )
+{
+}
+
+/*!
+ *
+ */
+RadioControlEventListener::~RadioControlEventListener()
+{
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::init()
+{
+ TRAPD( err, mRemCon.reset( CRadioRemConTarget::NewL() ) );
+ LOG_ASSERT( !err, LOG_FORMAT( "RadioControlEventListener::init Failed with err, %d", err ) );
+
+ if ( !err ) {
+ mRemCon->SetControlEventObserver( this );
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::StepToChannelL( RadioEngine::TRadioTuneDirection DEBUGVAR( aDirection ) )
+{
+ LOG_FORMAT( "RadioControlEventListener::StepToChannelL: direction: %d", aDirection );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::SetChannelL( TInt DEBUGVAR( aChannelId ) )
+{
+ LOG_FORMAT( "RadioControlEventListener::SetChannelL: Channel: %d", aChannelId );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::SeekL( RadioEngine::TRadioTuneDirection aDirection )
+{
+ LOG_FORMAT( "RadioControlEventListener::SeekL: Direction: %d", aDirection );
+ mEngine.startSeeking( aDirection == RadioEngine::ERadioDown ? Seeking::Down : Seeking::Up );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::StepToFrequencyL( RadioEngine::TRadioTuneDirection DEBUGVAR( aDirection ) )
+{
+ LOG_FORMAT( "RadioControlEventListener::StepToFrequencyL: Direction: %d", aDirection );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::SetFrequencyL( TUint32 DEBUGVAR( aFreq ) )
+{
+ LOG_FORMAT( "RadioControlEventListener::SetFrequencyL: Frequency: %d", aFreq );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::AdjustVolumeL( RadioEngine::TRadioVolumeSetDirection DEBUGVAR( aDirection ) )
+{
+ LOG_FORMAT( "RadioControlEventListener::AdjustVolumeL: Direction: %d", aDirection );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::MuteL( TBool aMute )
+{
+ LOG_FORMAT( "RadioControlEventListener::MuteL: Mute: %d", aMute );
+ mEngine.RadioEnginehandler().SetMuted( aMute );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::PlayL( TBool aDownPressed )
+{
+ if( aDownPressed )
+ {
+ mEngine.RadioEnginehandler().SetMuted( false );
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::PauseL( TBool aDownPressed )
+{
+ if( aDownPressed )
+ {
+ mEngine.RadioEnginehandler().SetMuted( true );
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::PausePlayL( TBool aDownPressed )
+{
+ if( aDownPressed )
+ {
+ const TBool muted = !mEngine.RadioEnginehandler().IsMuted();
+ mEngine.RadioEnginehandler().SetMuted( muted );
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::StopL( TBool aDownPressed )
+{
+ if( aDownPressed )
+ {
+ mEngine.RadioEnginehandler().SetMuted( ETrue );
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::ForwardL( TBool aDownPressed )
+{
+ if( aDownPressed )
+ {
+ mEngine.observer().skipNext();
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::FastForwardL( TBool aDownPressed )
+{
+ if( aDownPressed )
+ {
+ mEngine.startSeeking( Seeking::Up );
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::BackwardL( TBool aDownPressed )
+{
+ if( aDownPressed )
+ {
+ mEngine.observer().skipPrevious();
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::RewindL( TBool aDownPressed )
+{
+ if( aDownPressed )
+ {
+ mEngine.startSeeking( Seeking::Down );
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::ChannelUpL( TBool DEBUGVAR( aDownPressed ) )
+{
+ LOG_FORMAT( "RadioControlEventListener::ChannelUpL: Down: %d", aDownPressed );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::ChannelDownL( TBool DEBUGVAR( aDownPressed ) )
+{
+ LOG_FORMAT( "RadioControlEventListener::ChannelDownL: Down: %d", aDownPressed );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::VolumeUpL( TBool aDownPressed )
+{
+ if ( aDownPressed )
+ {
+ mEngine.RadioEnginehandler().IncreaseVolume();
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::VolumeDownL( TBool aDownPressed )
+{
+ if ( aDownPressed )
+ {
+ mEngine.RadioEnginehandler().DecreaseVolume();
+ }
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::ChangeViewL( TUid DEBUGVAR( aViewId ), TBool DEBUGVAR( aForceChange ) )
+{
+ LOG_FORMAT( "RadioControlEventListener::ChangeViewL: View: %d, Force: %d", aViewId, aForceChange );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::SetAudioRouteL( RadioEngine::TRadioAudioRoute DEBUGVAR( aRoute ) )
+{
+ LOG_FORMAT( "RadioControlEventListener::SetAudioOutputDestinationL: Destinatio: %d", aRoute );
+}
+
+/*!
+ *
+ */
+void RadioControlEventListener::AnswerEndCallL()
+{
+ mEngine.observer().skipNext();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radioenginewrapper.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// User includes
+#include "radioenginewrapper.h"
+#include "radioenginewrapper_p.h"
+#include "cradioenginehandler.h"
+#include "radiofrequencyscanninghandler.h"
+
+/*!
+ * Constructor
+ */
+RadioEngineWrapper::RadioEngineWrapper( RadioStationHandlerIf& stationHandler,
+ RadioEngineWrapperObserver& observer ) :
+ d_ptr( new RadioEngineWrapperPrivate( this, stationHandler, observer ) )
+{
+ Q_D( RadioEngineWrapper );
+ d->init();
+}
+
+/*!
+ * Destructor
+ */
+RadioEngineWrapper::~RadioEngineWrapper()
+{
+ delete d_ptr;
+}
+
+/*!
+ * Checks if the radio engine has been constructed properly
+ */
+bool RadioEngineWrapper::isEngineConstructed()
+{
+ Q_D( RadioEngineWrapper );
+ return d->isEngineConstructed();
+}
+
+/*!
+ * Returns the settings handler owned by the engine
+ */
+RadioSettings& RadioEngineWrapper::settings()
+{
+ Q_D( RadioEngineWrapper );
+ return d->settings();
+}
+
+/*!
+ * Returns the selected radio region
+ */
+RadioRegion::Region RadioEngineWrapper::region() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mEngineHandler->Region();
+}
+
+/*!
+ * Returns the minimum frequency
+ */
+uint RadioEngineWrapper::minFrequency() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mEngineHandler->MinFrequency();
+}
+
+/*!
+ * Returns the maximum frequency
+ */
+uint RadioEngineWrapper::maxFrequency() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mEngineHandler->MaxFrequency();
+}
+
+/*!
+ * Returns the frequency step size from the selected region
+ */
+uint RadioEngineWrapper::frequencyStepSize() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mEngineHandler->FrequencyStepSize();
+}
+
+/*!
+ * Returns the frequency step size from the selected region
+ */
+bool RadioEngineWrapper::isFrequencyValid( uint frequency )
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mEngineHandler->IsFrequencyValid( frequency );
+}
+
+/*!
+ * Checks if the radio engine is on
+ */
+bool RadioEngineWrapper::isRadioOn() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mEngineHandler->IsRadioOn();
+}
+
+/*!
+ * Checks if the scan is on
+ */
+bool RadioEngineWrapper::isScanning() const
+{
+ Q_D( const RadioEngineWrapper );
+ return !d->mFrequencyScanningHandler.isNull();
+}
+
+/*!
+ * Returns the currently tuned frequency
+ */
+uint RadioEngineWrapper::currentFrequency() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mEngineHandler->TunedFrequency();
+}
+
+/*!
+ * Returns the mute status
+ */
+bool RadioEngineWrapper::isMuted() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mEngineHandler->IsMuted();
+}
+
+/*!
+ * Returns the headset connection status
+ */
+bool RadioEngineWrapper::isAntennaAttached() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mEngineHandler->IsAntennaAttached();
+}
+
+/*!
+ * Returns the "use loudspeaker" status
+ */
+bool RadioEngineWrapper::isUsingLoudspeaker() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mUseLoudspeaker;
+}
+
+/*!
+ * Tunes to the given frequency
+ */
+void RadioEngineWrapper::tuneFrequency( uint frequency, const int sender )
+{
+ Q_D( RadioEngineWrapper );
+ d->tuneFrequency( frequency, sender );
+}
+
+/*!
+ * Tunes to the given frequency after a delay
+ */
+void RadioEngineWrapper::tuneWithDelay( uint frequency, const int sender )
+{
+ Q_D( RadioEngineWrapper );
+ d->tuneWithDelay( frequency, sender );
+}
+
+/*!
+ * volume update command for the engine
+ */
+void RadioEngineWrapper::setVolume( int volume )
+{
+ Q_D( RadioEngineWrapper );
+ d->mEngineHandler->SetVolume( volume );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::toggleMute()
+{
+ Q_D( RadioEngineWrapper );
+ d->mEngineHandler->SetMuted( !d->mEngineHandler->IsMuted() );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::toggleAudioRoute()
+{
+ Q_D( RadioEngineWrapper );
+ d->mUseLoudspeaker = !d->mUseLoudspeaker;
+ d->mEngineHandler->SetAudioRouteToLoudspeaker( d->mUseLoudspeaker );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::startSeeking( Seeking::Direction direction )
+{
+ Q_D( RadioEngineWrapper );
+ d->startSeeking( direction );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::scanFrequencyBand()
+{
+ Q_D( RadioEngineWrapper );
+ if ( !d->mFrequencyScanningHandler ) {
+ d->mFrequencyScanningHandler.reset( new RadioFrequencyScanningHandler( *d ) );
+ }
+ d->mFrequencyScanningHandler->startScanning( d->mEngineHandler->IsMuted() );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::cancelScanFrequencyBand()
+{
+ Q_D( RadioEngineWrapper );
+ d->mFrequencyScanningHandler->cancel();
+ d->frequencyScannerFinished();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radioenginewrapper_p.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,327 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+
+// User includes
+#include "radioenginewrapper_p.h"
+#include "radiosettings.h"
+#include "radiosettings_p.h"
+#include "radiologger.h"
+#include "radio_global.h"
+#include "cradioenginehandler.h"
+#include "radiofrequencyscanninghandler.h"
+#include "radiostationhandlerif.h"
+#include "cradiopubsub.h"
+#include "radiocontroleventlistener.h"
+#include "radiordslistener.h"
+#include "cradiorepositorymanager.h"
+#include "radioenginewrapperobserver.h"
+
+// Constants
+
+/*!
+ *
+ */
+RadioEngineWrapperPrivate::RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
+ RadioStationHandlerIf& stationHandler,
+ RadioEngineWrapperObserver& observer ) :
+ q_ptr( wrapper ),
+ mStationHandler( stationHandler ),
+ mObserver( observer ),
+ mEngineHandler( new CRadioEngineHandler( *this ) ),
+ mControlEventListener( new RadioControlEventListener( *this ) ),
+ mRdsListener ( new RadioRdsListener( mStationHandler, *this ) ),
+ mCommandSender( 0 ),
+ mUseLoudspeaker( false ),
+ mIsSeeking( false )
+{
+}
+
+/*!
+ *
+ */
+RadioEngineWrapperPrivate::~RadioEngineWrapperPrivate()
+{
+ // Destructor needs to be defined because some member variables that are forward declared
+ // in the header are managed by QT's smart pointers and they require that the owning class
+ // has a non-inlined destructor. Compiler generates an inlined destructor if it isn't defined.
+}
+
+/*!
+ * Initializes the private implementation
+ */
+void RadioEngineWrapperPrivate::init()
+{
+ TRAPD( err, mEngineHandler->ConstructL() );
+ if ( err != KErrNone ) {
+ LOG_FORMAT( "RadioEngineWrapperPrivate::init, EngineHandler construct failed: %d", err );
+ mEngineHandler.reset();
+ return;
+ //TODO: Error handling?
+ }
+
+ mEngineHandler->SetRdsObserver( mRdsListener.data() );
+ mEngineHandler->PubSub().SetControlEventObserver( mControlEventListener.data() );
+ mControlEventListener->init();
+
+ // Start observing profile changes
+ mEngineHandler->Repository().AddEntityL( KCRUidProfileEngine,
+ KProEngActiveProfile,
+ CRadioRepositoryManager::ERadioEntityInt );
+
+ mUseLoudspeaker = mEngineHandler->IsAudioRoutedToLoudspeaker();
+ if ( !mUseLoudspeaker ) {
+ mObserver.audioRouteChanged( false );
+ }
+}
+
+/*!
+ * Starts up the radio engine
+ */
+bool RadioEngineWrapperPrivate::isEngineConstructed()
+{
+ return mEngineHandler != 0;
+}
+
+/*!
+ * Returns the settings handler owned by the engine
+ */
+RadioSettings& RadioEngineWrapperPrivate::settings()
+{
+ if ( !mSettings ) {
+ mSettings.reset( new RadioSettings() );
+ mSettings->d_func()->init( &mEngineHandler->ApplicationSettings() );
+ }
+ return *mSettings;
+}
+
+/*!
+ * Returns the enginehandler owned by the engine
+ */
+CRadioEngineHandler& RadioEngineWrapperPrivate::RadioEnginehandler()
+{
+ return *mEngineHandler;
+}
+
+/*!
+ * Tunes to the given frequency
+ */
+void RadioEngineWrapperPrivate::tuneFrequency( uint frequency, const int sender )
+{
+ mCommandSender = sender;
+ mEngineHandler->Tune( frequency );
+}
+
+/*!
+ * Tunes to the given frequency after a delay
+ */
+void RadioEngineWrapperPrivate::tuneWithDelay( uint frequency, const int sender )
+{
+ mCommandSender = sender;
+ mEngineHandler->TuneWithDelay( frequency );
+}
+
+/*!
+ *
+ */
+RadioEngineWrapperObserver& RadioEngineWrapperPrivate::observer()
+{
+ return mObserver;
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::startSeeking( Seeking::Direction direction )
+{
+ mEngineHandler->Seek( direction );
+ mObserver.seekingStarted( direction );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::PowerEventL( TBool aPowerState, TInt DEBUGVAR( aError ) )
+{
+ LOG_FORMAT( "RadioEngineWrapperPrivate::PowerEventL, PowerState: %d, Error: %d", aPowerState, aError );
+ mObserver.radioStatusChanged( aPowerState );
+ mEngineHandler->PubSub().PublishPowerState( aPowerState );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::FrequencyEventL( TUint32 aFrequency,
+ RadioEngine::TRadioFrequencyEventReason aReason,
+ TInt aError )
+{
+ LOG_FORMAT( "RadioEngineWrapperPrivate::FrequencyEventL - Frequency: %d, Reason: %d, Error: %d", aFrequency, aReason, aError );
+
+ if ( mFrequencyScanningHandler )
+ {
+ // frequencyevents not handled during scanning //TODO remove
+ return;
+ }
+
+ if ( !aError ) {
+ const uint frequency = static_cast<uint>( aFrequency );
+
+ mStationHandler.setCurrentStation( frequency );
+ // Stations found by seeking (autotune) are saved as local stations
+// if ( aReason == RadioEngine::ERadioFrequencyEventReasonUp
+// || aReason == RadioEngine::ERadioFrequencyEventReasonDown )
+// {
+// mStationHandler.addScannedFrequency( frequency );
+// mIsSeeking = false;
+// mCommandSender = 0;
+// }
+
+ //mEngineHandler->SetMuted( EFalse );
+ LOG_TIMESTAMP( "Channel change finished" );
+
+ mObserver.tunedToFrequency( frequency, mCommandSender );
+
+ mStationHandler.startDynamicPsCheck();
+
+ mEngineHandler->PubSub().PublishFrequency( aFrequency );
+ }
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::VolumeEventL( TInt aVolume, TInt aError )
+{
+ Q_UNUSED( aError );
+ mObserver.volumeChanged( aVolume );
+ mEngineHandler->PubSub().PublishVolume( aVolume );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::MuteEventL( TBool aMuteState, TInt aError )
+{
+ Q_UNUSED( aError );
+ mObserver.muteChanged( aMuteState );
+ mEngineHandler->PubSub().PublishRadioMuteState( aMuteState );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::AudioModeEventL( TInt DEBUGVAR( aAudioMode ), TInt DEBUGVAR( aError ) )
+{
+ LOG_FORMAT( "RadioEngineWrapperPrivate::AudioModeEventL, AudioMode: %d, Error: %d", aAudioMode, aError );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::AntennaEventL( TBool aAntennaAttached, TInt aError )
+{
+ Q_UNUSED( aError );
+ mObserver.headsetStatusChanged( aAntennaAttached );
+// doc->PubSubL().PublishHeadsetStatusL( EVRPSHeadsetConnected );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::AudioRoutingEventL( TInt aAudioDestination, TInt aError )
+{
+ //TODO: Check how this event differs from AudioRoutingChangedL
+ Q_UNUSED( aAudioDestination )
+ Q_UNUSED( aError )
+// doc->PubSubL().PublishLoudspeakerStatusL( EVRPSLoudspeakerNotInUse );
+// Q_Q( RadioEngineWrapper );
+// q->audioRouteChanged( aAudioDestination == RadioEngine::ERadioSpeaker );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::SeekingEventL( TInt aSeekingState, TInt DEBUGVAR( aError ) )
+{
+ LOG_FORMAT( "RadioEngineWrapperPrivate::SeekingEventL, aSeekingState: %d, Error: %d", aSeekingState, aError );
+ if ( aSeekingState != RadioEngine::ERadioNotSeeking ) {
+ // We only set the flag here. It is reset in the FrequencyEventL
+ mIsSeeking = true;
+ }
+// Document()->PubSubL().PublishTuningStateL( EVRPSTuningStarted );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::RegionEventL( TInt DEBUGVAR( aRegion ), TInt DEBUGVAR( aError ) )
+{
+ LOG_FORMAT( "RadioEngineWrapperPrivate::RegionEventL, aRegion: %d, Error: %d", aRegion, aError );
+// Document()->PubSubL().PublishFrequencyDecimalCountL(
+// static_cast<TVRPSFrequencyDecimalCount>( Document()->RadioSettings()->DecimalCount() ) );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::AudioRouteChangedL( RadioEngine::TRadioAudioRoute aRoute )
+{
+ mUseLoudspeaker = aRoute == RadioEngine::ERadioSpeaker;
+ mObserver.audioRouteChanged( mUseLoudspeaker );
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::HandleSystemEventL( TRadioSystemEventType DEBUGVAR( aEventType ) )
+{
+ LOG_FORMAT( "RadioEngineWrapperPrivate::HandleSystemEventL, Event: %d", aEventType );
+// ERadioHeadsetConnected, ///< Headset was connected
+// ERadioHeadsetDisconnected, ///< Headset was disconnected
+// ERadioNetworkCoverageUp, ///< Network coverage detected
+// ERadioNetworkCoverageDown, ///< Network coverage lost
+// ERadioCallActivated, ///< Call activated or ringing
+// ERadioCallDeactivated, ///< Call disconnected
+// ERadioEmergencyCallActivated, ///< Call activated or ringing
+// ERadioEmergencyCallDeactivated, ///< Call disconnected
+// ERadioLowDiskSpace, ///< Low disk space
+// ERadioAudioRoutingHeadset, ///< Audio routed through headset
+// ERadioAudioRoutingSpeaker, ///< Audio routed through speaker ( IHF )
+// ERadioAudioResourcesAvailable, ///< Audio resources have become available
+// ERadioAudioAutoResumeForbidden ///< Audio auto resuming is forbidden
+}
+
+/*!
+ * \reimp
+ */
+void RadioEngineWrapperPrivate::HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError )
+{
+ if ( aUid == KCRUidProfileEngine && aKey == KProEngActiveProfile && !aError && aValue == KOfflineProfileId ) {
+ LOG( "RadioEngineWrapperPrivate::HandleRepositoryValueChangeL: Offline profile activated" );
+ }
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::frequencyScannerFinished()
+{
+ RadioFrequencyScanningHandler* handler = mFrequencyScanningHandler.take(); // Nulls the pointer
+ handler->deleteLater();
+ mObserver.scanAndSaveFinished();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radioenginewrapper_win32.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// User includes
+#include "radioenginewrapper.h"
+#include "radioenginewrapper_win32_p.h"
+#include "radioenginewrapperobserver.h"
+
+/*!
+ * Constructor
+ */
+RadioEngineWrapper::RadioEngineWrapper( RadioStationHandlerIf& stationHandler,
+ RadioEngineWrapperObserver& observer ) :
+ d_ptr( new RadioEngineWrapperPrivate( this, stationHandler, observer ) )
+{
+ Q_D( RadioEngineWrapper );
+ d->init();
+}
+
+/*!
+ * Destructor
+ */
+RadioEngineWrapper::~RadioEngineWrapper()
+{
+ delete d_ptr;
+}
+
+/*!
+ * Checks if the radio engine has been constructed properly
+ */
+bool RadioEngineWrapper::isEngineConstructed()
+{
+ Q_D( RadioEngineWrapper );
+ return d->isEngineConstructed();
+}
+
+/*!
+ * Returns the settings handler owned by the engine
+ */
+RadioSettings& RadioEngineWrapper::settings()
+{
+ Q_D( RadioEngineWrapper );
+ return d->settings();
+}
+
+/*!
+ * Returns the selected radio region
+ */
+RadioRegion::Region RadioEngineWrapper::region() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mRegionId;
+}
+
+/*!
+ * Returns the minimum frequency
+ */
+uint RadioEngineWrapper::minFrequency() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mMinFrequency;
+}
+
+/*!
+ * Returns the maximum frequency
+ */
+uint RadioEngineWrapper::maxFrequency() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mMaxFrequency;
+}
+
+/*!
+ * Returns the frequency step size from the selected region
+ */
+uint RadioEngineWrapper::frequencyStepSize() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mFrequencyStepSize;
+}
+
+/*!
+ * Returns the frequency step size from the selected region
+ */
+bool RadioEngineWrapper::isFrequencyValid( uint frequency )
+{
+ Q_UNUSED( frequency );
+ return true;
+}
+
+/*!
+ * Checks if the radio engine is on
+ */
+bool RadioEngineWrapper::isRadioOn() const
+{
+ return true;
+}
+
+/*!
+ * Checks if the scan is on
+ */
+bool RadioEngineWrapper::isScanning() const
+{
+ return false;
+}
+
+/*!
+ * Returns the currently tuned frequency
+ */
+uint RadioEngineWrapper::currentFrequency() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mFrequency;
+}
+
+/*!
+ * Returns the mute status
+ */
+bool RadioEngineWrapper::isMuted() const
+{
+ return false;
+}
+
+/*!
+ * Returns the headset connection status
+ */
+bool RadioEngineWrapper::isAntennaAttached() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mAntennaAttached;
+}
+
+/*!
+ * Returns the "use loudspeaker" status
+ */
+bool RadioEngineWrapper::isUsingLoudspeaker() const
+{
+ Q_D( const RadioEngineWrapper );
+ return d->mUseLoudspeaker;
+}
+
+/*!
+ * Tunes to the given frequency
+ */
+void RadioEngineWrapper::tuneFrequency( uint frequency, const int sender )
+{
+ Q_D( RadioEngineWrapper );
+ d->tuneFrequency( frequency, sender );
+}
+
+/*!
+ * Tunes to the given frequency after a delay
+ */
+void RadioEngineWrapper::tuneWithDelay( uint frequency, const int sender )
+{
+ Q_D( RadioEngineWrapper );
+ d->tuneWithDelay( frequency, sender );
+}
+
+/*!
+ * volume update command for the engine
+ */
+void RadioEngineWrapper::setVolume( int volume )
+{
+ Q_D( RadioEngineWrapper );
+ d->setVolume( volume );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::toggleMute()
+{
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::toggleAudioRoute()
+{
+ Q_D( RadioEngineWrapper );
+ d->mUseLoudspeaker = !d->mUseLoudspeaker;
+ d->mObserver.audioRouteChanged( d->mUseLoudspeaker );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::startSeeking( Seeking::Direction direction )
+{
+ Q_D( RadioEngineWrapper );
+ d->startSeeking( direction );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::scanFrequencyBand()
+{
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::cancelScanFrequencyBand()
+{
+ Q_D( RadioEngineWrapper );
+ d->frequencyScannerFinished();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radioenginewrapper_win32_p.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qtimer>
+#include <qsettings>
+
+// User includes
+#include "radioenginewrapper_win32_p.h"
+#include "radiosettings.h"
+#include "radiosettings_p.h"
+#include "radiologger.h"
+#include "radio_global.h"
+#include "radiostationhandlerif.h"
+#include "radioenginewrapperobserver.h"
+//#include "t_radiodataparser.h"
+
+static RadioEngineWrapperPrivate* theInstance = 0;
+
+const QString KKeyFrequency = "CurrentFreq";
+const QString KKeyOffline = "Offline";
+
+/*!
+ *
+ */
+RadioEngineWrapperPrivate::RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
+ RadioStationHandlerIf& stationHandler,
+ RadioEngineWrapperObserver& observer ) :
+ q_ptr( wrapper ),
+ mStationHandler( stationHandler ),
+ mObserver( observer ),
+ mTuneTimer( new QTimer( this ) ),
+ mCommandSender( 0 ),
+ mUseLoudspeaker( false ),
+ mIsSeeking( false ),
+ mAntennaAttached( true ),
+ mFrequency( 0 ),
+ mVolume( 5 ),
+ mMaxVolume( 10000 ),
+ mFrequencyStepSize( 50000 ),
+ mRegionId( RadioRegion::Default ),
+ mMinFrequency( 87500000 ),
+ mMaxFrequency( 108000000 )
+{
+ ::theInstance = this;
+ mEngineSettings.reset( new QSettings( "Nokia", "QtFmRadio" ) );
+ mFrequency = mEngineSettings->value( KKeyFrequency ).toUInt();
+ if ( mFrequency == 0 ) {
+ mFrequency = mMinFrequency;
+ }
+
+ connectAndTest( mTuneTimer, SIGNAL(timeout()), this, SLOT(frequencyEvent()) );
+ mTuneTimer->setSingleShot( true );
+}
+
+/*!
+ *
+ */
+RadioEngineWrapperPrivate::~RadioEngineWrapperPrivate()
+{
+ // Destructor needs to be defined because some member variables that are forward declared
+ // in the header are managed by QT's smart pointers and they require that the owning class
+ // has a non-inlined destructor. Compiler generates an inlined destructor if it isn't defined.
+}
+
+/*!
+ *
+ */
+RadioEngineWrapperPrivate* RadioEngineWrapperPrivate::instance()
+{
+ return ::theInstance;
+}
+
+/*!
+ * Initializes the private implementation
+ */
+void RadioEngineWrapperPrivate::init()
+{
+ mUseLoudspeaker = false;
+ if ( !mUseLoudspeaker ) {
+ mObserver.audioRouteChanged( false );
+ }
+
+ parseData();
+}
+
+/*!
+ * Starts up the radio engine
+ */
+bool RadioEngineWrapperPrivate::isEngineConstructed()
+{
+ return true;
+}
+
+/*!
+ * Returns the settings handler owned by the engine
+ */
+RadioSettings& RadioEngineWrapperPrivate::settings()
+{
+ if ( !mSettings ) {
+ mSettings.reset( new RadioSettings() );
+// mSettings->d_func()->init( &mEngineHandler->ApplicationSettings() );
+ }
+ return *mSettings;
+}
+
+/*!
+ * Tunes to the given frequency
+ */
+void RadioEngineWrapperPrivate::tuneFrequency( uint frequency, const int sender )
+{
+ mFrequency = frequency;
+ mEngineSettings->setValue( KKeyFrequency, mFrequency );
+ mCommandSender = sender;
+ mTuneTimer->stop();
+ mTuneTimer->start( 500 );
+}
+
+/*!
+ * Tunes to the given frequency after a delay
+ */
+void RadioEngineWrapperPrivate::tuneWithDelay( uint frequency, const int sender )
+{
+ mFrequency = frequency;
+ mEngineSettings->setValue( KKeyFrequency, mFrequency );
+ mCommandSender = sender;
+ mTuneTimer->stop();
+ mTuneTimer->start( 1500 );
+}
+
+/*!
+ *
+ */
+RadioEngineWrapperObserver& RadioEngineWrapperPrivate::observer()
+{
+ return mObserver;
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::startSeeking( Seeking::Direction direction )
+{
+ mObserver.seekingStarted( direction );
+}
+
+/*!
+ *
+ */
+QString RadioEngineWrapperPrivate::dataParsingError() const
+{
+ return mParsingError;
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::setHeadsetStatus( bool connected )
+{
+ mAntennaAttached = connected;
+ mObserver.headsetStatusChanged( mAntennaAttached );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::setVolume( int volume )
+{
+ mVolume = volume;
+ mObserver.volumeChanged( mVolume );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::addSong( const QString& artist, const QString& title )
+{
+ QString radioText = QString( "Now Playing: %1 - %2" ).arg( artist ).arg( title );
+
+ const uint frequency = mStationHandler.currentFrequency();
+ mStationHandler.setCurrentRadioText( frequency, radioText );
+ mStationHandler.setCurrentRadioTextPlus( frequency, RtPlus::Artist, artist );
+ mStationHandler.setCurrentRadioTextPlus( frequency, RtPlus::Title, title );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::clearSong()
+{
+ mStationHandler.setCurrentRadioText( mStationHandler.currentFrequency(), "" );
+}
+
+/*!
+ *
+ */
+bool RadioEngineWrapperPrivate::isOffline() const
+{
+ return mEngineSettings->value( KKeyOffline, false ).toBool();
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::setOffline( bool offline )
+{
+ mEngineSettings->setValue( KKeyOffline, offline );
+}
+
+/*!
+ * Private slot
+ */
+void RadioEngineWrapperPrivate::frequencyEvent()
+{
+ mStationHandler.setCurrentStation( mFrequency );
+ mObserver.tunedToFrequency( mFrequency, mCommandSender );
+ mStationHandler.startDynamicPsCheck();
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::frequencyScannerFinished()
+{
+ mObserver.scanAndSaveFinished();
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapperPrivate::parseData()
+{
+ /*
+ mDataParser.reset( new T_RadioDataParser() );
+ bool ok = mDataParser->parse();
+ if ( !ok ) {
+ mParsingError = mDataParser->errorString();
+ } else {
+ if ( mDataParser->mEngineSettings.mMaxVolume > 0 ) {
+ mMaxVolume = mDataParser->mEngineSettings.mMaxVolume;
+ }
+
+ if ( mDataParser->mEngineSettings.mFrequencyStepSize > 0 ) {
+ mFrequencyStepSize = mDataParser->mEngineSettings.mFrequencyStepSize;
+ }
+
+ if ( mDataParser->mEngineSettings.mRegionId >= 0 ) {
+ mRegionId = static_cast<RadioRegion::Region>( mDataParser->mEngineSettings.mRegionId );
+ }
+
+ if ( mDataParser->mEngineSettings.mMinFrequency > 0 ) {
+ mMinFrequency = mDataParser->mEngineSettings.mMinFrequency;
+ }
+
+ if ( mDataParser->mEngineSettings.mMaxFrequency > 0 ) {
+ mMaxFrequency = mDataParser->mEngineSettings.mMaxFrequency;
+ }
+ }
+*/
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radiofrequencyscanninghandler.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qtimer>
+
+// User includes
+#include "radiofrequencyscanninghandler.h"
+#include "radioenginewrapper_p.h"
+#include "cradioenginehandler.h"
+#include "radiostationhandlerif.h"
+
+/*!
+ *
+ */
+RadioFrequencyScanningHandler::RadioFrequencyScanningHandler( RadioEngineWrapperPrivate& radioEngine ) :
+ QObject( 0 ),
+ mEngine( radioEngine ),
+ mLastFoundFrequency( 0 )
+{
+}
+
+/*!
+ * From MRadioScanObserver
+ *
+ */
+void RadioFrequencyScanningHandler::ScanFrequencyEventL( TUint32 aFrequency )
+{
+ // The scanning logic starts from the minimun frequency and advances as long as
+ // the found frequency is higher than the last one. When it loops around from the highest
+ // frequency back to the lowest one we check if it stops at the minimun frequency and
+ // add the station there. This logic handles the special case where there is a station in the
+ // minimum frequency, but does not work if there are no stations at all. The adaptation has a
+ // timeout timer that stops the scanning if nothing is found and reports the scanning start
+ // frequency which is this case will be the minimum frequency. In that case this logic will
+ // assume that it was an audible station and adds it.
+
+ uint frequency = static_cast<uint>( aFrequency );
+ mEngine.mStationHandler.setCurrentStation( frequency );
+ if ( frequency > mLastFoundFrequency ) {
+ mLastFoundFrequency = frequency;
+ addFoundStation( frequency );
+ } else if ( frequency == mEngine.mEngineHandler->MinFrequency() ) {
+ // Special case. A station has been found in the mininmum frequency
+ addFoundStation( frequency );
+ }
+}
+
+/*!
+ * From MRadioScanObserver
+ *
+ */
+void RadioFrequencyScanningHandler::ScanCompletedEventL( TInt aError )
+{
+ Q_UNUSED( aError )
+
+ mEngine.frequencyScannerFinished(); // Causes the scanner to be deleted so nothing can be done after this
+}
+
+
+/*!
+ * Starts the scanning
+ */
+void RadioFrequencyScanningHandler::startScanning( bool muted )
+{
+ cancel();
+ QTimer::singleShot( 1000, this, SLOT(delayedStart()) );
+}
+
+/*!
+ * Adds a new station that was found
+ */
+void RadioFrequencyScanningHandler::addFoundStation( const uint frequency )
+{
+ mEngine.mStationHandler.addScannedFrequency( frequency );
+}
+
+/*!
+ * Cancels the scanning process
+ */
+void RadioFrequencyScanningHandler::cancel()
+{
+ mEngine.mEngineHandler->StopScan();
+}
+
+/*!
+ *
+ */
+void RadioFrequencyScanningHandler::delayedStart()
+{
+ mEngine.mStationHandler.removeLocalStations();
+
+ mLastFoundFrequency = mEngine.mEngineHandler->MinFrequency();
+ mEngine.mEngineHandler->StartScan( *this );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radiologger.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qdebug.h>
+
+// User includes
+#include "radiologger.h"
+
+/*!
+ *
+ */
+void RadioLogger::initCombinedLogger()
+{
+#if defined LOGGING_ENABLED && defined COMBINE_WITH_ENGINE_LOGGER
+ TRAP_IGNORE( RadioEngineUtils::InitializeL() );
+ if ( !MRadioEngineLogger::Logger() ) {
+ qDebug() << "FMRadioUi: Cannot combine logs with engine. Engine logger not active";
+ }
+#endif // LOGGING_ENABLED
+}
+
+/*!
+ *
+ */
+void RadioLogger::releaseCombinedLogger()
+{
+#if defined LOGGING_ENABLED && defined COMBINE_WITH_ENGINE_LOGGER
+ RadioEngineUtils::Release();
+#endif // LOGGING_ENABLED
+}
+
+/*!
+ * enum Mode { Normal, MethodEnter, MethodExit, DecIndent };
+ */
+void RadioLogger::logMsg( const char* msg, Mode mode )
+{
+ Q_UNUSED( msg );
+ Q_UNUSED( mode );
+#if defined LOGGING_ENABLED && defined COMBINE_WITH_ENGINE_LOGGER
+ MRadioEngineLogger* logger = MRadioEngineLogger::Logger();
+ if ( logger ) {
+ if ( mode == RadioLogger::Normal ) {
+ logger->AddIndent(KMarkerUi()).Add( msg ).Commit();
+ } else if ( mode == RadioLogger::MethodEnter ) {
+ logger->AddIndentClear( KMarkerUi() ).Add( msg ).Commit();
+ logger->IncIndent();
+ } else if ( mode == RadioLogger::MethodExit ) {
+ logger->DecIndent();
+ logger->AddIndentClear( KMarkerUi() ).Add( msg ).Commit();
+ } else if ( mode == RadioLogger::DecIndent ) {
+ logger->DecIndent();
+ } else {}
+ }
+#endif // LOGGING_ENABLED
+}
+
+
+#ifdef LOGGING_ENABLED
+
+#include <qstring>
+#include <qfile>
+#include <qtextstream>
+#include <qdatetime>
+
+#ifdef TRACE_TO_FILE
+ QFile mDebugFile;
+ bool mFilterByLogMarker = false;
+#endif
+
+const char* KLogEnter = "\\ %s";
+const char* KLogExit = "/ %s";
+const char* KLogExitRet = "/ %s, Returning %s";
+const char* KLogExitException = "/ %s, Exception raised";
+const char* KLogLine = "| ";
+
+/*!
+ *
+ */
+static QString formatString( const char* format, long val )
+{
+ if ( strcmp( format, "" ) == 0 ) {
+ return "";
+ }
+ QString string;
+ string.sprintf( format, val );
+ return string;
+}
+
+/*!
+ *
+ */
+MethodLogger::MethodLogger( const char* function, const char* format ) :
+ mFunction( function ),
+ mFormat( format )
+{
+ QString msg;
+ msg.sprintf( KLogEnter, mFunction );
+ WRITELOG_METHOD_ENTER( msg );
+}
+
+/*!
+ *
+ */
+MethodLogger::~MethodLogger()
+{
+ if ( std::uncaught_exception() ) {
+ QString msg;
+ msg.sprintf( KLogExitException, mFunction );
+ WRITELOG_METHOD_EXIT( msg );
+ } else {
+ QString msg;
+ if ( strlen( mFormat ) > 0 ) {
+ #if defined(__WINS__)
+
+ long retVal = 0;
+ _asm( mov retVal, ebx );
+ msg.sprintf( KLogExitRet, mFunction, formatString( mFormat, retVal ) );
+ WRITELOG_METHOD_EXIT( msg );
+
+ #else
+ msg.sprintf( KLogExit, mFunction );
+ WRITELOG_METHOD_EXIT( msg );
+ #endif
+ } else {
+ msg.sprintf( KLogExit, mFunction );
+ WRITELOG_METHOD_EXIT( msg );
+ }
+ }
+}
+#endif // LOGGING_ENABLED
+
+
+#ifdef TRACE_TO_FILE
+
+/*!
+ *
+ */
+void FileLogger::installMessageHandler( const QString& fileName, bool filterByMarker )
+{
+ mDebugFile.setFileName( fileName );
+ mFilterByLogMarker = filterByMarker;
+
+ mDebugFile.open( QIODevice::Text | QIODevice::WriteOnly );
+
+ if ( mDebugFile.isOpen() ) {
+ qInstallMsgHandler( FileLogger::handleMessage );
+ }
+}
+
+/*!
+ *
+ */
+void FileLogger::uninstallMessageHandler()
+{
+ if ( mDebugFile.isOpen() ) {
+ qInstallMsgHandler( 0 );
+ mDebugFile.close();
+ }
+}
+
+/*!
+ *
+ */
+void FileLogger::handleMessage( QtMsgType type, const char* msg )
+{
+ QTextStream debugStream( &mDebugFile );
+ QDateTime dateTime( QDateTime::currentDateTime() );
+
+ if ( type == QtDebugMsg ) {
+ QString message( msg );
+ if ( mFilterByLogMarker && message.contains( QString( LOGMARKER ) ) )
+ {
+ debugStream << dateTime.toString("yyyy-MM-dd hh:mm:ss.zzz") << " : " << message << endl;
+ }
+ }
+}
+#endif // TRACE_TO_FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radiordslistener.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// User includes
+#include "radiordslistener.h"
+#include "radiostationhandlerif.h"
+#include "radioenginewrapper_p.h"
+#include "radioenginewrapperobserver.h"
+#include "radiologger.h"
+
+/*!
+ * Converts a symbian descriptor to Qt string
+ */
+static QString convertString( const TDesC& aDesc )
+{
+ return QString( (QChar*)aDesc.Ptr(), aDesc.Length() );
+}
+
+/*!
+ *
+ */
+RadioRdsListener::RadioRdsListener( RadioStationHandlerIf& stationHandler, RadioEngineWrapperPrivate& wrapper ) :
+ mStationHandler( stationHandler ),
+ mWrapper( wrapper )
+{
+}
+
+/*!
+ * \reimp
+ */
+void RadioRdsListener::RdsAvailable( TUint32 /*aFrequency*/, TBool aAvailable )
+{
+ mWrapper.observer().rdsAvailabilityChanged( aAvailable );
+}
+
+/*!
+ * \reimp
+ */
+void RadioRdsListener::RdsAfSearchBegin()
+{
+}
+
+/*!
+ * \reimp
+ */
+void RadioRdsListener::RdsAfSearchEnd( TUint32 /*aFrequency*/, TInt /*aError*/ )
+{
+}
+
+/*!
+ * \reimp
+ */
+void RadioRdsListener::RdsAfSearchStateChange( TBool /*aEnabled*/ )
+{
+}
+
+/*!
+ * \reimp
+ */
+void RadioRdsListener::RdsDataProgrammeService( TUint32 aFrequency, const TDesC& aProgramService )
+{
+ if ( aProgramService.Length() > 0 ) {
+ LOG_TIMESTAMP( "RdsName changed" );
+ const uint frequency = static_cast<uint>( aFrequency );
+ mStationHandler.setCurrentPsName( frequency, convertString( aProgramService ) );
+
+ // TODO: Remove below when RdsDataPTY callback is available
+ RdsDataGenre( frequency, GenreEurope::RdsRockMusic );
+
+#ifdef SHOW_CALLSIGN_IN_ANY_REGION
+ RdsDataPiCode( frequency, 0x3BB7 ); //KQOL-FM - Las Vegas, NV
+#endif
+ }
+}
+
+/*!
+ * \reimp
+ */
+void RadioRdsListener::RdsDataRadioText( TUint32 aFrequency, const TDesC& aRadioText )
+{
+ if ( aRadioText.Length() > 0 ) {
+ const uint frequency = static_cast<uint>( aFrequency );
+ mStationHandler.setCurrentRadioText( frequency, convertString( aRadioText ) );
+ }
+}
+
+/*!
+ * \reimp
+ */
+void RadioRdsListener::RdsDataRadioTextPlus( TUint32 aFrequency,
+ const TInt aRadioTextPlusClass,
+ const TDesC& aRadioText )
+{
+ if ( aRadioText.Length() > 0 ) {
+ const uint frequency = static_cast<uint>( aFrequency );
+ mStationHandler.setCurrentRadioTextPlus( frequency, aRadioTextPlusClass, convertString( aRadioText ) );
+ }
+}
+
+/*!
+ * \reimp
+ */
+void RadioRdsListener::RdsDataGenre( TUint32 aFrequency, const TInt aGenre )
+{
+ LOG_FORMAT( "RadioRdsListener::RdsDataGenre: Genre: %d", aGenre );
+ const uint frequency = static_cast<uint>( aFrequency );
+ mStationHandler.setCurrentGenre( frequency, aGenre );
+}
+
+/*!
+ * \reimp
+ */
+void RadioRdsListener::RdsDataPiCode( TUint32 aFrequency, const TInt aPiCode )
+{
+ LOG_FORMAT( "RadioRdsListener::RdsDataPiCode, PI: %d", aPiCode );
+ const uint frequency = static_cast<uint>( aFrequency );
+ mStationHandler.setCurrentPiCode( frequency, aPiCode );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radiosettings.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qvariant>
+
+// User includes
+#include "radiosettings.h"
+#include "radiosettings_p.h"
+#include "radio_global.h"
+
+namespace RadioSetting
+{
+ enum TMtvSettingType
+ {
+ EFlags = 0,
+ ESomething
+ };
+}
+
+/*!
+ *
+ */
+RadioSettings::RadioSettings() :
+ d_ptr( new RadioSettingsPrivate( this ) )
+{
+}
+
+/*!
+ *
+ */
+bool RadioSettings::isFirstTimeStart()
+{
+ Q_D( RadioSettings );
+ return d->isFirstTimeStart();
+}
+
+/*!
+ *
+ */
+bool RadioSettings::showFavorites() const
+{
+ Q_D( const RadioSettings );
+ return d->isFlagSet( RadioSettingsPrivate::EShowFavorites );
+}
+
+/*!
+ *
+ */
+void RadioSettings::setShowFavorites( bool showFavorites )
+{
+ Q_D( RadioSettings );
+ if ( d->isFlagSet( RadioSettingsPrivate::EShowFavorites ) != showFavorites ) {
+ d->toggleFlag( RadioSettingsPrivate::EShowFavorites );
+ }
+}
+
+/*!
+ *
+ */
+bool RadioSettings::toggleShowFavorites()
+{
+ Q_D( RadioSettings );
+ d->toggleFlag( RadioSettingsPrivate::EShowFavorites );
+ return d->isFlagSet( RadioSettingsPrivate::EShowFavorites );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radiosettings_p.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "radiosettings.h"
+#include "radiosettings_p.h"
+#include "mradioapplicationsettings.h"
+
+
+/*!
+ *
+ */
+RadioSettingsPrivate::RadioSettingsPrivate( RadioSettings* settingsPublic ) :
+ q_ptr( settingsPublic ),
+ mFlags( 0 )
+{
+}
+
+/*!
+ *
+ */
+RadioSettingsPrivate::~RadioSettingsPrivate()
+{
+}
+
+/*!
+ *
+ */
+void RadioSettingsPrivate::init( MRadioApplicationSettings* storage )
+{
+ mSettingsStorage = storage;
+ if ( mSettingsStorage ) {
+ mFlags = Toggles( mSettingsStorage->UiFlags() );
+ }
+}
+
+/*!
+ *
+ */
+bool RadioSettingsPrivate::isFirstTimeStart()
+{
+ if ( mSettingsStorage ) {
+ return mSettingsStorage->UpdateStartCount() == 0;
+ }
+ return false;
+}
+
+/*!
+ *
+ */
+bool RadioSettingsPrivate::isFlagSet( ToggleFlag flag ) const
+{
+ return mFlags.testFlag( flag );
+}
+
+/*!
+ *
+ */
+void RadioSettingsPrivate::toggleFlag( ToggleFlag flag )
+{
+ mFlags ^= flag;
+}
+
+/*!
+ *
+ */
+void RadioSettingsPrivate::saveFlags()
+{
+ if ( mSettingsStorage ) {
+ mSettingsStorage->SetUiFlags( mFlags );
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/radiosettings_win32_p.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "radiosettings.h"
+#include "radiosettings_p.h"
+
+
+/*!
+ *
+ */
+RadioSettingsPrivate::RadioSettingsPrivate( RadioSettings* settingsPublic ) :
+ q_ptr( settingsPublic ),
+ mFlags( 0 )
+{
+}
+
+/*!
+ *
+ */
+RadioSettingsPrivate::~RadioSettingsPrivate()
+{
+}
+
+/*!
+ *
+ */
+/*
+void RadioSettingsPrivate::init( MRadioApplicationSettings* storage )
+{
+ mSettingsStorage = storage;
+ if ( mSettingsStorage ) {
+ mFlags = Toggles( mSettingsStorage->UiFlags() );
+ }
+}
+*/
+/*!
+ *
+ */
+bool RadioSettingsPrivate::isFirstTimeStart()
+{
+ return false;
+}
+
+/*!
+ *
+ */
+bool RadioSettingsPrivate::isFlagSet( ToggleFlag flag ) const
+{
+ return mFlags.testFlag( flag );
+}
+
+/*!
+ *
+ */
+void RadioSettingsPrivate::toggleFlag( ToggleFlag flag )
+{
+ mFlags ^= flag;
+}
+
+/*!
+ *
+ */
+void RadioSettingsPrivate::saveFlags()
+{
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radioenginewrapper/src/t_radiodataparser.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,601 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "t_radiodataparser.h"
+
+const int KThousand = 1000;
+const int KMillion = KThousand * KThousand;
+
+const QString KDataFile = "./settings.xml";
+
+const QString KXmlMilliseconds = "ms";
+const QString KXmlSeconds = "s";
+const QString KXmlMinutes = "m";
+const QString KXmlRadioSettings = "RadioSettings";
+const QString KXmlMaxVolume = "maxvolume";
+const QString KXmlFrequencyStepSize = "FrequencyStepSize";
+const QString KXmlRegion = "region";
+const QString KXmlMinFrequency = "MinFrequency";
+const QString KXmlMaxFrequency = "MaxFrequency";
+
+const QString KXmlRadioStations = "RadioStations";
+const QString KXmlSetting = "setting";
+const QString KXmlStation = "Station";
+const QString KXmlName = "name";
+const QString KXmlValue = "value";
+const QString KXmlFrequency = "frequency";
+const QString KXmlBooleanTrue = "TRUE";
+const QString KXmlRds = "Rds";
+const QString KXmlRdsItem = "RdsItem";
+const QString KXmlInterval = "SendInterval";
+const QString KXmlType = "type";
+const QString KXmlCount = "count";
+const QString KXmlDelay = "delay";
+
+const QString KXmlRdsGroup = "RdsGroup";
+const QString KXmlRdsPsName = "PsName";
+const QString KXmlRdsPiCode = "PiCode";
+const QString KXmlRdsRt = "RT";
+const QString KXmlRdsRtPlus = "RtPlus";
+const QString KXmlRdsRtPlusItem = "RtPlusItem";
+const QString KXmlRdsRtPlusTag = "RtPlusTag";
+const QString KXmlRdsRtPlusTagDelay = "delay";
+const QString KXmlRdsRtPlusTagArtist = "artist";
+const QString KXmlRdsRtPlusTagTitle = "title";
+const QString KXmlRdsPty = "Pty";
+
+/*!
+ *
+ */
+static bool isEqual( const QString& first, const QString& second )
+{
+ return first.compare( second, Qt::CaseInsensitive ) == 0;
+}
+
+
+/*!
+ *
+ */
+T_RadioDataParser::T_RadioDataParser() :
+ mReader( new QXmlSimpleReader() )
+{
+}
+
+/*!
+ *
+ */
+T_RadioDataParser::~T_RadioDataParser()
+{
+}
+
+/*!
+ *
+ */
+bool T_RadioDataParser::parse()
+{
+ QFile file( KDataFile );
+ if ( file.exists() ) {
+ mSource.reset( new QXmlInputSource( &file ) );
+ mReader->setContentHandler( this );;
+ mReader->setErrorHandler( this );
+
+ return mReader->parse( mSource.data() );
+ } else {
+ mErrorString = QString( "Data file %1 not found!" ).arg( file.fileName() );
+ }
+ return false;
+}
+
+/*!
+ * \reimp
+ */
+bool T_RadioDataParser::startDocument()
+{
+ return true;
+}
+
+/*!
+ * \reimp
+ */
+bool T_RadioDataParser::endDocument()
+{
+ return true;
+}
+
+/*!
+ * \reimp
+ */
+bool T_RadioDataParser::startElement( const QString& namespaceURI,
+ const QString& localName,
+ const QString& qName,
+ const QXmlAttributes& atts )
+{
+ if ( isEqual( localName, KXmlRadioSettings ) )
+ {
+ handleStartRadioSettings( atts );
+ }
+ else if ( isEqual( localName, KXmlSetting ) )
+ {
+ handleStartSetting( atts );
+ }
+ else if ( isEqual( localName, KXmlRadioStations ) )
+ {
+// handleStartRdsData( atts );
+ }
+ else if ( isEqual( localName, KXmlStation ) )
+ {
+ handleStartStation( atts );
+ }
+ else if ( isEqual( localName, KXmlRdsGroup ) )
+ {
+ handleStartRdsGroup( atts );
+ }
+ else if ( isEqual( localName, KXmlRds ) )
+ {
+ handleStartRdsData( atts );
+ }
+
+ return true;
+}
+
+/*!
+ * \reimp
+ */
+bool T_RadioDataParser::endElement( const QString& namespaceURI, const QString& localName, const QString& qName )
+{
+ if ( isEqual( localName, KXmlRadioSettings ) )
+ {
+ handleEndRadioSettings();
+ }
+ else if ( isEqual( localName, KXmlSetting ) )
+ {
+ handleEndSetting();
+ }
+ else if ( isEqual( localName, KXmlStation ) )
+ {
+ handleEndStation();
+ }
+ else if ( isEqual( localName, KXmlRds ) )
+ {
+ handleEndRdsData();
+ }
+ return true;
+}
+
+/*!
+ * \reimp
+ */
+bool T_RadioDataParser::characters( const QString& ch )
+{
+ return true;
+}
+
+/*!
+ * \reimp
+ */
+bool T_RadioDataParser::error( const QXmlParseException& exception )
+{
+ mErrorString = QString( "Line: %1, Column: %2, Msg: %3" )
+ .arg( exception.lineNumber() )
+ .arg( exception.columnNumber() )
+ .arg( exception.message() );
+ return true;
+}
+
+/*!
+ * \reimp
+ */
+bool T_RadioDataParser::fatalError( const QXmlParseException& exception )
+{
+ mErrorString = QString( "Error in data XML. Line: %1, Column: %2, Msg: %3" )
+ .arg( exception.lineNumber() )
+ .arg( exception.columnNumber() )
+ .arg( exception.message() );
+ return false;
+}
+
+/*!
+ * \reimp
+ */
+QString T_RadioDataParser::errorString() const
+{
+ return mErrorString;
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleStartRadioSettings( const QXmlAttributes& atts )
+{
+ Q_UNUSED( atts );
+ RadioData::EngineSettings* engineSettings = new RadioData::EngineSettings;
+ pushToSettingStack( engineSettings, mSettingStack );
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleEndRadioSettings()
+{
+ RadioData::EngineSettings* engineSettings
+ = static_cast<RadioData::EngineSettings*>( popFromSettingStack( mSettingStack ) );
+ if ( engineSettings )
+ {
+ mEngineSettings = *engineSettings;
+ delete engineSettings;
+ engineSettings = 0;
+ }
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleStartSetting( const QXmlAttributes& atts )
+{
+ RadioData::SettingHolder* holder = new RadioData::SettingHolder;
+
+ RadioData::Setting* parentHolder = topOfSettingStack( mSettingHolderStack );
+ if ( parentHolder ) {
+ static_cast<RadioData::SettingHolder*>( parentHolder )->mChildren.append( holder );
+ }
+
+ pushToSettingStack( holder, mSettingHolderStack );
+
+ for ( int i = 0; i < atts.count(); ++i )
+ {
+ QString attrName = atts.localName( i );
+
+ if ( isEqual( attrName, KXmlName ) )
+ {
+ holder->mName = atts.value( i );
+ }
+ else if ( isEqual( attrName, KXmlValue ) == 0 )
+ {
+ holder->mValue = atts.value( i );
+ }
+ }
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleEndSetting()
+{
+ QScopedPointer<RadioData::SettingHolder> holder(
+ static_cast<RadioData::SettingHolder*>( popFromSettingStack( mSettingHolderStack ) ) );
+ if ( mSettingHolderStack.count() == 0 )
+ {
+ if ( RadioData::Setting* setting = topOfSettingStack( mSettingStack ) )
+ {
+ setting->setValue( *holder, *this );
+ }
+ }
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleStartStation( const QXmlAttributes& atts )
+{
+ RadioData::Station* station = new RadioData::Station;
+ pushToSettingStack( station, mSettingStack );
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleEndStation()
+{
+ RadioData::Station* station = static_cast<RadioData::Station*>( popFromSettingStack( mSettingStack ) );
+ mStations.append( station );
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleStartRdsGroup( const QXmlAttributes& atts )
+{
+
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleEndRdsGroup()
+{
+
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleStartRdsData( const QXmlAttributes& atts )
+{
+ RadioData::RdsItem* rds = new RadioData::RdsItem;
+ pushToSettingStack( rds, mSettingStack );
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::handleEndRdsData()
+{
+ QScopedPointer<RadioData::RdsItem> rds(
+ static_cast<RadioData::RdsItem*>( popFromSettingStack( mSettingStack ) ) );
+ RadioData::Station* station = dynamic_cast<RadioData::Station*>( topOfSettingStack( mSettingStack ) );
+ if ( rds && station )
+ {
+ station->mRdsArray.append( rds.take() );
+ }
+}
+
+/*!
+ *
+ */
+void T_RadioDataParser::pushToSettingStack( RadioData::Setting* setting, RadioData::SettingArray& array )
+{
+ array.append( setting );
+}
+
+/*!
+ *
+ */
+RadioData::Setting* T_RadioDataParser::topOfSettingStack( RadioData::SettingArray& array )
+{
+ if ( array.count() > 0 )
+ {
+ return array[ array.count() - 1 ];
+ }
+
+ return 0;
+}
+
+/*!
+ *
+ */
+RadioData::Setting* T_RadioDataParser::popFromSettingStack( RadioData::SettingArray& array )
+{
+ const int lastIndex = array.count() - 1;
+ RadioData::Setting* setting = array[lastIndex];
+ array.removeAt( lastIndex );
+ return setting;
+}
+
+/*!
+ *
+ */
+int T_RadioDataParser::parseInt( const QString& string, int defaultVal )
+{
+ bool ok = false;
+ int ret = string.toInt( &ok );
+ if ( ok ) {
+ return ret;
+ }
+ return defaultVal;
+}
+
+/*!
+ *
+ */
+int T_RadioDataParser::parseTime( const QString& string, int defaultVal )
+{
+ if ( isEqual( string.right( 2 ), KXmlMilliseconds ) ) {
+ QString temp = string.mid( 0, string.length() - 2 );
+ return parseInt( temp, defaultVal );
+ } else if ( isEqual( string.right( 1 ), KXmlSeconds ) ) {
+ QString temp = string.mid( 0, string.length() - 1 );
+ return parseInt( temp, defaultVal ) * KThousand;
+ } else if ( isEqual( string.right( 1 ), KXmlMinutes ) ) {
+ QString temp = string.mid( 0, string.length() - 1 );
+ return parseInt( temp, defaultVal ) * KMillion;
+ } else {
+ // Default time is seconds
+ return parseInt( string, defaultVal ) * KThousand;
+ }
+}
+
+
+RadioData::RdsGroup::RdsGroup( const QXmlAttributes& atts, T_RadioDataParser& parser ) :
+ mInterval( 0 ),
+ mCount( 0 )
+{
+ for ( int i = 0; i < atts.count(); ++i ) {
+ QString attrName = atts.localName( i );
+
+ if ( isEqual( attrName, KXmlInterval ) )
+ {
+ mInterval = parser.parseTime( atts.value( i ), 0 );
+ }
+ else if ( isEqual( attrName, KXmlCount ) == 0 )
+ {
+ mCount = parser.parseInt( atts.value( i ), 0 );
+ }
+ }
+
+}
+
+RadioData::RdsGroup::~RdsGroup()
+{
+
+}
+
+RadioData::Station::Station() :
+ mFrequency( 0 )
+{
+}
+
+RadioData::Station::~Station()
+{
+ qDeleteAll( mRdsArray );
+ mRdsArray.clear();
+}
+
+void RadioData::Station::setValue( SettingHolder& holder, T_RadioDataParser& parser )
+{
+ if ( isEqual( holder.mName, KXmlFrequency ) )
+ {
+ int valueInt = 0;
+ parser.parseInt( holder.mValue, valueInt );
+ mFrequency = static_cast<uint>( valueInt );
+ }
+}
+
+
+RadioData::RdsItem::RdsItem() :
+ mCurrentRtPlusIndex( 0 ),
+ mType( RadioData::RdsItem::Unknown )
+{
+}
+
+RadioData::RdsItem::RtPlusHolder::RtPlusHolder() :
+ mDelay( 0 ),
+ mRtClass( 0 )
+{
+}
+
+RadioData::RdsItem::~RdsItem()
+{
+ qDeleteAll( mRtPlusItems );
+ mRtPlusItems.clear();
+}
+
+void RadioData::RdsItem::setValue( SettingHolder& holder, T_RadioDataParser& parser )
+{
+ if ( holder.mChildren.count() == 0 )
+ {
+ if ( isEqual( holder.mName, KXmlInterval ) )
+ {
+ mInterval = parser.parseInt( holder.mValue, 0 );
+ }
+ else if ( isEqual( holder.mName, KXmlType ) )
+ {
+ if ( isEqual( holder.mValue, KXmlRdsPsName ) )
+ {
+ mType = RadioData::RdsItem::RdsPsName;
+ }
+ else if ( isEqual( holder.mValue, KXmlRdsRt ) )
+ {
+ mType = RadioData::RdsItem::RdsRadioText;
+ }
+ else if ( isEqual( holder.mValue, KXmlRdsRt ) )
+ {
+ mType = RadioData::RdsItem::RdsRadioText;
+ }
+ else if ( isEqual( holder.mValue, KXmlRdsRtPlus ) )
+ {
+ mType = RadioData::RdsItem::RdsRadioTextPlus;
+ }
+ else if ( isEqual( holder.mValue, KXmlRdsPty ) )
+ {
+ mType = RadioData::RdsItem::RdsPty;
+ }
+ if ( isEqual( holder.mValue, KXmlRdsPiCode ) )
+ {
+ mType = RadioData::RdsItem::RdsPiCode;
+ }
+ }
+ else if ( isEqual( holder.mName, KXmlRdsItem ) )
+ {
+ mRdsItems.append( holder.mValue );
+ }
+ }
+ else
+ {
+ initChildren( holder, parser );
+ }
+}
+
+void RadioData::RdsItem::initChildren( SettingHolder& holder, T_RadioDataParser& parser )
+{
+ mRdsItems.append( holder.mValue );
+
+ for ( int i = 0; i < holder.mChildren.count(); ++i )
+ {
+ RtPlusHolder* rtPlusHolder = new RtPlusHolder;
+ mRtPlusItems.append( rtPlusHolder );
+
+ SettingHolder* child = holder.mChildren[i];
+ if ( isEqual( child->mName, KXmlRdsRtPlusTag ) )
+ {
+ rtPlusHolder->mRtClass = RadioData::RdsItem::Title;
+ if ( isEqual( child->mValue, KXmlRdsRtPlusTagArtist ) )
+ {
+ rtPlusHolder->mRtClass = RadioData::RdsItem::Artist;
+ }
+ }
+
+ for ( int j = 0; j < child->mChildren.count(); ++j )
+ {
+ SettingHolder* grandChild = child->mChildren[j];
+ if ( isEqual( grandChild->mName, KXmlRdsRtPlusTagDelay ) )
+ {
+ parser.parseInt( grandChild->mValue, rtPlusHolder->mDelay );
+ }
+ else if ( isEqual( grandChild->mName, KXmlRdsItem ) )
+ {
+ rtPlusHolder->mRtItem = grandChild->mValue;
+ }
+ }
+ }
+}
+
+RadioData::SettingHolder::SettingHolder()
+{
+}
+
+RadioData::SettingHolder::~SettingHolder()
+{
+ qDeleteAll( mChildren );
+ mChildren.clear();
+}
+
+RadioData::EngineSettings::EngineSettings() :
+ mMaxVolume( 0 ),
+ mFrequencyStepSize( 0 ),
+ mRegionId( 0 ),
+ mMinFrequency( 0 ),
+ mMaxFrequency( 0 )
+{
+}
+
+void RadioData::EngineSettings::setValue( SettingHolder& holder, T_RadioDataParser& parser )
+{
+ if ( isEqual( holder.mName, KXmlMaxVolume ) )
+ {
+ parser.parseInt( holder.mValue, mMaxVolume );
+ }
+ else if ( isEqual( holder.mName, KXmlFrequencyStepSize ) )
+ {
+ parser.parseInt( holder.mValue, mFrequencyStepSize );
+ }
+ else if ( isEqual( holder.mName, KXmlRegion ) )
+ {
+ parser.parseInt( holder.mValue, mRegionId );
+ }
+ else if ( isEqual( holder.mName, KXmlMinFrequency ) )
+ {
+ int valueInt = 0;
+ parser.parseInt( holder.mValue, valueInt );
+ mMinFrequency = static_cast<uint>( valueInt );
+ }
+ else if ( isEqual( holder.mName, KXmlMaxFrequency ) )
+ {
+ int valueInt = 0;
+ parser.parseInt( holder.mValue, valueInt );
+ mMaxFrequency = static_cast<uint>( valueInt );
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/inc/radiopresetstorage.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPRESETSTORAGE_H_
+#define RADIOPRESETSTORAGE_H_
+
+// System includes
+#include <qglobal.h>
+
+#include "radiopresetstorageexport.h"
+
+// Forward declarations
+class RadioStationIf;
+class RadioPresetStoragePrivate;
+
+class STORAGE_DLL_EXPORT RadioPresetStorage
+{
+ Q_DECLARE_PRIVATE_D( d_ptr, RadioPresetStorage )
+ Q_DISABLE_COPY( RadioPresetStorage )
+
+public:
+
+ RadioPresetStorage();
+ ~RadioPresetStorage();
+
+ int maxNumberOfPresets() const;
+ int presetCount() const;
+ int firstPreset() const;
+ int nextPreset( int fromIndex ) const;
+ bool deletePreset( int presetIndex );
+ bool savePreset( const RadioStationIf& station );
+ bool readPreset( int index, RadioStationIf& station );
+
+private: // data
+
+ /**
+ * Unmodifiable pointer to the private implementation
+ */
+ RadioPresetStoragePrivate* const d_ptr;
+
+};
+
+#endif // RADIOPRESETSTORAGE_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/inc/radiopresetstorage_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPRESETSTORAGE_P_H_
+#define RADIOPRESETSTORAGE_P_H_
+
+// System includes
+#ifndef COMPILE_WITH_NEW_PRESET_UTILITY
+# include <radiopresetutility.h>
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+
+#include <qscopedpointer>
+#include <e32std.h>
+
+// User includes
+
+// Forward declarations
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ class CPresetUtility;
+ typedef QScopedPointer<CPresetUtility> PresetUtilityPtr;
+#else
+ class CRadioFmPresetUtility;
+ typedef QScopedPointer<CRadioFmPresetUtility> PresetUtilityPtr;
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+
+class RadioPresetStoragePrivate
+#ifndef COMPILE_WITH_NEW_PRESET_UTILITY
+ : public MRadioPresetObserver
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+{
+public:
+
+ RadioPresetStoragePrivate();
+ ~RadioPresetStoragePrivate();
+
+ bool init();
+
+#ifndef COMPILE_WITH_NEW_PRESET_UTILITY
+private:
+ void MrpeoPresetChanged( TPresetChangeEvent /*aChange*/, TInt /*aIndex*/ ) {}
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+
+public: // data
+
+ PresetUtilityPtr mPresetUtility;
+
+};
+
+#endif // RADIOPRESETSTORAGE_P_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/inc/radiopresetstorage_win32_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPRESETSTORAGE_P_H_
+#define RADIOPRESETSTORAGE_P_H_
+
+
+#include <qscopedpointer>
+
+// User includes
+#include <qscopedpointer>
+#include <QByteArray>
+
+// Forward declarations
+class QSettings;
+class QDataStream;
+
+class Preset
+{
+public:
+
+ Preset();
+ ~Preset();
+
+ void externalize( QDataStream& outStream );
+ void internalize( QDataStream& inStream );
+
+ uint mFrequency;
+ QString mName;
+ bool mRenamedByUser;
+ int mGenre;
+ QString mUrl;
+ int mPiCode;
+ bool mFavorite;
+ bool mLocalStation;
+
+};
+
+class RadioPresetStoragePrivate
+{
+public:
+
+ RadioPresetStoragePrivate();
+ ~RadioPresetStoragePrivate();
+
+ bool init();
+
+ void readBookKeeping();
+ void saveBookKeeping();
+
+ void removeIndex( int index );
+ void addIndex( int index );
+
+ QScopedPointer<QSettings> mSettings;
+ QByteArray mBookKeeping;
+
+};
+
+#endif // RADIOPRESETSTORAGE_P_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/inc/radiopresetstorageexport.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIO_PRESET_STORAGE_EXPORT_H_
+#define RADIO_PRESET_STORAGE_EXPORT_H_
+
+// System includes
+#include <qglobal.h>
+
+#ifdef BUILD_PRESET_STORAGE_DLL
+ #define STORAGE_DLL_EXPORT Q_DECL_EXPORT
+#else
+ #define STORAGE_DLL_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // RADIO_PRESET_STORAGE_EXPORT_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/inc/radiostationif.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATIONIF_H_
+#define RADIOSTATIONIF_H_
+
+// System includes
+#include <qglobal.h>
+
+class RadioStationIf
+{
+public:
+
+ virtual int presetIndex() const = 0;
+ virtual void setPresetIndex( int presetIndex ) = 0;
+
+ virtual uint frequency() const = 0;
+ virtual void setFrequency( uint frequency ) = 0;
+
+ virtual QString name() const = 0;
+ virtual void setName( QString name ) = 0;
+
+ virtual bool isRenamedByUser() const = 0;
+ virtual void setRenamedByUser( bool renamed ) = 0;
+
+ virtual int genre() const = 0;
+ virtual void setGenre( int genre ) = 0;
+
+ virtual QString url() const = 0;
+ virtual void setUrl( QString url ) = 0;
+
+ virtual int piCode() const = 0;
+ virtual void setPiCode( int piCode ) = 0;
+
+ virtual bool isFavorite() const = 0;
+ virtual void setFavorite( bool favorite ) = 0;
+
+ virtual bool isLocalStation() const = 0;
+ virtual void setLocalStation( bool localStation ) = 0;
+
+};
+
+
+#endif // RADIOSTATIONIF_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/radiopresetstorage.pro Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,58 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+include(../buildflags.pri)
+
+TEMPLATE = lib
+TARGET = radiopresetstorage
+CONFIG += dll
+DEFINES += BUILD_PRESET_STORAGE_DLL
+win32:DESTDIR = ../bin
+
+# Wrapper does not depend on QtGui or Orbit
+QT = core
+CONFIG -= hb
+
+symbian: {
+ DEFINES += SYMBIAN
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+}
+
+INCLUDEPATH += inc
+
+COMPILE_WITH_NEW_PRESET_UTILITY {
+ INCLUDEPATH += /epoc32/include/newfmpresetutility
+ symbian:LIBS += -lpresetutility
+} else {
+ symbian:LIBS += -lfmpresetutility
+}
+
+DEPENDPATH += $$INCLUDEPATH src
+
+# $$_PRO_FILE_PWD_ points to the directory of the pro file
+MOC_DIR = $$_PRO_FILE_PWD_/tmp
+
+# Input
+HEADERS += radiopresetstorage.h
+HEADERS += radiostationif.h
+HEADERS += radiopresetstorageexport.h
+
+symbian:INTERNAL_HEADERS += radiopresetstorage_p.h
+symbian:SOURCES += radiopresetstorage.cpp
+
+win32:HEADERS += radiopresetstorage_win32_p.h
+win32:SOURCES += radiopresetstorage_win32.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/src/radiopresetstorage.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+#include <presetutility.h>
+#include <preset.h>
+#else
+# include <radiofmpresetutility.h>
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+
+#include <qstring>
+
+// User includes
+#include "radiopresetstorage.h"
+#include "radiopresetstorage_p.h"
+#include "radiostationif.h"
+
+/*!
+ * Converts a symbian descriptor to Qt string
+ */
+static QString convertString( const TDesC& aDesc )
+{
+ return QString( (QChar*)aDesc.Ptr(), aDesc.Length() );
+}
+
+/*!
+ *
+ */
+RadioPresetStorage::RadioPresetStorage() :
+ d_ptr( new RadioPresetStoragePrivate() )
+{
+ Q_D( RadioPresetStorage );
+ d->init();
+}
+
+/*!
+ *
+ */
+RadioPresetStorage::~RadioPresetStorage()
+{
+}
+
+/*!
+ *
+ */
+int RadioPresetStorage::maxNumberOfPresets() const
+{
+ Q_D( const RadioPresetStorage );
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ return d->mPresetUtility->MaxNumberOfPresets();
+#else
+ TInt maxPresets = 0;
+ d->mPresetUtility->GetMaxNumberOfPresets( maxPresets );
+ return maxPresets;
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+}
+
+/*!
+ *
+ */
+int RadioPresetStorage::presetCount() const
+{
+ Q_D( const RadioPresetStorage );
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ return d->mPresetUtility->PresetCount();
+#else
+ TInt presetCount = 0;
+ d->mPresetUtility->GetNumberOfPresets( presetCount );
+ return presetCount;
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+}
+
+/*!
+ *
+ */
+int RadioPresetStorage::firstPreset() const
+{
+ Q_D( const RadioPresetStorage );
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ return d->mPresetUtility->FirstPreset();
+#else
+ TInt firstIndex = -1;
+ TRAPD( err, d->mPresetUtility->GetFirstPresetL( firstIndex ) );
+ if ( err ) {
+ firstIndex = -1;
+ }
+ return firstIndex;
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+}
+
+/*!
+ *
+ */
+int RadioPresetStorage::nextPreset( int fromIndex ) const
+{
+ Q_D( const RadioPresetStorage );
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ return d->mPresetUtility->NextPreset( fromIndex );
+#else
+ TInt nextIndex = -1;
+ TRAPD( err, d->mPresetUtility->GetNextPresetL( fromIndex, nextIndex ) );
+ if ( err ) {
+ nextIndex = -1;
+ }
+ return nextIndex;
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+}
+
+/*!
+ *
+ */
+bool RadioPresetStorage::deletePreset( int presetIndex )
+{
+ Q_D( RadioPresetStorage );
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ return d->mPresetUtility->DeletePreset( presetIndex ) == KErrNone;
+#else
+ TRAPD( err, d->mPresetUtility->DeletePresetL( presetIndex ) );
+ return err;
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+}
+
+/*!
+ *
+ */
+bool RadioPresetStorage::savePreset( const RadioStationIf& station )
+{
+ Q_D( RadioPresetStorage );
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ TPreset preset;
+ preset.SetFrequency( station.frequency() );
+ TPresetName name( station.name().utf16() );
+ preset.SetName( name );
+ preset.SetRenamedByUser( station.isRenamedByUser() );
+ preset.SetGenre( station.genre() );
+ TRadioUrl url( station.url().utf16() );
+ preset.SetUrl( url );
+ preset.SetPiCode( station.piCode() );
+ preset.SetFavorite( station.isFavorite() );
+ preset.SetLocalStation( station.isLocalStation() );
+
+ TRAPD( err, d->mPresetUtility->SavePresetL( preset, station.presetIndex() ) );
+ return err == KErrNone;
+#else
+ TFmPresetName name( station.name().utf16() );
+ TRAPD( err, d->mPresetUtility->SetPresetL( station.presetIndex(), name, station.frequency() ) );
+ return err == KErrNone;
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+}
+
+/*!
+ *
+ */
+bool RadioPresetStorage::readPreset( int index, RadioStationIf& station )
+{
+ Q_D( RadioPresetStorage );
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ TPreset preset;
+ TRAPD( err, d->mPresetUtility->ReadPresetL( index, preset ) );
+ if ( !err ) {
+
+ station.setPresetIndex( index );
+ station.setFrequency( preset.Frequency() );
+ station.setName( convertString( preset.Name() ) );
+ station.setRenamedByUser( preset.RenamedByUser() );
+ station.setGenre( preset.Genre() );
+ station.setUrl( convertString( preset.Url() ) );
+ station.setPiCode( preset.PiCode() );
+ station.setFavorite( preset.Favorite() );
+ station.setLocalStation( preset.LocalStation() );
+
+ return true;
+ }
+ return false;
+#else
+ TFmPresetName nameDesc;
+ TInt frequency = 0;
+ TRAPD( err, d->mPresetUtility->GetPresetL( index, nameDesc, frequency ) );
+ if ( !err )
+ {
+ station.setPresetIndex( index );
+ station.setName( convertString( nameDesc ) );
+ station.setFrequency( static_cast<TUint>( frequency ) );
+ station.setLocalStation( true );
+ }
+ return err == KErrNone;
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+}
+
+/*!
+ *
+ */
+RadioPresetStoragePrivate::RadioPresetStoragePrivate()
+{
+}
+
+/*!
+ *
+ */
+RadioPresetStoragePrivate::~RadioPresetStoragePrivate()
+{
+}
+
+/*!
+ *
+ */
+bool RadioPresetStoragePrivate::init()
+{
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ TRAPD( err, mPresetUtility.reset( CPresetUtility::NewL() ) );
+
+#else
+ TRAPD( err, mPresetUtility.reset( CRadioFmPresetUtility::NewL( *this ) ) );
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+ return err == KErrNone;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/src/radiopresetstorage_win32.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,285 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qstring>
+#include <qsettings>
+#include <qdatastream>
+
+// User includes
+#include "radiopresetstorage.h"
+#include "radiopresetstorage_win32_p.h"
+#include "radiostationif.h"
+
+const QString KKeyBookKeeping = "BookKeeping";
+const QString KKeyBase = "Preset-";
+
+/*!
+ *
+ */
+static QString makeKey( int index ) {
+ QString key = KKeyBase;
+ key.append( index );
+ return key;
+}
+
+/*!
+ *
+ */
+Preset::Preset() :
+ mFrequency( 0 ),
+ mRenamedByUser( false ),
+ mGenre( -1 ),
+ mPiCode( -1 ),
+ mFavorite( false ),
+ mLocalStation( false )
+{
+}
+
+/*!
+ *
+ */
+Preset::~Preset()
+{
+}
+
+/*!
+ *
+ */
+void Preset::externalize( QDataStream& outStream )
+{
+ outStream << mFrequency;
+ outStream << mName;
+ outStream << mRenamedByUser;
+ outStream << mGenre;
+ outStream << mUrl;
+ outStream << mPiCode;
+ outStream << mFavorite;
+ outStream << mLocalStation;
+}
+
+/*!
+ *
+ */
+void Preset::internalize( QDataStream& inStream )
+{
+ inStream >> mFrequency;
+ inStream >> mName;
+ inStream >> mRenamedByUser;
+ inStream >> mGenre;
+ inStream >> mUrl;
+ inStream >> mPiCode;
+ inStream >> mFavorite;
+ inStream >> mLocalStation;
+}
+
+/*!
+ *
+ */
+RadioPresetStorage::RadioPresetStorage() :
+ d_ptr( new RadioPresetStoragePrivate() )
+{
+ Q_D( RadioPresetStorage );
+ d->init();
+}
+
+/*!
+ *
+ */
+RadioPresetStorage::~RadioPresetStorage()
+{
+}
+
+/*!
+ *
+ */
+int RadioPresetStorage::maxNumberOfPresets() const
+{
+ return 100;
+}
+
+/*!
+ *
+ */
+int RadioPresetStorage::presetCount() const
+{
+ Q_D( const RadioPresetStorage );
+ return d->mBookKeeping.count();
+}
+
+/*!
+ *
+ */
+int RadioPresetStorage::firstPreset() const
+{
+ Q_D( const RadioPresetStorage );
+ if ( d->mBookKeeping.count() > 0 ) {
+ return d->mBookKeeping.at( 0 );
+ }
+ return -1;
+}
+
+/*!
+ *
+ */
+int RadioPresetStorage::nextPreset( int fromIndex ) const
+{
+ Q_D( const RadioPresetStorage );
+ int index = d->mBookKeeping.indexOf( fromIndex ) + 1;
+ if ( index > 0 && index < d->mBookKeeping.count() ) {
+ return d->mBookKeeping.at( index );
+ }
+ return -1;
+}
+
+/*!
+ *
+ */
+bool RadioPresetStorage::deletePreset( int presetIndex )
+{
+ Q_D( RadioPresetStorage );
+ int index = d->mBookKeeping.indexOf( presetIndex );
+ if ( index > -1 ) {
+ d->mBookKeeping.remove( index, 1 );
+ d->mSettings->remove( makeKey( presetIndex ) );
+ d->removeIndex( presetIndex );
+ return true;
+ }
+ return false;
+}
+
+/*!
+ *
+ */
+bool RadioPresetStorage::savePreset( const RadioStationIf& station )
+{
+ Preset preset;
+ preset.mFrequency = station.frequency();
+ preset.mName = station.name();
+ preset.mRenamedByUser = station.isRenamedByUser() ;
+ preset.mGenre = station.genre();
+ preset.mUrl = station.url();
+ preset.mPiCode = station.piCode();
+ preset.mFavorite = station.isFavorite();
+ preset.mLocalStation = station.isLocalStation();
+
+ QByteArray array;
+ QDataStream outStream( &array, QIODevice::WriteOnly );
+ preset.externalize( outStream );
+
+ Q_D( RadioPresetStorage );
+ d->mSettings->setValue( makeKey( station.presetIndex() ), array );
+
+ d->addIndex( station.presetIndex() );
+
+ return true;
+}
+
+/*!
+ *
+ */
+bool RadioPresetStorage::readPreset( int index, RadioStationIf& station )
+{
+ Q_D( RadioPresetStorage );
+ QByteArray array = d->mSettings->value( makeKey( index ) ).toByteArray();
+ if ( !array.isEmpty() ) {
+ Preset preset;
+
+ QDataStream inStream( array );
+ preset.internalize( inStream );
+
+ station.setPresetIndex( index );
+ station.setFrequency( preset.mFrequency );
+ station.setName( preset.mName );
+ station.setRenamedByUser( preset.mRenamedByUser );
+ station.setGenre( preset.mGenre );
+ station.setUrl( preset.mUrl );
+ station.setPiCode( preset.mPiCode );
+ station.setFavorite( preset.mFavorite );
+ station.setLocalStation( preset.mLocalStation );
+
+ return true;
+ }
+ return false;
+}
+
+/*!
+ *
+ */
+RadioPresetStoragePrivate::RadioPresetStoragePrivate()
+{
+}
+
+/*!
+ *
+ */
+RadioPresetStoragePrivate::~RadioPresetStoragePrivate()
+{
+}
+
+/*!
+ *
+ */
+bool RadioPresetStoragePrivate::init()
+{
+ mSettings.reset( new QSettings( "Nokia", "QtFmRadio" ) );
+ readBookKeeping();
+ return true;
+}
+
+/*!
+ *
+ */
+void RadioPresetStoragePrivate::readBookKeeping()
+{
+ QVariant value = mSettings->value( KKeyBookKeeping );
+ if ( value.isValid() ) {
+ mBookKeeping = value.toByteArray();
+ }
+}
+
+/*!
+ *
+ */
+void RadioPresetStoragePrivate::saveBookKeeping()
+{
+ mSettings->setValue( KKeyBookKeeping, mBookKeeping );
+}
+
+/*!
+ *
+ */
+void RadioPresetStoragePrivate::removeIndex( int index )
+{
+ int pos = mBookKeeping.indexOf( index );
+ if ( pos > -1 ) {
+ mBookKeeping.remove( pos, 1 );
+ saveBookKeeping();
+ }
+}
+
+/*!
+ *
+ */
+void RadioPresetStoragePrivate::addIndex( int index )
+{
+ int pos = mBookKeeping.indexOf( index );
+ if ( pos == -1 ) {
+ mBookKeeping.append( index );
+ saveBookKeeping();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/tsrc/inc/t_radiopresetstorage.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef T_RADIOPRESETSTORAGE_H_
+#define T_RADIOPRESETSTORAGE_H_
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+#include "radiopresetstorage.h"
+
+
+class RadioPresetStorage;
+
+class TestRadioPresetStorage : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ TestRadioPresetStorage();
+ ~TestRadioPresetStorage();
+
+public slots:
+
+private slots:
+ // test framework called slots
+ void initTestCase();
+ void init();
+ void cleanup();
+ void cleanupTestCase();
+ void testSavePreset();
+ void testReadPreset();
+ void testDeletePreset();
+ void testStessTest();
+
+private:
+
+private:
+ QScopedPointer<RadioPresetStorage> mPresetStorage;
+};
+
+#endif /* T_RADIOPRESETSTORAGE_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/tsrc/src/t_radiopresetstorage.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "t_radiopresetstorage.h"
+#include "radiopresetstorage.h"
+#include "radiostation.h"
+#include "radiostation_p.h"
+
+// Constants
+const uint KTestFrequency1 = 89000000;
+const uint KTestFrequency2 = 89500000;
+const uint KTestFrequency3 = 90000000;
+const uint KTestFrequency4 = 90500000;
+const uint KMaxNumberOfPresets = 100;
+const uint KInvalidPresetIndex = -2;
+const uint KFirstPresetIndex = 0;
+const uint KSecondPresetIndex = 1;
+const uint KThirdPresetIndex = 2;
+const uint KFrequencyStep = 100000;
+
+/*!
+ *
+ */
+int main(int /* argc*/, char *argv[])
+{
+ TestRadioPresetStorage tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testradiopresetstorage.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+TestRadioPresetStorage::TestRadioPresetStorage()
+{
+}
+
+
+/*!
+ * Destructor
+ */
+TestRadioPresetStorage::~TestRadioPresetStorage()
+{
+}
+
+/*!
+ * called before each testfunction is executed
+ */
+void TestRadioPresetStorage::init()
+{
+}
+
+/*!
+ * called after every testfunction
+ */
+void TestRadioPresetStorage::cleanup()
+{
+}
+
+/*!
+ * called before the first testfunction is executed
+ */
+void TestRadioPresetStorage::initTestCase()
+{
+ mPresetStorage.reset( new RadioPresetStorage() );
+ // this is the range used in this test module
+ for(int i = 0; i <= mPresetStorage->maxNumberOfPresets(); i++)
+ {
+ mPresetStorage->deletePreset( i );
+ }
+ QVERIFY2(( mPresetStorage->presetCount() == 0 ), "API:RadioPresetStorage initTestCase 1");
+ // TODO: replace the local constant with the constand defined in preset utility header
+ QVERIFY2(( mPresetStorage->maxNumberOfPresets() == KMaxNumberOfPresets ), "API:RadioPresetStorage initTestCase 2");
+}
+
+/*!
+ * called after the last testfunction was executed
+ */
+void TestRadioPresetStorage::cleanupTestCase()
+{
+
+}
+
+/*!
+ * Test saving preset
+ */
+void TestRadioPresetStorage::testSavePreset()
+{
+ int test = mPresetStorage->maxNumberOfPresets();
+ int initialPresetCount( 0 );
+ //int initialPresetindex( KFirstPresetIndex );
+ RadioStation station;
+ station.setFrequency( KTestFrequency1 );
+ station.setPresetIndex( KFirstPresetIndex );
+ mPresetStorage->savePreset( *station.data_ptr() );
+ QVERIFY2(( mPresetStorage->presetCount() == initialPresetCount + 1 ), "API:RadioPresetStorage testSavePreset 1");
+ QVERIFY2(( mPresetStorage->nextPreset( KFirstPresetIndex ) == 0 ), "API:RadioPresetStorage testSavePreset 2");
+
+ station.setFrequency( KTestFrequency2 );
+ station.setPresetIndex( KSecondPresetIndex );
+ mPresetStorage->savePreset( *station.data_ptr() );
+ QVERIFY2(( mPresetStorage->presetCount() == initialPresetCount + 2 ), "API:RadioPresetStorage testSavePreset 3");
+ QVERIFY2(( mPresetStorage->nextPreset( KFirstPresetIndex ) == KSecondPresetIndex ), "API:RadioPresetStorage testSavePreset 4");
+
+ // check that saving preset fails if preset index and frequency are allready in use
+ station.setFrequency( KTestFrequency2 );
+ station.setPresetIndex( KSecondPresetIndex );
+ mPresetStorage->savePreset( *station.data_ptr() );
+ QVERIFY2(( mPresetStorage->presetCount() == initialPresetCount + 2 ), "API:RadioPresetStorage testSavePreset 5");
+
+ // check that saving preset success when new preset index and frequency are not in use
+ station.setFrequency( KTestFrequency3 );
+ station.setPresetIndex( KThirdPresetIndex );
+ mPresetStorage->savePreset( *station.data_ptr() );
+ QVERIFY2(( mPresetStorage->presetCount() == initialPresetCount + 3 ), "API:RadioPresetStorage testSavePreset 6");
+
+ // check that saving with invalid preset index fails
+ station.setFrequency( KTestFrequency4 );
+ station.setPresetIndex( KInvalidPresetIndex );
+ mPresetStorage->savePreset( *station.data_ptr() );
+ QVERIFY2(( mPresetStorage->presetCount() == initialPresetCount + 3 ), "API:RadioPresetStorage testSavePreset 6");
+}
+
+/*!
+ * Test reading preset
+ */
+void TestRadioPresetStorage::testReadPreset()
+{
+ RadioStation station;
+ RadioStationIf* preset = static_cast<RadioStationIf*>( station.data_ptr() );
+ mPresetStorage->readPreset( KFirstPresetIndex, *preset );
+ QVERIFY2(( preset->frequency() == KTestFrequency1 ), "API:RadioPresetStorage testReadPreset 1");
+
+ RadioStation station1;
+ RadioStationIf* preset1 = static_cast<RadioStationIf*>( station1.data_ptr() );
+ mPresetStorage->readPreset( KSecondPresetIndex, *preset1 );
+ QVERIFY2(( preset->frequency() == KTestFrequency2 ), "API:RadioPresetStorage testReadPreset 2");
+
+ RadioStation station2;
+ RadioStationIf* preset2 = static_cast<RadioStationIf*>( station2.data_ptr() );
+ mPresetStorage->readPreset( KThirdPresetIndex, *preset2 );
+ QVERIFY2(( preset->frequency() == KTestFrequency3 ), "API:RadioPresetStorage testReadPreset 3");
+
+ RadioStation station3;
+ RadioStationIf* preset3 = static_cast<RadioStationIf*>( station3.data_ptr() );
+ // test the value returned with invalid preset index
+ mPresetStorage->readPreset( KThirdPresetIndex + 1, *preset3 );
+ // TODO: change the value to KErrNotFound when preset utility update done
+ QVERIFY2(( preset->frequency() == 87500000 ), "API:RadioPresetStorage testReadPreset 4");
+}
+
+/*!
+ * Test deleting preset
+ */
+void TestRadioPresetStorage::testDeletePreset()
+{
+ int initialPresetCount( mPresetStorage->presetCount() );
+
+ QVERIFY2(( mPresetStorage->firstPreset() == KFirstPresetIndex ), "API:RadioPresetStorage testDeletePreset 1");
+ QVERIFY2(( mPresetStorage->nextPreset( KFirstPresetIndex ) == KSecondPresetIndex ), "API:RadioPresetStorage testDeletePreset 2");
+ mPresetStorage->deletePreset( KSecondPresetIndex );
+ QVERIFY2(( mPresetStorage->nextPreset( KFirstPresetIndex ) == KThirdPresetIndex ), "API:RadioPresetStorage testDeletePreset 3");
+ QVERIFY2(( mPresetStorage->presetCount() == (initialPresetCount - 1)), "API:RadioPresetStorage testDeletePreset 4");
+
+ RadioStation station;
+ RadioStationIf* preset = static_cast<RadioStationIf*>( station.data_ptr() );
+ mPresetStorage->readPreset( KSecondPresetIndex, *preset );
+ // TODO: change the value to KErrNotFound when preset utility update done
+ QVERIFY2(( preset->frequency() == 87500000 ), "API:RadioPresetStorage testDeletePreset 5");
+
+ mPresetStorage->deletePreset( KFirstPresetIndex );
+ QVERIFY2(( mPresetStorage->firstPreset() == KThirdPresetIndex ), "API:RadioPresetStorage testDeletePreset 6");
+ mPresetStorage->deletePreset( KThirdPresetIndex );
+ QVERIFY2(( mPresetStorage->presetCount() == 0), "API:RadioPresetStorage testDeletePreset 7");
+}
+
+/*!
+ * Test filling preset storage and handling boundary values
+ */
+void TestRadioPresetStorage::testStessTest()
+{
+ for(int i = 0; i < mPresetStorage->maxNumberOfPresets(); i++)
+ {
+ RadioStation station;
+ station.setFrequency( 87500000 + i*KFrequencyStep );
+ station.setPresetIndex( i );
+ mPresetStorage->savePreset( *station.data_ptr() );
+ }
+ QVERIFY2(( mPresetStorage->presetCount() == mPresetStorage->maxNumberOfPresets()), "API:RadioPresetStorage testStessTest 1");
+ int test = mPresetStorage->presetCount();
+ RadioStation station;
+ station.setFrequency( 87500000 + mPresetStorage->maxNumberOfPresets()*KFrequencyStep + KFrequencyStep);
+ station.setPresetIndex( mPresetStorage->maxNumberOfPresets() );
+ mPresetStorage->savePreset( *station.data_ptr() );
+ int r = mPresetStorage->presetCount();
+ // preset count must not increase
+ QVERIFY2(( mPresetStorage->presetCount() == mPresetStorage->maxNumberOfPresets()), "API:RadioPresetStorage testStessTest 2");
+
+ for(int i = 0; i <= mPresetStorage->maxNumberOfPresets(); i++)
+ {
+ mPresetStorage->deletePreset( i );
+ }
+
+ // test deleting with invalid preset index
+ mPresetStorage->deletePreset( KInvalidPresetIndex );
+ QVERIFY2(( mPresetStorage->presetCount() == 0), "API:RadioPresetStorage testStessTest 3");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiopresetstorage/tsrc/t_radiopresetstorage.pro Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = app
+TARGET = t_radiopresetstorage
+
+symbian: {
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.SID = 0x101FF976 # Old visual radio uid
+}
+
+DEPENDPATH += . \
+ inc \
+ src
+INCLUDEPATH += . \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport \
+ stub/inc \
+ ../../../inc \
+ ../inc \
+ ../../radioenginewrapper/commoninc \
+ ../../radioenginewrapper/inc \
+ ../../radiopresetstorage/inc \
+ ../../radiouiengine/inc \
+ ../../../../inc
+
+CONFIG += qtestlib
+
+symbian:LIBS += -lradiouiengine
+symbian:LIBS += -lradioenginewrapper
+symbian:LIBS += -lradiopresetstorage
+
+
+HEADERS += inc/t_radiopresetstorage.h
+SOURCES += src/t_radiopresetstorage.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radiolocalization.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,297 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qobject.h>
+
+typedef struct{ const char* source; const char* comment; } Translation;
+
+#define TRANSLATE(string) tr( string.source, string.comment )
+#define QTRANSLATE(string) QObject::tr( string.source, string.comment )
+
+static const char* KContextApplication = "RadioApplication";
+static const char* KContextViewBase = "RadioViewBase";
+static const char* KContextModel = "RadioStationModel";
+static const char* KContextTuningView = "RadioTuningView";
+static const char* KContextStationControl = "RadioStationControlWidget";
+static const char* KContextStationsView = "RadioStationsView";
+static const char* KContextWizardView = "RadioWizardView";
+static const char* KContextPresetScanner = "RadioFrequencyScanner";
+static const char* KContextMenuBar = "Menu";
+
+//:
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KConnectHeadsetAntenna = QT_TRANSLATE_NOOP3( KContextTuningView, "Connect headset antenna", "txt_rad_list_connect_headset_antenna" );
+
+//: Headset disconnected popup title
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KTitleHeadsetDisconnectedPopup = QT_TRANSLATE_NOOP3( KContextApplication, "Headset disconnected", "txt_fmradio_popup_headset_disconnected" );
+
+//: FMRadio application name
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KApplicationName = QT_TRANSLATE_NOOP3( KContextViewBase, "FM Radio", "txt_fmradio_appname" );
+
+//: Error message telling that radio receiver startup failed
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KErrorEngineStartFailed = QT_TRANSLATE_NOOP3( KContextApplication, "Failed to start radio receiver", "txt_fmradio_popup_start_failed" );
+
+//: Radio frequency megahertz abbreviation
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KFrequencyMhz = QT_TRANSLATE_NOOP3( KContextModel, "%1 Mhz", "txt_fmradio_model_mhz" );
+
+// TUNING VIEW
+
+//: Menu item in the tuning view menu to activate the stations view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuActivateStationsView = QT_TRANSLATE_NOOP3( KContextTuningView, "Go to Stations View", "txt_fmradio_action_activate_stationsview" );
+
+//: Text in the Station information area when seeking is ongoing
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KHeadingSeeking = QT_TRANSLATE_NOOP3( KContextTuningView, "Seeking", "txt_fmradio_heading_seeking" );
+
+// STATIONS VIEW
+
+//: Menu item in the stations view menu to activate Wizard view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuScanLocalStations = QT_TRANSLATE_NOOP3( KContextStationsView, "Scan local stations", "txt_fmradio_action_scan_local_stations" );
+
+//: Menu item in the stations view menu to activate the tuning view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuActivateTuningView = QT_TRANSLATE_NOOP3( KContextStationsView, "Go to Tuning View", "txt_fmradio_action_activate_tuningview" );
+
+//: Filter button to show only the favorite stations in the stations view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnTextFavorites = QT_TRANSLATE_NOOP3( KContextStationsView, "Favorites", "txt_fmradio_show_favorites" );
+
+//: Filter button to show only the local stations in the stations view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnTextLocalStations = QT_TRANSLATE_NOOP3( KContextStationsView, "Local stations", "txt_fmradio_show_local_stations" );
+
+//: Heading text to indicate that stations list is currently displaying favorite stations
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KHeadingTextFavorites = QT_TRANSLATE_NOOP3( KContextStationsView, "Favorites", "txt_fmradio_heading_favorites" );
+
+//: Prefix of the text in a button that changes view to tuning view.
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnTextNowPlaying = QT_TRANSLATE_NOOP3( KContextStationsView, "Now Playing: %1", "txt_fmradio_btn_now_playing" );
+
+//: Text in a button that changes view to tuning view (headset disconnected case).
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnTextConnectHeadsetAntenna = QT_TRANSLATE_NOOP3( KContextStationsView, "Connect headset antenna", "txt_fmradio_btn_connect_headset_antenna" );
+
+//: Heading text to indicate that stations list is currently displaying local stations
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KHeadingTextLocalStations = QT_TRANSLATE_NOOP3( KContextStationsView, "Local stations", "txt_fmradio_heading_local_stations" );
+
+//: Title for the progress note for scanning local stations
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KProgressTitleScanStations = QT_TRANSLATE_NOOP3( KContextPresetScanner, "Scanning local stations", "txt_fmradio_title_scan_stations" );
+
+//: Title for the progress note for scanning local stations. Shows the amount of stations found so far
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KProgressTitleStationsFound = QT_TRANSLATE_NOOP3( KContextPresetScanner, "%1 stations found", "txt_fmradio_title_stations_found" );
+
+// Stations view context sentive menu texts
+
+//: Title for the "rename station" menu item in the stationsview context sensitive menu
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuItemRenameStation = QT_TRANSLATE_NOOP3( KContextStationsView, "Rename station", "txt_fmradio_menu_rename_station" );
+
+//: Title for the "remove renaming" menu item in the stationsview context sensitive menu
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuItemRemoveRenaming = QT_TRANSLATE_NOOP3( KContextStationsView, "Remove renaming", "txt_fmradio_menu_remove_renaming" );
+
+//: Title for the input query used to rename the station
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KQueryEnterStationName = QT_TRANSLATE_NOOP3( KContextStationsView, "Enter station name", "txt_fmradio_query_enter_station_name" );
+
+//: Title for the "set as favorite" menu item in the stationsview context sensitive menu
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuItemSetAsFavorite = QT_TRANSLATE_NOOP3( KContextStationsView, "Set as favorite", "txt_fmradio_menu_set_favorite" );
+
+//: Title for the "remove favorite" menu item in the stationsview context sensitive menu
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuItemRemoveFavorite = QT_TRANSLATE_NOOP3( KContextStationsView, "Remove favorite", "txt_fmradio_menu_remove_favorite" );
+
+//: Title for the "remove station" menu item in the stationsview context sensitive menu
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuItemRemoveStation = QT_TRANSLATE_NOOP3( KContextStationsView, "Remove station", "txt_fmradio_menu_remove_station" );
+
+// WIZARD VIEW
+
+//: Heading text to indicate that user can select favourite stations from the stations list
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KHeadingTextSelectFavorites = QT_TRANSLATE_NOOP3( KContextWizardView, "Select favourite stations", "txt_fmradio_heading_select_favorites" );
+
+//: Button for marking all Wizard view station listbox items
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnTextMarkAll = QT_TRANSLATE_NOOP3( KContextWizardView, "Mark All", "txt_fmradio_mark_all" );
+
+//: Button for unmarking all Wizard view station listbox items
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnTextUnmarkAll = QT_TRANSLATE_NOOP3( KContextWizardView, "Unmark All", "txt_fmradio_unmark_all" );
+
+//: Confirmation query for starting in offline mode
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KQueryTextStartOffline = QT_TRANSLATE_NOOP3( KContextWizardView, "Start in offline mode?", "txt_fmradio_start_offline" );
+//: Confirmation for favourite station selections in Wizard view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnTextDone = QT_TRANSLATE_NOOP3( KContextWizardView, "Done", "txt_fmradio_done" );
+
+// STATION CONTROL WIDGET
+
+//: Button to tag the current song in the station control widget in tuning view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnTagSong = QT_TRANSLATE_NOOP3( KContextStationControl, "Tag this song", "txt_fmradio_btn_tag_song" );
+
+//: Button to open play history in the station control widget in tuning view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnPlayHistory = QT_TRANSLATE_NOOP3( KContextStationControl, "Play history", "txt_fmradio_btn_play_history" );
+
+//: Button to open a web address in the station control widget in tuning view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnGotoWeb = QT_TRANSLATE_NOOP3( KContextStationControl, "Go to web address", "txt_fmradio_btn_goto_web" );
+
+//: Button to mark current station as favorite in the station control widget in tuning view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnSetFavorite = QT_TRANSLATE_NOOP3( KContextStationControl, "Set as favorite", "txt_fmradio_btn_set_favorite" );
+
+//: Button to remove the favorite status from the current station in the station control widget in tuning view
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KBtnRemoveFavorite = QT_TRANSLATE_NOOP3( KContextStationControl, "Remove favorite", "txt_fmradio_btn_remove_favorite" );
+
+// Generic texts
+
+//: Menu item in the view menu to exit the application
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuExit = QT_TRANSLATE_NOOP3( KContextMenuBar, "Exit", "txt_fmradio_action_exit" );
+
+//: Menu item to route audio to loudspeaker
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuUseLoudspeaker = QT_TRANSLATE_NOOP3( KContextMenuBar, "Use loudspeaker", "txt_fmradio_menu_use_loudspeaker" );
+
+//: Menu item to route audio to headset
+//* loc-layout_id foo_dialog
+//* loc-blank False
+//* loc-viewid vid1
+//* loc-positionid pid1
+const Translation KMenuUseHeadset = QT_TRANSLATE_NOOP3( KContextMenuBar, "Use headset", "txt_fmradio_menu_use_headset" );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radioplaylogitem.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPLAYLOGITEM_H
+#define RADIOPLAYLOGITEM_H
+
+// System includes
+#include <qmetatype>
+#include <qobject>
+
+// User includes
+#include "radiouiengineexport.h"
+
+// Forward declarations
+class RadioPlayLogItemPrivate;
+
+/*!
+ * Radio play log item implements a song recognized from the radio broadcast
+ *
+ * Note! It is derived from QObject even though architecturally it shouldn't be.
+ * It is done only to satisfy the WINSCW build which doesn't export the destructor in UREL
+ * build. This causes mismatching def files and annoying warnings. Deriving from QObject fixes this
+ */
+class UI_ENGINE_DLL_EXPORT RadioPlayLogItem : public QObject
+{
+public:
+
+ RadioPlayLogItem();
+ RadioPlayLogItem( const QString& artist, const QString& title );
+ RadioPlayLogItem( const RadioPlayLogItem& other );
+
+ ~RadioPlayLogItem();
+
+ RadioPlayLogItem& operator=( const RadioPlayLogItem& other );
+
+ QString artist() const;
+ void setArtist( const QString& artist );
+
+ QString title() const;
+ void setTitle( const QString& title );
+
+ bool isFavorite() const;
+ void setFavorite();
+
+ void increasePlayCount();
+ int playCount() const;
+
+private:
+
+ /**
+ * Decrements the reference count of the implicitly shared data.
+ * Data is deleted if no instance uses it anymore.
+ */
+ void decrementReferenceCount();
+
+private: // data
+
+ /**
+ * Pointer to the implicitly shared private implementation
+ * Own.
+ */
+ class RadioPlayLogItemPrivate* mData;
+
+public:
+
+ /**
+ * Detach from the implicitly shared data
+ */
+ void detach();
+
+ /**
+ * Checks if the class is detached from implicitly shared data
+ * Required by many QT convenience functions for implicitly shared classes
+ */
+ bool isDetached() const;
+
+ typedef RadioPlayLogItemPrivate* DataPtr;
+ inline DataPtr &data_ptr() { return mData; }
+
+};
+
+Q_DECLARE_TYPEINFO( RadioPlayLogItem, Q_MOVABLE_TYPE ); // Can be moved around in memory by containers if necessary
+Q_DECLARE_SHARED( RadioPlayLogItem ) // Uses implicit sharing
+Q_DECLARE_METATYPE( RadioPlayLogItem ) // To be usable in a QVariant
+
+#endif // RADIOPLAYLOGITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radioplaylogitem_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPLAYLOGITEM_P_H
+#define RADIOPLAYLOGITEM_P_H
+
+// System includes
+#include <qstring>
+
+// User includes
+
+class RadioPlayLogItemPrivate
+{
+public:
+
+ RadioPlayLogItemPrivate();
+ RadioPlayLogItemPrivate( const QString& artist, const QString& title );
+
+ void init( const QString& artist, const QString& title );
+
+public: // data
+
+ /**
+ * Reference count used for implicit sharing.
+ * Has to be named "ref" instead having the 'm' prefix like all other member variables in Radio
+ * This is because convenience functions like qAtomicAssign() expect it to be named "ref"
+ */
+ QAtomicInt ref;
+
+ QString mArtist;
+
+ QString mTitle;
+
+ int mPlayCount;
+
+ bool mFavorite;
+
+};
+
+#endif // RADIOPLAYLOGITEM_P_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radioplaylogmodel.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPLAYLOGMODEL_H
+#define RADIOPLAYLOGMODEL_H
+
+// System includes
+#include <qabstractlistmodel>
+
+// User includes
+#include "radiouiengineexport.h"
+#include "radioplaylogitem.h"
+
+// Forward declarations
+class RadioPlayLogModelPrivate;
+class RadioUiEngine;
+
+class UI_ENGINE_DLL_EXPORT RadioPlayLogModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE_D( d_ptr, RadioPlayLogModel )
+ Q_DISABLE_COPY( RadioPlayLogModel )
+
+ friend class RadioUiEngine;
+ friend class RadioStationModelPrivate;
+ friend class TestRadioUiEngine;
+
+public:
+
+ enum PlayLogRole
+ {
+ PlayLogItemRole = Qt::UserRole + 100,
+ SetFavoriteRole
+ };
+
+// from base class QAbstractListModel
+
+ Qt::ItemFlags flags ( const QModelIndex& index ) const;
+ int rowCount( const QModelIndex& parent = QModelIndex() ) const;
+ QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
+ bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole );
+
+// New functions
+
+ bool isCurrentSongRecognized() const;
+
+signals:
+
+ void itemAdded();
+ void currentSongReset();
+
+public slots:
+
+ void resetCurrentSong();
+ void setFavorite();
+ void removeAll();
+
+private:
+
+ explicit RadioPlayLogModel( RadioUiEngine& uiEngine );
+
+ ~RadioPlayLogModel();
+
+ void addItem( const QString& artist, const QString& title );
+
+ void clearRadioTextPlus();
+ void addRadioTextPlus( int rtClass, const QString& rtItem );
+
+ int findItem( const QString& artist, const QString& title, RadioPlayLogItem& item );
+
+ void updateItem( int index, const RadioPlayLogItem& item, bool prepend = false );
+
+private: // data
+
+ /**
+ * Unmodifiable pointer to the private implementation
+ */
+ RadioPlayLogModelPrivate* const d_ptr;
+
+};
+
+#endif // RADIOPLAYLOGMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radioplaylogmodel_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPLAYLOGMODEL_P_H
+#define RADIOPLAYLOGMODEL_P_H
+
+// System includes
+#include <qlist>
+#include <qstring>
+
+// Forward declarations
+class RadioPlayLogModel;
+class RadioUiEngine;
+class RadioPlayLogItem;
+
+class RadioPlayLogModelPrivate
+{
+public:
+
+ explicit RadioPlayLogModelPrivate( RadioPlayLogModel* model, RadioUiEngine& uiEngine );
+
+ ~RadioPlayLogModelPrivate();
+
+public: // data
+
+ /**
+ * Pointer to the public class
+ * Not own.
+ */
+ RadioPlayLogModel* q_ptr;
+
+ /**
+ * Reference to the ui engine
+ */
+ RadioUiEngine& mUiEngine;
+
+ /**
+ * List of play log items
+ */
+ QList<RadioPlayLogItem> mItems;
+
+ QString mRtItemHolder;
+
+ bool mTopItemIsPlaying;
+
+};
+
+#endif // RADIOPLAYLOGMODEL_P_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radiostation.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATION_H_
+#define RADIOSTATION_H_
+
+// System includes
+#include <qstring>
+#include <qmetatype>
+#include <qobject>
+
+// User includes
+#include "radiouiengineexport.h"
+#include "radio_global.h"
+// Constants
+const int KLastCallSignCharCode = 25;
+const uint KThreeLetterCallSignCount = 72;
+const uint KKxxxCallSignPiFirst = 0x1000;
+const uint KWxxxCallSignPiFirst = 0x54A8;
+const uint KWxxxCallSignPiLast = 0x994F;
+const uint KxxxCallSignPiFirst = 0x9950;
+const uint KxxxCallSignPiLast = 0x99B9;
+
+// Forward declarations
+class RadioStationPrivate;
+
+// Class declaration
+
+/*!
+ * RadioStation is a data container that holds all information of a radio station.
+ * It is implicitly shared to make it cheap to copy and pass around as a signal parameter.
+ * It uses the "shared null" idiom to initialize empty instances quickly and efficiently.
+ *
+ * Note! It is derived from QObject even though architecturally it shouldn't be.
+ * It is done only to satisfy the WINSCW build which doesn't export the destructor in UREL
+ * build. This causes mismatching def files and annoying warnings. Deriving from QObject fixes this
+ */
+class UI_ENGINE_DLL_EXPORT RadioStation : public QObject
+{
+ friend class RadioStationModel;
+ friend class RadioStationModelPrivate;
+ friend class TestRadioUiEngine;
+ friend class TestRadioPresetStorage;
+
+public:
+
+ /**
+ * Flags to indicate how the RadioStation has changed since last save or reset.
+ * Declared to use QFlags<> to ease flag usage and to enforce type safety
+ */
+ enum ChangeFlag
+ {
+ NoChange = 0
+ ,PersistentDataChanged = 1 << 0
+ ,NameChanged = 1 << 1
+ ,FavoriteChanged = 1 << 2
+ ,GenreChanged = 1 << 3
+ ,UrlChanged = 1 << 4
+ ,TypeChanged = 1 << 5
+ ,PiCodeChanged = 1 << 6
+ ,PsTypeChanged = 1 << 7
+ ,RadioTextChanged = 1 << 8
+ ,DynamicPsChanged = 1 << 9
+ };
+ Q_DECLARE_FLAGS( Change, ChangeFlag )
+
+ /**
+ * Flags ot indicate station type.
+ * Declared to use QFlags<> to ease flag usage and to enforce type safety
+ */
+ enum TypeFlag
+ {
+ Favorite = 1 << 0,
+ LocalStation = 1 << 1,
+ PreDefined = 1 << 2,
+ Temporary = 1 << 3
+ };
+ Q_DECLARE_FLAGS( Type, TypeFlag )
+
+ /**
+ * Flag to indiate whether or not station uses dynamic PS and if the check has been performed
+ * Declared to use QFlags<> to ease flag usage and to enforce type safety
+ */
+ enum PsTypeFlag
+ {
+ Unknown,
+ Dynamic,
+ Static
+ };
+ Q_DECLARE_FLAGS( PsType, PsTypeFlag )
+
+ /**
+ * Magical values used as preset indexes to signify certain conditions.
+ * NotFound means that a find function could not find a station
+ * Invalid means that the station instance has not been initialized
+ */
+ enum PresetFlag { NotFound = -1, Invalid = -100, SharedNull = -200 };
+
+ /**
+ * Static convenience function to parse a frequency
+ */
+ static QString parseFrequency( uint frequency );
+
+ RadioStation();
+ RadioStation( const RadioStation& other );
+
+ ~RadioStation();
+
+ RadioStation& operator=( const RadioStation& other );
+
+private:
+
+ explicit RadioStation( int presetIndex, uint frequency );
+
+ void reset();
+ void setChangeFlags( Change flags );
+
+ // Setters for persistent data
+ void setPresetIndex( int presetIndex );
+ void setFrequency( uint frequency );
+ void setName( const QString& name );
+ void setGenre( const int genre );
+ void setUrl( const QString& url );
+ bool setPiCode( int piCode, RadioRegion::Region region );
+
+ // Setters for non-persistent data
+ void setPsType( PsType psType );
+ void setRadioText( const QString& radioText );
+ void setRadioTextPlus( const int rtPlusClass, const QString& rtPlusItem );
+ void setDynamicPsText( const QString& dynamicPsText );
+
+public: // Getters and setters
+
+ // Setters & Getters for persistent data
+
+ bool isValid() const;
+
+ QString name() const;
+ void setUserDefinedName( const QString& name );
+ bool isRenamed() const;
+
+ int genre() const;
+
+ QString frequencyMhz() const;
+ uint frequency() const;
+ int presetIndex() const;
+
+ void setFavorite( bool favorite );
+ bool isFavorite() const;
+
+ QString url() const;
+
+ bool hasPiCode() const;
+ bool hasRds() const;
+
+ void setType( RadioStation::Type type );
+ void unsetType( RadioStation::Type type );
+ bool isType( RadioStation::Type type ) const;
+
+ // Getters for non-persistent data
+
+ PsType psType() const;
+ QString radioText() const;
+ QString dynamicPsText() const;
+ Change changeFlags() const;
+ bool hasDataChanged( Change flags ) const;
+ bool hasChanged() const;
+ void resetChangeFlags();
+
+private:
+
+ /**
+ * Decrements the reference count of the implicitly shared data.
+ * Data is deleted if no instance uses it anymore.
+ */
+ void decrementReferenceCount();
+
+ // Methods for converting PI code into call sign
+ QString piCodeToCallSign( uint programmeIdentification );
+ QString iterateCallSign( int piBase, int programmeIdentification );
+ QString callSignString( uint programmeIdentification );
+ char callSignChar( uint decimalValue );
+
+private: // data
+
+ /**
+ * Pointer to the implicitly shared private implementation
+ * Own.
+ */
+ class RadioStationPrivate* mData;
+
+public:
+
+ /**
+ * Detach from the implicitly shared data
+ */
+ void detach();
+
+ /**
+ * Checks if the class is detached from implicitly shared data
+ * Required by many QT convenience functions for implicitly shared classes
+ */
+ bool isDetached() const;
+
+ typedef RadioStationPrivate* DataPtr;
+ inline DataPtr &data_ptr() { return mData; }
+
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( RadioStation::Change )
+Q_DECLARE_OPERATORS_FOR_FLAGS( RadioStation::Type )
+
+Q_DECLARE_TYPEINFO( RadioStation, Q_MOVABLE_TYPE ); // Can be moved around in memory by containers if necessary
+Q_DECLARE_SHARED( RadioStation ) // Uses implicit sharing
+Q_DECLARE_METATYPE( RadioStation ) // To be usable in a QVariant
+
+#endif // RADIOSTATION_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radiostation_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATIONINFO_P_H_
+#define RADIOSTATIONINFO_P_H_
+
+// System includes
+#include <qtime>
+
+// User includes
+#include "radiostation.h"
+#include "radiostationif.h"
+
+// Class declaration
+class RadioStationPrivate : public RadioStationIf
+{
+public:
+
+ explicit RadioStationPrivate( int presetIndex = RadioStation::Invalid, uint frequency = 0 );
+ explicit RadioStationPrivate( RadioStation::PresetFlag flag );
+
+ virtual ~RadioStationPrivate();
+
+ void init( int presetIndex, uint frequency = 0 );
+
+private:
+
+// from base class RadioStationIf
+
+ int presetIndex() const;
+ void setPresetIndex( int presetIndex );
+ uint frequency() const;
+ void setFrequency( uint frequency );
+ QString name() const;
+ void setName( QString name );
+ bool isRenamedByUser() const;
+ void setRenamedByUser( bool renamed );
+ int genre() const;
+ void setGenre( int genre );
+ QString url() const;
+ void setUrl( QString url );
+ int piCode() const;
+ void setPiCode( int piCode );
+ bool isFavorite() const;
+ void setFavorite( bool favorite );
+ bool isLocalStation() const;
+ void setLocalStation( bool localStation );
+
+public: // data
+
+ /**
+ * Reference count used for implicit sharing.
+ * Has to be named "ref" instead having the 'm' prefix like all other member variables in Radio
+ * This is because convenience functions like qAtomicAssign() expect it to be named "ref"
+ */
+ QAtomicInt ref;
+
+ // ========================================================================
+ // Persistent data. Saved to Central repository
+ // ========================================================================
+
+ /**
+ * Station frequency. The most important bit of information about a radio station.
+ * Is checked to be non-null in the isValid() function
+ */
+ uint mFrequency;
+
+ /**
+ * Station index in the Preset Utility.
+ * Negative values signify an invalid RadioStation that has not and will not be saved.
+ * Initialized to -100 by default to indicate and invalid station.
+ */
+ int mPresetIndex;
+
+ /**
+ * Station name. Contains a name that is set in one of the following ways:
+ * 1) Received through RDS as the stations PS name and station does not use dynamic PS
+ * 2) Entered by the user. In this case the mRenamedByUser flag will be set and the name
+ * cannot be changed until the user removes the renaming.
+ * 3) Callsign calculated from the PI code can be set as the station name if the station
+ * does not send RDS information and the current region is America
+ */
+ QString mName;
+
+ /**
+ * Flag to indicate whether or not the user has renamed the station
+ */
+ bool mRenamedByUser;
+
+ /**
+ * Station genre received through RDS
+ */
+ int mGenre;
+
+ /**
+ * Station URL. Can be e.g. a web address to the radio stations homepage
+ */
+ QString mUrl;
+
+ /**
+ * Stations PI code. Only used in the America region to calculate the Callsign if station
+ * does not use RDS to broadcast PS name
+ */
+ int mPiCode;
+
+ /**
+ * Station type. Used by the application mainly to filter out certain stations depending
+ * on the users preference to see all locally audible stations or all favorite stations.
+ * Can have any combination of the following flags:
+ * - Favorite The station is a favorite of the user.
+ * - LocalStation The station was found in the last scan and should be audible in the current location
+ * - Temporary Special flag to mark one RadioStation instance that is used to store
+ * information of a manually tuned frequency that has not been saved by the user.
+ */
+ RadioStation::Type mType; // Station type, favorite or local station or neither
+
+ // ========================================================================
+ // Non-persistent data. Only kept in memory
+ // ========================================================================
+
+ /**
+ * Radio station PS name type. Some radio stations use the PS name broadcasting against the
+ * official RDS standard rules to broadcast advertisements. The ads are sent by changing the
+ * PS name in relatively rapid succession. The RDS standard specifies that a station should
+ * only use the PS name to broadcast a static station name.
+ * The FM Radio application attempts to determine if the station uses dynamic PS or not and
+ * stores the information here. Stations with a dynamic PS are treated differently in the UI and the
+ * name is never saved to Central Repository because it would only contain a part of an advertisement.
+ * Can have one of the following values:
+ * - Unknown Dynamic PS check has not been done so it is unknown if the station uses dynamic PS
+ * - Dynamic The check has been done and station has been found to use dynamic PS
+ * - Static The check has been done and the station has been found not to use dynamic PS
+ */
+ RadioStation::PsType mPsType;
+
+ /**
+ * Stores the Radio Text received through RDS. Can be either normal Radio Text or Radio Text Plus
+ * where the tags have been parsed. Parsed Radio Text Plus is stored in HTML form, the normal Radio Text
+ * is stored as plain text.
+ */
+ QString mRadioText;
+
+ /**
+ * Holder for the ads sent by using dynamic PS. Holds one part of the ad at a time.
+ */
+ QString mDynamicPsText;
+
+ /**
+ * Internal book keeping used to determine which member variables have been changed since last save
+ * or reset. Used to decide which signals should be sent by the RadioStationModel when the station is saved.
+ */
+ RadioStation::Change mChangeFlags;
+
+ /**
+ * Keeps track of station call sign calculation state
+ */
+ bool mCallSignCheckDone;
+
+ /**
+ * Time of the last PS name change. Used to check if the station changes its PS name too often.
+ * In bad RDS coverage a station using dynamic PS might be incorrectly determined to use static PS.
+ * This is a corrective effort to change that decision if the name changes too often.
+ */
+ QTime mLastPsNameChangeTime;
+
+};
+
+#endif // RADIOSTATIONINFO_P_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radiostationfiltermodel.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATIONFILTERMODEL_H_
+#define RADIOSTATIONFILTERMODEL_H_
+
+// System includes
+#include <qsortfilterproxymodel>
+#include <qmap>
+
+// User includes
+#include "radiouiengineexport.h"
+#include "radiostation.h"
+
+// Forward declarations
+class RadioUiEngine;
+
+class UI_ENGINE_DLL_EXPORT RadioStationFilterModel : public QSortFilterProxyModel
+{
+public:
+
+ RadioStationFilterModel( RadioUiEngine& uiEngine, QObject* parent = 0 );
+
+ ~RadioStationFilterModel();
+
+// from QAbstractItemModel
+
+ int rowCount( const QModelIndex& parent = QModelIndex() ) const;
+ QModelIndex index( int row, int column,
+ const QModelIndex &parent = QModelIndex() ) const;
+ QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
+
+// New functions
+
+ void setTypeFilter( RadioStation::Type filter );
+
+ /*!
+ * Returns the model index corresponding to the given frequency
+ */
+ QModelIndex modelIndexFromFrequency( uint frequency );
+
+ void setCyclic( bool cyclic );
+
+ bool hasLooped( const QModelIndex& index ) const;
+
+ QModelIndex realIndex( const QModelIndex& shadowIndex ) const;
+
+ bool isEqual( const QModelIndex& first, const QModelIndex& second ) const;
+
+private:
+
+// from base class QSortFilterProxyModel
+
+ bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const;
+
+private: // data
+
+ RadioUiEngine& mUiEngine;
+
+ RadioStation::Type mFilter;
+
+ bool mIsCyclic;
+
+ QMap<QModelIndex,QModelIndex> mShadowIndexes;
+
+};
+
+#endif // RADIOSTATIONFILTERMODEL_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radiostationmodel.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATIONMODEL_H_
+#define RADIOSTATIONMODEL_H_
+
+// System includes
+#include <qabstractlistmodel>
+#include <qmap>
+
+// User includes
+#include "radiouiengineexport.h"
+#include "radiostation.h"
+
+// Forward declarations
+class RadioStationModelPrivate;
+class RadioPresetStorage;
+class RadioStationHandlerIf;
+class RadioEngineWrapper;
+class RadioUiEngine;
+class RadioStation;
+class QIcon;
+
+// Constants
+typedef QMap<uint,RadioStation> Stations;
+
+// Class declaration
+class UI_ENGINE_DLL_EXPORT RadioStationModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE_D( d_ptr, RadioStationModel )
+ Q_DISABLE_COPY( RadioStationModel )
+
+public:
+
+ enum RadioRole
+ {
+ RadioStationRole = Qt::UserRole + 1,
+ ToggleFavoriteRole
+ };
+
+ enum DetailFlag
+ {
+ Minimal = 1 << 0,
+ ShowIcons = 1 << 1,
+ ShowGenre = 1 << 2
+ };
+ Q_DECLARE_FLAGS( Detail, DetailFlag )
+
+ explicit RadioStationModel( RadioUiEngine& uiEngine );
+
+ ~RadioStationModel();
+
+// from base class QAbstractListModel
+
+ Qt::ItemFlags flags ( const QModelIndex& index ) const;
+ int rowCount( const QModelIndex& parent = QModelIndex() ) const;
+ QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
+ bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole );
+
+// New functions
+
+ /*!
+ * Called by the wrapper to initialize the list with given amount of presets
+ */
+ void initialize( RadioPresetStorage* storage, RadioEngineWrapper* engine );
+
+ /*!
+ * Sets the icons to be used in the lists
+ */
+ void setIcons( const QIcon& favoriteIcon, const QIcon& nowPlayingIcon );
+
+ /*!
+ * Returns a reference to the station handler interface
+ */
+ RadioStationHandlerIf& stationHandlerIf();
+
+ /*!
+ * Returns a reference to the underlying QList so that it can be easily looped
+ */
+ const Stations& list() const;
+
+ /*!
+ * Returns the station at the given index.
+ * The station is returned by value, but it is cheap because it is implicitly shared
+ */
+ RadioStation stationAt( int index ) const;
+
+ /*!
+ * Functions to find stations by frequency
+ */
+ bool findFrequency( uint frequency, RadioStation& station );
+
+ /*!
+ * Functions to find stations by preset index
+ */
+ int findPresetIndex( int presetIndex );
+ int findPresetIndex( int presetIndex, RadioStation& station );
+
+ /*!
+ * Functions to remove stations
+ */
+ void removeByFrequency( uint frequency );
+ void removeByPresetIndex( int presetIndex );
+ void removeStation( const RadioStation& station );
+
+ /*!
+ * Functions to add and save stations
+ */
+ void addStation( const RadioStation& station );
+ void saveStation( RadioStation& station );
+
+ /*!
+ * Convenience functions to change common settings
+ */
+ void setFavoriteByFrequency( uint frequency, bool favorite );
+ void setFavoriteByPreset( int presetIndex, bool favorite );
+ void renameStation( int presetIndex, const QString& name );
+ void setFavorites( const QModelIndexList& favorites );
+
+ /*!
+ * Functions to init and access the currently tuned station
+ */
+ RadioStation& currentStation();
+ const RadioStation& currentStation() const;
+
+ /*!
+ * Sets the model detail level
+ */
+ void setDetail( Detail level );
+
+ /*!
+ * Returns a list of radio stations in the given frequency range
+ */
+ QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency );
+
+ /*!
+ * Returns the model index corresponding to the given frequency
+ */
+ QModelIndex modelIndexFromFrequency( uint frequency );
+
+signals:
+
+ void stationDataChanged( const RadioStation& station );
+ void radioTextReceived( const RadioStation& station );
+ void dynamicPsChanged( const RadioStation& station );
+ void favoriteChanged( const RadioStation& station );
+ void stationAdded( const RadioStation& station );
+
+public slots:
+
+ /**
+ * Removes all stations
+ */
+ void removeAll();
+
+private slots:
+
+ /*!
+ * Timer timeout slot to indicate that the dynamic PS check has ended
+ */
+ void dynamicPsCheckEnded();
+
+private:
+
+// New functions
+
+ /*!
+ * Checks the given station and emits signals based on what member variables had been changed
+ * since the last save or reset.
+ */
+ void emitChangeSignals( const RadioStation& station, RadioStation::Change flags );
+
+ void emitDataChanged( const RadioStation& station );
+
+ /*!
+ * Finds an unused preset index
+ */
+ int findUnusedPresetIndex();
+
+ /**
+ * Used by the RDS data setters to find the correct station where the data is set
+ * First tries the currentStation variable and if the frequency doesn't match, finds the right one
+ */
+ RadioStation findCurrentStation( uint frequency );
+
+private: // data
+
+ /**
+ * Unmodifiable pointer to the private implementation
+ */
+ RadioStationModelPrivate* const d_ptr;
+
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( RadioStationModel::Detail )
+
+#endif // RADIOSTATIONMODEL_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radiostationmodel_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATIONMODEL_P_H_
+#define RADIOSTATIONMODEL_P_H_
+
+// System includes
+#include <qlist>
+#include <qmap>
+#include <qscopedpointer>
+#include <qicon>
+
+// User includes
+//#include "radiostation.h"
+#include "radiostationhandlerif.h"
+
+// Forward declarations
+class RadioUiEngine;
+class RadioPresetStorage;
+class RadioEngineWrapper;
+class QTimer;
+
+// Class declaration
+class RadioStationModelPrivate : public RadioStationHandlerIf
+{
+ Q_DECLARE_PUBLIC( RadioStationModel )
+ Q_DISABLE_COPY( RadioStationModelPrivate )
+
+public:
+
+ explicit RadioStationModelPrivate( RadioStationModel* model, RadioUiEngine& uiEngine );
+
+ virtual ~RadioStationModelPrivate();
+
+private:
+
+// from base class RadioStationHandlerIf
+
+ uint currentFrequency() const;
+ int currentPresetIndex() const;
+ void setCurrentStation( uint frequency );
+ bool containsFrequency( uint frequency );
+ bool containsPresetIndex( int presetIndex );
+ void startDynamicPsCheck();
+ void addScannedFrequency( uint frequency );
+ void removeLocalStations();
+ void setCurrentPsName( uint frequency, const QString& name );
+ void setCurrentRadioText( uint frequency, const QString& radioText );
+ void setCurrentRadioTextPlus( uint frequency, int rtClass, const QString& rtItem );
+ void setCurrentPiCode( uint frequency, int piCode );
+ void setCurrentGenre( uint frequency, int genre );
+
+private: // data
+
+ /**
+ * Pointer to the public class
+ * Not own.
+ */
+ RadioStationModel* q_ptr;
+
+ /**
+ * Reference to the ui engine
+ */
+ RadioUiEngine& mUiEngine;
+
+ /**
+ * Pointer to the preset storage
+ */
+ RadioPresetStorage* mPresetStorage;
+
+ /**
+ * Pointer to the radio engine wrapper
+ */
+ RadioEngineWrapper* mEngine;
+
+ /**
+ * List of station items
+ */
+ Stations mStations;
+
+ /**
+ * Station used to store information of manually tuned frequencies
+ */
+ RadioStation mManualStation;
+
+ /**
+ * Pointer to the current station
+ * Not own.
+ */
+ RadioStation* mCurrentStation;
+
+ /**
+ * Dynamic PS timer
+ * Own.
+ */
+ QScopedPointer<QTimer> mDynamicPsTimer;
+
+ /**
+ * Level of detail shown in Qt::DisplayRole and Qt::DecorationRole roles
+ */
+ RadioStationModel::Detail mDetailLevel;
+
+ /**
+ * Pointer to favorite icon.
+ * Not own.
+ */
+ QIcon mFavoriteIcon;
+
+ /**
+ * Pointer to the now playing marker icon
+ * Not own.
+ */
+ QIcon mNowPlayingIcon;
+
+};
+
+#endif // RADIOSTATIONMODEL_P_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radiouiengine.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef RADIOUIENGINE_H_
+#define RADIOUIENGINE_H_
+
+// System includes
+#include <qobject>
+#include <qstring>
+//#include <qlist>
+
+// User includes
+#include "radiouiengineexport.h"
+#include "radio_global.h"
+
+// Forward declarations
+class RadioUiEnginePrivate;
+class RadioStationModel;
+class RadioSettings;
+class RadioStation;
+class RadioPlayLogModel;
+class RadioStationFilterModel;
+
+class UI_ENGINE_DLL_EXPORT RadioUiEngine : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE_D( d_ptr, RadioUiEngine )
+ Q_DISABLE_COPY( RadioUiEngine )
+
+public:
+
+ static bool isOfflineProfile();
+ static QString parseFrequency( uint frequency );
+ static QString nameOrFrequency( const RadioStation& station, uint frequency = 0 );
+
+ RadioUiEngine( QObject* parent = 0 );
+ ~RadioUiEngine();
+
+ bool startRadio();
+
+ bool isFirstTimeStart();
+
+ /**
+ * Getters for things owned by the engine
+ */
+ RadioSettings& settings();
+ RadioStationModel& model();
+ RadioPlayLogModel& playLogModel();
+ RadioStationFilterModel* createNewFilterModel( QObject* parent = 0 );
+
+ bool isRadioOn() const;
+ bool isScanning() const;
+ bool isMuted() const;
+ bool isAntennaAttached() const;
+ bool isUsingLoudspeaker() const;
+
+ RadioRegion::Region region() const;
+ uint currentFrequency() const;
+ uint minFrequency() const;
+ uint maxFrequency() const;
+ uint frequencyStepSize() const;
+
+ void scanFrequencyBand();
+ void cancelScanFrequencyBand();
+
+ QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency );
+
+ QString genreToString( int genre );
+
+ bool isSongRecognitionAppAvailable();
+
+ void addRecognizedSong( const QString& artist, const QString& title );
+
+signals:
+
+ void tunedToFrequency( uint frequency, int commandSender );
+ void seekingStarted( int direction );
+ void radioStatusChanged( bool radioIsOn );
+
+ void rdsAvailabilityChanged( bool available );
+
+ void volumeChanged( int volume );
+ void muteChanged( bool muted );
+
+ void audioRouteChanged( bool loudspeaker );
+ void scanAndSaveFinished();
+ void headsetStatusChanged( bool connected );
+
+public slots:
+
+ /**
+ * Slots to tune to given frequency or preset
+ */
+ void tuneFrequency( uint frequency, const int sender = CommandSender::Unspecified );
+ void tuneWithDelay( uint frequency, const int sender = CommandSender::Unspecified );
+ void tunePreset( int presetIndex );
+
+ /*!
+ * volume update command slot for the engine
+ */
+ void setVolume( int volume );
+ void toggleMute();
+ void toggleAudioRoute();
+
+ void skipPrevious();
+ void skipNext();
+
+ void seekUp();
+ void seekDown();
+
+ void launchSongRecognition();
+
+private:
+
+ /**
+ * functions used only by the private class to get signals emitted
+ */
+ void emitTunedToFrequency( uint frequency, int commandSender );
+ void emitSeekingStarted( Seeking::Direction direction );
+ void emitRadioStatusChanged( bool radioIsOn );
+ void emitRdsAvailabilityChanged( bool available );
+ void emitVolumeChanged( int volume );
+ void emitMuteChanged( bool muted );
+ void emitAudioRouteChanged( bool loudspeaker );
+ void emitScanAndSaveFinished();
+ void emitheadsetStatusChanged( bool connected );
+
+private: // data
+
+ /**
+ * Unmodifiable pointer to the private implementation
+ */
+ RadioUiEnginePrivate* const d_ptr;
+
+};
+
+
+#endif // RADIOUIENGINE_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radiouiengine_p.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOUIENGINE_P_H_
+#define RADIOUIENGINE_P_H_
+
+// System includes
+#include <qscopedpointer>
+
+#include "radioenginewrapperobserver.h"
+
+// Forward declarations
+class RadioUiEngine;
+class RadioEngineWrapper;
+class RadioStationModel;
+class RadioPlayLogModel;
+class RadioPresetStorage;
+
+class RadioUiEnginePrivate : public RadioEngineWrapperObserver
+{
+ Q_DECLARE_PUBLIC( RadioUiEngine )
+ Q_DISABLE_COPY( RadioUiEnginePrivate )
+
+public:
+
+ enum TuneDirection{ Next, Previous };
+
+ RadioUiEnginePrivate( RadioUiEngine* engine );
+ ~RadioUiEnginePrivate();
+
+ bool startRadio();
+
+private:
+
+// from base class RadioEngineWrapperObserver
+
+ void tunedToFrequency( uint frequency, int commandSender );
+ void seekingStarted( Seeking::Direction direction );
+ void radioStatusChanged( bool radioIsOn );
+ void rdsAvailabilityChanged( bool available );
+ void volumeChanged( int volume );
+ void muteChanged( bool muted );
+ void audioRouteChanged( bool loudspeaker );
+ void scanAndSaveFinished();
+ void headsetStatusChanged( bool connected );
+ void skipPrevious();
+ void skipNext();
+
+// New functions
+
+ /*!
+ * Tunes to next or previous favorite preset
+ */
+ void skip( TuneDirection direction );
+
+private: // data
+
+ /**
+ * Pointer to the public class
+ * Not own.
+ */
+ RadioUiEngine* q_ptr;
+
+ QScopedPointer<RadioEngineWrapper> mEngineWrapper;
+
+ QScopedPointer<RadioPresetStorage> mPresetStorage;
+
+ RadioStationModel* mStationModel;
+
+ RadioPlayLogModel* mPlayLogModel;
+
+};
+
+#endif // RADIOUIENGINE_P_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/inc/radiouiengineexport.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIO_UI_ENGINE_EXPORT_H_
+#define RADIO_UI_ENGINE_EXPORT_H_
+
+// System includes
+#include <qglobal.h>
+
+#ifdef BUILD_UI_ENGINE_DLL
+ #define UI_ENGINE_DLL_EXPORT Q_DECL_EXPORT
+#else
+ #define UI_ENGINE_DLL_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // RADIO_UI_ENGINE_EXPORT_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/radiouiengine.pro Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,82 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+include(../buildflags.pri)
+
+TEMPLATE = lib
+TARGET = radiouiengine
+CONFIG += dll
+DEFINES += BUILD_UI_ENGINE_DLL
+win32:DESTDIR = ../bin
+
+# Wrapper does not depend on QtGui or Orbit
+QT = core gui
+CONFIG -= hb
+
+symbian: {
+ DEFINES += SYMBIAN
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+}
+
+INCLUDEPATH += inc
+INCLUDEPATH += ../radiopresetstorage/inc
+INCLUDEPATH += ../radioenginewrapper/inc
+INCLUDEPATH += ../radioenginewrapper/commoninc
+
+win32:LIBS += -L../bin
+
+LIBS += -lradiopresetstorage
+LIBS += -lradioenginewrapper
+
+USE_MOBILE_EXTENSIONS_API {
+ symbian:LIBS += -lxqprofile
+}
+
+DEPENDPATH += $$INCLUDEPATH src
+
+# $$_PRO_FILE_PWD_ points to the directory of the pro file
+MOC_DIR = $$_PRO_FILE_PWD_/tmp
+
+# Input
+HEADERS += radiostation.h
+HEADERS += radiostationmodel.h
+HEADERS += radiostationfiltermodel.h
+HEADERS += radiouiengine.h
+HEADERS += radioplaylogitem.h
+HEADERS += radioplaylogmodel.h
+HEADERS += radiolocalization.h
+HEADERS += radiouiengineexport.h
+
+INTERNAL_HEADERS += radiostation_p.h
+INTERNAL_HEADERS += radioplaylogitem_p.h
+INTERNAL_HEADERS += radioplaylogmodel_p.h
+INTERNAL_HEADERS += radiouiengine_p.h
+INTERNAL_HEADERS += radiostationmodel_p.h
+
+win32:HEADERS += $$INTERNAL_HEADERS
+
+SOURCES += radiostation.cpp
+SOURCES += radiostation_p.cpp
+SOURCES += radiostationmodel.cpp
+SOURCES += radiostationmodel_p.cpp
+SOURCES += radiostationfiltermodel.cpp
+SOURCES += radiouiengine.cpp
+SOURCES += radiouiengine_p.cpp
+SOURCES += radioplaylogitem.cpp
+SOURCES += radioplaylogitem_p.cpp
+SOURCES += radioplaylogmodel.cpp
+SOURCES += radioplaylogmodel_p.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radioplaylogitem.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// User includes
+#include "radioplaylogitem.h"
+#include "radioplaylogitem_p.h"
+
+/**
+ * Static shared data instance that is used by all default-constructed RadioStation instances
+ */
+Q_GLOBAL_STATIC( RadioPlayLogItemPrivate, shared_null )
+
+
+/*!
+ *
+ */
+RadioPlayLogItem::RadioPlayLogItem() :
+ QObject( 0 )
+{
+ mData = shared_null();
+ mData->ref.ref();
+}
+
+/*!
+ *
+ */
+RadioPlayLogItem::RadioPlayLogItem( const QString& artist, const QString& title ) :
+ QObject( 0 )
+{
+ mData = new RadioPlayLogItemPrivate( artist, title );
+}
+
+/*!
+ *
+ */
+RadioPlayLogItem::RadioPlayLogItem( const RadioPlayLogItem& other ) :
+ QObject( 0 )
+{
+ mData = other.mData;
+ mData->ref.ref();
+}
+
+/*!
+ *
+ */
+RadioPlayLogItem::~RadioPlayLogItem()
+{
+ decrementReferenceCount();
+}
+
+/*!
+ *
+ */
+RadioPlayLogItem& RadioPlayLogItem::operator=( const RadioPlayLogItem& other )
+{
+ qAtomicAssign( mData, other.mData );
+ return *this;
+}
+
+/*!
+ *
+ */
+QString RadioPlayLogItem::artist() const
+{
+ return mData->mArtist;
+}
+
+/*!
+ *
+ */
+void RadioPlayLogItem::setArtist( const QString& artist )
+{
+ if ( artist.compare( mData->mArtist ) != 0 ) {
+ detach();
+ mData->mArtist = artist;
+ }
+}
+
+/*!
+ *
+ */
+QString RadioPlayLogItem::title() const
+{
+ return mData->mTitle;
+}
+
+/*!
+ *
+ */
+void RadioPlayLogItem::setTitle( const QString& title )
+{
+ if ( title.compare( mData->mTitle ) != 0 ) {
+ detach();
+ mData->mTitle = title;
+ }
+}
+
+/*!
+ *
+ */
+bool RadioPlayLogItem::isFavorite() const
+{
+ return mData->mFavorite;
+}
+
+/*!
+ *
+ */
+void RadioPlayLogItem::setFavorite()
+{
+ if ( !mData->mFavorite ) {
+ detach();
+ mData->mFavorite = true;
+ }
+}
+
+/*!
+ *
+ */
+void RadioPlayLogItem::increasePlayCount()
+{
+ detach();
+ ++mData->mPlayCount;
+}
+
+/*!
+ *
+ */
+int RadioPlayLogItem::playCount() const
+{
+ return mData->mPlayCount;
+}
+
+/**
+ * Decrements the reference count of the implicitly shared data.
+ */
+void RadioPlayLogItem::decrementReferenceCount()
+{
+ if ( !mData->ref.deref() ) {
+ delete mData;
+ mData = 0;
+ }
+}
+
+/**
+ * Detach from the implicitly shared data
+ */
+void RadioPlayLogItem::detach()
+{
+ if ( !isDetached() ) {
+ RadioPlayLogItemPrivate* newData = new RadioPlayLogItemPrivate( *mData );
+
+ decrementReferenceCount();
+
+ newData->ref = 1;
+ mData = newData;
+ }
+}
+
+/**
+ * Checks if the class is detached from implicitly shared data
+ */
+bool RadioPlayLogItem::isDetached() const
+{
+ return mData->ref == 1;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radioplaylogitem_p.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "radioplaylogitem.h"
+#include "radioplaylogitem_p.h"
+
+/*!
+ *
+ */
+RadioPlayLogItemPrivate::RadioPlayLogItemPrivate()
+{
+ init( "", "" );
+}
+
+/*!
+ *
+ */
+RadioPlayLogItemPrivate::RadioPlayLogItemPrivate( const QString& artist,
+ const QString& title )
+{
+ init( artist, title );
+}
+
+/*!
+ *
+ */
+void RadioPlayLogItemPrivate::init( const QString& artist, const QString& title )
+{
+ ref = 1;
+ mArtist = artist;
+ mTitle = title;
+ mFavorite = false;
+ mPlayCount = 1;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radioplaylogmodel.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qstringlist>
+
+// User includes
+#include "radioplaylogmodel.h"
+#include "radioplaylogmodel_p.h"
+#include "radiouiengine.h"
+#include "radioplaylogitem.h"
+#include "radio_global.h"
+#include "radiologger.h"
+
+/*!
+ *
+ */
+RadioPlayLogModel::RadioPlayLogModel( RadioUiEngine& uiEngine ) :
+ QAbstractListModel( &uiEngine ),
+ d_ptr( new RadioPlayLogModelPrivate( this, uiEngine ) )
+{
+ connectAndTest( &uiEngine, SIGNAL(tunedToFrequency(uint,int)),
+ this, SLOT(resetCurrentSong()) );
+ connectAndTest( &uiEngine, SIGNAL(seekingStarted(int)),
+ this, SLOT(resetCurrentSong()) );
+}
+
+/*!
+ *
+ */
+RadioPlayLogModel::~RadioPlayLogModel()
+{
+ Q_D( RadioPlayLogModel );
+ d->mItems.clear();
+}
+
+/*!
+ * \reimp
+ */
+Qt::ItemFlags RadioPlayLogModel::flags ( const QModelIndex& index ) const
+{
+ Qt::ItemFlags flags = QAbstractListModel::flags( index );
+ flags |= Qt::ItemIsEditable;
+ return flags;
+}
+
+/*!
+ * \reimp
+ */
+int RadioPlayLogModel::rowCount( const QModelIndex& parent ) const
+{
+ Q_UNUSED( parent );
+ Q_D( const RadioPlayLogModel );
+ return d->mItems.count();
+}
+
+/*!
+ * \reimp
+ */
+QVariant RadioPlayLogModel::data( const QModelIndex& index, int role ) const
+{
+ if ( !index.isValid() ) {
+ return QVariant();
+ }
+
+ Q_D( const RadioPlayLogModel );
+ if ( role == Qt::DisplayRole ) {
+ RadioPlayLogItem item = d->mItems.at( index.row() );
+
+ QStringList list;
+ list.append( item.artist() + " - " + item.title() );
+ QString secondLine = QString( "Count: %1. Favorite: %2" ).arg( item.playCount() ).arg( item.isFavorite() );
+ list.append( secondLine );
+
+ return list;
+ }
+
+ return QVariant();
+}
+
+/*!
+ * \reimp
+ */
+bool RadioPlayLogModel::setData( const QModelIndex& index, const QVariant& value, int role )
+{
+ Q_UNUSED( value );
+ if ( !index.isValid() ) {
+ return false;
+ }
+
+ if ( role == RadioPlayLogModel::SetFavoriteRole ) {
+ Q_D( RadioPlayLogModel );
+ RadioPlayLogItem item = d->mItems.at( index.row() );
+ item.setFavorite();
+ updateItem( index.row(), item );
+ return true;
+ }
+
+ return false;
+}
+
+/*!
+ * Public slot
+ */
+void RadioPlayLogModel::resetCurrentSong()
+{
+ Q_D( RadioPlayLogModel );
+ d->mTopItemIsPlaying = false;
+ emit currentSongReset();
+}
+
+/*!
+ * Public slot
+ */
+void RadioPlayLogModel::setFavorite()
+{
+ Q_D( RadioPlayLogModel );
+ RadioPlayLogItem item = d->mItems.first();
+ item.setFavorite();
+ updateItem( 0, item );
+}
+
+/*!
+ * Public slot
+ */
+void RadioPlayLogModel::removeAll()
+{
+ Q_D( RadioPlayLogModel );
+
+ beginRemoveRows( QModelIndex(), 0, rowCount() - 1 );
+
+ d->mItems.clear();
+
+ endRemoveRows();
+}
+
+/*!
+ *
+ */
+bool RadioPlayLogModel::isCurrentSongRecognized() const
+{
+ Q_D( const RadioPlayLogModel );
+ return d->mTopItemIsPlaying;
+}
+
+/*!
+ *
+ */
+void RadioPlayLogModel::addItem( const QString& artist, const QString& title )
+{
+ Q_D( RadioPlayLogModel );
+
+ RadioPlayLogItem item;
+ const int itemIndex = findItem( artist, title, item );
+ if ( itemIndex != -1 ) {
+ item.increasePlayCount();
+ updateItem( itemIndex, item, true );
+ } else {
+ item.setArtist( artist );
+ item.setTitle( title );
+
+ beginInsertRows( QModelIndex(), 0, 0 );
+
+ d->mItems.prepend( item );
+
+ endInsertRows();
+ }
+
+ d->mTopItemIsPlaying = true;
+ emit itemAdded();
+}
+
+/*!
+ *
+ */
+void RadioPlayLogModel::clearRadioTextPlus()
+{
+ Q_D( RadioPlayLogModel );
+ d->mRtItemHolder = "";
+ resetCurrentSong();
+}
+
+/*!
+ *
+ */
+void RadioPlayLogModel::addRadioTextPlus( int rtClass, const QString& rtItem )
+{
+ if ( rtClass == RtPlus::Artist || rtClass == RtPlus::Title ) {
+ Q_D( RadioPlayLogModel );
+ if ( d->mRtItemHolder.isEmpty() ) {
+ d->mRtItemHolder = rtItem;
+ } else {
+ if ( rtClass == RtPlus::Title ) {
+ addItem( d->mRtItemHolder, rtItem );
+ } else {
+ addItem( rtItem, d->mRtItemHolder );
+ }
+ d->mRtItemHolder = "";
+ }
+ }
+}
+
+/*!
+ *
+ */
+int RadioPlayLogModel::findItem( const QString& artist, const QString& title, RadioPlayLogItem& item )
+{
+ Q_D( RadioPlayLogModel );
+ const int itemCount = d->mItems.count();
+ for ( int i = 0; i < itemCount; ++i ) {
+ RadioPlayLogItem existingItem = d->mItems.at( i );
+ if ( existingItem.artist().compare( artist ) == 0
+ && existingItem.title().compare( title ) == 0 ) {
+ item = existingItem;
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+/*!
+ *
+ */
+void RadioPlayLogModel::updateItem( int index, const RadioPlayLogItem& item, bool prepend )
+{
+ Q_D( RadioPlayLogModel );
+ d->mItems.removeAt( index );
+
+ if ( prepend ) {
+ d->mItems.prepend( item );
+ } else {
+ d->mItems.insert( index, item );
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radioplaylogmodel_p.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "radioplaylogmodel_p.h"
+#include "radioplaylogitem.h"
+
+/*!
+ *
+ */
+RadioPlayLogModelPrivate::RadioPlayLogModelPrivate( RadioPlayLogModel* model,
+ RadioUiEngine& uiEngine ) :
+ q_ptr( model ),
+ mUiEngine( uiEngine ),
+ mTopItemIsPlaying( false )
+{
+
+}
+
+/*!
+ *
+ */
+RadioPlayLogModelPrivate::~RadioPlayLogModelPrivate()
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radiostation.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,697 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qtime>
+
+// User includes
+#include "radiostation.h"
+#include "radiostation_p.h"
+#include "radiologger.h"
+#include "radio_global.h"
+
+// Constants
+const QString KTagArtist = "artist";
+const QString KTagTitle = "title";
+const QString KLinkArtist = "<a href=\"" + KTagArtist + "\">";
+const QString KLinkTitle = "<a href=\"" + KTagTitle + "\">";
+const QString KLinkClose = "</a>";
+
+const char* callSign[KThreeLetterCallSignCount] =
+ {"KBW", "KCY", "KDB", "KDF", "KEX", "KFH","KFI","KGA","KGB",
+ "KGO", "KGU", "KGW", "KGY", "KHQ", "KID", "KIT", "KJR", "KLO",
+ "KLZ", "KMA", "KMJ", "KNX", "KOA", "KOB", "KOY", "KPQ", "KQV",
+ "KSD", "KSL", "KUJ", "KUT", "KVI", "KWG", "KXL", "KXO", "KYW",
+ "WBT", "WBZ", "WDZ", "WEW", "WGH", "WGL", "WGN", "WGR", "WGY",
+ "WHA", "WHB", "WHK", "WHO", "WHP", "WIL", "WIP", "WIS", "WJR",
+ "WJW", "WJZ", "WKY", "WLS", "WLW", "WMC", "WMT", "WOC", "WOI",
+ "WOL", "WOR", "WOW", "WRC", "WRR", "WSB", "WSM", "WWJ", "WWL"};
+
+const uint piCode[KThreeLetterCallSignCount] =
+ {0x99A5, 0x99A6, 0x9990, 0x99A7, 0x9950, 0x9951, 0x9952, 0x9953,
+ 0x9991, 0x9954, 0x9955, 0x9956, 0x9957, 0x99AA, 0x9958, 0x9959,
+ 0x995A, 0x995B, 0x995C, 0x995D, 0x995E, 0x995F, 0x9960, 0x99AB,
+ 0x9992, 0x9993, 0x9964, 0x9994, 0x9965, 0x9966, 0x9995, 0x9967,
+ 0x9968, 0x9996, 0x9997, 0x996B, 0x9999, 0x996D, 0x996E, 0x996F,
+ 0x999A, 0x9971, 0x9972, 0x9973, 0x999B, 0x9975, 0x9976, 0x9977,
+ 0x9978, 0x999C, 0x999D, 0x997A, 0x99B3, 0x997B, 0x99B4, 0x99B5,
+ 0x997C, 0x997D, 0x997E, 0x999E, 0x999F, 0x9981, 0x99A0, 0x9983,
+ 0x9984, 0x99A1, 0x99B9, 0x99A2, 0x99A3, 0x99A4, 0x9988, 0x9989};
+
+const uint KDisableLocalAreaCoverageMask = 0x0800;
+
+const int KPsNameChangeThresholdSeconds = 10;
+
+/**
+ * Static shared data instance that is used by all default-constructed RadioStation instances
+ */
+Q_GLOBAL_STATIC_WITH_ARGS( RadioStationPrivate, shared_null, ( RadioStation::SharedNull ) )
+
+/*!
+ *
+ */
+QString RadioStation::parseFrequency( uint frequency )
+{
+ QString freqString;
+ freqString.sprintf( "%.2f", qreal( frequency ) / KFrequencyMultiplier );
+ return freqString;
+}
+
+/*!
+ *
+ */
+RadioStation::RadioStation() :
+ QObject( 0 )
+{
+ mData = shared_null();
+ mData->ref.ref();
+}
+
+/*!
+ *
+ */
+RadioStation::RadioStation( const RadioStation& other ) :
+ QObject( 0 )
+{
+ mData = other.mData;
+ mData->ref.ref();
+}
+
+/*!
+ *
+ */
+RadioStation::RadioStation( int presetIndex, uint frequency ) :
+ QObject( 0 )
+{
+ mData = new RadioStationPrivate( presetIndex, frequency );
+}
+
+/*!
+ *
+ */
+RadioStation::~RadioStation()
+{
+ decrementReferenceCount();
+}
+
+/*!
+ *
+ */
+RadioStation& RadioStation::operator=( const RadioStation& other )
+{
+ qAtomicAssign( mData, other.mData );
+ return *this;
+}
+
+/*!
+ *
+ */
+void RadioStation::reset()
+{
+ decrementReferenceCount();
+ mData = shared_null();
+ mData->ref.ref();
+}
+
+/*!
+ *
+ */
+void RadioStation::setChangeFlags( RadioStation::Change flags )
+{
+ if ( mData->mChangeFlags != flags ) {
+ detach();
+ mData->mChangeFlags = flags;
+ }
+}
+
+/*!
+ *
+ */
+void RadioStation::setPresetIndex( int presetIndex )
+{
+ if ( mData->mPresetIndex != presetIndex ) {
+ detach();
+ mData->mPresetIndex = presetIndex;
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged;
+ }
+}
+
+/*!
+ *
+ */
+void RadioStation::setFrequency( uint frequency )
+{
+ if ( mData->mFrequency != frequency ) {
+ detach();
+ mData->mFrequency = frequency;
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged;
+ }
+}
+
+/*!
+ * Sets the preset name
+ */
+void RadioStation::setName( const QString& name )
+{
+ // Name emptiness is checked because this name setter is used by incoming RDS PS name
+ // and empty names should be ignored
+ if ( !name.isEmpty() && mData->mName.compare( name ) != 0 ) {
+ detach();
+ mData->mName = name.trimmed();
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::NameChanged;
+
+ // Save the time when PS name changed and if the last change was too close to the current time
+ // change the PS type to dynamic if it has already been incorrectly determined to be static.
+ QTime previousChange = mData->mLastPsNameChangeTime;
+ mData->mLastPsNameChangeTime = QTime::currentTime();
+ if ( previousChange.isValid() && mData->mPsType == RadioStation::Static &&
+ previousChange.secsTo( mData->mLastPsNameChangeTime ) < KPsNameChangeThresholdSeconds ) {
+ LOG( "Station changed PS name too often. PS type changed to Dynamic" );
+ mData->mPsType = RadioStation::Dynamic;
+ mData->mDynamicPsText = mData->mName;
+ mData->mName = "";
+ mData->mChangeFlags |= RadioStation::PsTypeChanged | RadioStation::DynamicPsChanged;
+ mData->mCallSignCheckDone = false;
+ }
+
+ //TODO: This is a temporary thing to see some URL. Remove this
+ if ( !mData->mName.isEmpty() ) {
+ mData->mUrl = "<a href=\"buu\">www." + mData->mName.toLower() + ".fi</a>";
+ } else {
+ mData->mUrl = "";
+ }
+ mData->mChangeFlags |= RadioStation::UrlChanged;
+ }
+}
+
+/*!
+ *
+ */
+void RadioStation::setGenre( const int genre )
+{
+ if ( mData->mGenre != genre ) {
+ detach();
+ mData->mGenre = genre;
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::GenreChanged;
+ }
+}
+
+/*!
+ *
+ */
+void RadioStation::setUrl( const QString& url )
+{
+ if ( mData->mUrl.compare( url ) != 0 ) {
+ detach();
+ mData->mUrl = url;
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::UrlChanged;
+ }
+}
+
+/*!
+ * Sets the PI code
+ * @return true if code was changed, false if not
+ */
+bool RadioStation::setPiCode( int piCode, RadioRegion::Region region )
+{
+ LOG_FORMAT( "RadioStation::setPiCode new PI: %d", piCode );
+ // toggling local area coverage bit code must not be interpreted as new PI code
+ if( region != RadioRegion::America )
+ {
+ piCode &= ~KDisableLocalAreaCoverageMask;
+ }
+
+ LOG_FORMAT( "stored PI: %d", mData->mPiCode );
+ LOG_FORMAT( "call sign check done: %d", mData->mCallSignCheckDone );
+ //prevent executing the below code when unnessesary
+ if ( mData->mPiCode != piCode || !mData->mCallSignCheckDone )
+ {
+ detach();
+ mData->mPiCode = piCode;
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::PiCodeChanged;
+ // call sign not calculated for clear channel stations
+ //TODO: Remove magic numbers
+ if( ( (mData->mPiCode & 0xF000 ) >> 12 ) == 0x1 )
+ {
+ LOG( "Clear channel station" );
+ mData->mCallSignCheckDone = true;
+ }
+ // if America region, not PS name received and not user renamed station
+ else if ( region == RadioRegion::America && mData->mName.isEmpty() && !isRenamed() )
+ {
+ LOG( "Calculate call sign" );
+ mData->mName = piCodeToCallSign( mData->mPiCode );
+ mData->mChangeFlags |= RadioStation::NameChanged;
+ }
+
+ if ( mData->mChangeFlags.testFlag( RadioStation::PsTypeChanged ) )
+ {
+ LOG( "Call sign check done" );
+ mData->mCallSignCheckDone = true;
+ }
+
+ return true;
+ }
+ return false;
+}
+
+/*!
+ *
+ */
+void RadioStation::setPsType( PsType psType )
+{
+ if ( mData->mPsType != psType ) {
+ detach();
+ mData->mPsType = psType;
+ mData->mChangeFlags |= RadioStation::PsTypeChanged;
+ }
+}
+
+/*!
+ *
+ */
+void RadioStation::setRadioText( const QString& radioText )
+{
+ if ( mData->mRadioText.compare( radioText ) != 0 ) {
+ detach();
+ mData->mRadioText = radioText.isEmpty() ? "" : radioText.trimmed();
+ mData->mChangeFlags |= RadioStation::RadioTextChanged;
+ }
+}
+
+/*!
+ *
+ */
+void RadioStation::setRadioTextPlus( const int rtPlusClass, const QString& rtPlusItem )
+{
+ if ( !mData->mRadioText.isEmpty() &&
+ !rtPlusItem.isEmpty() &&
+ ( rtPlusClass == RtPlus::Artist || rtPlusClass == RtPlus::Title || rtPlusClass == RtPlus::Homepage) )
+ {
+ // Url is saved to its own variable and it is not highlighted from the radiotext
+ if ( rtPlusClass == RtPlus::Homepage ) {
+ setUrl( rtPlusItem );
+ return;
+ }
+
+ detach();
+ QString replacement = "";
+ if ( rtPlusClass == RtPlus::Artist ) {
+ replacement = KLinkArtist;
+ } else if ( rtPlusClass == RtPlus::Title ) {
+ replacement = KLinkTitle;
+ }
+ replacement += rtPlusItem + KLinkClose;
+
+ mData->mRadioText.replace( rtPlusItem, replacement );
+ mData->mChangeFlags |= RadioStation::RadioTextChanged;
+ }
+}
+
+/*!
+ *
+ */
+void RadioStation::setDynamicPsText( const QString& dynamicPsText )
+{
+ if ( mData->mDynamicPsText.compare( dynamicPsText ) != 0 ) {
+ detach();
+ mData->mDynamicPsText = dynamicPsText;
+ mData->mChangeFlags |= RadioStation::DynamicPsChanged;
+ }
+}
+
+/*!
+ *
+ */
+bool RadioStation::isValid() const
+{
+ return mData->mPresetIndex >= 0 && mData->mFrequency > 0;
+}
+
+/*!
+ *
+ */
+QString RadioStation::name() const
+{
+ return mData->mName;
+}
+
+/*!
+ *
+ */
+void RadioStation::setUserDefinedName( const QString& name )
+{
+ // We don't check for name emptiness because this setter is used also to remove the renaming
+ // of a station by setting an empty name
+ if ( mData->mName.compare( name ) != 0 ) {
+ detach();
+ mData->mName = name;
+ mData->mRenamedByUser = !name.isEmpty();
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::NameChanged;
+ }
+}
+
+/*!
+ *
+ */
+bool RadioStation::isRenamed() const
+{
+ return mData->mRenamedByUser;
+}
+
+/*!
+ *
+ */
+int RadioStation::genre() const
+{
+ return mData->mGenre;
+}
+
+/*!
+ *
+ */
+QString RadioStation::frequencyMhz() const
+{
+ return parseFrequency( mData->mFrequency );
+}
+
+/*!
+ *
+ */
+uint RadioStation::frequency() const
+{
+ return mData->mFrequency;
+}
+
+/*!
+ *
+ */
+int RadioStation::presetIndex() const
+{
+ return mData->mPresetIndex;
+}
+
+/*!
+ *
+ */
+void RadioStation::setFavorite( bool favorite )
+{
+ if ( isFavorite() != favorite ) {
+ detach();
+ favorite ? setType( RadioStation::Favorite ) : unsetType( RadioStation::Favorite );
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::FavoriteChanged;
+ }
+}
+
+/*!
+ *
+ */
+bool RadioStation::isFavorite() const
+{
+ return mData->mType.testFlag( RadioStation::Favorite );
+}
+
+/*!
+ *
+ */
+QString RadioStation::url() const
+{
+ return mData->mUrl;
+}
+
+/*!
+ *
+ */
+bool RadioStation::hasPiCode() const
+{
+ return mData->mPiCode != -1;
+}
+
+/*!
+ *
+ */
+bool RadioStation::hasRds() const
+{
+ return hasPiCode() ||
+ mData->mGenre != -1 ||
+ !mData->mDynamicPsText.isEmpty() ||
+ !mData->mRadioText.isEmpty() ||
+ ( !mData->mName.isEmpty() && !isRenamed() );
+}
+
+/*!
+ *
+ */
+void RadioStation::setType( RadioStation::Type type )
+{
+ if ( !isType( type ) ) {
+ detach();
+
+ // Check if favorite-status changed
+ if ( mData->mType.testFlag( RadioStation::Favorite ) != type.testFlag( RadioStation::Favorite ) ) {
+ mData->mChangeFlags |= RadioStation::FavoriteChanged;
+ }
+
+ mData->mType |= type;
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::TypeChanged;
+ }
+}
+
+/*!
+ *
+ */
+void RadioStation::unsetType( RadioStation::Type type )
+{
+ if ( isType( type ) ) {
+ detach();
+
+ // Check if favorite-status changed
+ if ( mData->mType.testFlag( RadioStation::Favorite ) != type.testFlag( RadioStation::Favorite ) ) {
+ mData->mChangeFlags |= RadioStation::FavoriteChanged;
+ }
+
+ mData->mType &= ~type;
+ mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::TypeChanged;
+ }
+}
+
+/*!
+ *
+ */
+bool RadioStation::isType( RadioStation::Type type ) const
+{
+ return ( mData->mType & type ) == type;
+}
+
+/*!
+ *
+ */
+RadioStation::PsType RadioStation::psType() const
+{
+ return mData->mPsType;
+}
+
+/*!
+ *
+ */
+QString RadioStation::radioText() const
+{
+ return mData->mRadioText;
+}
+
+/*!
+ *
+ */
+QString RadioStation::dynamicPsText() const
+{
+ return mData->mDynamicPsText;
+}
+
+/*!
+ *
+ */
+RadioStation::Change RadioStation::changeFlags() const
+{
+ return mData->mChangeFlags;
+}
+
+/*!
+ *
+ */
+bool RadioStation::hasDataChanged( RadioStation::Change flags ) const
+{
+ return ( mData->mChangeFlags & flags ) == flags;
+}
+
+/*!
+ *
+ */
+bool RadioStation::hasChanged() const
+{
+ return mData->mChangeFlags != RadioStation::NoChange;
+}
+
+/*!
+ *
+ */
+void RadioStation::resetChangeFlags()
+{
+ if ( mData->mChangeFlags != RadioStation::NoChange ) {
+ detach();
+ mData->mChangeFlags = RadioStation::NoChange;
+ }
+}
+
+/**
+ * Decrements the reference count of the implicitly shared data.
+ */
+void RadioStation::decrementReferenceCount()
+{
+ if ( !mData->ref.deref() ) {
+ delete mData;
+ mData = 0;
+ }
+}
+
+/*!
+ *
+ */
+ QString RadioStation::piCodeToCallSign( uint programmeIdentification )
+ {
+ QString callSign;
+
+ LOG_FORMAT( "RadioStation::piCodeToCallSign PI: %d", programmeIdentification );
+ // call signs beginning with 'K'
+ if( ( programmeIdentification>=KKxxxCallSignPiFirst ) && ( programmeIdentification < KWxxxCallSignPiFirst ) ) {
+ callSign += "K";
+ callSign += iterateCallSign( KKxxxCallSignPiFirst, programmeIdentification );
+ }
+ // call signs beginning with 'W'
+ else if (( programmeIdentification >= KWxxxCallSignPiFirst ) && ( programmeIdentification <= KWxxxCallSignPiLast )) {
+ callSign += "W";
+ callSign += iterateCallSign( KWxxxCallSignPiFirst, programmeIdentification );
+ }
+ // 3 letter only call signs
+ else if(( programmeIdentification >= KxxxCallSignPiFirst ) && ( programmeIdentification <= KxxxCallSignPiLast)) {
+ callSign += callSignString( programmeIdentification );
+ }
+ else
+ {
+ LOG( "RadioStation::piCodeToCallSign - Unhandled else" );
+ }
+
+ LOG_FORMAT( "RadioStation::piCodeToCallSign, call sign: %s", GETSTRING(callSign) );
+
+ return callSign;
+}
+
+/*!
+ *
+ */
+QString RadioStation::iterateCallSign( int piBase, int programmeIdentification )
+{
+ QString callSign;
+ LOG_FORMAT( "RadioStation::iterateCallSign base: %d", piBase );
+
+ int sum(0), i(0);
+
+ while( sum < programmeIdentification ) {
+ i++;
+ sum = piBase + i * 676 + 0 + 0;
+ }
+ callSign += callSignChar( i - 1 );
+
+ int tmpSum( sum - 676 );
+ sum -= 676;
+ i = 0;
+ while( sum <= programmeIdentification ) {
+ i++;
+ sum = tmpSum + 0 + i * 26 + 0;
+ }
+ callSign += callSignChar( i - 1 );
+
+ tmpSum = sum - 26;
+ sum -= 26;
+ i = 0;
+ while( sum <= programmeIdentification ) {
+ i++;
+ sum = tmpSum + 0 + 0 + i;
+ }
+ callSign += callSignChar( i - 1 );
+
+ return callSign;
+ }
+
+/*!
+ *
+ */
+QString RadioStation::callSignString( uint programmeIdentification )
+{
+ for ( uint i = 0; i < KThreeLetterCallSignCount; ++i ) {
+ if( piCode[i] == programmeIdentification ) {
+ return callSign[i];
+ }
+ }
+
+ LOG_FORMAT( "RadioStation::callSignString, Not found PI: %d", programmeIdentification );
+
+ return QString("????");
+}
+
+/*!
+ *
+ */
+char RadioStation::callSignChar( uint decimalValue )
+{
+ LOG_FORMAT( "RadioStation::callSignChar A+: %d", decimalValue );
+ if ( decimalValue <= KLastCallSignCharCode ) {
+ return static_cast<char>( 'A' + decimalValue );
+ }
+ return '?';
+}
+
+/**
+ * Detach from the implicitly shared data
+ */
+void RadioStation::detach()
+{
+ if ( !isDetached() ) {
+ RadioStationPrivate* newData = new RadioStationPrivate( *mData );
+
+ decrementReferenceCount();
+
+ newData->ref = 1;
+ mData = newData;
+
+ // The shared null instance of the data has its preset index set to -200 (RadioStation::SharedNull).
+ // We change the preset index of the detached data to -100 (RadioStation::Invalid) just to ease
+ // debugging. This guarantees that the only instance that has value -200 is the actual shared null.
+ #ifdef _DEBUG
+ if ( mData->mPresetIndex == RadioStation::SharedNull ) {
+ mData->mPresetIndex = RadioStation::Invalid;
+ }
+ #endif
+ }
+}
+
+/**
+ * Checks if the class is detached from implicitly shared data
+ */
+bool RadioStation::isDetached() const
+{
+ return mData->ref == 1;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radiostation_p.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+
+// User includes
+#include "radiostation_p.h"
+
+/*!
+ *
+ */
+RadioStationPrivate::RadioStationPrivate( int presetIndex, uint frequency )
+{
+ init( presetIndex, frequency );
+}
+
+/*!
+ *
+ */
+RadioStationPrivate::RadioStationPrivate( RadioStation::PresetFlag flag )
+{
+ init( flag );
+}
+
+/*!
+ *
+ */
+RadioStationPrivate::~RadioStationPrivate()
+{
+}
+
+/*!
+ *
+ */
+void RadioStationPrivate::init( int presetIndex, uint frequency )
+{
+ ref = 1;
+ mFrequency = frequency;
+ mPresetIndex = presetIndex;
+ mRenamedByUser = false;
+ mGenre = -1;
+ mPiCode = -1;
+ mType = 0;
+ mPsType = RadioStation::Unknown;
+ mChangeFlags = RadioStation::NoChange;
+ mCallSignCheckDone = false;
+}
+
+/*!
+ * \reimp
+ */
+int RadioStationPrivate::presetIndex() const
+{
+ return mPresetIndex;
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationPrivate::setPresetIndex( int presetIndex )
+{
+ mPresetIndex = presetIndex;
+}
+
+/*!
+ * \reimp
+ */
+uint RadioStationPrivate::frequency() const
+{
+ return mFrequency;
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationPrivate::setFrequency( uint frequency )
+{
+ mFrequency = frequency;
+}
+
+/*!
+ * \reimp
+ */
+QString RadioStationPrivate::name() const
+{
+ return mName;
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationPrivate::setName( QString name )
+{
+ mName = name;
+}
+
+/*!
+ * \reimp
+ */
+bool RadioStationPrivate::isRenamedByUser() const
+{
+ return mRenamedByUser;
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationPrivate::setRenamedByUser( bool renamed )
+{
+ mRenamedByUser = renamed;
+}
+
+/*!
+ * \reimp
+ */
+int RadioStationPrivate::genre() const
+{
+ return mGenre;
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationPrivate::setGenre( int genre )
+{
+ mGenre = genre;
+}
+
+/*!
+ * \reimp
+ */
+QString RadioStationPrivate::url() const
+{
+ return mUrl;
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationPrivate::setUrl( QString url )
+{
+ mUrl = url;
+}
+
+/*!
+ * \reimp
+ */
+int RadioStationPrivate::piCode() const
+{
+ return mPiCode;
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationPrivate::setPiCode( int piCode )
+{
+ mPiCode = piCode;
+}
+
+/*!
+ * \reimp
+ */
+bool RadioStationPrivate::isFavorite() const
+{
+ return mType.testFlag( RadioStation::Favorite );
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationPrivate::setFavorite( bool favorite )
+{
+ if ( favorite ) {
+ mType |= RadioStation::Favorite;
+ } else {
+ mType &= ~RadioStation::Favorite;
+ }
+}
+
+/*!
+ * \reimp
+ */
+bool RadioStationPrivate::isLocalStation() const
+{
+ return mType.testFlag( RadioStation::LocalStation );
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationPrivate::setLocalStation( bool localStation )
+{
+ if ( localStation ) {
+ mType |= RadioStation::LocalStation;
+ } else {
+ mType &= ~RadioStation::LocalStation;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radiostationfiltermodel.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "radiostationfiltermodel.h"
+#include "radiouiengine.h"
+#include "radiostationmodel.h"
+#include "radiologger.h"
+
+#include "radiostation.h" // Remove
+
+/*!
+ *
+ */
+RadioStationFilterModel::RadioStationFilterModel( RadioUiEngine& uiEngine, QObject* parent ) :
+ QSortFilterProxyModel( parent ),
+ mUiEngine( uiEngine ),
+ mIsCyclic( false )
+{
+ setSourceModel( &mUiEngine.model() );
+ setDynamicSortFilter( true );
+}
+
+/*!
+ *
+ */
+RadioStationFilterModel::~RadioStationFilterModel()
+{
+}
+
+/*!
+ * \reimp
+ */
+int RadioStationFilterModel::rowCount( const QModelIndex& parent ) const
+{
+ const int count = QSortFilterProxyModel::rowCount( parent );
+ return mIsCyclic ? count * 2 : count;
+}
+
+/*!
+ * \reimp
+ */
+QModelIndex RadioStationFilterModel::index( int row, int column,
+ const QModelIndex &parent ) const
+{
+ const int count = QSortFilterProxyModel::rowCount();
+ if ( row < count ) {
+ return QSortFilterProxyModel::index( row, column, parent );
+ } else {
+ foreach ( const QModelIndex& shadowIndex, mShadowIndexes.keys() ) {
+ if ( shadowIndex.row() == row ) {
+ return shadowIndex;
+ }
+ }
+
+ return QModelIndex();
+ }
+}
+
+/*!
+ * \reimp
+ */
+QVariant RadioStationFilterModel::data( const QModelIndex& index, int role ) const
+{
+ QModelIndex dataIndex = index;
+ if ( mShadowIndexes.contains( index ) ) {
+ dataIndex = mShadowIndexes.value( index );
+ }
+
+ if ( !index.isValid() || !dataIndex.isValid() ) {
+ return QVariant();
+ }
+
+ return QSortFilterProxyModel::data( dataIndex, role );
+}
+
+/*!
+ *
+ */
+void RadioStationFilterModel::setTypeFilter( RadioStation::Type filter )
+{
+ mFilter = filter;
+ filterChanged();
+}
+
+/*!
+ * Returns the model index corresponding to the given frequency
+ */
+QModelIndex RadioStationFilterModel::modelIndexFromFrequency( uint frequency )
+{
+ QModelIndex index = static_cast<RadioStationModel*>( sourceModel() )->modelIndexFromFrequency( frequency );
+ return mapFromSource( index );
+}
+
+/*!
+ *
+ */
+void RadioStationFilterModel::setCyclic( bool cyclic )
+{
+ mIsCyclic = cyclic;
+ if ( mIsCyclic ) {
+ const int realCount = QSortFilterProxyModel::rowCount();
+ LOG_FORMAT( "Station count: %d", realCount );
+ for ( int i = 0; i < realCount; ++i ) {
+ QModelIndex realIndex = QSortFilterProxyModel::index( i, 0 );
+ QModelIndex shadowIndex = createIndex( i + realCount, 0, realIndex.internalPointer() );
+ const uint freq = realIndex.data( RadioStationModel::RadioStationRole ).value<RadioStation>().frequency();
+ LOG_FORMAT( "Adding shadow index %d for index %d. Freq: %u", shadowIndex.row(), realIndex.row(), freq );
+ mShadowIndexes.insert( shadowIndex, realIndex );
+ }
+ }
+}
+
+/*!
+ *
+ */
+bool RadioStationFilterModel::hasLooped( const QModelIndex& index ) const
+{
+ return mShadowIndexes.contains( index );
+}
+
+/*!
+ *
+ */
+QModelIndex RadioStationFilterModel::realIndex( const QModelIndex& shadowIndex ) const
+{
+ return mShadowIndexes.value( shadowIndex );
+}
+
+/*!
+ *
+ */
+bool RadioStationFilterModel::isEqual( const QModelIndex& first, const QModelIndex& second ) const
+{
+ if ( first == second ) {
+ return true;
+ }
+
+ QModelIndex realFirst = first;
+ if ( mShadowIndexes.contains( first ) ) {
+ realFirst = mShadowIndexes.value( first );
+ }
+
+ QModelIndex realSecond = second;
+ if ( mShadowIndexes.contains( second ) ) {
+ realSecond = mShadowIndexes.value( second );
+ }
+
+ if ( realFirst == realSecond ) {
+ return true;
+ }
+
+ return false;
+}
+
+/*!
+ *
+ */
+bool RadioStationFilterModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
+{
+ QAbstractItemModel* source = sourceModel();
+ QModelIndex index = source->index( sourceRow, 0, sourceParent );
+ const RadioStation station = source->data( index, RadioStationModel::RadioStationRole ).value<RadioStation>();
+ const bool isType = station.isType( mFilter );
+ return isType;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radiostationmodel.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,692 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qstringlist>
+
+#include "radiostationmodel.h"
+#include "radiostationmodel_p.h"
+#include "radiopresetstorage.h"
+#include "radioenginewrapper.h"
+#include "radiouiengine.h"
+#include "radiostation.h"
+#include "radiostation_p.h"
+#include "radiologger.h"
+
+/*!
+ *
+ */
+static QString parseLine( const RadioStation& station )
+{
+ QString line = "";
+ line.append( RadioUiEngine::parseFrequency( station.frequency() ) );
+
+ QString name = station.name();
+ if ( !name.isEmpty() )
+ {
+ line.append( " - " );
+ line.append( name.trimmed() );
+ }
+
+ LOG_FORMAT( "RadioStationModel: Returning line %s", GETSTRING(line) );
+ return line;
+}
+
+/*!
+ *
+ */
+RadioStationModel::RadioStationModel( RadioUiEngine& uiEngine ) :
+ QAbstractListModel( &uiEngine ),
+ d_ptr( new RadioStationModelPrivate( this, uiEngine ) )
+{
+}
+
+/*!
+ *
+ */
+RadioStationModel::~RadioStationModel()
+{
+}
+
+/*!
+ *
+ */
+Qt::ItemFlags RadioStationModel::flags ( const QModelIndex& index ) const
+{
+ Qt::ItemFlags flags = QAbstractListModel::flags( index );
+ flags |= Qt::ItemIsEditable;
+ return flags;
+}
+
+/*!
+ *
+ */
+int RadioStationModel::rowCount( const QModelIndex& parent ) const
+{
+ Q_UNUSED( parent );
+ Q_D( const RadioStationModel );
+ const int count = d->mStations.keys().count();
+ return count;
+}
+
+/*!
+ * Checks the given station and emits signals based on what member variables had been changed
+ */
+QVariant RadioStationModel::data( const QModelIndex& index, int role ) const
+{
+ if ( !index.isValid() ) {
+ return QVariant();
+ }
+
+ Q_D( const RadioStationModel );
+ if ( role == Qt::DisplayRole ) {
+ RadioStation station = stationAt( index.row() );
+ QString firstLine = parseLine( station );
+ if ( d->mDetailLevel.testFlag( RadioStationModel::ShowGenre ) ) {
+ QStringList list;
+ list.append( firstLine );
+ QString genre = " "; // Empty space so that the listbox generates the second row
+ if ( station.genre() != -1 ) {
+ genre = d->mUiEngine.genreToString( station.genre() );
+ }
+ list.append( genre );
+
+ return list;
+ }
+
+ return firstLine;
+ } else if ( role == RadioStationModel::RadioStationRole ) {
+ QVariant variant;
+ variant.setValue( stationAt( index.row() ) );
+ return variant;
+ } else if ( role == Qt::DecorationRole &&
+ d->mDetailLevel.testFlag( RadioStationModel::ShowIcons ) ) {
+ RadioStation station = stationAt( index.row() );
+ QVariantList list;
+ if ( station.isFavorite() && !d->mFavoriteIcon.isNull() ) {
+ list.append( d->mFavoriteIcon );
+ } else {
+ list.append( QIcon() );
+ }
+ if ( currentStation().frequency() == station.frequency() && !d->mNowPlayingIcon.isNull() ) {
+ list.append( d->mNowPlayingIcon );
+ }
+ return list;
+ }
+
+ return QVariant();
+}
+
+/*!
+ * Checks the given station and emits signals based on what member variables had been changed
+ */
+bool RadioStationModel::setData( const QModelIndex& index, const QVariant& value, int role )
+{
+ Q_UNUSED( index );
+
+ if ( role == RadioStationModel::ToggleFavoriteRole ) {
+ const uint frequency = value.toUInt();
+ RadioStation station;
+ if ( findFrequency( frequency, station ) ) {
+ setFavoriteByPreset( station.presetIndex(), !station.isFavorite() );
+ } else {
+ setFavoriteByFrequency( frequency, true );
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+/*!
+ * Called by the wrapper to initialize the list with given amount of presets
+ */
+void RadioStationModel::initialize( RadioPresetStorage* storage, RadioEngineWrapper* engine )
+{
+ Q_D( RadioStationModel );
+ d->mPresetStorage = storage;
+ d->mEngine = engine;
+ const int presetCount = d->mPresetStorage->presetCount();
+ int index = d->mPresetStorage->firstPreset();
+ LOG_FORMAT( "RadioStationModelPrivate::initialize: presetCount: %d, firstIndex: %d", presetCount, index );
+
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ while ( index >= 0 ) {
+#else
+ index = 0;
+ while ( index < presetCount ) {
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+
+ RadioStation station;
+ station.detach();
+
+ RadioStationIf* preset = static_cast<RadioStationIf*>( station.data_ptr() );
+ if ( d->mPresetStorage->readPreset( index, *preset ) ) {
+ RADIO_ASSERT( station.isValid(), "RadioStationModelPrivate::initialize", "Invalid station" );
+ // TODO: Remove this if when new Preset utility is taken into use
+ if ( station.frequency() != 87500000 )
+ {
+ d->mStations.insert( station.frequency(), station );
+ }
+ }
+ ++index;
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ index = d->mPresetStorage->nextPreset( index );
+#endif
+ }
+
+ d->setCurrentStation( d->mEngine->currentFrequency() );
+}
+
+/*!
+ * Sets the icons to be used in the lists
+ */
+void RadioStationModel::setIcons( const QIcon& favoriteIcon, const QIcon& nowPlayingIcon )
+{
+ Q_D( RadioStationModel );
+ d->mFavoriteIcon = favoriteIcon;
+ d->mNowPlayingIcon = nowPlayingIcon;
+}
+
+/*!
+ * Returns a reference to the station handler interface
+ */
+RadioStationHandlerIf& RadioStationModel::stationHandlerIf()
+{
+ Q_D( RadioStationModel );
+ return *d;
+}
+
+/*!
+ * Returns a reference to the underlying QList so that it can be easily looped
+ */
+const Stations& RadioStationModel::list() const
+{
+ Q_D( const RadioStationModel );
+ return d->mStations;
+}
+
+/*!
+ * Returns the station at the given index.
+ */
+RadioStation RadioStationModel::stationAt( int index ) const
+{
+ // Get the value from the keys list instead of directly accessing the values list
+ // because QMap may have added a default-constructed value to the values list
+ Q_D( const RadioStationModel );
+ if ( index < d->mStations.keys().count() ) {
+ uint frequency = d->mStations.keys().at( index );
+ return d->mStations.value( frequency );
+ }
+ return RadioStation();
+}
+
+/*!
+ * Finds a station by frequency
+ */
+bool RadioStationModel::findFrequency( uint frequency, RadioStation& station )
+{
+ Q_D( RadioStationModel );
+ if ( d->mStations.contains( frequency ) ) {
+ station = d->mStations.value( frequency );
+ return true;
+ }
+ return false;
+}
+
+/*!
+ * Finds a station by preset index
+ */
+int RadioStationModel::findPresetIndex( int presetIndex )
+{
+ Q_D( RadioStationModel );
+ int index = 0;
+ foreach( const RadioStation& tempStation, d->mStations ) {
+ if ( tempStation.presetIndex() == presetIndex ) {
+ return index;
+ }
+ ++index;
+ }
+
+ return RadioStation::NotFound;
+}
+
+/*!
+ * Finds a station by preset index
+ */
+int RadioStationModel::findPresetIndex( int presetIndex, RadioStation& station )
+{
+ Q_D( RadioStationModel );
+ const int index = findPresetIndex( presetIndex );
+ if ( index != RadioStation::NotFound ) {
+ station = d->mStations.values().at( index );
+ }
+ return index;
+}
+
+/*!
+ * Removes a station by frequency
+ */
+void RadioStationModel::removeByFrequency( uint frequency )
+{
+ RadioStation station;
+ if ( findFrequency( frequency, station ) ) {
+ removeStation( station );
+ }
+}
+
+/*!
+ * Removes a station by preset index
+ */
+void RadioStationModel::removeByPresetIndex( int presetIndex )
+{
+ RadioStation station;
+ const int index = findPresetIndex( presetIndex, station );
+ if ( index >= 0 ) {
+ removeStation( station );
+ }
+}
+
+/*!
+ * Removes the given station
+ */
+void RadioStationModel::removeStation( const RadioStation& station )
+{
+ Q_D( RadioStationModel );
+ const uint frequency = station.frequency();
+ if ( d->mStations.contains( frequency ) ) {
+
+ // If we are removing the current station, copy its data to the current station pointer
+ // to keep all of the received RDS data still available. They will be discarded when
+ // the user tunes to another frequency, but they are available if the user decides to add it back.
+ if ( d->mCurrentStation->frequency() == frequency ) {
+ *d->mCurrentStation = station;
+ }
+
+ // Copy the station to a temporary variable that can be used as signal parameter
+ RadioStation tempStation = station;
+
+ const int row = modelIndexFromFrequency( tempStation.frequency() ).row();
+ beginRemoveRows( QModelIndex(), row, row );
+
+ d->mPresetStorage->deletePreset( tempStation.presetIndex() );
+ d->mStations.remove( frequency );
+
+ endRemoveRows();
+
+ d->setCurrentStation( d->mEngine->currentFrequency() );
+
+ if ( tempStation.isFavorite() ) {
+ tempStation.setFavorite( false );
+ emit favoriteChanged( tempStation );
+ }
+ }
+}
+
+/*!
+ * Adds a new station to the list
+ */
+void RadioStationModel::addStation( const RadioStation& station )
+{
+ Q_D( RadioStationModel );
+ const int newIndex = findUnusedPresetIndex();
+ LOG_FORMAT( "RadioStationModelPrivate::addStation: Adding station to index %d", newIndex );
+
+ RadioStation newStation = station;
+ newStation.setPresetIndex( newIndex );
+ newStation.unsetType( RadioStation::Temporary );
+
+ // We have to call beginInsertRows() BEFORE the addition is actually done so we must figure out where
+ // the new station will go in the sorted frequency order
+// int row = 0;
+// const int count = rowCount();
+// if ( count > 1 ) {
+// Stations::const_iterator iter = d->mStations.upperBound( newStation.frequency() );
+// uint iterFreq = iter.key();
+// if ( d->mStations.contains( iter.key() ) ) {
+// row = d->mStations.keys().indexOf( iter.key() );
+// } else {
+// row = count;
+// }
+// } else if ( count == 1 ) {
+// uint existingFreq = d->mStations.keys().first();
+// if ( station.frequency() > existingFreq ) {
+// row = 1;
+// }
+// }
+//
+ emit layoutAboutToBeChanged();
+// beginInsertRows( QModelIndex(), row, row );
+ // We must add the station here because saveStation() will only update an existing station
+ d->mStations.insert( newStation.frequency(), newStation );
+
+ saveStation( newStation );
+ d->setCurrentStation( d->mEngine->currentFrequency() );
+
+// endInsertRows();
+
+ emit layoutChanged();
+ emit stationAdded( station );
+}
+
+/*!
+ * Saves the given station. It is expected to already exist in the list
+ */
+void RadioStationModel::saveStation( RadioStation& station )
+{
+ Q_D( RadioStationModel );
+ const bool stationHasChanged = station.hasChanged();
+ RadioStation::Change changeFlags = station.changeFlags();
+ station.resetChangeFlags();
+
+ if ( station.isType( RadioStation::Temporary ) ) {
+
+ emitChangeSignals( station, changeFlags );
+
+ } else if ( station.isValid() && stationHasChanged && d->mStations.contains( station.frequency() )) {
+
+ d->mStations.insert( station.frequency(), station );
+
+ if ( changeFlags.testFlag( RadioStation::PersistentDataChanged ) ) {
+ const bool success = d->mPresetStorage->savePreset( *station.data_ptr() );
+ RADIO_ASSERT( success, "RadioStationModelPrivate::saveStation", "Failed to add station" );
+ }
+
+ emitChangeSignals( station, changeFlags );
+ }
+}
+
+/*!
+ * Changes the favorite status of a station by its frequency. If the station does
+ * not yet exist, it is added.
+ */
+void RadioStationModel::setFavoriteByFrequency( uint frequency, bool favorite )
+{
+ Q_D( RadioStationModel );
+ if ( d->mEngine->isFrequencyValid( frequency ) )
+ {
+ LOG_FORMAT( "RadioStationModelPrivate::setFavoriteByFrequency, frequency: %d", frequency );
+ RadioStation station;
+ if ( findFrequency( frequency, station ) ) // Update existing preset
+ {
+ if ( station.isFavorite() != favorite )
+ {
+ station.setFavorite( favorite );
+ saveStation( station );
+ }
+ }
+ else if ( favorite ) // Add new preset if setting as favorite
+ {
+ RadioStation newStation;
+ if ( d->mCurrentStation->frequency() == frequency ) {
+ newStation = *d->mCurrentStation;
+ } else {
+ LOG( "CurrentStation frequency mismatch!" );
+ newStation.setFrequency( frequency );
+ }
+
+ newStation.setType( RadioStation::LocalStation | RadioStation::Favorite );
+
+ // If PI code has been received, it is a local station
+ if ( newStation.hasPiCode() ) {
+ newStation.setType( RadioStation::LocalStation );
+ }
+
+ // Emit the signals only after adding the preset and reinitializing the current station
+ // because the UI will probably query the current station in its slots that get called.
+ addStation( newStation );
+ d->setCurrentStation( frequency );
+ }
+ }
+}
+
+/*!
+ * Changes the favorite status of a station by its preset index
+ */
+void RadioStationModel::setFavoriteByPreset( int presetIndex, bool favorite )
+{
+ LOG_FORMAT( "RadioStationModelPrivate::setFavoriteByPreset, presetIndex: %d", presetIndex );
+ RadioStation station;
+ if ( findPresetIndex( presetIndex, station ) != RadioStation::NotFound )
+ {
+ station.setFavorite( favorite );
+ saveStation( station );
+ }
+}
+
+/*!
+ * Renames a station by its preset index
+ */
+void RadioStationModel::renameStation( int presetIndex, const QString& name )
+{
+ LOG_FORMAT( "RadioStationModelPrivate::renameStation, presetIndex: %d, name: %s", presetIndex, GETSTRING(name) );
+ RadioStation station;
+ if ( findPresetIndex( presetIndex, station ) != RadioStation::NotFound )
+ {
+ station.setUserDefinedName( name );
+ saveStation( station );
+ }
+}
+
+/*!
+ *
+ */
+void RadioStationModel::setFavorites( const QModelIndexList& favorites )
+{
+ foreach ( const QModelIndex& index, favorites ) {
+ RadioStation station = stationAt( index.row() );
+ RADIO_ASSERT( station.isValid() , "RadioStationModel::setFavorites", "invalid RadioStation");
+ setFavoriteByPreset( station.presetIndex(), true );
+ }
+}
+
+/*!
+ * Returns the currently tuned station
+ */
+RadioStation& RadioStationModel::currentStation()
+{
+ Q_D( RadioStationModel );
+ return *d->mCurrentStation;
+}
+
+/*!
+ * Returns the currently tuned station
+ */
+const RadioStation& RadioStationModel::currentStation() const
+{
+ Q_D( const RadioStationModel );
+ return *d->mCurrentStation;
+}
+
+/*!
+ * Sets the model detail level
+ */
+void RadioStationModel::setDetail( Detail level )
+{
+ Q_D( RadioStationModel );
+ d->mDetailLevel = level;
+}
+
+/*!
+ * Returns a list of radio stations in the given frequency range
+ */
+QList<RadioStation> RadioStationModel::stationsInRange( uint minFrequency, uint maxFrequency )
+{
+ Q_D( RadioStationModel );
+ QList<RadioStation> stations;
+ foreach( const RadioStation& station, d->mStations ) {
+ if ( station.frequency() >= minFrequency && station.frequency() <= maxFrequency ) {
+ stations.append( station );
+ }
+ }
+
+ return stations;
+}
+
+/*!
+ * Returns the model index corresponding to the given frequency
+ */
+QModelIndex RadioStationModel::modelIndexFromFrequency( uint frequency )
+{
+ RadioStation station;
+ if ( findFrequency( frequency, station ) ) {
+ return index( findPresetIndex( station.presetIndex() ), 0 );
+ }
+ return QModelIndex();
+}
+
+/*!
+ * Public slot
+ * Removes all stations
+ */
+void RadioStationModel::removeAll()
+{
+ Q_D( RadioStationModel );
+
+ if ( d->mStations.count() == 0 ) {
+ return;
+ }
+
+ QList<RadioStation> favorites;
+ foreach( const RadioStation& station, d->mStations ) {
+ if ( station.isFavorite() ) {
+ favorites.append( station );
+ }
+ }
+
+ beginRemoveRows( QModelIndex(), 0, rowCount() - 1 );
+
+ // Preset utility deletes all presets with index -1
+#ifdef COMPILE_WITH_NEW_PRESET_UTILITY
+ bool success = d->mPresetStorage->deletePreset( -1 );
+#else
+ bool success = d->mPresetStorage->deletePreset( 0 );
+#endif // COMPILE_WITH_NEW_PRESET_UTILITY
+ RADIO_ASSERT( success, "FMRadio", "Failed to remove station" );
+
+ d->mStations.clear();
+ d->setCurrentStation( d->mEngine->currentFrequency() );
+
+ endRemoveRows();
+
+ foreach( RadioStation station, favorites ) {
+ station.setFavorite( false );
+ emit favoriteChanged( station );
+ }
+}
+
+/*!
+ * Private slot
+ * Timer timeout slot to indicate that the dynamic PS check has ended
+ */
+void RadioStationModel::dynamicPsCheckEnded()
+{
+ Q_D( RadioStationModel );
+ LOG_TIMESTAMP( "Finished dynamic PS check." );
+ if ( d->mCurrentStation->psType() != RadioStation::Dynamic && !d->mCurrentStation->dynamicPsText().isEmpty() )
+ {
+ d->mCurrentStation->setPsType( RadioStation::Static );
+ d->mCurrentStation->setName( d->mCurrentStation->dynamicPsText() );
+ d->mCurrentStation->setDynamicPsText( "" );
+ saveStation( *d->mCurrentStation );
+ }
+}
+
+/*!
+ * Checks the given station and emits signals based on what member variables had been changed
+ */
+void RadioStationModel::emitChangeSignals( const RadioStation& station, RadioStation::Change flags )
+{
+ if ( flags.testFlag( RadioStation::NameChanged ) ||
+ flags.testFlag( RadioStation::GenreChanged ) ||
+ flags.testFlag( RadioStation::UrlChanged ) ||
+ flags.testFlag( RadioStation::TypeChanged ) ||
+ flags.testFlag( RadioStation::PiCodeChanged ) ) {
+
+ // Create a temporary RadioStation for the duration of the signal-slot processing
+ // The receivers can ask the station what data has changed and update accordingly
+ RadioStation tempStation( station );
+ tempStation.setChangeFlags( flags );
+ emit stationDataChanged( tempStation );
+
+ emitDataChanged( tempStation );
+ }
+
+ if ( flags.testFlag( RadioStation::RadioTextChanged ) ) {
+ emit radioTextReceived( station );
+ emitDataChanged( station );
+ }
+
+ if ( flags.testFlag( RadioStation::DynamicPsChanged ) ) {
+ emit dynamicPsChanged( station );
+ emitDataChanged( station );
+ }
+
+ if ( flags.testFlag( RadioStation::FavoriteChanged ) && station.isValid() ) {
+ emit favoriteChanged( station );
+ emitDataChanged( station );
+ }
+}
+
+/*!
+ *
+ */
+void RadioStationModel::emitDataChanged( const RadioStation& station )
+{
+ const int row = findPresetIndex( station.presetIndex() );
+ QModelIndex top = index( row, 0, QModelIndex() );
+ QModelIndex bottom = index( row, 0, QModelIndex() );
+ emit dataChanged( top, bottom );
+}
+
+/*!
+ * Finds an unused preset index
+ */
+int RadioStationModel::findUnusedPresetIndex()
+{
+ Q_D( RadioStationModel );
+ QList<int> indexes;
+ foreach( const RadioStation& station, d->mStations ) {
+ if ( station.isValid() ) {
+ indexes.append( station.presetIndex() );
+ }
+ }
+
+ int index = 0;
+ for ( ; indexes.contains( index ); ++index ) {
+ // Nothing to do here
+ }
+
+ LOG_FORMAT( "RadioStationModelPrivate::findUnusedPresetIndex, index: %d", index );
+ return index;
+}
+
+/*!
+ * Used by the RDS data setters to find the correct station where the data is set
+ */
+RadioStation RadioStationModel::findCurrentStation( uint frequency )
+{
+ Q_D( RadioStationModel );
+ RadioStation station = *d->mCurrentStation;
+ if ( station.frequency() != frequency ) {
+ if ( !findFrequency( frequency, station ) ) {
+ return RadioStation();
+ }
+ }
+ return station;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radiostationmodel_p.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qtimer>
+
+// User includes
+#include "radiostationmodel.h"
+#include "radiostationmodel_p.h"
+#include "radiologger.h"
+#include "radiopresetstorage.h"
+#include "radioenginewrapper.h"
+#include "radiouiengine.h"
+#include "radiostation.h"
+#include "radioplaylogmodel.h"
+
+// Constants
+/**
+ * Timeout period for checking if station is sending dynamic PS in milliseconds
+ */
+const int KDynamicPsCheckTimeout = 10 * 1000;
+
+/*!
+ *
+ */
+RadioStationModelPrivate::RadioStationModelPrivate( RadioStationModel* model,
+ RadioUiEngine& uiEngine ) :
+ q_ptr( model ),
+ mUiEngine( uiEngine ),
+ mCurrentStation( &mManualStation ),
+ mDynamicPsTimer( new QTimer() )
+{
+ connectAndTest( mDynamicPsTimer.data(), SIGNAL(timeout()),
+ q_ptr, SLOT(dynamicPsCheckEnded()) );
+ mDynamicPsTimer->setInterval( KDynamicPsCheckTimeout );
+ mDynamicPsTimer->setSingleShot( true );
+}
+
+/*!
+ *
+ */
+RadioStationModelPrivate::~RadioStationModelPrivate()
+{
+ // Destructor needs to be defined. See explanation from RadioEngineWrapperPrivate destructor.
+}
+
+/*!
+ * \reimp
+ */
+uint RadioStationModelPrivate::currentFrequency() const
+{
+ return mCurrentStation->frequency();
+}
+
+/*!
+ * \reimp
+ */
+int RadioStationModelPrivate::currentPresetIndex() const
+{
+ return mCurrentStation->presetIndex();
+}
+
+/*!
+ * Sets the currently tuned frequency. Meant to be set by the engine wrapper
+ */
+void RadioStationModelPrivate::setCurrentStation( uint frequency )
+{
+ LOG_METHOD;
+ if ( mStations.contains( frequency ) ) {
+ // We have to be careful to check that key exists before using operator[]
+ // with QMap since it will insert a default-constructed value if it doesn't exist yet.
+ mCurrentStation = &mStations[ frequency ];
+ } else {
+ mManualStation.reset();
+ mManualStation.setFrequency( frequency );
+ mCurrentStation = &mManualStation;
+ }
+}
+
+/*!
+ * \reimp
+ * Sets the genre to the currently tuned station
+ */
+void RadioStationModelPrivate::setCurrentGenre( uint frequency, int genre )
+{
+ Q_Q( RadioStationModel );
+ RadioStation station = q->findCurrentStation( frequency );
+ if ( !station.isValid() ) {
+ LOG( "Unable to find current station. Ignoring RDS" );
+ return;
+ }
+ station.setGenre( genre );
+ q->saveStation( station );
+}
+
+/*!
+ * \reimp
+ * Checks if the given frequency exists in the list
+ */
+bool RadioStationModelPrivate::containsFrequency( uint frequency )
+{
+ return mStations.contains( frequency );
+}
+
+/*!
+ * \reimp
+ * Checks if the given preset index exists in the list
+ */
+bool RadioStationModelPrivate::containsPresetIndex( int presetIndex )
+{
+ Q_Q( RadioStationModel );
+ return q->findPresetIndex( presetIndex ) != RadioStation::NotFound;
+}
+
+/*!
+ * \reimp
+ * Starts the dynamic PS check
+ */
+void RadioStationModelPrivate::startDynamicPsCheck()
+{
+ // Start the Dynamic PS check if the station has no name and ps type is not known
+ // During the dynamic PS check the RadioStation's dynamicPs variable is used to store the
+ // received PS name even though at this point it isn't known if it is dynamic or not.
+ mDynamicPsTimer->stop();
+ if ( mCurrentStation->psType() == RadioStation::Unknown ) {
+ mCurrentStation->setDynamicPsText( "" );
+ mDynamicPsTimer->start();
+ }
+}
+
+/*!
+ * \reimp
+ *
+ */
+void RadioStationModelPrivate::addScannedFrequency( uint frequency )
+{
+ Q_Q( RadioStationModel );
+ RadioStation station;
+ if ( q->findFrequency( frequency, station ) ) {
+ station.setType( RadioStation::LocalStation );
+ q->saveStation( station );
+ } else {
+ station.setType( RadioStation::LocalStation );
+ station.setFrequency( frequency );
+ q->addStation( station );
+ }
+}
+
+/*!
+ * \reimp
+ * Removes all local stations that are not favorites
+ */
+void RadioStationModelPrivate::removeLocalStations()
+{
+ Q_Q( RadioStationModel );
+ foreach( const RadioStation& station, mStations ) {
+ if ( station.isType( RadioStation::LocalStation ) && !station.isFavorite() ) {
+ q->removeStation( station );
+ }
+ }
+}
+
+/*!
+ * \reimp
+ * Sets the PS name to the currently tuned station
+ */
+void RadioStationModelPrivate::setCurrentPsName( uint frequency, const QString& name )
+{
+ Q_Q( RadioStationModel );
+ LOG_FORMAT( "RadioEngineWrapperPrivate::updateCurrentStationName: %s", GETSTRING( name ) );
+ RadioStation station = q->findCurrentStation( frequency );
+ if ( !station.isValid() ) {
+ LOG( "Unable to find current station. Ignoring RDS" );
+ return;
+ }
+
+ if ( station.psType() == RadioStation::Static ) {
+
+ if ( name.compare( station.name() ) != 0 && !station.isRenamed() ) {
+ station.setName( name );
+ q->saveStation( station );
+ }
+
+ } else {
+
+ if ( mDynamicPsTimer->isActive() ) { // Dynamic PS check is ongoing
+ LOG( "Dynamic Ps check ongoing" );
+
+ if ( !station.dynamicPsText().isEmpty() &&
+ name.compare( station.dynamicPsText(), Qt::CaseInsensitive ) != 0 ) {
+ LOG( "Dynamic Ps check - Second PS name arrived and is different. PS is dynamic" );
+ station.setPsType( RadioStation::Dynamic ); // Station is sending Dynamic PS
+ mDynamicPsTimer->stop();
+
+ // Cleanup the station name if region is not America
+ if ( !station.name().isEmpty()
+ && !station.isRenamed()
+ && mEngine->region() != RadioRegion::America )
+ {
+ LOG( "Station name cleanup" );
+ station.setName( "" );
+ }
+ }
+
+ // Received PS name is published to the UI as dynamic PS while the check is ongoing
+ // even though at this stage we don't know if it is dynamic or not.
+
+ station.setDynamicPsText( name );
+ q->saveStation( station );
+
+ } else {
+
+ if ( station.psType() == RadioStation::Dynamic ) {
+ LOG( "Station uses Dynamic Ps" );
+ } else {
+ LOG( "Station PS type unknown" );
+ }
+
+ station.setDynamicPsText( name );
+ q->saveStation( station );
+ }
+ }
+}
+
+/*!
+ * \reimp
+ * Sets the radio text to the currently tuned station
+ */
+void RadioStationModelPrivate::setCurrentRadioText( uint frequency, const QString& radioText )
+{
+ Q_Q( RadioStationModel );
+ RadioStation station = q->findCurrentStation( frequency );
+ if ( !station.isValid() ) {
+ LOG( "Unable to find current station. Ignoring RDS" );
+ return;
+ }
+ station.setRadioText( radioText );
+ q->saveStation( station );
+ mUiEngine.playLogModel().clearRadioTextPlus();
+}
+
+/*!
+ * \reimp
+ * Sets the radio text plus to the currently tuned station
+ */
+void RadioStationModelPrivate::setCurrentRadioTextPlus( uint frequency, int rtClass, const QString& rtItem )
+{
+ Q_Q( RadioStationModel );
+ RadioStation station = q->findCurrentStation( frequency );
+ if ( !station.isValid() ) {
+ LOG( "Unable to find current station. Ignoring RDS" );
+ return;
+ }
+ station.setRadioTextPlus( rtClass, rtItem );
+ q->saveStation( station );
+ mUiEngine.playLogModel().addRadioTextPlus( rtClass, rtItem );
+}
+
+/*!
+ * \reimp
+ * Sets the PI code to the currently tuned station
+ */
+void RadioStationModelPrivate::setCurrentPiCode( uint frequency, int piCode )
+{
+ Q_Q( RadioStationModel );
+ RadioStation station = q->findCurrentStation( frequency );
+ if ( !station.isValid() ) {
+ LOG( "Unable to find current station. Ignoring RDS" );
+ return;
+ }
+#ifdef SHOW_CALLSIGN_IN_ANY_REGION
+ RadioRegion::Region region = RadioRegion::America;
+#else
+ RadioRegion::Region region = mEngine->region();
+#endif
+
+ station.setPiCode( piCode, region );
+ q->saveStation( station );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radiouiengine.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,546 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qscopedpointer>
+#include <qprocess>
+#include <qfile>
+
+#ifdef BUILD_WIN32
+# include <qsettings>
+#endif // WIN32_BUILD
+
+// User includes
+#include "radiouiengine.h"
+#include "radiouiengine_p.h"
+#include "radiologger.h"
+#include "radioenginewrapper.h"
+#include "radiostationmodel.h"
+#include "radioplaylogmodel.h"
+#include "radiosettings.h"
+#include "radiostationfiltermodel.h"
+#include "radiolocalization.h"
+
+#ifdef USE_MOBILE_EXTENSIONS_API
+ #include "xqprofile"
+#endif
+
+// Constants
+const QString KPathFormatter = "%1:%2%3";
+const QString KApplicationDir = "\\sys\\bin\\";
+const QString KSongRecognitionApp = "Shazam_0x200265B3.exe";
+const QString KSongRecognitionAppParams = "-listen";
+
+/*!
+ *
+ */
+bool RadioUiEngine::isOfflineProfile()
+{
+ bool offline = false;
+
+#ifdef USE_MOBILE_EXTENSIONS_API
+ QScopedPointer<XQProfile> profile ( new XQProfile() ); // Deletes automatically when out of scope
+ offline = profile->activeProfile() == XQProfile::ProfileOffLine;
+#elif BUILD_WIN32
+ QScopedPointer<QSettings> settings( new QSettings( "Nokia", "QtFmRadio" ) );
+ offline = settings->value( "Offline", false ).toBool();
+#endif
+
+ return offline;
+}
+
+/*!
+ *
+ */
+QString RadioUiEngine::parseFrequency( uint frequency )
+{
+ return QTRANSLATE( KFrequencyMhz ).arg( RadioStation::parseFrequency( frequency ) );
+}
+
+/*!
+ *
+ */
+QString RadioUiEngine::nameOrFrequency( const RadioStation& station, uint frequency )
+{
+ if ( frequency == 0 )
+ {
+ frequency = station.frequency();
+ }
+
+ QString text = "";
+ if ( station.isValid() && !station.name().isEmpty() )
+ {
+ text = station.name();
+ }
+ else
+ {
+ text = parseFrequency( frequency );
+ }
+
+ return text;
+}
+
+/*!
+ *
+ */
+RadioUiEngine::RadioUiEngine( QObject* parent ) :
+ QObject( parent ),
+ d_ptr( new RadioUiEnginePrivate( this ) )
+{
+}
+
+/*!
+ *
+ */
+RadioUiEngine::~RadioUiEngine()
+{
+}
+
+/*!
+ *
+ */
+bool RadioUiEngine::startRadio()
+{
+ Q_D( RadioUiEngine );
+ return d->startRadio();
+}
+
+/*!
+ *
+ */
+bool RadioUiEngine::isFirstTimeStart()
+{
+ Q_D( RadioUiEngine );
+ return d->mEngineWrapper->settings().isFirstTimeStart();
+}
+
+/*!
+ * Returns the settings handler owned by the engine
+ */
+RadioSettings& RadioUiEngine::settings()
+{
+ Q_D( RadioUiEngine );
+ return d->mEngineWrapper->settings();
+}
+
+/*!
+ * Returns the station model
+ */
+RadioStationModel& RadioUiEngine::model()
+{
+ Q_D( RadioUiEngine );
+ return *d->mStationModel;
+}
+
+/*!
+ * Returns the play log model
+ */
+RadioPlayLogModel& RadioUiEngine::playLogModel()
+{
+ Q_D( RadioUiEngine );
+ if ( !d->mPlayLogModel ) {
+ d->mPlayLogModel = new RadioPlayLogModel( *this );
+ }
+
+ return *d->mPlayLogModel;
+}
+
+/*!
+ * Returns the stations list
+ */
+RadioStationFilterModel* RadioUiEngine::createNewFilterModel( QObject* parent )
+{
+ return new RadioStationFilterModel( *this, parent );
+}
+
+/*!
+ *
+ */
+bool RadioUiEngine::isRadioOn() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->isRadioOn();
+}
+
+/*!
+ *
+ */
+bool RadioUiEngine::isScanning() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->isScanning();
+}
+
+/*!
+ *
+ */
+bool RadioUiEngine::isMuted() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->isMuted();
+}
+
+/*!
+ *
+ */
+bool RadioUiEngine::isAntennaAttached() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->isAntennaAttached();
+}
+
+/*!
+ *
+ */
+bool RadioUiEngine::isUsingLoudspeaker() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->isUsingLoudspeaker();
+}
+
+/*!
+ * Returns the selected radio region
+ */
+RadioRegion::Region RadioUiEngine::region() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->region();
+}
+
+/*!
+ * Returns the currently tuned frequency
+ */
+uint RadioUiEngine::currentFrequency() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->currentFrequency();
+}
+
+/*!
+ * Returns the minimum frequency
+ */
+uint RadioUiEngine::minFrequency() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->minFrequency();
+}
+
+/*!
+ * Returns the maximum frequency
+ */
+uint RadioUiEngine::maxFrequency() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->maxFrequency();
+}
+
+/*!
+ * Returns the frequency step size from the selected region
+ */
+uint RadioUiEngine::frequencyStepSize() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->frequencyStepSize();
+}
+
+/*!
+ *
+ */
+void RadioUiEngine::scanFrequencyBand()
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->scanFrequencyBand();
+}
+
+/*!
+ *
+ */
+void RadioUiEngine::cancelScanFrequencyBand()
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->cancelScanFrequencyBand();
+}
+
+/*!
+ *
+ */
+QList<RadioStation> RadioUiEngine::stationsInRange( uint minFrequency, uint maxFrequency )
+{
+ Q_D( RadioUiEngine );
+ return d->mStationModel->stationsInRange( minFrequency, maxFrequency );
+}
+
+/*!
+ *
+ */
+QString RadioUiEngine::genreToString( int genre )
+{
+ RadioRegion::Region currentRegion = region();
+
+ const GenreStruct* genreArray = currentRegion == RadioRegion::America ? AmericanGenres : EuropeanGenres;
+ const int genreCount = currentRegion == RadioRegion::America ? AmericanGenresCount : EuropeanGenresCount;
+
+ for( int i = 0; i < genreCount; ++i ) {
+ if ( genreArray[i].mGenreCode == genre ) {
+ return TRANSLATE( genreArray[i].mTranslation );
+// return qApp->translate( GenreContext,
+// genreArray[i].mTranslation.source,
+// genreArray[i].mTranslation.comment );
+ }
+ }
+
+ return "";
+}
+
+/*!
+ *
+ */
+bool RadioUiEngine::isSongRecognitionAppAvailable()
+{
+ //TODO: Check if there is a better way to check if an application is available
+ bool available = false;
+
+ // Check the Z: drive
+ QString fullPath = QString( KPathFormatter ).arg( "Z" ).arg( KApplicationDir ).arg( KSongRecognitionApp );
+ available = QFile::exists( fullPath );
+
+ LOG_FORMAT( "Checking file: %s. found %d", GETSTRING( fullPath ), available );
+
+ if ( !available ) {
+ // Check the C: drive
+ fullPath = QString( KPathFormatter ).arg( "C" ).arg( KApplicationDir ).arg( KSongRecognitionApp );
+ available = QFile::exists( fullPath );
+ LOG_FORMAT( "Checking file: %s. found %d", GETSTRING( fullPath ), available );
+ if ( !available ) {
+ // Check the E: drive
+ fullPath = QString( KPathFormatter ).arg( "E" ).arg( KApplicationDir ).arg( KSongRecognitionApp );
+ available = QFile::exists( fullPath );
+ LOG_FORMAT( "Checking file: %s. found %d", GETSTRING( fullPath ), available );
+ }
+ }
+ return available;
+}
+
+/*!
+ *
+ */
+void RadioUiEngine::addRecognizedSong( const QString& artist, const QString& title )
+{
+ Q_D( RadioUiEngine );
+ d->mPlayLogModel->addItem( artist, title );
+}
+
+/*!
+ * Public slot
+ * Tunes to the given frequency
+ */
+void RadioUiEngine::tuneFrequency( uint frequency, const int sender )
+{
+ Q_D( RadioUiEngine );
+ if ( frequency != d->mStationModel->currentStation().frequency() && d->mEngineWrapper->isFrequencyValid( frequency ) ) {
+ LOG_FORMAT( "RadioUiEngine::tuneFrequency, frequency: %d", frequency );
+ d->mEngineWrapper->tuneFrequency( frequency, sender );
+ }
+}
+
+/*!
+ * Public slot
+ * Tunes to the given frequency after a delay
+ */
+void RadioUiEngine::tuneWithDelay( uint frequency, const int sender )
+{
+ Q_D( RadioUiEngine );
+ if ( frequency != d->mStationModel->currentStation().frequency() && d->mEngineWrapper->isFrequencyValid( frequency ) ) {
+ LOG_FORMAT( "RadioEngineWrapperPrivate::tuneWithDelay, frequency: %d", frequency );
+ d->mEngineWrapper->tuneWithDelay( frequency, sender );
+ }
+}
+
+/*!
+ * Public slot
+ * Tunes to the given preset
+ */
+void RadioUiEngine::tunePreset( int presetIndex )
+{
+ Q_D( RadioUiEngine );
+ if ( presetIndex != d->mStationModel->currentStation().presetIndex() ) {
+ RadioStation station;
+ if ( d->mStationModel->findPresetIndex( presetIndex, station ) != RadioStation::NotFound &&
+ d->mEngineWrapper->isFrequencyValid( station.frequency() ) ) {
+ LOG_FORMAT( "RadioEngineWrapperPrivate::tunePreset, presetIndexPosition: %d", presetIndex );
+
+ d->mEngineWrapper->tuneFrequency( station.frequency(), CommandSender::Unspecified );
+ }
+ }
+}
+
+/*!
+ * Public slot
+ * volume update command slot for the engine
+ */
+void RadioUiEngine::setVolume( int volume )
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->setVolume( volume );
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioUiEngine::toggleMute()
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->toggleMute();
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioUiEngine::toggleAudioRoute()
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->toggleAudioRoute();
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioUiEngine::skipPrevious()
+{
+ Q_D( RadioUiEngine );
+ d->skip( RadioUiEnginePrivate::Previous );
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioUiEngine::skipNext()
+{
+ Q_D( RadioUiEngine );
+ d->skip( RadioUiEnginePrivate::Next );
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioUiEngine::seekUp()
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->startSeeking( Seeking::Up );
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioUiEngine::seekDown()
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->startSeeking( Seeking::Down );
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioUiEngine::launchSongRecognition()
+{
+ LOG_FORMAT("RadioUiEngine::launchSongRecognition() starting: %s", GETSTRING( KSongRecognitionApp ) );
+
+ QStringList arguments;
+ arguments << KSongRecognitionAppParams;
+
+ bool started = QProcess::startDetached( KSongRecognitionApp, arguments );
+ LOG_ASSERT( started, LOG_FORMAT("RadioUiEngine::launchSongRecognition() failed to start %s", GETSTRING( KSongRecognitionApp ) ) );
+}
+
+/*!
+ * Function used by the private implementation to emit a tunedToFrequency signal
+ */
+void RadioUiEngine::emitTunedToFrequency( uint frequency, int commandSender )
+{
+ emit tunedToFrequency( frequency, commandSender );
+}
+
+/*!
+ * Function used by the private implementation to emit a seekingStarted signal
+ */
+void RadioUiEngine::emitSeekingStarted( Seeking::Direction direction )
+{
+ emit seekingStarted( direction );
+}
+
+/*!
+ * Function used by the private implementation to emit a radioStatusChanged signal
+ */
+void RadioUiEngine::emitRadioStatusChanged( bool radioIsOn )
+{
+ emit radioStatusChanged( radioIsOn );
+}
+
+/*!
+ * Function used by the private implementation to emit a rdsAvailabilityChanged signal
+ */
+void RadioUiEngine::emitRdsAvailabilityChanged( bool available )
+{
+ emit rdsAvailabilityChanged( available );
+}
+
+/*!
+ * Function used by the private implementation to emit a volumeChanged signal
+ */
+void RadioUiEngine::emitVolumeChanged( int volume )
+{
+ emit volumeChanged( volume );
+}
+
+/*!
+ * Function used by the private implementation to emit a muteChanged signal
+ */
+void RadioUiEngine::emitMuteChanged( bool muted )
+{
+ emit muteChanged( muted );
+}
+
+/*!
+ * Function used by the private implementation to emit a audioRouteChanged signal
+ */
+void RadioUiEngine::emitAudioRouteChanged( bool loudspeaker )
+{
+ emit audioRouteChanged( loudspeaker );
+}
+
+/*!
+ * Function used by the private implementation to emit a scanAndSaveFinished signal
+ */
+void RadioUiEngine::emitScanAndSaveFinished()
+{
+ emit scanAndSaveFinished();
+}
+/*!
+ * Function used by the private implementation to emit a headsetStatusChanged signal
+ */
+void RadioUiEngine::emitheadsetStatusChanged( bool connected )
+{
+ emit headsetStatusChanged( connected );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/src/radiouiengine_p.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qapplication>
+#include <qstringlist>
+
+// User includes
+#include "radiouiengine.h"
+#include "radiouiengine_p.h"
+#include "radioenginewrapper.h"
+#include "radiostationmodel.h"
+#include "radiopresetstorage.h"
+#include "radiosettings.h"
+#include "radiostation.h"
+#include "radiologger.h"
+
+/*!
+ *
+ */
+RadioUiEnginePrivate::RadioUiEnginePrivate( RadioUiEngine* engine ) :
+ q_ptr( engine ),
+ mEngineWrapper( 0 ),
+ mStationModel( 0 ),
+ mPlayLogModel( 0 )
+{
+}
+
+/*!
+ *
+ */
+RadioUiEnginePrivate::~RadioUiEnginePrivate()
+{
+}
+
+/*!
+ *
+ */
+bool RadioUiEnginePrivate::startRadio()
+{
+ mStationModel = new RadioStationModel( *q_ptr );
+ mEngineWrapper.reset( new RadioEngineWrapper( mStationModel->stationHandlerIf(), *this ) );
+ mPresetStorage.reset( new RadioPresetStorage() );
+ mStationModel->initialize( mPresetStorage.data(), mEngineWrapper.data() );
+
+ return mEngineWrapper->isEngineConstructed();
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::tunedToFrequency( uint frequency, int commandSender )
+{
+ Q_Q( RadioUiEngine );
+ q->emitTunedToFrequency( frequency, commandSender );
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::seekingStarted( Seeking::Direction direction )
+{
+ Q_Q( RadioUiEngine );
+ q->emitSeekingStarted( direction );
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::radioStatusChanged( bool radioIsOn )
+{
+ Q_Q( RadioUiEngine );
+ q->emitRadioStatusChanged( radioIsOn );
+
+ if ( radioIsOn ) {
+ Q_Q( RadioUiEngine );
+ QStringList args; // = qApp->arguments();
+ if ( args.count() == 2 )
+ {
+ if ( args.at( 0 ) == "-f" ) // Frequency
+ {
+ uint frequency = args.at( 1 ).toUInt();
+
+ if ( frequency >= mEngineWrapper->minFrequency() && frequency <= mEngineWrapper->maxFrequency() )
+ {
+ LOG_FORMAT( "RadioApplication::handleArguments, Tuning to frequency: %d", frequency );
+ q->tuneFrequency( frequency, 0 );
+ }
+ }
+ else if ( args.at( 0 ) == "-i" ) // Preset index
+ {
+ int preset = args.at( 1 ).toInt();
+ if ( preset > 0 && preset < mStationModel->rowCount() )
+ {
+ LOG_FORMAT( "RadioApplication::handleArguments, Tuning to preset %d", preset );
+ q->tunePreset( preset );
+ }
+ }
+ }
+ }
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::rdsAvailabilityChanged( bool available )
+{
+ Q_Q( RadioUiEngine );
+ q->emitRdsAvailabilityChanged( available );
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::volumeChanged( int volume )
+{
+ Q_Q( RadioUiEngine );
+ q->emitVolumeChanged( volume );
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::muteChanged( bool muted )
+{
+ Q_Q( RadioUiEngine );
+ q->emitMuteChanged( muted );
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::audioRouteChanged( bool loudspeaker )
+{
+ Q_Q( RadioUiEngine );
+ q->emitAudioRouteChanged( loudspeaker );
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::scanAndSaveFinished()
+{
+ Q_Q( RadioUiEngine );
+ q->emitScanAndSaveFinished();
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::headsetStatusChanged( bool connected )
+{
+ Q_Q( RadioUiEngine );
+ q->emitheadsetStatusChanged( connected );
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::skipPrevious()
+{
+ skip( Previous );
+}
+
+/*!
+ *
+ */
+void RadioUiEnginePrivate::skipNext()
+{
+ skip( Next );
+}
+
+/*!
+ * Tunes to next or previous favorite preset
+ */
+void RadioUiEnginePrivate::skip( RadioUiEnginePrivate::TuneDirection direction )
+{
+ LOG_FORMAT( "RadioUiEnginePrivate::skip: direction: %d", direction );
+
+ //TODO: Refactor to go through RadioStationModel
+ QList<uint> favorites;
+ const uint currentFreq = mStationModel->currentStation().frequency();
+
+ // Find all favorites
+ foreach( const RadioStation& station, mStationModel->list() ) {
+ if ( station.isFavorite() && station.frequency() != currentFreq ) {
+ favorites.append( station.frequency() );
+ }
+ }
+
+ const int favoriteCount = favorites.count();
+ if ( favoriteCount == 0 ) {
+ return;
+ }
+
+ // Find the previous and next favorite from current frequency
+ uint previous = 0;
+ uint next = 0;
+ foreach( uint favorite, favorites ) {
+ if ( favorite > currentFreq ) {
+ next = favorite;
+ break;
+ }
+ previous = favorite;
+ }
+
+ if ( direction == RadioUiEnginePrivate::Previous ) {
+ if ( previous == 0 ) {
+ previous = favorites.last();
+ }
+ LOG_FORMAT( "RadioUiEnginePrivate::skip. CurrentFreq: %u, tuning to: %u", currentFreq, previous );
+ mEngineWrapper->tuneFrequency( previous, CommandSender::Unspecified );
+ } else {
+ if ( next == 0 ) {
+ next = favorites.first();
+ }
+ LOG_FORMAT( "RadioUiEnginePrivate::skip. CurrentFreq: %u, tuning to: %u", currentFreq, next );
+ mEngineWrapper->tuneFrequency( next, CommandSender::Unspecified );
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/tsrc/inc/t_radiostation.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef T_RADIOSTATION_H_
+#define T_RADIOSTATION_H_
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+#include "radioenginewrapperobserver.h"
+#include "radiostation.h"
+
+class RadioUiEngine;
+class RadioStationModel;
+class RadioPlayLogModel;
+class RadioPresetStorage;
+class RadioEngineWrapper;
+class RadioEngineWrapperObserver;
+
+class TestRadioUiEngine : public QObject, RadioEngineWrapperObserver
+{
+ Q_OBJECT
+
+ /**
+ * Flags to indicate which slots have been entered since calling API method.
+ * Declared to use QFlags<> to ease flag usage and to enforce type safety.
+ */
+ enum SlotEnteredFlag
+ {
+ NoSlotsEntered = 0
+ ,StationDataChanged = 1 << 0
+ ,FavoriteChanged = 1 << 1
+ ,StationAdded = 1 << 2
+ ,DataChanged = 1 << 3
+ ,ItemAdded = 1 << 4
+ };
+ Q_DECLARE_FLAGS( Slots, SlotEnteredFlag )
+
+public:
+
+ TestRadioUiEngine();
+ ~TestRadioUiEngine();
+
+public slots:
+ void dataChanged(const QModelIndex topLeft, const QModelIndex bottomRight);
+ void stationAdded( RadioStation addedStation );
+ void stationDataChanged( RadioStation station );
+ void favoriteChanged( RadioStation station );
+ void itemAdded();
+
+private slots:
+ // test framework called slots
+ void initTestCase();
+ void init();
+ void cleanup();
+ void cleanupTestCase();
+ void testImplicitSharing();
+ void testChangeFlags();
+ void TestCallSignChar();
+ void testPICodeToCallSign();
+ void testRadioStationModel();
+ void testPlayLogModel();
+ void testPlayLogModelItem();
+
+private:
+
+ // from base class RadioEngineWrapperObserver
+ void tunedToFrequency( uint frequency, int commandSender );
+ void seekingStarted( Seeking::Direction direction );
+ void radioStatusChanged( bool radioIsOn );
+ void rdsAvailabilityChanged( bool available );
+ void volumeChanged( int volume );
+ void muteChanged( bool muted );
+ void audioRouteChanged( bool loudspeaker );
+ void scanAndSaveFinished();
+ void headsetStatusChanged( bool connected );
+ void skipPrevious();
+ void skipNext();
+ // subfunctions used by the test framework called slots
+ void testRadioStationModelInit();
+ void testAddStation1();
+ void testSaveStation1();
+ void testAddStation2();
+ void testSaveStation2();
+ void testAddStation3();
+ void testSaveStation3();
+ void testSortByFrequency();
+ void testFindPresetIndex();
+ void testRemoveByFrequency();
+ void testRemoveByPresetIndex();
+ void testRemoveStation();
+
+ void testSetFavorite();
+
+ void testRenameStation();
+ void testSetRadioTextPlus();
+ void testPlayLogModelInit();
+ void testPlayLogModelAddItem();
+ void testPlayLogModelFindItem();
+ void testPlayLogModelUpdateItem();
+ void testPlayLogModelSetData();
+ void testAddRadioTextPlus();
+ void testClearRadioTextPlus();
+ void testRadioPlayLogItem();
+
+private:
+ RadioUiEngine* mUiEngine;
+ QScopedPointer<RadioEngineWrapper> mEngineWrapper;
+ RadioStationModel* mRadioStationModel;
+ RadioPlayLogModel* mPlayLogModel;
+ QScopedPointer<RadioPresetStorage> mPresetStorage;
+ int mExpectedStationCount;
+ /**
+ * Internal book keeping used to determine which slots have been entered since calling RadioStationModel
+ * API method. Used to conclude if the correct signals from RadioStationModel have been received.
+ */
+ Slots mEnteredSlots;
+ QString mStationToBeAdded;
+ QString mStationToBeSaved;
+};
+
+#endif /* T_RADIOSTATION_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/tsrc/src/t_radiostation.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,1014 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: radiostation test implementation
+*
+*/
+
+#define UNIT_TESTS_FOR_10_1
+#ifdef UNIT_TESTS_FOR_10_1
+#include <e32base.h>
+#include <eikenv.h>
+#endif
+#include "t_radiostation.h"
+#include "radiopresetstorage.h"
+#include "radiostation.h"
+#include "radiostationmodel.h"
+#include "radioplaylogmodel.h"
+#include "radioenginewrapper.h"
+#include "radiouiengine.h"
+#include "radiologger.h" //connectAndTest
+
+// Constants
+const uint KTestFrequency1 = 89000000;
+const uint KTestFrequency2 = 89500000;
+const uint KTestFrequency3 = 90000000;
+const uint KTestFrequency4 = 90500000;
+const uint KTestFrequency5 = 91000000;
+const uint KTestFrequency6 = 91500000;
+const uint KTestGenre1 = 1;
+const uint KTestGenre2 = 2;
+const QString KTestStationName1 = "Radio Noice";
+const QString KTestStationName2 = "RN RENAMED";
+const QString KTestUrl1 = "http://qt.nokia.com";
+const QString KTestUrl2 = "http://www.radionoice.com";
+const QString KTestFrequencyString1 = "89000000";
+const QString KTestFrequencyString2 = "89500000";
+const QString KTestFrequencyString3 = "90000000";
+const QString KTestFrequencyString6 = "91500000";
+const QString KTestArtist1 = "Eläkeläiset";
+const QString KTestArtist2 = "Jope";
+const QString KTestArtist3 = "Motorhead";
+const QString KTestTitle1 = "Humppa^2";
+const QString KTestTitle2 = "´åäö´ ^&%¤^";
+const QString KTestTitle3 = "Dancing queen";
+const QString KTestRadioTextRadioText = "NOW! Metallica - Enter sandman in MusicStore for free";
+const QString KTestRadioTextPlusArtist = "Metallica";
+const QString KTestRadioTextPlusTitle = "Enter sandman";
+const QString KTestRadioTextPlusUrl = "www.metallica.com";
+const QString KTestRadioTextPlusUnsupportedTag = "*#*#*#";
+const QString KTestDynamicPSText = "MAKKARAA";
+
+/*!
+ *
+ */
+int main(int /* argc*/, char *argv[])
+{
+ TestRadioUiEngine tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testradiouiengine.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+TestRadioUiEngine::TestRadioUiEngine()
+{
+}
+
+
+void TestRadioUiEngine::tunedToFrequency( uint /* frequency */, int /* commandSender */)
+{
+}
+
+
+void TestRadioUiEngine::seekingStarted( Seeking::Direction /* direction */)
+{
+}
+
+void TestRadioUiEngine::radioStatusChanged( bool /* radioIsOn */)
+{
+}
+
+void TestRadioUiEngine::rdsAvailabilityChanged( bool /* available */)
+{
+}
+
+void TestRadioUiEngine::volumeChanged( int /* volume */)
+{
+}
+
+void TestRadioUiEngine::muteChanged( bool /* muted */)
+{
+}
+
+void TestRadioUiEngine::audioRouteChanged( bool /* loudspeaker */)
+{
+}
+
+void TestRadioUiEngine::scanAndSaveFinished()
+{
+}
+
+
+void TestRadioUiEngine::headsetStatusChanged( bool /* connected */)
+{
+}
+
+void TestRadioUiEngine::skipPrevious()
+{
+}
+
+void TestRadioUiEngine::skipNext()
+{
+}
+
+/*!
+ * Destructor
+ */
+TestRadioUiEngine::~TestRadioUiEngine()
+{
+ delete mRadioStationModel;
+ delete mUiEngine;
+}
+
+/*!
+ * called before each testfunction is executed
+ */
+void TestRadioUiEngine::init()
+{
+}
+
+/*!
+ * called after every testfunction
+ */
+void TestRadioUiEngine::cleanup()
+{
+}
+
+/*!
+ * called before the first testfunction is executed
+ */
+void TestRadioUiEngine::initTestCase()
+{
+#ifdef UNIT_TESTS_FOR_10_1
+// Workaround for the below panic, occured after porting to 10.1
+// Main Panic E32USER-CBase 44
+// Create and install the active scheduler
+ CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
+ CleanupStack::PushL(scheduler);
+ CActiveScheduler::Install(scheduler);
+// CCoeEnv::Static() call in CRadioEngineTls returns NULL
+ CCoeEnv* env = new CCoeEnv;
+#endif
+ mUiEngine = new RadioUiEngine;
+ mRadioStationModel = new RadioStationModel( *mUiEngine );
+ mPlayLogModel = new RadioPlayLogModel( *mUiEngine );
+
+ mEngineWrapper.reset( new RadioEngineWrapper( mRadioStationModel->stationHandlerIf(), *this ) );
+ mPresetStorage.reset( new RadioPresetStorage() );
+ mRadioStationModel->initialize( mPresetStorage.data(), mEngineWrapper.data() );
+
+ //TODO:: Check why ASSERT fails when mModel->rowCount() == 0
+ if(mRadioStationModel->rowCount()>0)
+ {
+ mRadioStationModel->removeAll(); //ASSERT: \"last >= first\" in file qabstractitemmodel.cpp, line 2110
+ }
+
+ connectAndTest( mRadioStationModel, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)),
+ this, SLOT(dataChanged(const QModelIndex, const QModelIndex)) );
+
+ connectAndTest( mRadioStationModel, SIGNAL(stationAdded(RadioStation)),
+ this, SLOT(stationAdded(RadioStation)) );
+
+ connectAndTest( mRadioStationModel, SIGNAL(stationDataChanged(RadioStation)),
+ this, SLOT(stationDataChanged(RadioStation)) );
+
+ connectAndTest( mRadioStationModel, SIGNAL(favoriteChanged(RadioStation)),
+ this, SLOT(favoriteChanged(RadioStation)) );
+
+ connectAndTest( mPlayLogModel, SIGNAL(itemAdded()),
+ this, SLOT(itemAdded()) );
+}
+
+/*!
+ * called after the last testfunction was executed
+ */
+void TestRadioUiEngine::cleanupTestCase()
+{
+ delete mRadioStationModel;
+ delete mUiEngine;
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::dataChanged(const QModelIndex /* topLeft */, const QModelIndex /* bottomRight */)
+{
+ mEnteredSlots |= DataChanged;
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::stationDataChanged( RadioStation /* addedStation */ )
+{
+ mEnteredSlots |= StationDataChanged;
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::favoriteChanged( RadioStation /* addedStation */)
+{
+ mEnteredSlots |= FavoriteChanged;
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::itemAdded()
+{
+ mEnteredSlots |= ItemAdded;
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::stationAdded( RadioStation addedStation )
+{
+ mEnteredSlots |= StationAdded;
+
+ QVERIFY2(( mStationToBeAdded == addedStation.name() ), "API:RadioStationModel stationAdded 1");
+ QVERIFY2(( mExpectedStationCount == mRadioStationModel->rowCount() ), "API:RadioStationModel stationAdded 2");
+}
+
+
+/*!
+ * Testing of implicit sharing a.k.a. copy-on-write
+ */
+void TestRadioUiEngine::testImplicitSharing()
+{
+ RadioStation t_RadioStation_1;
+
+ int originalPresetIndex = t_RadioStation_1.presetIndex();
+ // before any values assigned into any data field
+ QVERIFY2(( originalPresetIndex == RadioStation::SharedNull ), "API:Radiostation init failed 1");
+ t_RadioStation_1.setName("Noice");
+ originalPresetIndex = t_RadioStation_1.presetIndex();
+ // once some value assigned into some other data field
+ QVERIFY2(( originalPresetIndex == RadioStation::Invalid ), "API:Radiostation init failed 2");
+
+ t_RadioStation_1.setFrequency( KTestFrequency1 );
+ //const int newIndex = mModel->findUnusedPresetIndex();
+ t_RadioStation_1.setPresetIndex( 2 );
+ t_RadioStation_1.setGenre(1);
+ t_RadioStation_1.setUrl("http://qt.nokia.com");
+
+ RadioStation* t_RadioStation_2 = new RadioStation(t_RadioStation_1);
+ // test that changing the content of copied data doesn't cause
+ // detach in the copying data structure
+ uint originalFrequency = t_RadioStation_1.frequency();
+ t_RadioStation_1.setFrequency( originalFrequency + 1 );
+ // should be detached
+ bool detached = t_RadioStation_2->isDetached();
+ QVERIFY2(detached, "API:Radiostation Implicit sharing/ freq 1");
+
+ // test that changing the content of data sets detach true
+ originalFrequency = t_RadioStation_2->frequency();
+ t_RadioStation_2->setFrequency( originalFrequency + 1 );
+ // should be detached
+ detached = t_RadioStation_2->isDetached();
+ QVERIFY2(detached, "API:Radiostation Implicit sharing/ freq 2");
+ delete t_RadioStation_2;
+ t_RadioStation_2 = NULL;
+
+ //-------------------------------------------------------------------------
+ // test that changing the content of copied data doesn't cause
+ // detach in the copying data structure
+ t_RadioStation_2 = new RadioStation(t_RadioStation_1);
+ // should not be detached
+ detached = t_RadioStation_2->isDetached();
+ QVERIFY2(!detached, "API:Radiostation Implicit sharing/ preset index 1");
+ originalPresetIndex = t_RadioStation_1.presetIndex();
+ t_RadioStation_1.setPresetIndex( originalPresetIndex + 1 );
+ // should be detached
+ detached = t_RadioStation_2->isDetached();
+ QVERIFY2(detached, "API:Radiostation Implicit sharing/ preset index 2");
+
+ // test that changing the content of data sets detach true
+ originalPresetIndex = t_RadioStation_2->presetIndex();
+ //newIndex = mModel->findUnusedPresetIndex();
+ t_RadioStation_2->setPresetIndex( originalPresetIndex + 1 );
+ // should be detached
+ detached = t_RadioStation_2->isDetached();
+ QVERIFY2(detached, "API:Radiostation Implicit sharing/ preset index 3");
+ delete t_RadioStation_2;
+ t_RadioStation_2 = NULL;
+
+ // test that changing the content of copied data doesn't cause
+ // detach in the copying data structure
+ t_RadioStation_2 = new RadioStation(t_RadioStation_1);
+ // should not be detached
+ detached = t_RadioStation_2->isDetached();
+ QVERIFY2(!detached, "API:Radiostation Implicit sharing/ name 1");
+ //QString originalName = t_RadioStation_1.name();
+ t_RadioStation_1.setName("RadioOne");
+ // should be detached
+ detached = t_RadioStation_2->isDetached();
+ QVERIFY2(detached, "API:Radiostation Implicit sharing/ name 2");
+ // test that changing the content of data sets detach true
+ t_RadioStation_2->setName("RadioTwo");
+ // should be detached
+ detached = t_RadioStation_2->isDetached();
+ QVERIFY2(detached, "API:Radiostation Implicit sharing/ name 3");
+}
+
+/*!
+ * Testing of change flags set by RadioStation class
+ */
+void TestRadioUiEngine::testChangeFlags()
+{
+ RadioStation t_RadioStation;
+
+ QVERIFY2(!t_RadioStation.isValid(), "API:Radiostation Init failure");
+ t_RadioStation.setUserDefinedName("");
+ t_RadioStation.setUserDefinedName("Radio Noice");
+ t_RadioStation.setFrequency( KTestFrequency1 );
+ //const int newIndex = mModel->findUnusedPresetIndex();
+ t_RadioStation.setPresetIndex( 2 );
+ t_RadioStation.setGenre( KTestGenre1 );
+ t_RadioStation.setUrl( KTestUrl1 );
+
+ t_RadioStation.resetChangeFlags();
+ bool persistentDataChanged = t_RadioStation.hasDataChanged( RadioStation::PersistentDataChanged );
+ QVERIFY2(!persistentDataChanged, "API:Radiostation Change flags/ PersistentDataChanged 1");
+ t_RadioStation.setUserDefinedName("Radio Noice+");
+ bool nameChanged = t_RadioStation.hasDataChanged( RadioStation::NameChanged );
+ QVERIFY2(nameChanged, "API:Radiostation Change flags/ NameChanged");
+ persistentDataChanged = t_RadioStation.hasDataChanged( RadioStation::PersistentDataChanged );
+ QVERIFY2(persistentDataChanged, "API:Radiostation Change flags/ PersistentDataChanged 2");
+ t_RadioStation.resetChangeFlags();
+
+ uint originalGenre = t_RadioStation.genre();
+ t_RadioStation.setGenre( originalGenre + 1 );
+ bool genreChanged = t_RadioStation.hasDataChanged( RadioStation::GenreChanged );
+ QVERIFY2(genreChanged, "API:Radiostation Change flags/ GenreChanged");
+ persistentDataChanged = t_RadioStation.hasDataChanged( RadioStation::PersistentDataChanged );
+ QVERIFY2(persistentDataChanged, "API:Radiostation Change flags/ PersistentDataChanged 3");
+ t_RadioStation.resetChangeFlags();
+
+ QString originalUrl = t_RadioStation.url();
+ t_RadioStation.setUrl(originalUrl);
+ // previous url set so no url or persistent data change flags should be set
+ bool urlChanged = t_RadioStation.hasDataChanged( RadioStation::UrlChanged );
+ QVERIFY2(!urlChanged, "API:Radiostation Change flags/ UrlChanged");
+ persistentDataChanged = t_RadioStation.hasDataChanged( RadioStation::PersistentDataChanged );
+ QVERIFY2(!persistentDataChanged, "API:Radiostation Change flags/ PersistentDataChanged 4");
+ t_RadioStation.resetChangeFlags();
+
+ QString originalRadioText = t_RadioStation.radioText();
+ t_RadioStation.setRadioText( originalRadioText + "buy sausage" );
+ bool radioTextChanged = t_RadioStation.hasDataChanged( RadioStation::RadioTextChanged );
+ QVERIFY2(radioTextChanged, "API:Radiostation Change flags/ RadioTextChanged");
+ // radio text not stored into cenrep
+ persistentDataChanged = t_RadioStation.hasDataChanged( RadioStation::PersistentDataChanged );
+ QVERIFY2(!persistentDataChanged, "API:Radiostation Change flags/ PersistentDataChanged 5");
+ t_RadioStation.resetChangeFlags();
+ t_RadioStation.setRadioText( t_RadioStation.radioText() );
+ // because current radio text is reset change flags must not be affected
+ radioTextChanged = t_RadioStation.hasDataChanged( RadioStation::RadioTextChanged );
+ QVERIFY2(!radioTextChanged, "API:Radiostation Change flags/ RadioTextChanged");
+ t_RadioStation.resetChangeFlags();
+
+ QVERIFY2((t_RadioStation.psType()==RadioStation::Unknown), "API:Radiostation PS type check");
+ t_RadioStation.setPsType( RadioStation::Dynamic );
+ bool psTypeChanged = t_RadioStation.hasDataChanged( RadioStation::PsTypeChanged );
+ QVERIFY2(psTypeChanged, "API:Radiostation Change flags/ PsTypeChanged");
+ persistentDataChanged = t_RadioStation.hasDataChanged( RadioStation::PersistentDataChanged );
+ // PS type not stored as persistent data
+ QVERIFY2(!persistentDataChanged, "API:Radiostation Change flags/ PersistentDataChanged 6");
+ t_RadioStation.resetChangeFlags();
+
+ t_RadioStation.setFavorite(t_RadioStation.isFavorite());
+ bool favouriteChanged = t_RadioStation.hasDataChanged( RadioStation::FavoriteChanged );
+ QVERIFY2(!favouriteChanged, "API:Radiostation Change flags/ FavoriteChanged");
+ persistentDataChanged = t_RadioStation.hasDataChanged( RadioStation::PersistentDataChanged );
+ QVERIFY2(!persistentDataChanged, "API:Radiostation Change flags/ PersistentDataChanged 7");
+ t_RadioStation.resetChangeFlags();
+
+ // initially there should not be PI code defined
+ QVERIFY2(!t_RadioStation.hasPiCode(), "API:Radiostation Pi code check");
+ // non-clear channel
+ t_RadioStation.setPiCode(0xC004, RadioRegion::Default); //88.1 CBEE-FM - Chatham, ON
+ bool piCodeChanged = t_RadioStation.hasDataChanged( RadioStation::PiCodeChanged );
+ QVERIFY2(piCodeChanged, "API:Radiostation Change flags/ PiCodeChanged");
+ persistentDataChanged = t_RadioStation.hasDataChanged( RadioStation::PersistentDataChanged );
+ QVERIFY2(persistentDataChanged, "API:Radiostation Change flags/ PersistentDataChanged 8");
+}
+
+/*!
+ * Testing of call sign integer to char conversion
+ */
+void TestRadioUiEngine::TestCallSignChar()
+{
+ for(uint i = 0; i < KLastCallSignCharCode; i++)
+ {
+ RadioStation t_RadioStation;
+ bool passed = t_RadioStation.callSignChar(i) == static_cast<char>( 'A' + i );
+ QVERIFY2(passed, "API:Radiostation TestCallSignChar 1");
+ }
+ RadioStation t_RadioStation;
+ bool passed = t_RadioStation.callSignChar(KLastCallSignCharCode + 1) == static_cast<char>( '?' );
+ QVERIFY2(passed, "API:Radiostation TestCallSignChar 2");
+}
+
+/*!
+ * Testing of PI code to call sign conversion
+ */
+void TestRadioUiEngine::testPICodeToCallSign()
+{
+ RadioStation t_RadioStation;
+
+ // boundary values, two typical values and three chars call sign case
+ QString callSign = t_RadioStation.piCodeToCallSign( KKxxxCallSignPiFirst - 1 );
+ QVERIFY2((callSign==""), "API:Radiostation Call sign <");
+ callSign = t_RadioStation.piCodeToCallSign( KKxxxCallSignPiFirst );
+ QVERIFY2((callSign=="KAAA"), "API:Radiostation Call sign KAAA");
+ callSign = t_RadioStation.piCodeToCallSign( 0x243F );
+ QVERIFY2((callSign=="KHRJ"), "API:Radiostation Call sign KHRJ");
+ callSign = t_RadioStation.piCodeToCallSign( KWxxxCallSignPiFirst - 1 );
+ QVERIFY2((callSign=="KZZZ"), "API:Radiostation Call sign KZZZ");
+ callSign = t_RadioStation.piCodeToCallSign( KWxxxCallSignPiFirst );
+ QVERIFY2((callSign=="WAAA"), "API:Radiostation Call sign WAAA");
+ callSign = t_RadioStation.piCodeToCallSign( 0x74B9 );
+ QVERIFY2((callSign=="WMDT"), "API:Radiostation Call sign WMDT");
+ callSign = t_RadioStation.piCodeToCallSign( KWxxxCallSignPiLast );
+ QVERIFY2((callSign=="WZZZ"), "API:Radiostation Call sign WZZZ");
+ callSign = t_RadioStation.piCodeToCallSign( KWxxxCallSignPiLast + 1 );
+ QVERIFY2((callSign=="KEX"), "API:Radiostation Call sign KEX");
+ callSign = t_RadioStation.piCodeToCallSign( 0x99B5 );
+ QVERIFY2((callSign=="WJZ"), "API:Radiostation Call sign WJZ");
+ callSign = t_RadioStation.piCodeToCallSign( 0x99C0 );
+ QVERIFY2((callSign==""), "API:Radiostation Call sign ????");
+}
+
+/*!
+ * Testing of RadioStationModel initial state
+ */
+void TestRadioUiEngine::testRadioStationModelInit()
+{
+ //TODO:: Check why ASSERT fails when mModel->rowCount() == 0
+ if( mRadioStationModel->rowCount()>0 )
+ {
+ mRadioStationModel->removeAll();
+ QVERIFY2((mRadioStationModel->rowCount()==0), "API:RadioStationModel removeAll()");
+ }
+
+ RadioStation foundStation;
+ // no stations in the model in this phase
+ QVERIFY2(!(mRadioStationModel->findFrequency( KTestFrequency1, foundStation )),
+ "API:RadioStationModel findFrequency 1");
+}
+
+/*!
+ * Testing of RadioStationModel addStation method and resulting RadioStationModel signals
+ */
+void TestRadioUiEngine::testAddStation1()
+{
+ RadioStation station;
+ station.setFrequency( KTestFrequency1 );
+ station.setFrequency( KTestFrequency1 );
+ station.setGenre( KTestGenre1 );
+ station.setGenre( KTestGenre1 );
+ station.setUrl( KTestUrl1 );
+ station.setType( RadioStation::LocalStation );
+ station.setType( RadioStation::LocalStation );
+ station.setName("");
+ station.setName( KTestStationName1 );
+ station.setDynamicPsText( KTestDynamicPSText );
+ station.setPiCode( 0xC004, RadioRegion::America ); //88.1 CBEE-FM - Chatham, ON
+ QVERIFY2(!(station.dynamicPsText().compare(KTestDynamicPSText)), "API:RadioStationModel addStation 1");
+ station.setDynamicPsText( KTestDynamicPSText );
+ // check that adding station increases model row count
+ mExpectedStationCount = mRadioStationModel->rowCount() + 1;
+ mStationToBeAdded = station.name();
+ mRadioStationModel->addStation( station );
+ QVERIFY2((mRadioStationModel->rowCount()==mExpectedStationCount), "API:RadioStationModel addStation 2");
+ bool correctSignalsReceived = mEnteredSlots.testFlag( StationDataChanged ) &&
+ mEnteredSlots.testFlag( StationAdded ) && mEnteredSlots.testFlag( DataChanged );
+
+ bool frequencyUpdated = station.frequencyMhz().toDouble()*1000000 == KTestFrequency1;
+ QVERIFY2(frequencyUpdated, "API:RadioStationModel addStation 1");
+ // check that correct signals received
+ QVERIFY2(correctSignalsReceived, "API:RadioStationModel addStation 3");
+ mEnteredSlots = NoSlotsEntered;
+
+ // check that added station can be found by frequency
+ QModelIndex index = mRadioStationModel->modelIndexFromFrequency( KTestFrequency1 );
+ QVariant stationData = mRadioStationModel->data( index, Qt::DisplayRole );
+ QString stationName = stationData.toString().right( KTestStationName1.length() );
+ QVERIFY2(!(stationName.compare(KTestStationName1)), "API:RadioStationModel modelIndexFromFrequency");
+}
+
+/*!
+ * Testing of RadioStationModel saveStation method and resulting RadioStationModel signals
+ */
+void TestRadioUiEngine::testSaveStation1()
+{
+ RadioStation newStation1;
+ // check that find by frequency works
+ // this is needed for preset index to be updated into newStation1
+ QVERIFY2((mRadioStationModel->findFrequency( KTestFrequency1, newStation1 )),
+ "API:RadioStationModel findFrequency 2");
+ newStation1.setType( RadioStation::Favorite );
+ mRadioStationModel->saveStation( newStation1 );
+ bool correctSignalsReceived = mEnteredSlots.testFlag( StationDataChanged ) &&
+ mEnteredSlots.testFlag( FavoriteChanged ) && mEnteredSlots.testFlag( DataChanged );;
+ QVERIFY2(correctSignalsReceived, "API:RadioStationModel saveStation 1");
+
+ newStation1.setGenre(newStation1.genre()+1);
+ mRadioStationModel->saveStation( newStation1 );
+ correctSignalsReceived = mEnteredSlots.testFlag( StationDataChanged ) && mEnteredSlots.testFlag( DataChanged );
+ // check that correct signals received
+ QVERIFY2(correctSignalsReceived, "API:RadioStationModel saveStation 2");
+}
+
+/*!
+ * Testing of RadioStationModel addStation method and rowCount methods
+ */
+void TestRadioUiEngine::testAddStation2()
+{
+ RadioStation newStation2;
+ newStation2.setFrequency( KTestFrequency2 );
+ QVERIFY2(!newStation2.hasRds(), "API:RadioStationModel addStation 1");
+ newStation2.setGenre( KTestGenre2 );
+ // setting genre should set this true
+ QVERIFY2(newStation2.hasRds(), "API:RadioStationModel addStation 2");
+ newStation2.setUrl( KTestUrl2 );
+ newStation2.setType( RadioStation::LocalStation | RadioStation::Favorite );
+ newStation2.setName("Radio ice");
+ // check that adding station increases model row count
+ mExpectedStationCount = mRadioStationModel->rowCount()+1;
+ mStationToBeAdded = newStation2.name();
+ mRadioStationModel->addStation( newStation2 );
+
+ QVERIFY2((mRadioStationModel->rowCount()==mExpectedStationCount), "API:RadioStationModel addStation 3");
+ mEnteredSlots = NoSlotsEntered;
+}
+
+/*!
+ * Testing of RadioStationModel saveStation method special cases
+ */
+void TestRadioUiEngine::testSaveStation2()
+{
+ RadioStation newStation1;
+ // this is needed for preset index to be updated into newStation1
+ QVERIFY2((mRadioStationModel->findFrequency( KTestFrequency1, newStation1 )),
+ "API:RadioStationModel findFrequency 2");
+
+ newStation1.setFrequency( KTestFrequency2 );
+ mExpectedStationCount = mRadioStationModel->rowCount();
+ // updating existing station data must not increase station count
+ mRadioStationModel->saveStation( newStation1 );
+ QVERIFY2((mRadioStationModel->rowCount()==mExpectedStationCount), "API:RadioStationModel saveStation 1");
+ // because frequency tried to be updated no signals should be received either
+ bool correctSignalsReceived = mEnteredSlots.testFlag( NoSlotsEntered );
+ QVERIFY2(correctSignalsReceived, "API:RadioStationModel saveStation 2");
+ mEnteredSlots = NoSlotsEntered;
+
+ // original frequency resumed
+ newStation1.setFrequency( KTestFrequency1 );
+ newStation1.setGenre(newStation1.genre()+1);
+ mExpectedStationCount = mRadioStationModel->rowCount();
+ // now that frequency resumed signal should be received also
+ mRadioStationModel->saveStation( newStation1 );
+ correctSignalsReceived = mEnteredSlots.testFlag( StationDataChanged ) && mEnteredSlots.testFlag( DataChanged );
+ QVERIFY2(correctSignalsReceived, "API:RadioStationModel saveStation 3");
+ // updating existing station data must not increase station count
+ QVERIFY2((mRadioStationModel->rowCount()==mExpectedStationCount), "API:RadioStationModel saveStation 2");
+
+ mExpectedStationCount = mRadioStationModel->rowCount();
+ mStationToBeAdded = newStation1.name();
+ // adding station must fail because the frequency is the same as previously used frequency
+ mRadioStationModel->addStation( newStation1 );
+ QVERIFY2((mRadioStationModel->rowCount()==mExpectedStationCount), "API:RadioStationModel addStation 3");
+}
+
+/*!
+ * Testing of RadioStationModel addStation method special cases
+ */
+void TestRadioUiEngine::testAddStation3()
+{
+ RadioStation newStation3;
+ newStation3.setFrequency( KTestFrequency2 );
+ newStation3.setGenre(3);
+ newStation3.setUrl("http://www.radio4noice.com");
+ newStation3.setType( RadioStation::LocalStation | RadioStation::Favorite );
+ newStation3.setName("Radio e");
+ // adding station must fail because frequency is the same as previously used frequency
+ mExpectedStationCount = mRadioStationModel->rowCount();
+ mStationToBeAdded = newStation3.name();
+ mRadioStationModel->addStation( newStation3 );
+ QVERIFY2((mRadioStationModel->rowCount()==mExpectedStationCount), "API:RadioStationModel addStation 4");
+ // adding station must success because the station frequency is different now
+ newStation3.setFrequency( KTestFrequency2 + 1 );
+ mExpectedStationCount = mRadioStationModel->rowCount() + 1;
+ mRadioStationModel->addStation( newStation3 );
+ QVERIFY2((mRadioStationModel->rowCount()==mExpectedStationCount), "API:RadioStationModel addStation 5");
+ // test that station can be found by frequency range
+ QList<RadioStation> stations;
+ stations = mRadioStationModel->stationsInRange( KTestFrequency1, KTestFrequency3 );
+ QVERIFY2((stations.count()==3), "API:RadioStationModel stationsInRange");
+}
+
+/*!
+ * Testing of RadioStationModel saveStation method special cases
+ */
+void TestRadioUiEngine::testSaveStation3()
+{
+ RadioStation newStation3;
+ RadioStation foundStation;
+ QVERIFY2(mRadioStationModel->findFrequency( KTestFrequency2 + 1, newStation3 ),
+ "API:RadioStationModel findFrequency 4");
+
+ newStation3.setFrequency( KTestFrequency3 );
+ // because frequency or preset index don't have change flag the frequency must not be updated
+ mRadioStationModel->saveStation( newStation3 );
+
+ QVERIFY2(!(mRadioStationModel->findFrequency( KTestFrequency3, foundStation )),
+ "API:RadioStationModel findFrequency 3");
+
+ int stationGenre;
+ stationGenre = newStation3.genre();
+ newStation3.setGenre( newStation3.genre() + 1 );
+ // allthough genre changed so the frequency update must not become effective
+ mRadioStationModel->saveStation( newStation3 );
+
+ QVERIFY2(!(mRadioStationModel->findFrequency( KTestFrequency3, foundStation )),
+ "API:RadioStationModel findFrequency 4");
+
+
+ mEnteredSlots = NoSlotsEntered;
+ foreach( const RadioStation& station, mRadioStationModel->list() )
+ {
+ if ( station.frequency() == KTestFrequency2 )
+ {
+ mRadioStationModel->setFavoriteByFrequency( KTestFrequency2, !station.isFavorite() );
+ }
+ }
+ bool correctSignalsReceived = mEnteredSlots.testFlag( StationDataChanged ) &&
+ mEnteredSlots.testFlag( FavoriteChanged ) && mEnteredSlots.testFlag( DataChanged );
+ QVERIFY2(correctSignalsReceived, "API:RadioStationModel findFrequency 5");
+}
+
+
+
+/*!
+ * Test that stations are stored into RadioStationModel in ascending frequency order
+ */
+void TestRadioUiEngine::testSortByFrequency()
+{
+ int role = RadioStationModel::RadioStationRole;
+ int previousFrequency(0); // int not initialized zero as default
+
+ for (int i = 0; i< mRadioStationModel->rowCount(); i++ )
+ {
+ QModelIndex index = mRadioStationModel->index( i, 0 );
+ QVariant stationData = mRadioStationModel->data( index, role );
+ RadioStation station = stationData.value<RadioStation>();
+ // stations must be obtainded at ascending frequency order
+ QVERIFY2((station.frequency()>previousFrequency), "API:RadioStationModel testSortByFrequency");
+ previousFrequency = station.frequency();
+ }
+}
+
+/*!
+ * Test that preset indexes match
+ */
+void TestRadioUiEngine::testFindPresetIndex()
+{
+ RadioStation station;
+ for (int i = 0; i< mRadioStationModel->rowCount(); i++ )
+ {
+ QVERIFY2((mRadioStationModel->findPresetIndex(i) != RadioStation::NotFound),
+ "API:RadioStationModel testFindPresetIndex 1");
+ QVERIFY2((mRadioStationModel->findPresetIndex( i, station ) != RadioStation::NotFound),
+ "API:RadioStationModel testFindPresetIndex 2");
+ QVERIFY2((station.presetIndex() == i), "API:RadioStationModel testFindPresetIndex 3");
+ }
+}
+
+/*!
+ * Test that preset can be removed from model by frequency
+ */
+void TestRadioUiEngine::testRemoveByFrequency()
+{
+ RadioStation station;
+ int initialStationCount( mRadioStationModel->rowCount() );
+ int presetIndex(0);
+
+ // find valid preset index
+ for(int i = 0; i<mRadioStationModel->rowCount(); i++)
+ {
+ presetIndex = mRadioStationModel->findPresetIndex( i, station );
+ if(presetIndex!=RadioStation::NotFound)
+ break;
+ }
+ QVERIFY2((presetIndex != RadioStation::NotFound), "API:RadioStationModel testRemoveByFrequency 1");
+
+ mRadioStationModel->removeByFrequency( station.frequency() );
+ QVERIFY2((mRadioStationModel->rowCount()==(initialStationCount-1)), "API:RadioStationModel testRemoveByFrequency 2");
+}
+
+/*!
+ * Test that station can be removed from model by preset index
+ */
+void TestRadioUiEngine::testRemoveByPresetIndex()
+{
+ RadioStation station;
+ station.setFrequency( KTestFrequency4 );
+ mStationToBeAdded = "";
+ mExpectedStationCount = mRadioStationModel->rowCount() + 1;
+ mRadioStationModel->addStation( station );
+ // for updating station preset index
+ QVERIFY2((mRadioStationModel->findFrequency( KTestFrequency4, station )),
+ "API:RadioStationModel testRemoveByPresetIndex 1");
+
+ int initialStationCount( mRadioStationModel->rowCount() );
+ mRadioStationModel->removeByPresetIndex( station.presetIndex() );
+ QVERIFY2((mRadioStationModel->rowCount()==(initialStationCount-1)), "API:RadioStationModel testRemoveByPresetIndex 2");
+}
+
+/*!
+ * Test RadioStationModel method removeStation
+ */
+void TestRadioUiEngine::testRemoveStation()
+{
+ RadioStation station;
+ station.setFrequency( KTestFrequency5 );
+ mStationToBeAdded = "";
+ mExpectedStationCount = mRadioStationModel->rowCount() + 1;
+ mRadioStationModel->addStation( station );
+ int initialStationCount( mRadioStationModel->rowCount() );
+ // for updating station preset index
+ QVERIFY2(mRadioStationModel->findFrequency( KTestFrequency5, station ),
+ "API:RadioStationModel testRemoveStation");
+
+ mRadioStationModel->removeStation( station );
+ QVERIFY2((mRadioStationModel->rowCount()==(initialStationCount-1)), "API:RadioStationModel testRemoveStation");
+}
+
+
+/*!
+ * Test setting and unsetting station type favourite
+ */
+void TestRadioUiEngine::testSetFavorite()
+{
+ RadioStation station;
+ station.setFrequency( KTestFrequency6 );
+ station.setType( RadioStation::Favorite );
+ QVERIFY2(station.isFavorite(), "API:RadioStationModel testSetFavorite 1");
+ mRadioStationModel->addStation( station );
+ mEnteredSlots = NoSlotsEntered;
+
+ mRadioStationModel->setFavoriteByFrequency( KTestFrequency6, false );
+ bool correctSignalsReceived = mEnteredSlots.testFlag( StationDataChanged ) &&
+ mEnteredSlots.testFlag( FavoriteChanged ) && mEnteredSlots.testFlag( DataChanged );
+ QVERIFY2(correctSignalsReceived, "API:RadioStationModel testSetFavorite 2");
+
+ mRadioStationModel->findFrequency( KTestFrequency6, station );
+ QVERIFY2(!station.isFavorite(), "API:RadioStationModel testSetFavorite 3");
+ mEnteredSlots = NoSlotsEntered;
+
+ mRadioStationModel->setFavoriteByPreset( station.presetIndex(), true );
+ correctSignalsReceived = mEnteredSlots.testFlag( StationDataChanged ) &&
+ mEnteredSlots.testFlag( FavoriteChanged ) && mEnteredSlots.testFlag( DataChanged );
+ QVERIFY2(correctSignalsReceived, "API:RadioStationModel testSetFavorite 4");
+
+ // test toggling the favorite
+ QModelIndex index = mRadioStationModel->modelIndexFromFrequency( KTestFrequency6 );
+ mRadioStationModel->setData( index, KTestFrequencyString6 ,RadioStationModel::ToggleFavoriteRole);
+ RadioStation station1 = mRadioStationModel->stationAt( index.row() );
+ QVERIFY2(!station1.isFavorite(), "API:RadioStationModel testToggleFavourite");
+
+}
+
+/*!
+ * Test renaming station
+ */
+void TestRadioUiEngine::testRenameStation()
+{
+ RadioStation station;
+ int presetIndex(0);
+ // find valid preset index
+ for( int i = 0; i<mRadioStationModel->rowCount(); i++ )
+ {
+ if( mRadioStationModel->findPresetIndex( i, station ) != RadioStation::NotFound )
+ {
+ presetIndex = i;
+ break;
+ }
+ }
+ QString initialStationName( station.name() );
+ mEnteredSlots = NoSlotsEntered;
+ mRadioStationModel->renameStation( presetIndex, initialStationName + "Renamed" );
+ bool correctSignalsReceived = mEnteredSlots.testFlag( StationDataChanged ) &&
+ mEnteredSlots.testFlag( DataChanged );
+ QVERIFY2(correctSignalsReceived, "API:RadioStationModel testRenameStation 1");
+ QVERIFY2(initialStationName!=mRadioStationModel->stationAt(presetIndex).name(), "API:RadioStationModel testRenameStation 2");
+
+ station.setUserDefinedName( KTestStationName2 );
+ QVERIFY2(station.isRenamed(), "API:RadioStationModel testRenameStation 1");
+
+}
+
+/*!
+ * Test setting radio text
+ */
+void TestRadioUiEngine::testSetRadioTextPlus()
+{
+ RadioStation station;
+ mRadioStationModel->findFrequency( KTestFrequency6, station );
+ station.setRadioText( "" );
+ station.setRadioText( KTestRadioTextRadioText );
+ station.setRadioText( KTestRadioTextRadioText );
+ station.setRadioTextPlus( RtPlus::Artist, KTestRadioTextPlusArtist );
+ station.setRadioTextPlus( RtPlus::Title, KTestRadioTextPlusTitle );
+ station.setRadioTextPlus( RtPlus::Homepage, KTestRadioTextPlusUrl );
+ station.setRadioTextPlus( RtPlus::Homepage + 1, KTestRadioTextPlusUnsupportedTag );
+ mRadioStationModel->saveStation( station );
+ bool effective = station.radioText().contains( KTestRadioTextPlusArtist, Qt::CaseSensitive );
+ QVERIFY2(effective, "API:RadioStationModel testSetRadioTextPlus 1");
+ effective = station.radioText().contains( KTestRadioTextPlusTitle, Qt::CaseSensitive );
+ QVERIFY2(effective, "API:RadioStationModel testSetRadioTextPlus 2");
+ effective = !station.url().compare( KTestRadioTextPlusUrl );
+ QVERIFY2(effective, "API:RadioStationModel testSetRadioTextPlus 3");
+}
+
+/*!
+ * Test RadioStationModel API
+ */
+void TestRadioUiEngine::testRadioStationModel()
+{
+ testRadioStationModelInit();
+ testAddStation1();
+ testSaveStation1();
+ testAddStation2();
+ testSaveStation2();
+ testAddStation3();
+ testSaveStation3();
+ testSortByFrequency();
+ testFindPresetIndex();
+ testRemoveByFrequency();
+ testRemoveByPresetIndex();
+ testRemoveStation();
+ testSetFavorite();
+ testRenameStation();
+ testSetRadioTextPlus();
+}
+/*!
+ * Test RadioPlayLogModel API
+ */
+void TestRadioUiEngine::testPlayLogModel()
+ {
+ testPlayLogModelInit();
+ testPlayLogModelAddItem();
+ testPlayLogModelFindItem();
+ testPlayLogModelUpdateItem();
+ testPlayLogModelSetData();
+ testAddRadioTextPlus();
+ testClearRadioTextPlus();
+ }
+
+/*!
+ * Testing of RadioPlayLogModel initial state
+ */
+void TestRadioUiEngine::testPlayLogModelInit()
+{
+ //TODO:: Check why ASSERT fails when mPlayLogModel->rowCount() == 0
+ if( mPlayLogModel->rowCount()>0 )
+ {
+ mPlayLogModel->removeAll();
+ QVERIFY2((mRadioStationModel->rowCount()==0), "API:RadioPlayLogModel removeAll() 1");
+ }
+ QVERIFY2((mPlayLogModel->rowCount()==0), "API:RadioPlayLogModel removeAll() 2");
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::testPlayLogModelAddItem()
+{
+ int expectedPlayLogItemCount( mPlayLogModel->rowCount() + 1 );
+ mEnteredSlots = NoSlotsEntered;
+ mPlayLogModel->addItem( KTestArtist1, KTestTitle1 );
+ bool correctSignalsReceived = mEnteredSlots.testFlag( ItemAdded );
+ // check that correct signals received
+ QVERIFY2(correctSignalsReceived, "API:RadioPlayLogModel addItem() 1");
+ // check that item count increases
+ QVERIFY2((mPlayLogModel->rowCount()==expectedPlayLogItemCount), "API:RadioPlayLogModel addItem() 2");
+
+ // check that artist/title stored into the model conforms to the one read from the model
+ QModelIndex index = mPlayLogModel->index( 0, 0 );
+ QStringList stringList = mPlayLogModel->data( index, Qt::DisplayRole ).value<QStringList>();
+ QString artistTitle = stringList.at(0);
+ QVERIFY2(!(artistTitle.compare(KTestArtist1+" - "+KTestTitle1)), "API:RadioPlayLogModel addItem() 3");
+
+
+ expectedPlayLogItemCount = mPlayLogModel->rowCount();
+ // trying to add an item that allready exists must not increase the item count
+ mPlayLogModel->addItem( KTestArtist1, KTestTitle1 );
+ QVERIFY2((mPlayLogModel->rowCount()==expectedPlayLogItemCount), "API:RadioPlayLogModel addItem() 4");
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::testPlayLogModelFindItem()
+{
+ RadioPlayLogItem item;
+ mPlayLogModel->findItem( KTestArtist1, KTestTitle1, item );
+ QVERIFY2((item.artist()==KTestArtist1), "API:RadioPlayLogModel findItem() 1");
+ QVERIFY2((item.title()==KTestTitle1), "API:RadioPlayLogModel findItem() 2");
+ // try to find an item that doesn't exist
+ int ret = mPlayLogModel->findItem( KTestArtist1+"+", KTestTitle1, item );
+ QVERIFY2(ret==-1, "API:RadioPlayLogModel findItem() 3");
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::testPlayLogModelUpdateItem()
+{
+ RadioPlayLogItem item;
+ mPlayLogModel->findItem( KTestArtist1, KTestTitle1, item );
+ item.setTitle( KTestTitle2 );
+ // update an existing item
+ mPlayLogModel->updateItem( 0, item, true );
+
+ RadioPlayLogItem foundItem;
+ // original item must not be found any more
+ int ret = mPlayLogModel->findItem(KTestArtist1, KTestTitle1, foundItem);
+ QVERIFY2(ret==-1, "API:RadioPlayLogModel updateItem() 1");
+ // but the updated one instead
+ mPlayLogModel->findItem(KTestArtist1, KTestTitle2, foundItem);
+ QVERIFY2((foundItem.title()==KTestTitle2), "API:RadioPlayLogModel updateItem() 2");
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::testPlayLogModelSetData()
+{
+ RadioPlayLogItem foundItem;
+ mPlayLogModel->findItem(KTestArtist1, KTestTitle2, foundItem);
+ QVERIFY2(!foundItem.isFavorite(), "API:RadioPlayLogModel SetData() 1");
+
+ QModelIndex index = mPlayLogModel->index( 0, 0 );
+ QString artistTitle = KTestArtist1 + KTestTitle2;
+ mPlayLogModel->setData( index, artistTitle, RadioPlayLogModel::SetFavoriteRole );
+ mPlayLogModel->findItem(KTestArtist1, KTestTitle2, foundItem);
+ // item should be now favorite
+ QVERIFY2(foundItem.isFavorite(), "API:RadioPlayLogModel SetData() 2");
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::testAddRadioTextPlus()
+{
+ mPlayLogModel->addRadioTextPlus( RtPlus::Artist, KTestArtist1 );
+ mPlayLogModel->addRadioTextPlus( RtPlus::Title, KTestTitle1 );
+}
+
+/*!
+ *
+ */
+void TestRadioUiEngine::testClearRadioTextPlus()
+{
+ mPlayLogModel->clearRadioTextPlus();
+}
+
+/*!
+ * Test RadioPlayLogModelItem API
+ */
+void TestRadioUiEngine::testPlayLogModelItem()
+{
+ RadioPlayLogItem* item = new RadioPlayLogItem( KTestArtist3, KTestTitle3 );
+ item->setArtist( KTestArtist3 );
+ QVERIFY2(!(item->artist().compare(KTestArtist3)), "API:testPlayLogModelItem setArtist()");
+ item->setTitle( KTestTitle3 );
+ QVERIFY2(!(item->title().compare(KTestTitle3)), "API:testPlayLogModelItem setTitle()");
+ QVERIFY2(!item->isFavorite(), "API:testPlayLogModelItem isFavorite() 1");
+ item->setFavorite();
+ QVERIFY2(item->isFavorite(), "API:testPlayLogModelItem isFavorite() 2");
+ item->setFavorite();
+ delete item;
+ item = NULL;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiouiengine/tsrc/t_radiouiengine.pro Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: project file for radiouiengine tests
+*
+*/
+
+TEMPLATE = app
+TARGET = t_radiouiengine
+
+
+symbian: {
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.SID = 0x101FF976 # Old visual radio uid
+}
+
+
+DEPENDPATH += . \
+ inc \
+ src
+INCLUDEPATH += . \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport \
+ stub/inc \
+ ../../../inc \
+ ../inc \
+ ../../radioenginewrapper/commoninc \
+ ../../radioenginewrapper/inc \
+ ../../radiopresetstorage/inc \
+ ../../../../inc
+
+CONFIG += qtestlib
+
+symbian:LIBS += -lradiouiengine
+symbian:LIBS += -lradioenginewrapper
+symbian:LIBS += -lradiopresetstorage
+
+HEADERS += inc/t_radiostation.h
+SOURCES += src/t_radiostation.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiobannerlabel.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOBANNERLABEL_H_
+#define RADIOBANNERLABEL_H_
+
+// System includes
+#include <hblabel.h>
+
+class RadioBannerLabel : public HbLabel
+{
+ Q_OBJECT
+
+public:
+
+ RadioBannerLabel( QGraphicsItem * parent = 0 );
+
+private:
+
+// from base class QGraphicsItem
+
+ void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget );
+
+};
+
+#endif // RADIOBANNERLABEL_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiocontextmenu.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOCONTEXTMENU_H_
+#define RADIOCONTEXTMENU_H_
+
+// System includes
+#include <hbmenu.h>
+
+// User includes
+#include "radiostation.h"
+
+// Forward declarations
+class RadioUiEngine;
+class RadioStation;
+class RadioXmlUiLoader;
+
+// Class declaration
+class RadioContextMenu : public HbMenu
+{
+ Q_OBJECT
+
+public:
+
+ RadioContextMenu( RadioUiEngine& uiEngine, QGraphicsItem* parent = 0 );
+
+ /*!
+ * Initializes the menu
+ * @param station Reference to the station that the menu handles
+ * @param uiLoader Reference to UI loader
+ */
+ void init( const RadioStation& station, RadioXmlUiLoader& uiLoader );
+ void init( const RadioStation& station, QPointF pos );
+
+private slots:
+
+ void rename();
+ void toggleFavorite();
+ void deleteStation();
+
+private:
+
+// from base class QGraphicsWidget
+
+ void resizeEvent( QGraphicsSceneResizeEvent* event );
+
+private: // data
+
+ /*!
+ * Reference to the UI engine
+ */
+ RadioUiEngine& mUiEngine;
+
+ RadioStation mStation;
+
+ QPointF mPos;
+
+};
+
+#endif // RADIOCONTEXTMENU_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiofadinglabel.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOFADINGLABEL_H
+#define RADIOFADINGLABEL_H
+
+// System includes
+#include <hblabel.h>
+#include <hbeffect.h>
+
+class RadioFadingLabel : public HbLabel
+{
+ Q_OBJECT
+
+public:
+
+ RadioFadingLabel( QGraphicsItem* parent = 0 );
+
+ void setFadingEnabled( bool fading );
+
+ void setTextWithoutFading( const QString& newText );
+
+public slots:
+
+ void setText( const QString& newText );
+
+private slots:
+
+ void effectFinished( HbEffect::EffectStatus status );
+
+private:
+
+ void startEffect( const QString& effectName, const char* slot = 0 );
+
+ QString trimHtml( const QString& text );
+
+private: // data
+
+ QString mTextHolder;
+
+ bool mFadingEnabled;
+
+};
+
+#endif // RADIOFADINGLABEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiofrequencyitem.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOFREQUENCYITEM_H
+#define RADIOFREQUENCYITEM_H
+
+// System includes
+#include <qpixmap>
+
+// Forward declarations
+class RadioFrequencyStrip;
+class QGraphicsPixmapItem;
+
+// Class declaration
+class RadioFrequencyItem
+{
+public:
+
+ RadioFrequencyItem( QString frequency );
+
+ uint frequency() const;
+
+ QPixmap updatePrimitive( QGraphicsPixmapItem* item );
+
+ void setPixmap( QPixmap pixmap );
+
+private: // data
+
+ uint mFrequency;
+
+ QPixmap mPixmap;
+
+ QGraphicsPixmapItem* mGraphicsItem;
+
+};
+
+#endif // RADIOFREQUENCYITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiofrequencyscanner.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPRESETSCANNER_H_
+#define RADIOPRESETSCANNER_H_
+
+// System includes
+#include <qobject>
+
+// Forward declarations
+class HbProgressDialog;
+class RadioStation;
+class RadioUiEngine;
+
+// Class declaration
+class RadioFrequencyScanner : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ RadioFrequencyScanner( RadioUiEngine& uiEngine, QObject* parent = 0 );
+
+ void startScanning();
+
+signals:
+
+ void frequencyScannerFinished();
+
+private slots:
+
+ void updateScanAndSaveProgress( const RadioStation& station );
+ void scanAndSavePresetsCancelled();
+ void scanAndSavePresetsFinished();
+
+private: // data
+
+ /*!
+ * Reference to the Ui engine
+ */
+ RadioUiEngine& mUiEngine;
+
+ /**
+ * Scanning progress note
+ * Own.
+ */
+ HbProgressDialog* mScanningProgressNote;
+
+ /**
+ * Amount of radio stations found
+ */
+ uint mChannelCount;
+
+ /**
+ * Low frequency band edge. The lowest valid frequency at the current region
+ */
+ uint mMinFrequency;
+
+};
+
+#endif // RADIOPRESETSCANNER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiofrequencystrip.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef FREQUENCYSTRIP_H
+#define FREQUENCYSTRIP_H
+
+// System includes
+#include <qmap>
+#include <qhash>
+#include <hbicon.h>
+#include <hbeffect.h>
+
+// User includes
+#include "radiostripbase.h"
+#include "radio_global.h"
+
+// Forward declarations
+class RadioUiEngine;
+class RadioFrequencyItem;
+class RadioStation;
+class HbPushButton;
+class QTimer;
+
+const int KOneHertz = KFrequencyMultiplier;
+const int KHalfHertz = KOneHertz / 2;
+const int KOneTabDistance = 15;
+const uint KOneTabInHz = 0.2 * KOneHertz;
+const qreal KPixelInHz = KOneTabInHz / KOneTabDistance;
+//const int KCharWidth = 8; // TODO: Remove hardcoding
+const int KWidth = KOneTabDistance * 5;
+const int KHeight = 50; //TODO: Remove hardcoding
+
+// Class declaration
+class RadioFrequencyStrip : public RadioStripBase
+{
+ Q_OBJECT
+ Q_PROPERTY( HbIcon leftButtonIcon READ leftButtonIcon WRITE setLeftButtonIcon )
+ Q_PROPERTY( HbIcon rightButtonIcon READ rightButtonIcon WRITE setRightButtonIcon )
+
+ friend class RadioFrequencyItem;
+
+public:
+
+ RadioFrequencyStrip( uint minFrequency,
+ uint maxFrequency,
+ uint stepSize,
+ uint currentFrequency,
+ RadioUiEngine* engine = 0 );
+
+ void setLeftButtonIcon( const HbIcon& leftButtonIcon );
+ HbIcon leftButtonIcon() const;
+
+ void setRightButtonIcon( const HbIcon& rightButtonIcon );
+ HbIcon rightButtonIcon() const;
+
+ uint frequency( bool* favorite = 0 ) const;
+
+ void connectLeftButton( const char* signal, QObject* receiver, const char* slot );
+ void connectRightButton( const char* signal, QObject* receiver, const char* slot );
+
+
+
+public slots:
+
+ void favoriteChanged( const RadioStation& station );
+ void setFrequency( const uint frequency, int commandSender = 0 );
+
+signals:
+
+ void frequencyChanged( uint frequency, int sender ); // sender is always CommandSender::RadioFrequencyStrip
+ void frequencyIsFavorite( bool favorite );
+ void swipedLeft();
+ void swipedRight();
+
+private slots:
+
+ void leftGesture( int speedPixelsPerSecond );
+ void rightGesture( int speedPixelsPerSecond );
+ void panGesture( const QPointF& point );
+ void toggleButtons();
+
+private:
+
+// from base class RadioStripBase
+
+ void updateItemPrimitive( QGraphicsItem* itemToUpdate, int itemIndex );
+ QGraphicsItem* createItemPrimitive( QGraphicsItem *parent );
+ void scrollPosChanged( QPointF newPosition );
+
+// from base class QGraphicsWidget
+
+ void resizeEvent ( QGraphicsSceneResizeEvent* event );
+ void showEvent( QShowEvent* event );
+
+// from base class HbScrollArea
+
+ void mousePressEvent( QGraphicsSceneMouseEvent* event );
+ void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
+
+// virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
+
+// New functions
+
+ void initModel();
+
+ void initSelector();
+
+ void initItems();
+
+ void initButtons();
+
+ void addFrequencyPos( int pos, uint frequency, RadioFrequencyItem* item );
+
+ void updateFavorites( RadioFrequencyItem* item );
+
+ QPixmap drawPixmap( uint frequency, QList<RadioStation> stations, RadioFrequencyItem* item );
+
+ void emitFrequencyChanged( uint frequency );
+
+ void emitFavoriteSelected( bool favoriteSelected );
+
+ int selectorPos() const;
+
+ void scrollToFrequency( uint frequency, int time = 0 );
+
+private: // data
+
+ class FrequencyPos
+ {
+ public:
+ explicit FrequencyPos( int pos, bool favorite, bool localStation, RadioFrequencyItem* item ) :
+ mPosition( pos ),
+ mFavorite( favorite ),
+ mLocalStation( localStation ),
+ mItem( item ) {}
+
+
+ FrequencyPos() :
+ mPosition( 0 ),
+ mFavorite( false ),
+ mLocalStation( false ),
+ mItem( 0 ) {}
+
+ int mPosition;
+ bool mFavorite;
+ bool mLocalStation;
+ RadioFrequencyItem* mItem;
+
+ };
+
+ uint mMinFrequency;
+
+ uint mMaxFrequency;
+
+ uint mFrequencyStepSize;
+
+ RadioUiEngine* mEngine;
+
+ QGraphicsPixmapItem* mSelectorImage;
+
+ qreal mSeparatorPos;
+
+ short mMaxWidth;
+
+ qreal mSelectorPos;
+
+ uint mFrequency;
+
+ QList<RadioFrequencyItem*> mFrequencyItems;
+
+ bool mFavoriteSelected;
+
+ /**
+ * Container to help map a frequency to strip position and additional information about the frequency.
+ * In the default region contains an item for every valid frequency from 87.50 Mhz to 108.00 Mhz with
+ * stepsize 50 Khz which amounts to 410 items.
+ */
+ QMap<uint,FrequencyPos> mFrequencies;
+
+ /**
+ * Container to help map strip position to frequency.
+ * It is queried every time the strip moves so the lookup time needs to be fast. QHash is used because
+ * it offers the fastest lookup time of any other QT container. QHash stores the items in arbitrary
+ * order so we must never try to loop through them and assume they are in any particular order.
+ */
+ QHash<int,uint> mPositions;
+
+ HbIcon mLeftButtonIcon;
+
+ HbIcon mRightButtonIcon;
+
+ HbPushButton* mLeftButton;
+
+ HbPushButton* mRightButton;
+
+ QTimer* mButtonTimer;
+
+ bool mIsPanGesture;
+
+};
+
+#endif // FREQUENCYSTRIP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiomainwindow.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef _RADIOMAINWINDOW_H_
+#define _RADIOMAINWINDOW_H_
+
+// System includes
+#include <hbmainwindow.h>
+#include <hbeffect.h>
+#include <qpointer>
+
+//#define QT_SHAREDPOINTER_TRACK_POINTERS // Debugging support for QSharedPointer
+#include <qsharedpointer>
+
+// User includes
+#include "radiowidgetsexport.h"
+
+// Forward declarations
+class RadioViewBase;
+class RadioUiEngine;
+class HbVolumeSliderPopup;
+
+typedef QSharedPointer<HbVolumeSliderPopup> VolumeSliderPtr;
+
+/**
+ * QPointer is used to store the views because it tracks the deletion of the object and nulls
+ * the reference. Transient views like RadioWizardView and RadioPlayLogView are destroyed after they are closed
+ * and QPointer will notice it.
+ */
+typedef QPointer<RadioViewBase> ViewPtr;
+
+typedef QSharedPointer<HbView> DummyViewPtr;
+
+// Class declaration
+class WIDGETS_DLL_EXPORT RadioMainWindow : public HbMainWindow
+{
+ Q_OBJECT
+ Q_DISABLE_COPY( RadioMainWindow )
+
+public:
+
+ RadioMainWindow( QWidget *parent = 0 );
+
+ ~RadioMainWindow();
+
+ bool isOfflineUsageAllowed();
+
+ void showErrorMessage( const QString& text );
+
+ void init( RadioUiEngine* uiEngine );
+
+ RadioUiEngine& uiEngine();
+
+ QString orientationSection();
+
+public slots:
+
+ void activateTuningView();
+
+ void activateWizardView();
+
+ void activateStationsView();
+
+ void activatePlayLogView();
+
+private slots:
+
+ void updateOrientation( Qt::Orientation orientation );
+ void showVolumeLevel( int volume );
+ void headsetStatusChanged( bool connected );
+
+private:
+
+// New functions
+
+ void activateView( ViewPtr& aMember, const QString& docmlFile );
+
+ DummyViewPtr prepareToShowDialog();
+ void dialogShown( DummyViewPtr pointer );
+
+private: // data
+
+ /*!
+ * Pointer to the UI engine
+ */
+ RadioUiEngine* mUiEngine;
+
+ /**
+ * Tuning view.
+ * Own.
+ */
+ ViewPtr mTuningView;
+
+ /**
+ * Stations view
+ * Own.
+ */
+ ViewPtr mStationsView;
+
+ /**
+ * Wizard view
+ * Own.
+ */
+ ViewPtr mWizardView;
+
+ /**
+ * Play log view
+ * Own.
+ */
+ ViewPtr mPlayLogView;
+
+ /**
+ * Pointer to the volume slider
+ * Own.
+ */
+ VolumeSliderPtr mVolSlider;
+
+};
+
+
+#endif // _RADIOMAINWINDOW_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radioplaylogview.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPLAYLOGVIEW_H
+#define RADIOPLAYLOGVIEW_H
+
+// User includes
+#include "radioviewbase.h"
+#include "radiowidgetsexport.h"
+
+// Forward declarations
+class RadioXmlUiLoader;
+class HbListView;
+
+// Class declaration
+class WIDGETS_DLL_EXPORT RadioPlayLogView : public RadioViewBase
+{
+ Q_OBJECT
+
+public:
+
+ explicit RadioPlayLogView( RadioXmlUiLoader* uiLoader );
+
+private:
+
+// from base class RadioViewBase
+
+ void init( RadioMainWindow* aMainWindow, RadioStationModel* aModel );
+
+private: //data
+
+ HbListView* mPlayLogList;
+
+};
+
+#endif // RADIOPLAYLOGVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiostationcarousel.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATIONCAROUSEL_H
+#define RADIOSTATIONCAROUSEL_H
+
+// System includes
+#include <hbgridview.h>
+#include <hbabstractviewitem.h>
+#include <qmap>
+#include <qabstractitemmodel>
+#include <hbicon.h>
+
+// Forward declarations
+class RadioUiEngine;
+class RadioFadingLabel;
+class HbPushButton;
+class HbAnchorLayout;
+class RadioStation;
+class RadioStationCarousel;
+class RadioStationFilterModel;
+
+// Class declaration
+class RadioStationItem : public HbAbstractViewItem
+{
+ Q_OBJECT
+ friend class RadioStationCarousel;
+
+public:
+
+ RadioStationItem( QGraphicsItem* parent = 0 );
+
+// From base class HbAbstractViewItem
+
+ HbAbstractViewItem* createItem();
+ void updateChildItems();
+
+// New functions
+
+ uint frequency() const;
+
+ void update( const RadioStation* station = 0 );
+
+ void setFrequency( uint frequency );
+ void setSeekingText();
+
+private slots:
+
+ void toggleFavorite();
+
+private:
+
+ void updateFavoriteIcon( bool isFavorite );
+
+ RadioStationCarousel* carousel();
+
+private: // data
+
+ HbAnchorLayout* mLayout;
+ RadioFadingLabel* mNameLabel;
+ HbPushButton* mIconButton;
+ RadioFadingLabel* mGenreLabel;
+ RadioFadingLabel* mRadiotextLabel;
+ uint mFrequency;
+};
+
+// Class declaration
+class RadioStationCarousel : public HbGridView
+{
+ Q_OBJECT
+ Q_PROPERTY(HbIcon background READ background WRITE setBackground)
+
+public:
+
+ RadioStationCarousel( RadioUiEngine& uiEngine, QGraphicsItem* parent = 0 );
+
+ void setBackground( const HbIcon& background );
+ HbIcon background() const;
+
+ RadioUiEngine& uiEngine();
+
+ bool isAntennaAttached() const;
+
+signals:
+
+ void frequencyChanged( uint frequency, int commandSender );
+
+public slots:
+
+ void setFrequency( uint frequency );
+ void setSeekingText();
+ void updateHeadsetStatus( bool connected );
+
+private slots:
+
+ void update( const RadioStation& station );
+ void leftGesture( int speedPixelsPerSecond );
+ void rightGesture( int speedPixelsPerSecond );
+ void insertFrequency( const QModelIndex& parent, int first, int last );
+ void removeFrequency( const QModelIndex& parent, int first, int last );
+ void updateFrequencies();
+ void updateLoopedPos();
+
+private:
+
+// from base class QGraphicsItem
+
+ void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget );
+
+ void mouseMoveEvent( QGraphicsSceneMouseEvent* event );
+ void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
+ void resizeEvent( QGraphicsSceneResizeEvent* event );
+
+ RadioStationItem* currentStationItem();
+
+ RadioStationFilterModel* filterModel() const;
+
+ void scrollToIndex( const QModelIndex& index, int time );
+
+private: // data
+
+ RadioUiEngine& mUiEngine;
+
+ bool mAntennaAttached;
+
+ int mAutoScrollTime;
+
+ qreal mPreviousButtonPos;
+
+ bool mMovingLeft;
+
+ RadioStationItem* mCurrentItem;
+
+ QMap<uint,QModelIndex> mModelIndexes;
+
+ HbIcon mBackground;
+
+};
+
+#endif // RADIOSTATIONCAROUSEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiostationcontrolwidget.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATIONCONTROLWIDGET_H
+#define RADIOSTATIONCONTROLWIDGET_H
+
+// System includes
+#include <hbwidget.h>
+#include <hbicon.h>
+#include <hbeffect.h>
+
+// Forward declarations
+class RadioUiEngine;
+class HbPushButton;
+class RadioXmlUiLoader;
+class RadioMainWindow;
+
+// Class declaration
+class RadioStationControlWidget : public HbWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(HbIcon background READ background WRITE setBackground)
+ Q_PROPERTY(QString tagBtnText READ tagBtnText WRITE setTagBtnText)
+ Q_PROPERTY(QString recognizeBtnText READ recognizeBtnText WRITE setRecognizeBtnText)
+ Q_PROPERTY(QString stationsBtnText READ stationsBtnText WRITE setStationsBtnText)
+
+public:
+
+ RadioStationControlWidget( RadioUiEngine& uiEngine, QGraphicsItem* parent = 0 );
+ ~RadioStationControlWidget();
+
+ void setBackground( const HbIcon& background );
+ HbIcon background() const;
+
+ void setTagBtnText( const QString& text );
+ QString tagBtnText() const;
+
+ void setRecognizeBtnText( const QString& text );
+ QString recognizeBtnText() const;
+
+ void setStationsBtnText( const QString& text );
+ QString stationsBtnText() const;
+
+ void init( RadioMainWindow* aMainWindow );
+
+private slots:
+
+ void updateStationsButton();
+ void recognizePressed();
+ void effectFinished( HbEffect::EffectStatus status );
+ void disableTagButton();
+ void enableTagButton();
+
+private:
+
+// from base class QGraphicsItem
+
+ void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget );
+
+// New functions
+
+private: // data
+
+ RadioUiEngine& mUiEngine;
+
+ HbIcon mBackground;
+ HbPushButton* mTagSongButton;
+ HbPushButton* mRecognizeButton;
+ HbPushButton* mStationsViewButton;
+
+ RadioMainWindow* mMainWindow;
+
+};
+
+#endif // RADIOSTATIONCONTROLWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiostationsview.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTATIONSVIEW_H
+#define RADIOSTATIONSVIEW_H
+
+// System includes
+#include <hbicon.h>
+
+// User includes
+#include "radioviewbase.h"
+#include "radiowidgetsexport.h"
+
+// Forward declarations
+class RadioMainWindow;
+class RadioStationModel;
+class HbListView;
+class HbPushButton;
+class RadioBannerLabel;
+class HbAbstractViewItem;
+class RadioXmlUiLoader;
+class RadioStation;
+class RadioStationFilterModel;
+
+// Class declaration
+class WIDGETS_DLL_EXPORT RadioStationsView : public RadioViewBase
+{
+ Q_OBJECT
+ Q_PROPERTY(HbIcon nowPlayingIcon READ nowPlayingIcon WRITE setNowPlayingIcon)
+ Q_PROPERTY(HbIcon favoriteIcon READ favoriteIcon WRITE setFavoriteIcon)
+
+public:
+
+ explicit RadioStationsView( RadioXmlUiLoader* uiLoader );
+
+ void setNowPlayingIcon( const HbIcon& nowPlayingIcon );
+ HbIcon nowPlayingIcon() const;
+
+ void setFavoriteIcon( const HbIcon& favoriteIcon );
+ HbIcon favoriteIcon() const;
+
+private slots:
+
+ void listItemClicked( const QModelIndex& index );
+ void listItemLongPressed( HbAbstractViewItem* item, const QPointF& coords );
+ void updateHeadsetStatus( bool connected );
+ void updateCurrentStation();
+ void deckButtonPressed();
+ void startScanAndSavePresets();
+ void updateControlVisibilities();
+
+private:
+
+// from base class RadioViewBase
+
+ void init( RadioMainWindow* aMainWindow, RadioStationModel* aModel );
+
+// from base class QGraphicsWidget
+
+ void showEvent( QShowEvent* event );
+
+// New functions
+
+ void initListView();
+
+ void updateHeading();
+
+private: //data
+
+ RadioStationFilterModel* mFilterModel;
+
+ HbAction* mScanStationsAction;
+ HbAction* mRemoveAllPresetsAction;
+
+ HbListView* mStationsList;
+
+ RadioBannerLabel* mHeadingBanner;
+
+ HbAction* mFavoritesButton;
+ HbAction* mLocalStationsButton;
+
+ HbIcon mFavoriteIcon;
+
+ HbIcon mNowPlayingIcon;
+
+};
+
+#endif // RADIOSTATIONSVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiostripbase.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSTRIPBASE_H_
+#define RADIOSTRIPBASE_H_
+
+// System includes
+#include <hbscrollarea.h>
+
+// Forward declarations
+class HbWidget;
+class QAbstractItemModel;
+
+// Class declaration
+class RadioStripBase : public HbScrollArea
+{
+ Q_OBJECT
+ Q_PROPERTY( HbIcon background READ background WRITE setBackground )
+ Q_PROPERTY( int autoScrollTime READ autoScrollTime WRITE setAutoScrollTime )
+
+public:
+
+ virtual ~RadioStripBase();
+
+ void setBackground( const HbIcon& background );
+ HbIcon background() const;
+ void setAutoScrollTime( const int time );
+ int autoScrollTime() const;
+
+ void setModel( QAbstractItemModel* model );
+ QAbstractItemModel* model() const;
+
+ void setCyclic( bool isCyclic );
+ void setSpacing( qreal spacing );
+ void setAutoCenter( bool autoCenter );
+ void setItemSize( const QSizeF& size );
+ void setIndex( int index, bool animateToCenter );
+
+protected:
+
+ RadioStripBase( QGraphicsItem* parent );
+
+// from base class QGraphicsWidget
+
+ void resizeEvent( QGraphicsSceneResizeEvent* event );
+
+// from base class QGraphicsItem
+
+ void mousePressEvent( QGraphicsSceneMouseEvent* event );
+ void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
+
+private slots:
+
+ void scrollPositionChanged( QPointF newPosition );
+
+private:
+
+ Q_DISABLE_COPY( RadioStripBase )
+
+ virtual void updateItemPrimitive( QGraphicsItem* itemToUpdate, int itemIndex ) = 0;
+ virtual QGraphicsItem* createItemPrimitive( QGraphicsItem *parent ) = 0;
+
+ virtual void scrollPosChanged( QPointF newPosition );
+
+ void moveAllItemsToPool();
+
+ void populateAndLayout();
+
+ QGraphicsItem* constructItem( int index, bool append );
+
+ QGraphicsItem* getFromPool();
+
+ void returnToPool( QGraphicsItem* item );
+
+ qreal indexToOffset( int index );
+
+ int offsetToIndex( qreal offset );
+
+ void updateItemWithIndex( int index );
+
+ void adjustItems();
+
+protected: // data
+
+ int mAutoScrollTime;
+
+private: //data
+
+ HbWidget* mStripContainer;
+
+ QAbstractItemModel* mModel;
+
+ bool mIsCyclic;
+ bool mAutoCenter;
+
+ qreal mSpacing;
+
+ QSizeF mItemSize;
+
+ QList<QGraphicsItem*> mItemPool;
+ QGraphicsWidget* mItemPoolParent;
+
+ int mCurrentIndex;
+ int mPressedIndex;
+
+ qreal mStripLength;
+ qreal mContentsLength;
+
+ QList<QGraphicsItem*> mItemAtSlot;
+ QList<int> mIndexAtSlot; // Can be bigger than rowcount if cyclic is used
+
+ HbIcon mBackground;
+
+ QGraphicsPixmapItem* mBackgroundImage;
+
+};
+
+
+#endif // RADIOSTRIPBASE_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiotuningview.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef _TUNINGVIEW_H_
+#define _TUNINGVIEW_H_
+
+// System includes
+
+// User includes
+#include "radioviewbase.h"
+#include "radiowidgetsexport.h"
+
+// Forward declarations
+class RadioMainWindow;
+class RadioStationModel;
+class HbPushButton;
+class RadioXmlUiLoader;
+
+// Class declaration
+class WIDGETS_DLL_EXPORT RadioTuningView : public RadioViewBase
+ {
+ Q_OBJECT
+
+public:
+
+ explicit RadioTuningView( RadioXmlUiLoader* uiLoader );
+
+private slots:
+
+ void toggleFavorite();
+
+private:
+
+// from base class RadioViewBase
+
+ void init( RadioMainWindow* aMainWindow, RadioStationModel* aModel );
+ void initSecondarySoftkey();
+ void setOrientation();
+
+// New functions
+
+private: // data
+
+ };
+
+#endif // _TUNINGVIEW_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiouiutilities.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef _RADIOUIUTILITIES_H_
+#define _RADIOUIUTILITIES_H_
+
+// Forward declarations
+
+struct EffectInfo
+{
+ EffectInfo( QGraphicsItem* item, QString path, QString event ) :
+ mItem( item ),
+ mPath( path ),
+ mEvent( event )
+ {}
+
+ QGraphicsItem* mItem;
+ QString mPath;
+ QString mEvent;
+
+private:
+ EffectInfo();
+};
+typedef QList<EffectInfo> QEffectList;
+
+// Class declaration
+class RadioUiUtilities
+{
+public:
+
+ static bool addEffects( QEffectList list );
+
+private:
+
+ RadioUiUtilities();
+ ~RadioUiUtilities();
+
+};
+
+
+#endif // _RADIOUIUTILITIES_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radioviewbase.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef _RADIOVIEWBASE_H_
+#define _RADIOVIEWBASE_H_
+
+// System includes
+#include <hbview.h>
+
+//#define QT_SHAREDPOINTER_TRACK_POINTERS // Debugging support for QSharedPointer
+#include <qsharedpointer>
+
+// User includes
+
+// Forward declarations
+class RadioMainWindow;
+class RadioStationModel;
+class RadioXmlUiLoader;
+class HbAction;
+
+// Constants
+namespace MenuItem
+{
+ enum CommonMenuItem
+ {
+ UseLoudspeaker
+ };
+}
+
+// Class declaration
+class RadioViewBase : public HbView
+{
+ Q_OBJECT
+ Q_DISABLE_COPY( RadioViewBase )
+
+public:
+ explicit RadioViewBase( RadioXmlUiLoader* uiLoader, bool transient = true );
+
+ virtual ~RadioViewBase();
+
+ virtual void init( RadioMainWindow* aMainWindow, RadioStationModel* aModel );
+
+ bool isTransient() const;
+
+ virtual void initSecondarySoftkey();
+ HbAction* secondarySoftkey() const;
+
+ void updateOrientation( Qt::Orientation orientation, bool forceUpdate = false );
+
+protected slots:
+
+ void updateAudioRouting( bool loudspeaker );
+ void activatePreviousView();
+ void quit();
+
+protected:
+
+// New functinos
+
+ HbAction* addMenuItem( const QString& aTitle, QObject* aRecipient, const char* aSlot );
+
+ void connectCommonMenuItem( int menuItem );
+
+ void connectXmlElement( const char* name, const char* signal, QObject* receiver, const char* slot );
+
+ void connectViewChangeMenuItem( QString name, const char* slot );
+
+private:
+
+ virtual void setOrientation();
+
+protected: // data
+
+ /**
+ * Pointer to the main window.
+ * Not own.
+ */
+ RadioMainWindow* mMainWindow;
+
+ /**
+ * Pointer to the radio data model.
+ * Not own.
+ */
+ RadioStationModel* mModel;
+
+ /**
+ * Pointer to the XML UI (DocML) loader
+ * Own.
+ */
+ QSharedPointer<RadioXmlUiLoader> mUiLoader;
+
+ /**
+ * Flag indicating whether or not the view is transient
+ * Transient views are deleted when they are hidden.
+ */
+ bool mTransientView;
+
+ /**
+ * Route audio to Loudspeaker/Headset menu item
+ */
+ HbAction* mUseLoudspeakerAction;
+
+ /**
+ * Action for the secondary softkey. Used for "back" and "done" buttons
+ */
+ HbAction* mSecondarySoftkeyction;
+
+ /**
+ * View orientation.
+ */
+ Qt::Orientation mOrientation;
+
+};
+
+
+#endif // _RADIOVIEWBASE_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiowidgetsexport.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIO_WIDGETS_EXPORT_H_
+#define RADIO_WIDGETS_EXPORT_H_
+
+// System includes
+#include <qglobal.h>
+
+#ifdef BUILD_WIDGETS_DLL
+ #define WIDGETS_DLL_EXPORT Q_DECL_EXPORT
+#else
+ #define WIDGETS_DLL_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // RADIO_WIDGETS_EXPORT_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radiowizardview.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOWIZARDVIEW_H_
+#define RADIOWIZARDVIEW_H_
+
+// User includes
+#include "radioviewbase.h"
+#include "radiowidgetsexport.h"
+
+// Forward declarations
+class RadioMainWindow;
+class HbLabel;
+class HbPushButton;
+class HbListView;
+class RadioBannerLabel;
+
+// Class declaration
+class WIDGETS_DLL_EXPORT RadioWizardView : public RadioViewBase
+ {
+ Q_OBJECT
+
+public:
+
+ explicit RadioWizardView( RadioXmlUiLoader* uiLoader );
+
+private:
+
+// from base class RadioViewBase
+
+ void init( RadioMainWindow* aMainWindow, RadioStationModel* aModel );
+ void initSecondarySoftkey();
+
+// from base class QGraphicsWidget
+
+ void showEvent( QShowEvent* event );
+
+private slots:
+
+ void saveSelectedAsFavorites();
+ void listItemClicked( const QModelIndex& index );
+ void engineStatusChanged( bool radioIsOn );
+
+private:
+
+ void startScanning();
+
+private: // data
+
+ HbListView* mList;
+ RadioBannerLabel* mBannerLabel;
+ bool mStartScanningRequested;
+
+ };
+
+#endif // RADIOWIZARDVIEW_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/inc/radioxmluiloader.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOXMLUILOADER_H_
+#define RADIOXMLUILOADER_H_
+
+// System includes
+#include <hbdocumentloader.h>
+
+// Constants
+#ifdef USE_LAYOUT_FROM_E_DRIVE
+ static const char* DOCML_TUNINGVIEW_FILE = "e:/radiotest/layout/tuningview.docml";
+ static const char* DOCML_STATIONSVIEW_FILE = "e:/radiotest/layout/stationsview.docml";
+ static const char* DOCML_WIZARDVIEW_FILE = "e:/radiotest/layout/wizardview.docml";
+ static const char* DOCML_PLAYLOGVIEW_FILE = "e:/radiotest/layout/playlogview.docml";
+#else
+ static const char* DOCML_TUNINGVIEW_FILE = ":/layout/tuningview.docml";
+ static const char* DOCML_STATIONSVIEW_FILE = ":/layout/stationsview.docml";
+ static const char* DOCML_WIZARDVIEW_FILE = ":/layout/wizardview.docml";
+ static const char* DOCML_PLAYLOGVIEW_FILE = ":/layout/playlogview.docml";
+#endif
+
+// XML UI definitions
+static const char* DOCML_NAME_VIEW = "view";
+static const char* DOCML_LAYOUT_PORTRAIT = "portrait";
+static const char* DOCML_LAYOUT_LANDSCAPE = "landscape";
+static const char* DOCML_NAME_EXITACTION = "mExitAction";
+static const char* DOCML_NAME_LOUDSPEAKERACTION = "mLoudspeakerAction";
+
+// RadioTuningView
+static const char* DOCML_NAME_FAVORITEACTION = "tv:FavoriteAction";
+static const char* DOCML_NAME_PLAYLOGVIEWACTION = "tv:PlayLogViewAction";
+static const char* DOCML_NAME_STATIONSVIEWACTION = "tv:StationsViewAction";
+static const char* DOCML_NAME_STATIONCAROUSEL = "tv:mStationCarousel";
+static const char* DOCML_NAME_STATIONCONTROLWIDGET = "tv:mStationControlWidget";
+static const char* DOCML_NAME_FREQUENCYSTRIP = "tv:mFrequencyStrip";
+
+// RadioStationsView
+static const char* DOCML_NAME_HEADINGBANNER = "sv:mHeadingBanner";
+static const char* DOCML_NAME_STATIONSLIST = "sv:mStationsList";
+static const char* DOCML_NAME_FAVORITESBUTTON = "sv:FavoritesButton";
+static const char* DOCML_NAME_LOCALSBUTTON = "sv:LocalStationsButton";
+static const char* DOCML_NAME_TUNINGVIEWACTION = "sv:mTuningViewAction";
+static const char* DOCML_NAME_WIZARDVIEWACTION = "sv:mWizardViewAction";
+static const char* DOCML_NAME_SCANSTATIONSACTION = "sv:mScanStationsAction";
+static const char* DOCML_NAME_REMOVESTATIONSACTION = "sv:mRemoveAllStations";
+static const char* DOCML_NAME_SCANBUTTON = "sv:mScanButton";
+
+// RadioStationsView Context Menu
+static const char* DOCML_NAME_CONTEXT_MENU = "sv:mContextMenu";
+static const char* DOCML_NAME_CONTEXT_RENAME = "sv:mRenameStationAction";
+static const char* DOCML_NAME_CONTEXT_FAVORITE = "sv:mFavoriteAction";
+static const char* DOCML_NAME_CONTEXT_DELETE = "sv:mDeleteStationAction";
+
+// Station Info Widget
+static const char* DOCML_NAME_INFO_FIRST_ROW = "tv:InfoFirstRow";
+static const char* DOCML_NAME_INFO_SECOND_ROW = "tv:InfoSecondRow";
+static const char* DOCML_NAME_INFO_THIRD_ROW = "tv:InfoThirdRow";
+static const char* DOCML_NAME_INFO_FOURTH_ROW = "tv:InfoFourthRow";
+
+// Station Control Widget
+static const char* DOCML_NAME_STATIONSVIEWBUTTON = "tv:mStationsViewButton";
+static const char* DOCML_NAME_TAGBUTTON = "tv:mTagButton";
+static const char* DOCML_NAME_RECOGNIZEBUTTON = "tv:mRecognizeButton";
+
+// Wizard View
+static const char* DOCML_NAME_WV_STATIONSVIEWACTION = "wv:mStationsViewAction";
+static const char* DOCML_NAME_WV_HEADINGBANNER = "wv:mHeadingBanner";
+static const char* DOCML_NAME_WV_STATIONSLIST = "wv:mStationsList";
+static const char* DOCML_NAME_WV_MARKALLBUTTON = "wv:mMarkAllButton";
+static const char* DOCML_NAME_WV_UNMARKALLBUTTON = "wv:mUnMarkAllButton";
+static const char* DOCML_NAME_WV_DONEBUTTON = "wv:mDoneButton";
+
+// Play Log View
+static const char* DOCML_NAME_PLV_TUNINGVIEWACTION = "plv:mTuningViewAction";
+static const char* DOCML_NAME_PLV_STATIONSVIEWACTION = "plv:mStationsViewAction";
+static const char* DOCML_NAME_PLV_REMOVEALLACTION = "plv:mRemoveAllAction";
+static const char* DOCML_NAME_PLAYLOGLIST = "plv:mPlayLogList";
+static const char* DOCML_NAME_ALLSONGSBUTTON = "plv:AllSongsButton";
+static const char* DOCML_NAME_FAVORITESONGSBUTTON = "plv:FavoriteSongsButton";
+
+// Forward declarations
+class RadioMainWindow;
+
+// Class declaration
+class RadioXmlUiLoader : public HbDocumentLoader
+{
+
+public:
+
+ RadioXmlUiLoader( RadioMainWindow& mainWindow );
+
+ /**
+ * Returns the requested widget casted to correct type
+ *
+ * @param name Name of the widget
+ * @return Pointer to the widget
+ */
+ template<class T>
+ T* findWidget( QString name )
+ {
+ return qobject_cast<T*>( HbDocumentLoader::findWidget( name ) );
+ }
+
+ /**
+ * Returns the requested object casted to correct type
+ *
+ * @param name Name of the object
+ * @return Pointer to the object
+ */
+ template<class T>
+ T* findObject( QString name )
+ {
+ return qobject_cast<T*>( HbDocumentLoader::findObject( name ) );
+ }
+
+private:
+
+ QObject *createObject( const QString& type, const QString &name );
+
+private: // data
+
+ /*!
+ * Reference to the main window
+ */
+ RadioMainWindow& mMainWindow;
+
+};
+
+#endif // RADIOXMLUILOADER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/radiowidgets.pro Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,88 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+include(../buildflags.pri)
+
+TEMPLATE = lib
+TARGET = radiowidgets
+CONFIG += dll
+DEFINES += BUILD_WIDGETS_DLL
+win32:DESTDIR = ../bin
+
+# Wrapper does not depend on QtGui or Orbit
+QT = core gui
+CONFIG += hb
+
+symbian: {
+ DEFINES += SYMBIAN
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+}
+
+INCLUDEPATH += inc
+INCLUDEPATH += ../radiouiengine/inc
+INCLUDEPATH += ../radioenginewrapper/commoninc
+
+win32:LIBS += -L../bin
+
+LIBS += -lradiouiengine
+
+LOGGING_ENABLED:LIBS += -lradioenginewrapper
+
+DEPENDPATH += $$INCLUDEPATH src
+
+# $$_PRO_FILE_PWD_ points to the directory of the pro file
+MOC_DIR = $$_PRO_FILE_PWD_/tmp
+
+# Input
+HEADERS += radiowidgetsexport.h
+HEADERS += radiomainwindow.h
+HEADERS += radiouiutilities.h
+HEADERS += radioviewbase.h
+HEADERS += radioxmluiloader.h
+HEADERS += radiotuningview.h
+HEADERS += radiostripbase.h
+HEADERS += radiofrequencystrip.h
+HEADERS += radiofrequencyitem.h
+HEADERS += radiostationsview.h
+HEADERS += radiobannerlabel.h
+HEADERS += radiowizardview.h
+HEADERS += radiofrequencyscanner.h
+HEADERS += radiocontextmenu.h
+HEADERS += radiofadinglabel.h
+HEADERS += radiostationcarousel.h
+HEADERS += radiostationcontrolwidget.h
+HEADERS += radioplaylogview.h
+
+SOURCES += radiomainwindow.cpp
+SOURCES += radiouiutilities.cpp
+SOURCES += radioviewbase.cpp
+SOURCES += radioxmluiloader.cpp
+SOURCES += radiotuningview.cpp
+SOURCES += radiostripbase.cpp
+SOURCES += radiofrequencystrip.cpp
+SOURCES += radiofrequencyitem.cpp
+SOURCES += radiostationsview.cpp
+SOURCES += radiobannerlabel.cpp
+SOURCES += radiowizardview.cpp
+SOURCES += radiofrequencyscanner.cpp
+SOURCES += radiocontextmenu.cpp
+SOURCES += radiofadinglabel.cpp
+SOURCES += radiostationcarousel.cpp
+SOURCES += radiostationcontrolwidget.cpp
+SOURCES += radioplaylogview.cpp
+
+RESOURCES += res/fmradioui.qrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/effects/blink_in_out_in.fxml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,12 @@
+<!-- flip and change opacity -->
+
+<layers>
+ <visual>
+ <param name="opacity" type="anim">
+ <duration>1.0</duration>
+ <style>easeinout</style>
+ <keyframe at="0.0">0.3</keyframe>
+ <keyframe at="1.0">1.0</keyframe>
+ </param>
+ </visual>
+</layers>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/effects/fade_in.fxml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,10 @@
+<layers>
+ <visual src="Item">
+ <param name="opacity" type="anim">
+ <duration>1.0</duration>
+ <style>inquad</style>
+ <keyframe at="0.0">0.0</keyframe>
+ <keyframe at="1.0">1.0</keyframe>
+ </param>
+ </visual>
+</layers>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/effects/fade_out.fxml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,10 @@
+<layers>
+ <visual src="Item">
+ <param name="opacity" type="anim">
+ <duration>1.0</duration>
+ <style>outquad</style>
+ <keyframe at="0.0">1.0</keyframe>
+ <keyframe at="1.0">0.0</keyframe>
+ </param>
+ </visual>
+</layers>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/effects/slide_from_left.fxml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,9 @@
+<layers>
+ <visual>
+ <param name="scale_x" type="anim"><keyframe
+ at="0">0.0</keyframe><duration>0.3</duration><keyframe
+ at="1.0">1.0</keyframe><style>outback</style></param>
+ <param name="scale_origin_x" ref="visual.width">0.0</param>
+ <param name="scale_origin_y" ref="visual.height">0.0</param>
+ </visual>
+</layers>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/effects/slide_from_right.fxml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,12 @@
+<layers>
+ <visual>
+ <param name="scale_x" type="anim">
+ <duration>0.3</duration>
+ <style>outback</style>
+ <keyframe at="0.0">0.0</keyframe>
+ <keyframe at="0.5">0.5</keyframe>
+ <keyframe at="1.0">1.0</keyframe>
+ </param>
+ <param name="scale_origin_x" ref="visual.right">1</param>
+ </visual>
+</layers>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/effects/slide_to_left.fxml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,9 @@
+<layers>
+ <visual>
+ <param name="scale_x" type="anim"><keyframe
+ at="0">1.0</keyframe><duration>0.3</duration><keyframe
+ at="1.0">0.0</keyframe><style>outquad</style></param>
+ <param name="scale_origin_x" ref="visual.width">0.0</param>
+ <param name="scale_origin_y" ref="visual.height">0.0</param>
+ </visual>
+</layers>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/effects/slide_to_right.fxml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,12 @@
+<layers>
+ <visual>
+ <param name="scale_x" type="anim">
+ <duration>0.3</duration>
+ <style>outquad</style>
+ <keyframe at="0.0">1.0</keyframe>
+ <keyframe at="0.5">0.5</keyframe>
+ <keyframe at="1.0">0.0</keyframe>
+ </param>
+ <param name="scale_origin_x" ref="visual.right">1</param>
+ </visual>
+</layers>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/fmradioui.qrc Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<RCC>
+ <qresource>
+ <file>layout/tuningview.docml</file>
+ <file>layout/stationsview.docml</file>
+ <file>layout/wizardview.docml</file>
+ <file>layout/playlogview.docml</file>
+ <file>layout/radiostationcontrolwidget.css</file>
+ <file>layout/radiostationcontrolwidget.widgetml</file>
+ </qresource>
+
+ <qresource>
+ <file>effects/blink_in_out_in.fxml</file>
+ <file>effects/fade_out.fxml</file>
+ <file>effects/fade_in.fxml</file>
+ <file>effects/slide_to_left.fxml</file>
+ <file>effects/slide_from_left.fxml</file>
+ <file>effects/slide_to_right.fxml</file>
+ <file>effects/slide_from_right.fxml</file>
+ </qresource>
+
+ <qresource>
+ <file>images/stripbackground.png</file>
+ <file>images/buttonleft.png</file>
+ <file>images/buttonright.png</file>
+ <file>images/infowidgetbackground.png</file>
+ <file>images/controlwidgetbackground.png</file>
+ <file>images/removefavoriteicon.png</file>
+ <file>images/setfavoriteicon.png</file>
+ <file>images/nowplayingicon.png</file>
+ <file>images/identifysongbuttonicon.png</file>
+ <file>images/stationsbuttonicon.png</file>
+ <file>images/tagsongbuttonicon.png</file>
+ <file>images/favoriteiconactive.png</file>
+ <file>images/favoriteiconinactive.png</file>
+ </qresource>
+</RCC>
Binary file radioapp/radiowidgets/res/images/buttonleft.png has changed
Binary file radioapp/radiowidgets/res/images/buttonright.png has changed
Binary file radioapp/radiowidgets/res/images/controlwidgetbackground.png has changed
Binary file radioapp/radiowidgets/res/images/favoriteiconactive.png has changed
Binary file radioapp/radiowidgets/res/images/favoriteiconinactive.png has changed
Binary file radioapp/radiowidgets/res/images/identifysongbuttonicon.png has changed
Binary file radioapp/radiowidgets/res/images/infowidgetbackground.png has changed
Binary file radioapp/radiowidgets/res/images/nowplayingicon.png has changed
Binary file radioapp/radiowidgets/res/images/removefavoriteicon.png has changed
Binary file radioapp/radiowidgets/res/images/setfavoriteicon.png has changed
Binary file radioapp/radiowidgets/res/images/stationsbuttonicon.png has changed
Binary file radioapp/radiowidgets/res/images/stripbackground.png has changed
Binary file radioapp/radiowidgets/res/images/tagsongbuttonicon.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/layout/radiostationcontrolwidget.css Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,37 @@
+RadioStationControlWidget {
+ layout: stationcontrol_vertical;
+}
+
+RadioStationControlWidget::background {
+}
+
+HbPushButton::background {
+ border-width: 0px;
+}
+
+HbPushButton::text {
+ text-align: left center;
+ color: white;
+ font-variant: primary;
+}
+
+RadioStationControlWidget::tag_song_button {
+ left: -var(hb-param-margin-gene-left);
+ right: var(hb-param-margin-gene-right);
+ top: 0un;
+ bottom: 0un;
+}
+
+RadioStationControlWidget::recognize_button {
+ left: -var(hb-param-margin-gene-left);
+ right: var(hb-param-margin-gene-right);
+ top: 0un;
+ bottom: 0un;
+}
+
+RadioStationControlWidget::stations_button {
+ left: -var(hb-param-margin-gene-left);
+ right: var(hb-param-margin-gene-right);
+ top: 0un;
+ bottom: 0un;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/res/layout/radiostationcontrolwidget.widgetml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,16 @@
+<hbwidget type="RadioStationControlWidget" version="0.1">
+ <layout name="stationcontrol_vertical" type="mesh">
+ <meshitem dst="" dstEdge="TOP" src="tag_song_button" srcEdge="TOP"/>
+ <meshitem dst="" srcEdge="LEFT" src="tag_song_button" dstEdge="LEFT" />
+ <meshitem dst="" srcEdge="RIGHT" src="tag_song_button" dstEdge="RIGHT" />
+
+ <meshitem dst="tag_song_button" dstEdge="BOTTOM" src="recognize_button" srcEdge="TOP"/>
+ <meshitem dst="" srcEdge="LEFT" src="recognize_button" dstEdge="LEFT" />
+ <meshitem dst="" srcEdge="RIGHT" src="recognize_button" dstEdge="RIGHT" />
+
+ <meshitem dst="recognize_button" dstEdge="BOTTOM" src="stations_button" srcEdge="TOP"/>
+ <meshitem dst="" srcEdge="LEFT" src="stations_button" dstEdge="LEFT" />
+ <meshitem dst="" srcEdge="RIGHT" src="stations_button" dstEdge="RIGHT" />
+ <meshitem dst="" dstEdge="BOTTOM" src="stations_button" srcEdge="BOTTOM"/>
+ </layout>
+</hbwidget>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiobannerlabel.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "radiobannerlabel.h"
+
+#include <qpainter.h>
+
+/*!
+ *
+ */
+RadioBannerLabel::RadioBannerLabel( QGraphicsItem * parent ) :
+ HbLabel( parent )
+{
+ QFont currentfont( font() );
+ currentfont.setBold( true );
+ currentfont.setPixelSize( 18 );
+ setFont( currentfont );
+}
+
+/*!
+ *
+ */
+void RadioBannerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget )
+{
+ painter->setPen(QPen(QColor(200, 200, 200, 150)));
+ painter->setBrush(QBrush(QColor(200, 200, 200, 150),Qt::SolidPattern));
+ painter->drawRect(option->rect);
+ HbLabel::paint( painter, option, widget );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiocontextmenu.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <hbaction.h>
+#include <hbinputdialog.h>
+#include <qgraphicssceneresizeevent>
+
+// User includes
+#include "radiocontextmenu.h"
+#include "radioxmluiloader.h"
+#include "radiolocalization.h"
+#include "radiouiengine.h"
+#include "radiostationmodel.h"
+#include "radiologger.h"
+
+/*!
+ *
+ */
+RadioContextMenu::RadioContextMenu( RadioUiEngine& uiEngine, QGraphicsItem* parent ) :
+ HbMenu( parent ),
+ mUiEngine( uiEngine )
+{
+}
+
+/*!
+ * Initializes the menu
+ */
+void RadioContextMenu::init( const RadioStation& station, RadioXmlUiLoader& uiLoader )
+{
+ mStation = station;
+
+ if ( station.isRenamed() )
+ {
+ uiLoader.findObject<HbAction>( DOCML_NAME_CONTEXT_RENAME )->setText( TRANSLATE( KMenuItemRemoveRenaming ) );
+ }
+ else
+ {
+ uiLoader.findObject<HbAction>( DOCML_NAME_CONTEXT_RENAME )->setText( TRANSLATE( KMenuItemRenameStation ) );
+ }
+
+ if ( station.isFavorite() )
+ {
+ uiLoader.findObject<HbAction>( DOCML_NAME_CONTEXT_FAVORITE )->setText( TRANSLATE( KMenuItemRemoveFavorite ) );
+ }
+ else
+ {
+ uiLoader.findObject<HbAction>( DOCML_NAME_CONTEXT_FAVORITE )->setText( TRANSLATE( KMenuItemSetAsFavorite ) );
+ }
+}
+
+/*!
+ * Initializes the menu
+ */
+void RadioContextMenu::init( const RadioStation& station, QPointF pos )
+{
+ mStation = station;
+ mPos = pos;
+
+ if ( station.isRenamed() )
+ {
+ HbAction* action = addAction( TRANSLATE( KMenuItemRemoveRenaming ) );
+ connectAndTest( action, SIGNAL(triggered()), this, SLOT(rename()) );
+ }
+ else
+ {
+ HbAction* action = addAction( TRANSLATE( KMenuItemRenameStation ) );
+ connectAndTest( action, SIGNAL(triggered()), this, SLOT(rename()) );
+ }
+
+ if ( station.isFavorite() )
+ {
+ HbAction* action = addAction( TRANSLATE( KMenuItemRemoveFavorite ) );
+ connectAndTest( action, SIGNAL(triggered()), this, SLOT(toggleFavorite()) );
+ }
+ else
+ {
+ HbAction* action = addAction( TRANSLATE( KMenuItemSetAsFavorite ) );
+ connectAndTest( action, SIGNAL(triggered()), this, SLOT(toggleFavorite()) );
+ }
+
+ HbAction* deleteAction = addAction( TRANSLATE( KMenuItemRemoveStation ) );
+ connectAndTest( deleteAction, SIGNAL(triggered()), this, SLOT(deleteStation()) );
+
+ connectAndTest( this, SIGNAL(aboutToClose()), this, SLOT(deleteLater()) );
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioContextMenu::rename()
+{
+ if ( mStation.isRenamed() )
+ {
+ mUiEngine.model().renameStation( mStation.presetIndex(), "" );
+ }
+ else
+ {
+ HbInputDialog nameQuery;
+ nameQuery.setPromptText( TRANSLATE( KQueryEnterStationName ) );
+ nameQuery.setInputMode( HbInputDialog::TextInput );
+ nameQuery.setTextValue( mStation.name() );
+ if ( nameQuery.exec() == nameQuery.primaryAction() )
+ {
+ mUiEngine.model().renameStation( mStation.presetIndex(), nameQuery.textValue().toString() );
+ }
+ }
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioContextMenu::toggleFavorite()
+{
+ mUiEngine.model().setFavoriteByPreset( mStation.presetIndex(), !mStation.isFavorite() );
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioContextMenu::deleteStation()
+{
+ mUiEngine.model().removeStation( mStation );
+}
+
+/*!
+ * \reimp
+ */
+void RadioContextMenu::resizeEvent( QGraphicsSceneResizeEvent* event )
+{
+ HbMenu::resizeEvent( event );
+ setPos( QPointF( mPos.x() - event->newSize().width() / 2, mPos.y() - event->newSize().height() / 2 ) );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiofadinglabel.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+
+// User includes
+#include "radiofadinglabel.h"
+#include "radiologger.h"
+#include "radiouiutilities.h"
+
+// Constants
+const QString KHideEffect = "hide";
+const QString KShowEffect = "show";
+
+#ifdef USE_DEPRECATED_ORBIT_APIS
+# define SET_CONTENT setText
+# define GET_CONTENT text
+#else
+# define SET_CONTENT setHtml
+# define GET_CONTENT html
+#endif // USE_DEPRECATED_ORBIT_APIS
+
+/*!
+ *
+ */
+RadioFadingLabel::RadioFadingLabel( QGraphicsItem* parent ) :
+ HbLabel( parent ),
+ mFadingEnabled( false )
+{
+ QEffectList effectList;
+// effectList.append( EffectInfo( this, ":/effects/fade_in.fxml", KShowEffect ) );
+// effectList.append( EffectInfo( this, ":/effects/fade_out.fxml", KHideEffect ) );
+ RadioUiUtilities::addEffects( effectList );
+}
+
+/*!
+ *
+ */
+void RadioFadingLabel::setFadingEnabled( bool fading )
+{
+ mFadingEnabled = fading;
+}
+
+/*!
+ *
+ */
+void RadioFadingLabel::setTextWithoutFading( const QString& newText )
+{
+ HbLabel::SET_CONTENT( trimHtml( newText ) );
+ if ( newText.isEmpty() && mFadingEnabled ) {
+ setOpacity( 0.0 );
+ }
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioFadingLabel::setText( const QString& newText )
+{
+ if( GET_CONTENT().compare( newText ) != 0 && // Text is different
+ parentItem() && parentItem()->isVisible() && // Parent is visible
+ mFadingEnabled ) { // Fading is enabled
+ if ( newText.isEmpty() ) {
+ if ( isVisible() ) {
+ mTextHolder = "";
+ startEffect( KHideEffect, "effectFinished" );
+ }
+ } else {
+ if ( GET_CONTENT().isEmpty() ) {
+ HbLabel::SET_CONTENT( trimHtml( newText ) );
+ startEffect( KShowEffect );
+ } else {
+ mTextHolder = newText;
+ startEffect( KHideEffect, "effectFinished" );
+ }
+ }
+ } else {
+ HbLabel::SET_CONTENT( trimHtml( newText ) );
+ }
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioFadingLabel::effectFinished( HbEffect::EffectStatus status )
+{
+ if ( status.reason == Hb::EffectFinished ) {
+ HbLabel::SET_CONTENT( trimHtml( mTextHolder ) );
+ if ( !mTextHolder.isEmpty() ) {
+ HbEffect::start( this, KShowEffect );
+ }
+ mTextHolder = "";
+ }
+}
+
+/*!
+ *
+ */
+void RadioFadingLabel::startEffect( const QString& effectName, const char* slot )
+{
+ if ( HbEffect::effectRunning( this ) ) {
+ HbEffect::cancel( this );
+ }
+ if ( slot ) {
+ HbEffect::start( this, effectName, this, slot );
+ } else {
+ HbEffect::start( this, effectName );
+ }
+}
+
+/*!
+ *
+ */
+QString RadioFadingLabel::trimHtml( const QString& text )
+{
+#ifdef USE_DEPRECATED_ORBIT_APIS
+ return text;
+#else
+ return "<font color=\"white\">" + text + "</font>";
+#endif // USE_DEPRECATED_ORBIT_APIS
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiofrequencyitem.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+
+// User includes
+#include "radiofrequencyitem.h"
+#include "radiofrequencystrip.h"
+
+/*!
+ *
+ */
+RadioFrequencyItem::RadioFrequencyItem( QString frequency ) :
+ mFrequency( frequency.isEmpty() ? 0 : frequency.toInt() * KOneHertz ),
+ mGraphicsItem( 0 )
+{
+}
+
+/*!
+ *
+ */
+uint RadioFrequencyItem::frequency() const
+{
+ return mFrequency;
+}
+
+/*!
+ *
+ */
+QPixmap RadioFrequencyItem::updatePrimitive( QGraphicsPixmapItem* item )
+{
+ mGraphicsItem = item;
+ return mPixmap;
+}
+
+/*!
+ *
+ */
+void RadioFrequencyItem::setPixmap( QPixmap pixmap )
+{
+ mPixmap = pixmap;
+ if ( mGraphicsItem ) {
+ mGraphicsItem->setPixmap( mPixmap );
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiofrequencyscanner.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <hbprogressdialog.h>
+
+// User includes
+#include "radiofrequencyscanner.h"
+#include "radiolocalization.h"
+#include "radiouiengine.h"
+#include "radiologger.h"
+#include "radiostationmodel.h"
+
+// Constants
+const int KExtraRoomToMaxValue = 100000;
+
+/*!
+ *
+ */
+RadioFrequencyScanner::RadioFrequencyScanner( RadioUiEngine& uiEngine, QObject* parent ) :
+ QObject( parent ),
+ mUiEngine( uiEngine ),
+ mScanningProgressNote( new HbProgressDialog( HbProgressDialog::ProgressDialog ) ),
+ mChannelCount( 0 ),
+ mMinFrequency( 0 )
+{
+ mScanningProgressNote->setModal( true );
+ mScanningProgressNote->setAutoClose( true );
+
+ mMinFrequency = mUiEngine.minFrequency();
+
+ // Add some extra to the maximum value to allow room for the station at the low band edge
+ mScanningProgressNote->setRange( mMinFrequency, mUiEngine.maxFrequency() + KExtraRoomToMaxValue );
+ mScanningProgressNote->setProgressValue( mMinFrequency );
+ mScanningProgressNote->setText( TRANSLATE( KProgressTitleScanStations ) );
+
+ RadioStationModel* stationModel = &mUiEngine.model();
+ connectAndTest( stationModel, SIGNAL(stationAdded(RadioStation)),
+ this, SLOT(updateScanAndSaveProgress(RadioStation)) );
+
+ connectAndTest( &mUiEngine, SIGNAL(scanAndSaveFinished()),
+ this, SLOT(scanAndSavePresetsFinished()) );
+
+ connectAndTest( mScanningProgressNote, SIGNAL(cancelled()),
+ this, SLOT(scanAndSavePresetsCancelled()) );
+}
+
+/*!
+ *
+ */
+void RadioFrequencyScanner::startScanning()
+{
+ mUiEngine.scanFrequencyBand();
+ mScanningProgressNote->show();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioFrequencyScanner::updateScanAndSaveProgress( const RadioStation& station )
+{
+ const uint frequency = station.frequency();
+ LOG_FORMAT( "RadioFrequencyScanner::updateScanAndSaveProgress frequency: %d", frequency );
+
+ // Check for special case that can happen during scanning.
+ // If there is a valid radio station at the low frequency band edge it will be reported last after
+ // all of the higher frequencies. We don't update the progress value here because the value would
+ // be lower than the previous one. The progress value is set to maximum when the scanner finishes.
+ if ( frequency != mMinFrequency ) {
+ mScanningProgressNote->setProgressValue( frequency );
+ }
+
+ ++mChannelCount;
+ mScanningProgressNote->setText( QString( TRANSLATE( KProgressTitleStationsFound ) ).arg( mChannelCount ) );
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioFrequencyScanner::scanAndSavePresetsFinished()
+{
+ mScanningProgressNote->setProgressValue( mScanningProgressNote->maximum() );
+
+ disconnect( &mUiEngine.model(), SIGNAL(stationAdded(RadioStation)),
+ this, SLOT(updateScanAndSaveProgress(RadioStation)) );
+ disconnect( &mUiEngine, SIGNAL(scanAndSaveFinished()),
+ this, SLOT(scanAndSavePresetsFinished()) );
+
+ emit frequencyScannerFinished();
+ mScanningProgressNote->deleteLater();
+ deleteLater();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioFrequencyScanner::scanAndSavePresetsCancelled()
+{
+ mUiEngine.cancelScanFrequencyBand();
+ scanAndSavePresetsFinished();
+ mScanningProgressNote = 0;
+ mChannelCount = 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiofrequencystrip.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,640 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qpainter>
+#include <qstringlistmodel>
+#include <qpainterpath>
+#include <qgraphicssceneresizeevent>
+#include <qpen>
+#include <hbpushbutton.h>
+#include <qtimer>
+
+#include "radiofrequencystrip.h"
+#include "radiofrequencyitem.h"
+#include "radiouiengine.h"
+#include "radiostation.h"
+#include "radiouiutilities.h"
+#include "radiologger.h"
+
+// Frequency lines
+const int KTabHeightSmall = 10;
+const int KTabHeightBig = 15;
+const int KTabHeightFavorite = 15;
+const int KTabWidthFavorite = 4;
+const qreal KIndicatorWidth = 2.0;
+
+const qreal KRounder = 0.5;
+const int KSelectorWidth = 2;
+const int KSelectorZPos = 100;
+
+const int K100Khz = 100000;
+
+const int KTouchPosThreshold = 30;
+
+const QString KSlideToLeft = "SlideToLeft";
+const QString KSlideFromLeft = "SlideFromLeft";
+const QString KSlideToRight = "SlideToRight";
+const QString KSlideFromRight = "SlideFromRight";
+
+/*!
+ *
+ */
+static QLineF makeTab( qreal pos, int height )
+{
+ return QLineF( pos, KHeight - height, pos, KHeight );
+}
+
+/*!
+ *
+ */
+RadioFrequencyStrip::RadioFrequencyStrip( uint minFrequency,
+ uint maxFrequency,
+ uint stepSize,
+ uint currentFrequency,
+ RadioUiEngine* engine ) :
+ RadioStripBase( 0 ),
+ mMinFrequency( minFrequency ),
+ mMaxFrequency( maxFrequency ),
+ mFrequencyStepSize( stepSize ),
+ mEngine( engine ),
+ mSelectorImage( new QGraphicsPixmapItem( this ) ),
+ mSeparatorPos( 0.0 ),
+ mMaxWidth( 0 ),
+ mSelectorPos( 0.0 ),
+ mFrequency( currentFrequency ),
+ mFavoriteSelected( false ),
+ mLeftButton( new HbPushButton( this ) ),
+ mRightButton( new HbPushButton( this ) ),
+ mButtonTimer( new QTimer( this ) ),
+ mIsPanGesture( false )
+{
+ mButtonTimer->setInterval( 500 );
+ mButtonTimer->setSingleShot( true );
+ connectAndTest( mButtonTimer, SIGNAL(timeout()), this, SLOT(toggleButtons()) );
+
+ //TODO: Remove. Stepsize hardcoded to 100 Khz in europe region during demo
+ if ( mFrequencyStepSize < K100Khz ) {
+ mFrequencyStepSize = K100Khz;
+ }
+
+ setScrollingStyle( HbScrollArea::PanOrFlick );
+ setItemSize( QSizeF( KWidth, KHeight ) );
+ setFrictionEnabled( true );
+
+ initModel();
+
+ initSelector();
+
+ initItems();
+
+ initButtons();
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::setLeftButtonIcon( const HbIcon& leftButtonIcon )
+{
+ mLeftButtonIcon = leftButtonIcon;
+ if ( mLeftButton ) {
+ mLeftButton->setIcon( mLeftButtonIcon );
+ }
+}
+
+/*!
+ *
+ */
+HbIcon RadioFrequencyStrip::leftButtonIcon() const
+{
+ return mLeftButtonIcon;
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::setRightButtonIcon( const HbIcon& rightButtonIcon )
+{
+ mRightButtonIcon = rightButtonIcon;
+ if ( mRightButton ) {
+ mRightButton->setIcon( mRightButtonIcon );
+ }
+}
+
+/*!
+ *
+ */
+HbIcon RadioFrequencyStrip::rightButtonIcon() const
+{
+ return mRightButtonIcon;
+}
+
+/*!
+ *
+ */
+uint RadioFrequencyStrip::frequency( bool* favorite ) const
+{
+ if ( favorite ) {
+ *favorite = mFrequencies.value( mFrequency ).mFavorite;
+ }
+ return mFrequency;
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::connectLeftButton( const char* signal, QObject* receiver, const char* slot )
+{
+ connectAndTest( mLeftButton, signal, receiver, slot );
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::connectRightButton( const char* signal, QObject* receiver, const char* slot )
+{
+ connectAndTest( mRightButton, signal, receiver, slot );
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioFrequencyStrip::favoriteChanged( const RadioStation& station )
+{
+ LOG_SLOT_CALLER;
+ FrequencyPos pos = mFrequencies.value( station.frequency() );
+ updateFavorites( pos.mItem );
+
+ emitFavoriteSelected( station.isFavorite() );
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioFrequencyStrip::setFrequency( const uint frequency, int commandSender )
+{
+// LOG_SLOT_CALLER;
+// LOG_FORMAT( "RadioFrequencyStrip::setFrequency, frequency: %d, sender: %d", frequency, commandSender );
+ if ( commandSender != CommandSender::FrequencyStrip && // Not sent by the FrequencyStrip
+ frequency != mFrequency && // Different from the current
+ mFrequencies.contains( frequency ) ) // 0 frequency means any illegal value
+ {
+ scrollToFrequency( frequency, mAutoScrollTime );
+ emitFrequencyChanged( frequency );
+ }
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioFrequencyStrip::leftGesture( int DEBUGVAR( speedPixelsPerSecond ) )
+{
+ LOG_FORMAT( "RadioFrequencyStrip::leftGesture. speed: %d", speedPixelsPerSecond );
+ mButtonTimer->stop();
+ mButtonTimer->start();
+ emit swipedLeft();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioFrequencyStrip::rightGesture( int DEBUGVAR( speedPixelsPerSecond ) )
+{
+ LOG_FORMAT( "RadioFrequencyStrip::rightGesture. speed: %d", speedPixelsPerSecond );
+ mButtonTimer->stop();
+ mButtonTimer->start();
+ emit swipedRight();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioFrequencyStrip::panGesture( const QPointF& point )
+{
+ RadioStripBase::panGesture( point );
+ mIsPanGesture = true;
+}
+
+/*!
+ * Private slot
+ */
+void RadioFrequencyStrip::toggleButtons()
+{
+ HbEffect::start( mLeftButton, KSlideFromLeft );
+ HbEffect::start( mRightButton, KSlideFromRight );
+}
+
+/*!
+ * \reimp
+ */
+void RadioFrequencyStrip::updateItemPrimitive( QGraphicsItem* itemToUpdate, int itemIndex )
+{
+ QGraphicsPixmapItem* item = static_cast<QGraphicsPixmapItem*>( itemToUpdate );
+ if ( itemIndex < mFrequencyItems.count() ) {
+ item->setPixmap( mFrequencyItems.at( itemIndex )->updatePrimitive( item ) );
+ }
+}
+
+/*!
+ * \reimp
+ */
+QGraphicsItem* RadioFrequencyStrip::createItemPrimitive( QGraphicsItem* parent )
+{
+ return new QGraphicsPixmapItem( parent );
+}
+
+/*!
+ * \reimp
+ */
+void RadioFrequencyStrip::scrollPosChanged( QPointF newPosition )
+{
+ Q_UNUSED( newPosition );
+
+ if ( isDragging() ) {
+ const int pos = selectorPos();
+ emitFrequencyChanged( mPositions.value( pos ) );
+ }
+}
+
+/*!
+ * \reimp
+ */
+void RadioFrequencyStrip::resizeEvent ( QGraphicsSceneResizeEvent* event )
+{
+ LOG_METHOD_ENTER;
+ RadioStripBase::resizeEvent( event );
+
+ mSelectorPos = event->newSize().width() / 2;
+ mSelectorImage->setOffset( mSelectorPos - (KIndicatorWidth / 2), 0.0 );
+
+ const int stripHeight = event->newSize().height();
+ if ( !mLeftButtonIcon.isNull() ) {
+// mLeftButtonIcon.setSize( QSizeF( stripHeight, stripHeight ) );
+ mLeftButton->resize( stripHeight, stripHeight );
+ mLeftButton->setBackground( mLeftButtonIcon );
+ }
+
+ if ( !mRightButtonIcon.isNull() ) {
+// mRightButtonIcon.setSize( QSizeF( stripHeight, stripHeight ) );
+ mRightButton->resize( stripHeight, stripHeight );
+ mRightButton->setBackground( mRightButtonIcon );
+ }
+ mRightButton->setPos( QPointF( size().width() - mRightButton->size().width(), 0 ) );
+
+ scrollToFrequency( mFrequency, 0 );
+}
+
+/*!
+ * \reimp
+ */
+void RadioFrequencyStrip::showEvent( QShowEvent* event )
+{
+ Q_UNUSED( event );
+ scrollToFrequency( mFrequency, 0 );
+}
+
+/*!
+ * \reimp
+ */
+void RadioFrequencyStrip::mousePressEvent( QGraphicsSceneMouseEvent* event )
+{
+ RadioStripBase::mousePressEvent( event );
+ mIsPanGesture = false;
+ mButtonTimer->stop();
+
+ HbEffect::start( mLeftButton, KSlideToLeft );
+ HbEffect::start( mRightButton, KSlideToRight );
+}
+
+/*!
+ * \reimp
+ */
+void RadioFrequencyStrip::mouseReleaseEvent( QGraphicsSceneMouseEvent* event )
+{
+ RadioStripBase::mouseReleaseEvent( event );
+
+ // Check if the selector is in the invalid area where the strip loops around
+ const int selectorPosition = selectorPos();
+ if ( !mPositions.contains( selectorPosition ) ) {
+ if ( selectorPosition < mMaxWidth - KWidth + mSeparatorPos ) {
+ scrollToFrequency( mMaxFrequency, 500 );
+ emitFrequencyChanged( mMaxFrequency );
+ } else {
+ scrollToFrequency( mMinFrequency, 500 );
+ emitFrequencyChanged( mMinFrequency );
+ }
+ }
+
+// if ( !mIsPanGesture ) {
+// const qreal touchDelta = event->pos().x() - mSelectorPos;
+// const int touchPos = selectorPosition + touchDelta;
+// const uint frequencyAtPos = mPositions.value( touchPos );
+//
+// uint foundFrequency = 0;
+// for ( int i = 0; i < 10; ++i ) {
+// const uint delta = i * mFrequencyStepSize;
+// FrequencyPos leftFreq = mFrequencies.value( frequencyAtPos - delta );
+// FrequencyPos rightFreq = mFrequencies.value( frequencyAtPos + delta );
+//
+// if ( touchPos - leftFreq.mPosition > KTouchPosThreshold ) {
+// break;
+// }
+//
+// if ( leftFreq.mFavorite || leftFreq.mLocalStation ) {
+// foundFrequency = frequencyAtPos - delta;
+// break;
+// } else if ( rightFreq.mFavorite || rightFreq.mLocalStation ) {
+// foundFrequency = frequencyAtPos + delta;
+// break;
+// }
+// }
+//
+// if ( foundFrequency > 0 ) {
+// setFrequency( foundFrequency, 0 );
+// }
+// }
+
+ mButtonTimer->stop();
+ mButtonTimer->start();
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::initModel()
+{
+ const uint minFreq = uint( qreal(mMinFrequency) / KOneHertz + KRounder );
+ const uint maxFreq = uint( qreal(mMaxFrequency) / KOneHertz + 0.9 ); // always round up
+
+ QStringList list;
+ QString freqText;
+ for ( uint i = minFreq; i <= maxFreq; ++i ) {
+ freqText = QString::number( i );
+ list.append( freqText );
+ mFrequencyItems.append( new RadioFrequencyItem( freqText ) );
+ }
+ mFrequencyItems.append( new RadioFrequencyItem( "" ) );
+ list.append( "" );
+
+ mMaxWidth = list.count() * KWidth;
+
+ mSeparatorPos = qreal(KWidth) / 2;
+ const uint minDrawableFreq = minFreq * KOneHertz - KHalfHertz;;
+ const uint maxDrawableFreq = maxFreq * KOneHertz + KHalfHertz;
+ mSeparatorPos += qreal( ( mMinFrequency - minDrawableFreq ) / 2 ) / KPixelInHz;
+ mSeparatorPos -= qreal( ( maxDrawableFreq - mMaxFrequency ) / 2 ) / KPixelInHz;
+
+ setModel( new QStringListModel( list, this ) );
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::initSelector()
+{
+ QPixmap selectorPixmap = QPixmap( QSize( KSelectorWidth, KHeight ) );
+ selectorPixmap.fill( Qt::red );
+ mSelectorImage->setPixmap( selectorPixmap );
+ mSelectorImage->setZValue( KSelectorZPos );
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::initItems()
+{
+ LOG_METHOD;
+ foreach ( RadioFrequencyItem* item, mFrequencyItems ) {
+ updateFavorites( item );
+ }
+
+ if ( mEngine ) {
+ QList<RadioStation> stations = mEngine->stationsInRange( mMinFrequency, mMaxFrequency );
+ foreach ( const RadioStation& station, stations ) {
+ if ( station.isFavorite() ) {
+ mFrequencies[ station.frequency() ].mFavorite = true;
+ }
+ if ( station.isType( RadioStation::LocalStation ) ) {
+ mFrequencies[ station.frequency() ].mLocalStation = true;
+ }
+ }
+ }
+
+ int prevPos = 0;
+ int nextPos = 0;
+ const int lastPos = mFrequencies.value( mMaxFrequency ).mPosition;
+ for ( int i = mFrequencies.value( mMinFrequency ).mPosition; i < lastPos; ++i ) {
+ if ( mPositions.contains( i ) ) {
+ prevPos = i;
+ const uint freq = mPositions.value( prevPos ) + mFrequencyStepSize;
+ if ( mFrequencies.contains( freq ) ) {
+ nextPos = mFrequencies.value( freq ).mPosition;
+ } else {
+ nextPos = prevPos;
+ }
+ } else {
+ const int nearestHit = ( i - prevPos ) < ( nextPos - i ) ? prevPos : nextPos;
+ mPositions.insert( i, mPositions.value( nearestHit ) );
+ }
+ }
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::initButtons()
+{
+ mLeftButton->setZValue( KSelectorZPos );
+ mRightButton->setZValue( KSelectorZPos );
+
+ QEffectList effectList;
+ effectList.append( EffectInfo( mLeftButton, ":/effects/slide_to_left.fxml", KSlideToLeft ) );
+ effectList.append( EffectInfo( mLeftButton, ":/effects/slide_from_left.fxml", KSlideFromLeft ) );
+ effectList.append( EffectInfo( mRightButton, ":/effects/slide_to_right.fxml", KSlideToRight ) );
+ effectList.append( EffectInfo( mRightButton, ":/effects/slide_from_right.fxml", KSlideFromRight ) );
+ RadioUiUtilities::addEffects( effectList );
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::addFrequencyPos( int pos, uint frequency, RadioFrequencyItem* item )
+{
+ mFrequencies.insert( frequency, FrequencyPos( pos, false, false, item ) );
+ mPositions.insert( pos, frequency );
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::updateFavorites( RadioFrequencyItem* item )
+{
+ uint frequency = item->frequency();
+ QList<RadioStation> stations;
+ if ( mEngine ) {
+ stations = mEngine->stationsInRange( frequency - KHalfHertz, frequency + KHalfHertz );
+ }
+
+ QPixmap pixmap = drawPixmap( frequency, stations, item );
+ item->setPixmap( pixmap );
+
+ foreach ( const RadioStation& station, stations ) {
+ frequency = station.frequency();
+ FrequencyPos pos = mFrequencies.value( frequency );
+ pos.mFavorite = station.isFavorite();
+ pos.mLocalStation = station.isType( RadioStation::LocalStation );
+ mFrequencies.insert( frequency, pos );
+ }
+}
+
+/*!
+ *
+ */
+QPixmap RadioFrequencyStrip::drawPixmap( uint frequency, QList<RadioStation> stations, RadioFrequencyItem* item )
+{
+ QPixmap pixmap( KWidth, KHeight );
+ pixmap.fill( Qt::transparent );
+ QPainter painter( &pixmap );
+ QPen normalPen = painter.pen();
+ QPen favoritePen = normalPen;
+ normalPen.setColor( Qt::white );
+ painter.setPen( normalPen );
+
+ if ( frequency == 0 ) {
+ painter.drawLine( makeTab( mSeparatorPos - 1 + KRounder, KHeight ) );
+ painter.drawLine( makeTab( mSeparatorPos + KRounder, KHeight ) );
+ return pixmap;
+ }
+
+ const QString itemText = QString::number( frequency / KOneHertz );
+ const uint startFrequency = frequency - KHalfHertz;
+ const uint endFrequency = startFrequency + KOneHertz;
+ const uint roundedMin = int( qreal(mMinFrequency) / KOneHertz + KRounder );
+ const uint freq = frequency / KOneHertz;
+ const int diff = freq - roundedMin;
+ const qreal startPixel = diff * KWidth;
+ qreal pixels = 0.0;
+ QFont painterFont = painter.font();
+ painterFont.setPointSize( 6 );
+ painter.setFont( painterFont );
+
+ const int charWidth = painter.fontMetrics().averageCharWidth();
+ for ( uint frequency = startFrequency; frequency <= endFrequency; frequency += mFrequencyStepSize ) {
+
+ if ( frequency < mMinFrequency || frequency > mMaxFrequency ) {
+ continue;
+ }
+
+ pixels = qreal( frequency - startFrequency ) / KPixelInHz;
+ if ( frequency % KOneHertz == 0 ) {
+
+ // Draw the high frequency tab and the frequency text for the even number
+ painter.drawLine( makeTab( pixels, KTabHeightBig ) );
+ const int textPosX = pixels - itemText.length() * charWidth / 2;
+ painter.drawText( QPoint( textPosX, 20 ), itemText );
+
+ } else if ( frequency % KOneTabInHz == 0 ) {
+
+ // Draw the low frequency tab for the uneven number
+ painter.drawLine( makeTab( pixels, KTabHeightSmall ) );
+
+ }
+
+ addFrequencyPos( startPixel + pixels + KRounder, frequency, item );
+ }
+
+ // Draw favorites and local stations
+ favoritePen.setColor( Qt::yellow );
+
+ const int markerYPos = KHeight - 20;
+ foreach ( const RadioStation& station, stations ) {
+ const uint frequency = station.frequency();
+ pixels = qreal( frequency - startFrequency ) / KPixelInHz;
+
+ if ( station.isFavorite() ) {
+ favoritePen.setWidth( KTabWidthFavorite );
+ painter.setPen( favoritePen );
+ painter.drawEllipse( pixels - 3, markerYPos - 3, 6, 6 );
+// painter.drawPixmap( pixels - 10, 20, 20, 20, mFavoriteIcon.pixmap() );
+ } else if ( station.isType( RadioStation::LocalStation ) ) {
+// painter.setPen( normalPen );
+// painter.drawLine( pixels, // Start X
+// KHeight - KTabHeightFavorite, // Start Y
+// pixels, // End X
+// KHeight ); // End Y
+
+ favoritePen.setWidth( 1 );
+ painter.setPen( favoritePen );
+ painter.drawEllipse( pixels - 4, markerYPos - 4, 8, 8 );
+ }
+ }
+
+ return pixmap;
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::emitFrequencyChanged( uint frequency )
+{
+// LOG_FORMAT( "RadioFrequencyStrip::emitFrequencyChanged, frequency: %d", frequency );
+ if ( frequency > 0 && frequency != mFrequency ) {
+ mFrequency = frequency;
+ emit frequencyChanged( frequency, CommandSender::FrequencyStrip );
+ emitFavoriteSelected( mFrequencies.value( frequency ).mFavorite );
+ }
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::emitFavoriteSelected( bool favoriteSelected )
+{
+ if ( favoriteSelected != mFavoriteSelected ) {
+ mFavoriteSelected = favoriteSelected;
+ emit frequencyIsFavorite( mFavoriteSelected );
+ }
+}
+
+/*!
+ *
+ */
+int RadioFrequencyStrip::selectorPos() const
+{
+ const int pos = ( -contentWidget()->x() + mSelectorPos ) + KRounder;
+ return pos % mMaxWidth;
+}
+
+/*!
+ *
+ */
+void RadioFrequencyStrip::scrollToFrequency( uint frequency, int time )
+{
+ // Find the shortest route to the requested frequency.
+ const int pos = ( -contentWidget()->x() + mSelectorPos ) + KRounder;
+ if ( pos >= mMaxWidth - KWidth + mSeparatorPos ) {
+ const qreal newPos = qreal( mFrequencies.value( frequency ).mPosition ) - mSelectorPos + mMaxWidth;
+ scrollContentsTo( QPointF( newPos, 0 ), time );
+ } else {
+ scrollContentsTo( QPointF( qreal( mFrequencies.value( frequency ).mPosition ) - mSelectorPos, 0 ), time );
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiomainwindow.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,280 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <hbinstance.h>
+#include <hbaction.h>
+#include <hbmessagebox.h>
+#include <hbvolumesliderpopup.h>
+
+#include "radiomainwindow.h"
+#include "radiotuningview.h"
+#include "radiostationsview.h"
+#include "radiowizardview.h"
+#include "radiouiengine.h"
+#include "radiostationmodel.h"
+#include "radiologger.h"
+#include "radioxmluiloader.h"
+#include "radiolocalization.h"
+
+// Constants
+
+/**
+ * Desired amount of delay of volumesliderpopup
+ */
+const int KVolumeSliderDelay = 5000;
+
+/*!
+ *
+ */
+RadioMainWindow::RadioMainWindow( QWidget* parent ) :
+ HbMainWindow( parent ),
+ mUiEngine( 0 )
+{
+}
+
+/*!
+ *
+ */
+RadioMainWindow::~RadioMainWindow()
+{
+ // Destructor needs to be defined. See explanation from RadioEngineWrapperPrivate destructor.
+}
+
+/*!
+ *
+ */
+bool RadioMainWindow::isOfflineUsageAllowed()
+{
+ DummyViewPtr dummyView = prepareToShowDialog();
+
+ const bool answer = HbMessageBox::launchQuestionMessageBox( TRANSLATE( KQueryTextStartOffline ) );
+ dialogShown( dummyView );
+
+ return answer;
+}
+
+/*!
+ *
+ */
+void RadioMainWindow::showErrorMessage( const QString& text )
+{
+ DummyViewPtr dummyView = prepareToShowDialog();
+
+ HbMessageBox::launchWarningMessageBox( text );
+
+ dialogShown( dummyView );
+}
+
+/*!
+ *
+ */
+void RadioMainWindow::init( RadioUiEngine* uiEngine )
+{
+ LOG_METHOD;
+ mUiEngine = uiEngine;
+
+ // MainWindow is the one that always listens for orientation changes and then delegates
+ // the updates to the views
+ connectAndTest( hbInstance->allMainWindows().first(), SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(updateOrientation(Qt::Orientation)) );
+
+ connectAndTest( mUiEngine, SIGNAL(volumeChanged(int)),
+ this, SLOT(showVolumeLevel(int)) );
+ connectAndTest( mUiEngine, SIGNAL(headsetStatusChanged(bool)),
+ this, SLOT(headsetStatusChanged(bool)) );
+
+ const bool firstTimeStart = mUiEngine->isFirstTimeStart();
+ const int rowCount = mUiEngine->model().rowCount();
+ if( firstTimeStart && rowCount == 0 ) {
+ activateWizardView();
+ } else {
+ activateTuningView();
+ }
+}
+
+/*!
+ *
+ */
+RadioUiEngine& RadioMainWindow::uiEngine()
+{
+ return *mUiEngine;
+}
+
+/*!
+ * Returns the XML layout section that corresponds to the view orientation
+ */
+QString RadioMainWindow::orientationSection()
+{
+ return orientation() == Qt::Vertical ? DOCML_LAYOUT_PORTRAIT : DOCML_LAYOUT_LANDSCAPE;
+}
+
+/*!
+ *
+ */
+void RadioMainWindow::activateTuningView()
+{
+ activateView( mTuningView, DOCML_TUNINGVIEW_FILE );
+}
+
+/*!
+ *
+ */
+void RadioMainWindow::activateWizardView()
+{
+ activateView( mWizardView, DOCML_WIZARDVIEW_FILE );
+}
+
+/*!
+ *
+ */
+void RadioMainWindow::activateStationsView()
+{
+ activateView( mStationsView, DOCML_STATIONSVIEW_FILE );
+}
+
+/*!
+ *
+ */
+void RadioMainWindow::activatePlayLogView()
+{
+ activateView( mPlayLogView, DOCML_PLAYLOGVIEW_FILE );
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioMainWindow::updateOrientation( Qt::Orientation orientation )
+{
+ HbView* view = currentView();
+ RADIO_ASSERT( view, "RadioMainWindow::updateOrientation", "Current view not found!" );
+ if ( view ) {
+ static_cast<RadioViewBase*>( view )->updateOrientation( orientation );
+ }
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioMainWindow::showVolumeLevel( int volume )
+{
+ if ( !mVolSlider )
+ {
+ mVolSlider = VolumeSliderPtr( new HbVolumeSliderPopup() );
+ mVolSlider->setRange( 0, KMaximumVolumeLevel );
+ mVolSlider->setSingleStep( 1 );
+ mVolSlider->setTimeout( KVolumeSliderDelay );
+ connectAndTest( mVolSlider.data(), SIGNAL(valueChanged(int)),
+ mUiEngine, SLOT(setVolume(int)) );
+ }
+
+ mVolSlider->setValue( volume );
+ mVolSlider->setText( QString( "%L1%" ).arg( volume * 100 / KMaximumVolumeLevel ) );
+ mVolSlider->show();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioMainWindow::headsetStatusChanged( bool connected )
+{
+ if ( !connected ) {
+ HbMessageBox infoBox( TRANSLATE( KTitleHeadsetDisconnectedPopup ) );
+ infoBox.exec();
+ }
+}
+
+/*!
+ *
+ */
+void RadioMainWindow::activateView( ViewPtr& aMember, const QString& docmlFile )
+{
+ if ( aMember && aMember == currentView() ) {
+ return;
+ }
+
+ // Remove the secondary softkey of the previous view
+ //TODO: Check how the soft keys work nowaways in Orbit. This doesn't seem to do anything
+ RadioViewBase* previousView = static_cast<RadioViewBase*>( currentView() );
+ if ( previousView && previousView->secondarySoftkey() ) {
+ removeSoftKeyAction( Hb::SecondarySoftKey, previousView->secondarySoftkey() );
+ if ( previousView->isTransient() ) {
+ removeView( previousView );
+ previousView->deleteLater();
+ }
+ }
+
+ bool viewCreated = false;
+ if ( !aMember ) {
+ viewCreated = true;
+
+ RadioXmlUiLoader* uiLoader = new RadioXmlUiLoader( *this );
+ bool ok = false;
+
+ // View takes ownership of the ui loader when it is created inside the load function
+ uiLoader->load( docmlFile, &ok );
+
+ RADIO_ASSERT( ok , "FMRadio", "invalid DocML file" );
+ if ( !ok ) {
+ delete uiLoader;
+ uiLoader = 0;
+ return;
+ }
+
+ aMember = ViewPtr( uiLoader->findObject<RadioViewBase>( DOCML_NAME_VIEW ) );
+ aMember->init( this, &mUiEngine->model() );
+ aMember->initSecondarySoftkey();
+
+ addView( aMember );
+ }
+
+ // Add the secondary softkey if the view has one
+ if ( aMember->secondarySoftkey() ) {
+ addSoftKeyAction( Hb::SecondarySoftKey, aMember->secondarySoftkey() );
+ }
+
+ aMember->updateOrientation( orientation(), viewCreated );
+
+ setCurrentView( aMember, true );
+}
+
+/*!
+ *
+ */
+DummyViewPtr RadioMainWindow::prepareToShowDialog()
+{
+ // To be able to draw a dialog on screen we need a HbMainWindow instance and a HbView to get a graphics scene
+ // so we create a dummy view and set it active
+ DummyViewPtr dummyView( new HbView() );
+ addView( dummyView.data() );
+ setCurrentView( dummyView.data() );
+ show();
+ return dummyView;
+}
+
+/*!
+ *
+ */
+void RadioMainWindow::dialogShown( DummyViewPtr pointer )
+{
+ // Clean up the dummy view
+ hide();
+ removeView( pointer.data() );
+ pointer.clear();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radioplaylogview.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <hblistview.h>
+#include <hbaction.h>
+
+// User includes
+#include "radioplaylogview.h"
+#include "radiomainwindow.h"
+#include "radiologger.h"
+#include "radioxmluiloader.h"
+#include "radiouiengine.h"
+#include "radioplaylogmodel.h"
+
+/*!
+ *
+ */
+RadioPlayLogView::RadioPlayLogView( RadioXmlUiLoader* uiLoader ) :
+ RadioViewBase( uiLoader ),
+ mPlayLogList( 0 )
+{
+}
+
+/*!
+ * From RadioViewBase
+ *
+ */
+void RadioPlayLogView::init( RadioMainWindow* aMainWindow, RadioStationModel* aModel )
+{
+ LOG_METHOD;
+ mMainWindow = aMainWindow;
+ mModel = aModel;
+
+ RadioPlayLogModel* playLogModel = &mMainWindow->uiEngine().playLogModel();
+
+ mPlayLogList = mUiLoader->findObject<HbListView>( DOCML_NAME_PLAYLOGLIST );
+ mPlayLogList->setScrollingStyle( HbListView::PanOrFlick );
+ mPlayLogList->setModel( playLogModel );
+ mPlayLogList->setSelectionMode( HbListView::NoSelection );
+ mPlayLogList->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+
+ HbAction* removeAction = mUiLoader->findObject<HbAction>( DOCML_NAME_PLV_REMOVEALLACTION );
+ connectAndTest( removeAction, SIGNAL(triggered()), playLogModel, SLOT(removeAll()) );
+
+ // "Go to tuning view" menu item
+ connectViewChangeMenuItem( DOCML_NAME_PLV_TUNINGVIEWACTION, SLOT(activateTuningView()) );
+
+ // "Go to stations view" menu item
+ connectViewChangeMenuItem( DOCML_NAME_PLV_STATIONSVIEWACTION, SLOT(activateStationsView()) );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiostationcarousel.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,562 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qgraphicslinearlayout>
+#include <hbanchorlayout.h>
+#include <hbpushbutton.h>
+#include <qpixmap>
+#include <QGraphicsSceneMouseEvent>
+#include <hbeffect>
+
+// User includes
+#include "radiostationcarousel.h"
+#include "radiouiengine.h"
+#include "radiostationmodel.h"
+#include "radiofadinglabel.h"
+#include "radiologger.h"
+#include "radiolocalization.h"
+#include "radiostationfiltermodel.h"
+#include "radio_global.h"
+
+#ifdef USE_LAYOUT_FROM_E_DRIVE
+ const QString KFavoriteIconPath = "e:/radiotest/images/favoriteiconactive.png";
+ const QString KNonFavoriteIconPath = "e:/radiotest/images/favoriteiconinactive.png";
+#else
+ const QString KFavoriteIconPath = ":/images/favoriteiconactive.png";
+ const QString KNonFavoriteIconPath = ":/images/favoriteiconinactive.png";
+#endif
+
+// =============================================
+// Station Item
+// =============================================
+
+/*!
+ *
+ */
+RadioStationItem::RadioStationItem( QGraphicsItem* parent ) :
+ HbAbstractViewItem( parent ),
+ mLayout( 0 ),
+ mNameLabel( 0 ),
+ mIconButton( 0 ),
+ mGenreLabel( 0 ),
+ mRadiotextLabel( 0 )
+{
+ setFlag( QGraphicsItem::ItemIsFocusable, true );
+}
+
+/*!
+ * From HbAbstractViewItem
+ *
+ */
+HbAbstractViewItem* RadioStationItem::createItem()
+{
+ return new RadioStationItem( *this ); // Calls copy constructor
+}
+
+/*!
+ * From HbAbstractViewItem
+ */
+void RadioStationItem::updateChildItems()
+{
+ if ( !mLayout )
+ {
+ mNameLabel = new RadioFadingLabel( this );
+ HbFontSpec spec = mNameLabel->fontSpec();
+ spec.setTextPaneHeight( 40 );
+ spec.setRole( HbFontSpec::Primary );
+ mNameLabel->setFontSpec( spec );
+ mNameLabel->setAlignment( Qt::AlignLeft );
+
+ spec.setRole( HbFontSpec::Secondary );
+ spec.setPointSize( 6 );
+
+ mIconButton = new HbPushButton( this );
+ QPixmap background( QSize( 50, 50 ) );
+ background.fill( Qt::transparent );
+ mIconButton->setBackground( HbIcon( background ) );
+ HbIcon favoriteIcon( KFavoriteIconPath );
+ mIconButton->setOrientation( Qt::Horizontal );
+ mIconButton->setIcon( favoriteIcon );
+ mIconButton->setPreferredSize( 50, 50 );
+ connectAndTest( mIconButton, SIGNAL(clicked()), this, SLOT(toggleFavorite()));
+
+ mGenreLabel = new RadioFadingLabel( this );
+ mGenreLabel->setAlignment( Qt::AlignCenter );
+// mGenreLabel->setFadingEnabled( true ); TODO
+ mGenreLabel->setFontSpec( spec );
+ mGenreLabel->setTextColor( Qt::white );
+
+ mRadiotextLabel = new RadioFadingLabel( this );
+ mRadiotextLabel->setAlignment( Qt::AlignCenter );
+ mRadiotextLabel->setTextWrapping( Hb::TextWordWrap );
+// mRadiotextLabel->setFadingEnabled( true ); TODO
+ mRadiotextLabel->setFontSpec( spec );
+ mRadiotextLabel->setTextColor( Qt::white );
+
+ mLayout = new HbAnchorLayout();
+
+ mLayout->setAnchor( mLayout, Hb::TopEdge, mIconButton, Hb::TopEdge, 40.0 );
+ mLayout->setAnchor( mLayout, Hb::LeftEdge, mIconButton, Hb::LeftEdge, 20.0 );
+
+ mLayout->setAnchor( mLayout, Hb::TopEdge, mNameLabel, Hb::TopEdge, 40.0 );
+ mLayout->setAnchor( mIconButton, Hb::RightEdge, mNameLabel, Hb::LeftEdge, 10.0 );
+ mLayout->setAnchor( mLayout, Hb::RightEdge, mNameLabel, Hb::RightEdge, 10.0 );
+
+ mLayout->setAnchor( mNameLabel, Hb::BottomEdge, mGenreLabel, Hb::TopEdge, 0.0 );
+
+ mLayout->setAnchor( mLayout, Hb::LeftEdge, mGenreLabel, Hb::LeftEdge, 10.0 );
+ mLayout->setAnchor( mLayout, Hb::CenterHEdge, mGenreLabel, Hb::CenterHEdge, 0.0 );
+
+ mLayout->setAnchor( mGenreLabel, Hb::BottomEdge, mRadiotextLabel, Hb::TopEdge, 0.0 );
+ mLayout->setAnchor( mLayout, Hb::LeftEdge, mRadiotextLabel, Hb::LeftEdge, 10.0 );
+ mLayout->setAnchor( mLayout, Hb::CenterHEdge, mRadiotextLabel, Hb::CenterHEdge, 0.0 );
+ mLayout->setAnchor( mLayout, Hb::BottomEdge, mRadiotextLabel, Hb::BottomEdge, -20.0 );
+
+ setLayout( mLayout );
+ }
+
+ update();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationItem::toggleFavorite()
+{
+ carousel()->uiEngine().model().setData( modelIndex(), mFrequency, RadioStationModel::ToggleFavoriteRole );
+}
+
+/*!
+ *
+ */
+uint RadioStationItem::frequency() const
+{
+ return mFrequency;
+}
+
+/*!
+ *
+ */
+void RadioStationItem::update( const RadioStation* station )
+{
+ QModelIndex index = modelIndex();
+ if ( !( station && station->isValid() ) && !index.isValid() )
+ {
+ return;
+ }
+
+ RadioStation tempStation = ( station && station->isValid() ) ? *station
+ : index.data( RadioStationModel::RadioStationRole ).value<RadioStation>();
+
+ mNameLabel->setTextWithoutFading( RadioUiEngine::nameOrFrequency( tempStation ) );
+ QString dynamicPs = tempStation.dynamicPsText();
+ mGenreLabel->setText( dynamicPs.isEmpty() ? carousel()->uiEngine().genreToString( tempStation.genre() ) : dynamicPs );
+ mRadiotextLabel->setText( carousel()->isAntennaAttached() ? tempStation.radioText() : TRANSLATE(KConnectHeadsetAntenna) );
+ mFrequency = tempStation.frequency();
+
+ updateFavoriteIcon( tempStation.isFavorite() );
+}
+
+/*!
+ *
+ */
+void RadioStationItem::setFrequency( uint frequency )
+{
+ LOG_FORMAT( "RadioStationItem::setFrequency: %u", frequency );
+ mNameLabel->setTextWithoutFading( RadioUiEngine::parseFrequency( frequency ) );
+ mGenreLabel->setTextWithoutFading( "" );
+ mRadiotextLabel->setTextWithoutFading( carousel()->isAntennaAttached() ? "" : TRANSLATE(KConnectHeadsetAntenna) );
+ mFrequency = frequency;
+ updateFavoriteIcon( false );
+}
+
+/*!
+ *
+ */
+void RadioStationItem::setSeekingText()
+{
+ mNameLabel->setTextWithoutFading( TRANSLATE( KHeadingSeeking ) );
+ mGenreLabel->setTextWithoutFading( "" );
+ mRadiotextLabel->setTextWithoutFading( "" );
+}
+
+/*!
+ *
+ */
+void RadioStationItem::updateFavoriteIcon( bool isFavorite )
+{
+// mIconButton->setOpacity( isFavorite ? 1.0 : 0.5 );
+ mIconButton->setIcon( isFavorite ? KFavoriteIconPath : KNonFavoriteIconPath );
+}
+
+/*!
+ *
+ */
+RadioStationCarousel* RadioStationItem::carousel()
+{
+ return static_cast<RadioStationCarousel*>( itemView() );
+}
+
+// =============================================
+// Station Carousel
+// =============================================
+
+/*!
+ *
+ */
+RadioStationCarousel::RadioStationCarousel( RadioUiEngine& uiEngine, QGraphicsItem* parent ) :
+ HbGridView( parent ),
+ mUiEngine( uiEngine ),
+ mAntennaAttached( false ),
+ mAutoScrollTime( 1000 ),
+ mPreviousButtonPos( 0.0 ),
+ mMovingLeft( false ),
+ mCurrentItem( 0 )
+{
+ mAntennaAttached = mUiEngine.isAntennaAttached();
+
+ setScrollDirections( Qt::Horizontal );
+ setFrictionEnabled( true );
+ setRowCount( 1 );
+ setColumnCount( 1 );
+ setClampingStyle( HbScrollArea::BounceBackClamping );
+ setScrollingStyle( HbScrollArea::PanOrFlick );
+ setLongPressEnabled( false );
+ setItemRecycling( false ); // TODO: Enable recycling
+ setUniformItemSizes( true );
+ setItemPrototype( new RadioStationItem( this ) );
+ setSelectionMode( SingleSelection );
+
+ RadioStationFilterModel* filterModel = mUiEngine.createNewFilterModel( this );
+ filterModel->setCyclic( false );
+
+ setModel( filterModel );
+ mCurrentItem = static_cast<RadioStationItem*>( itemByIndex( model()->index( 0, 0 ) ) );
+
+ updateFrequencies();
+
+ connectAndTest( model(), SIGNAL(rowsInserted(QModelIndex,int,int)),
+ this, SLOT(insertFrequency(QModelIndex,int,int)) );
+ connectAndTest( model(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
+ this, SLOT(removeFrequency(QModelIndex,int,int)) );
+// connectAndTest( model(), SIGNAL(layoutChanged()),
+// this, SLOT(updateFrequencies()) );
+ connectAndTest( this, SIGNAL(scrollingEnded()),
+ this, SLOT(updateLoopedPos()) );
+
+ RadioStationModel* stationModel = &mUiEngine.model();
+ connectAndTest( stationModel, SIGNAL(favoriteChanged(RadioStation)),
+ this, SLOT(update(RadioStation)) );
+ connectAndTest( stationModel, SIGNAL(stationDataChanged(RadioStation)),
+ this, SLOT(update(RadioStation)));
+ connectAndTest( stationModel, SIGNAL(radioTextReceived(RadioStation)),
+ this, SLOT(update(RadioStation)));
+ connectAndTest( stationModel, SIGNAL(dynamicPsChanged(RadioStation)),
+ this, SLOT(update(RadioStation)));
+}
+
+/*!
+ * Property
+ *
+ */
+void RadioStationCarousel::setBackground( const HbIcon& background )
+{
+ mBackground = background;
+}
+
+/*!
+ * Property
+ *
+ */
+HbIcon RadioStationCarousel::background() const
+{
+ return mBackground;
+}
+
+/*!
+ *
+ */
+RadioUiEngine& RadioStationCarousel::uiEngine()
+{
+ return mUiEngine;
+}
+
+/*!
+ *
+ */
+bool RadioStationCarousel::isAntennaAttached() const
+{
+ return mAntennaAttached;
+}
+
+/*!
+ * Private slot
+ */
+void RadioStationCarousel::update( const RadioStation& station )
+{
+ RadioStationItem* item = currentStationItem();
+ if ( item && item->frequency() == station.frequency() ) {
+ item->update( &station );
+ }
+}
+
+/*!
+ * Private slot
+ */
+void RadioStationCarousel::leftGesture( int speedPixelsPerSecond )
+{
+ Q_UNUSED( speedPixelsPerSecond );
+ QModelIndex index = currentIndex();
+
+ if ( index == model()->index( model()->rowCount() - 1, 0 ) ) {
+ index = model()->index( 0, 0 );
+ } else {
+ index = nextIndex( index );
+ }
+
+ scrollToIndex( index, mAutoScrollTime );
+}
+
+/*!
+ * Private slot
+ */
+void RadioStationCarousel::rightGesture( int speedPixelsPerSecond )
+{
+ Q_UNUSED( speedPixelsPerSecond );
+ QModelIndex index = currentIndex();
+
+ if ( index == model()->index( 0, 0 ) ) {
+ index = model()->index( model()->rowCount() - 1, 0 );
+ } else {
+ index = previousIndex( index );
+ }
+
+ scrollToIndex( index, mAutoScrollTime );
+}
+
+/*!
+ * Private slot
+ */
+void RadioStationCarousel::insertFrequency( const QModelIndex& parent, int first, int last )
+{
+ Q_UNUSED( parent );
+ QAbstractItemModel* freqModel = model();
+ for ( int i = first; i <= last; ++i ) {
+ QModelIndex index = freqModel->index( i, 0 );
+ RadioStation station = freqModel->data( index, RadioStationModel::RadioStationRole ).value<RadioStation>();
+ mModelIndexes.insert( station.frequency(), index );
+ LOG_FORMAT( "Added frequency %u", station.frequency() );
+ scrollToIndex( index, 0 );
+ }
+}
+
+/*!
+ * Private slot
+ */
+void RadioStationCarousel::removeFrequency( const QModelIndex& parent, int first, int last )
+{
+ Q_UNUSED( parent );
+ QAbstractItemModel* freqModel = model();
+ for ( int i = first; i <= last; ++i ) {
+ QModelIndex index = freqModel->index( i, 0 );
+ RadioStation station = freqModel->data( index, RadioStationModel::RadioStationRole ).value<RadioStation>();
+ mModelIndexes.remove( station.frequency() );
+ }
+}
+
+/*!
+ * Private slot
+ */
+void RadioStationCarousel::updateFrequencies()
+{
+ mModelIndexes.clear();
+ QAbstractItemModel* itemModel = model();
+ const int count = itemModel->rowCount();
+ for ( int i = 0; i < count; ++i ) {
+ QModelIndex index = itemModel->index( i, 0 );
+ uint frequency = itemModel->data( index, RadioStationModel::RadioStationRole ).value<RadioStation>().frequency();
+ mModelIndexes.insert( frequency, index );
+ }
+}
+
+/*!
+ * Private slot
+ */
+void RadioStationCarousel::updateLoopedPos()
+{
+ const int row = currentIndex().row();
+ if ( filterModel()->hasLooped( currentIndex() ) ) {
+ QModelIndex realIndex = filterModel()->realIndex( currentIndex() );
+ scrollTo( realIndex );
+ setCurrentIndex( realIndex, QItemSelectionModel::SelectCurrent );
+// scrollToIndex( realIndex , 0 );
+ LOG_FORMAT( "Index %d has looped. real index is %d", row, realIndex.row() );
+ }
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioStationCarousel::setFrequency( uint frequency )
+{
+ RadioStationItem* item = currentStationItem();
+ if ( item && item->mFrequency == frequency ) {
+ return;
+ }
+/*
+ QModelIndex index = static_cast<RadioStationFilterModel*>( model() )->modelIndexFromFrequency( frequency );
+ if ( index.isValid() ) {
+ scrollToIndex( index, 0 );
+ } else {
+ if ( item ) {
+ item->setFrequency( frequency );
+ }
+ }
+ */
+/*
+
+
+ QAbstractItemModel* itemModel = model();
+ const int count = itemModel->rowCount();
+ for ( int i = 0; i < count; ++i ) {
+ QModelIndex index = itemModel->index( i, 0 );
+ uint stationFrequency = itemModel->data( index, RadioStationModel::RadioStationRole ).value<RadioStation>().frequency();
+ if ( frequency == stationFrequency ) {
+ scrollToIndex( index, mAutoScrollTime );
+ return;
+ }
+ }
+ */
+
+ if ( mModelIndexes.contains( frequency ) ) {
+ QModelIndex index = mModelIndexes.value( frequency );
+ scrollToIndex( index, 0 );
+ } else {
+ if ( item ) {
+ item->setFrequency( frequency );
+ }
+ }
+}
+
+/*!
+ * Public slot
+ *
+ */
+void RadioStationCarousel::setSeekingText()
+{
+ RadioStationItem* item = currentStationItem();
+ if ( item ) {
+ item->setSeekingText();
+ }
+}
+
+/*!
+ * Public slot
+ */
+void RadioStationCarousel::updateHeadsetStatus( bool connected )
+{
+ mAntennaAttached = connected;
+ RadioStationItem* item = currentStationItem();
+ if ( item ) {
+ item->update();
+ }
+}
+
+/*!
+ * \reimp
+ *
+ */
+void RadioStationCarousel::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget )
+{
+ mBackground.paint( painter, QRectF( QPoint( 0, 0 ), size() ), Qt::IgnoreAspectRatio );
+ HbGridView::paint( painter, option, widget );
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationCarousel::mouseMoveEvent( QGraphicsSceneMouseEvent* event )
+{
+ HbGridView::mouseMoveEvent( event );
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationCarousel::mouseReleaseEvent( QGraphicsSceneMouseEvent* event )
+{
+ QPointF pos = QPointF( size().width() / 2, size().height() / 2 );
+ HbAbstractViewItem* item = itemAtPosition( pos );
+ if ( item ) {
+ scrollToIndex( item->modelIndex(), mAutoScrollTime );
+ }
+
+ HbGridView::mouseReleaseEvent( event );
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationCarousel::resizeEvent( QGraphicsSceneResizeEvent* event )
+{
+ HbGridView::resizeEvent( event );
+ QModelIndex index = filterModel()->modelIndexFromFrequency( mUiEngine.currentFrequency() );
+ setCurrentIndex( index, QItemSelectionModel::SelectCurrent );
+ scrollTo( index );
+}
+
+/*!
+ *
+ */
+RadioStationItem* RadioStationCarousel::currentStationItem()
+{
+ return static_cast<RadioStationItem*>( currentViewItem() );
+// return mCurrentItem;
+}
+
+/*!
+ *
+ */
+RadioStationFilterModel* RadioStationCarousel::filterModel() const
+{
+ return static_cast<RadioStationFilterModel*>( model() );
+}
+
+/*!
+ *
+ */
+void RadioStationCarousel::scrollToIndex( const QModelIndex& index, int time )
+{
+ RadioStationItem* item = static_cast<RadioStationItem*>( itemByIndex( index ) );
+ if ( index.isValid() && item ) {
+ int posX = item->pos().x();
+ const int currentRow = currentIndex().row();
+ const int nextRow = index.row();
+ if ( currentRow != nextRow ) {
+ LOG_FORMAT( "Current row is %d, scrolling to row %d", currentRow, nextRow);
+ }
+ if ( !filterModel()->isEqual( currentIndex(), index ) ) {
+ setCurrentIndex( index, QItemSelectionModel::SelectCurrent );
+ mCurrentItem = static_cast<RadioStationItem*>( item );
+ emit frequencyChanged( static_cast<RadioStationItem*>( item )->frequency(), CommandSender::StationCarousel );
+ }
+ scrollContentsTo( QPointF( posX, 0 ) , time );
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiostationcontrolwidget.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <hbstyleloader.h>
+#include <hbpushbutton.h>
+#include <hbmessagebox.h>
+#include <hbanchorlayout.h>
+
+// User includes
+#include "radiostationcontrolwidget.h"
+#include "radiolocalization.h"
+#include "radioxmluiloader.h"
+#include "radiomainwindow.h"
+#include "radiologger.h"
+#include "radiostation.h"
+#include "radiouiengine.h"
+#include "radiostationmodel.h"
+#include "radioplaylogmodel.h"
+
+
+#ifdef USE_LAYOUT_FROM_E_DRIVE
+ const QString KBlinkEffectFile = "e:/radiotest/effects/blink_in_out_in.fxml";
+#else
+ const QString KBlinkEffectFile = ":/effects/blink_in_out_in.fxml";
+#endif
+const QString KBlinkEffect = "blink_in_out_in";
+
+static const QString FILE_PATH_WIDGETML = ":/layout/radiostationcontrolwidget.widgetml";
+static const QString FILE_PATH_CSS = ":/layout/radiostationcontrolwidget.css";
+
+/*!
+ *
+ */
+RadioStationControlWidget::RadioStationControlWidget( RadioUiEngine& uiEngine, QGraphicsItem* parent ) :
+ HbWidget( parent ),
+ mUiEngine( uiEngine ),
+ mTagSongButton( new HbPushButton( this ) ),
+ mStationsViewButton( new HbPushButton( this ) ),
+ mRecognizeButton( new HbPushButton( this ) ),
+ mMainWindow( 0 )
+{
+ bool registered = HbStyleLoader::registerFilePath( FILE_PATH_WIDGETML );
+ LOG_FORMAT( "registered: %d", registered );
+ registered = HbStyleLoader::registerFilePath( FILE_PATH_CSS );
+ LOG_FORMAT( "registered: %d", registered );
+
+ HbStyle::setItemName( mTagSongButton, "tag_song_button" );
+ HbStyle::setItemName( mRecognizeButton, "recognize_button" );
+ HbStyle::setItemName( mStationsViewButton, "stations_button" );
+}
+
+/*!
+ *
+ */
+RadioStationControlWidget::~RadioStationControlWidget()
+{
+ HbStyleLoader::unregisterFilePath( FILE_PATH_WIDGETML );
+ HbStyleLoader::unregisterFilePath( FILE_PATH_CSS );
+}
+
+/*!
+ * Property
+ *
+ */
+void RadioStationControlWidget::setBackground( const HbIcon& background )
+{
+ mBackground = background;
+}
+
+/*!
+ * Property
+ */
+HbIcon RadioStationControlWidget::background() const
+{
+ return mBackground;
+}
+
+/*!
+ * Property
+ */
+void RadioStationControlWidget::setTagBtnText( const QString& text )
+{
+ mTagSongButton->setText( text );
+}
+
+/*!
+ * Property
+ */
+QString RadioStationControlWidget::tagBtnText() const
+{
+ return mTagSongButton->text();
+}
+
+/*!
+ * Property
+ */
+void RadioStationControlWidget::setRecognizeBtnText( const QString& text )
+{
+ mRecognizeButton->setText( text );
+}
+
+/*!
+ * Property
+ */
+QString RadioStationControlWidget::recognizeBtnText() const
+{
+ return mRecognizeButton->text();
+}
+
+/*!
+ * Property
+ */
+void RadioStationControlWidget::setStationsBtnText( const QString& text )
+{
+ mStationsViewButton->setText( text );
+}
+
+/*!
+ * Property
+ */
+QString RadioStationControlWidget::stationsBtnText() const
+{
+ return mStationsViewButton->text();
+}
+
+/*!
+ *
+ */
+void RadioStationControlWidget::init( RadioMainWindow* aMainWindow )
+{
+ mMainWindow = aMainWindow;
+
+ mTagSongButton->setBackground( HbIcon( " " ) );
+ mRecognizeButton->setBackground( HbIcon( " " ) );
+ mStationsViewButton->setBackground( HbIcon( " " ) );
+
+ mTagSongButton->setIcon( HbIcon( ":/images/tagsongbuttonicon.png" ) );
+ mRecognizeButton->setIcon( HbIcon( ":/images/identifysongbuttonicon.png" ) );
+ mStationsViewButton->setIcon( HbIcon( ":/images/stationsbuttonicon.png" ) );
+
+ RadioPlayLogModel* playLogModel = &mUiEngine.playLogModel();
+ if ( !playLogModel->isCurrentSongRecognized() ) {
+ disableTagButton();
+ } else {
+ enableTagButton();
+ }
+
+ connectAndTest( playLogModel, SIGNAL(currentSongReset()),
+ this, SLOT(disableTagButton()) );
+ connectAndTest( playLogModel, SIGNAL(itemAdded()),
+ this, SLOT(enableTagButton()) );
+
+// if ( RadioUiUtilities::uiEngine().isSongRecognitionAppAvailable() ) {
+ connectAndTest( mRecognizeButton, SIGNAL(clicked()),
+ this, SLOT(recognizePressed()) );
+// } else {
+// mRecognizeButton->setOpacity( 0.4 );
+// }
+
+ connectAndTest( mStationsViewButton, SIGNAL(clicked()),
+ this, SLOT(updateStationsButton()) );
+
+ HbEffect::add( mTagSongButton, KBlinkEffectFile, KBlinkEffect );
+ HbEffect::add( mRecognizeButton, KBlinkEffectFile, KBlinkEffect );
+ HbEffect::add( mStationsViewButton, KBlinkEffectFile, KBlinkEffect );
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationControlWidget::updateStationsButton()
+{
+ HbEffect::start( mStationsViewButton, KBlinkEffect, this, "effectFinished" );
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationControlWidget::recognizePressed()
+{
+ LOG_METHOD;
+ HbEffect::start( mRecognizeButton, KBlinkEffect );
+ mUiEngine.launchSongRecognition();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationControlWidget::effectFinished( HbEffect::EffectStatus status )
+{
+ Q_UNUSED( status );
+ mMainWindow->activateStationsView();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationControlWidget::disableTagButton()
+{
+ mTagSongButton->setOpacity( 0.5 );
+ disconnect( mTagSongButton, SIGNAL(clicked()) );
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationControlWidget::enableTagButton()
+{
+ mTagSongButton->setOpacity( 1 );
+ RadioPlayLogModel* playLogModel = &mUiEngine.playLogModel();
+ connectAndTest( mTagSongButton, SIGNAL(clicked()),
+ playLogModel, SLOT(setFavorite()) );
+}
+
+/*!
+ * \reimp
+ *
+ */
+void RadioStationControlWidget::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget )
+{
+ HbWidget::paint( painter, option, widget );
+ mBackground.paint( painter, QRectF( QPoint( 0, 0 ), size() ), Qt::IgnoreAspectRatio );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiostationsview.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,284 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <hblistview.h>
+#include <hbabstractviewitem.h>
+#include <hbpushbutton.h>
+#include <hbeffect.h>
+#include <hbaction.h>
+
+// User includes
+#include "radiostationsview.h"
+#include "radiologger.h"
+#include "radiomainwindow.h"
+
+#include "radiolocalization.h"
+#include "radiouiengine.h"
+#include "radiobannerlabel.h"
+#include "radiofrequencyscanner.h"
+#include "radiocontextmenu.h"
+#include "radioxmluiloader.h"
+#include "radiostationmodel.h"
+#include "radiostationfiltermodel.h"
+
+/*!
+ *
+ */
+RadioStationsView::RadioStationsView( RadioXmlUiLoader* uiLoader ) :
+ RadioViewBase( uiLoader, false ),
+ mStationsList( 0 ),
+ mHeadingBanner( 0 ),
+ mFavoritesButton( 0 ),
+ mLocalStationsButton( 0 )
+{
+}
+
+/*!
+ *
+ */
+void RadioStationsView::setNowPlayingIcon( const HbIcon& nowPlayingIcon )
+{
+ mNowPlayingIcon = nowPlayingIcon;
+}
+
+/*!
+ *
+ */
+HbIcon RadioStationsView::nowPlayingIcon() const
+{
+ return mNowPlayingIcon;
+}
+
+/*!
+ *
+ */
+void RadioStationsView::setFavoriteIcon( const HbIcon& favoriteIcon )
+{
+ mFavoriteIcon = favoriteIcon;
+}
+
+/*!
+ *
+ */
+HbIcon RadioStationsView::favoriteIcon() const
+{
+ return mFavoriteIcon;
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationsView::listItemClicked( const QModelIndex& index )
+{
+ LOG_TIMESTAMP( "Channel change started" );
+ QModelIndex sourceIndex = mFilterModel->mapToSource( index );
+ RadioStation station = mModel->stationAt( sourceIndex.row() );
+ RADIO_ASSERT( station.isValid(), "FMRadio", "invalid RadioStation");
+ mMainWindow->uiEngine().tunePreset( station.presetIndex() );
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationsView::listItemLongPressed( HbAbstractViewItem* item, const QPointF& coords )
+{
+ QModelIndex sourceIndex = mFilterModel->mapToSource( item->modelIndex() );
+ RadioStation station = mModel->stationAt( sourceIndex.row() );
+ RADIO_ASSERT( station.isValid() , "FMRadio", "invalid RadioStation");
+
+ //TODO: Remove this. This is a temporary workaround for an Orbit bug in HbMenu
+// RadioContextMenu* menu = new RadioContextMenu( mMainWindow->uiEngine() );
+// menu->init( station, QPointF( size().width() / 2, coords.y() ) );
+
+ RadioContextMenu* menu = mUiLoader->findObject<RadioContextMenu>( DOCML_NAME_CONTEXT_MENU );
+ menu->init( station, *mUiLoader );
+ menu->setPos( QPointF( size().width() / 2 - menu->size().width() / 2, coords.y() - menu->size().height() / 2 ) );
+ menu->exec();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationsView::updateHeadsetStatus( bool connected )
+{
+ Q_UNUSED( connected );
+ updateControlVisibilities();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationsView::updateCurrentStation()
+{
+ mFilterModel->invalidate();
+}
+
+/*!
+ * Private slot
+ *
+ */
+
+void RadioStationsView::deckButtonPressed()
+{
+ if ( sender() == mFavoritesButton ) {
+ mHeadingBanner->setPlainText( TRANSLATE( KHeadingTextFavorites ));
+ } else {
+ mHeadingBanner->setPlainText( TRANSLATE( KHeadingTextLocalStations ));
+ }
+
+ const bool showFavorites = mFavoritesButton->isChecked();
+ mFilterModel->setTypeFilter( showFavorites ? RadioStation::Favorite
+ : RadioStation::LocalStation );
+
+ updateControlVisibilities();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationsView::startScanAndSavePresets()
+{
+ RadioFrequencyScanner* scanner = new RadioFrequencyScanner( mMainWindow->uiEngine(), this );
+ scanner->startScanning();
+ connectAndTest( scanner, SIGNAL(frequencyScannerFinished()),
+ this, SLOT(updateControlVisibilities()) );
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioStationsView::updateControlVisibilities()
+{
+ LOG_SLOT_CALLER;
+ const bool listEmpty = mModel->rowCount() == 0;
+ const bool localStationsMode = !mFavoritesButton->isChecked();
+ if ( HbPushButton* button = mUiLoader->findWidget<HbPushButton>( DOCML_NAME_SCANBUTTON ) )
+ {
+#ifdef USE_DEBUGGING_CONTROLS
+ button->setVisible( listEmpty && localStationsMode );
+#else
+ button->setVisible( false );
+#endif
+ }
+
+ mScanStationsAction->setVisible( mMainWindow->uiEngine().isAntennaAttached()
+ && localStationsMode
+ && !mMainWindow->uiEngine().isScanning() );
+ mRemoveAllPresetsAction->setVisible( !listEmpty && localStationsMode );
+}
+
+/*!
+ * From RadioViewBase
+ *
+ */
+void RadioStationsView::init( RadioMainWindow* aMainWindow, RadioStationModel* aModel )
+{
+ LOG_METHOD;
+ mMainWindow = aMainWindow;
+ mModel = aModel;
+
+ RadioUiEngine* engine = &mMainWindow->uiEngine();
+
+ mFilterModel = engine->createNewFilterModel( this );
+ mFilterModel->setTypeFilter( RadioStation::LocalStation );
+
+ if ( !mFavoriteIcon.isNull() && !mNowPlayingIcon.isNull() ) {
+ mModel->setIcons( mFavoriteIcon.qicon(), mNowPlayingIcon.qicon() );
+ }
+ mModel->setDetail( RadioStationModel::ShowIcons | RadioStationModel::ShowGenre );
+
+ mStationsList = mUiLoader->findObject<HbListView>( DOCML_NAME_STATIONSLIST );
+ mHeadingBanner = mUiLoader->findWidget<RadioBannerLabel>( DOCML_NAME_HEADINGBANNER );
+ mFavoritesButton = mUiLoader->findObject<HbAction>( DOCML_NAME_FAVORITESBUTTON );
+ mLocalStationsButton = mUiLoader->findObject<HbAction>( DOCML_NAME_LOCALSBUTTON );
+
+ connectAndTest( engine, SIGNAL(headsetStatusChanged(bool)),
+ this, SLOT(updateHeadsetStatus(bool)) );
+ connectAndTest( mModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
+ this, SLOT(updateControlVisibilities() ) );
+ connectAndTest( mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
+ this, SLOT(updateControlVisibilities()) );
+ connectAndTest( mModel, SIGNAL(modelReset() ),
+ this, SLOT(updateControlVisibilities() ) );
+ connectAndTest( mFavoritesButton, SIGNAL(triggered() ),
+ this, SLOT(deckButtonPressed() ) );
+ connectAndTest( mLocalStationsButton, SIGNAL(triggered() ),
+ this, SLOT(deckButtonPressed() ) );
+
+ connectAndTest( engine, SIGNAL(tunedToFrequency(uint,int)), this, SLOT(updateCurrentStation()) );
+
+ // "Go to tuning view" menu item
+ connectViewChangeMenuItem( DOCML_NAME_TUNINGVIEWACTION, SLOT(activateTuningView()) );
+
+ // "Go to wizard view" menu item
+#ifdef USE_DEBUGGING_CONTROLS
+ connectViewChangeMenuItem( DOCML_NAME_WIZARDVIEWACTION, SLOT(activateWizardView()) );
+#else
+ mUiLoader->findObject<HbAction>( DOCML_NAME_WIZARDVIEWACTION )->setVisible( false );
+#endif // USE_DEBUGGING_CONTROLS
+
+ // "Scan local stations" menu item
+ mScanStationsAction = mUiLoader->findObject<HbAction>( DOCML_NAME_SCANSTATIONSACTION );
+
+ // "Remove all presets" menu item
+ mRemoveAllPresetsAction = mUiLoader->findObject<HbAction>( DOCML_NAME_REMOVESTATIONSACTION );
+
+ connectCommonMenuItem( MenuItem::UseLoudspeaker );
+
+ // Connect the "Remove all presets" menu item
+ connectXmlElement( DOCML_NAME_REMOVESTATIONSACTION, SIGNAL(triggered()), mModel, SLOT(removeAll()) );
+
+ initListView();
+}
+
+/*!
+ * \reimp
+ */
+void RadioStationsView::showEvent( QShowEvent* event )
+{
+ RadioViewBase::showEvent( event );
+ mModel->setDetail( RadioStationModel::ShowIcons | RadioStationModel::ShowGenre );
+ updateControlVisibilities();
+ updateHeading();
+}
+
+/*!
+ *
+ */
+void RadioStationsView::initListView()
+{
+ mStationsList->setScrollingStyle( HbListView::PanOrFlick );
+ mStationsList->setModel( mFilterModel );
+ mStationsList->setSelectionMode( HbListView::NoSelection );
+ mStationsList->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+}
+
+/*!
+ *
+ */
+void RadioStationsView::updateHeading()
+{
+ mHeadingBanner->setPlainText( mFavoritesButton->isChecked() ? TRANSLATE( KHeadingTextFavorites )
+ : TRANSLATE( KHeadingTextLocalStations ) );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiostripbase.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,543 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <qgraphicssceneevent>
+
+// User includes
+#include "radiostripbase.h"
+#include "radiologger.h"
+
+// Constants
+
+/*!
+ *
+ */
+RadioStripBase::RadioStripBase( QGraphicsItem* parent ) :
+ HbScrollArea( parent ),
+ mAutoScrollTime( 0 ),
+ mStripContainer( new HbWidget( this ) ),
+ mModel( 0 ),
+ mIsCyclic( true ),
+ mAutoCenter( false ),
+ mSpacing( 0 ),
+ mItemPoolParent( new QGraphicsWidget( NULL ) ),
+ mCurrentIndex( 0 ),
+ mPressedIndex( 0 ),
+ mStripLength( 0 ),
+ mContentsLength( 0 ),
+ mBackgroundImage( 0 )
+{
+ setClampingStyle( HbScrollArea::NoClamping );
+ setScrollDirections( Qt::Horizontal );
+ setFlag( QGraphicsItem::ItemClipsChildrenToShape, true );
+ setContentWidget( mStripContainer );
+ setFrictionEnabled( true );
+ setLongPressEnabled( false );
+ setHorizontalScrollBarPolicy( HbScrollArea::ScrollBarAlwaysOff );
+ setVerticalScrollBarPolicy( HbScrollArea::ScrollBarAlwaysOff );
+
+ // mItemParent is used to hold the unused QGraphicsItem's in the pool. It's visibility is set to false
+ // so the visibility of the items doesn't need to be modified.
+ mItemPoolParent->setVisible( false );
+
+ connectAndTest( this, SIGNAL(scrollPositionChanged(QPointF)),
+ this, SLOT(scrollPositionChanged(QPointF)));
+}
+
+/*!
+ *
+ */
+RadioStripBase::~RadioStripBase()
+{
+}
+
+/*!
+ *
+ */
+void RadioStripBase::setBackground( const HbIcon& background )
+{
+ // Create background image for the entire widget
+ mBackground = background;
+ if ( !mBackgroundImage ) {
+ mBackgroundImage = new QGraphicsPixmapItem( this );
+ }
+ mBackgroundImage->setPixmap( mBackground.pixmap() );
+ mBackgroundImage->setOffset( QPointF( 0.0, 0.0 ) );
+ mBackgroundImage->setZValue( -10.0 );
+}
+
+/*!
+ *
+ */
+HbIcon RadioStripBase::background() const
+{
+ return mBackground;
+}
+
+/*!
+ *
+ */
+void RadioStripBase::setAutoScrollTime( const int time )
+{
+ mAutoScrollTime = time;
+}
+
+/*!
+ *
+ */
+int RadioStripBase::autoScrollTime() const
+{
+ return mAutoScrollTime;
+}
+
+/*!
+ *
+ */
+void RadioStripBase::setModel( QAbstractItemModel* model )
+{
+ if ( mModel != model )
+ {
+ // if ( mModel )
+ // {
+ // disconnectDataModel();
+ // }
+
+ mModel = model;
+
+ if ( mModel )
+ {
+ // connectDataModel();
+
+ mCurrentIndex = 0;
+ populateAndLayout();
+ }
+ }
+}
+
+/*!
+ *
+ */
+QAbstractItemModel* RadioStripBase::model() const
+{
+ return mModel;
+}
+
+/*!
+ *
+ */
+void RadioStripBase::setCyclic( bool isCyclic )
+{
+ mIsCyclic = isCyclic;
+}
+
+/*!
+ *
+ */
+void RadioStripBase::setSpacing( qreal spacing )
+{
+ if ( mSpacing != spacing )
+ {
+ mSpacing = spacing;
+
+ prepareGeometryChange();
+
+ populateAndLayout();
+
+ update();
+ updateGeometry();
+ }
+}
+
+/*!
+ *
+ */
+void RadioStripBase::setAutoCenter( bool autoCenter )
+{
+ mAutoCenter = autoCenter;
+}
+
+/*!
+ *
+ */
+void RadioStripBase::setItemSize( const QSizeF& size )
+{
+ if ( mItemSize != size ) {
+ mItemSize = size;
+
+ prepareGeometryChange();
+
+ populateAndLayout();
+
+ update();
+ updateGeometry();
+ }
+}
+
+/*!
+ *
+ */
+void RadioStripBase::setIndex( int index, bool animateToCenter )
+{
+ Q_UNUSED( animateToCenter )
+ // Sanity checks
+ if ( !mModel || ( !mIsCyclic && ( index < 0 || index >= mModel->rowCount() ) ) ) {
+ return;
+ }
+
+ const int oldIndex = mCurrentIndex;
+ if ( mIsCyclic )
+ {
+ int numRows = mModel->rowCount();
+ index = (index + numRows) % numRows;
+ }
+ Q_ASSERT( index >= 0 );
+
+ mCurrentIndex = index;
+
+ updateItemWithIndex( mCurrentIndex );
+ updateItemWithIndex( oldIndex );
+}
+
+/*!
+ * \reimp
+ */
+void RadioStripBase::resizeEvent( QGraphicsSceneResizeEvent* event )
+{
+ QPixmap background = mBackgroundImage->pixmap().scaledToWidth( event->newSize().width() );
+ mBackgroundImage->setPixmap( background );
+ populateAndLayout();
+}
+
+/*!
+ * \reimp
+ */
+void RadioStripBase::mousePressEvent( QGraphicsSceneMouseEvent* event )
+{
+ if ( event->button() != Qt::LeftButton || !mModel || !mModel->rowCount() )
+ {
+ event->ignore();
+ return;
+ }
+
+ HbScrollArea::mousePressEvent( event );
+}
+
+/*!
+ * \reimp
+ */
+void RadioStripBase::mouseReleaseEvent( QGraphicsSceneMouseEvent* event )
+{
+ if ( event->button() != Qt::LeftButton )
+ {
+ event->ignore();
+ return;
+ }
+
+ HbScrollArea::mouseReleaseEvent( event );
+}
+
+/*!
+ * Private slot
+ */
+void RadioStripBase::scrollPositionChanged( QPointF newPosition )
+{
+ adjustItems();
+ scrollPosChanged( newPosition );
+}
+
+/*!
+ *
+ */
+void RadioStripBase::scrollPosChanged( QPointF newPosition )
+{
+ Q_UNUSED( newPosition );
+}
+
+/*!
+ *
+ */
+void RadioStripBase::moveAllItemsToPool()
+{
+ // set parent of all items to pool
+ foreach( QGraphicsItem* item, mItemAtSlot )
+ {
+ item->setParentItem( mItemPoolParent );
+ }
+
+ // move all items to pool
+ mItemPool += mItemAtSlot;
+ mItemAtSlot.clear();
+ mIndexAtSlot.clear();
+}
+
+/*!
+ *
+ */
+void RadioStripBase::populateAndLayout()
+{
+ moveAllItemsToPool();
+
+ if ( !mModel || mModel->rowCount() == 0 )
+ {
+ return;
+ }
+
+ mStripLength = boundingRect().width();
+ qreal itemSize = mItemSize.width();
+ mContentsLength = mModel->rowCount() * (itemSize + mSpacing) + mSpacing;
+
+ if ( mIsCyclic )
+ {
+ // if treating the items cyclically, double the content area so it can
+ // be shifted back and forth as you scroll
+ mContentsLength = mModel->rowCount() * (itemSize + mSpacing);
+ mContentsLength *= 2.0;
+ }
+
+ qreal currPos = mSpacing;
+ for ( int i = 0; i < mModel->rowCount(); ++i ) {
+ if ( currPos > mStripLength )
+ {
+ break;
+ }
+
+ QGraphicsItem* item = constructItem( i, true );
+ if ( item )
+ {
+ item->setPos( QPointF( currPos, mSpacing ) );
+ currPos += itemSize + mSpacing;
+ }
+ }
+
+ QRectF contentsRect(0,0,0,0);
+ contentsRect.setBottom( itemSize + 2 * mSpacing );
+ contentsRect.setRight( mContentsLength );
+
+ mStripContainer->setGeometry( contentsRect );
+
+ if ( mCurrentIndex >= 0 )
+ {
+ setIndex( mCurrentIndex, false );
+ }
+}
+
+/*!
+ *
+ */
+QGraphicsItem* RadioStripBase::constructItem( int index, bool append )
+{
+ QGraphicsItem* item = getFromPool();
+
+ if ( mIsCyclic )
+ {
+ Q_ASSERT( index >= 0 && index < 2 * mModel->rowCount() );
+
+ updateItemPrimitive( item, index % mModel->rowCount() );
+ }
+ else
+ {
+ Q_ASSERT( index >= 0 && index < mModel->rowCount() );
+
+ updateItemPrimitive( item, index );
+ }
+
+ item->setParentItem( mStripContainer );
+
+ if ( append )
+ {
+ mItemAtSlot.append( item );
+ mIndexAtSlot.append( index );
+ }
+ else
+ {
+ mItemAtSlot.prepend( item );
+ mIndexAtSlot.prepend( index );
+ }
+
+ return item;
+}
+
+/*!
+ *
+ */
+QGraphicsItem* RadioStripBase::getFromPool()
+{
+ QGraphicsItem* item = 0;
+
+ if ( mItemPool.isEmpty() )
+ {
+ item = createItemPrimitive( this );
+ }
+ else
+ {
+ item = mItemPool.takeFirst();
+ }
+
+ return item;
+}
+
+/*!
+ *
+ */
+void RadioStripBase::returnToPool( QGraphicsItem* item )
+{
+ // Unparent the item so it doesn't get deleted
+ item->setParentItem( mItemPoolParent );
+ mItemPool.append( item );
+}
+
+/*!
+ * Returns starting coordinate of the item with the specified index
+ */
+qreal RadioStripBase::indexToOffset( int index )
+{
+ return index * ( mItemSize.width() + mSpacing ) + mSpacing;
+}
+
+/*!
+ * Returns item index for specified offset amount into the content
+ */
+int RadioStripBase::offsetToIndex( qreal offset )
+{
+ const int rows = mModel->rowCount();
+ int index = (int)( ( offset - mSpacing) / ( mItemSize.width() + mSpacing ) );
+
+ if ( mIsCyclic )
+ {
+ return qBound( 0, index, 2 * rows - 1 );
+ }
+
+ return qBound( 0, index, rows - 1 );
+}
+
+/*!
+ * updates items with specified index value
+ */
+void RadioStripBase::updateItemWithIndex( int index )
+{
+ if( index >= 0 )
+ {
+ QList<QGraphicsItem *>::const_iterator item = mItemAtSlot.constBegin();
+ QList<QGraphicsItem *>::const_iterator itemsEnd = mItemAtSlot.constEnd();
+ QList<int>::const_iterator itemIndex = mIndexAtSlot.constBegin();
+ const int rowCount = mModel->rowCount();
+
+ // Find all items with this index (can be 2 in special cycling case)
+ for( ; item != itemsEnd; ++item, ++itemIndex )
+ {
+ if( index == *itemIndex || index == *itemIndex - rowCount )
+ {
+ // update those items
+ updateItemPrimitive( *item, index );
+ }
+ }
+ }
+}
+
+/*!
+ * Updates items during scrolling: removing invisible items and adding items that became visible
+ */
+void RadioStripBase::adjustItems()
+{
+ qreal contentPos = mStripContainer->pos().x();
+
+ if ( mIsCyclic )
+ {
+ if ( -contentPos < 0 )
+ {
+ // trying to display off the left end of the strip, so
+ // shift the strip one length to the left
+ contentPos -= mContentsLength * 0.5;
+ mStripContainer->setPos( QPointF ( contentPos, mStripContainer->pos().y() ) );
+ } else if (-contentPos > mContentsLength * 0.5) {
+ // trying to display off the right end of the strip, so
+ // shift the strip one length to the right
+ contentPos += mContentsLength * 0.5;
+ mStripContainer->setPos( QPointF ( contentPos, mStripContainer->pos().y() ) );
+ }
+ }
+
+ // find the first and last indices of the visible items
+ int firstVisibleIndex = offsetToIndex( -contentPos );
+ int lastVisibleIndex = offsetToIndex( -contentPos + mStripLength );
+
+ // remove items at the start that are no longer visible
+ while ( !mIndexAtSlot.isEmpty() )
+ {
+ int firstSlotIndex = mIndexAtSlot.first();
+ if ( firstVisibleIndex <= firstSlotIndex )
+ {
+ break;
+ }
+
+ returnToPool( mItemAtSlot.first() );
+ mItemAtSlot.removeFirst();
+ mIndexAtSlot.removeFirst();
+ }
+
+ // remove items at the end that are no longer visible
+ while ( !mIndexAtSlot.isEmpty() )
+ {
+ int lastSlotIndex = mIndexAtSlot.last();
+ if ( lastVisibleIndex >= lastSlotIndex )
+ {
+ break;
+ }
+
+ returnToPool( mItemAtSlot.last() );
+ mItemAtSlot.removeLast();
+ mIndexAtSlot.removeLast();
+ }
+
+ if ( mItemAtSlot.isEmpty() )
+ {
+ // fill area with all needed items
+ for ( int i = firstVisibleIndex; i <= lastVisibleIndex; ++i )
+ {
+ QGraphicsItem* item = constructItem( i, true );
+ if ( item )
+ {
+ item->setPos( QPointF( indexToOffset( i ), mSpacing ) );
+ }
+ }
+ }
+ else
+ {
+ // add missing items at the front
+ int firstItemToCreate = mIndexAtSlot.first()-1;
+ for ( int i = firstItemToCreate; i >= firstVisibleIndex; --i )
+ {
+ QGraphicsItem* item = constructItem( i, false );
+ if ( item )
+ {
+ item->setPos( QPointF( indexToOffset( i ), mSpacing ) );
+ }
+ }
+
+ // add missing items at the end
+ firstItemToCreate = mIndexAtSlot.last()+1;
+ for ( int i = firstItemToCreate; i <= lastVisibleIndex; ++i )
+ {
+ QGraphicsItem* item = constructItem( i, true );
+ if ( item )
+ {
+ item->setPos( QPointF( indexToOffset( i ), mSpacing ) );
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiotuningview.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+
+// User includes
+#include "radiomainwindow.h"
+#include "radiotuningview.h"
+#include "radiofrequencystrip.h"
+#include "radiolocalization.h"
+#include "radiouiengine.h"
+#include "radiologger.h"
+#include "radiostationcarousel.h"
+#include "radiostationcontrolwidget.h"
+#include "radioxmluiloader.h"
+#include "radiostationmodel.h"
+
+/*!
+ *
+ */
+RadioTuningView::RadioTuningView( RadioXmlUiLoader* uiLoader ) :
+ RadioViewBase( uiLoader, false )
+{
+}
+
+/*!
+ * From RadioViewBase
+ *
+ */
+void RadioTuningView::init( RadioMainWindow* aMainWindow, RadioStationModel* aModel )
+{
+ LOG_METHOD;
+ mMainWindow = aMainWindow;
+ mModel = aModel;
+
+ RadioStationCarousel* carousel = mUiLoader->findObject<RadioStationCarousel>( DOCML_NAME_STATIONCAROUSEL );
+
+ RadioStationControlWidget* stationControlWidget = mUiLoader->findObject<RadioStationControlWidget>( DOCML_NAME_STATIONCONTROLWIDGET );
+ stationControlWidget->init( mMainWindow );
+
+ // Note! UI connections are already made in the DocML file. Here we need to connect UI to engine
+ RadioUiEngine* engine = &mMainWindow->uiEngine();
+ RadioFrequencyStrip* frequencyStrip = mUiLoader->findObject<RadioFrequencyStrip>( DOCML_NAME_FREQUENCYSTRIP );
+ RadioStationModel* stationModel = &engine->model();
+
+ connectAndTest( frequencyStrip, SIGNAL(frequencyChanged(uint,int)),
+ engine, SLOT(tuneWithDelay(uint,int)) );
+ connectAndTest( frequencyStrip, SIGNAL(frequencyChanged(uint,int)),
+ carousel, SLOT(setFrequency(uint)) );
+ connectAndTest( carousel, SIGNAL(frequencyChanged(uint,int)),
+ frequencyStrip, SLOT(setFrequency(uint,int)) );
+ connectAndTest( engine, SIGNAL(tunedToFrequency(uint,int)),
+ frequencyStrip, SLOT(setFrequency(uint,int)) );
+ connectAndTest( stationModel, SIGNAL(favoriteChanged(RadioStation)),
+ frequencyStrip, SLOT(favoriteChanged(RadioStation)) );
+ connectAndTest( frequencyStrip, SIGNAL(swipedLeft()),
+ engine, SLOT(skipNext()) );
+ connectAndTest( frequencyStrip, SIGNAL(swipedRight()),
+ engine, SLOT(skipPrevious()) );
+ connectAndTest( engine, SIGNAL(seekingStarted(int)),
+ carousel, SLOT(setSeekingText()) );
+ connectAndTest( engine, SIGNAL(headsetStatusChanged(bool)),
+ carousel, SLOT(updateHeadsetStatus(bool)) );
+
+ frequencyStrip->connectLeftButton( SIGNAL(clicked()), engine, SLOT(skipPrevious()) );
+ frequencyStrip->connectRightButton( SIGNAL(clicked()), engine, SLOT(skipNext()) );
+
+ frequencyStrip->connectLeftButton( SIGNAL(longPress(QPointF)), engine, SLOT(seekUp()) );
+ frequencyStrip->connectRightButton( SIGNAL(longPress(QPointF)), engine, SLOT(seekDown()) );
+
+ // "Play log" menu item
+ connectViewChangeMenuItem( DOCML_NAME_PLAYLOGVIEWACTION, SLOT(activatePlayLogView()) );
+
+ // "StationsView" menu item
+ connectViewChangeMenuItem( DOCML_NAME_STATIONSVIEWACTION, SLOT(activateStationsView()) );
+
+ connectCommonMenuItem( MenuItem::UseLoudspeaker );
+}
+
+/*!
+ * From RadioViewBase
+ *
+ */
+void RadioTuningView::initSecondarySoftkey()
+{
+ // Intentionally empty so that the tuning view won't have the back button
+}
+
+/*!
+ * From RadioViewBase
+ *
+ */
+void RadioTuningView::setOrientation()
+{
+ bool ok = false;
+ QString section = mMainWindow->orientationSection();
+ mUiLoader->load( DOCML_TUNINGVIEW_FILE, section, &ok );
+// LOG_ASSERT( ok, LOG_FORMAT( "Failed to set orientation %1 from docml %2", section, *DOCML_TUNINGVIEW_FILE ) );
+}
+
+/*!
+ * Private slot
+ */
+void RadioTuningView::toggleFavorite()
+{
+ bool favorite = false;
+ uint frequency = mUiLoader->findObject<RadioFrequencyStrip>( DOCML_NAME_FREQUENCYSTRIP )->frequency( &favorite );
+ mModel->setFavoriteByFrequency( frequency, !favorite );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiouiutilities.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <hbeffect.h>
+
+// User includes
+#include "radiouiutilities.h"
+#include "radiologger.h"
+
+// Constants
+
+/*!
+ *
+ */
+bool RadioUiUtilities::addEffects( QEffectList list )
+{
+ bool allAvailable = true;
+ QEffectList added;
+ foreach ( EffectInfo info, list ) {
+#ifdef USE_LAYOUT_FROM_E_DRIVE
+ info.mPath.replace( QString( ":/" ), QString( "e:/radiotest/" ) );
+#endif
+ if ( HbEffect::add( info.mItem, info.mPath, info.mEvent ) ) {
+ added.append( info );
+ } else {
+ allAvailable = false;
+ break;
+ }
+ }
+
+ if ( !allAvailable ) {
+ foreach ( const EffectInfo& info, added ) {
+ HbEffect::remove( info.mItem, info.mPath, info.mEvent );
+ }
+ }
+
+ return allAvailable;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radioviewbase.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hbeffect.h>
+#include <qcoreapplication>
+
+#include "radioviewbase.h"
+#include "radiomainwindow.h"
+#include "radiostationmodel.h"
+#include "radioxmluiloader.h"
+#include "radiouiengine.h"
+#include "radiolocalization.h"
+#include "radiologger.h"
+
+/*!
+ *
+ */
+RadioViewBase::RadioViewBase( RadioXmlUiLoader* uiLoader, bool transient ) :
+ HbView( 0 ),
+ mMainWindow( 0 ),
+ mModel( 0 ),
+ mUiLoader( uiLoader ),
+ mTransientView( transient ),
+ mUseLoudspeakerAction( 0 ),
+ mSecondarySoftkeyction( 0 ),
+ mOrientation( Qt::Vertical )
+{
+}
+
+/*!
+ *
+ */
+RadioViewBase::~RadioViewBase()
+{
+ if ( mUiLoader )
+ {
+ mUiLoader->reset();
+ }
+}
+
+/*!
+ *
+ */
+void RadioViewBase::init( RadioMainWindow* aMainWindow, RadioStationModel* aModel )
+{
+ // Default implementation does nothing
+ Q_UNUSED( aMainWindow );
+ Q_UNUSED( aModel );
+}
+
+/*!
+ *
+ */
+bool RadioViewBase::isTransient() const
+{
+ return mTransientView;
+}
+
+/*!
+ *
+ */
+void RadioViewBase::initSecondarySoftkey()
+{
+ // The default back button activates the tuning view
+ mSecondarySoftkeyction = new HbAction( Hb::BackAction, this );
+ connectAndTest( mSecondarySoftkeyction, SIGNAL(triggered()),
+ mMainWindow, SLOT(activateTuningView()) );
+}
+
+/*!
+ *
+ */
+HbAction* RadioViewBase::secondarySoftkey() const
+{
+ return mSecondarySoftkeyction;
+}
+
+/*!
+ *
+ */
+void RadioViewBase::updateOrientation( Qt::Orientation orientation, bool forceUpdate )
+{
+ if ( orientation != mOrientation || forceUpdate )
+ {
+ mOrientation = orientation;
+ setOrientation();
+ }
+}
+
+/*!
+ * Protected slot
+ *
+ */
+void RadioViewBase::updateAudioRouting( bool loudspeaker )
+{
+ if ( mUseLoudspeakerAction ) {
+ mUseLoudspeakerAction->setText( loudspeaker ? TRANSLATE( KMenuUseHeadset ) : TRANSLATE( KMenuUseLoudspeaker ) );
+ }
+}
+
+/*!
+ * Protected slot
+ *
+ */
+void RadioViewBase::activatePreviousView()
+{
+ mMainWindow->activateTuningView();
+}
+
+/*!
+ * Protected slot
+ *
+ */
+void RadioViewBase::quit()
+{
+ qApp->quit();
+}
+
+/*!
+ *
+ */
+HbAction* RadioViewBase::addMenuItem( const QString& aTitle, QObject* aRecipient, const char* aSlot )
+{
+ HbAction* action = menu()->addAction( aTitle );
+ connectAndTest( action, SIGNAL(triggered()), aRecipient, aSlot );
+ return action;
+}
+
+/*!
+ *
+ */
+void RadioViewBase::connectCommonMenuItem( int menuItem )
+{
+ RadioUiEngine* engine = &mMainWindow->uiEngine();
+ switch ( menuItem )
+ {
+ case MenuItem::UseLoudspeaker:
+ mUseLoudspeakerAction = mUiLoader->findObject<HbAction>( DOCML_NAME_LOUDSPEAKERACTION );
+ if ( mUseLoudspeakerAction ) {
+ connectAndTest( mUseLoudspeakerAction, SIGNAL(triggered()), engine, SLOT(toggleAudioRoute()) );
+ updateAudioRouting( engine->isUsingLoudspeaker() );
+ connectAndTest( engine, SIGNAL(audioRouteChanged(bool)), this, SLOT(updateAudioRouting(bool)) );
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*!
+ *
+ */
+void RadioViewBase::connectXmlElement( const char* name, const char* signal, QObject* receiver, const char* slot )
+{
+ if ( QObject* action = mUiLoader->findObject<QObject>( name ) )
+ {
+ connectAndTest( action, signal, receiver, slot );
+ }
+}
+
+/*!
+ *
+ */
+void RadioViewBase::connectViewChangeMenuItem( QString name, const char* slot )
+{
+ if ( QObject* action = mUiLoader->findObject<QObject>( name ) )
+ {
+ connectAndTest( action, SIGNAL(triggered()), mMainWindow, slot );
+ }
+}
+
+/*!
+ *
+ */
+void RadioViewBase::setOrientation()
+{
+ // Default implementation does nothing
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radiowizardview.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <hblistview.h>
+#include <hbaction.h>
+
+// User includes
+#include "radiowizardview.h"
+#include "radiobannerlabel.h"
+#include "radiomainwindow.h"
+#include "radiouiengine.h"
+#include "radiolocalization.h"
+#include "radiologger.h"
+#include "radiostationmodel.h"
+#include "radiofrequencyscanner.h"
+#include "radioxmluiloader.h"
+
+/*!
+ *
+ */
+RadioWizardView::RadioWizardView( RadioXmlUiLoader* uiLoader ) :
+ RadioViewBase( uiLoader ),
+ mBannerLabel( 0 ),
+ mStartScanningRequested( false )
+{
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioWizardView::engineStatusChanged( bool radioIsOn )
+{
+ if ( radioIsOn )
+ {
+ LOG("Starting scanning after engine started up");
+ disconnect( &mMainWindow->uiEngine(), SIGNAL(radioStatusChanged(bool)), this, SLOT(engineStatusChanged(bool)) );
+ startScanning();
+ }
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioWizardView::saveSelectedAsFavorites()
+{
+ mModel->setFavorites( mList->selectionModel()->selectedIndexes() );
+ mMainWindow->activateTuningView();
+}
+
+/*!
+ * Private slot
+ *
+ */
+void RadioWizardView::listItemClicked( const QModelIndex& index )
+{
+ RadioStation station = mModel->stationAt( index.row() );
+ RADIO_ASSERT( station.isValid() , "FMRadio", "invalid RadioStation");
+
+ LOG_FORMAT( "RadioWizardView::setFrequency, selectedRow: %d", station.presetIndex() );
+
+ mMainWindow->uiEngine().tunePreset( station.presetIndex() );
+}
+
+/*!
+ *
+ */
+void RadioWizardView::startScanning()
+{
+ if ( !mStartScanningRequested ) {
+ mStartScanningRequested = true;
+ RadioFrequencyScanner* scanner = new RadioFrequencyScanner( mMainWindow->uiEngine(), this );
+ scanner->startScanning();
+ }
+}
+
+/*!
+ * From RadioViewBase
+ *
+ */
+void RadioWizardView::init( RadioMainWindow* aMainWindow, RadioStationModel* aModel )
+{
+ LOG_METHOD;
+ mMainWindow = aMainWindow;
+ mModel = aModel;
+ mModel->setDetail( RadioStationModel::ShowGenre );
+
+ mBannerLabel = mUiLoader->findObject<RadioBannerLabel>( DOCML_NAME_WV_HEADINGBANNER );
+ mList = mUiLoader->findWidget<HbListView>( DOCML_NAME_WV_STATIONSLIST );
+
+ mList->setSelectionMode( HbListView::MultiSelection );
+ mList->setModel( mModel );
+ mList->setScrollingStyle( HbListView::PanOrFlick );
+
+ // "Go to stations view" menu item
+ connectViewChangeMenuItem( DOCML_NAME_WV_STATIONSVIEWACTION, SLOT(activateStationsView()) );
+}
+
+/*!
+ * From RadioViewBase
+ *
+ */
+void RadioWizardView::initSecondarySoftkey()
+{
+ // The default back button activates the tuning view
+ mSecondarySoftkeyction = new HbAction( Hb::DoneAction, this );
+ connectAndTest( mSecondarySoftkeyction, SIGNAL(triggered()),
+ this, SLOT(saveSelectedAsFavorites()) );
+}
+
+/*!
+ * From QGraphicsWidget
+ *
+ */
+void RadioWizardView::showEvent( QShowEvent* event )
+{
+ RadioViewBase::showEvent( event );
+
+ RadioUiEngine* engine = &mMainWindow->uiEngine();
+ if ( engine->isRadioOn() && !mStartScanningRequested )
+ {
+ LOG("Engine was already running. Starting scanning immediately");
+ startScanning();
+ }
+ else
+ {
+ connectAndTest( engine, SIGNAL(radioStatusChanged(bool)), this, SLOT(engineStatusChanged(bool)) );
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioapp/radiowidgets/src/radioxmluiloader.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// User includes
+#include "radioxmluiloader.h"
+#include "radiomainwindow.h"
+#include "radiostationsview.h"
+#include "radiotuningview.h"
+#include "radiowizardview.h"
+#include "radioplaylogview.h"
+#include "radiostationcarousel.h"
+#include "radiostationcontrolwidget.h"
+#include "radiofrequencystrip.h"
+#include "radiobannerlabel.h"
+#include "radiofadinglabel.h"
+#include "radiocontextmenu.h"
+#include "radiostationmodel.h"
+#include "radiouiengine.h"
+
+/*!
+ *
+ */
+RadioXmlUiLoader::RadioXmlUiLoader( RadioMainWindow& mainWindow ) :
+ HbDocumentLoader(),
+ mMainWindow( mainWindow )
+{
+}
+
+/*!
+ *
+ */
+QObject* RadioXmlUiLoader::createObject( const QString& type, const QString &name )
+{
+ QObject* object = 0;
+
+ if ( type == RadioTuningView::staticMetaObject.className() )
+ {
+ object = new RadioTuningView( this );
+ }
+ else if ( type == RadioStationCarousel::staticMetaObject.className() )
+ {
+ object = new RadioStationCarousel( mMainWindow.uiEngine() );
+ }
+ else if ( type == RadioStationControlWidget::staticMetaObject.className() )
+ {
+ object = new RadioStationControlWidget( mMainWindow.uiEngine() );
+ }
+ else if ( type == RadioFrequencyStrip::staticMetaObject.className() )
+ {
+ RadioUiEngine& engine = mMainWindow.uiEngine();
+ object = new RadioFrequencyStrip( engine.minFrequency(),
+ engine.maxFrequency(),
+ engine.frequencyStepSize(),
+ engine.currentFrequency(),
+ &engine );
+ }
+ else if ( type == RadioStationsView::staticMetaObject.className() )
+ {
+ object = new RadioStationsView( this );
+ }
+ else if ( type == RadioBannerLabel::staticMetaObject.className() )
+ {
+ object = new RadioBannerLabel();
+ }
+ else if ( type == RadioFadingLabel::staticMetaObject.className() )
+ {
+ object = new RadioFadingLabel();
+ }
+ else if ( type == RadioWizardView::staticMetaObject.className() )
+ {
+ object = new RadioWizardView( this );
+ }
+ else if ( type == RadioContextMenu::staticMetaObject.className() )
+ {
+ object = new RadioContextMenu( mMainWindow.uiEngine() );
+ }
+ else if ( type == RadioPlayLogView::staticMetaObject.className() )
+ {
+ object = new RadioPlayLogView( this );
+ }
+
+ if ( object )
+ {
+ object->setObjectName( name );
+ return object;
+ }
+
+ return HbDocumentLoader::createObject( type, name );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/api/cradioengine.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,315 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef CRADIOENGINE_H_
+#define CRADIOENGINE_H_
+
+// User includes
+#include "cradioroutableaudio.h"
+#include "radioenginedef.h"
+#include "radioengine.hrh"
+
+// Forward declarations
+class MRadioEngineInitializer;
+class CRadioAudioRouter;
+class CRadioSettings;
+class MRadioApplicationSettings;
+class MRadioEngineSettings;
+class CRadioSystemEventCollector;
+class CRadioPubSub;
+class CRadioRepositoryManager;
+class MRadioPresetSettings;
+class MRadioSettingsSetter;
+class MRadioScanObserver;
+class MRadioEngineObserver;
+class MRadioRdsReceiver;
+
+/**
+ * Convenience class to handle engine startup and the ownership of the related classes
+ */
+NONSHARABLE_CLASS( CRadioEngine ) : public CRadioRoutableAudio
+ {
+public:
+
+ /**
+ * Starts the radio engine initialization.
+ * Asks the given initializer to create the member variables
+ */
+ IMPORT_C static CRadioEngine* NewL( MRadioEngineInitializer& aInitializer );
+
+ IMPORT_C ~CRadioEngine();
+
+ /**
+ * Returns a reference to the audio router
+ *
+ * @return Reference to the audio router
+ */
+ virtual CRadioAudioRouter& AudioRouter() const = 0;
+
+ /**
+ * Returns the system event collector
+ *
+ * @return The system event collector
+ */
+ virtual CRadioSystemEventCollector& SystemEventCollector() const = 0;
+
+ /**
+ * Returns a reference to the application settings
+ *
+ * @return Reference to the application settings
+ */
+ virtual CRadioSettings& Settings() const = 0;
+
+ /**
+ * Returns a reference to the publish & subscribe handler
+ *
+ * @return Reference to the publish & subscribe handler
+ */
+ virtual CRadioPubSub* PubSub() const = 0;
+
+ /**
+ * Determines radio region
+ */
+ virtual TRadioRegion DetermineRegion() = 0;
+
+ /**
+ * ( Re )initializes the radio.
+ *
+ * @param aRegionId Region id
+ * @param aPubSub Pointer to Publish&Subscribe object
+ */
+ virtual void InitRadioL( TInt aRegionId, CRadioPubSub* aPubSub = 0 ) = 0;
+
+ /**
+ * Has the radio been initialized
+ *
+ * @return ETrue if radio is initialized, otherwise EFalse
+ */
+ virtual TBool RadioInitialized() const = 0;
+
+ /**
+ * Sets the state for radio audio
+ * This is the public interface to manage radio power state
+ * This method should be called before radio can turn itself on
+ *
+ * @param aEnable ETrue if radio audio can be played,
+ * EFalse if audio should be disabled
+ * @param aDelay ETrue if radio is played/disabled with delay
+ * EFalse if radio is played/disabled without delay
+ */
+ virtual void EnableAudio( TBool aEnable, TBool aDelay = ETrue ) = 0;
+
+ /**
+ * Gets the state for radio audio.
+ *
+ * This returns the information if radio could be played when
+ * other conditions are valid. This should be false only when
+ * some other application has cause disabling of auto resume.
+ *
+ * @return ETrue if radio audio could be played,
+ * EFalse if radio audio couldn't be played
+ */
+ virtual TBool RadioAudioEnabled() const = 0;
+
+ /**
+ * Sets the audio overriding flag
+ *
+ * @param aOverride ETrue if other audio resources are tried to be overriden.
+ */
+ virtual void SetAudioOverride( TBool aOverride ) = 0;
+
+ /**
+ * Adds an observer wich will be notified of the radio state changes
+ * If observer already exists, it is not added
+ *
+ * @param aObserver pointer of the observer instance.
+ */
+ virtual void AddObserverL( MRadioEngineObserver* aObserver ) = 0;
+
+ /**
+ * Removes a radio state change observer.
+ */
+ virtual void RemoveObserver( MRadioEngineObserver* aObserver ) = 0;
+
+ /**
+ * Sets audio mode ( Stereo/Mono )
+ *
+ * @param aAudioMode actual new radio mode
+ */
+ virtual void SetAudioMode( TInt aAudioMode ) = 0;
+
+ /**
+ * Compares if frequency is within limits range.
+ *
+ * @param aFrequency The frequency that is checked.
+ * If omitted, current frequency is checked.
+ * @return ETrue, if frequency is within radio range.
+ */
+ virtual TBool IsFrequencyValid( TUint32 aFrequency = 0 ) const = 0;
+
+ /**
+ * Tunes to frequency
+ * If radio is not initialized by InitRadioL, frequency is just
+ * set to settings.
+ *
+ * @param aFrequency frequency to tune to
+ * @param aReason reason for the frequency setting
+ */
+ virtual void SetFrequency( TUint32 aFrequency,
+ RadioEngine::TRadioFrequencyEventReason aReason = RadioEngine::ERadioFrequencyEventReasonUnknown ) = 0;
+
+ /**
+ * Test function to try to make the tuning as fast as possible.
+ * Use with care since this will skip a lot of checks done by the SetFrequency() function
+ */
+ virtual void SetFrequencyFast( TUint32 aFrequency,
+ RadioEngine::TRadioFrequencyEventReason aReason = RadioEngine::ERadioFrequencyEventReasonUnknown ) = 0;
+
+ /**
+ * Steps to next frequency according to direction
+ *
+ * @param aDirection The direciton to step to
+ */
+ virtual void StepToFrequency( RadioEngine::TRadioTuneDirection aDirection ) = 0;
+
+ /**
+ * Performs seeking operation.
+ *
+ * @param aDirection direction of seeking operation.
+ */
+ virtual void Seek( RadioEngine::TRadioTuneDirection aDirection ) = 0;
+
+ /**
+ * Cancels an ongoing request to seek up/down.
+ */
+ virtual void CancelSeek() = 0;
+
+ /**
+ * Is the radio seeking up/down, or at all.
+ *
+ * @return Seeking state.
+ */
+ virtual RadioEngine::TRadioSeeking Seeking() const = 0;
+
+ /**
+ * Starts scanning all available stations from the minimum frequency
+ *
+ * Calling this method also cancels any existing scan or seek operations.
+ *
+ * @param aObserver Observer to be notified of the progress of the scan.
+ * If a scan is currently in progress or the radio is not on, then
+ * the new scan is not performed at all and an error is passed on completion event.
+ *
+ */
+ virtual void StartScan( MRadioScanObserver& aObserver ) = 0;
+
+ /**
+ * Stops any scans currently in progress and notifies the observer
+ *
+ * @param aError The error code for completing the scanning.
+ */
+ virtual void StopScan( TInt aError = KErrCancel ) = 0;
+
+ /**
+ * Changes volume by one level.
+ *
+ * @param aDirection Direction of the volume change.
+ */
+ virtual void AdjustVolume( RadioEngine::TRadioVolumeSetDirection aDirection ) = 0;
+
+ /**
+ * Sets volume level
+ *
+ * @param aVolume new volume level.
+ */
+ virtual void SetVolume( TInt aVolume ) = 0;
+
+ /**
+ * Sets volume to be muted.
+ *
+ * @param aMute mute status.
+ */
+ virtual void SetVolumeMuted( TBool aMute ) = 0;
+
+ /**
+ * Retrieves current antenna state.
+ *
+ * @return ETrue if antenna is attached, EFalse otherwise.
+ */
+ virtual TBool IsAntennaAttached() = 0;
+
+ /**
+ * Retrieves current state of fm transmitter.
+ *
+ * @return ETrue if fm transmitter is active, EFalse otherwise.
+ */
+ virtual TBool IsFmTransmitterActive() const = 0;
+
+ /**
+ * Changes the antenna state.
+ * This should only be used when faking the antenna
+ * state in emulator environment.
+ * Thus this should work only in WINS.
+ *
+ * @param aAntennaAttached The new antenna state.
+ */
+ virtual void SetAntennaAttached( TBool aAntennaAttached ) = 0;
+
+ /**
+ * Returns the maximum volume level
+ *
+ * @return maximum volume level
+ */
+ virtual TInt MaxVolumeLevel() const = 0;
+
+ /**
+ * Has the frequency been set by RDS AF search or not.
+ *
+ * @return ETrue if frequency was set by RDS AF, otherwise EFalse
+ */
+ virtual TBool FrequencySetByRdsAf() const = 0;
+
+ /**
+ * Getter for RDS receiver
+ *
+ * @return Reference to CRadioRdsReceiver
+ */
+ virtual MRadioRdsReceiver& RdsReceiver() = 0;
+
+ /**
+ * Is routing between loudspeaker and headset possible
+ *
+ * @return ETrue, if routing is possible
+ */
+ virtual TBool IsAudioRoutingPossible() const = 0;
+
+ /**
+ * Checks if the radio playing parameters are OK
+ *
+ * @param aFrequency The frequency that is wanted to play.
+ * @return ETrue if audio can be played, otherwise EFalse
+ */
+ virtual TBool OkToPlay( TUint32 aFrequency ) const = 0;
+
+protected:
+
+ CRadioEngine( CRadioAudioRouter* aAudioRouter );
+
+ };
+
+#endif // CRADIOENGINE_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/api/mradioengineinitializer.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef MRADIOENGINEINITIALIZER_H_
+#define MRADIOENGINEINITIALIZER_H_
+
+#include <e32std.h>
+
+// Forward declarations
+class CRadioAudioRouter;
+class CRadioSystemEventCollector;
+class CRadioSettings;
+class CRadioEngine;
+class CRadioPubSub;
+
+NONSHARABLE_CLASS( MRadioEngineInitializer )
+ {
+public:
+
+ virtual CRadioAudioRouter* InitAudioRouterL() = 0;
+ virtual CRadioSystemEventCollector* InitSystemEventCollectorL() = 0;
+ virtual CRadioSettings* InitSettingsL() = 0;
+ virtual CRadioPubSub* InitPubSubL() = 0;
+
+ };
+
+#endif // MRADIOENGINEINITIALIZER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/api/mradioengineobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MRADIOENGINEOBSERVER_H
+#define MRADIOENGINEOBSERVER_H
+
+#include "radioenginedef.h"
+
+/**
+* Observer for radio state changes.
+*/
+NONSHARABLE_CLASS( MRadioEngineObserver )
+ {
+ public:
+
+ virtual void PowerEventL( TBool aPowerState, TInt aErrorCode ) = 0;
+
+ /**
+ * Notifies when frequency changes
+ * @param aFrequency The new frequency
+ * @param aReason reason why the frequency changed
+ * @param aErrorCode code related to state change
+ */
+ virtual void FrequencyEventL( TUint32 aFrequency, RadioEngine::TRadioFrequencyEventReason aReason, TInt aErrorCode ) = 0;
+ virtual void VolumeEventL( TInt aVolume, TInt aErrorCode ) = 0;
+ virtual void MuteEventL( TBool aMuteState, TInt aErrorCode ) = 0;
+ virtual void AudioModeEventL( TInt aAudioMode, TInt aErrorCode ) = 0;
+ virtual void AntennaEventL( TBool aAntennaAttached, TInt aErrorCode ) = 0;
+
+ /**
+ * Notifies when audio routing changes
+ * @param aAudioDestination The new output device
+ * @param aErrorCode Error code related to state change
+ */
+ virtual void AudioRoutingEventL( TInt aAudioDestination, TInt aErrorCode ) = 0;
+
+ /**
+ * Notifies about seeking events
+ * @param aSeekingState The seeking state
+ * @param aErrorCode KErrNone for successful starting or completion of seeking
+ */
+ virtual void SeekingEventL( TInt aSeekingState, TInt aErrorCode ) = 0;
+
+ /**
+ * Notifies about region changes
+ *
+ * @param aRegion The ID of the new region
+ * @param aErrorCode Region event error code
+ */
+ virtual void RegionEventL( TInt aRegion, TInt aErrorCode ) = 0;
+
+ /**
+ * Notifies about fm transmitter activating
+ */
+ virtual void FmTransmitterEventL( TBool aActive ) = 0;
+
+ };
+
+#endif // MRADIOENGINEOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/api/mradiordsdataobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MRADIORDSDATAOBSERVER_H
+#define MRADIORDSDATAOBSERVER_H
+
+#include <e32std.h>
+
+NONSHARABLE_CLASS( MRadioRdsDataObserver )
+ {
+public:
+
+ /**
+ * Notifies of the status of RDS signal
+ */
+ virtual void RdsAvailable( TUint32 aFrequency, TBool aAvailable ) = 0;
+
+ /**
+ * Notifies of the beginning of Alternate Frequency search
+ */
+ virtual void RdsAfSearchBegin() = 0;
+
+ /**
+ * Notifies of the completed Alternate Frequency search
+ *
+ * @param aFrequency The new frequency
+ * @param aError A standard system error code
+ */
+ virtual void RdsAfSearchEnd( TUint32 aFrequency, TInt aError ) = 0;
+
+ /**
+ * Notifies of the changed Alternate Frequency search state
+ *
+ * @param aEnabled ETrue if AF search was enabled, otherwise EFalse
+ */
+ virtual void RdsAfSearchStateChange( TBool aEnabled ) = 0;
+
+ /**
+ * Programme Service data available
+ *
+ * @param aProgramService The new Programme Service data
+ */
+ virtual void RdsDataProgrammeService( TUint32 aFrequency, const TDesC& aProgramService ) = 0;
+
+ /**
+ * Radio text data available
+ *
+ * @param aRt The new radio text data
+ */
+ virtual void RdsDataRadioText( TUint32 aFrequency, const TDesC& aRt ) = 0;
+
+ /**
+ * Radio text plus data available.
+ *
+ * @param aRtPlusClass The class of the radio text plus data. Radio text plus classes are
+ * specified in TRdsRTplusClass enumeration.
+ * @param aRtPlusData The new radio text plus data.
+ */
+ virtual void RdsDataRadioTextPlus( TUint32 aFrequency, const TInt aRtPlusClass, const TDesC& aRtPlusData ) = 0;
+
+ /**
+ * Radio genre available
+ */
+ virtual void RdsDataGenre( TUint32 aFrequency, const TInt aGenre ) = 0;
+
+ /**
+ * Radio PI code available
+ */
+ virtual void RdsDataPiCode( TUint32 aFrequency, const TInt aPiCode ) = 0;
+
+ };
+
+#endif // MRADIORDSDATAOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/api/mradiordsreceiver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MRADIORDSRECEIVER_H
+#define MRADIORDSRECEIVER_H
+
+class CRadioUtility;
+class CRadioPubSub;
+class MRadioRdsDataObserver;
+
+NONSHARABLE_CLASS( MRadioRdsReceiver )
+ {
+public:
+
+ /**
+ * Initializes the RDS receiver
+ *
+ * @param aRadioUtility A reference to the radio utility
+ * @param aPubSub Pointer to Publish&Subscribe object
+ */
+ virtual void InitL( CRadioUtility& aRadioUtility, CRadioPubSub* aPubSub ) = 0;
+
+ /**
+ * Adds an observer wich will be notified of the new RDS data
+ * If observer already exists, it is not added
+ *
+ * @param aObserver pointer of the observer instance.
+ */
+ virtual void AddObserverL( MRadioRdsDataObserver* aObserver ) = 0;
+
+ /**
+ * Removes the rds observer.
+ */
+ virtual void RemoveObserver( MRadioRdsDataObserver* aObserver ) = 0;
+
+ /**
+ * Getter for automatic switching state of alternate frequencies
+ *
+ * @return ETrue if automatic switching is enabled
+ */
+ virtual TBool AutomaticSwitchingEnabled() const = 0;
+
+ /**
+ * Getter for the programme service name
+ *
+ * @return Programme service name
+ */
+ virtual const TDesC& ProgrammeService() const = 0;
+
+ /**
+ * Getter for the radio text.
+ *
+ * @return Radio text.
+ */
+ virtual const TDesC& RadioText() const = 0;
+
+ /**
+ * Getter for the RDS signal availability
+ *
+ * @return ETrue if RDS signal is available, otherwise EFalse
+ */
+ virtual TBool SignalAvailable() const = 0;
+
+ /**
+ * Setter for automatic switching of alternate frequencies
+ * If this method is overridden, the base implementation should be called
+ *
+ * @param aEnable ETrue, if automatic swithing is to be enabled
+ */
+ virtual void SetAutomaticSwitchingL( TBool aEnable ) = 0;
+
+ /**
+ * Starts receiving the RDS information
+ */
+ virtual void StartReceiver() = 0;
+
+ /**
+ * Stops receiving the RDS information
+ */
+ virtual void StopReceiver() = 0;
+
+ };
+
+#endif // MRADIORDSRECEIVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/api/mradioscanobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MRADIOSCANOBSERVER_H_
+#define MRADIOSCANOBSERVER_H_
+
+/**
+ * Interface for radio station scanning.
+ *
+ * Implementers of this interface are able to receive notifications
+ * when scanning finds a valid frequency and upon its completion.
+ */
+NONSHARABLE_CLASS( MRadioScanObserver )
+ {
+
+public:
+
+ /**
+ * Invoked when a frequency has been found with scanning.
+ *
+ * @param aFrequency The frequency, in kilohertz, that was found.
+ */
+ virtual void ScanFrequencyEventL( TUint32 aFrequency ) = 0;
+
+ /**
+ * Invoked when a scan has been completed.
+ *
+ * @param aError <code>KErrNone</code> when the scan was successfull,
+ * or any of the standard error codes otherwise.
+ */
+ virtual void ScanCompletedEventL( TInt aError ) = 0;
+
+ };
+
+#endif // MRADIOSCANOBSERVER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/bwins/radioengineu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+ ??1CRadioEngine@@UAE@XZ @ 1 NONAME ; CRadioEngine::~CRadioEngine(void)
+ ?NewL@CRadioEngine@@SAPAV1@AAVMRadioEngineInitializer@@@Z @ 2 NONAME ; class CRadioEngine * CRadioEngine::NewL(class MRadioEngineInitializer &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/eabi/radioengineu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+ _ZN12CRadioEngine4NewLER23MRadioEngineInitializer @ 1 NONAME
+ _ZN12CRadioEngineD0Ev @ 2 NONAME
+ _ZN12CRadioEngineD1Ev @ 3 NONAME
+ _ZN12CRadioEngineD2Ev @ 4 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/group/bld.inf Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "../../group/buildflags.hrh"
+
+#ifdef COMPILE_IN_WK48_ENV
+# include <domain/osextensions/platform_paths.hrh>
+#else
+# include <platform_paths.hrh>
+#endif // COMPILE_IN_WK48_ENV
+
+PRJ_PLATFORMS
+WINSCW ARMV5
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+radioengine.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/group/radioengine.mmp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "../../group/buildflags.hrh"
+
+#ifdef COMPILE_IN_WK48_ENV
+# include <domain/osextensions/platform_paths.hrh>
+#else
+# include <platform_paths.hrh>
+#endif // COMPILE_IN_WK48_ENV
+
+#include <data_caging_paths.hrh>
+
+TARGET radioengine.dll
+TARGETTYPE DLL
+UID 0x1000008D 0x10281CB2
+VERSION 11.0
+
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+PAGED
+
+SOURCEPATH ../src
+SOURCE cradioengine.cpp
+SOURCE cradioengineimp.cpp
+SOURCE cradiordsreceiver.cpp
+SOURCE cradiordsreceiverbase.cpp
+SOURCE cradionetworkinfolistener.cpp
+
+#ifdef __FEATURE_RDS_SIMULATOR
+MACRO __FEATURE_RDS_SIMULATOR
+SOURCE t_cradiordsreceiversimulator.cpp
+#endif // __FEATURE_RDS_SIMULATOR
+
+USERINCLUDE ../api
+USERINCLUDE ../inc
+USERINCLUDE ../../utils/api
+USERINCLUDE ../../settings/api
+USERINCLUDE ../../group
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY radioengineutils.lib
+LIBRARY radioenginesettings.lib
+
+LIBRARY audiooutputrouting.lib
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+LIBRARY radio_utility.lib
+LIBRARY cone.lib
+LIBRARY etel3rdparty.lib // For CTelephony
+LIBRARY etel.lib // For RTelServer
+LIBRARY etelmm.lib // For RMobilePhone
+LIBRARY commsdat.lib // For CommsDat
+LIBRARY timezonelocalization.lib // For CTzLocalizer
+LIBRARY bafl.lib // For CDesCArray
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/inc/cradioengineimp.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,425 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef CRADIOENGINEIMP_H
+#define CRADIOENGINEIMP_H
+
+#include <radiofmtunerutility.h>
+#include <radioplayerutility.h>
+#include <radioutility.h>
+
+#include "cradioengine.h"
+#include "mradiosettingsobserver.h"
+#include "mradiordsdataobserver.h"
+#include "mradiosystemeventobserver.h"
+#include "radioenginedef.h"
+
+class CRadioPubSub;
+class CRadioRdsReceiverBase;
+class CRadioNetworkInfoListener;
+class MRadioEngineSettings;
+class MRadioSettingsSetter;
+class MRadioEngineObserver;
+class MRadioScanObserver;
+
+/**
+ * Radio class takes care of the FM-radio side.
+ */
+NONSHARABLE_CLASS( CRadioEngineImp ) : public CRadioEngine
+ , public MRadioSystemEventObserver
+ , public MRadioFmTunerObserver
+ , public MRadioPlayerObserver
+ , public MRadioSettingsObserver
+ , public MRadioRdsDataObserver
+ {
+ friend class CRadioEngine;
+
+public:
+
+ ~CRadioEngineImp();
+
+ void SetSystemEventCollector( CRadioSystemEventCollector* aCollector );
+ void SetRadioSettings( CRadioSettings* aSettings );
+ void SetRadioPubSub( CRadioPubSub* aPubSub );
+
+private:
+
+ CRadioEngineImp( CRadioAudioRouter* aAudioRouter );
+
+// from base class CRadioEngine
+
+ CRadioAudioRouter& AudioRouter() const;
+ CRadioSystemEventCollector& SystemEventCollector() const;
+ CRadioSettings& Settings() const;
+ CRadioPubSub* PubSub() const;
+ TRadioRegion DetermineRegion();
+ void InitRadioL( TInt aRegionId, CRadioPubSub* aPubSub = 0 );
+ TBool RadioInitialized() const;
+ void EnableAudio( TBool aEnable, TBool aDelay = ETrue );
+ TBool RadioAudioEnabled() const;
+ void SetAudioOverride( TBool aOverride );
+ void AddObserverL( MRadioEngineObserver* aObserver );
+ void RemoveObserver( MRadioEngineObserver* aObserver );
+ void SetAudioMode( TInt aAudioMode );
+ TBool IsFrequencyValid( TUint32 aFrequency = 0 ) const;
+ void SetFrequency( TUint32 aFrequency,
+ RadioEngine::TRadioFrequencyEventReason aReason = RadioEngine::ERadioFrequencyEventReasonUnknown );
+ void SetFrequencyFast( TUint32 aFrequency,
+ RadioEngine::TRadioFrequencyEventReason aReason = RadioEngine::ERadioFrequencyEventReasonUnknown );
+ void StepToFrequency( RadioEngine::TRadioTuneDirection aDirection );
+ void Seek( RadioEngine::TRadioTuneDirection aDirection );
+ void CancelSeek();
+ RadioEngine::TRadioSeeking Seeking() const;
+ void StartScan( MRadioScanObserver& aObserver );
+ void StopScan( TInt aError = KErrCancel );
+ void AdjustVolume( RadioEngine::TRadioVolumeSetDirection aDirection );
+ void SetVolume( TInt aVolume );
+ void SetVolumeMuted( TBool aMute );
+ TBool IsAntennaAttached();
+ TBool IsFmTransmitterActive() const;
+ void SetAntennaAttached( TBool aAntennaAttached );
+ TInt MaxVolumeLevel() const;
+ TBool FrequencySetByRdsAf() const;
+ MRadioRdsReceiver& RdsReceiver();
+ TBool IsAudioRoutingPossible() const;
+ TBool OkToPlay( TUint32 aFrequency ) const;
+
+private:
+
+ /** Radio event notifications */
+ enum TRadioEventNotification
+ {
+ ERadioEventPower = 1,
+ ERadioEventFrequency,
+ ERadioEventVolume,
+ ERadioEventMute,
+ ERadioEventAudioMode,
+ ERadioEventAntenna,
+ ERadioEventAudioRouting,
+ ERadioEventSeeking,
+ ERadioEventRegion,
+ ERadioEventFmTransmitter
+ };
+
+ /**
+ * Possible radio scan events.
+ */
+ enum TRadioScanEvent
+ {
+ /**
+ * Scanning found a valid frequency.
+ */
+ ERadioEventFrequencyScanned,
+
+ /**
+ * Scanning is completed.
+ */
+ ERadioEventScanCompleted
+
+ };
+
+ enum TRadioInitialisationState
+ {
+ ERadioNotInitialized,
+ ERadioUtilitiesConstructed,
+ ERadioTunerControlGranted
+ };
+
+ void ConstructL();
+
+ /**
+ * Switches power on/off after a delay
+ *
+ * @param aPowerOn ETrue if power is to be switched on,
+ * EFalse if power is to be switched off
+ */
+ void SwitchPower( TBool aPowerOn );
+
+ /**
+ * Callback for switching the radio power on
+ *
+ * @param aSelfPtr A pointer to CRadioEngineImp instance
+ * @return KErrNone
+ */
+ static TInt StaticPowerOnCallback( TAny* aSelfPtr );
+
+ /**
+ * Callback for switching the radio power off
+ *
+ * @param aSelfPtr A pointer to CRadioEngineImp instance
+ * @return KErrNone
+ */
+ static TInt StaticPowerOffCallback( TAny* aSelfPtr );
+
+ /**
+ * Switches radio power ON.
+ */
+ void PowerOn();
+
+ /**
+ * Switches radio power OFF.
+ */
+ void PowerOff();
+
+ /**
+ * Converts region code used internally by Visual Radio
+ * in to a frequency range by tuner ( TFmRadioFrequencyRange )
+ *
+ * @param aRegionId VR region ID
+ * @return Frequency range
+ */
+ TFmRadioFrequencyRange TunerFrequencyRangeForRegionId( TInt aRegionId ) const;
+
+ /**
+ * Non-leaving version of DoNotifyRadioEventL.
+ * @param aRadioEvent event notification ( identification )
+ * @param aErrorCode error code related to state change
+ */
+ void NotifyRadioEvent( TInt aRadioEvent, TInt aErrorCode = KErrNone );
+
+ /**
+ * Leaving version of DoNotifyRadioEvent.
+ * @param aRadioEvent event notification ( identification )
+ * @param aErrorCode error code related to state change
+ */
+ void DoNotifyRadioEventL( TInt aRadioEvent, TInt aErrorCode = KErrNone );
+
+ /**
+ * Notifies the observer of a radio scan event.
+ *
+ * @param aEvent Event to notify.
+ * @param aObserver Scan observer.
+ * @param aError Error code the event completed with.
+ */
+ void NotifyRadioScanEvent( TRadioScanEvent aEvent, MRadioScanObserver& aObserver,
+ TInt aError = KErrNone );
+
+ /**
+ * Notifies the observer of a radio scan event.
+ *
+ * @param aEvent Event to notify.
+ * @param aObserver Scan observer.
+ * @param aError Error code the event completed with.
+ */
+ void DoNotifyRadioScanEventL( TRadioScanEvent aEvent, MRadioScanObserver& aObserver,
+ TInt aError );
+
+ /**
+ * Handles the change in audio routing
+ *
+ * @param aDestination The new routing destination
+ */
+ void HandleAudioRoutingEvent( RadioEngine::TRadioAudioRoute aDestination );
+
+ /**
+ * Handles the change in power state
+ *
+ * @param aPowerOn The power state
+ * @param aErrorCode Error code related to state change
+ */
+ void HandlePowerEvent( TBool aPowerOn, TInt aErrorCode = KErrNone );
+
+ /**
+ * Handles the change in power state
+ *
+ * @param aFrequency The current frequency
+ * @param aErrorCode Error code related to state change
+ */
+ void HandleFrequencyEvent( TUint32 aFrequency, TInt aErrorCode = KErrNone );
+
+ /**
+ * Converts the volume used by Visual Radio to volume used by Radio Utility
+ *
+ * @param aUiVolume The Volume used by Visual Radio
+ * @return The volume used by Radio Utility
+ */
+ TInt TunerVolumeForUiVolume( TInt aUiVolume );
+
+// from base class MRadioSystemEventObserver
+
+ void HandleSystemEventL( TRadioSystemEventType aEventType );
+
+// from base class MRadioFmTunerObserver
+
+ void MrftoRequestTunerControlComplete( TInt aError );
+ void MrftoSetFrequencyRangeComplete( TInt aError );
+ void MrftoSetFrequencyComplete( TInt aError );
+ void MrftoStationSeekComplete( TInt aError, TInt aFrequency );
+ void MrftoFmTransmitterStatusChange( TBool aActive );
+ void MrftoAntennaStatusChange( TBool aAttached );
+ void MrftoOfflineModeStatusChange( TBool aOfflineMode );
+ void MrftoFrequencyRangeChange( TFmRadioFrequencyRange aBand );
+ void MrftoFrequencyChange( TInt aNewFrequency );
+ void MrftoForcedMonoChange( TBool aForcedMono );
+ void MrftoSquelchChange( TBool aSquelch );
+
+// from base class MRadioPlayerObserver
+
+ void MrpoStateChange( TPlayerState aState, TInt aError );
+ void MrpoVolumeChange( TInt aVolume );
+ void MrpoMuteChange( TBool aMute );
+ void MrpoBalanceChange( TInt aLeftPercentage, TInt aRightPercentage );
+
+// from base class MRadioSettingsObserver
+
+ void RdsAfSearchSettingChangedL( TBool aEnabled );
+ void RegionSettingChangedL( TInt aRegion );
+
+// from base class MRadioRdsDataObserver
+
+ void RdsAvailable( TUint32 /*aFrequency*/, TBool /*aAvailable*/ ) {}
+ void RdsAfSearchBegin();
+ void RdsAfSearchEnd( TUint32 aFrequency, TInt aError );
+ void RdsAfSearchStateChange( TBool /*aEnabled*/ ) {}
+ void RdsDataProgrammeService( TUint32 /*aFrequency*/, const TDesC& /*aProgramService*/ ) {}
+ void RdsDataRadioText( TUint32 /*aFrequency*/, const TDesC& /*aRadioText*/ ) {}
+ void RdsDataRadioTextPlus( TUint32 /*aFrequency*/, const TInt /*aRadioTextPlusClass*/, const TDesC& /*aRadioText*/ ) {}
+ void RdsDataGenre( TUint32 /*aFrequency*/, const TInt /*aGenre*/ ) {}
+ void RdsDataPiCode( TUint32 /*aFrequency*/, const TInt /*aPiCode*/ ) {}
+
+// New functions
+
+ /**
+ * Tries to figure the region out based on current mobile network id
+ */
+ TRadioRegion RegionFromMobileNetwork() const;
+
+ /**
+ * Tries to figure the region out based on timezone selection
+ */
+ TRadioRegion RegionFromTimezone() const;
+
+ /**
+ * Performs the timezone-based check
+ */
+ TRadioRegion DoRegionFromTimezoneL() const;
+
+private: // data
+
+ /**
+ * Array of state change observers.
+ */
+ RPointerArray<MRadioEngineObserver> iObservers;
+
+ /**
+ * A pointer to system event collector
+ * Own.
+ */
+ CRadioSystemEventCollector* iSystemEventCollector;
+
+ /**
+ * Radio settings
+ * Own.
+ */
+ CRadioSettings* iSettings;
+
+ /**
+ * Network info listener
+ * Own.
+ */
+ CRadioNetworkInfoListener* iNetworkInfoListener;
+
+ /**
+ * Controls the radio hardware
+ */
+ CRadioUtility* iRadioUtility;
+
+ /**
+ * Controls FM radio tuner. Not owned.
+ */
+ CRadioFmTunerUtility* iTunerUtility;
+
+ /**
+ * Controls the radio player. Not owned.
+ */
+ CRadioPlayerUtility* iPlayerUtility;
+
+ /**
+ * Receives and notifies of the RDS data
+ */
+ CRadioRdsReceiverBase* iRdsReceiver;
+
+ /**
+ * State for radio initialization
+ */
+ TRadioInitialisationState iRadioInitializationState;
+
+ /**
+ * Radio on/off timer.
+ */
+ CPeriodic* iRadioTimer;
+
+ /**
+ * If this is true, audio resource availability is ignored on next radio power on
+ */
+ TBool iOverrideAudioResources;
+
+ /**
+ * Direction of the previous seek request, needed for canceling
+ */
+ RadioEngine::TRadioSeeking iSeekingState;
+
+ /**
+ * Antenna state.
+ */
+ TBool iAntennaAttached;
+
+ /**
+ * Radio enabling state
+ */
+ TBool iRadioEnabled;
+
+ /**
+ * ETrue if frequency was set by RDS AF
+ */
+ TBool iFrequencySetByRdsAf;
+
+ /**
+ * The state of the fm transmitter
+ */
+ TBool iFmTransmitterActive;
+
+ /**
+ * Cause for the ongoing frequency change operation.
+ */
+ RadioEngine::TRadioFrequencyEventReason iFreqEventReason;
+
+ /**
+ * Publish&Subscribe object. Can be NULL.
+ * Owned if set
+ */
+ CRadioPubSub* iPubSub;
+
+ /**
+ * Radio scan observer. NULL when scanning is not ongoing
+ * Not owned.
+ */
+ MRadioScanObserver* iScanObserver;
+
+ /**
+ * The previously scanned frequency, or <code>KErrNotFound</code> if none.
+ */
+ TUint32 iPreviousScannedFrequency;
+
+ /**
+ * The state of mute before scan has been started.
+ */
+ TBool iPreviousMuteState;
+
+ };
+
+#endif // CRADIOENGINEIMP_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/inc/cradionetworkinfolistener.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIONETWORKINFOLISTENER_H
+#define C_RADIONETWORKINFOLISTENER_H
+
+// System includes
+#include <e32base.h>
+#include <etel3rdparty.h>
+
+// Forward declarations
+class CTelephony;
+class MRadioSettingsSetter;
+
+/**
+ * An interface for notifying about network id changes
+ */
+NONSHARABLE_CLASS( MRadioNetworkChangeObserver )
+ {
+public:
+
+ /**
+ * Used for notifying that the network id has changed
+ */
+ virtual void NetworkIdChanged() = 0;
+
+ };
+
+/**
+ * Listens changes in network ID and country code.
+ */
+NONSHARABLE_CLASS( CRadioNetworkInfoListener ) : public CActive
+ {
+public:
+
+ static CRadioNetworkInfoListener* NewL( MRadioSettingsSetter& aSetter,
+ MRadioNetworkChangeObserver* aObserver );
+
+ ~CRadioNetworkInfoListener();
+
+ /**
+ * Return current combined network ID and country code as TInt.
+ * @return An integer composed of the current network ID and country code.
+ */
+ TInt CompoundNetworkId() const;
+
+ /**
+ * Returns current country code.
+ * @return The current country code.
+ */
+ TPtrC CountryCode() const;
+
+ /**
+ * SubscriberId
+ * @return subscriber id
+ */
+ TPtrC SubscriberId() const;
+
+private:
+
+ CRadioNetworkInfoListener( MRadioSettingsSetter& aSetter,
+ MRadioNetworkChangeObserver* aObserver );
+
+ void ConstructL();
+
+// from base class CActive
+
+ void DoCancel();
+ void RunL();
+
+// New functions
+
+ void SaveNetworkInfoL();
+
+private: // data
+
+ MRadioSettingsSetter& iSetter;
+
+ MRadioNetworkChangeObserver* iObserver;
+
+#ifndef __WINS__
+ CTelephony* iTelephony;
+#endif
+
+ CTelephony::TSubscriberIdV1 iSubscriberId;
+ CTelephony::TSubscriberIdV1Pckg iSubscriberIdPckg;
+ CTelephony::TNetworkInfoV1 iNetworkInfo;
+ CTelephony::TNetworkInfoV1Pckg iNetworkInfoPckg;
+
+ TInt iCompoundNetworkId;
+ TInt iPreviousCompoundNetworkId;
+
+ };
+
+#endif // C_RADIONETWORKINFOLISTENER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/inc/cradiordsreceiver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIORDSRECEIVER_H
+#define CRADIORDSRECEIVER_H
+
+#include "cradiordsreceiverbase.h"
+
+class MRadioEngineSettings;
+
+NONSHARABLE_CLASS( CRadioRdsReceiver ) : public CRadioRdsReceiverBase
+ {
+public:
+
+ static CRadioRdsReceiver* NewL( MRadioEngineSettings& aSettings );
+
+ virtual ~CRadioRdsReceiver();
+
+private:
+
+ CRadioRdsReceiver( MRadioEngineSettings& aSettings );
+
+ void ConstructL();
+
+// from base class MRadioRdsReceiver
+
+ void InitL( CRadioUtility& aRadioUtility, CRadioPubSub* aPubSub );
+ void SetAutomaticSwitchingL( TBool aEnable );
+ void StartReceiver();
+ void StopReceiver();
+
+// New functions
+
+ /**
+ * Logs the RDS receiver capabilities if logging is enabled
+ */
+ void LogReceiverCapabilities();
+
+private: // data
+
+ /** The RDS utility */
+ CRadioRdsUtility* iRdsUtility;
+
+ /** State of the RDS receiver */
+ TBool iStarted;
+
+ };
+
+#endif // CRADIORDSRECEIVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/inc/cradiordsreceiverbase.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIORDSRECEIVERBASE_H
+#define CRADIORDSRECEIVERBASE_H
+
+#include <radiordsutility.h>
+
+#include "mradioenginesettings.h"
+#include "mradiordsdataobserver.h"
+#include "mradiordsreceiver.h"
+
+class CRadioUtility;
+class CRadioPubSub;
+
+NONSHARABLE_CLASS( CRadioRdsReceiverBase ) : public CBase
+ , public MRadioRdsReceiver
+ , public MRadioRdsObserver
+ {
+public:
+
+ /**
+ * The destructor
+ */
+ virtual ~CRadioRdsReceiverBase();
+
+ /**
+ * Adds an observer wich will be notified of the new RDS data
+ * If observer already exists, it is not added
+ *
+ * @param aObserver pointer of the observer instance.
+ */
+ void AddObserverL( MRadioRdsDataObserver* aObserver );
+
+ /**
+ * Removes the rds observer.
+ */
+ void RemoveObserver( MRadioRdsDataObserver* aObserver );
+
+ /**
+ * Getter for automatic switching state of alternate frequencies
+ *
+ * @return ETrue if automatic switching is enabled
+ */
+ TBool AutomaticSwitchingEnabled() const;
+
+ /**
+ * Getter for the programme service name
+ *
+ * @return Programme service name
+ */
+ const TDesC& ProgrammeService() const;
+
+ /**
+ * Getter for the radio text.
+ *
+ * @return Radio text.
+ */
+ const TDesC& RadioText() const;
+
+ /**
+ * Getter for the RDS signal availability
+ *
+ * @return ETrue if RDS signal is available, otherwise EFalse
+ */
+ TBool SignalAvailable() const;
+
+ /**
+ * Setter for automatic switching of alternate frequencies
+ * If this method is overridden, the base implementation should be called
+ *
+ * @param aEnable ETrue, if automatic swithing is to be enabled
+ */
+ virtual void SetAutomaticSwitchingL( TBool aEnable );
+
+ /**
+ * Clears the RDS information
+ */
+ void ClearRdsInformation();
+
+protected:
+
+ CRadioRdsReceiverBase( MRadioEngineSettings& aSettings );
+
+ void BaseConstructL();
+
+// from base class MRadioRdsObserver
+
+ void MrroStationSeekByPTYComplete( TInt aError, TInt aFrequency );
+ void MrroStationSeekByTAComplete( TInt aError, TInt aFrequency );
+ void MrroStationSeekByTPComplete( TInt aError, TInt aFrequency );
+ void MrroGetFreqByPTYComplete( TInt aError, RArray<TInt>& aFreqList );
+ void MrroGetFreqByTAComplete( TInt aError, RArray<TInt>& aFreqList );
+ void MrroGetPSByPTYComplete( TInt aError, RArray<TRdsPSName>& aPsList );
+ void MrroGetPSByTAComplete( TInt aError, RArray<TRdsPSName>& aPsList );
+ void MrroRdsDataPI( TInt aPi );
+ void MrroRdsDataPTY( TRdsProgrammeType aPty );
+ void MrroRdsDataPS( TRdsPSName& aPs );
+ void MrroRdsDataRT( TRdsRadioText& aRt );
+ void MrroRdsDataCT( TDateTime& aCt );
+ void MrroRdsDataTA( TBool aTaOn );
+ void MrroRdsDataRTplus( TRdsRTplusClass aRtPlusClass, TRdsRadioText& aRtPlusData );
+ void MrroRdsSearchBeginAF();
+ void MrroRdsSearchEndAF( TInt aError, TInt aFrequency );
+ void MrroRdsStationChangeTA( TInt aFrequency );
+ void MrroRdsEventAutomaticSwitchingChange( TBool aAuto );
+ void MrroRdsEventAutomaticTrafficAnnouncement( TBool aAuto );
+ void MrroRdsEventSignalChange( TBool aSignal );
+
+protected: // data
+
+ /**
+ * The radio settings
+ */
+ MRadioEngineSettings& iSettings;
+
+ /**
+ * Publish&Subscribe object. Can be NULL.
+ * Not own.
+ */
+ CRadioPubSub* iPubSub;
+
+private: // data
+
+ /**
+ * Array of RDS observers.
+ */
+ RPointerArray<MRadioRdsDataObserver> iObservers;
+
+ /**
+ * The programme service name cache.
+ * Own.
+ */
+ HBufC* iPsName;
+
+ /**
+ * The RDS radio text
+ * Own.
+ */
+ RBuf iRadioText;
+
+ /**
+ * ETrue if the RDS signal is available
+ */
+ TBool iSignalAvailable;
+
+ /**
+ * ETrue if AF is enabled
+ */
+ TBool iAfEnabled;
+
+ };
+
+#endif // CRADIORDSRECEIVERBASE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/inc/t_cradiordsreceiversimulator.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef T_CRADIORDSRECEIVERSIMULATOR_H
+#define T_CRADIORDSRECEIVERSIMULATOR_H
+
+#include "mradiordsdataobserver.h"
+#include "cradiordsreceiverbase.h"
+
+NONSHARABLE_CLASS( CRadioRdsReceiverSimulator ) : public CRadioRdsReceiverBase
+ {
+public:
+
+ static CRadioRdsReceiverSimulator* NewL( MRadioEngineSettings& aSettings );
+
+ virtual ~CRadioRdsReceiverSimulator();
+
+// from base class MRadioRdsReceiver
+
+ void InitL( CRadioUtility& aRadioUtility, CRadioPubSub* aPubSub );
+ void StartReceiver();
+ void StopReceiver();
+
+private:
+
+ /** The simulated events */
+ enum TRadioRdsSimulationEvent
+ {
+ ERadioRdsEventSignalOn,
+ ERadioRdsEventSignalOff,
+ ERadioRdsEventPS,
+ ERadioRdsEventAFBegin,
+ ERadioRdsEventAFEnd,
+ ERadioRdsEventRadioText,
+ ERadioRdsEventRadioTextPlus
+ };
+
+ CRadioRdsReceiverSimulator( MRadioEngineSettings& aSettings );
+
+ void ConstructL();
+
+ void ParseRdsDataL();
+
+ void startRTPlusTimer();
+
+ /**
+ * StaticRdsSimulationCallback Callback for RDS simulation
+ */
+ static TInt StaticRdsSimulationCallback( TAny* aSelfPtr );
+
+ /**
+ * Callback for RT+ simulation
+ */
+ static TInt StaticRdsSimulationCallback2( TAny* aSelfPtr );
+
+private: // data
+
+ /** Timer for RDS event simulation */
+ CPeriodic* iEventSimulatorTimer;
+
+ /** Timer for RT+ events */
+ CPeriodic* iEventSimulatorTimer2;
+
+ /** The iterator for RDS events */
+ TInt iEventIterator;
+
+ /** The iterator for RT+ events */
+ TInt iRtPlusIterator;
+
+ /** The iterator for RT events */
+ TInt iRtIterator;
+
+ /** The iterator for PS names */
+ TInt iPsIterator;
+
+ /** The iterator for frequencies */
+ TInt iFrequencyIterator;
+
+ /** The iterator for RT and RT+ information */
+ TInt iRadioTextIterator;
+
+ };
+
+#endif // T_CRADIORDSRECEIVERSIMULATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/src/cradioengine.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// User includes
+#include "cradioengine.h"
+#include "cradioengineimp.h"
+#include "cradioenginelogger.h"
+#include "mradioengineinitializer.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+// Starts the radio engine initialization.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioEngine* CRadioEngine::NewL( MRadioEngineInitializer& aInitializer )
+ {
+ CRadioAudioRouter* audioRouter = aInitializer.InitAudioRouterL();
+ CleanupStack::PushL( audioRouter );
+
+ CRadioEngineImp* self = new (ELeave) CRadioEngineImp( audioRouter );
+ CleanupStack::Pop( audioRouter );
+ CleanupStack::PushL( self );
+
+ self->SetSystemEventCollector( aInitializer.InitSystemEventCollectorL() );
+ self->SetRadioSettings( aInitializer.InitSettingsL() );
+ self->SetRadioPubSub( aInitializer.InitPubSubL() );
+ self->ConstructL();
+
+ self->InitRadioL( self->DetermineRegion(), self->PubSub() );
+ self->EnableAudio( ETrue );
+
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngine::CRadioEngine( CRadioAudioRouter* aAudioRouter )
+ : CRadioRoutableAudio( aAudioRouter )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioEngine::~CRadioEngine()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/src/cradioengineimp.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,1873 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <audiooutput.h>
+#include <eikdef.h>
+#include <coemain.h>
+#include <badesca.h>
+#include <tzlocalizer.h>
+
+// User includes
+#include "cradioenginelogger.h"
+#include "radiointernalpskeys.h"
+#include "radiointernalcrkeys.h"
+#include "cradioaudiorouter.h"
+#include "cradiopubsub.h"
+#include "cradioengineimp.h"
+#include "mradioengineobserver.h"
+#include "mradioscanobserver.h"
+#include "cradioregion.h"
+#include "cradiosettings.h"
+#include "mradioenginesettings.h"
+#include "mradiosettingssetter.h"
+#include "cradiorepositorymanager.h"
+#include "cradiordsreceiver.h"
+#include "cradiosystemeventcollector.h"
+#include "cradionetworkinfolistener.h"
+#include "radioengine.hrh"
+
+#include "../../group/buildflags.hrh"
+#ifdef __FEATURE_RDS_SIMULATOR
+# include "t_cradiordsreceiversimulator.h"
+#endif
+
+// Constants
+
+/** The limit of volume steps that must not be divided */
+const TInt KRadioVolumeStepsDividinglimit = 20;
+/** If CMMTunerUtility has 200 volume steps, AknVolume control has 20 steps */
+const TInt KRadioVolumeStepsDivider = 500;
+/** amount of volume steps used previously */
+#if defined __WINS__
+const TInt KRadioVolumeStepsOld = 10;
+#endif // defined __WINS__
+
+/** KRadioRadioSwitchDelay value must not be too small, otherwise problems with
+ radioserver will occur, when swithing between valid and invalid presets */
+const TInt KRadioRadioSwitchDelay = 300; // In milliseconds
+
+const TInt KRadioThousand = 1000;
+const TInt KRadioMillion = KRadioThousand * KRadioThousand;
+
+// Country order from timezones.rss. Default = 0, Japan = 1, America = 2.
+const TUint KCityGroupRegions[] =
+ {0,0,0,0,0,0,2,0,0,0,0,2,0,2,0,2,0,2,0,2,2,0,2,0,0,2,2,2,0,2,0,0, //32
+ 0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0, //64
+ 0,0,0,0,0,2,0,0,0,2,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //96
+ 0,0,0,2,0,0,0,0,2,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //128
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //160
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0, //192
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0, //224
+ 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineImp::CRadioEngineImp( CRadioAudioRouter* aAudioRouter )
+ : CRadioEngine( aAudioRouter )
+ , iAntennaAttached( ETrue )
+ , iFreqEventReason( RadioEngine::ERadioFrequencyEventReasonUnknown )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::ConstructL()
+ {
+ LOG_METHOD_AUTO;
+
+ if ( !iAudioRouter || !iSystemEventCollector || !iSettings )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ iSystemEventCollector->AddObserverL( this );
+
+ // Initial default values to be over by init
+ User::LeaveIfError( iSettings->RadioSetter().SetPowerOn( EFalse ) );
+
+ // The output source needs to be in headset when starting the radio.
+ // But if the headset is not connected, audio cannot be heard if it is routed
+ // to headset
+ RadioEngine::TRadioAudioRoute route = iSystemEventCollector->IsHeadsetConnectedL() ?
+ RadioEngine::ERadioHeadset : RadioEngine::ERadioSpeaker;
+ User::LeaveIfError( iSettings->RadioSetter().SetAudioRoute( route ) );
+
+#ifdef __FEATURE_RDS_SIMULATOR
+ iRdsReceiver = CRadioRdsReceiverSimulator::NewL( iSettings->EngineSettings() );
+#else
+ iRdsReceiver = CRadioRdsReceiver::NewL( iSettings->EngineSettings() );
+#endif
+
+ iNetworkInfoListener = CRadioNetworkInfoListener::NewL( iSettings->RadioSetter(), NULL );
+
+ iRdsReceiver->AddObserverL( this );
+
+ // Create timer that is used when polling for radio restart.
+ iRadioTimer = CPeriodic::NewL( CActive::EPriorityHigh );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineImp::~CRadioEngineImp()
+ {
+ LOG( "CRadioEngineImp::~CRadioEngineImp -- Start" );
+
+ delete iNetworkInfoListener;
+
+ PowerOff();
+
+ delete iRadioTimer;
+
+ DeleteAudioOutput();
+
+ if ( iTunerUtility )
+ {
+ iTunerUtility->Close();
+ }
+
+ if ( iPlayerUtility )
+ {
+ iPlayerUtility->Close();
+ }
+
+ if ( iRdsReceiver )
+ {
+ iRdsReceiver->RemoveObserver( this );
+ }
+
+ delete iRdsReceiver;
+ delete iRadioUtility;
+
+ iObservers.Close();
+
+ if ( iSystemEventCollector )
+ {
+ iSystemEventCollector->RemoveObserver( this );
+ }
+ delete iSystemEventCollector;
+
+ delete iPubSub;
+
+ if ( iSettings )
+ {
+ iSettings->RadioSetter().SetObserver( NULL );
+ }
+ delete iSettings;
+
+ LOG( "CRadioEngineImp::~CRadioEngineImp -- End" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SetSystemEventCollector( CRadioSystemEventCollector* aCollector )
+ {
+ iSystemEventCollector = aCollector;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SetRadioSettings( CRadioSettings* aSettings )
+ {
+ iSettings = aSettings;
+ iSettings->RadioSetter().SetObserver( this );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SetRadioPubSub( CRadioPubSub* aPubSub )
+ {
+ iPubSub = aPubSub;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioAudioRouter& CRadioEngineImp::AudioRouter() const
+ {
+ return *iAudioRouter;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSystemEventCollector& CRadioEngineImp::SystemEventCollector() const
+ {
+ return *iSystemEventCollector;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSettings& CRadioEngineImp::Settings() const
+ {
+ return *iSettings;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioPubSub* CRadioEngineImp::PubSub() const
+ {
+ return iPubSub;
+ }
+
+// ---------------------------------------------------------------------------
+// Determines radio region
+// ---------------------------------------------------------------------------
+//
+TRadioRegion CRadioEngineImp::DetermineRegion()
+ {
+ TRadioRegion region = ERadioRegionNone;
+
+ MRadioEngineSettings& engineSettings = iSettings->EngineSettings();
+ if ( iSystemEventCollector->IsMobileNetworkCoverage() )
+ {
+ region = RegionFromMobileNetwork();
+ }
+ else
+ {
+ region = RegionFromTimezone();
+ }
+
+ if ( !iSettings->IsRegionAllowed( region ) )
+ {
+ region = ERadioRegionNone;
+ }
+
+ // Region not found, try to use the previously set region
+ if ( region == ERadioRegionNone && engineSettings.RegionId() != ERadioRegionNone )
+ {
+ region = engineSettings.RegionId();
+ }
+
+ // All regions have been searched and no direct match found, use default one
+ if ( region == ERadioRegionNone )
+ {
+ region = engineSettings.DefaultRegion();
+ }
+
+ return region;
+ }
+
+// ---------------------------------------------------------------------------
+// Initializes / reinitializes the radio. If this is not called
+// the radio is not functional
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::InitRadioL( TInt aRegionId, CRadioPubSub* aPubSub )
+ {
+ LOG_METHOD_AUTO;
+ LOG_FORMAT( "CRadioEngineImp::InitRadioL: Region: %d", aRegionId );
+
+ iRadioInitializationState = ERadioNotInitialized;
+
+ iPubSub = aPubSub;
+
+ iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonUnknown;
+ if ( iSettings->EngineSettings().RegionId() != aRegionId )
+ {
+ // Change only when necessary as it changes also the default tuned frequency
+ User::LeaveIfError( iSettings->RadioSetter().SetRegionId( aRegionId ) );
+ }
+
+ if ( !iRadioUtility )
+ {
+ iRadioUtility = CRadioUtility::NewL( ETrue );
+ }
+
+ if ( !iPlayerUtility )
+ {
+ iPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this );
+ SetAudioOutput( CAudioOutput::NewL( *iPlayerUtility ) );
+ }
+
+ if ( !iTunerUtility )
+ {
+ iTunerUtility = &iRadioUtility->RadioFmTunerUtilityL( *this );
+ }
+
+ // Utilities have been created now
+ iRadioInitializationState = ERadioUtilitiesConstructed;
+
+ // Before first RequestTunerControl() call it is ok to enable offline mode without checking capabilities
+ iTunerUtility->EnableTunerInOfflineMode( ETrue );
+ iTunerUtility->RequestTunerControl();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineImp::RadioInitialized() const
+ {
+ return iRadioInitializationState == ERadioTunerControlGranted;
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the state for radio audio
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::EnableAudio( TBool aEnable, TBool aDelay )
+ {
+ LOG_FORMAT( "CRadioEngineImp::EnableAudio( %d )", aEnable );
+ iRadioEnabled = aEnable;
+ if ( aDelay )
+ {
+ SwitchPower( iRadioEnabled );
+ }
+ else if ( aEnable )
+ {
+ if ( !RadioInitialized() &&
+ iRadioInitializationState == ERadioUtilitiesConstructed &&
+ iRadioEnabled &&
+ OkToPlay( iSettings->EngineSettings().TunedFrequency() ) )
+ {
+ iTunerUtility->RequestTunerControl();
+ }
+ else
+ {
+ PowerOn();
+ }
+ }
+ else
+ {
+ PowerOff();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the state for radio audio.
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineImp::RadioAudioEnabled() const
+ {
+ return iRadioEnabled;
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the state for audio overriding
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SetAudioOverride( TBool aOverride )
+ {
+ LOG_FORMAT( "CRadioEngineImp::SetAudioOverride( %d )", aOverride );
+ iOverrideAudioResources = aOverride;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds an observer for the radio state changes notifications.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::AddObserverL( MRadioEngineObserver* aObserver )
+ {
+ LOG( "CRadioEngineImp::AddObserver" );
+ TInt index = iObservers.FindInAddressOrder( aObserver );
+ if ( index == KErrNotFound )
+ {
+ iObservers.InsertInAddressOrderL( aObserver );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Removes an observer from the list of obsevers
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::RemoveObserver( MRadioEngineObserver* aObserver )
+ {
+ LOG( "CRadioEngineImp::RemoveObserver" );
+ TInt index = iObservers.FindInAddressOrder( aObserver );
+
+ if ( index >= 0 )
+ {
+ iObservers.Remove( index );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TFmRadioFrequencyRange CRadioEngineImp::TunerFrequencyRangeForRegionId( TInt aRegionId ) const
+ {
+ TFmRadioFrequencyRange result = EFmRangeEuroAmerica;
+ switch ( aRegionId )
+ {
+ case ERadioRegionDefault:
+ {
+ result = EFmRangeEuroAmerica;
+ break;
+ }
+ case ERadioRegionJapan:
+ {
+ result = EFmRangeJapan;
+ break;
+ }
+ case ERadioRegionAmerica:
+ {
+ result = EFmRangeEuroAmerica;
+ break;
+ }
+ default:
+ break;
+ }
+ return result;
+ }
+
+// ---------------------------------------------------------------------------
+// Sets radio mode ERadioStereo or ERadioMono
+// ---------------------------------------------------------------------------
+
+void CRadioEngineImp::SetAudioMode( TInt aAudioMode )
+ {
+ LOG_FORMAT( "CRadioEngineImp::SetAudioMode: aAudioMode: %d", aAudioMode );
+ TInt err = KErrNone;
+ if ( !RadioInitialized() )
+ {
+ TInt err = iSettings->RadioSetter().SetOutputMode( aAudioMode );
+ NotifyRadioEvent( ERadioEventAudioMode, err );
+ }
+ else
+ {
+ err = iTunerUtility->ForceMonoReception( aAudioMode == RadioEngine::ERadioMono );
+
+ if ( err )
+ {
+ NotifyRadioEvent( ERadioEventAudioMode, err );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Switches power on/off after a delay
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SwitchPower( TBool aPowerOn )
+ {
+ LOG_FORMAT( "CRadioEngineImp::SwitchPower( %d )", aPowerOn );
+ if ( RadioInitialized() )
+ {
+ if ( !aPowerOn || OkToPlay( iSettings->EngineSettings().TunedFrequency() ) )
+ {
+ iRadioTimer->Cancel();
+ if ( aPowerOn )
+ {
+ iRadioTimer->Start( TTimeIntervalMicroSeconds32( KRadioRadioSwitchDelay * KRadioThousand ),
+ TTimeIntervalMicroSeconds32( 0 ),
+ TCallBack( StaticPowerOnCallback, this ) );
+ }
+ else
+ {
+ iRadioTimer->Start( TTimeIntervalMicroSeconds32( KRadioRadioSwitchDelay * KRadioThousand ),
+ TTimeIntervalMicroSeconds32( 0 ),
+ TCallBack( StaticPowerOffCallback, this ) );
+ }
+ }
+ }
+ else if ( aPowerOn &&
+ iRadioInitializationState == ERadioUtilitiesConstructed &&
+ iRadioEnabled &&
+ OkToPlay( iSettings->EngineSettings().TunedFrequency() ) )
+ {
+ iTunerUtility->RequestTunerControl();
+ }
+ else
+ {
+ LOG( "CRadioEngineImp::SwitchPower - Unhandled case" );
+ LOG_FORMAT( "PowerOn: %d, InitializationState: %d, Enabled: %d, Frequency: %d",
+ aPowerOn, iRadioInitializationState, iRadioEnabled, iSettings->EngineSettings().TunedFrequency() );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Executes the power switch
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineImp::StaticPowerOnCallback( TAny* aSelfPtr )
+ {
+ LOG( "CRadioEngineImp::StaticPowerOnCallback" );
+ CRadioEngineImp* self = reinterpret_cast<CRadioEngineImp*>( aSelfPtr );
+
+ if ( self )
+ {
+ self->iRadioTimer->Cancel(); // prevents the further calls.
+
+ if ( !self->iSettings->EngineSettings().IsPowerOn() )
+ {
+ self->PowerOn();
+ }
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Executes the power switch
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineImp::StaticPowerOffCallback( TAny* aSelfPtr )
+ {
+ LOG( "CRadioEngineImp::StaticPowerOffCallback" );
+ CRadioEngineImp* self = reinterpret_cast<CRadioEngineImp*>( aSelfPtr );
+
+ if ( self )
+ {
+ self->iRadioTimer->Cancel(); // prevents the further calls.
+
+ if ( self->iSettings->EngineSettings().IsPowerOn() )
+ {
+ self->PowerOff();
+ }
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::PowerOn()
+ {
+ LOG_METHOD_AUTO;
+
+ if ( RadioInitialized() &&
+ iRadioEnabled &&
+ OkToPlay( iSettings->EngineSettings().TunedFrequency() ) )
+ {
+ SetAudioMode( iSettings->EngineSettings().OutputMode() );
+ iPlayerUtility->SetVolumeRamp( TTimeIntervalMicroSeconds( MAKE_TINT64( 0, KRadioMillion ) ) );
+ iPlayerUtility->SetVolume( TunerVolumeForUiVolume( iSettings->EngineSettings().Volume() ) );
+
+ // If we are about to start scanning, mute the radio and set minimum frequency
+ if ( iScanObserver )
+ {
+ iPlayerUtility->Mute( ETrue );
+ iTunerUtility->SetFrequency( iSettings->EngineSettings().MinFrequency() );
+ }
+ else
+ {
+ iPlayerUtility->Mute( iSettings->EngineSettings().IsVolMuted() );
+ iTunerUtility->SetFrequency( iSettings->EngineSettings().TunedFrequency() );
+ }
+ iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonImplicit;
+
+ TRAP_IGNORE( iAudioRouter->SetAudioRouteL(
+ RadioEngine::TRadioAudioRoute( iSettings->EngineSettings().AudioRoute() ) ) )
+
+ iPlayerUtility->Play();
+ }
+ else
+ {
+ HandlePowerEvent( EFalse, KErrGeneral );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Radio power off
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::PowerOff()
+ {
+ LOG( "CRadioEngineImp::PowerOff" );
+
+ if ( iSettings->EngineSettings().IsPowerOn() )
+ {
+ if ( RadioInitialized() )
+ {
+ iPlayerUtility->Stop();
+ }
+ else // This shouldn't occur normally, just a recovery action
+ {
+ HandlePowerEvent( EFalse, KErrNone );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineImp::OkToPlay( TUint32 aFrequency ) const
+ {
+ TBool audioResourcesAvailable = iSystemEventCollector->IsAudioResourcesAvailable();
+ TBool okToPlay = iAntennaAttached &&
+ !iFmTransmitterActive &&
+ ( audioResourcesAvailable || iOverrideAudioResources ) &&
+#ifdef COMPILE_IN_IVALO
+ IsFrequencyValid( aFrequency )
+ && !iSystemEventCollector->IsCallActive();
+#else
+ IsFrequencyValid( aFrequency );
+#endif //COMPILE_IN_IVALO
+
+ LOG_FORMAT( "CRadioEngineImp::OkToPlay, returning %d ", okToPlay );
+ return okToPlay;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineImp::IsFrequencyValid( TUint32 aFrequency ) const
+ {
+ TBool ret( EFalse );
+ if ( !aFrequency )
+ {
+ aFrequency = iSettings->EngineSettings().TunedFrequency();
+ }
+ if ( aFrequency >= iSettings->EngineSettings().MinFrequency() && aFrequency <= iSettings->EngineSettings().MaxFrequency() )
+ {
+ ret = ETrue;
+ }
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// Radio tuning
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SetFrequency( TUint32 aFrequency, RadioEngine::TRadioFrequencyEventReason aReason )
+ {
+ LOG_METHOD_AUTO;
+ LOG_FORMAT( "CRadioEngineImp::SetFrequency, freq: %u, Initialized: %d, Enabled: %d",
+ aFrequency, RadioInitialized(), iRadioEnabled );
+
+ iFrequencySetByRdsAf = EFalse;
+ iFreqEventReason = aReason;
+
+ TInt frequency = 0;
+ if ( iTunerUtility )
+ {
+ iTunerUtility->GetFrequency( frequency );
+ }
+ CancelSeek();
+
+ if ( aFrequency == frequency ) //radio has already the frequency to be set.
+ {
+ LOG( "CRadioEngineImp::SetFrequency: Already at the requested frequency" );
+ HandleFrequencyEvent( aFrequency );
+ }
+ else
+ {
+ iRadioTimer->Cancel();
+ if ( RadioInitialized() && iRadioEnabled && OkToPlay( aFrequency ) )
+ {
+ LOG( "CRadioEngineImp::SetFrequency: Tuning to frequency" );
+ iTunerUtility->SetFrequency( aFrequency );
+ }
+ else
+ {
+ HandleFrequencyEvent( aFrequency );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Radio tuning
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SetFrequencyFast( TUint32 aFrequency,
+ RadioEngine::TRadioFrequencyEventReason /*aReason*/ )
+{
+ if ( iSeekingState != RadioEngine::ERadioNotSeeking )
+ {
+ iSeekingState = RadioEngine::ERadioNotSeeking;
+ iTunerUtility->CancelStationSeek();
+ }
+ iTunerUtility->SetFrequency( aFrequency );
+ iSettings->RadioSetter().SetTunedFrequency( aFrequency );
+}
+
+// ---------------------------------------------------------------------------
+// Frequency stepping
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::StepToFrequency( RadioEngine::TRadioTuneDirection aDirection )
+ {
+ LOG( "CRadioEngineImp::StepToFrequency" );
+
+ TUint32 freq = iSettings->EngineSettings().TunedFrequency();
+ RadioEngine::TRadioFrequencyEventReason reason( RadioEngine::ERadioFrequencyEventReasonUnknown );
+ if ( aDirection == RadioEngine::ERadioUp )
+ {
+ freq = freq + iSettings->EngineSettings().FrequencyStepSize();
+ reason = RadioEngine::ERadioFrequencyEventReasonUp;
+ }
+ else
+ {
+ freq = freq - iSettings->EngineSettings().FrequencyStepSize();
+ reason = RadioEngine::ERadioFrequencyEventReasonDown;
+ }
+
+ // Check overflow or underflow
+ if ( IsFrequencyValid( freq ) )
+ {
+ if ( aDirection == RadioEngine::ERadioUp )
+ {
+ freq = iSettings->EngineSettings().MinFrequency();
+ }
+ else
+ {
+ freq = iSettings->EngineSettings().MaxFrequency();
+ }
+ }
+ SetFrequency( freq, reason );
+ }
+
+// ---------------------------------------------------------------------------
+// Radio seek
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::Seek( RadioEngine::TRadioTuneDirection aDirection )
+ {
+ LOG_FORMAT( "CRadioEngineImp::Seek-- Start direction:%d",aDirection );
+
+ iFrequencySetByRdsAf = EFalse;
+
+ // Check if audio playing parameters ( other than frequency ) are OK
+ if ( iRadioEnabled &&
+ OkToPlay( iSettings->EngineSettings().MinFrequency() ) &&
+ iSeekingState == RadioEngine::ERadioNotSeeking )
+ {
+ if ( aDirection == RadioEngine::ERadioDown )
+ {
+ iSeekingState = RadioEngine::ERadioSeekingDown;
+ iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonDown;
+ }
+ else
+ {
+ iSeekingState = RadioEngine::ERadioSeekingUp;
+ iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonUp;
+ }
+
+ NotifyRadioEvent( ERadioEventSeeking );
+
+ if ( IsFrequencyValid() )
+ {
+ if ( iSettings->EngineSettings().IsPowerOn() )
+ {
+ iTunerUtility->StationSeek( aDirection == RadioEngine::ERadioUp ? ETrue : EFalse );
+ }
+ else
+ {
+ // Try to switch power on ( reinitialization )
+ SwitchPower( ETrue );
+ }
+ }
+ else
+ {
+ // Tune first to valid frequency, start seeking after radio power is on
+ SetFrequency( iSettings->EngineSettings().MinFrequency(), RadioEngine::ERadioFrequencyEventReasonImplicit );
+ }
+ }
+ else
+ {
+ NotifyRadioEvent( ERadioEventSeeking, KErrGeneral );
+ StopScan( KErrGeneral );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Cancels seek up/down request
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::CancelSeek()
+ {
+ LOG_FORMAT( "CRadioEngineImp::CancelSeek -- seeking state was:%d", iSeekingState );
+
+ if ( !iScanObserver )
+ {
+ if ( iSeekingState != RadioEngine::ERadioNotSeeking )
+ {
+ iSeekingState = RadioEngine::ERadioNotSeeking;
+ iTunerUtility->CancelStationSeek();
+ iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonImplicit;
+ NotifyRadioEvent( ERadioEventSeeking, KErrCancel );
+ NotifyRadioEvent( ERadioEventFrequency, KErrNone ); // Notify the observers even if the frequency remains the same.
+ }
+ }
+ else
+ {
+ StopScan( KErrCancel );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+RadioEngine::TRadioSeeking CRadioEngineImp::Seeking() const
+ {
+ return iSeekingState;
+ }
+
+// ---------------------------------------------------------------------------
+// Starts scanning all available stations from the minimum frequency
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::StartScan( MRadioScanObserver& aObserver )
+ {
+ LOG( "CRadioEngineImp::StartScan" );
+
+ const TUint32 minFrequency = iSettings->EngineSettings().MinFrequency();
+ if ( !iScanObserver && iRadioEnabled && RadioInitialized() && OkToPlay( minFrequency ) )
+ {
+ CancelSeek();
+ iScanObserver = &aObserver;
+ iPreviousMuteState = iSettings->EngineSettings().IsVolMuted();
+ iPreviousScannedFrequency = 0;
+ iPlayerUtility->Mute( ETrue );
+ iTunerUtility->SetFrequency( minFrequency );
+ Seek( RadioEngine::ERadioUp );
+ }
+ else
+ {
+ TInt error = iScanObserver ? KErrAlreadyExists : KErrNotReady;
+ TRAP_IGNORE( aObserver.ScanCompletedEventL( error ) )
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Stops any scans currently in progress.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::StopScan( TInt aError )
+ {
+ LOG_FORMAT( "CRadioEngineImp::StopScan, error: %d", aError );
+ if ( iScanObserver )
+ {
+ if ( iSeekingState != RadioEngine::ERadioNotSeeking )
+ {
+ iSeekingState = RadioEngine::ERadioNotSeeking;
+ if ( RadioInitialized() )
+ {
+ iTunerUtility->CancelStationSeek();
+ }
+ }
+
+ iPreviousScannedFrequency = 0;
+ MRadioScanObserver& observer = *iScanObserver;
+ iScanObserver = NULL;
+ NotifyRadioScanEvent( ERadioEventScanCompleted, observer, aError );
+
+ if ( !OkToPlay( iSettings->EngineSettings().MinFrequency() ) )
+ {
+ // Try to reset the frequency as sometimes extra frequency event occurs after seeking
+ iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonImplicit;
+ iTunerUtility->SetFrequency( iSettings->EngineSettings().TunedFrequency() );
+ }
+
+ if ( iPlayerUtility && OkToPlay( iSettings->EngineSettings().TunedFrequency() ) )
+ {
+ iPlayerUtility->Mute( iPreviousMuteState );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Sets volume level up/down one step.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::AdjustVolume( RadioEngine::TRadioVolumeSetDirection aDirection )
+ {
+ LOG_FORMAT( "CRadioEngineImp::AdjustVolume( %d )", aDirection );
+
+ if ( iSettings->EngineSettings().IsPowerOn() )
+ {
+ TInt volume = iSettings->EngineSettings().Volume();
+ LOG_FORMAT( "CRadioEngineImp::AdjustVolume volume = ( %d )", volume );
+
+ if ( aDirection == RadioEngine::ERadioDecVolume )
+ {
+ TInt min = iSettings->EngineSettings().DefaultMinVolumeLevel();
+ if ( --volume < min )
+ {
+ volume = min;
+ }
+ }
+ else if ( aDirection == RadioEngine::ERadioIncVolume )
+ {
+ TInt max = MaxVolumeLevel();
+
+ if ( ++volume > max )
+ {
+ volume = max;
+ }
+ }
+ else
+ {
+ LOG( "CRadioEngineImp::AdjustVolume - Unhandled case" );
+ }
+ SetVolume( volume );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Sets audio volume level
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SetVolume( TInt aVolume )
+ {
+ LOG_FORMAT( "CRadioEngineImp::SetVolume vol: %d", aVolume );
+
+ if ( iSettings->EngineSettings().IsPowerOn() && RadioInitialized() )
+ {
+ LOG( "CRadioEngineImp::SetVolume: Setting volume to player utility" );
+
+ if ( aVolume == 0 )
+ {
+ SetVolumeMuted( ETrue );
+ }
+ else
+ {
+ if ( iSettings->EngineSettings().IsVolMuted() )
+ {
+ SetVolumeMuted( EFalse );
+ }
+ else if ( iPlayerUtility->SetVolume( TunerVolumeForUiVolume( aVolume ) ) == KErrNone )
+ {
+ iSettings->RadioSetter().SetVolume( aVolume );
+ NotifyRadioEvent( ERadioEventVolume, KErrNone );
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Set radio audio muted/unmuted
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SetVolumeMuted( TBool aMuteState )
+ {
+ LOG_METHOD_AUTO;
+ LOG_FORMAT( "MuteState = %d", aMuteState );
+
+ if ( iSettings->EngineSettings().IsPowerOn() )
+ {
+ TInt err = KErrNone;
+ if ( RadioInitialized() )
+ {
+ err = iPlayerUtility->Mute( aMuteState );
+ iSettings->RadioSetter().SetVolMuted( aMuteState );
+ NotifyRadioEvent( ERadioEventMute, err );
+ }
+ else
+ {
+ err = iSettings->RadioSetter().SetVolMuted( aMuteState );
+ NotifyRadioEvent( ERadioEventMute, err );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineImp::IsAntennaAttached()
+ {
+ LOG_FORMAT( "CRadioEngineImp::IsAntennaAttached, returning %d", iAntennaAttached );
+ return iAntennaAttached;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineImp::IsFmTransmitterActive() const
+ {
+ LOG_FORMAT( "CRadioEngineImp::IsFmTransmitterActive, returning %d", iFmTransmitterActive );
+ return iFmTransmitterActive;
+ }
+
+// ---------------------------------------------------------------------------
+// This function is usable only in WINS emulator.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::SetAntennaAttached( TBool aAntennaAttached )
+ {
+#ifdef __WINS__
+ MrftoAntennaStatusChange( aAntennaAttached );
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+// If CRadioPlayerUtility has 10 steps, CAknVolumeControl has also 10 steps and also
+// the maximum volume level of Visual radio is 10. Otherwise CRadioPlayerUtility has
+// 200 steps, and CAknVolumeControl has 20 steps, so maximum volume level of Visual radio
+// is 20.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineImp::MaxVolumeLevel() const
+ {
+ TInt maxLevel = 0;
+
+#if defined __WINS__
+ maxLevel = KRadioVolumeStepsOld;
+#else
+ if ( RadioInitialized() )
+ {
+ iPlayerUtility->GetMaxVolume( maxLevel );
+ }
+#endif //defined __WINS__
+
+ if ( maxLevel > KRadioVolumeStepsDividinglimit )
+ {
+ maxLevel = maxLevel / KRadioVolumeStepsDivider;
+ }
+
+ return maxLevel;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineImp::FrequencySetByRdsAf() const
+ {
+ return iFrequencySetByRdsAf;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+MRadioRdsReceiver& CRadioEngineImp::RdsReceiver()
+ {
+ return *iRdsReceiver;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineImp::TunerVolumeForUiVolume( TInt aUiVolume )
+ {
+ TInt vol = aUiVolume * KRadioVolumeStepsDivider;
+
+ return vol;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::NotifyRadioEvent( TInt aRadioEvent, TInt aErrorCode )
+ {
+ TRAP_IGNORE( DoNotifyRadioEventL( aRadioEvent, aErrorCode ) )
+ }
+
+// ---------------------------------------------------------------------------
+// Notifies all the registered observers of radio events
+// by sending notifications to observers.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::DoNotifyRadioEventL( TInt aRadioEvent, TInt aErrorCode )
+ {
+ TInt count = iObservers.Count();
+
+ for ( TInt i = 0; i<count; i++)
+ {
+ MRadioEngineObserver * observer = iObservers[i];
+
+ switch ( aRadioEvent )
+ {
+ case ERadioEventPower:
+ {
+ observer->PowerEventL( iSettings->EngineSettings().IsPowerOn(), aErrorCode );
+ break;
+ }
+ case ERadioEventFrequency:
+ {
+ observer->FrequencyEventL( iSettings->EngineSettings().TunedFrequency(),
+ iFreqEventReason, aErrorCode );
+ break;
+ }
+ case ERadioEventVolume:
+ {
+ observer->VolumeEventL( iSettings->EngineSettings().Volume(), aErrorCode );
+ break;
+ }
+ case ERadioEventMute:
+ {
+ if ( !iScanObserver )
+ {
+ observer->MuteEventL( iSettings->EngineSettings().IsVolMuted(), aErrorCode );
+ }
+ break;
+ }
+ case ERadioEventAudioMode:
+ {
+ observer->AudioModeEventL( iSettings->EngineSettings().OutputMode(), aErrorCode );
+ break;
+ }
+ case ERadioEventAntenna:
+ {
+ observer->AntennaEventL( iAntennaAttached, aErrorCode );
+ break;
+ }
+ case ERadioEventAudioRouting:
+ {
+ observer->AudioRoutingEventL( iSettings->EngineSettings().AudioRoute(), aErrorCode );
+ break;
+ }
+ case ERadioEventSeeking:
+ {
+ observer->SeekingEventL( iSeekingState, aErrorCode );
+ break;
+ }
+ case ERadioEventRegion:
+ {
+ observer->RegionEventL( iSettings->EngineSettings().RegionId(), aErrorCode );
+ break;
+ }
+ case ERadioEventFmTransmitter:
+ {
+ observer->FmTransmitterEventL( iFmTransmitterActive );
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Notifies the observer of a radio scan event.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::NotifyRadioScanEvent( TRadioScanEvent aEvent,
+ MRadioScanObserver& aObserver,
+ TInt aError )
+ {
+ TRAP_IGNORE( DoNotifyRadioScanEventL( aEvent, aObserver, aError ) )
+ }
+
+// ---------------------------------------------------------------------------
+// Notifies the observer of a radio scan event.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::DoNotifyRadioScanEventL( TRadioScanEvent aEvent,
+ MRadioScanObserver& aObserver,
+ TInt aError )
+ {
+ LOG_FORMAT( "CRadioEngineImp::DoNotifyRadioScanEventL, aEvent: %d, aError: %d", aEvent, aError );
+
+ if ( aEvent == ERadioEventFrequencyScanned )
+ {
+ if ( aError == KErrNone )
+ {
+ aObserver.ScanFrequencyEventL( iPreviousScannedFrequency );
+ }
+ }
+ else if ( aEvent == ERadioEventScanCompleted )
+ {
+ // KFmRadioErrTuning error means that no channels can be found anymore
+ if ( aError == KFmRadioErrTuning )
+ {
+ aError = KErrNotFound;
+ }
+
+ aObserver.ScanCompletedEventL( aError );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Handles some system events
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::HandleSystemEventL( TRadioSystemEventType aEventType )
+ {
+ LOG_FORMAT( "CRadioEngineImp::HandleSystemEventL, aEventType = %d", aEventType );
+
+ switch ( aEventType )
+ {
+ case ERadioAudioResourcesAvailable:
+ {
+ LOG( "CRadioEngineImp::HandleSystemEventL, Audio resources available" );
+ SwitchPower( ETrue );
+ }
+ break;
+
+ case ERadioAudioAutoResumeForbidden:
+ {
+ EnableAudio( EFalse );
+ }
+ break;
+
+ case ERadioAudioRouteHeadset:
+ {
+ HandleAudioRoutingEvent( RadioEngine::ERadioHeadset );
+ }
+ break;
+
+ case ERadioAudioRouteSpeaker:
+ {
+ HandleAudioRoutingEvent( RadioEngine::ERadioSpeaker );
+ }
+ break;
+
+ case ERadioCallActivated:
+ {
+ StopScan( KErrGeneral );
+ CancelSeek();
+ }
+ break;
+
+ case ERadioCallDeactivated:
+ {
+ SwitchPower( ETrue );
+ }
+ break;
+
+ case ERadioHeadsetConnected:
+ {
+ // Explicitly set the audio routing to headset. Because system
+ // forces the routing to headset anyway, and without our knowledge.
+ iAudioRouter->SetAudioRouteL( RadioEngine::ERadioHeadset );
+ }
+ break;
+
+ case ERadioHeadsetDisconnected:
+ {
+ // Explicitly set the audio routing to speaker. Because system
+ // forces the routing to speaker anyway, if radio stays on.
+ iAudioRouter->SetAudioRouteL( RadioEngine::ERadioSpeaker );
+ }
+ break;
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoRequestTunerControlComplete( TInt aError )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoRequestTunerControlComplete( %d )", aError );
+
+ if ( aError == KErrNone || aError == KErrAlreadyExists ) // Tuner activated now or was already active
+ {
+ iRadioInitializationState = ERadioTunerControlGranted;
+
+ TFmTunerCapabilities tunerCaps;
+ tunerCaps.iTunerBands = 0;
+ tunerCaps.iTunerFunctions = 0;
+ tunerCaps.iAdditionalFunctions1 = 0;
+ tunerCaps.iAdditionalFunctions2 = 0;
+ iTunerUtility->GetCapabilities( tunerCaps );
+
+#ifdef LOGGING_ENABLED
+ TBuf<50> tunerCapsBuf;
+ if ( tunerCaps.ETunerAvailableInOfflineMode )
+ {
+ tunerCapsBuf.Append( _L("OfflineMode ") );
+ }
+ if ( tunerCaps.ETunerRdsSupport )
+ {
+ tunerCapsBuf.Append( _L("RDS ") );
+ }
+ if ( tunerCaps.ETunerDualTunerSupport )
+ {
+ tunerCapsBuf.Append( _L("DualTuner ") );
+ }
+ LOG_FORMAT( "Radio tuner capabilities: %S", &tunerCapsBuf );
+
+#endif // LOGGING_ENABLED
+
+ TBool offlineAvailable( tunerCaps.iTunerFunctions &
+ TFmTunerCapabilities::ETunerAvailableInOfflineMode );
+ iTunerUtility->EnableTunerInOfflineMode( offlineAvailable );
+
+ TBool rdsSupported = EFalse;
+ TRAP_IGNORE( CRadioRepositoryManager::GetRepositoryValueL( KRadioCRUid, KRadioCRRdsSupport,
+ rdsSupported ) )
+ if ( tunerCaps.iTunerFunctions & TFmTunerCapabilities::ETunerRdsSupport &&
+ rdsSupported )
+ {
+ TRAP_IGNORE( iRdsReceiver->InitL( *iRadioUtility, iPubSub ) )
+ }
+
+ iTunerUtility->SetFrequencyRange( TunerFrequencyRangeForRegionId(
+ iSettings->EngineSettings().RegionId() ) );
+ // To prevent false frequency changes
+ iTunerUtility->SetFrequency( iSettings->EngineSettings().TunedFrequency() );
+ SwitchPower( ETrue );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoSetFrequencyRangeComplete( TInt aError )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoSetFrequencyRangeComplete( %d )", aError );
+ if ( aError )
+ {
+ NotifyRadioEvent( ERadioEventRegion, aError );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoSetFrequencyComplete( TInt aError )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoSetFrequencyComplete: Err: %d", aError );
+
+ if ( aError )
+ {
+ if ( aError == KErrNotReady )
+ {
+ iRadioInitializationState = ERadioUtilitiesConstructed;
+ }
+ HandleFrequencyEvent( iSettings->EngineSettings().TunedFrequency(), aError );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoStationSeekComplete( TInt aError, TInt aFrequency )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoStationSeekComplete() -- aError = %d, aFrequency = %d", aError, aFrequency );
+ // Seeking has ended, error code tells if it was successful
+
+ if ( aError == KFmRadioErrAntennaNotConnected )
+ {
+ iAntennaAttached = EFalse;
+ }
+ else if ( aError == KErrNotReady )
+ {
+ iRadioInitializationState = ERadioUtilitiesConstructed;
+ }
+
+ iSeekingState = RadioEngine::ERadioNotSeeking;
+
+ NotifyRadioEvent( ERadioEventSeeking, aError );
+
+// if ( aError != KErrNone )
+// {
+// iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonImplicit;
+// NotifyRadioEvent( ERadioEventFrequency, KErrNone ); // Frequency change is not otherwise notified when seeking fails.
+// }
+// else
+// {
+// // sometimes frequency change is not reported even if seeking succeeds
+// if ( !iFrequencySetByRdsAf )
+// {
+// NotifyRadioEvent( ERadioEventFrequency, KErrNone );
+// }
+// }
+
+ if ( iScanObserver )
+ {
+ if ( aError != KErrNone )
+ {
+ StopScan( aError );
+ }
+ else
+ {
+ if ( aFrequency > iSettings->EngineSettings().MinFrequency() && aFrequency > iPreviousScannedFrequency )
+ {
+ iPreviousScannedFrequency = aFrequency;
+ NotifyRadioScanEvent( ERadioEventFrequencyScanned, *iScanObserver, KErrNone );
+ Seek( RadioEngine::ERadioUp ); // Continue scanning.
+ }
+ else
+ {
+ if ( aFrequency == iSettings->EngineSettings().MinFrequency() )
+ {
+ iPreviousScannedFrequency = aFrequency;
+ NotifyRadioScanEvent( ERadioEventFrequencyScanned, *iScanObserver, KErrNone );
+ }
+ StopScan( aError );
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoFmTransmitterStatusChange( TBool aActive )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoFmTransmitterStatusChange( %d )", aActive );
+ iFmTransmitterActive = aActive;
+
+ if ( !iFmTransmitterActive )
+ {
+ SwitchPower( ETrue );
+ }
+
+ NotifyRadioEvent( ERadioEventFmTransmitter );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoAntennaStatusChange( TBool aAttached )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoAntennaStatusChange( %d )", aAttached );
+ iAntennaAttached = aAttached;
+ if ( iAntennaAttached )
+ {
+ SwitchPower( ETrue );
+ NotifyRadioEvent( ERadioEventAntenna );
+ iPubSub->PublishAntennaState( ERadioPSRadioAntennaAttached );
+ }
+ else
+ {
+ NotifyRadioEvent( ERadioEventAntenna, KErrDisconnected );
+ iPubSub->PublishAntennaState( ERadioPSRadioAntennaDetached );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+//
+void CRadioEngineImp::MrftoOfflineModeStatusChange( TBool DEBUGVAR( aOfflineMode ) )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoOfflineModeStatusChange( %d )", aOfflineMode );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoFrequencyRangeChange( TFmRadioFrequencyRange DEBUGVAR( aBand ) )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoFrequencyRangeChange( %d )", aBand );
+ if ( RadioInitialized() )
+ {
+ iTunerUtility->SetFrequency( iSettings->EngineSettings().TunedFrequency() );
+ iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonImplicit;
+ }
+ NotifyRadioEvent( ERadioEventRegion );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoFrequencyChange( TInt aNewFrequency )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoFrequencyChange aNewFrequency = %u", aNewFrequency );
+
+ // There may be frequency changed events when radio is not initialized ( because
+ // of SetFrequency or Seek returns with KErrNotReady ).
+ if ( RadioInitialized() )
+ {
+
+ HandleFrequencyEvent( aNewFrequency );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoForcedMonoChange( TBool aForcedMono )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrftoForcedMonoChange -- aForcedMono = %d", aForcedMono );
+
+ iSettings->RadioSetter().SetOutputMode( aForcedMono ? RadioEngine::ERadioMono : RadioEngine::ERadioStereo );
+ NotifyRadioEvent( ERadioEventAudioMode );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrftoSquelchChange( TBool /*aSquelch*/ )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrpoStateChange( TPlayerState aState, TInt aError )
+ {
+ LOG_FORMAT( "CRadioEngineImp::MrpoStateChange() -- aState = %d, aError = %d", aState, aError );
+
+ if ( aError == KFmRadioErrAntennaNotConnected )
+ {
+ iAntennaAttached = EFalse;
+ }
+ HandlePowerEvent( aState == ERadioPlayerPlaying, aError );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrpoVolumeChange( TInt aVolume )
+ {
+ aVolume = aVolume / KRadioVolumeStepsDivider;
+ LOG_FORMAT( "CRadioEngineImp::MrpoVolumeChange() -- volume = %d", aVolume );
+ if ( aVolume != iSettings->EngineSettings().Volume() )
+ {
+ iSettings->RadioSetter().SetVolume( aVolume );
+ NotifyRadioEvent( ERadioEventVolume );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrpoMuteChange( TBool aMute )
+ {
+ TBool muted = iSettings->EngineSettings().IsVolMuted();
+ if ( !iScanObserver && !aMute != !muted )
+ {
+ iSettings->RadioSetter().SetVolMuted( aMute );
+ NotifyRadioEvent( ERadioEventMute );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::MrpoBalanceChange( TInt /*aLeftPercentage*/, TInt /*aRightPercentage*/ )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::RdsAfSearchSettingChangedL( TBool aEnabled )
+ {
+ LOG_FORMAT( "CRadioEngineImp::RdsAfSearchSettingChangedL( %d )", aEnabled );
+ iRdsReceiver->SetAutomaticSwitchingL( aEnabled );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::RegionSettingChangedL( TInt DEBUGVAR( aRegion ) )
+ {
+ LOG_FORMAT( "CRadioEngineImp::RegionSettingChangedL( %d )", aRegion );
+
+ if ( RadioInitialized() )
+ {
+ iTunerUtility->SetFrequencyRange( TunerFrequencyRangeForRegionId( iSettings->EngineSettings().RegionId() ) );
+ iTunerUtility->SetFrequency( iSettings->EngineSettings().TunedFrequency() );
+ iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonImplicit;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::RdsAfSearchBegin()
+ {
+ LOG( "CRadioEngineImp::RdsAfSearchBegin()" );
+ iFrequencySetByRdsAf = ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::RdsAfSearchEnd( TUint32 DEBUGVAR( aFrequency ), TInt aError )
+ {
+ LOG_FORMAT( "CRadioEngineImp::RdsAfSearchEnd( %d, %d )", aFrequency, aError );
+ if ( aError != KErrNone )
+ {
+ iFrequencySetByRdsAf = EFalse;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Tries to figure the region out based on current mobile network id
+// ---------------------------------------------------------------------------
+//
+TRadioRegion CRadioEngineImp::RegionFromMobileNetwork() const
+ {
+ TRadioRegion region = ERadioRegionNone;
+
+ // Choose the frequency range according to country code
+ MRadioEngineSettings& engineSettings = iSettings->EngineSettings();
+ const TDesC& countryCode = engineSettings.CountryCode();
+ const TInt regionCount = engineSettings.CountRegions();
+ TBool matchFound = EFalse;
+ for ( TInt i = 0; i < regionCount && !matchFound; ++i )
+ {
+ const RRadioCountryCodeArray& regionCountryCodes =
+ engineSettings.Region( i ).CountryCodes();
+
+ const TInt countryCodeCount = regionCountryCodes.Count();
+ for ( TInt j = 0; j < countryCodeCount && !matchFound; ++j )
+ {
+ if ( countryCode == *regionCountryCodes[j] )
+ {
+ // We have a match
+ matchFound = ETrue;
+ region = engineSettings.Region( i ).Id();
+ }
+ }
+ }
+
+ return region;
+ }
+
+// ---------------------------------------------------------------------------
+// Tries to figure the region out based on timezone selection
+// ---------------------------------------------------------------------------
+//
+TRadioRegion CRadioEngineImp::RegionFromTimezone() const
+ {
+ TRadioRegion region = ERadioRegionNone;
+ TRAP_IGNORE( region = DoRegionFromTimezoneL() );
+ return region;
+ }
+
+// ---------------------------------------------------------------------------
+// Performs the timezone-based check
+// ---------------------------------------------------------------------------
+//
+TRadioRegion CRadioEngineImp::DoRegionFromTimezoneL() const
+ {
+ LOG_METHOD_AUTO;
+ CTzLocalizer* timezoneLocalizer = CTzLocalizer::NewL();
+ CleanupStack::PushL( timezoneLocalizer );
+
+ CTzLocalizedCityGroupArray* cityGroups = timezoneLocalizer->GetAllCityGroupsL(
+ CTzLocalizer::ETzAlphaNameAscending );
+ CleanupStack::PushL( cityGroups );
+
+ // We get the ownership so we must delete
+ CTzLocalizedCity* city = timezoneLocalizer->GetFrequentlyUsedZoneCityL( CTzLocalizedTimeZone::ECurrentZone );
+ const TUint8 cityId = city->GroupId();
+ delete city;
+ city = NULL;
+ LOG_FORMAT( "CRadioEngineHandler::CurrentTimeZoneToRegionL group id: %d", cityId );
+
+ TRadioRegion region = ERadioRegionNone;
+ const TInt cityGroupCount = cityGroups->Count();
+ TBool found = EFalse;
+ for ( TInt i = 0; i < cityGroupCount && !found; ++i )
+ {
+ if ( cityId == cityGroups->At( i ).Id() )
+ {
+ region = static_cast<TRadioRegion>( KCityGroupRegions[ cityId - 1 ] );
+ found = ETrue;
+ }
+ }
+
+ CleanupStack::PopAndDestroy( cityGroups );
+ CleanupStack::PopAndDestroy( timezoneLocalizer );
+
+ LOG_ASSERT( found, LOG_FORMAT( "CRadioEngine::DoMapCurrentTimeZoneToRegionL. City not found: %d", cityId ) );
+
+ return region;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::HandleAudioRoutingEvent( RadioEngine::TRadioAudioRoute aDestination )
+ {
+ LOG_FORMAT( "CRadioEngineImp::HandleAudioRoutingL( %d )", aDestination );
+
+ // Make modifications to volume ONLY if new audio source state
+ // differs from settings. If they don't differ, this state
+ // change is a part of the radio initialization.
+ MRadioSettingsSetter& setter = iSettings->RadioSetter();
+ if ( aDestination != iSettings->EngineSettings().AudioRoute() )
+ {
+ setter.SetAudioRoute( aDestination );
+
+ // If audio muted, change it to minimum volume
+ MRadioEngineSettings& engineSettings = iSettings->EngineSettings();
+ TInt vol = engineSettings.IsVolMuted() ? engineSettings.DefaultMinVolumeLevel()
+ : engineSettings.Volume();
+
+ if ( RadioInitialized() )
+ {
+ TInt err = iPlayerUtility->Mute( EFalse );
+ if ( !err )
+ {
+ setter.SetVolMuted( EFalse );
+ err = iPlayerUtility->SetVolume( TunerVolumeForUiVolume( vol ));
+
+ if ( !err )
+ {
+ setter.SetVolume( vol );
+ }
+ }
+ }
+ else
+ {
+ setter.SetVolMuted( EFalse );
+ setter.SetVolume( vol );
+ }
+ NotifyRadioEvent( ERadioEventAudioRouting );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::HandlePowerEvent( TBool aPowerOn, TInt aErrorCode )
+ {
+ LOG_FORMAT( "CRadioEngineImp::HandlePowerEvent( %d, %d )", aPowerOn, aErrorCode );
+
+ const TBool powerState = iSettings->EngineSettings().IsPowerOn();
+ if ( !powerState != !aPowerOn )
+ {
+ iSettings->RadioSetter().SetPowerOn( aPowerOn );
+
+ if ( aPowerOn )
+ {
+ iRdsReceiver->StartReceiver();
+ }
+ else
+ {
+ iRdsReceiver->StopReceiver();
+ }
+ }
+
+ if ( !iSettings->EngineSettings().IsPowerOn() )
+ {
+ StopScan( aErrorCode );
+ CancelSeek();
+ }
+
+ // If we are seeking, power event starts seeking
+ if ( iSeekingState != RadioEngine::ERadioNotSeeking && iSettings->EngineSettings().IsPowerOn() )
+ {
+ // Reset seeking state to enable seeking start
+ RadioEngine::TRadioSeeking oldSeeking = iSeekingState;
+ iSeekingState = RadioEngine::ERadioNotSeeking;
+ Seek( oldSeeking == RadioEngine::ERadioSeekingUp ? RadioEngine::ERadioUp : RadioEngine::ERadioDown );
+ }
+
+ if ( !powerState != !aPowerOn )
+ {
+ NotifyRadioEvent( ERadioEventPower, aErrorCode );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineImp::HandleFrequencyEvent( TUint32 aFrequency, TInt aErrorCode )
+ {
+ LOG_FORMAT( "CRadioEngineImp::HandleFrequencyEvent( %d, %d )", aFrequency, aErrorCode );
+
+ if ( iSettings->EngineSettings().TunedFrequency() != aFrequency )
+ {
+ if ( iSettings->EngineSettings().IsPowerOn() )
+ {
+ if ( !OkToPlay( aFrequency ) )
+ {
+ // Radio is going to be powered off, stop rds receiver immediately because
+ // some rds data from previous channel might come before power off event.
+ iRdsReceiver->StopReceiver();
+ }
+ else
+ {
+ // Normal frequency change, make sure that rds receiver is started
+ iRdsReceiver->StartReceiver();
+ }
+ }
+ if ( !iFrequencySetByRdsAf )
+ {
+ iRdsReceiver->ClearRdsInformation();
+ }
+ }
+ else if ( iFrequencySetByRdsAf )
+ {
+ // frequency didn't change, so AF search didn't complete successfully
+ iFrequencySetByRdsAf = EFalse;
+ }
+
+ iSettings->RadioSetter().SetTunedFrequency( aFrequency );
+
+ NotifyRadioEvent( ERadioEventFrequency, aErrorCode );
+ iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonUnknown;
+
+ if ( aErrorCode == KErrNone )
+ {
+ SwitchPower( iRadioEnabled && OkToPlay( aFrequency ) );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Routing is not possible when headset is not available, power is off or
+// audio routing is not supported.
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineImp::IsAudioRoutingPossible() const
+ {
+ TBool headsetConnected = EFalse;
+ TRAP_IGNORE( ( headsetConnected = iSystemEventCollector->IsHeadsetConnectedL() ) )
+
+ TBool powerOn = iSettings->EngineSettings().IsPowerOn();
+
+ TBool isAudioRoutingPossible = EFalse;
+ if ( headsetConnected && powerOn && AudioRoutingSupported() )
+ {
+ isAudioRoutingPossible = ETrue;
+ }
+
+ return isAudioRoutingPossible;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/src/cradionetworkinfolistener.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,306 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <etelmm.h>
+#include <commsdattypesv1_1.h>
+
+#include "cradionetworkinfolistener.h"
+#include "mradiosettingssetter.h"
+#include "cradioenginelogger.h"
+
+using namespace CommsDat;
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioNetworkInfoListener* CRadioNetworkInfoListener::NewL( MRadioSettingsSetter& aSetter,
+ MRadioNetworkChangeObserver* aObserver )
+ {
+ CRadioNetworkInfoListener* self = new ( ELeave ) CRadioNetworkInfoListener( aSetter, aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioNetworkInfoListener::CRadioNetworkInfoListener( MRadioSettingsSetter& aSetter,
+ MRadioNetworkChangeObserver* aObserver )
+ : CActive( CActive::EPriorityHigh )
+ , iSetter( aSetter )
+ , iObserver( aObserver )
+ , iSubscriberIdPckg( iSubscriberId )
+ , iNetworkInfoPckg( iNetworkInfo )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioNetworkInfoListener::ConstructL()
+ {
+ LOG_METHOD_AUTO;
+#ifndef __WINS__
+ iTelephony = CTelephony::NewL();
+
+ // Initialize the default network id and country code directly from CommsDat, as CTelephony cannot be used in synchronous mode
+ // and using it in async mode will cause problems in core initialisation, and too much complexity!
+
+ // Get default TSY from database.
+
+ CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion());
+ CleanupStack::PushL( db );
+
+ CMDBRecordSet<CCDModemBearerRecord>* set = new ( ELeave ) CMDBRecordSet<CCDModemBearerRecord>( KCDTIdModemBearerRecord );
+ CleanupStack::PushL( set );
+
+ set->LoadL( *db );
+
+ TInt index = 0;
+ CCDModemBearerRecord* record = static_cast<CCDModemBearerRecord*>( set->iRecords[index++]);
+
+ if ( record->iTsyName.IsNull() && set->iRecords.Count() > index ) // the first item is normally only a template
+ {
+ record = static_cast<CCDModemBearerRecord*>( set->iRecords[index++]);
+ }
+
+ TPtrC name( static_cast<const TDesC&>( record->iTsyName ));
+ TBuf<50> tsyName;
+ tsyName.Copy( name );
+
+ LOG_FORMAT( "CRadioNetworkInfoListener::ConstructL, TSY name: %S", &tsyName );
+ CleanupStack::PopAndDestroy( set );
+ CleanupStack::PopAndDestroy( db );
+
+ RTelServer telServer;
+ CleanupClosePushL( telServer );
+ RMobilePhone mobilePhone;
+ CleanupClosePushL( mobilePhone );
+
+ // Open phone
+ User::LeaveIfError( telServer.Connect());
+
+ // TSY module gets automatically unloaded when tel.Close() is called ( and tel is is CU-stack ),
+ // so loaded TSY is also leave-safe
+ User::LeaveIfError( telServer.LoadPhoneModule( tsyName ));
+
+ // Get number of phones.
+ TInt phones( 0 );
+ User::LeaveIfError( telServer.EnumeratePhones( phones ));
+ LOG_FORMAT( "CRadioNetworkInfoListener::ConstructL, Number of phones=%d", phones );
+
+ // Get phone info of first legal phone.
+ TInt legalPhoneIndex = KErrNotFound;
+ RTelServer::TPhoneInfo phoneInfo;
+ for ( TInt i=0; i<phones && legalPhoneIndex == KErrNotFound; i++)
+ {
+ if ( telServer.GetPhoneInfo( i, phoneInfo ) == KErrNone )
+ {
+ if ( phoneInfo.iNetworkType == RTelServer::ENetworkTypeMobileDigital )
+ {
+ legalPhoneIndex = i;
+ }
+ }
+ }
+ User::LeaveIfError( legalPhoneIndex );
+
+ // Open legal phone.
+ User::LeaveIfError( mobilePhone.Open( telServer, phoneInfo.iName ));
+
+ TUint32 networkCaps;
+ User::LeaveIfError( mobilePhone.GetNetworkCaps( networkCaps ));
+ TUint32 identityCaps;
+ User::LeaveIfError( mobilePhone.GetIdentityCaps( identityCaps ));
+ // Check if we are allowed to get network info.
+ if ( networkCaps & RMobilePhone::KCapsGetCurrentNetwork )
+ {
+ // Gather initial information synchronically.
+ RMobilePhone::TMobilePhoneLocationAreaV1 location;
+
+ RMobilePhone::TMobilePhoneNetworkInfoV1 networkInfo;
+ RMobilePhone::TMobilePhoneNetworkInfoV1Pckg networkInfoPckg( networkInfo );
+
+ mobilePhone.GetCurrentNetwork( iStatus, networkInfoPckg, location );
+ User::WaitForRequest( iStatus );
+
+ CTelephony::TNetworkInfoV1 telephonyNetworkInfo;
+ if ( iStatus == KErrNone )
+ {
+ telephonyNetworkInfo.iMode = static_cast<CTelephony::TNetworkMode>( networkInfo.iMode );
+ telephonyNetworkInfo.iCountryCode = networkInfo.iCountryCode;
+ telephonyNetworkInfo.iCdmaSID = networkInfo.iCdmaSID;
+ telephonyNetworkInfo.iNetworkId = networkInfo.iNetworkId;
+ }
+ else
+ {
+ telephonyNetworkInfo.iCountryCode = iSetter.CountryCode();
+ telephonyNetworkInfo.iNetworkId = iSetter.NetworkId();
+ }
+ iNetworkInfoPckg() = telephonyNetworkInfo;
+ }
+ else
+ {
+ // Leave if we are not allowed to get network info.
+ // Other action could also be considered!!!!
+ User::Leave( KErrNotSupported );
+ }
+
+ if ( identityCaps & RMobilePhone::KCapsGetSubscriberId )
+ {
+ TRequestStatus stat;
+ RMobilePhone::TMobilePhoneSubscriberId subscriberId;
+ mobilePhone.GetSubscriberId( stat, subscriberId );
+ User::WaitForRequest( stat );
+
+ CTelephony::TSubscriberIdV1 telephonySubscriberId;
+
+ if ( stat == KErrNone )
+ {
+ telephonySubscriberId.iSubscriberId = subscriberId;
+ }
+ else
+ {
+ telephonySubscriberId.iSubscriberId = iSetter.SubscriberId();
+ }
+
+ iSubscriberIdPckg() = telephonySubscriberId;
+ }
+
+ CleanupStack::PopAndDestroy( 2, &telServer );
+#endif
+ // At the end, update the local variables by simulating the "netid changed" event.
+ RunL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioNetworkInfoListener::~CRadioNetworkInfoListener()
+ {
+ Cancel();
+
+#ifndef __WINS__
+ delete iTelephony;
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioNetworkInfoListener::CompoundNetworkId() const
+ {
+ LOG_FORMAT( "CRadioNetworkInfoListener::CompoundNetworkId() - %d", iCompoundNetworkId );
+ return iCompoundNetworkId;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TPtrC CRadioNetworkInfoListener::SubscriberId() const
+ {
+ TPtrC id = iSubscriberId.iSubscriberId;
+ LOG_FORMAT( "CRadioNetworkInfoListener::SubscriberId() - %S", &id );
+ return id;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TPtrC CRadioNetworkInfoListener::CountryCode() const
+ {
+ TPtrC countryCode = iSetter.CountryCode();
+ LOG_FORMAT( "CRadioNetworkInfoListener::CountryCode() - %S", &countryCode );
+ return countryCode;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioNetworkInfoListener::SaveNetworkInfoL()
+ {
+#ifdef __WINS__
+ iNetworkInfo.iCountryCode.Copy( _L("244") );
+ iNetworkInfo.iNetworkId.Zero();
+#endif
+
+ LOG_FORMAT( "CRadioNetworkInfoListener::SaveNetworkInfoL() - iNetworkInfo.iCountryCode = %S",
+ &iNetworkInfo.iCountryCode );
+
+ User::LeaveIfError( iSetter.SetCountryCode( iNetworkInfo.iCountryCode ) );
+
+ // The compound network identifier is composed of the current network identifier and country code.
+ TBuf<KDefaultRealWidth> compoundNetworkId;
+ compoundNetworkId.Append( iSetter.CountryCode() );
+ if ( iNetworkInfo.iNetworkId.Length() < 2 )
+ {
+ // Network identifier has only one digit, in which case it must be prepended with a zero.
+ compoundNetworkId.AppendNum( 0 );
+ }
+
+ compoundNetworkId.Append( iNetworkInfo.iNetworkId );
+
+ TLex lex( compoundNetworkId );
+ User::LeaveIfError( lex.Val( iCompoundNetworkId ) );
+
+ if ( iCompoundNetworkId != 0 && iPreviousCompoundNetworkId != iCompoundNetworkId )
+ {
+ if ( iPreviousCompoundNetworkId != 0 && iObserver )
+ {
+ iObserver->NetworkIdChanged();
+ }
+ iPreviousCompoundNetworkId = iCompoundNetworkId;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioNetworkInfoListener::DoCancel()
+ {
+#ifndef __WINS__
+ iTelephony->CancelAsync( CTelephony::ECurrentNetworkInfoChangeCancel );
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioNetworkInfoListener::RunL()
+ {
+ LOG_FORMAT( "CRadioNetworkInfoListener::RunL() - iStatus.Int() = %d", iStatus.Int() );
+#ifndef __WINS__
+ iTelephony->NotifyChange( iStatus, CTelephony::ECurrentNetworkInfoChange, iNetworkInfoPckg );
+ SetActive();
+#endif
+ SaveNetworkInfoL();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/src/cradiordsreceiver.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradioenginelogger.h"
+
+#include "cradiordsreceiver.h"
+#include "mradioenginesettings.h"
+#include "mradiordsdataobserver.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRdsReceiver::CRadioRdsReceiver( MRadioEngineSettings& aSettings )
+ : CRadioRdsReceiverBase( aSettings )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiver::ConstructL()
+ {
+ BaseConstructL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRdsReceiver* CRadioRdsReceiver::NewL( MRadioEngineSettings& aSettings )
+ {
+ CRadioRdsReceiver* self = new ( ELeave ) CRadioRdsReceiver( aSettings );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRdsReceiver::~CRadioRdsReceiver()
+ {
+ if ( iRdsUtility )
+ {
+ iRdsUtility->Close();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiver::InitL( CRadioUtility& aRadioUtility, CRadioPubSub* aPubSub )
+ {
+ LOG_METHOD_AUTO;
+ iPubSub = aPubSub;
+
+ iRdsUtility = &aRadioUtility.RadioRdsUtilityL( *this );
+
+ LogReceiverCapabilities();
+
+ SetAutomaticSwitchingL( iSettings.RdsAfSearchEnabled() );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiver::SetAutomaticSwitchingL( TBool aEnable )
+ {
+ if ( iRdsUtility )
+ {
+ User::LeaveIfError( iRdsUtility->SetAutomaticSwitching( aEnable ) );
+ }
+
+ // Notifies the observers
+ CRadioRdsReceiverBase::SetAutomaticSwitchingL( aEnable );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiver::StartReceiver()
+ {
+ // Request to be notified of almost all RDS data.
+ // Unwanted RDS values:
+ // ERdsClockTime
+ // ERdsTrafficProgramme
+ // ERdsTrafficAnnouncement
+ // ERdsAlternateFrequency
+ TRdsData rdsData;
+ rdsData.iRdsFunctions = ERdsProgrammeIdentification |
+ ERdsProgrammeType |
+ ERdsProgrammeService |
+ ERdsRadioText |
+ ERdsRadioTextPlus;
+
+ rdsData.iAdditionalFunctions1 = 0;
+ rdsData.iAdditionalFunctions2 = 0;
+
+ LOG_ASSERT( iRdsUtility, LOG( "CRadioRdsReceiver::StartReceiverL. Error: RDS utility not created!" ) );
+ if ( iRdsUtility && !iStarted )
+ {
+ TInt err = iRdsUtility->NotifyRdsDataChange( rdsData );
+ if ( !err )
+ {
+ // Avoid further calls
+ iStarted = ETrue;
+ LOG( "CRadioRdsReceiver::StartReceiverL: Requested RDS notifications from receiver." );
+ }
+ else
+ {
+ LOG_FORMAT( "CRadioRdsReceiver::StartReceiverL. Failed to request RDS data with err %d", err );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiver::StopReceiver()
+ {
+ LOG( "CRadioRdsReceiver::StopReceiver" );
+
+ if ( iRdsUtility )
+ {
+ iRdsUtility->CancelNotifyRdsDataChange();
+ }
+ iStarted = EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// Logs the RDS receiver capabilities if logging is enabled
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiver::LogReceiverCapabilities()
+ {
+#ifdef LOGGING_ENABLED
+ // Log the RDS utility capabilities
+ if ( iRdsUtility )
+ {
+ TRdsCapabilities caps;
+ caps.iRdsFunctions = 0;
+ caps.iAdditionalFunctions1 = 0;
+ caps.iAdditionalFunctions2 = 0;
+ TInt err = iRdsUtility->GetCapabilities( caps );
+ if ( !err )
+ {
+ TBuf<100> capsBuf;
+ if ( caps.iRdsFunctions & ERdsProgrammeIdentification == ERdsProgrammeIdentification )
+ {
+ capsBuf.Append( _L("PI ") );
+ }
+ if ( caps.iRdsFunctions & ERdsProgrammeType == ERdsProgrammeType )
+ {
+ capsBuf.Append( _L("Genre ") );
+ }
+ if ( caps.iRdsFunctions & ERdsProgrammeService == ERdsProgrammeService )
+ {
+ capsBuf.Append( _L("PS ") );
+ }
+ if ( caps.iRdsFunctions & ERdsRadioText == ERdsRadioText )
+ {
+ capsBuf.Append( _L("RT ") );
+ }
+ if ( caps.iRdsFunctions & ERdsRadioTextPlus == ERdsRadioTextPlus )
+ {
+ capsBuf.Append( _L("RT+ ") );
+ }
+ if ( caps.iRdsFunctions & ERdsAlternateFrequency == ERdsAlternateFrequency )
+ {
+ capsBuf.Append( _L("AF ") );
+ }
+ if ( caps.iRdsFunctions & ERdsClockTime == ERdsClockTime )
+ {
+ capsBuf.Append( _L("Time ") );
+ }
+ if ( caps.iRdsFunctions & ERdsTrafficProgramme == ERdsTrafficProgramme )
+ {
+ capsBuf.Append( _L("TrafficProgramme ") );
+ }
+ if ( caps.iRdsFunctions & ERdsTrafficAnnouncement == ERdsTrafficAnnouncement )
+ {
+ capsBuf.Append( _L("TrafficAnnouncement ") );
+ }
+ LOG_FORMAT( "CRadioRdsReceiver::LogReceiverCapabilities. RDS receiver capabilities: %S", &capsBuf );
+ LOG_FORMAT( "CRadioRdsReceiver::LogReceiverCapabilities. Functions: %d, AdditionalFunctions1: %d, iAdditionalFunctions2: %d",
+ caps.iRdsFunctions, caps.iAdditionalFunctions1, caps.iAdditionalFunctions2 );
+ }
+ else
+ {
+ LOG_FORMAT( "CRadioRdsReceiver::LogReceiverCapabilities: Failed to get RDS utility capabilities: err %d", err );
+ }
+ }
+#endif // LOGGING_ENABLED
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/src/cradiordsreceiverbase.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,394 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradiopubsub.h"
+#include "cradiordsreceiverbase.h"
+#include "cradioenginelogger.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRdsReceiverBase::CRadioRdsReceiverBase( MRadioEngineSettings& aSettings )
+ : iSettings( aSettings )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::BaseConstructL()
+ {
+ iPsName = HBufC::NewL( TRdsPSName().MaxLength() );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRdsReceiverBase::~CRadioRdsReceiverBase()
+ {
+ iObservers.Close();
+ delete iPsName;
+ iRadioText.Close();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::AddObserverL( MRadioRdsDataObserver* aObserver )
+ {
+ TInt index = iObservers.FindInAddressOrder( aObserver );
+ if ( index == KErrNotFound )
+ {
+ iObservers.InsertInAddressOrderL( aObserver );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::RemoveObserver( MRadioRdsDataObserver* aObserver )
+ {
+ TInt index = iObservers.FindInAddressOrder( aObserver );
+
+ if ( index >= 0 )
+ {
+ iObservers.Remove( index );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioRdsReceiverBase::AutomaticSwitchingEnabled() const
+ {
+ return iAfEnabled;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC& CRadioRdsReceiverBase::ProgrammeService() const
+ {
+ return *iPsName;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC& CRadioRdsReceiverBase::RadioText() const
+ {
+ return iRadioText;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioRdsReceiverBase::SignalAvailable() const
+ {
+ return iSignalAvailable;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::SetAutomaticSwitchingL( TBool aEnable )
+ {
+ iAfEnabled = aEnable;
+ for ( TInt i = 0 ; i < iObservers.Count(); i++ )
+ {
+ iObservers[i]->RdsAfSearchStateChange( iAfEnabled );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::ClearRdsInformation()
+ {
+ iPsName->Des().Zero();
+ iRadioText.Close();
+
+ if ( iPubSub )
+ {
+ iPubSub->PublishRdsProgramService( *iPsName );
+ }
+
+ MrroRdsEventSignalChange( EFalse );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroStationSeekByPTYComplete( TInt DEBUGVAR( aError ),
+ TInt DEBUGVAR( aFrequency ) )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroStationSeekByPTYComplete: err: %d, frequency: %d ", aError, aFrequency );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroStationSeekByTAComplete( TInt DEBUGVAR( aError ),
+ TInt DEBUGVAR( aFrequency ) )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroStationSeekByTAComplete: err: %d, frequency: %d ", aError, aFrequency );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroStationSeekByTPComplete( TInt DEBUGVAR( aError ),
+ TInt DEBUGVAR( aFrequency ) )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroStationSeekByTPComplete: err: %d, frequency: %d ", aError, aFrequency );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroGetFreqByPTYComplete( TInt DEBUGVAR( aError ),
+ RArray<TInt>& /*aFreqList*/ )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroGetFreqByPTYComplete: err: %d", aError );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroGetFreqByTAComplete( TInt DEBUGVAR( aError ),
+ RArray<TInt>& /*aFreqList*/ )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroGetFreqByTAComplete: err: %d", aError );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroGetPSByPTYComplete( TInt DEBUGVAR( aError ),
+ RArray<TRdsPSName>& /*aPsList*/ )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroGetPSByPTYComplete: err: %d", aError );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroGetPSByTAComplete( TInt DEBUGVAR( aError ),
+ RArray<TRdsPSName>& /*aPsList*/ )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroGetPSByTAComplete: err: %d", aError );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsDataPI( TInt aPi )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsDataPI: PI: %d", aPi );
+ const TInt observerCount = iObservers.Count();
+ const TUint32 frequency = iSettings.TunedFrequency();
+ for ( TInt i = 0; i < observerCount; ++i )
+ {
+ iObservers[i]->RdsDataPiCode( frequency, aPi );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsDataPTY( TRdsProgrammeType aPty )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsDataPTY: PTY: %d", aPty );
+ const TInt observerCount = iObservers.Count();
+ const TUint32 frequency = iSettings.TunedFrequency();
+ for ( TInt i = 0; i < observerCount; ++i )
+ {
+ iObservers[i]->RdsDataGenre( frequency, aPty );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Notifies of the New Programme Service data
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsDataPS( TRdsPSName& aPs )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsDataPS: PS: %S", &aPs );
+ const TUint32 frequency = iSettings.TunedFrequency();
+ if ( iPubSub )
+ {
+ iPubSub->PublishRdsProgramService( aPs );
+ }
+
+ iPsName->Des().Copy( aPs );
+ const TInt observerCount = iObservers.Count();
+ for ( TInt i = 0; i < observerCount; ++i )
+ {
+ iObservers[i]->RdsDataProgrammeService( frequency, *iPsName );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsDataRT( TRdsRadioText& aRt )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsDataRT: RT: %S", &aRt );
+ iRadioText.Close();
+ iRadioText.Create( aRt );
+
+ const TUint32 frequency = iSettings.TunedFrequency();
+ if ( iPubSub )
+ {
+ iPubSub->PublishRdsRadioText( iRadioText );
+ }
+
+ const TInt observerCount = iObservers.Count();
+ for ( TInt i = 0; i < observerCount; ++i )
+ {
+ iObservers[i]->RdsDataRadioText( frequency, iRadioText );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsDataCT( TDateTime& /*aCt*/ )
+ {
+ LOG( "CRadioRdsReceiverBase::MrroRdsDataCT" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsDataTA( TBool DEBUGVAR( aTaOn ) )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsDataTA: aTaOn: %d", aTaOn );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsDataRTplus( TRdsRTplusClass aRtPlusClass,
+ TRdsRadioText& aRtPlusData )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsDataRTplus: Class: %d, data: %S", aRtPlusClass, &aRtPlusData );
+ const TUint32 frequency = iSettings.TunedFrequency();
+ const TInt observerCount = iObservers.Count();
+ for ( TInt i = 0; i < observerCount; ++i )
+ {
+ iObservers[i]->RdsDataRadioTextPlus( frequency, aRtPlusClass, aRtPlusData );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Notifies of the start of Alternate Frequency search
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsSearchBeginAF()
+ {
+ LOG( "CRadioRdsReceiverBase::MrroRdsSearchBeginAF" );
+ const TInt observerCount = iObservers.Count();
+ for ( TInt i = 0; i < observerCount; ++i )
+ {
+ iObservers[i]->RdsAfSearchBegin();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Notifies of the end of Alternate Frequency search
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsSearchEndAF( TInt aError, TInt aFrequency )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsSearchEndAF: err: %d, Frequency: %d", aError, aFrequency );
+ const TInt observerCount = iObservers.Count();
+ for ( TInt i = 0; i < observerCount; ++i )
+ {
+ // Radio utility uses Hz, UI uses kHz. It's ok to divide with 1000, possible lost fractions are useless.
+ iObservers[i]->RdsAfSearchEnd( aFrequency, aError );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsStationChangeTA( TInt DEBUGVAR( aFrequency ) )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsStationChangeTA: Frequency: %d", aFrequency );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsEventAutomaticSwitchingChange( TBool DEBUGVAR( aAuto ) )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsEventAutomaticSwitchingChange: aAuto: %d", aAuto );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsEventAutomaticTrafficAnnouncement( TBool DEBUGVAR( aAuto ) )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsEventAutomaticTrafficAnnouncement: aAuto: %d", aAuto );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverBase::MrroRdsEventSignalChange( TBool aSignal )
+ {
+ LOG_FORMAT( "CRadioRdsReceiverBase::MrroRdsEventSignalChange: aSignal: %d", aSignal );
+ iSignalAvailable = aSignal;
+ const TUint32 frequency = iSettings.TunedFrequency();
+ const TInt observerCount = iObservers.Count();
+ for ( TInt i = 0; i < observerCount; ++i )
+ {
+ iObservers[i]->RdsAvailable( frequency, iSignalAvailable );
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/engine/src/t_cradiordsreceiversimulator.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "t_cradiordsreceiversimulator.h"
+#include "mradioenginesettings.h"
+
+const TInt KVRRdsEventSimulationDelay = 5000000;
+const TUint KItemRelatedTagsCount = 2; //songTitles, artistNames
+const TUint KRadioTextItemsCount = 3;
+const TUint KRtToRtPlusEventTimeout = 400000; // 400 ms
+const TUint KSubsequentRtPlusEventsTimeout = 200; // 0.02 ms
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRdsReceiverSimulator::CRadioRdsReceiverSimulator( MRadioEngineSettings& aSettings )
+ : CRadioRdsReceiverBase( aSettings )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverSimulator::ConstructL()
+ {
+ BaseConstructL();
+ iEventSimulatorTimer = CPeriodic::NewL( CActive::EPriorityUserInput );
+ iEventSimulatorTimer2 = CPeriodic::NewL( CActive::EPriorityUserInput );
+ SetAutomaticSwitchingL( iSettings.RdsAfSearchEnabled() );
+
+ StartReceiver();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRdsReceiverSimulator* CRadioRdsReceiverSimulator::NewL( MRadioEngineSettings& aSettings )
+ {
+ CRadioRdsReceiverSimulator* self = new (ELeave) CRadioRdsReceiverSimulator( aSettings );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRdsReceiverSimulator::~CRadioRdsReceiverSimulator()
+ {
+ if ( iEventSimulatorTimer )
+ {
+ iEventSimulatorTimer->Cancel();
+ }
+ if( iEventSimulatorTimer2 )
+ {
+ iEventSimulatorTimer2->Cancel();
+ }
+ delete iEventSimulatorTimer;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverSimulator::InitL( CRadioUtility& /*aRadioUtility*/, CRadioPubSub* aPubSub )
+ {
+ iPubSub = aPubSub;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverSimulator::StartReceiver()
+ {
+ if ( !iEventSimulatorTimer->IsActive() )
+ {
+ iEventSimulatorTimer->Start( TTimeIntervalMicroSeconds32( KVRRdsEventSimulationDelay ),
+ TTimeIntervalMicroSeconds32( KVRRdsEventSimulationDelay ),
+ TCallBack( StaticRdsSimulationCallback, this ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRdsReceiverSimulator::StopReceiver()
+ {
+ iEventSimulatorTimer->Cancel();
+ iEventSimulatorTimer2->Cancel();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioRdsReceiverSimulator::StaticRdsSimulationCallback( TAny* aSelfPtr )
+ {
+ TRadioRdsSimulationEvent events[] = { ERadioRdsEventSignalOn,
+ //ERadioRdsEventAFBegin,
+ ERadioRdsEventPS,
+ ERadioRdsEventRadioText,
+ //ERadioRdsEventRadioTextPlus,
+ ERadioRdsEventPS,
+ ERadioRdsEventRadioText,
+ //ERadioRdsEventRadioTextPlus,
+ ERadioRdsEventPS,
+ ERadioRdsEventRadioText,
+ //ERadioRdsEventRadioTextPlus,
+ ERadioRdsEventPS,
+ ERadioRdsEventRadioText ,
+ //ERadioRdsEventPS,
+ //ERadioRdsEventAFEnd,
+ ERadioRdsEventSignalOff };
+
+ TRdsPSName serviceNames[] = { _L("Tesla" ), _L("Tesla" ), _L("Tesla" ) };
+ TRdsRadioText radioTexts[] = { _L( "Now playing Madonna Material Girl" ),
+ _L( "Hox! Get Motorhead Ace of Spades from music store now for free!" ),
+ _L( "Abba station-Waterloo Abba station-Waterloo Abba station" ) };
+
+ TInt frequencies[] = { 103100000, 95800000 }; // Frequencies in hz
+ TInt numEvents = sizeof( events ) / sizeof( TRadioRdsSimulationEvent );
+ TInt numServiceNames = sizeof( serviceNames ) / sizeof( TRdsPSName );
+ TInt numFrequencies = sizeof( frequencies ) / sizeof( TInt );
+ // RT ( radioTexts[]) and RT+ ( songTitles[] and artistNames[]) information according to PS names ( serviceNames[]).
+
+ CRadioRdsReceiverSimulator* self = reinterpret_cast<CRadioRdsReceiverSimulator*>( aSelfPtr );
+ if ( self )
+ {
+ switch ( events[self->iEventIterator] )
+ {
+ case ERadioRdsEventSignalOn:
+ {
+ self->MrroRdsEventSignalChange( ETrue );
+ break;
+ }
+
+ case ERadioRdsEventSignalOff:
+ {
+ self->MrroRdsEventSignalChange( EFalse );
+ break;
+ }
+
+ case ERadioRdsEventPS:
+ {
+ // Set RT/RT+ iterator value according to PS name iterator: If ERadioRdsEventRadioText or
+ // ERadioRdsEventRadioTextPlus arrives, displays RT or RT+ according to radio station name.
+ self->iRadioTextIterator = self->iPsIterator;
+ self->MrroRdsDataPS( serviceNames[self->iPsIterator] );
+ self->iPsIterator++;
+ if ( self->iPsIterator >= numServiceNames )
+ {
+ self->iPsIterator = 0;
+ }
+ break;
+ }
+
+ case ERadioRdsEventAFBegin:
+ {
+ if ( self->iSettings.RdsAfSearchEnabled() )
+ {
+ self->MrroRdsSearchBeginAF();
+ }
+ break;
+ }
+
+ case ERadioRdsEventAFEnd:
+ {
+ if ( self->iSettings.RdsAfSearchEnabled() )
+ {
+ self->MrroRdsSearchEndAF( KErrNone, frequencies[self->iFrequencyIterator] );
+ }
+ self->iFrequencyIterator++;
+ if ( self->iFrequencyIterator >= numFrequencies )
+ {
+ self->iFrequencyIterator = 0;
+ }
+ break;
+ }
+ case ERadioRdsEventRadioText:
+ {
+ // Display RT according to PS name.
+ self->MrroRdsDataRT( radioTexts[self->iRadioTextIterator] );
+ // how many times StaticRdsSimulationCallback2 entered
+ if ( self->iRtPlusIterator >= KItemRelatedTagsCount )
+ {
+ self->iRtPlusIterator = 0;
+ }
+
+ // start timer for displaying the two consequent RT+ events
+ self->startRTPlusTimer();
+
+ // how many radio text tags received
+ if( self->iRtIterator >= KRadioTextItemsCount )
+ {
+ self->iRtIterator = 1;
+ }
+ else
+ {
+ self->iRtIterator++;
+ }
+ break;
+ }
+ case ERadioRdsEventRadioTextPlus:
+ {
+ // Display RT+ information according to PS name.
+
+ break;
+ }
+ default:
+ break;
+ }
+ self->iEventIterator++;
+ if ( self->iEventIterator >= numEvents )
+ {
+ self->iEventIterator = 0;
+ }
+ }
+ return KErrNone;
+ }
+
+void CRadioRdsReceiverSimulator::startRTPlusTimer()
+ {
+
+ iEventSimulatorTimer2->Cancel();
+ if ( !iEventSimulatorTimer2->IsActive() )
+ {
+ iEventSimulatorTimer2->Start( TTimeIntervalMicroSeconds32( KRtToRtPlusEventTimeout ),
+ TTimeIntervalMicroSeconds32( KSubsequentRtPlusEventsTimeout ),
+ TCallBack( StaticRdsSimulationCallback2, this ));
+ }
+ }
+
+TInt CRadioRdsReceiverSimulator::StaticRdsSimulationCallback2( TAny* aSelfPtr )
+ {
+ TRdsRadioText songTitles[] = { _L( "Material Girl" ),
+ _L( "Ace of Spades" ),
+ _L( "Waterloo" ) };
+ TRdsRadioText artistNames[] = { _L( "Madonna" ),
+ _L( "Motorhead" ),
+ _L( "Abba" ) };
+
+ CRadioRdsReceiverSimulator* self = reinterpret_cast<CRadioRdsReceiverSimulator*>( aSelfPtr );
+
+ if ( self )
+ {
+ if( self->iRtPlusIterator == 0 )
+ {
+ self->MrroRdsDataRTplus( ERTplusItemTitle, songTitles[self->iRtIterator-1] );
+ }
+ else if( self->iRtPlusIterator == 1 )
+ {
+ self->MrroRdsDataRTplus( ERTplusItemArtist, artistNames[self->iRtIterator-1] );
+ }
+ }
+ self->iRtPlusIterator++;
+
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/group/bld.inf Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "../utils/group/bld.inf"
+#include "../settings/group/bld.inf"
+#include "../engine/group/bld.inf"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/group/buildflags.hrh Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef BUILDFLAGS_HRH_
+#define BUILDFLAGS_HRH_
+
+#ifdef __WINS__
+//# define __FEATURE_RDS_SIMULATOR
+#endif
+
+//TODO: Remove this flagging.
+//#define COMPILE_IN_IVALO
+
+#endif // BUILDFLAGS_HRH_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/api/cradioregion.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIOREGION_H
+#define CRADIOREGION_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+#include "radioengine.hrh"
+
+// FORWARD DECLARATIONS
+class CRadioRegion;
+class TResourceReader;
+
+// DATA TYPES
+typedef RPointerArray<CRadioRegion> RRadioRegionArray;
+typedef RPointerArray<HBufC16> RRadioCountryCodeArray;
+
+// CLASS DECLARATION
+
+/**
+* Class CRadioRegion provides information about FM region
+*/
+NONSHARABLE_CLASS( CRadioRegion ) : public CBase
+ {
+public:
+
+ static CRadioRegion* NewL( TResourceReader& aRr );
+
+ ~CRadioRegion();
+
+// New methods
+
+ /**
+ * Id Get the id of region
+ * @return id of region
+ */
+ IMPORT_C TRadioRegion Id() const;
+
+ /**
+ * StepSize Get the step interval of region
+ * @return Step size
+ */
+ IMPORT_C TUint32 StepSize() const;
+
+ /**
+ * Get the minimum frequency of region
+ * @return Minimum frequency
+ */
+ IMPORT_C TUint32 MinFrequency() const;
+
+ /**
+ * Get the maximum frequency of region
+ * @return Maximum frequency
+ */
+ IMPORT_C TUint32 MaxFrequency() const;
+
+ /**
+ * Get the decimal count of region.
+ * @return Decimal count.
+ */
+ IMPORT_C TInt DecimalCount() const;
+
+ /**
+ * CountryCode Get the country code of region
+ * @return Country code, or empty descriptor if country code doesn't exist
+ */
+ IMPORT_C const RRadioCountryCodeArray& CountryCodes();
+
+ /**
+ * Name Get the name of region
+ * @return Name of region
+ */
+ IMPORT_C const TDesC16& Name() const;
+
+ /**
+ * SettingItemName Get the name of region for setting item
+ * @return Name of region
+ */
+ IMPORT_C const TDesC16& SettingItemName() const;
+
+private:
+
+ CRadioRegion();
+
+ void ConstructL( TResourceReader& aRr );
+
+private: // data
+
+ /** Id of the region*/
+ TRadioRegion iId;
+ /** Step interval*/
+ TUint16 iStepSize;
+ /** Min frequency */
+ TUint32 iMinFreq;
+ /** Max frequency */
+ TUint32 iMaxFreq;
+ /** Decimal count */
+ TInt iDecimalCount;
+ /** Country code*/
+ RRadioCountryCodeArray iCountryCodes;
+ /** Region name*/
+ HBufC* iName;
+ /** Region name for setting item*/
+ HBufC* iSettingName;
+
+ };
+
+#endif // CRADIOREGION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/api/cradiosettings.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOSETTINGS_H
+#define C_RADIOSETTINGS_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include "radioengine.hrh"
+
+// Forward declarations
+class CCoeEnv;
+class MRadioApplicationSettings;
+class MRadioEngineSettings;
+class MRadioSettingsSetter;
+class CRadioRepositoryManager;
+class MRadioPresetSettings;
+class RFs;
+
+/**
+ * Manages persistent application settings.
+ *
+ * Exposes access to the underlying settings implementations.
+ */
+NONSHARABLE_CLASS( CRadioSettings ) : public CBase
+ {
+
+public:
+
+ IMPORT_C static CRadioSettings* NewL( CCoeEnv* aCoeEnv = NULL );
+
+ IMPORT_C virtual ~CRadioSettings();
+
+ /**
+ * Determines if region is allowed.
+ */
+ virtual TBool IsRegionAllowed( TRadioRegion aRegionId ) const = 0;
+
+ /**
+ * Returns the implemented application settings interface.
+ *
+ * @return The implemented application settings interface.
+ */
+ virtual MRadioApplicationSettings& ApplicationSettings() const = 0;
+
+ /**
+ * Returns the implemented radio settings interface.
+ *
+ * @return The implemented radio settings interface.
+ */
+ virtual MRadioEngineSettings& EngineSettings() const = 0;
+
+ /**
+ * Returns the implemented radio settings interface.
+ *
+ * @return The implemented setter interface for radio settings.
+ */
+ virtual MRadioSettingsSetter& RadioSetter() const = 0;
+
+ /**
+ * Returns the repository manager.
+ *
+ * @return The repository manager.
+ */
+ virtual CRadioRepositoryManager& Repository() const = 0;
+
+ /**
+ * Resolves the most recently updated location for a file.
+ *
+ * @param aFileName The file name to be searched.
+ * On return, will contain the full path to the file.
+ * @param aPath The absolute path to the file. If drive letter is
+ * given then that one will be first tried.
+ */
+ virtual void ResolveDriveL( TFileName& aFileName, const TDesC& aPath ) = 0;
+
+ };
+
+#endif // C_RADIOSETTINGS_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/api/mradioapplicationsettings.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef M_RADIOAPPLICATIONSETTINGS_H
+#define M_RADIOAPPLICATIONSETTINGS_H
+
+#include <badesca.h>
+
+/**
+ * MRadioApplicationSettings
+ *
+ * Interface for managing persistent Visual Radio application settings.
+ */
+NONSHARABLE_CLASS( MRadioApplicationSettings )
+ {
+
+public:
+
+ /**
+ * Possible states for audio playing state.
+ * Once the state reaches ´played´, it doesn't change.
+ */
+ enum TRadioCRAudioPlayHistory
+ {
+ ERadioCRInitial,
+ ERadioCRAudioTriggered,
+ ERadioCRAudioPlayed
+ };
+
+public:
+
+ /**
+ * Stores the currently active preset in the preset list.
+ *
+ * @param aIndex The list box index of the preset that is
+ * currently active.
+ */
+ virtual TInt SetActiveFocusLocation( TInt aIndex ) = 0;
+
+ /**
+ * Retrieves the list box index of the currently active preset.
+ * By default, the first preset is active.
+ *
+ * @return The list box index of the currently active preset.
+ */
+ virtual TInt ActiveFocusLocation() const = 0;
+
+ /**
+ * Stores the audio history telling whether the audio has been
+ * played ( so that user has triggered it ).
+ *
+ * Once the history reaches state 'played', it does not change.
+ *
+ * @param aHistory The audio history.
+ */
+ virtual void SetAudioPlayHistoryL( TRadioCRAudioPlayHistory aHistory ) = 0;
+
+ /**
+ * Retrieves the current audio play history.
+ *
+ * @return The current audio play history.
+ */
+ virtual TRadioCRAudioPlayHistory AudioPlayHistory() const = 0;
+
+ virtual TInt UpdateStartCount() = 0;
+
+ virtual TInt SetUiFlags( TUint aUiFlags ) = 0;
+
+ virtual TUint UiFlags() const = 0;
+
+ };
+
+#endif // M_RADIOAPPLICATIONSETTINGS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/api/mradioenginesettings.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef M_RADIOSETTINGS_H
+#define M_RADIOSETTINGS_H
+
+#include <e32def.h>
+
+#include "radioengine.hrh"
+
+class CRadioRegion;
+
+/**
+ * Interface for managing persistent Visual Radio application FM radio specific settings.
+ */
+NONSHARABLE_CLASS( MRadioEngineSettings )
+ {
+
+public:
+
+ /**
+ * Retrieves the radio volume level that is used when audio is routed through the headset.
+ *
+ * @return The radio volume level.
+ */
+ virtual TInt HeadsetVolume() const = 0;
+
+ /**
+ * Retrieves the radio volume level that is used when audio is routed through the speaker.
+ *
+ * @return The radio volume level.
+ */
+ virtual TInt SpeakerVolume() const = 0;
+
+ /**
+ * Wrapper for retrieving the radio volume level of current output device
+ *
+ * @return The radio volume level.
+ */
+ virtual TInt Volume() const = 0;
+
+ /**
+ * Retrieves the radio output mode currently in use.
+ *
+ * @return The radio output mode currently in use.
+ */
+ virtual TInt OutputMode() const = 0;
+
+ /**
+ * Retrieves the radio audio route in use.
+ *
+ * @return The radio audio route in use.
+ */
+ virtual TInt AudioRoute() const = 0;
+
+ /**
+ * Retrieves the muting state of radio when audio is routed through the headset.
+ *
+ * @return <code>ETrue</code> if radio audio is muted when routed through the headset, <code>EFalse</code> otherwise.
+ */
+ virtual TBool IsHeadsetVolMuted() const = 0;
+
+ /**
+ * Retrieves the muting state of radio when audio is routed through the speaker.
+ *
+ * @return <code>ETrue</code> if radio audio is muted when routed through the speaker, <code>EFalse</code> otherwise.
+ */
+ virtual TBool IsSpeakerVolMuted() const = 0;
+
+ /**
+ * Wrapper for retrieving the muting state of current output device
+ *
+ * @return <code>ETrue</code> if radio audio is muted, <code>EFalse</code> otherwise.
+ */
+ virtual TBool IsVolMuted() const = 0;
+
+ /**
+ * Retrieves the power state of the radio.
+ *
+ * @return <code>ETrue</code> if the radio is powered on, <code>EFalse</code> otherwise.
+ */
+ virtual TBool IsPowerOn() const = 0;
+
+ /**
+ * Retrieves the currently tuned frequency.
+ *
+ * @return The currently tuned frequency.
+ */
+ virtual TUint32 TunedFrequency() const = 0;
+
+ /**
+ * Retrieves the default minimum volume level.
+ *
+ * @return The default minimum volume level.
+ */
+ virtual TInt DefaultMinVolumeLevel() const = 0;
+
+ /**
+ * Retrieves the number of regions defined.
+ *
+ * @return The number of regions defined.
+ */
+ virtual TInt CountRegions() const = 0;
+
+ /**
+ * Retrieves a region matching the supplied index.
+ *
+ * @param aIndex The index of the region.
+ * @return The region matching the supplied index.
+ */
+ virtual CRadioRegion& Region( TInt aIndex ) const = 0;
+
+ /**
+ * Retrieves the current region's ID.
+ *
+ * @return The region's ID.
+ */
+ virtual TRadioRegion RegionId() const = 0;
+
+ /**
+ * Retrieves the frequency step size for the current region.
+ *
+ * @return The frequency step size for the current region.
+ */
+ virtual TUint32 FrequencyStepSize() const = 0;
+
+ /**
+ * Retrieves the maximum frequency for the current region.
+ * If region switching is ongoing, this might be zero.
+ *
+ * @return The maximum freqency for the current region.
+ */
+ virtual TUint32 MaxFrequency() const = 0;
+
+ /**
+ * Retrieves the minimum frequency for the current region.
+ * If region switching is ongoing, this might be zero.
+ *
+ * @return The minimum freqency for the current region.
+ */
+ virtual TUint32 MinFrequency() const = 0;
+
+ /**
+ * Retrieves the frequency decimal count of the current region.
+ *
+ * @return Decimal count.
+ */
+ virtual TInt DecimalCount() const = 0;
+
+ /**
+ * Retrieves the RDS alternate frequency search setting
+ *
+ * @return ETrue if AF search is enabled, otherwise EFalse
+ */
+ virtual TBool RdsAfSearchEnabled() const = 0;
+
+ /**
+ * Retrieves the default region's ID.
+ *
+ * @return The region's ID.
+ */
+ virtual TRadioRegion DefaultRegion() const = 0;
+
+ /**
+ *
+ */
+ virtual TPtrC NetworkId() const = 0;
+
+ /**
+ *
+ */
+ virtual TPtrC SubscriberId() const = 0;
+
+ /**
+ *
+ */
+ virtual TPtrC CountryCode() const = 0;
+
+ };
+
+#endif // M_RADIOSETTINGS_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/api/mradiosettingsobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef M_RADIOSETTINGSOBSERVER_H
+#define M_RADIOSETTINGSOBSERVER_H
+
+
+/**
+ * Interface for observing some radio related settings.
+ * This interface is intended for the use of radio to update it's internal state
+ * to conform to newly changed setting
+ */
+NONSHARABLE_CLASS( MRadioSettingsObserver )
+ {
+public:
+
+ /**
+ * Notifies of the change in RDS alternate frequency setting
+ *
+ * @param aEnabled ETrue if AF search is enabled, otherwise EFalse
+ */
+ virtual void RdsAfSearchSettingChangedL( TBool aEnabled ) = 0;
+
+ /**
+ * Notifies of the change in region setting when it is changed
+ * outside of the particular radio settings instance
+ *
+ * @param aRegion The new region ID
+ */
+ virtual void RegionSettingChangedL( TInt aRegion ) = 0;
+
+ };
+
+#endif // M_RADIOSETTINGSOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/api/mradiosettingssetter.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef M_RADIOSETTINGSSETTERS_H
+#define M_RADIOSETTINGSSETTERS_H
+
+#include "mradioenginesettings.h"
+
+class MRadioSettingsObserver;
+
+/**
+ * Setter interface for radio settings. This should be accessible only for CRadioEngineImp
+ */
+NONSHARABLE_CLASS( MRadioSettingsSetter ) : public MRadioEngineSettings
+ {
+public:
+
+ /**
+ * Sets observer for the radio settings
+ *
+ * @param aObserver The observer
+ */
+ virtual void SetObserver( MRadioSettingsObserver* aObserver ) = 0;
+
+ /**
+ * Stores the radio volume level that is used when audio is routed through the headset.
+ *
+ * @param aVolume The radio volume level to store.
+ *
+ */
+ virtual TInt SetHeadsetVolume( TInt aVolume ) = 0;
+
+ /**
+ * Stores the radio volume level that is used when audio is routed through the speaker.
+ *
+ * @param aVolume The radio volume level.
+ */
+ virtual TInt SetSpeakerVolume( TInt aVolume ) = 0;
+
+ /**
+ * Wrapper for storing the radio volume level of current output device
+ *
+ * @param aVolume The radio volume level.
+ */
+ virtual TInt SetVolume( TInt aVolume ) = 0;
+
+ /**
+ * Stores the radio output mode to use.
+ *
+ * @param aOutputMode The radio output mode to use.
+ */
+ virtual TInt SetOutputMode( TInt aOutputMode ) = 0;
+
+ /**
+ * Stores the radio audio route ( headset/ihf ) to use.
+ *
+ * @param aAudioRoute The radio output destination to use.
+ */
+ virtual TInt SetAudioRoute( TInt aAudioRoute ) = 0;
+
+ /**
+ * Stores the radio muting state when audio is routed through the headset.
+ *
+ * @param aMuted <code>ETrue</code> if radio is to be muted when routed through the headset, <code>EFalse</code> otherwise.
+ */
+ virtual TInt SetHeadsetVolMuted( TBool aMuted ) = 0;
+
+ /**
+ * Stores the radio muting state when audio is routed through the speaker.
+ *
+ * @param aMuted <code>ETrue</code> if radio is to be muted when routed through the speaker, <code>EFalse</code> otherwise.
+ */
+ virtual TInt SetSpeakerVolMuted( TBool aMuted ) = 0;
+
+ /**
+ * Wrapper for storing the radio muting state of current output device
+ *
+ * @param aMuted <code>ETrue</code> if radio is to be muted, <code>EFalse</code> otherwise.
+ */
+ virtual TInt SetVolMuted( TBool aMuted ) = 0;
+
+ /**
+ * Stores the power state of the radio.
+ *
+ * @param aPowerState <code>ETrue</code> if radio is powered on, <code>EFalse</code> otherwise.
+ */
+ virtual TInt SetPowerOn( TBool aPowerState ) = 0;
+
+ /**
+ * Stores the frequency tuned.
+ *
+ * @param aFrequency The frequency to store.
+ */
+ virtual TInt SetTunedFrequency( TUint32 aFrequency ) = 0;
+
+ /**
+ * Stores the region ID currently in use.
+ *
+ * @param aRegion The region's ID to store.
+ */
+ virtual TInt SetRegionId( TInt aRegion ) = 0;
+
+ /**
+ * Stores the RDS alternate frequency search setting
+ *
+ * @param aEnabled ETrue if search is enabled, otherwise EFalse
+ */
+ virtual TInt SetRdsAfSearch( TBool aEnabled ) = 0;
+
+ /**
+ *
+ */
+ virtual TInt SetNetworkId( const TDesC& aNetworkId ) = 0;
+
+ /**
+ *
+ */
+ virtual TInt SetSubscriberId( const TDesC& aSubscriberId ) = 0;
+
+ /**
+ *
+ */
+ virtual TInt SetCountryCode( const TDesC& aCountryCode ) = 0;
+
+ };
+
+#endif // M_RADIOSETTINGSSETTERS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/bwins/radioenginesettingsu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,12 @@
+EXPORTS
+ ??1CRadioSettings@@UAE@XZ @ 1 NONAME ; CRadioSettings::~CRadioSettings(void)
+ ?CountryCodes@CRadioRegion@@QAEABV?$RPointerArray@VHBufC16@@@@XZ @ 2 NONAME ; class RPointerArray<class HBufC16> const & CRadioRegion::CountryCodes(void)
+ ?DecimalCount@CRadioRegion@@QBEHXZ @ 3 NONAME ; int CRadioRegion::DecimalCount(void) const
+ ?Id@CRadioRegion@@QBE?AW4TRadioRegion@@XZ @ 4 NONAME ; enum TRadioRegion CRadioRegion::Id(void) const
+ ?MaxFrequency@CRadioRegion@@QBEKXZ @ 5 NONAME ; unsigned long CRadioRegion::MaxFrequency(void) const
+ ?MinFrequency@CRadioRegion@@QBEKXZ @ 6 NONAME ; unsigned long CRadioRegion::MinFrequency(void) const
+ ?Name@CRadioRegion@@QBEABVTDesC16@@XZ @ 7 NONAME ; class TDesC16 const & CRadioRegion::Name(void) const
+ ?NewL@CRadioSettings@@SAPAV1@PAVCCoeEnv@@@Z @ 8 NONAME ; class CRadioSettings * CRadioSettings::NewL(class CCoeEnv *)
+ ?SettingItemName@CRadioRegion@@QBEABVTDesC16@@XZ @ 9 NONAME ; class TDesC16 const & CRadioRegion::SettingItemName(void) const
+ ?StepSize@CRadioRegion@@QBEKXZ @ 10 NONAME ; unsigned long CRadioRegion::StepSize(void) const
+
Binary file radioengine/settings/cenrep/101FF976.txt has changed
Binary file radioengine/settings/cenrep/keys_radioengine.xls has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/data/radioenginesettings.rss Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// Resource identifier
+NAME QRST
+
+// System includes
+#include <uikon.rh>
+
+#include "radiosettings.rh"
+#include "radiopreset.hrh"
+#include "radioengine.hrh"
+
+// Resource definitions
+
+// ---------------------------------------------------------
+// Resource signature
+// ---------------------------------------------------------
+//
+
+RESOURCE RSS_SIGNATURE { }
+
+// Non-operator customisable settings
+
+// ---------------------------------------------------------
+// r_qrad_empty_name_preset
+// TBUF16 stores the string name for the empty "Empty"
+// ---------------------------------------------------------
+//
+RESOURCE TBUF256 r_qrad_empty_name_preset
+{
+ buf = qtn_radio_ch_empty;
+}
+
+// ---------------------------------------------------------
+// r_qrad_predefined_presets
+// Predefined presets list. No need to include empty presets -- they'll get autogenerated!
+// ---------------------------------------------------------
+//
+// The following array must coexist as the VERY LAST Resource IN THIS FILE, to maintain BC!
+RESOURCE RADIOPRESET r_qrad_empty_presets
+{
+ name = "";
+ freq_kHz = 0;
+ serviceid = "";
+ radio_preset_type = ERadioPresetItemEmpty;
+ radio_preset_location = "";
+}
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+STRUCT RADIO_REGION
+ {
+ WORD id;
+ WORD stepsize;
+ LONG minfrequency;
+ LONG maxfrequency;
+ WORD decimalcount;
+ LTEXT countrycodes[] = {""};
+ LTEXT regionname;
+ LTEXT regionsettingname;
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+STRUCT RADIO_REGION_ARRAY
+ {
+ LLINK regions[];
+ }
+
+// ---------------------------------------------------------
+// r_qrad_regions
+// Array of the supported regions
+// ---------------------------------------------------------
+//
+RESOURCE RADIO_REGION_ARRAY r_qrad_regions
+ {
+ regions =
+ {
+ r_qrad_region_japan,
+ r_qrad_region_america,
+ r_qrad_region_default
+ };
+ }
+
+// ---------------------------------------------------------
+// r_qrad_region_japan
+// Region settings for Japan
+// Check country codes from:
+// "COMPLEMENT TO ITU-T RECOMMENDATION E.212, LIST OF MOBILE COUNTRY OR GEOGRAPHICAL AREA CODES"
+// ---------------------------------------------------------
+//
+RESOURCE RADIO_REGION r_qrad_region_japan
+ {
+ id = ERadioRegionJapan;
+ stepsize = 100;
+ minfrequency = 76000;
+ maxfrequency = 90000;
+ decimalcount = 1;
+ countrycodes =
+ {
+ "440",
+ "441"
+ };
+ regionname = qtn_vr_reg_japan;
+ regionsettingname = qtn_vr_set_reg_japan;
+ }
+
+// ---------------------------------------------------------
+// r_qrad_region_america
+// Region settings for America
+// "COMPLEMENT TO ITU-T RECOMMENDATION E.212, LIST OF MOBILE COUNTRY OR GEOGRAPHICAL AREA CODES"
+// ---------------------------------------------------------
+//
+RESOURCE RADIO_REGION r_qrad_region_america
+ {
+ id = ERadioRegionAmerica;
+ stepsize = 200;
+ minfrequency = 88100;
+ maxfrequency = 107900;
+ decimalcount = 1;
+ countrycodes =
+ {
+ "302", // Canada
+ "310", // USA
+ "311", // USA
+ "312", // USA
+ "313", // USA
+ "314", // USA
+ "315", // USA
+ "316", // USA
+ "332", // United States Virgin Islands
+ "334", // Mexico
+ "338", // Jamaica
+ "342", // Barbados
+ "344", // Antigua and Barbuda
+ "352", // Grenada
+ "360", // Saint Vincent and the Grenadines
+ "364", // Bahamas
+ "366", // Common Wealth of Dominica
+ "370", // Dominican Republic
+ "372", // Haiti
+ "374", // Trinidad and Tobago
+ "368", // Cuba
+ "702", // Belize
+ "704", // Guatemala
+ "706", // El Salvador
+ "708", // Honduras
+ "710", // Nicaragua
+ "712", // Costa Rica
+ "714", // Panama
+ "716", // Peru
+ "722", // Argentina
+ "724", // Brazil
+ "730", // Chile
+ "732", // Colombia
+ "734", // Venezuela
+ "736", // Bolivia
+ "738", // Guyana
+ "740", // Ecuador
+ "744", // Paraguay
+ "746", // Suriname
+ "748" // Uruguay
+ };
+ regionname = qtn_vr_reg_america;
+ regionsettingname = qtn_vr_set_reg_america;
+ }
+
+// ---------------------------------------------------------
+// r_qrad_region_default
+// Region settings for default region
+// ---------------------------------------------------------
+//
+RESOURCE RADIO_REGION r_qrad_region_default
+ {
+ id = ERadioRegionDefault;
+ stepsize = 50;
+ minfrequency = 87500;
+ maxfrequency = 108000;
+ decimalcount = 2;
+ regionname = qtn_vr_reg_other;
+ regionsettingname = qtn_vr_set_reg_other;
+ }
+
+// ---------------------------------------------------------
+// r_qtn_qrad_folder_radio_presets
+// TBUF32 stores the string for presets folder name
+// String lenght must be 30 characters
+// ---------------------------------------------------------
+//
+RESOURCE TBUF32 r_qtn_qrad_folder_radio_presets
+ {
+ buf = qtn_vr_folder_radio_presets;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/eabi/radioenginesettingsu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,14 @@
+EXPORTS
+ _ZN12CRadioRegion12CountryCodesEv @ 1 NONAME
+ _ZN14CRadioSettings4NewLEP7CCoeEnv @ 2 NONAME
+ _ZN14CRadioSettingsD0Ev @ 3 NONAME
+ _ZN14CRadioSettingsD1Ev @ 4 NONAME
+ _ZN14CRadioSettingsD2Ev @ 5 NONAME
+ _ZNK12CRadioRegion12DecimalCountEv @ 6 NONAME
+ _ZNK12CRadioRegion12MaxFrequencyEv @ 7 NONAME
+ _ZNK12CRadioRegion12MinFrequencyEv @ 8 NONAME
+ _ZNK12CRadioRegion15SettingItemNameEv @ 9 NONAME
+ _ZNK12CRadioRegion2IdEv @ 10 NONAME
+ _ZNK12CRadioRegion4NameEv @ 11 NONAME
+ _ZNK12CRadioRegion8StepSizeEv @ 12 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/group/backup_registration.xml Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration version="1.0">
+ <passive_backup>
+ </passive_backup>
+ <proxy_data_manager sid="0x10202BE9"/>
+ <restore requires_reboot = "no"/>
+</backup_registration>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/group/bld.inf Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "../../group/buildflags.hrh"
+
+#ifdef COMPILE_IN_WK48_ENV
+# include <domain/osextensions/platform_paths.hrh>
+#else
+# include <platform_paths.hrh>
+#endif // COMPILE_IN_WK48_ENV
+
+PRJ_PLATFORMS
+WINSCW ARMV5
+
+PRJ_EXPORTS
+//../include/vrinternalpskeys.h internal/vrinternalpskeys.h
+//../include/vrinternalcrkeys.h internal/vrinternalcrkeys.h
+
+//../sis/visualradiostub.sis /epoc32/data/z/system/install/visualradio.sis
+backup_registration.xml /epoc32/data/z/private/101ff976/backup_registration.xml
+
+../cenrep/101FF976.txt /epoc32/data/z/private/10202be9/101FF976.txt
+../cenrep/101FF976.txt /epoc32/RELEASE/winscw/UDEB/Z/private/10202be9/101FF976.txt
+../cenrep/101FF976.txt /epoc32/RELEASE/winscw/UREL/Z/private/10202be9/101FF976.txt
+
+PRJ_MMPFILES
+radioenginesettings.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/group/radioenginesettings.mmp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "../../group/buildflags.hrh"
+
+#ifdef COMPILE_IN_WK48_ENV
+# include <domain/osextensions/platform_paths.hrh>
+#else
+# include <platform_paths.hrh>
+#endif // COMPILE_IN_WK48_ENV
+
+#include <data_caging_paths.hrh>
+
+#include <data_caging_paths.hrh>
+
+TARGET radioenginesettings.dll
+TARGETTYPE DLL
+UID 0x1000008D 0x101FF94C
+VERSION 10.0
+
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+PAGED
+//LANGUAGE_IDS
+LANG SC
+
+SOURCEPATH ../data
+START RESOURCE radioenginesettings.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+END // RESOURCE
+
+USERINCLUDE ../api
+USERINCLUDE ../inc
+USERINCLUDE ../../utils/api
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH ../src
+SOURCE cradioregion.cpp
+SOURCE cradiosettings.cpp
+SOURCE cradiosettingsimp.cpp
+SOURCE cradiosettingsbase.cpp
+SOURCE cradioenginesettings.cpp
+SOURCE cradioapplicationsettings.cpp
+
+LIBRARY radioengineutils.lib
+LIBRARY bafl.lib
+LIBRARY commonengine.lib
+LIBRARY cone.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+LIBRARY euser.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/inc/cradioapplicationsettings.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOAPPLICATIONSETTINGS_H
+#define C_RADIOAPPLICATIONSETTINGS_H
+
+#include "mradioapplicationsettings.h"
+#include "cradiosettingsbase.h"
+
+/**
+ * Concrete implementation of application settings.
+ */
+NONSHARABLE_CLASS( CRadioApplicationSettings ) : public CRadioSettingsBase
+ , public MRadioApplicationSettings
+ {
+
+public:
+
+ static CRadioApplicationSettings* NewL( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv );
+
+ ~CRadioApplicationSettings();
+
+// from base class MRadioApplicationSettings
+
+ TInt SetActiveFocusLocation( TInt aIndex );
+ TInt ActiveFocusLocation() const;
+ void SetAudioPlayHistoryL( TRadioCRAudioPlayHistory aHistory );
+ TRadioCRAudioPlayHistory AudioPlayHistory() const;
+ TInt UpdateStartCount();
+ TInt SetUiFlags( TUint aUiFlags );
+ TUint UiFlags() const;
+
+private:
+
+ CRadioApplicationSettings( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv );
+
+ void ConstructL();
+
+ };
+
+#endif // C_RADIOAPPLICATIONSETTINGS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/inc/cradioenginesettings.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOENGINESETTINGS_H
+#define C_RADIOENGINESETTINGS_H
+
+#include "mradioenginesettings.h"
+#include "mradiosettingssetter.h"
+#include "cradioregion.h"
+#include "mradiorepositoryentityobserver.h"
+#include "cradiosettingsbase.h"
+
+class MRadioSettingsObserver;
+
+/**
+ * Concrete implementation of radio settings.
+ */
+NONSHARABLE_CLASS( CRadioEngineSettings ) : public CRadioSettingsBase
+ , public MRadioSettingsSetter
+ , public MRadioRepositoryEntityObserver
+ {
+
+public:
+
+ static CRadioEngineSettings* NewL( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv );
+
+ ~CRadioEngineSettings();
+
+ /**
+ * Determines if region is allowed.
+ */
+ TBool IsRegionAllowed( TRadioRegion aRegionId ) const;
+
+private:
+
+ CRadioEngineSettings( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv );
+
+ void ConstructL();
+
+// from base class MRadioEngineSettings
+
+ TInt HeadsetVolume() const;
+ TInt SpeakerVolume() const;
+ TInt Volume() const;
+ TInt OutputMode() const;
+ TInt AudioRoute() const;
+ TBool IsHeadsetVolMuted() const;
+ TBool IsSpeakerVolMuted() const;
+ TBool IsVolMuted() const;
+ TBool IsPowerOn() const;
+ TUint32 TunedFrequency() const;
+ TInt DefaultMinVolumeLevel() const;
+ TInt CountRegions() const;
+ CRadioRegion& Region( TInt aIndex ) const;
+ TRadioRegion RegionId() const;
+ TUint32 FrequencyStepSize() const;
+ TUint32 MaxFrequency() const;
+ TUint32 MinFrequency() const;
+ TInt DecimalCount() const;
+ TBool RdsAfSearchEnabled() const;
+ TRadioRegion DefaultRegion() const;
+ TPtrC NetworkId() const;
+ TPtrC SubscriberId() const;
+ TPtrC CountryCode() const;
+
+// from base class MRadioSettingsSetter
+
+ void SetObserver( MRadioSettingsObserver* aObserver );
+ TInt SetHeadsetVolume( TInt aVolume );
+ TInt SetSpeakerVolume( TInt aVolume );
+ TInt SetVolume( TInt aVolume );
+ TInt SetOutputMode( TInt aOutputMode );
+ TInt SetAudioRoute( TInt aAudioRoute );
+ TInt SetHeadsetVolMuted( TBool aMuted );
+ TInt SetSpeakerVolMuted( TBool aMuted );
+ TInt SetVolMuted( TBool aMuted );
+ TInt SetPowerOn( TBool aPowerState );
+ TInt SetTunedFrequency( TUint32 aFrequency );
+ TInt SetRegionId( TInt aRegion );
+ TInt SetRdsAfSearch( TBool aEnabled );
+ TInt SetNetworkId( const TDesC& aNetworkId );
+ TInt SetSubscriberId( const TDesC& aSubscriberId );
+ TInt SetCountryCode( const TDesC& aCountryCode );
+
+// from base class MRadioRepositoryEntityObserver
+
+ void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError );
+ void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TReal& /*aValue*/, TInt /*aError*/ ) {}
+ void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC8& /*aValue*/, TInt /*aError*/ ) {}
+ void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC16& /*aValue*/, TInt /*aError*/ ) {}
+
+// New functions
+
+ /**
+ * Initializes the regions as defined in the resource file.
+ */
+ void InitializeRegionsL();
+
+ /**
+ * Converts Region ID to index
+ *
+ * @param aRegionId The region ID that is wanted to convert
+ * @return The region index, KErrNotFound if no match found
+ */
+ TInt RegionIndexForId( TInt aRegionId ) const;
+
+ /**
+ * Updates the current region index
+ *
+ * @param aRegionId The new region ID
+ */
+ void UpdateCurrentRegionIdx( TInt aRegionId );
+
+private: // data
+
+ /**
+ * The observer for the setting changes.
+ * Not own.
+ */
+ MRadioSettingsObserver* iObserver;
+
+ /**
+ * The available regions.
+ */
+ RRadioRegionArray iRegions;
+
+ /**
+ * The current region.
+ */
+ TInt iCurrentRegionIdx;
+
+ };
+
+#endif // C_RADIOENGINESETTINGS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/inc/cradiosettingsbase.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOSETTINGSBASE_H
+#define C_RADIOSETTINGSBASE_H
+
+#include <badesca.h>
+#include <e32base.h>
+
+class CCoeEnv;
+class CRadioRepositoryManager;
+
+/**
+ * Base class for all settings implementations.
+ *
+ * Provides commonly used data members and methods.
+ */
+NONSHARABLE_CLASS( CRadioSettingsBase ) : public CBase
+ {
+
+public:
+
+ ~CRadioSettingsBase();
+
+protected:
+
+ CRadioSettingsBase( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv );
+
+ /**
+ * Writes an array to the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key to which to write the array.
+ * @param aArray The array to write.
+ */
+ void WriteArrayEntityL( const TUid& aUid, TUint32 aKey, const CDesCArray& aArray );
+
+ /**
+ * Reads an array from the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key to which to write the array.
+ * @return The array that was read. Ownership is transferred to the caller.
+ */
+ CDesCArray* ReadArrayEntityL( const TUid& aUid, TUint32 aKey ) const;
+
+protected:
+
+ /**
+ * The control environment.
+ */
+ CCoeEnv& iCoeEnv;
+
+ /**
+ * The repository manager.
+ */
+ CRadioRepositoryManager& iRepositoryManager;
+
+ };
+
+#endif // C_RADIOSETTINGSBASE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/inc/cradiosettingsimp.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOSETTINGSIMP_H
+#define C_RADIOSETTINGSIMP_H
+
+// User includes
+#include "cradiosettings.h"
+
+// Forward declarations
+class CCoeEnv;
+class CRadioApplicationSettings;
+class CRadioEngineSettings;
+class CRadioRepositoryManager;
+class RConeResourceLoader;
+
+/**
+ * Manages persistent application settings.
+ *
+ * Exposes access to the underlying settings implementations.
+ */
+NONSHARABLE_CLASS( CRadioSettingsImp ) : public CRadioSettings
+ {
+
+public:
+
+ static CRadioSettingsImp* NewL( CCoeEnv* aCoeEnv = NULL );
+
+ ~CRadioSettingsImp();
+
+// from base class CRadioSettings
+
+ TBool IsRegionAllowed( TRadioRegion aRegionId ) const;
+ MRadioApplicationSettings& ApplicationSettings() const;
+ MRadioEngineSettings& EngineSettings() const;
+ MRadioSettingsSetter& RadioSetter() const;
+ CRadioRepositoryManager& Repository() const;
+ void ResolveDriveL( TFileName& aFileName, const TDesC& aPath );
+
+private:
+
+ CRadioSettingsImp();
+
+ void ConstructL( CCoeEnv* aCoeEnv );
+
+ /**
+ * Loads the resources required by the settings.
+ */
+ void LoadResourcesL();
+
+private: // data
+
+ /**
+ * The central repository manager.
+ * Own.
+ */
+ CRadioRepositoryManager* iRepositoryManager;
+
+ /**
+ * Resource loader for the settings resources.
+ * Own.
+ */
+ RConeResourceLoader* iResourceLoader;
+
+ /**
+ * Implementation of the application settings.
+ * Own
+ */
+ CRadioApplicationSettings* iApplicationSettings;
+
+ /**
+ * Implementation of the radio settings.
+ * Own
+ */
+ CRadioEngineSettings* iEngineSettings;
+
+ };
+
+#endif // C_RADIOSETTINGSIMP_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/inc/radiopreset.hrh Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOPRESET_HRH
+#define RADIOPRESET_HRH
+
+#define KVRDefaultPresetFolder 0
+
+/**
+ * Preset types.
+ */
+enum TRadioPresetType
+ {
+ ERadioPresetItemEmpty = 0, /**< The preset item is empty, i.e. not initialized yet. */
+ ERadioPresetItemRadioContentEnabled = 1, /**< The preset item has radio frequency. */
+ ERadioPresetItemVisualRadioContentEnabled = 2 /**< The preset item has visual content enabled. */
+ };
+
+#endif // RADIOPRESET_HRH
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/inc/radiosettings.rh Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOSETTINGS_RH
+#define RADIOSETTINGS_RH
+
+#include <uikon.rh>
+
+STRUCT RADIOPRESET
+{
+ LTEXT name; // Name of a Radio Station preset
+ LONG freq_kHz; // Frequency of the radio, in kHz. 108.0 MHz == 108000 kHz
+ LTEXT serviceid; // Visual Radio Service Id for Content server
+ BYTE radio_preset_type; // Indicates whether this is a visual radio -enabled preset. 0 indicates false, otherwise true.
+ LTEXT radio_preset_location; // Location of the preset
+}
+
+#endif // RADIOSETTINGS_RH
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/src/cradioapplicationsettings.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradioenginelogger.h"
+#include "radiointernalcrkeys.h"
+
+#include "cradioapplicationsettings.h"
+#include "cradiorepositorymanager.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioApplicationSettings* CRadioApplicationSettings::NewL( CRadioRepositoryManager& aRepositoryManager,
+ CCoeEnv& aCoeEnv )
+ {
+ CRadioApplicationSettings* self = new ( ELeave ) CRadioApplicationSettings( aRepositoryManager, aCoeEnv );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioApplicationSettings::ConstructL()
+ {
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRActiveFocusLocation, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRAudioPlayHistory, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRUiFlags, CRadioRepositoryManager::ERadioEntityInt );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioApplicationSettings::CRadioApplicationSettings( CRadioRepositoryManager& aRepositoryManager,
+ CCoeEnv& aCoeEnv )
+ : CRadioSettingsBase( aRepositoryManager, aCoeEnv )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioApplicationSettings::~CRadioApplicationSettings()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioApplicationSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioApplicationSettings::SetActiveFocusLocation( TInt aIndex )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRActiveFocusLocation, aIndex );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioApplicationSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioApplicationSettings::ActiveFocusLocation() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRActiveFocusLocation );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioApplicationSettings.
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioApplicationSettings::SetAudioPlayHistoryL( TRadioCRAudioPlayHistory aHistory )
+ {
+ if ( AudioPlayHistory() != ERadioCRAudioPlayed )
+ {
+ User::LeaveIfError( iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRAudioPlayHistory, aHistory ) );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioApplicationSettings.
+//
+// ---------------------------------------------------------------------------
+//
+MRadioApplicationSettings::TRadioCRAudioPlayHistory CRadioApplicationSettings::AudioPlayHistory() const
+ {
+ return static_cast<TRadioCRAudioPlayHistory>(
+ iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRAudioPlayHistory ) );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioApplicationSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioApplicationSettings::UpdateStartCount()
+ {
+ TInt startCount = 0;
+ TRAP_IGNORE
+ (
+ CRadioRepositoryManager::GetRepositoryValueL( KRadioCRUid, KRadioCRLaunchCount, startCount );
+ CRadioRepositoryManager::SetRepositoryValueL( KRadioCRUid, KRadioCRLaunchCount, startCount + 1 );
+ );
+ return startCount;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioApplicationSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioApplicationSettings::SetUiFlags( TUint aUiFlags )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRUiFlags, static_cast<TInt>( aUiFlags ) );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioApplicationSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TUint CRadioApplicationSettings::UiFlags() const
+ {
+ return static_cast<TUint>( iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRUiFlags ) );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/src/cradioenginesettings.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,666 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <barsread.h>
+#include <coemain.h>
+#include "radiointernalcrkeys.h"
+#include "radioenginesettings.rsg"
+
+#include "radioenginedef.h"
+#include "cradioenginesettings.h"
+#include "mradiosettingsobserver.h"
+#include "cradiorepositorymanager.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineSettings* CRadioEngineSettings::NewL( CRadioRepositoryManager& aRepositoryManager,
+ CCoeEnv& aCoeEnv )
+ {
+ CRadioEngineSettings* self = new ( ELeave ) CRadioEngineSettings( aRepositoryManager, aCoeEnv );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineSettings::ConstructL()
+ {
+ iRepositoryManager.AddObserverL( this );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRHeadsetVolume, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRSpeakerVolume, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCROutputMode, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRAudioRoute, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRHeadsetMuteState, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRSpeakerMuteState, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRVisualRadioPowerState, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRTunedFrequency, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRDefaultMinVolumeLevel, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRCurrentRegion, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRRdsAfSearch, CRadioRepositoryManager::ERadioEntityInt );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRNetworkId, CRadioRepositoryManager::ERadioEntityDes16 );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRSubscriberId, CRadioRepositoryManager::ERadioEntityDes16 );
+ iRepositoryManager.AddEntityL( KRadioCRUid, KRadioCRCountryCode, CRadioRepositoryManager::ERadioEntityDes16 );
+
+ InitializeRegionsL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineSettings::CRadioEngineSettings( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv )
+ : CRadioSettingsBase( aRepositoryManager, aCoeEnv )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineSettings::~CRadioEngineSettings()
+ {
+ iRepositoryManager.RemoveObserver( this );
+ iRegions.ResetAndDestroy();
+ iRegions.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineSettings::SetObserver( MRadioSettingsObserver* aObserver )
+ {
+ iObserver = aObserver;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetHeadsetVolume( TInt aVolume )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRHeadsetVolume, aVolume );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::HeadsetVolume() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRHeadsetVolume );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetSpeakerVolume( TInt aVolume )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRSpeakerVolume, aVolume );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SpeakerVolume() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRSpeakerVolume );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetVolume( TInt aVolume )
+ {
+ if ( AudioRoute() == RadioEngine::ERadioHeadset )
+ {
+ return SetHeadsetVolume( aVolume );
+ }
+ else
+ {
+ return SetSpeakerVolume( aVolume );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::Volume() const
+ {
+ if ( AudioRoute() == RadioEngine::ERadioHeadset )
+ {
+ return HeadsetVolume();
+ }
+ else
+ {
+ return SpeakerVolume();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetOutputMode( TInt aOutputMode )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCROutputMode, aOutputMode );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::OutputMode() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCROutputMode );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+// Stores the radio audio route ( headset/ihf ) to use.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetAudioRoute( TInt aAudioRoute )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRAudioRoute, aAudioRoute );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+// Retrieves the radio audio route in use.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::AudioRoute() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRAudioRoute );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetHeadsetVolMuted( TBool aMuted )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRHeadsetMuteState, aMuted );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineSettings::IsHeadsetVolMuted() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRHeadsetMuteState );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetSpeakerVolMuted( TBool aMuted )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRSpeakerMuteState, aMuted );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineSettings::IsSpeakerVolMuted() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRSpeakerMuteState );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetVolMuted( TBool aMuted )
+ {
+ if ( AudioRoute() == RadioEngine::ERadioHeadset )
+ {
+ return SetHeadsetVolMuted( aMuted );
+ }
+ else
+ {
+ return SetSpeakerVolMuted( aMuted );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineSettings::IsVolMuted() const
+ {
+ if ( AudioRoute() == RadioEngine::ERadioHeadset )
+ {
+ return IsHeadsetVolMuted();
+ }
+ else
+ {
+ return IsSpeakerVolMuted();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetPowerOn( TBool aPowerState )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRVisualRadioPowerState, aPowerState );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineSettings::IsPowerOn() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRVisualRadioPowerState );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetTunedFrequency( TUint32 aFrequency )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid,
+ KRadioCRTunedFrequency, static_cast<TInt>( aFrequency ) );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TUint32 CRadioEngineSettings::TunedFrequency() const
+ {
+ return static_cast<TUint32>( iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRTunedFrequency ) );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::DefaultMinVolumeLevel() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRDefaultMinVolumeLevel );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::CountRegions() const
+ {
+ return iRegions.Count();
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRegion& CRadioEngineSettings::Region( TInt aIndex ) const
+ {
+ if ( aIndex == KErrNotFound )
+ {
+ aIndex = RegionIndexForId( DefaultRegion() );
+ }
+
+ return *iRegions[aIndex];
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TRadioRegion CRadioEngineSettings::RegionId() const
+ {
+ return static_cast<TRadioRegion>( iRepositoryManager.EntityValueInt( KRadioCRUid,
+ KRadioCRCurrentRegion ) );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TRadioRegion CRadioEngineSettings::DefaultRegion() const
+ {
+ TInt region( 0 );
+
+ TRAPD( err, iRepositoryManager.GetRepositoryValueL( KRadioCRUid, KRadioCRDefaultRegion, region ) );
+
+ TRadioRegion regionSetting = static_cast<TRadioRegion>( region );
+
+ if ( err != KErrNone )
+ {
+ regionSetting = ERadioRegionNone;
+ }
+ return regionSetting;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TPtrC CRadioEngineSettings::NetworkId() const
+ {
+ return TPtrC( iRepositoryManager.EntityValueDes16( KRadioCRUid, KRadioCRNetworkId ) );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TPtrC CRadioEngineSettings::SubscriberId() const
+ {
+ return TPtrC( iRepositoryManager.EntityValueDes16( KRadioCRUid, KRadioCRSubscriberId ) );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TPtrC CRadioEngineSettings::CountryCode() const
+ {
+ return TPtrC( iRepositoryManager.EntityValueDes16( KRadioCRUid, KRadioCRCountryCode ) );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetRegionId( TInt aRegion )
+ {
+ __ASSERT_ALWAYS( RegionIndexForId( aRegion ) != KErrNotFound,
+ User::Panic( _L( "CRadioEngineSettings" ), KErrArgument ) );
+
+ TInt err = iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRCurrentRegion, aRegion );
+ if ( !err )
+ {
+ UpdateCurrentRegionIdx( aRegion );
+ err = SetTunedFrequency( Region( iCurrentRegionIdx ).MinFrequency() );
+ }
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetRdsAfSearch( TBool aEnabled )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRRdsAfSearch, aEnabled );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetNetworkId( const TDesC& aNetworkId )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRNetworkId, aNetworkId );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetSubscriberId( const TDesC& aSubscriberId )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRSubscriberId, aSubscriberId );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSettingsSetter.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::SetCountryCode( const TDesC& aCountryCode )
+ {
+ return iRepositoryManager.SetEntityValue( KRadioCRUid, KRadioCRCountryCode, aCountryCode );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TUint32 CRadioEngineSettings::FrequencyStepSize() const
+ {
+ return Region( iCurrentRegionIdx ).StepSize();
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TUint32 CRadioEngineSettings::MaxFrequency() const
+ {
+ return Region( iCurrentRegionIdx ).MaxFrequency();
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TUint32 CRadioEngineSettings::MinFrequency() const
+ {
+ return Region( iCurrentRegionIdx ).MinFrequency();
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::DecimalCount() const
+ {
+ return Region( iCurrentRegionIdx ).DecimalCount();
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioEngineSettings.
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineSettings::RdsAfSearchEnabled() const
+ {
+ return iRepositoryManager.EntityValueInt( KRadioCRUid, KRadioCRRdsAfSearch );
+ }
+
+// ---------------------------------------------------------------------------
+// Initializes the regions based on resources.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineSettings::InitializeRegionsL()
+ {
+ iRegions.ResetAndDestroy();
+
+ TResourceReader reader;
+ iCoeEnv.CreateResourceReaderLC( reader, R_QRAD_REGIONS );
+
+ TInt regionCount = reader.ReadInt16();
+
+ for ( TInt i = 0 ; i < regionCount; i++ )
+ {
+ TInt resId = reader.ReadInt32(); // The next resource ID to read.
+ TResourceReader regionReader;
+ iCoeEnv.CreateResourceReaderLC( regionReader, resId );
+ CRadioRegion* region = CRadioRegion::NewL( regionReader );
+ CleanupStack::PushL( region );
+
+ if ( IsRegionAllowed( region->Id() ))
+ {
+ User::LeaveIfError( iRegions.Append( region ) );
+ CleanupStack::Pop( region );
+ }
+ else{
+ CleanupStack::PopAndDestroy( region );
+ }
+ CleanupStack::PopAndDestroy();
+ }
+
+ CleanupStack::PopAndDestroy();
+
+ if ( CountRegions() <= 0 || !IsRegionAllowed( DefaultRegion() ) )
+ {
+ User::Leave( KErrCorrupt );
+ }
+
+ UpdateCurrentRegionIdx( RegionId() );
+ }
+
+// ---------------------------------------------------------------------------
+// Converts Region ID to index
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineSettings::RegionIndexForId( TInt aRegionId ) const
+ {
+ TInt idx = KErrNotFound;
+ for ( TInt i = 0 ; i < CountRegions(); ++i )
+ {
+ if ( Region( i ).Id() == static_cast<TRadioRegion>( aRegionId ) )
+ {
+ idx = i;
+ break;
+ }
+ }
+ return idx;
+ }
+
+// ---------------------------------------------------------------------------
+// Updates the current region
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineSettings::UpdateCurrentRegionIdx( TInt aRegionId )
+ {
+ iCurrentRegionIdx = RegionIndexForId( aRegionId );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioRepositoryEntityObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineSettings::HandleRepositoryValueChangeL( const TUid& aUid,
+ TUint32 aKey,
+ TInt aValue,
+ TInt aError )
+ {
+ if ( !aError && aUid == KRadioCRUid && iObserver )
+ {
+ if ( aKey == KRadioCRRdsAfSearch )
+ {
+ iObserver->RdsAfSearchSettingChangedL( aValue );
+ }
+ else if ( aKey == KRadioCRCurrentRegion )
+ {
+ if ( iCurrentRegionIdx != RegionIndexForId( aValue ) )
+ {
+ UpdateCurrentRegionIdx( aValue );
+ __ASSERT_ALWAYS( iCurrentRegionIdx != KErrNotFound,
+ User::Panic( _L( "CRadioEngineSettings" ), KErrArgument ) );
+ User::LeaveIfError( SetTunedFrequency( Region( iCurrentRegionIdx ).MinFrequency() ) );
+ iObserver->RegionSettingChangedL( aValue );
+ }
+ }
+ else if ( aKey == KRadioCRRdsAfSearch )
+ {
+ iObserver->RdsAfSearchSettingChangedL( aValue );
+ }
+ else
+ {
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Determines if region is allowed .
+// ---------------------------------------------------------------------------
+//
+TBool CRadioEngineSettings::IsRegionAllowed( TRadioRegion aRegionId ) const
+ {
+
+ TInt regionAllowed( EFalse );
+ TInt err( KErrNone );
+
+ switch ( aRegionId )
+ {
+ case ERadioRegionJapan:
+ TRAP( err, iRepositoryManager.GetRepositoryValueL( KRadioCRUid, KRadioCRRegionAllowedJapan, regionAllowed ) );
+ break;
+
+ case ERadioRegionAmerica:
+ TRAP( err, iRepositoryManager.GetRepositoryValueL( KRadioCRUid, KRadioCRRegionAllowedAmerica, regionAllowed ) );
+ break;
+
+ case ERadioRegionDefault:
+ TRAP( err, iRepositoryManager.GetRepositoryValueL( KRadioCRUid, KRadioCRRegionAllowedDefault, regionAllowed ) );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( err != KErrNone )
+ {
+ regionAllowed = EFalse;
+ }
+
+ return TBool( regionAllowed );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/src/cradioregion.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <barsread.h>
+
+// User includes
+#include "cradioregion.h"
+
+// Used to convert kilohertz values to hertz values
+const TInt KRadioThousand = 1000;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRegion::CRadioRegion()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRegion::ConstructL( TResourceReader& aRr )
+ {
+ iId = static_cast<TRadioRegion>( aRr.ReadUint16());
+ iStepSize = static_cast<TUint16>( aRr.ReadUint16() ) * KRadioThousand;
+ iMinFreq = aRr.ReadUint32() * KRadioThousand;
+ iMaxFreq = aRr.ReadUint32() * KRadioThousand;
+ iDecimalCount = aRr.ReadInt16();
+
+ TInt countryCodeCount = aRr.ReadInt16();
+ for ( TInt i = 0 ; i < countryCodeCount ; i++)
+ {
+ TPtrC code;
+ code.Set( aRr.ReadTPtrC());
+ User::LeaveIfError( iCountryCodes.Append( code.AllocL()));
+ }
+
+ iName = aRr.ReadHBufC16L();
+ iSettingName = aRr.ReadHBufC16L();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRegion* CRadioRegion::NewL( TResourceReader& aRr )
+ {
+ CRadioRegion* self = new ( ELeave ) CRadioRegion;
+
+ CleanupStack::PushL( self );
+ self->ConstructL( aRr );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRegion::~CRadioRegion()
+ {
+ iCountryCodes.ResetAndDestroy();
+ iCountryCodes.Close();
+ delete iName;
+ delete iSettingName;
+ }
+
+// ---------------------------------------------------------
+// Get the id of region
+// ---------------------------------------------------------
+//
+EXPORT_C TRadioRegion CRadioRegion::Id() const
+ {
+ return iId;
+ }
+
+// ---------------------------------------------------------
+// Get the step interval of region
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CRadioRegion::StepSize() const
+ {
+ return iStepSize;
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CRadioRegion::MinFrequency() const
+ {
+ return iMinFreq;
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CRadioRegion::MaxFrequency() const
+ {
+ return iMaxFreq;
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CRadioRegion::DecimalCount() const
+ {
+ return iDecimalCount;
+ }
+
+// ---------------------------------------------------------
+// Get the country code of region
+// ---------------------------------------------------------
+//
+EXPORT_C const RRadioCountryCodeArray& CRadioRegion::CountryCodes()
+ {
+ return iCountryCodes;
+ }
+
+// ---------------------------------------------------------
+// Get the name of region
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC16& CRadioRegion::Name() const
+ {
+ return *iName;
+ }
+
+// ---------------------------------------------------------
+// Get the name of region
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC16& CRadioRegion::SettingItemName() const
+ {
+ return *iSettingName;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/src/cradiosettings.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// User includes
+#include "cradiosettings.h"
+#include "cradiosettingsimp.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioSettings* CRadioSettings::NewL( CCoeEnv* aCoeEnv )
+{
+ return CRadioSettingsImp::NewL( aCoeEnv );
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioSettings::~CRadioSettings()
+{
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/src/cradiosettingsbase.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <s32mem.h>
+#include "cradioenginelogger.h"
+
+#include "cradiorepositorymanager.h"
+#include "cradiosettingsbase.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSettingsBase::CRadioSettingsBase( CRadioRepositoryManager& aRepositoryManager,
+ CCoeEnv& aCoeEnv )
+ : iCoeEnv( aCoeEnv )
+ , iRepositoryManager( aRepositoryManager )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSettingsBase::~CRadioSettingsBase()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Writes a desciptor array to the repository.
+// ---------------------------------------------------------------------------
+//
+void CRadioSettingsBase::WriteArrayEntityL( const TUid& aUid, TUint32 aKey, const CDesCArray& aArray )
+ {
+ LOG_FORMAT( "CRadioSettingsBase::WriteArrayEntityL( aUid = %d, aKey = %d )", aUid.iUid, aKey );
+
+ CBufFlat* buf = CBufFlat::NewL( KRadioEntityBuf8Length );
+ CleanupStack::PushL( buf );
+ RBufWriteStream stream( *buf );
+ CleanupClosePushL( stream );
+
+ TInt count = aArray.MdcaCount();
+ stream << TCardinality( count );
+
+ LOG_FORMAT( " count = %d", count );
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ DEBUGVAR( TPtrC ptr( aArray.MdcaPoint( i ) ) );
+ LOG_FORMAT( " entry %d: %S", i, &ptr );
+ stream << aArray.MdcaPoint( i );
+ }
+
+ stream.CommitL();
+
+ CleanupStack::PopAndDestroy( &stream );
+
+ TRadioEntityBuf8 entityBuf( buf->Ptr( 0 ).Left( KRadioEntityBuf8Length ) );
+ User::LeaveIfError( iRepositoryManager.SetEntityValue( aUid, aKey, entityBuf ) );
+
+ CleanupStack::PopAndDestroy( buf );
+ }
+
+// ---------------------------------------------------------------------------
+// Reads a descriptor array from the repository.
+// ---------------------------------------------------------------------------
+//
+CDesCArray* CRadioSettingsBase::ReadArrayEntityL( const TUid& aUid, TUint32 aKey ) const
+ {
+ LOG_FORMAT( "CRadioSettingsBase::ReadArrayEntityL( aUid = %d, aKey = %d )", aUid.iUid, aKey );
+
+ CBufFlat* buf = CBufFlat::NewL( KRadioEntityBuf8Length );
+ CleanupStack::PushL( buf );
+ buf->InsertL( 0, iRepositoryManager.EntityValueDes8( aUid, aKey ) );
+ RBufReadStream stream( *buf );
+ CleanupClosePushL( stream );
+
+ TCardinality count;
+ stream >> count;
+
+ LOG_FORMAT( " count = %d", static_cast<TInt>( count ) );
+
+ CDesCArray* array = new ( ELeave ) CDesCArrayFlat( Max( static_cast<TInt>( count ), 1 ) );
+ CleanupStack::PushL( array );
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ HBufC* curBuf = HBufC::NewLC( stream, KMaxTInt );
+ DEBUGVAR( TPtrC ptr( *curBuf ) );
+ LOG_FORMAT( " entry %d: %S", i, &ptr );
+ array->AppendL( *curBuf );
+ CleanupStack::PopAndDestroy( curBuf );
+ }
+
+ CleanupStack::Pop( array );
+ CleanupStack::PopAndDestroy( 2, buf );
+
+ return array;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/settings/src/cradiosettingsimp.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <bautils.h>
+#include <coemain.h>
+#include <coneresloader.h>
+#include <f32file.h>
+#include <data_caging_path_literals.hrh>
+
+// User includes
+#include "cradiosettingsimp.h"
+#include "cradioapplicationsettings.h"
+#include "cradioenginesettings.h"
+#include "cradiorepositorymanager.h"
+#include "radioengineutils.h"
+#include "radioengineutils.h"
+#include "cradioenginelogger.h"
+
+// The name of the radio settings resource file.
+_LIT( KRadioSettingsResourceFile, "radioenginesettings.rsc" );
+
+// The granularity of the repository manager array.
+const TInt KRadioSettingsRepositoryManagerGranularity = 8;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSettingsImp* CRadioSettingsImp::NewL( CCoeEnv* aCoeEnv )
+ {
+ CRadioSettingsImp* self = new (ELeave) CRadioSettingsImp;
+ CleanupStack::PushL( self );
+ self->ConstructL( aCoeEnv );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioSettingsImp::ConstructL( CCoeEnv* aCoeEnv )
+ {
+ RadioEngineUtils::InitializeL( aCoeEnv );
+ LoadResourcesL();
+
+ iRepositoryManager = CRadioRepositoryManager::NewL( KRadioSettingsRepositoryManagerGranularity );
+
+ // Constructs the implementors of the interfaces.
+ iApplicationSettings = CRadioApplicationSettings::NewL( *iRepositoryManager, *RadioEngineUtils::Env() );
+ iEngineSettings = CRadioEngineSettings::NewL( *iRepositoryManager, *RadioEngineUtils::Env() );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSettingsImp::CRadioSettingsImp()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSettingsImp::~CRadioSettingsImp()
+ {
+ delete iApplicationSettings;
+ delete iEngineSettings;
+ delete iRepositoryManager;
+
+ if ( iResourceLoader )
+ {
+ iResourceLoader->Close();
+ }
+ delete iResourceLoader;
+ RadioEngineUtils::Release();
+ }
+
+// ---------------------------------------------------------------------------
+// Determines if region is allowed.
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSettingsImp::IsRegionAllowed( TRadioRegion aRegionId ) const
+ {
+ return iEngineSettings->IsRegionAllowed( aRegionId );
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the application settings interface.
+// ---------------------------------------------------------------------------
+//
+MRadioApplicationSettings& CRadioSettingsImp::ApplicationSettings() const
+ {
+ return *iApplicationSettings;
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the radio settings interface.
+// ---------------------------------------------------------------------------
+//
+MRadioEngineSettings& CRadioSettingsImp::EngineSettings() const
+ {
+ return *iEngineSettings;
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the radio settings setter interface.
+// ---------------------------------------------------------------------------
+//
+MRadioSettingsSetter& CRadioSettingsImp::RadioSetter() const
+ {
+ return *iEngineSettings;
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the underlying repository.
+// ---------------------------------------------------------------------------
+//
+CRadioRepositoryManager& CRadioSettingsImp::Repository() const
+ {
+ return *iRepositoryManager;
+ }
+
+// ---------------------------------------------------------------------------
+// Static version of ResolveDriveL.
+// ---------------------------------------------------------------------------
+//
+void CRadioSettingsImp::ResolveDriveL( TFileName& aFileName, const TDesC& aPath )
+ {
+ LOG_FORMAT( "CRadioSettingsImp::ResolveDriveL( aFileName = %S, aPath = %S )", &aFileName, &aPath );
+
+ RFs& fsSession = RadioEngineUtils::FsSession();
+ TFileName fileName;
+ TFileName baseResource;
+ TFindFile finder( fsSession );
+ TLanguage language( ELangNone );
+
+ _LIT( resourceFileExt, ".rsc" );
+ _LIT( resourceFileWildExt, ".r*" );
+
+ TParsePtrC parse( aFileName );
+ TBool isResourceFile = ( parse.Ext() == resourceFileExt() );
+
+ TInt err = KErrUnknown;
+ if ( isResourceFile )
+ {
+ CDir* entries = NULL;
+ fileName.Copy( parse.Name() );
+ fileName.Append( resourceFileWildExt() );
+ err = finder.FindWildByDir( fileName, aPath, entries );
+ delete entries;
+ }
+ else
+ {
+ // TFindFile applies search order that is from
+ // drive Y to A, then Z
+ err = finder.FindByDir( aFileName, aPath );
+ }
+
+ LOG_FORMAT( "CRadioSettingsImp::ResolveDriveL - err = %d", err );
+ TBool found = EFalse;
+ if ( !isResourceFile && err == KErrNone )
+ {
+ found = ETrue;
+ aFileName.Zero();
+ aFileName.Append( finder.File() );
+ }
+
+ while ( !found && err == KErrNone && isResourceFile )
+ {
+ // Found file
+ fileName.Zero();
+ TParsePtrC foundPath( finder.File() );
+ fileName.Copy( foundPath.DriveAndPath() );
+ fileName.Append( aFileName );
+ BaflUtils::NearestLanguageFile( fsSession, fileName, language );
+ if ( language != ELangNone && BaflUtils::FileExists( fsSession, fileName ) )
+ {
+ found = ETrue;
+ aFileName.Zero();
+ aFileName.Copy( fileName );
+ }
+ else
+ {
+ if ( language == ELangNone &&
+ !baseResource.Compare( KNullDesC ) &&
+ BaflUtils::FileExists( fsSession, fileName ) )
+ {
+ baseResource.Copy( fileName );
+ }
+ CDir* entries = NULL;
+ err = finder.FindWild( entries );
+ delete entries;
+ }
+ }
+
+ if ( !found && baseResource.Compare( KNullDesC ) )
+ {
+ // If we found *.rsc then better to use that than nothing
+ if ( BaflUtils::FileExists( fsSession, baseResource ) )
+ {
+ found = ETrue;
+ aFileName.Zero();
+ aFileName.Append( baseResource );
+ }
+ }
+
+ if ( !found )
+ {
+ LOG_FORMAT( "CRadioSettingsImp::ResolveDriveL - File %S not found ( err = %d )!", &aFileName, err );
+ User::Leave( KErrNotFound );
+ }
+
+ LOG_FORMAT( "CRadioSettingsImp::ResolveDriveL( aFileName = %S )", &aFileName );
+ }
+
+// ---------------------------------------------------------------------------
+// Loads the required resources.
+// ---------------------------------------------------------------------------
+//
+void CRadioSettingsImp::LoadResourcesL()
+ {
+ // Allocated in heap only so that the resource loader header doesn't need to be
+ // included in the header of this class. This is because this will be included
+ // by a QT component that should not depend on CONE
+ iResourceLoader = new (ELeave) RConeResourceLoader( *RadioEngineUtils::Env() );
+
+ TFileName resourceFileName;
+ resourceFileName.Append( KRadioSettingsResourceFile );
+
+ ResolveDriveL( resourceFileName, KDC_RESOURCE_FILES_DIR );
+
+ iResourceLoader->OpenL( resourceFileName );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/cradioaudiorouter.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOAUDIOROUTER_H
+#define C_RADIOAUDIOROUTER_H
+
+#include <e32base.h>
+
+#include "radioenginedef.h"
+
+// Forward declarations
+class CRadioRoutableAudio;
+class MRadioAudioRoutingObserver;
+
+/**
+ * CRadioAudioRouter
+ *
+ * Contains functionality for playing and routing startup sound
+ *
+ */
+NONSHARABLE_CLASS( CRadioAudioRouter ) : public CBase
+ {
+public:
+
+ IMPORT_C static CRadioAudioRouter* NewL( MRadioAudioRoutingObserver& aAudioRoutingObserver );
+
+ IMPORT_C ~CRadioAudioRouter();
+
+ /**
+ * Sets audio route
+ *
+ * @param aAudioRoute new audio route
+ */
+ IMPORT_C void SetAudioRouteL( RadioEngine::TRadioAudioRoute aAudioRoute );
+
+ /**
+ * Register routable audio which routing will be changed via this class.
+ *
+ * @param aRoutableAudio audio which routing will be added to routable
+ * audios. Ownership is not moved.
+ */
+ IMPORT_C void RegisterRoutableAudio( CRadioRoutableAudio* aRoutableAudio );
+
+ /**
+ * Removes registration of routable audio.
+ *
+ * @param aRoutableAudio audio which routing registration will be
+ * removed. Ownership is not moved.
+ */
+ IMPORT_C void UnRegisterRoutableAudio( CRadioRoutableAudio* aRoutableAudio );
+
+private:
+
+ CRadioAudioRouter( MRadioAudioRoutingObserver& aAudioRoutingObserver );
+
+ void ConstructL();
+
+private: // data
+
+ /**
+ * Reference to audio routing observer. Gets informed when audio routing
+ * is changed.
+ */
+ MRadioAudioRoutingObserver& iAudioRoutingObserver;
+
+ /**
+ * Contains routable audios.
+ */
+ RArray<CRadioRoutableAudio*> iRoutableAudios;
+
+ };
+
+#endif // C_RADIOAUDIOROUTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/cradioenginelogger.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,477 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOENGINELOGGER_H
+#define C_RADIOENGINELOGGER_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include "mradioenginelogger.h"
+
+/**
+ * Main logging macro.
+ * When the macro is defined, logging is on
+ */
+#ifdef _DEBUG
+ #define LOGGING_ENABLED
+#endif
+
+#ifdef LOGGING_ENABLED
+
+/**
+ * Log file path.
+ * If the path points to memory card and the card is not present or is read only,
+ * the log is written to C: drive.
+ */
+_LIT( KLogFile, "c:\\logs\\radio\\radioenginelog.txt" );
+
+/**
+ * Logging buffer length. Should be big enough to hold one line of text
+ */
+const TInt KLogBufferLength = 512;
+
+
+// ===========================================================================
+// ===========================================================================
+//
+// BEGIN LOGGING MACROS. Use these to write log prints
+//
+// ===========================================================================
+// ===========================================================================
+
+// All macros except LOG_METHOD and LOG_METHOD_RET are enclosed in do { }while( 0 );
+// statements to make them form a complete code block that can be used anywhere.
+
+/**
+ * Function entry, exit and leave logging.
+ *
+ * @code
+ * LOG_METHOD( "CSomeClass::SomeFunctionL" );
+ * @endcode
+ */
+#define LOG_METHOD( func ) TRadioMethodLogger ___methodLogger( _S( func ), _S( "" ) )
+
+/**
+ * Function entry, exit and leave logging.
+ * Gets the function name automatically
+ *
+ * @code
+ * LOG_METHOD_AUTO;
+ * @endcode
+ */
+// Substract 1 from MaxLength() because PtrZ() adds the zero terminator
+#define LOG_METHOD_AUTO \
+ TPtrC8 __ptr8( (const TUint8*)__PRETTY_FUNCTION__ ); \
+ TBuf<150> __buf; \
+ __buf.Copy( __ptr8.Left( __buf.MaxLength() - 1 ) ); \
+ TRadioMethodLogger ___methodLogger( __buf.PtrZ(), _S( "" ) )
+
+/**
+ * Function entry, exit and leave logging. Logs also returned value
+ * NOTE! At the moment return value is only logged in emulator builds.
+ *
+ * @code
+ * // Function returns an integer value
+ * LOG_METHOD_RET( "CSomeClass::SomeFunctionL", "Error: %d" );
+ *
+ * // Function returns an HBufC pointer
+ * LOG_METHOD_RET( "CSomeClass::SomeFunctionL", "HBufC: %S" );
+ * @endcode
+ */
+#define LOG_METHOD_RET( func,fmt ) TRadioMethodLogger ___methodLogger( _S( func ), _S( fmt ) )
+
+/**
+ * Function entry, exit and leave logging. Logs also returned value
+ * Gets the function name automatically
+ * NOTE! At the moment return value is only logged in emulator builds.
+ *
+ * @code
+ * // Function returns an integer value
+ * LOG_METHOD_RET( "CSomeClass::SomeFunctionL", "Error: %d" );
+ *
+ * // Function returns an HBufC pointer
+ * LOG_METHOD_RET( "CSomeClass::SomeFunctionL", "HBufC: %S" );
+ * @endcode
+ */
+// Substract 1 from MaxLength() because PtrZ() adds the zero terminator
+#define LOG_METHOD_AUTO_RET( fmt ) \
+ TPtrC8 __ptr8( (const TUint8*)__PRETTY_FUNCTION__ ); \
+ TBuf<150> __buf; \
+ __buf.Copy( __ptr8.Left( __buf.MaxLength() - 1 ) ); \
+ TRadioMethodLogger ___methodLogger( __buf.PtrZ(), _S( fmt ) )
+
+/**
+ * Simple assert macro that works like normal asserts. The expression ( expr ) is
+ * expected to be true in which case nothing is done. If the expression is false the
+ * statement ( stmt ) is executed.
+ *
+ * Note! As with normal asserts, do not put a function call as the expression because
+ * it will not be executed when logging is off!
+ *
+ * @code
+ * // Log error code if it is not KErrNone
+ * TRAPD( err, SomeFunctionL() );
+ * MTV_ASSERT( !err, LOG_FORMAT( "Operation failed. error: %d", err ) );
+ * @endcode
+ */
+#define LOG_ASSERT( expr, stmt ) do { if ( !( expr )) { stmt; } }while( 0 )
+
+#define DEBUGVAR( var ) var
+
+/**
+ * Writes a formatted string to log. Accepts variable number of parameters
+ *
+ * @code
+ * LOG_FORMAT( "Integer: %d", 1 );
+ * LOG_FORMAT( "Integer: %d Desc %S", 1, &desc );
+ * LOG_FORMAT( "Integer: %d Desc %S hex 0x%X", 1, &desc, 0xC0FFEE );
+ * @endcode
+ */
+#define LOG_FORMAT( fmt,args...) do{MRadioEngineLogger::Logger()->AddIndent( KMarkerEngine()).AddFormat( _L( fmt ),args ).Commit();}while( 0 )
+
+/**
+ * Writes current time to log. Example: Time: 13.9.2007 13:23:25.383750
+ */
+#define LOG_CURRENT_TIME() do{MRadioEngineLogger::Logger()->AddIndent( KMarkerEngine()).AddTimestamp().Commit();}while( 0 )
+
+/**
+ * Writes a time to log. Accepts a TTime as parameter
+ *
+ * @code
+ * TTime now;
+ * now.HomeTime();
+ * LOG_TIME( now );
+ * @endcode
+ */
+#define LOG_TIME( x ) do{MRadioEngineLogger::Logger()->AddIndent( KMarkerEngine()).AddTimestamp( x ).Commit();}while( 0 )
+
+/**
+ * Writes a time to log. Accepts a string and a TTime as parameter
+ *
+ * @code
+ * TTime now;
+ * now.HomeTime();
+ * LOG_TIME2( "Current time", now );
+ * @endcode
+ */
+#define LOG_TIME2( desc, time ) do{MRadioEngineLogger::Logger()->AddIndent( KMarkerEngine()).Add( desc ).Add( ": " ).Add( time ).Commit();}while( 0 )
+
+/**
+ * Clear the log contents
+ */
+#define LOG_CLEAR() do{MRadioEngineLogger::Logger()->ClearLog();}while( 0 )
+
+/**
+ * Construct a log line one item at a time. No newline at end
+ */
+//#define LOG( x ) do{CRadioEngineLogger::Logger()->Add( x );}while( 0 )
+
+/**
+ * Write a newline to log
+ */
+#define LOG_NEWLINE() do{MRadioEngineLogger::Logger()->Commit();}while( 0 )
+
+/**
+ * Macro that behaves like User::LeaveIfError except it logs the leave
+ * The line "TInt __error_code = expr;" makes sure the expression is evaluated only once
+ */
+#define LEAVEIFERROR( expr ) \
+ do { \
+ TInt __err = expr; \
+ if ( __err ) \
+ { \
+ _LIT( KExpression, #expr ); \
+ LOG_FORMAT( "%S leaving with code %d!", &KExpression, __err ); \
+ User::Leave( __err ); \
+ } \
+ } while( 0 )
+
+/**
+ * Macro that behaves like User::Leave except it logs the leave
+ * The line "TInt __error_code = expr;" makes sure the expression is evaluated only once
+ */
+#define LEAVE( expr ) \
+ do { \
+ TInt __err = expr; \
+ LOG_FORMAT( "Leaving with code %d!", __err ); \
+ User::Leave( __err ); \
+ } while( 0 )
+
+/**
+ * Macro that behaves like TRAP except it logs the possible error
+ */
+#define TRAP_AND_LOG_ERR( err, expr ) \
+ TRAP( err, expr ); \
+ if ( err ) \
+ { \
+ _LIT( KExpression, #expr ); \
+ LOG_FORMAT( "%S failed with err %d", &KExpression, err ); \
+ } \
+
+/**
+ * Macro that behaves like TRAPD except it logs the possible error
+ */
+#define TRAPD_AND_LOG_ERR( err, expr ) \
+ TInt err = 0; \
+ TRAP_AND_LOG_ERR( err, expr )
+
+
+/**
+ * Macro that behaves like TRAP_IGNORE except it logs the possible error
+ */
+#define TRAP_IGNORE_AND_LOG_ERR( expr ) \
+ do { \
+ TRAPD_AND_LOG_ERR( __err, expr ); \
+ } while ( 0 )
+
+/**
+ * Write a single log line.
+ */
+#define LOGGER_WRITE( x ) do{MRadioEngineLogger::Logger()->AddIndent( KMarkerEngine ).Add( _L8( x ) ).Commit();}while( 0 )
+#define LOG( x ) do{MRadioEngineLogger::Logger()->AddIndent( KMarkerEngine ).Add( x ).Commit();}while( 0 )
+//#define LOG2( x1, x2 ) do{CRadioEngineLogger::Logger()->AddIndent().Add( x1 ).Add( x2 ).Commit();}while( 0 )
+//#define LOG3( x1, x2, x3 ) do{CRadioEngineLogger::Logger()->AddIndent().Add( x1 ).Add( x2 ).Add( x3 ).Commit();}while( 0 )
+//#define LOG4( x1, x2, x3, x4 ) do{CRadioEngineLogger::Logger()->AddIndent().Add( x1 ).Add( x2 ).Add( x3 ).Add( x4 ).Commit();}while( 0 )
+//#define LOG5( x1, x2, x3, x4, x5 ) do{CRadioEngineLogger::Logger()->AddIndent().Add( x1 ).Add( x2 ).Add( x3 ).Add( x4 ).Add( x5 ).Commit();}while( 0 )
+
+
+// ===========================================================================
+// ===========================================================================
+//
+// END LOGGING MACROS. Do not use anything below this line directly!
+//
+// ===========================================================================
+// ===========================================================================
+
+
+#include <f32file.h>
+#include <e32debug.h>
+
+class TRadioMethodLogger;
+
+const TInt KTimestampLength = 40;
+typedef TBuf8<KTimestampLength> TTimestamp;
+
+/**
+ * Logger for writing log to a file and RDebug
+ *
+ * @lib mtvcommon.lib
+ * @since Live TV UI v1.0
+ */
+NONSHARABLE_CLASS( CRadioEngineLogger ) : public CBase
+ , public MRadioEngineLogger
+ , public TDes16Overflow
+ {
+ friend class CRadioEngineTls;
+public:
+
+// from base class MRadioEngineLogger
+
+ MRadioEngineLogger& ClearLog();
+ MRadioEngineLogger& Add( const TDesC8& aMsg );
+ MRadioEngineLogger& Add( const TDesC& aMsg );
+ MRadioEngineLogger& Add( TInt aInt );
+ MRadioEngineLogger& Add( const TReal& aReal );
+ MRadioEngineLogger& Add( const char* aText );
+ MRadioEngineLogger& Add( const TAny* aPtr );
+ MRadioEngineLogger& Add( const TTime& aTime );
+ MRadioEngineLogger& AddTimestamp();
+ MRadioEngineLogger& AddFormat( TRefByValue<const TDesC> aFmt, ... );
+ MRadioEngineLogger& AddIndent( const TDesC& aMarker );
+ MRadioEngineLogger& AddIndentClear( const TDesC& aMarker );
+ MRadioEngineLogger& IncIndent();
+ MRadioEngineLogger& DecIndent();
+ MRadioEngineLogger& Commit( TBool aNewLine = ETrue );
+
+// from base class TDes16Overflow
+
+ /**
+ * Handles the overflow from AppendFormatList()
+ *
+ * @since Live TV UI v1.0
+ * @param aDes The 16-bit modifiable descriptor whose overflow results in the
+ * call to this overflow handler.
+ */
+ void Overflow( TDes16 &aDes );
+
+private:
+
+ static CRadioEngineLogger* NewL( RFs& aFs );
+
+ ~CRadioEngineLogger();
+
+ CRadioEngineLogger( RFs& aFs );
+
+ void ConstructL();
+
+ /**
+ * Returns the amount of characters that still fit in the buffer
+ *
+ * @since Live TV UI v1.0
+ * @return Amount of space available
+ */
+ TInt Available() const;
+
+ /**
+ * Templated function to add either 8-bit or 16-bit descriptor to buffer
+ *
+ * @since Live TV UI v1.0
+ * @param aDesc Descriptor to add
+ */
+ template<class PTR, class DESC>
+ void AddDesC( const DESC& aDesc );
+
+ /**
+ * Parses the timestamp from the given TTime
+ *
+ * @since Live TV UI v1.0
+ * @param aTime Time to parse
+ * @param aTimestamp On return, the parsed timestamp
+ */
+ void ParseTimestamp( const TTime& aTime, TTimestamp& aTimestamp );
+
+private: // data
+
+ /**
+ * Reference to file server session.
+ */
+ RFs& iFs;
+
+ /**
+ * File handle
+ */
+ RFile iFile;
+
+ /**
+ * Name of the log file.
+ * Own.
+ */
+ HBufC* iFileName;
+
+ /**
+ * Logging buffer. holds one log line at a time
+ */
+ TBuf8<KLogBufferLength> iBuf8;
+
+ /**
+ * Indentation
+ */
+ TInt iIndent;
+
+ /**
+ * Flag to indicate whether or not timestamp has already been written to the beginning of line
+ */
+ TBool iTimeStampWritten;
+
+ };
+
+/**
+ * Helper class for method entry, exit and leave logging.
+ * Used as automatic variable declared by LOG_METHOD() macro.
+ */
+NONSHARABLE_CLASS( TRadioMethodLogger )
+ {
+public:
+
+ /**
+ * Constructor. Writes method entry log.
+ */
+ IMPORT_C TRadioMethodLogger( const TText* aFunc, const TText* aRetFormat );
+
+ /**
+ * Destructor. Writes method exit log.
+ */
+ IMPORT_C ~TRadioMethodLogger();
+
+private: // data
+
+ /**
+ * Pointer descriptor to function signature that is to be logged.
+ */
+ TPtrC iFunc;
+
+ /**
+ * Formatting string used to print the function return value
+ */
+ TPtrC iRetFormat;
+
+ };
+
+#else // LOGGING_ENABLED
+
+// Empty macro definitions for non logging build.
+
+#define LOG_METHOD_AUTO
+#define LOG_METHOD_AUTO_RET( fmt )
+
+#define LOG_METHOD( func )
+#define LOG_METHOD_RET( func,fmt )
+#define LOG_FORMAT( fmt,args...)
+#define LOG_ASSERT( expr, stmt )
+#define DEBUGVAR( var )
+
+#define LOG_CURRENT_TIME()
+#define LOG_TIME( x )
+#define LOG_TIME2( desc, time )
+
+#define LOG_CLEAR()
+#define LOG( x )
+#define LOG_NEWLINE()
+#define LOG1( x )
+#define LOG2( x1, x2 )
+#define LOG3( x1, x2, x3 )
+#define LOG4( x1, x2, x3, x4 )
+#define LOG5( x1, x2, x3, x4, x5 )
+
+// Default implementations for leave macros.
+// Note! These can NOT be empty macros because the errors would not be checked when logging is off
+#define LEAVEIFERROR( expr ) User::LeaveIfError( expr )
+#define LEAVE( expr ) User::Leave( expr )
+
+// Default implementation for trap macros
+// Note! As with leave macros, these can not be empty
+#define TRAP_AND_LOG_ERR( err,stmt ) TRAP( err, stmt )
+#define TRAPD_AND_LOG_ERR( err,stmt ) TRAPD( err, stmt )
+#define TRAP_IGNORE_AND_LOG_ERR( stmt ) TRAP_IGNORE( stmt )
+
+#define LOGGER_WRITE( x )
+
+// ===========================================================================
+// Dummy classes to keep the exports unchanged when logging is turned off
+// These can not be used.
+// ===========================================================================
+class RFs;
+NONSHARABLE_CLASS( CRadioEngineLogger ) : public CBase
+ {
+ friend class CRadioEngineImp;
+private:
+ static void InitializeL( RFs& aFs );
+ static void Release();
+ };
+
+NONSHARABLE_CLASS( TRadioMethodLogger )
+ {
+public:
+ IMPORT_C TRadioMethodLogger( const TText* /*aFunc*/, const TText* /*aRetFormat*/ );
+ IMPORT_C ~TRadioMethodLogger();
+ };
+
+#endif // LOGGING_ENABLED
+
+#endif // C_RADIOENGINELOGGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/cradiopubsub.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIOPUBSUB_H
+#define CRADIOPUBSUB_H
+
+#include <e32base.h>
+
+#include "radiointernalpskeys.h"
+
+class MRadioControlEventObserver;
+
+/**
+ * Publish&Subscribe interface of Visual Radio Application.
+ */
+NONSHARABLE_CLASS( CRadioPubSub ) : public CBase
+ {
+public:
+
+ IMPORT_C static CRadioPubSub* NewL();
+
+ IMPORT_C virtual ~CRadioPubSub();
+
+ /**
+ * Publishes active channel number to P&S.
+ *
+ * @param aChannelId The channel ID to publish.
+ */
+ virtual TBool PublishChannel( TInt aChannelId ) const = 0;
+
+ /**
+ * Publishes active frequency to P&S.
+ *
+ * @param aFreq The frequency to publish.
+ */
+ virtual TBool PublishFrequency( TUint32 aFreq ) const = 0;
+
+ /**
+ * Publishes radio power state to P&S.
+ *
+ * @param aPowerOn The radio power state to publish.
+ */
+ virtual TBool PublishPowerState( TBool aPowerOn ) const = 0;
+
+ /**
+ * Publishes current volume level to P&S.
+ *
+ * @param aVol The current volume level to publish.
+ */
+ virtual TBool PublishVolume( TInt aVol ) const = 0;
+
+ /**
+ * Publishes changed channel number to P&S.
+ *
+ * @param aChannelId The channel ID to publish.
+ */
+ virtual TBool PublishChannelDataChanged( TInt aChannelId ) const = 0;
+
+ /**
+ * Publishes the tuning state to P&S.
+ * @param aTuningState The tuning state to publish.
+ */
+ virtual TBool PublishTuningState( TRadioPSTuningState aTuningState ) const = 0;
+
+ /**
+ * Publishes radio mute state to P&S.
+ *
+ * @param aMuted The radio mute state to publish.
+ */
+ virtual TBool PublishRadioMuteState( TBool aMuted ) const = 0;
+
+ /**
+ * Publishes application running state to P&S.
+ *
+ * @param aRunningState The application running state.
+ */
+ virtual TBool PublishApplicationRunningState( TRadioPSApplicationRunningState aRunningState ) const = 0;
+
+ /**
+ * Publishes the headset status to P&S.
+ *
+ * @param aHeadsetStatus The headset's status.
+ */
+ virtual TBool PublishHeadsetStatus( TRadioPSHeadsetStatus aHeadsetStatus ) const = 0;
+
+ /**
+ * Publishes the frequency decimal count to P&S.
+ * @param aDecimalCount The decimal count.
+ */
+ virtual TBool PublishFrequencyDecimalCount( TRadioPSFrequencyDecimalCount aDecimalCount ) const = 0;
+
+ /**
+ * Publishes speaker status. Before state is set for first time it is in
+ * <code>ERadioPSSpeakerUninitialized</code> state.
+ *
+ * @param aLoudspeakerStatus Status of the speaker
+ */
+ virtual TBool PublishLoudspeakerStatus( TRadioPSLoudspeakerStatus aLoudspeakerStatus ) const = 0;
+
+ /**
+ * Publishes Rds Program Service information.
+ *
+ * @param aProgramService Rds Program service descriptor
+ */
+ virtual TBool PublishRdsProgramService( const TDesC& aProgramService ) const = 0;
+
+ /**
+ * Publishes Rds Radio Text information.
+ *
+ * @param aRadioText The Radio Text information to be published.
+ */
+ virtual TBool PublishRdsRadioText( const TDesC& aRadioText ) const = 0;
+
+ /**
+ * Publishes Channel name information.
+ *
+ * @param aName The name to be published.
+ */
+ virtual TBool PublishChannelName( const TDesC& aName ) const = 0;
+
+ /**
+ * Publishes the number of presets in the active preset list.
+ *
+ * @param aCount The number of presets.
+ */
+ virtual TBool PublishActivePreseListCount( TInt aCount ) const = 0;
+
+ /**
+ * Publishes the focus in the active preset list.
+ *
+ * @param aIndex The focus in the active preset list.
+ */
+ virtual TBool PublishActivePreseListFocus( TInt aIndex ) const = 0;
+
+ /**
+ * Publishes the antenna state ( attach/detach ).
+ *
+ * @param aState The current antenna state.
+ */
+ virtual TBool PublishAntennaState( TRadioPSRadioAntennaState aState ) const = 0;
+
+ /**
+ * Sets the UI side control event observer.
+ * @param aControlEventObserver the observer for control events
+ */
+ virtual void SetControlEventObserver( MRadioControlEventObserver* aControlEventObserver ) = 0;
+
+ };
+
+#endif // CRADIOPUBSUB_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/cradioremcontarget.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIOREMCONTARGET_H
+#define CRADIOREMCONTARGET_H
+
+// System includes
+#include <e32base.h>
+
+// Forward declarations
+class MRadioControlEventObserver;
+
+// Class declaration
+
+NONSHARABLE_CLASS( CRadioRemConTarget ) : public CBase
+ {
+public:
+
+ IMPORT_C static CRadioRemConTarget* NewL();
+
+ virtual ~CRadioRemConTarget();
+
+ /**
+ * Sets control event observer.
+ * @param aControlEventObserver the observer for control events
+ */
+ virtual void SetControlEventObserver( MRadioControlEventObserver* aControlEventObserver ) = 0;
+
+ };
+
+#endif // CRADIOREMCONTARGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/cradiorepositorymanager.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,255 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOREPOSITORYMANAGER_H
+#define C_RADIOREPOSITORYMANAGER_H
+
+// System includes
+#include <e32base.h>
+
+// Forward declarations
+class MRadioRepositoryEntityObserver;
+
+/** The maximum length of a string buffer. */
+const TInt KRadioEntityBuf16Length = 256; // Maximum: NCentralRepositoryConstants::KMaxUnicodeStringLength;
+/** The maximum length of a binary buffer. */
+const TInt KRadioEntityBuf8Length = KRadioEntityBuf16Length * 2; // Maximum: NCentralRepositoryConstants::KMaxBinaryLength;
+
+/** Maximum length binary buffer. */
+typedef TBuf8<KRadioEntityBuf8Length> TRadioEntityBuf8;
+/** Maximum length string buffer. */
+typedef TBuf16<KRadioEntityBuf16Length> TRadioEntityBuf16;
+
+/**
+ * Central repository entity manager.
+ *
+ * Manages central repository entities that listen to specific repository and a key within it, notifying the observer
+ * whenever the key's value changes.
+ *
+ * Also a set of static methods are provided that wrap the common use case of central repository where the user
+ * is only interested to read or write the value of a key and then discard the repository object.
+ */
+NONSHARABLE_CLASS( CRadioRepositoryManager ) : public CBase
+ {
+
+public:
+
+ /**
+ * Possible entity types.
+ */
+ enum TRadioEntityType
+ {
+ ERadioEntityInt, /**< The entity is an integer. */
+ ERadioEntityReal, /**< The entity is a floating point number. */
+ ERadioEntityDes8, /**< The entity is a binary value. */
+ ERadioEntityDes16 /**< The entity is a string. */
+ };
+
+ IMPORT_C static CRadioRepositoryManager* NewL( TInt aGranularity );
+
+ IMPORT_C ~CRadioRepositoryManager();
+
+ /**
+ * Adds observer
+ *
+ * @param aObserver The observer that is notified of all the changes in the observed keys' values.
+ */
+ virtual void AddObserverL( MRadioRepositoryEntityObserver* aObserver ) = 0;
+
+ /**
+ * Removes observer
+ *
+ * @param aObserver The observer that is to be removed
+ */
+ virtual void RemoveObserver( MRadioRepositoryEntityObserver* aObserver ) = 0;
+
+ /**
+ * Enables or disables the writing of entities' values to the repository.
+ *
+ * Disabling the save functionality is important when the free disk space reaches critical level.
+ *
+ * @param aEnable <code>ETrue</code> if the entities are allowed to write their value to the repository, <code>EFalse</code> otherwise.
+ */
+ virtual void EnableSave( TBool aEnable ) = 0;
+
+ /**
+ * Adds an entity to the manager.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aType The type of the key within the repository.
+ */
+ virtual void AddEntityL( const TUid& aUid, TUint32 aKey, TRadioEntityType aType ) = 0;
+
+ /**
+ * Removes an entity from the manager.
+ *
+ * Entities should only be removed when they are no longer needed. The destructor of the repository manager
+ * deletes all the remaining entities.
+ *
+ * @param aUid The UID of the entity to be removed.
+ * @param aKey The key of the entity to be removed.
+ */
+ virtual void RemoveEntity( const TUid& aUid, TUint32 aKey ) = 0;
+
+ /**
+ * Sets the value of an integer entity.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param aValue The value to set.
+ */
+ virtual TInt SetEntityValue( const TUid& aUid, TUint32 aKey, TInt aValue ) = 0;
+
+ /**
+ * Sets the value of a floating point entity.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param aValue The value to set.
+ */
+ virtual TInt SetEntityValue( const TUid& aUid, TUint32 aKey, const TReal& aValue ) = 0;
+
+ /**
+ * Sets the value of a binary entity.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param aValue The value to set.
+ */
+ virtual TInt SetEntityValue( const TUid& aUid, TUint32 aKey, const TDesC8& aValue ) = 0;
+
+ /**
+ * Sets the value of a string entity.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param aValue The value to set.
+ */
+ virtual TInt SetEntityValue( const TUid& aUid, TUint32 aKey, const TDesC16& aValue ) = 0;
+
+ /**
+ * Returns the cached value of an integer entity.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @return The cached value of the entity.
+ */
+ virtual TInt EntityValueInt( const TUid& aUid, TUint32 aKey ) const = 0;
+
+ /**
+ * Returns the cached value of a floating point entity.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @return The cached value of the entity.
+ */
+ virtual const TReal& EntityValueReal( const TUid& aUid, TUint32 aKey ) const = 0;
+
+ /**
+ * Returns the cached value of a binary entity.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @return The cached value of the entity.
+ */
+ virtual const TDesC8& EntityValueDes8( const TUid& aUid, TUint32 aKey ) const = 0;
+
+ /**
+ * Returns the cached value of a string entity.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @return The cached value of the entity.
+ */
+ virtual const TDesC16& EntityValueDes16( const TUid& aUid, TUint32 aKey ) const = 0;
+
+ /**
+ * Sets the value of an integer key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue The value to set.
+ */
+ IMPORT_C static void SetRepositoryValueL( const TUid& aUid, TUint32 aKey, TInt aValue );
+
+ /**
+ * Sets the value of a floating point key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue The value to set.
+ */
+ IMPORT_C static void SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TReal& aValue );
+
+ /**
+ * Sets the value of a binary key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue The value to set.
+ */
+ IMPORT_C static void SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TDesC8& aValue );
+
+ /**
+ * Sets the value of a string key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue The value to set.
+ */
+ IMPORT_C static void SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TDesC16& aValue );
+
+ /**
+ * Gets the value of an integer key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue On return, the value of the key within the repository.
+ */
+ IMPORT_C static void GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TInt& aValue );
+
+ /**
+ * Gets the value of a floating point key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue On return, the value of the key within the repository.
+ */
+ IMPORT_C static void GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TReal& aValue );
+
+ /**
+ * Gets the value of a binary key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue On return, the value of the key within the repository.
+ */
+ IMPORT_C static void GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TDes8& aValue );
+
+ /**
+ * Gets the value of a string key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue On return, the value of the key within the repository.
+ */
+ IMPORT_C static void GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TDes16& aValue );
+
+ };
+
+#endif // C_RADIOREPOSITORYMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/cradioroutableaudio.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOROUTABLEAUDIO_H
+#define C_RADIOROUTABLEAUDIO_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include "radioenginedef.h"
+
+// Forward declarations
+class CAudioOutput;
+class CRadioAudioRouter;
+
+/**
+ * CRadioRoutableAudio
+ *
+ * Defines common functionality for routable audio sources by defining common
+ * skeleton method for routing.
+ *
+ */
+class CRadioRoutableAudio : public CBase
+ {
+
+public:
+
+ IMPORT_C CRadioRoutableAudio( CRadioAudioRouter* aAudioRouter );
+
+ IMPORT_C ~CRadioRoutableAudio();
+
+ /**
+ * Sets audio routing. Please note that subclasses must define
+ * <code>RoutedAudio</code> method otherwise this will not do anything.
+ * @param aDestination 'Not documented'? old documentation: if <code>true</code> audio routing will be set to
+ * speaker otherwise to headset.
+ */
+ IMPORT_C void SetAudioRouteL( RadioEngine::TRadioAudioRoute aRoute );
+
+ /**
+ * Tells if audio routing is supported
+ * @return EFalse if routing is not supported, otherwise true
+ */
+ IMPORT_C TBool AudioRoutingSupported() const;
+
+protected:
+
+ /**
+ * Sets audio output. Must be called from subclass.
+ * Ownership is moved.
+ * @param aAudioOutput for setting routing.
+ */
+ IMPORT_C void SetAudioOutput( CAudioOutput* aAudioOutput );
+
+ /**
+ * Deletes audio output.
+ * Must be called from subclass before
+ * the actual audio utility class is deleted.
+ */
+ IMPORT_C void DeleteAudioOutput();
+
+protected: //data
+
+ /**
+ * Routes audio. Used to register/unregister this routable audio for routing.
+ * Own.
+ */
+ CRadioAudioRouter* iAudioRouter;
+
+private: // data
+
+ /**
+ * AudioOutput for setting routing.
+ * Own.
+ */
+ CAudioOutput* iAudioOutput;
+
+ };
+
+#endif // C_RADIOROUTABLEAUDIO_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/cradiosystemeventcollector.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIOSYSTEMEVENTCOLLECTOR_H
+#define CRADIOSYSTEMEVENTCOLLECTOR_H
+
+#include <e32std.h>
+
+class MRadioSystemEventObserver;
+
+NONSHARABLE_CLASS( CRadioSystemEventCollector )
+ {
+public:
+
+ IMPORT_C static CRadioSystemEventCollector* NewL();
+
+ IMPORT_C virtual ~CRadioSystemEventCollector();
+
+ /**
+ * Adds a system event observer
+ *
+ * @param aSystemObserver The observer to be added
+ */
+ virtual void AddObserverL( MRadioSystemEventObserver* aSystemObserver ) = 0;
+
+ /**
+ * Removes a system event observer
+ *
+ * @param aSystemObserver The observer to be removed
+ */
+ virtual void RemoveObserver( MRadioSystemEventObserver* aSystemObserver ) = 0;
+
+ /**
+ * Returns data network coverage state ( wlan or mobile ).
+ *
+ * @return ETrue if there is network coverage
+ */
+ virtual TBool IsNetworkCoverage() const = 0;
+
+ /**
+ * Returns mobile network coverage state.
+ *
+ * @return ETrue if there is network coverage
+ */
+ virtual TBool IsMobileNetworkCoverage() const = 0;
+
+ /**
+ * Returns current call state.
+ *
+ * @return ETrue if call is active
+ */
+ virtual TBool IsCallActive() const = 0;
+
+ /**
+ * Returns current audio resources state.
+ *
+ * @return ETrue if audio resources are available
+ */
+ virtual TBool IsAudioResourcesAvailable() const = 0;
+
+ /**
+ * Returns current headset connection status
+ *
+ * @return
+ */
+ virtual TBool IsHeadsetConnectedL() const = 0;
+
+ /**
+ * Returns current Voice UI state.
+ *
+ * @return ETrue if Voice UI is active, EFalse otherwise
+ */
+ virtual TBool IsVoiceUiActive() const = 0;
+
+ };
+
+#endif // CRADIOSYSTEMEVENTCOLLECTOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/mradioaudioroutingobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MRADIOAUDIOROUTINGOBSERVER_H
+#define MRADIOAUDIOROUTINGOBSERVER_H
+
+#include "radioenginedef.h"
+
+/**
+ * Interface for observing audio routing events.
+ *
+ * Implementer will be notified when audio routing changes
+ * between IHF and headset.
+ *
+ */
+NONSHARABLE_CLASS( MRadioAudioRoutingObserver )
+ {
+public:
+
+ /**
+ * Notifies of a requested audio routing change. Changes requested
+ * by other applications do not generate a notification.
+ *
+ * @param aRoute Current audio route
+ */
+ virtual void AudioRouteChangedL( RadioEngine::TRadioAudioRoute aRoute ) = 0;
+
+ };
+
+#endif // MRADIOAUDIOROUTINGOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/mradiocontroleventobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MRADIOCONTROLEVENTOBSERVER_H
+#define MRADIOCONTROLEVENTOBSERVER_H
+
+// System includes
+#include <e32std.h>
+
+// User includes
+#include "radioenginedef.h"
+
+/**
+ * MRadioControlEventObserver
+ *
+ * MRadioControlEventObserver defines observer interface for radio engine control events.
+ */
+NONSHARABLE_CLASS( MRadioControlEventObserver )
+ {
+public:
+
+ /**
+ * Called when "step to channel" request occurs.
+ *
+ * @param aDirection If ERadioUp steps up, otherwise steps down
+ */
+ virtual void StepToChannelL( RadioEngine::TRadioTuneDirection aDirection ) = 0;
+
+ /**
+ * Called when "set channel" request occurs.
+ *
+ * @param aChannelId Channel id to set
+ */
+ virtual void SetChannelL( TInt aChannelId ) = 0;
+
+ /**
+ * Called when "seek" request occurs.
+ *
+ * @param aDirection If ERadioUp seeks up, otherwise seeks down
+ */
+ virtual void SeekL( RadioEngine::TRadioTuneDirection aDirection ) = 0;
+
+ /**
+ * Called when "step to frequency up" request occurs.
+ *
+ * @param aDirection If ERadioUp steps up, otherwise steps down
+ */
+ virtual void StepToFrequencyL( RadioEngine::TRadioTuneDirection aDirection ) = 0;
+
+ /**
+ * Called when "set frequency" request occurs.
+ *
+ * @param aFreq Frequency to set
+ */
+ virtual void SetFrequencyL( TUint32 aFreq ) = 0;
+
+ /**
+ * Called when "adjust volume" request occurs.
+ *
+ * @param aDirection If ERadioDecVolume decreases, otherwise increases
+ * volume
+ */
+ virtual void AdjustVolumeL( RadioEngine::TRadioVolumeSetDirection aDirection ) = 0;
+
+ /**
+ * Called when "mute" request occurs.
+ *
+ * @param aMute if ETrue mutes, else unmutes radio
+ */
+ virtual void MuteL( TBool aMute ) = 0;
+
+ /**
+ * Called when "play" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void PlayL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "pause" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void PauseL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "play", "pause" or "pauseplay" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void PausePlayL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "stop" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void StopL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "forward" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void ForwardL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "fast forward" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void FastForwardL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "backward" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void BackwardL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "rewind" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void RewindL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "channel up" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void ChannelUpL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "channel down" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void ChannelDownL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "volume up" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void VolumeUpL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "volume down" request occurs.
+ *
+ * @param aDownPressed If ETrue, button is down. If EFalse, button is up.
+ */
+ virtual void VolumeDownL( TBool aDownPressed ) = 0;
+
+ /**
+ * Called when "change view" request occurs
+ *
+ * @param aViewId the id of activated view
+ * @param aForceChange if ETrue, view changing is forced and state
+ * of visual radio is not checked
+ */
+ virtual void ChangeViewL( TUid aViewId, TBool aForceChange ) = 0;
+
+ /**
+ * Called when audio route is changed
+ * @param aRoute the current audio route
+ */
+ virtual void SetAudioRouteL( RadioEngine::TRadioAudioRoute aRoute ) = 0;
+
+ /**
+ * Called when headset button answer/end call is pressed
+ */
+ virtual void AnswerEndCallL() = 0;
+
+ };
+
+#endif // MRADIOCONTROLEVENTOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/mradioenginelogger.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef M_RADIOENGINELOGGER_H
+#define M_RADIOENGINELOGGER_H
+
+#include <e32std.h>
+
+_LIT( KMarkerEngine, "RadioEngine:" );
+_LIT( KMarkerUi, "RadioUI: " );
+
+/**
+ * Common interface for logger types.
+ */
+NONSHARABLE_CLASS( MRadioEngineLogger )
+ {
+
+public:
+
+ IMPORT_C static MRadioEngineLogger* Logger();
+
+ /**
+ * Clear the log.
+ */
+ virtual MRadioEngineLogger& ClearLog() = 0;
+
+ /**
+ * Adds a 8-bit string to log line
+ */
+ virtual MRadioEngineLogger& Add( const TDesC8& aMsg ) = 0;
+
+ /**
+ * Adds a 16-bit string to log line
+ */
+ virtual MRadioEngineLogger& Add( const TDesC& aMsg ) = 0;
+
+ /**
+ * Adds a TInt to log line
+ */
+ virtual MRadioEngineLogger& Add( TInt aInt ) = 0;
+
+ /**
+ * Adds a TReal to log line
+ */
+ virtual MRadioEngineLogger& Add( const TReal& aReal ) = 0;
+
+ /**
+ * Adds a c-style string to log line
+ */
+ virtual MRadioEngineLogger& Add( const char* aText ) = 0;
+
+ /**
+ * Adds a pointer value to log line
+ */
+ virtual MRadioEngineLogger& Add( const TAny* aPtr ) = 0;
+
+ /**
+ * Adds a timestamp of current time to log line
+ */
+ virtual MRadioEngineLogger& Add( const TTime& aTime ) = 0;
+
+ /**
+ * Adds a timestamp of current time to log line
+ */
+ virtual MRadioEngineLogger& AddTimestamp() = 0;
+
+ /**
+ * Adds a formatted string to log line
+ */
+ virtual MRadioEngineLogger& AddFormat( TRefByValue<const TDesC> aFmt, ... ) = 0;
+
+ /**
+ * Adds the line indentation to log line
+ */
+ virtual MRadioEngineLogger& AddIndent( const TDesC& aMarker ) = 0;
+
+ /**
+ * Adds the line indentation to log line
+ */
+ virtual MRadioEngineLogger& AddIndentClear( const TDesC& aMarker ) = 0;
+
+ /**
+ * Increment indentation
+ */
+ virtual MRadioEngineLogger& IncIndent() = 0;
+
+ /**
+ * Decrement indentation
+ */
+ virtual MRadioEngineLogger& DecIndent() = 0;
+
+ /**
+ * Commits the log line to file and RDebug and resets internal buffer
+ * @param aNewLine ETrue if newline is to be added, EFalse if not
+ */
+ virtual MRadioEngineLogger& Commit( TBool aNewLine = ETrue ) = 0;
+
+ };
+
+#endif // M_RADIOENGINELOGGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/mradiorepositoryentityobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef M_RADIOREPOSITORYENTITYOBSERVER_H
+#define M_RADIOREPOSITORYENTITYOBSERVER_H
+
+/**
+ * Entity observer interface.
+ */
+NONSHARABLE_CLASS( MRadioRepositoryEntityObserver )
+ {
+
+public:
+
+ /**
+ * Invoked when the observed entity's value is changed.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param aValue The new value of the entity.
+ * @param aError One of the standard system error codes.
+ */
+ virtual void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError ) = 0;
+
+ /**
+ * Invoked when the observed entity's value is changed.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param aValue The new value of the entity.
+ * @param aError One of the standard system error codes.
+ */
+ virtual void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, const TReal& aValue, TInt aError ) = 0;
+
+ /**
+ * Invoked when the observed entity's value is changed.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param aValue The new value of the entity.
+ * @param aError One of the standard system error codes.
+ */
+ virtual void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, const TDesC8& aValue, TInt aError ) = 0;
+
+ /**
+ * Invoked when the observed entity's value is changed.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param aValue The new value of the entity.
+ * @param aError One of the standard system error codes.
+ */
+ virtual void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, const TDesC16& aValue, TInt aError ) = 0;
+
+ };
+
+#endif // M_RADIOREPOSITORYENTITYOBSERVER_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/mradiosystemeventobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MRADIOSYSTEMEVENTOBSERVER_H
+#define MRADIOSYSTEMEVENTOBSERVER_H
+
+// Data types
+
+/** Type of system event */
+enum TRadioSystemEventType
+ {
+ ERadioHeadsetConnected, ///< Headset was connected
+ ERadioHeadsetDisconnected, ///< Headset was disconnected
+ ERadioNetworkCoverageUp, ///< Network coverage detected
+ ERadioNetworkCoverageDown, ///< Network coverage lost
+ ERadioCallActivated, ///< Call activated or ringing
+ ERadioCallDeactivated, ///< Call disconnected
+ ERadioEmergencyCallActivated, ///< Call activated or ringing
+ ERadioEmergencyCallDeactivated, ///< Call disconnected
+ ERadioLowDiskSpace, ///< Low disk space
+ ERadioAudioRouteHeadset, ///< Audio routed through headset
+ ERadioAudioRouteSpeaker, ///< Audio routed through speaker ( IHF )
+ ERadioAudioResourcesAvailable, ///< Audio resources have become available
+ ERadioAudioAutoResumeForbidden ///< Audio auto resuming is forbidden
+ };
+
+
+/**
+ * Observer for any system event state change.
+ */
+NONSHARABLE_CLASS( MRadioSystemEventObserver )
+ {
+public:
+
+ /**
+ * Called when system event occurs.
+ * @param aEventType Type of the event
+ */
+ virtual void HandleSystemEventL( TRadioSystemEventType aEventType ) = 0;
+
+ };
+
+#endif // MRADIOSYSTEMEVENTOBSERVER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/radioengine.hrh Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOENGINE_HRH
+#define RADIOENGINE_HRH
+
+/** Regions*/
+enum TRadioRegion
+ {
+ ERadioRegionNone = -1,
+ ERadioRegionDefault,
+ ERadioRegionJapan,
+ ERadioRegionAmerica,
+ ERadioRegionPoland
+ };
+
+#endif // RADIOENGINE_HRH
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/radioenginedef.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOENGINEDEF_H_
+#define RADIOENGINEDEF_H_
+
+namespace RadioEngine
+ {
+
+ /**
+ * Output sources.
+ */
+ enum TRadioAudioRoute
+ {
+ ERadioHeadset = 0, /**< Headset in use. */
+ ERadioSpeaker = 1 /**< Speaker in use. */
+ };
+
+ /** Direction of tuning */
+ enum TRadioTuneDirection
+ {
+ ERadioDown,
+ ERadioUp
+ };
+
+ /** Direction when setting the volume */
+ enum TRadioVolumeSetDirection
+ {
+ ERadioDecVolume,
+ ERadioIncVolume
+ };
+
+ /** Audio mode */
+ enum TRadioAudioMode
+ {
+ ERadioStereo = 0,
+ ERadioMono
+ };
+
+ /** Seeking state */
+ enum TRadioSeeking
+ {
+ ERadioNotSeeking,
+ ERadioSeekingUp,
+ ERadioSeekingDown,
+ };
+
+ enum TRadioFrequencyEventReason
+ {
+ ERadioFrequencyEventReasonUnknown, // Default reason
+ ERadioFrequencyEventReasonNext, // Step to next preset
+ ERadioFrequencyEventReasonPrevious, // Step to previous preset
+ ERadioFrequencyEventReasonUp, // Tune or step to higher frequency
+ ERadioFrequencyEventReasonDown, // Tune or step to lower frequency
+ ERadioFrequencyEventReasonImplicit, // Event originated by radio component
+ ERadioFrequencyEventReasonDummy // Dummy event, doesn't cause any actions
+ };
+ }
+
+#endif // RADIOENGINEDEF_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/radioengineutils.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOENGINEUTILS_H
+#define RADIOENGINEUTILS_H
+
+// System includes
+#include <e32std.h>
+
+// User includes
+
+// Forward declarations
+class MRadioEngineLogger;
+class CCoeEnv;
+class RFs;
+
+/**
+ * System utility collection class.
+ */
+class RadioEngineUtils
+ {
+
+public:
+
+ IMPORT_C static void InitializeL( CCoeEnv* aCoeEnv = NULL );
+
+ IMPORT_C static void Release();
+
+ IMPORT_C static MRadioEngineLogger* Logger();
+
+ /**
+ * Return the cone environment
+ *
+ * @return Pointer to CCoeEnv
+ */
+ IMPORT_C static CCoeEnv* Env();
+
+ /**
+ * Returns the file server session
+ *
+ * @return Reference to file server session
+ */
+ IMPORT_C static RFs& FsSession();
+
+ /**
+ * Converts a frequency to a descriptor format.
+ * Returned descriptor is left in CleanupStack.
+ *
+ * @param aFreq Frequency, in kilohertz, to convert.
+ * @param aDecimalCount Decimal count to use.
+ * @param aResourceId Resource ID of the format string, or <code>KErrNotFound</code> if no such resource is to be used.
+ * @return The formatted descriptor. Ownership is transferred.
+ */
+ IMPORT_C static HBufC* ReadFrequencyStringLC( TUint32 aFreq, TInt aDecimalCount, TInt aResourceId = KErrNotFound );
+
+ /**
+ * Writes formatted frequency to a give descriptor.
+ *
+ * @param aDest Destination descriptor.
+ * @param aFreq Frequency, in kilohertz, to convert.
+ * @param aDecimalCount Decimal count to use.
+ * @param aFormat Format read from resource.
+ */
+ IMPORT_C static void FormatFrequencyString( TDes& aDest, TUint32 aFreq, TInt aDecimalCount, TDesC& aFormat );
+
+ };
+
+#endif // RADIOENGINEUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/radiointernalcrkeys.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOINTERNALCRKEYS_H
+#define RADIOINTERNALCRKEYS_H
+
+#include <e32cmn.h>
+
+/** The UID of the category we use. Must be the same as Visual Radio's UID3 ( SID ). */
+const TUid KRadioCRUid = { 0x101FF976 };
+
+/**
+* The service mode of Visual Radio.
+*
+* @see TVRCRServiceMode
+*/
+const TUint32 KRadioCRServiceMode = 0x00000000;
+
+/**
+* Possible Visual Radio service modes.
+*/
+enum TVRCRServiceMode
+ {
+ EVRCRServiceNone, /**< Visual Radio has neither SDS nor visual service enabled. */
+ EVRCRServiceSds, /**< Visual Radio has SDS service enabled. */
+ };
+
+/////////////////////////////////////////////////////////////////////////////////////
+// When adding a new key, add it also to CVRRepositoryManager::CheckRepositoryKeysL()
+// to make sure that SIS installation updates cenrep keys.
+/////////////////////////////////////////////////////////////////////////////////////
+
+// APPLICATION SETTINGS
+
+/** The base value for application setting keys. */
+const TUint32 KRadioCRApplicationSettingsBase = { 0x00000010 };
+
+/** The key associated with the active focus location setting. */
+const TUint32 KRadioCRActiveFocusLocation = { KRadioCRApplicationSettingsBase + 0x00000000 };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved1 = { KRadioCRApplicationSettingsBase + 0x00000001 };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved2 = { KRadioCRApplicationSettingsBase + 0x00000002 };
+
+/** The key associated with the http cache limit setting. */
+const TUint32 KRadioCRUiFlags = { KRadioCRApplicationSettingsBase + 0x00000003 };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved3 = { KRadioCRApplicationSettingsBase + 0x00000004 };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved4 = { KRadioCRApplicationSettingsBase + 0x00000005 };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved5 = { KRadioCRApplicationSettingsBase + 0x00000006 };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved6 = { KRadioCRApplicationSettingsBase + 0x00000007 };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved7 = { KRadioCRApplicationSettingsBase + 0x0000000B };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved8 = { KRadioCRApplicationSettingsBase + 0x0000000C };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved9 = { KRadioCRApplicationSettingsBase + 0x0000000D };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved10 = { KRadioCRApplicationSettingsBase + 0x0000000E };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved11 = { KRadioCRApplicationSettingsBase + 0x0000000F };
+
+/* The key associated with the application launch count setting */
+const TUint32 KRadioCRLaunchCount = { KRadioCRApplicationSettingsBase + 0x00000010 };
+
+/* The key associated with the application offline mode usability. */
+const TUint32 KRadioCROfflineModeFunctionality = { KRadioCRApplicationSettingsBase + 0x00000011 };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved12 = { KRadioCRApplicationSettingsBase + 0x00000012 };
+
+/* User audio history */
+const TUint32 KRadioCRAudioPlayHistory = { KRadioCRApplicationSettingsBase + 0x00000014 };
+
+
+/**
+* Removed. Do not use.
+*/
+enum TVRCRRemoved
+ {
+ EVRCRRemoved13,
+ EVRCRRemoved14
+ };
+
+
+// RADIO SETTINGS
+
+/** The base value for radio setting keys. */
+const TUint32 KRadioCRRadioSettingsBase = { 0x00000100 };
+
+/** The key associated with the headset volume setting. */
+const TUint32 KRadioCRHeadsetVolume = { KRadioCRRadioSettingsBase + 0x00000000 };
+
+/** The key associated with the speaker volume setting. */
+const TUint32 KRadioCRSpeakerVolume = { KRadioCRRadioSettingsBase + 0x00000001 };
+
+/** The key associated with the output mode setting. */
+const TUint32 KRadioCROutputMode = { KRadioCRRadioSettingsBase + 0x00000002 };
+
+/** The key associated with the audio route setting. */
+const TUint32 KRadioCRAudioRoute = { KRadioCRRadioSettingsBase + 0x00000003 };
+
+/** The key associated with the headset volume mute setting. */
+const TUint32 KRadioCRHeadsetMuteState = { KRadioCRRadioSettingsBase + 0x00000004 };
+
+/** The key associated with the speaker volume mute setting. */
+const TUint32 KRadioCRSpeakerMuteState = { KRadioCRRadioSettingsBase + 0x00000005 };
+
+/** The key associated with the radio power state. */
+const TUint32 KRadioCRVisualRadioPowerState = { KRadioCRRadioSettingsBase + 0x00000006 };
+
+/** The key associated with the tuned frequency setting. */
+const TUint32 KRadioCRTunedFrequency = { KRadioCRRadioSettingsBase + 0x00000007 };
+
+/** The key associated with the default minimum volume level setting. */
+const TUint32 KRadioCRDefaultMinVolumeLevel = { KRadioCRRadioSettingsBase + 0x00000008 };
+
+/** The key associated with the current region setting. */
+const TUint32 KRadioCRCurrentRegion = { KRadioCRRadioSettingsBase + 0x0000000A };
+
+/** Removed. Do not use. */
+const TUint32 KRadioCRRemoved15 = { KRadioCRRadioSettingsBase + 0x0000000B };
+
+/** The key associated with the RDS support setting */
+const TUint32 KRadioCRRdsSupport = { KRadioCRRadioSettingsBase + 0x0000000C };
+
+/** The key associated with the alternate frequency search setting */
+const TUint32 KRadioCRRdsAfSearch = { KRadioCRRadioSettingsBase + 0x0000000D };
+
+/*** Region Japan allowed. */
+const TUint32 KRadioCRRegionAllowedJapan = { KRadioCRRadioSettingsBase + 0x0000000E };
+
+/*** Region America allowed. */
+const TUint32 KRadioCRRegionAllowedAmerica = { KRadioCRRadioSettingsBase + 0x0000000F };
+
+/*** Region Other allowed. */
+const TUint32 KRadioCRRegionAllowedDefault = { KRadioCRRadioSettingsBase + 0x00000010 };
+
+/*** Default region. */
+const TUint32 KRadioCRDefaultRegion = { KRadioCRRadioSettingsBase + 0x00000011 };
+
+
+// PRESET SETTINGS
+
+/** The base value for preset setting keys. */
+const TUint32 KRadioCRPresetSettingsBase = { 0x00001000 };
+
+/** The key associated with the maximum preset count setting. */
+const TUint32 KRadioCRPresetCount = { KRadioCRPresetSettingsBase + 0x00000000 };
+
+// CORE SETTINGS
+
+/** The base value for core setting keys. */
+const TUint32 KRadioCRCoreSettingsBase = { 0x00010000 };
+
+/** The key associated with the global name server address setting. */
+const TUint32 KRadioCRGlobalNameServer = { KRadioCRCoreSettingsBase + 0x00000000 };
+
+/** The key associated with the default global name server address setting. */
+const TUint32 KRadioCRDefaultGlobalNameServer = { KRadioCRCoreSettingsBase + 0x00000001 };
+
+/** The key associated with the local name server address setting. */
+const TUint32 KRadioCRLocalNameServer = { KRadioCRCoreSettingsBase + 0x00000002 };
+
+/** The key associated with the default local name server address setting. */
+const TUint32 KRadioCRDefaultLocalNameServer = { KRadioCRCoreSettingsBase + 0x00000003 };
+
+/** The key associated with the directory server url setting. */
+const TUint32 KRadioCRDirectoryServerUrl = { KRadioCRCoreSettingsBase + 0x00000004 };
+
+/** The key associated with the directory server base url setting. */
+const TUint32 KRadioCRDirectoryServerBaseUrl = { KRadioCRCoreSettingsBase + 0x00000005 };
+
+/** The key associated with the directory server country code setting. */
+const TUint32 KRadioCRDirectoryServerCountryCode = { KRadioCRCoreSettingsBase + 0x00000006 };
+
+/** The key associated with the directory server network id setting. */
+const TUint32 KRadioCRDirectoryServerNetworkId = { KRadioCRCoreSettingsBase + 0x00000007 };
+
+/** The key associated with the default directory server url setting. */
+const TUint32 KRadioCRDefaultDirectoryServerUrl = { KRadioCRCoreSettingsBase + 0x00000008 };
+
+/** The key associated with the default directory server base url setting. */
+const TUint32 KRadioCRDefaultDirectoryServerBaseUrl = { KRadioCRCoreSettingsBase + 0x00000009 };
+
+/** The key associated with the internet access point setting. */
+const TUint32 KRadioCRInternetAccessPoint = { KRadioCRCoreSettingsBase + 0x0000000A };
+
+/** The key associated with the default internet access point setting. */
+const TUint32 KRadioCRDefaultInternetAccessPoint = { KRadioCRCoreSettingsBase + 0x0000000B };
+
+/** The key associated with application id setting. */
+const TUint32 KRadioCRApplicationId = { KRadioCRCoreSettingsBase + 0x0000000C };
+
+/** The key associated with the network id setting. */
+const TUint32 KRadioCRNetworkId = { KRadioCRCoreSettingsBase + 0x0000000D };
+
+/** The key associated with the subscriber id setting. */
+const TUint32 KRadioCRSubscriberId = { KRadioCRCoreSettingsBase + 0x0000000E };
+
+/** The key associated with the connection destination setting. */
+const TUint32 KRadioCRConnectionDestinationId = { KRadioCRCoreSettingsBase + 0x0000000F };
+
+/** The key associated with the country code setting. */
+const TUint32 KRadioCRCountryCode = { KRadioCRCoreSettingsBase + 0x00000010 };
+
+#endif // RADIOINTERNALCRKEYS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/radiointernalpskeys.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,354 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOINTERNALPSKEYS_H
+#define RADIOINTERNALPSKEYS_H
+
+#include <e32cmn.h>
+
+#include "radiouid.hrh"
+
+/**< The UID of the category we use. Must be the same as Visual Radio's UID3 ( SID ). */
+//TODO: Change
+const TUid KRadioPSUid = {0x101FF976};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ///
+/// Data properties. These properties are published by Visual Radio and used by other applications. ///
+/// ///
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+* Currently active channel's ID.
+* Value <code>KErrNone</code> means that no preset channel is active.
+* Type <code>RProperty::EInt</code>.
+*/
+const TUint32 KRadioPSDataChannel = 0x00000000;
+
+/**
+* Currently active frequency.
+* Frequency unit is in kHz.
+* Type <code>RProperty::EInt</code>.
+*/
+const TUint32 KRadioPSDataFrequency = 0x00000001;
+
+/**
+* Current power state of the radio.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioRadioPowerState.
+*/
+const TUint32 KRadioPSDataRadioPowerState = 0x00000002;
+
+/**
+* Power state of the radio.
+*/
+enum TRadioPSRadioPowerState
+ {
+ ERadioPSRadioPowerStateUninitialized, /**< The key is not yet initialized. */
+ ERadioPSRadioPowerOn, /**< Radio power on. */
+ ERadioPSRadioPowerOff /**< Radio power off. */
+ };
+
+/**
+* Current volume level.
+* Scale is from 1-10.
+* Type <code>RProperty::EInt</code>.
+*/
+const TUint32 KRadioPSDataVolume = 0x00000003;
+
+/**
+* Changing of this value means that channel
+* data of specified channel ID has changed.
+* The value remains indicating the last changed channel ID.
+* Value <code>KErrNone</code> means that no channel data has been changed yet.
+* Type <code>RProperty::EInt</code>.
+*/
+const TUint32 KRadioPSDataChannelDataChanged = 0x00000004;
+
+/**
+ * Removed. Do not use.
+ */
+const TUint32 KRadioPSDataRemoved = 0x00000005;
+
+/**
+* The current tuning state.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioPSTuningState.
+*/
+const TUint32 KRadioPSDataTuningState = 0x00000006;
+
+/**
+* Possible tuning states.
+*/
+enum TRadioPSTuningState
+ {
+ ERadioPSTuningUninitialized, /**< Currently not tuning. */
+ ERadioPSTuningStarted, /**< Tuning has been started an lasted less than one second. */
+ ERadioPSTuningContinues /**< Tuning has taken more than one second. */
+ };
+
+/**
+* Current mute state of radio.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioPSRadioMuteState.
+*/
+const TUint32 KRadioPSDataRadioMuteState = 0x00000007;
+
+/**
+* Mute state of radio.
+*/
+enum TRadioPSRadioMuteState
+ {
+ ERadioPSMuteStateUninitialized, /**< The key has not yet been initialized. */
+ ERadioPSMuteStateOn, /**< Radio mute state is on. */
+ ERadioPSMuteStateOff /**< Radio mute state is off. */
+ };
+
+/**
+* Indicates if Visual Radio is running or closing.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioPSApplicationRunningState.
+*/
+const TUint32 KRadioPSDataApplicationRunning = 0x00000008;
+
+/**
+* Visual Radio application running states.
+*/
+enum TRadioPSApplicationRunningState
+ {
+ ERadioPSApplicationUninitialized, /**< Visual Radio application's state is not yet initialized. */
+ ERadioPSApplicationRunning, /**< Visual Radio application is running. */
+ ERadioPSApplicationClosing /**< Visual Radio application is closing. */
+ };
+
+/**
+* Indicates the current headset connectivity status.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioHeadsetStatus
+*/
+const TUint32 KRadioPSDataHeadsetStatus = 0x00000009;
+
+/**
+* Current headset status.
+*/
+enum TRadioPSHeadsetStatus
+ {
+ ERadioPSHeadsetUninitialized, /**< The headset status is uninitialized. */
+ ERadioPSHeadsetDisconnected, /**< The headset is disconnected. */
+ ERadioPSHeadsetConnected /**< The headset is connected. */
+ };
+
+/**
+* The current frequency decimal count.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioFrequencyDecimalCount.
+*/
+const TUint32 KRadioPSDataFrequencyDecimalCount = 0x00000010;
+
+/**
+* The current frequency decimal count.
+*/
+enum TRadioPSFrequencyDecimalCount
+ {
+ ERadioPSFrequencyDecimalCountUninitialized, /**< Frequency decimal count has not yet been initialized. */
+ ERadioPSFrequencyOneDecimal, /**< Frequency accuracy is one decimal. */
+ ERadioPSFrequencyTwoDecimals, /**< Frequency accuracy is two decimals. */
+ ERadioPSFrequencyThreeDecimals /**< Frequency accuracy is three decimals. */
+ };
+
+/**
+* Removed. Do not use.
+*/
+const TUint32 KRadioPSRemoved1 = 0x00000014;
+
+/**
+* Flag to indicate if loudspeaker is in use
+*/
+const TUint32 KRadioPSDataLoudspeakerStatus = 0x00000015;
+/**
+* Current speaker status.
+*/
+enum TRadioPSLoudspeakerStatus
+ {
+ ERadioPSLoudspeakerUninitialized, /**< The speaker status is uninitialized. */
+ ERadioPSLoudspeakerNotInUse, /**< The speaker is not in use. */
+ ERadioPSLoudpeakerInUse /**< The speaker is in use. */
+ };
+
+/**
+* Rds Program Service information, property type is text.
+*/
+const TUint32 KRadioPSDataRdsProgramService = 0x00000016;
+
+/**
+* Rds Radio Text information.
+* Type <code>RProperty::EText</code>.
+*/
+const TUint32 KRadioPSDataRdsRadioText = 0x00000017;
+
+/**
+ * Name of the current channel.
+ * Type <code>RProperty::EText</code>.
+ */
+const TUint32 KRadioPSDataChannelName = 0x00000018;
+
+/**
+* The amount of presets in active preset list.
+* In situations where the amount is undefined, value KErrNotFound
+* is used.
+* Type <code>RProperty::EInt</code>.
+*/
+const TUint32 KRadioPSDataActivePresetListCount = 0x00000019;
+
+/**
+* The active focus in active preset list.
+* In situations where the amount is undefined, value KErrNotFound
+* is used.
+* Type <code>RProperty::EInt</code>.
+*/
+const TUint32 KRadioPSDataActivePresetListFocus = 0x00000020;
+
+/**
+ * Current antenna state of the radio.
+ * Type <code>RProperty::EInt</code>.
+ * @see TRadioRadioAntennaState.
+ */
+const TUint32 KRadioPSDataRadioAntennaState = 0x00000021;
+
+/**
+* Power state of the radio.
+*/
+enum TRadioPSRadioAntennaState
+ {
+ ERadioPSRadioAntennaStateUninitialized, /**< The key is not yet initialized. */
+ ERadioPSRadioAntennaAttached, /**< Antenna attached. */
+ ERadioPSRadioAntennaDetached /**< Antenna detached. */
+ };
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ///
+/// Control properties. These properties are published by other applications and used by Visual Radio. ///
+/// ///
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+* Steps up or down a channel in channel list.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioPSStepToChannel.
+*/
+const TUint32 KRadioPSControlStepToChannel = 0x00001000;
+
+/**
+* Step direction of channel step.
+*/
+enum TRadioPSStepToChannel
+ {
+ ERadioPSStepToChannelUninitialized, /**< Value of the key has not yet been initialized. */
+ ERadioPSStepToChannelUp, /**< Step to next channel up. */
+ ERadioPSStepToChannelDown /**< Step to next channel down. */
+ };
+
+/**
+* Switches to the specified channel ID.
+* Visual Radio ignores channel IDs that are out of scope.
+* Type <code>RProperty::EInt</code>.
+*/
+const TUint32 KRadioPSControlSetChannel = 0x00001001;
+
+/**
+* Seeks to next active frequency up or down.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioPSSeek.
+*/
+const TUint32 KRadioPSControlSeek = 0x00001002;
+
+/**
+* Seek direction.
+*/
+enum TRadioPSSeek
+ {
+ ERadioPSSeekUninitialized, /**< Value of the key has not yet been initialized. */
+ ERadioPSSeekUp, /**< Seek up. */
+ ERadioPSSeekDown /**< Seek down. */
+ };
+
+/**
+* Steps up or down frequency, using the frequency step that is defined in radio.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioPSStepToFrequency.
+*/
+const TUint32 KRadioPSControlStepToFrequency = 0x00001003;
+
+/**
+* Frequency step direction.
+*/
+enum TRadioPSStepToFrequency
+ {
+ ERadioPSStepToFrequencyUninitialized, /**< The key has not yet been initialized. */
+ ERadioPSStepToFrequencyUp, /**< Step up a frequency. */
+ ERadioPSStepToFrequencyDown /**< Step down a frequency. */
+ };
+
+/**
+* Switches to specified frequency.
+* Frequency unit is kHz.
+* Type <code>RProperty::EInt</code>.
+*/
+const TUint32 KRadioPSControlSetFrequency = 0x00001004;
+
+/**
+* Increases or decreases volume level.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioPSAdjustVolume.
+*/
+const TUint32 KRadioPSControlAdjustVolume = 0x00001005;
+
+/**
+* Volume step direction.
+*/
+enum TRadioPSAdjustVolume
+ {
+ ERadioPSAdjustVolumeUninitialized = 0, /**< The key has not yet been initialized. */
+ ERadioPSIncreaseVolume, /**< Increase volume. */
+ ERadioPSDecreaseVolume /**< Decrease volume. */
+ };
+
+/**
+* Sets mute state on or off.
+* Type <code>RProperty::EInt</code>.
+* @see TRadioPSRadioMuteState.
+*/
+const TUint32 KRadioPSControlSetRadioMuteState = 0x00001006;
+
+/**
+* Sets the output source
+* Type <code>RProperty::EInt</code>.
+* @see TRadioPSAudioOutput
+*/
+const TUint32 KRadioPSControlSetAudioOutput = 0x00001008;
+
+/**
+ * Audio output target.
+ */
+enum TRadioPSAudioOutput
+ {
+ ERadioPSAudioOutputUninitialized = 0, /**< The key has not yet been initialized. */
+ ERadioPSAudioOutputHeadset, /**< Headset in use. */
+ ERadioPSAudioOutputSpeaker /**< Speaker in use. */
+ };
+
+#endif // RADIOINTERNALPSKEYS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/api/radiouid.hrh Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef RADIOUID_HRH
+#define RADIOUID_HRH
+
+//TODO: Get uid. this is from visual radio
+#define KUidRadioApplication 0x101FF976
+
+#endif // RADIOUID_HRH
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/bwins/radioengineutilsu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,43 @@
+EXPORTS
+ ??0CRadioRoutableAudio@@QAE@PAVCRadioAudioRouter@@@Z @ 1 NONAME ; CRadioRoutableAudio::CRadioRoutableAudio(class CRadioAudioRouter *)
+ ??0TRadioMethodLogger@@QAE@PBG0@Z @ 2 NONAME ; TRadioMethodLogger::TRadioMethodLogger(unsigned short const *, unsigned short const *)
+ ??1CRadioAudioRouter@@UAE@XZ @ 3 NONAME ; CRadioAudioRouter::~CRadioAudioRouter(void)
+ ??1CRadioPubSub@@UAE@XZ @ 4 NONAME ; CRadioPubSub::~CRadioPubSub(void)
+ ??1CRadioRepositoryManager@@UAE@XZ @ 5 NONAME ; CRadioRepositoryManager::~CRadioRepositoryManager(void)
+ ??1CRadioRoutableAudio@@UAE@XZ @ 6 NONAME ; CRadioRoutableAudio::~CRadioRoutableAudio(void)
+ ??1CRadioSystemEventCollector@@UAE@XZ @ 7 NONAME ; CRadioSystemEventCollector::~CRadioSystemEventCollector(void)
+ ??1TRadioMethodLogger@@QAE@XZ @ 8 NONAME ; TRadioMethodLogger::~TRadioMethodLogger(void)
+ ?ActivateL@CRadioPropertyObserver@@QAEXXZ @ 9 NONAME ; void CRadioPropertyObserver::ActivateL(void)
+ ?AudioRoutingSupported@CRadioRoutableAudio@@QBEHXZ @ 10 NONAME ; int CRadioRoutableAudio::AudioRoutingSupported(void) const
+ ?DeleteAudioOutput@CRadioRoutableAudio@@IAEXXZ @ 11 NONAME ; void CRadioRoutableAudio::DeleteAudioOutput(void)
+ ?Env@RadioEngineUtils@@SAPAVCCoeEnv@@XZ @ 12 NONAME ; class CCoeEnv * RadioEngineUtils::Env(void)
+ ?FormatFrequencyString@RadioEngineUtils@@SAXAAVTDes16@@KHAAVTDesC16@@@Z @ 13 NONAME ; void RadioEngineUtils::FormatFrequencyString(class TDes16 &, unsigned long, int, class TDesC16 &)
+ ?FsSession@RadioEngineUtils@@SAAAVRFs@@XZ @ 14 NONAME ; class RFs & RadioEngineUtils::FsSession(void)
+ ?GetRepositoryValueL@CRadioRepositoryManager@@SAXABVTUid@@KAAH@Z @ 15 NONAME ; void CRadioRepositoryManager::GetRepositoryValueL(class TUid const &, unsigned long, int &)
+ ?GetRepositoryValueL@CRadioRepositoryManager@@SAXABVTUid@@KAAN@Z @ 16 NONAME ; void CRadioRepositoryManager::GetRepositoryValueL(class TUid const &, unsigned long, double &)
+ ?GetRepositoryValueL@CRadioRepositoryManager@@SAXABVTUid@@KAAVTDes16@@@Z @ 17 NONAME ; void CRadioRepositoryManager::GetRepositoryValueL(class TUid const &, unsigned long, class TDes16 &)
+ ?GetRepositoryValueL@CRadioRepositoryManager@@SAXABVTUid@@KAAVTDes8@@@Z @ 18 NONAME ; void CRadioRepositoryManager::GetRepositoryValueL(class TUid const &, unsigned long, class TDes8 &)
+ ?InitializeL@RadioEngineUtils@@SAXPAVCCoeEnv@@@Z @ 19 NONAME ; void RadioEngineUtils::InitializeL(class CCoeEnv *)
+ ?Logger@MRadioEngineLogger@@SAPAV1@XZ @ 20 NONAME ; class MRadioEngineLogger * MRadioEngineLogger::Logger(void)
+ ?Logger@RadioEngineUtils@@SAPAVMRadioEngineLogger@@XZ @ 21 NONAME ; class MRadioEngineLogger * RadioEngineUtils::Logger(void)
+ ?NewL@CRadioAudioRouter@@SAPAV1@AAVMRadioAudioRoutingObserver@@@Z @ 22 NONAME ; class CRadioAudioRouter * CRadioAudioRouter::NewL(class MRadioAudioRoutingObserver &)
+ ?NewL@CRadioPropertyObserver@@SAPAV1@AAVMRadioPropertyChangeObserver@@ABVTUid@@IW4TRadioPropertyType@1@@Z @ 23 NONAME ; class CRadioPropertyObserver * CRadioPropertyObserver::NewL(class MRadioPropertyChangeObserver &, class TUid const &, unsigned int, enum CRadioPropertyObserver::TRadioPropertyType)
+ ?NewL@CRadioPubSub@@SAPAV1@XZ @ 24 NONAME ; class CRadioPubSub * CRadioPubSub::NewL(void)
+ ?NewL@CRadioRemConTarget@@SAPAV1@XZ @ 25 NONAME ; class CRadioRemConTarget * CRadioRemConTarget::NewL(void)
+ ?NewL@CRadioRepositoryManager@@SAPAV1@H@Z @ 26 NONAME ; class CRadioRepositoryManager * CRadioRepositoryManager::NewL(int)
+ ?NewL@CRadioSystemEventCollector@@SAPAV1@XZ @ 27 NONAME ; class CRadioSystemEventCollector * CRadioSystemEventCollector::NewL(void)
+ ?ReadFrequencyStringLC@RadioEngineUtils@@SAPAVHBufC16@@KHH@Z @ 28 NONAME ; class HBufC16 * RadioEngineUtils::ReadFrequencyStringLC(unsigned long, int, int)
+ ?RegisterRoutableAudio@CRadioAudioRouter@@QAEXPAVCRadioRoutableAudio@@@Z @ 29 NONAME ; void CRadioAudioRouter::RegisterRoutableAudio(class CRadioRoutableAudio *)
+ ?Release@RadioEngineUtils@@SAXXZ @ 30 NONAME ; void RadioEngineUtils::Release(void)
+ ?SetAudioOutput@CRadioRoutableAudio@@IAEXPAVCAudioOutput@@@Z @ 31 NONAME ; void CRadioRoutableAudio::SetAudioOutput(class CAudioOutput *)
+ ?SetAudioRouteL@CRadioAudioRouter@@QAEXW4TRadioAudioRoute@RadioEngine@@@Z @ 32 NONAME ; void CRadioAudioRouter::SetAudioRouteL(enum RadioEngine::TRadioAudioRoute)
+ ?SetAudioRouteL@CRadioRoutableAudio@@QAEXW4TRadioAudioRoute@RadioEngine@@@Z @ 33 NONAME ; void CRadioRoutableAudio::SetAudioRouteL(enum RadioEngine::TRadioAudioRoute)
+ ?SetRepositoryValueL@CRadioRepositoryManager@@SAXABVTUid@@KABN@Z @ 34 NONAME ; void CRadioRepositoryManager::SetRepositoryValueL(class TUid const &, unsigned long, double const &)
+ ?SetRepositoryValueL@CRadioRepositoryManager@@SAXABVTUid@@KABVTDesC16@@@Z @ 35 NONAME ; void CRadioRepositoryManager::SetRepositoryValueL(class TUid const &, unsigned long, class TDesC16 const &)
+ ?SetRepositoryValueL@CRadioRepositoryManager@@SAXABVTUid@@KABVTDesC8@@@Z @ 36 NONAME ; void CRadioRepositoryManager::SetRepositoryValueL(class TUid const &, unsigned long, class TDesC8 const &)
+ ?SetRepositoryValueL@CRadioRepositoryManager@@SAXABVTUid@@KH@Z @ 37 NONAME ; void CRadioRepositoryManager::SetRepositoryValueL(class TUid const &, unsigned long, int)
+ ?UnRegisterRoutableAudio@CRadioAudioRouter@@QAEXPAVCRadioRoutableAudio@@@Z @ 38 NONAME ; void CRadioAudioRouter::UnRegisterRoutableAudio(class CRadioRoutableAudio *)
+ ?ValueDes8@CRadioPropertyObserver@@QBEABVTDesC8@@XZ @ 39 NONAME ; class TDesC8 const & CRadioPropertyObserver::ValueDes8(void) const
+ ?ValueDes@CRadioPropertyObserver@@QBEABVTDesC16@@XZ @ 40 NONAME ; class TDesC16 const & CRadioPropertyObserver::ValueDes(void) const
+ ?ValueInt@CRadioPropertyObserver@@QBEHXZ @ 41 NONAME ; int CRadioPropertyObserver::ValueInt(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/eabi/radioengineutilsu.def Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,60 @@
+EXPORTS
+ _ZN12CRadioPubSub4NewLEv @ 1 NONAME
+ _ZN12CRadioPubSubD0Ev @ 2 NONAME
+ _ZN12CRadioPubSubD1Ev @ 3 NONAME
+ _ZN12CRadioPubSubD2Ev @ 4 NONAME
+ _ZN16RadioEngineUtils11InitializeLEP7CCoeEnv @ 5 NONAME
+ _ZN16RadioEngineUtils21FormatFrequencyStringER6TDes16miR7TDesC16 @ 6 NONAME
+ _ZN16RadioEngineUtils21ReadFrequencyStringLCEmii @ 7 NONAME
+ _ZN16RadioEngineUtils3EnvEv @ 8 NONAME
+ _ZN16RadioEngineUtils6LoggerEv @ 9 NONAME
+ _ZN16RadioEngineUtils7ReleaseEv @ 10 NONAME
+ _ZN16RadioEngineUtils9FsSessionEv @ 11 NONAME
+ _ZN17CRadioAudioRouter14SetAudioRouteLEN11RadioEngine16TRadioAudioRouteE @ 12 NONAME
+ _ZN17CRadioAudioRouter21RegisterRoutableAudioEP19CRadioRoutableAudio @ 13 NONAME
+ _ZN17CRadioAudioRouter23UnRegisterRoutableAudioEP19CRadioRoutableAudio @ 14 NONAME
+ _ZN17CRadioAudioRouter4NewLER26MRadioAudioRoutingObserver @ 15 NONAME
+ _ZN17CRadioAudioRouterD0Ev @ 16 NONAME
+ _ZN17CRadioAudioRouterD1Ev @ 17 NONAME
+ _ZN17CRadioAudioRouterD2Ev @ 18 NONAME
+ _ZN18CRadioRemConTarget4NewLEv @ 19 NONAME
+ _ZN18MRadioEngineLogger6LoggerEv @ 20 NONAME
+ _ZN18TRadioMethodLoggerC1EPKtS1_ @ 21 NONAME
+ _ZN18TRadioMethodLoggerC2EPKtS1_ @ 22 NONAME
+ _ZN18TRadioMethodLoggerD1Ev @ 23 NONAME
+ _ZN18TRadioMethodLoggerD2Ev @ 24 NONAME
+ _ZN19CRadioRoutableAudio14SetAudioOutputEP12CAudioOutput @ 25 NONAME
+ _ZN19CRadioRoutableAudio14SetAudioRouteLEN11RadioEngine16TRadioAudioRouteE @ 26 NONAME
+ _ZN19CRadioRoutableAudio17DeleteAudioOutputEv @ 27 NONAME
+ _ZN19CRadioRoutableAudioC1EP17CRadioAudioRouter @ 28 NONAME
+ _ZN19CRadioRoutableAudioC2EP17CRadioAudioRouter @ 29 NONAME
+ _ZN19CRadioRoutableAudioD0Ev @ 30 NONAME
+ _ZN19CRadioRoutableAudioD1Ev @ 31 NONAME
+ _ZN19CRadioRoutableAudioD2Ev @ 32 NONAME
+ _ZN22CRadioPropertyObserver4NewLER28MRadioPropertyChangeObserverRK4TUidjNS_18TRadioPropertyTypeE @ 33 NONAME
+ _ZN22CRadioPropertyObserver9ActivateLEv @ 34 NONAME
+ _ZN23CRadioRepositoryManager19GetRepositoryValueLERK4TUidmR5TDes8 @ 35 NONAME
+ _ZN23CRadioRepositoryManager19GetRepositoryValueLERK4TUidmR6TDes16 @ 36 NONAME
+ _ZN23CRadioRepositoryManager19GetRepositoryValueLERK4TUidmRd @ 37 NONAME
+ _ZN23CRadioRepositoryManager19GetRepositoryValueLERK4TUidmRi @ 38 NONAME
+ _ZN23CRadioRepositoryManager19SetRepositoryValueLERK4TUidmRK6TDesC8 @ 39 NONAME
+ _ZN23CRadioRepositoryManager19SetRepositoryValueLERK4TUidmRK7TDesC16 @ 40 NONAME
+ _ZN23CRadioRepositoryManager19SetRepositoryValueLERK4TUidmRKd @ 41 NONAME
+ _ZN23CRadioRepositoryManager19SetRepositoryValueLERK4TUidmi @ 42 NONAME
+ _ZN23CRadioRepositoryManager4NewLEi @ 43 NONAME
+ _ZN23CRadioRepositoryManagerD0Ev @ 44 NONAME
+ _ZN23CRadioRepositoryManagerD1Ev @ 45 NONAME
+ _ZN23CRadioRepositoryManagerD2Ev @ 46 NONAME
+ _ZN26CRadioSystemEventCollector4NewLEv @ 47 NONAME
+ _ZN26CRadioSystemEventCollectorD0Ev @ 48 NONAME
+ _ZN26CRadioSystemEventCollectorD1Ev @ 49 NONAME
+ _ZN26CRadioSystemEventCollectorD2Ev @ 50 NONAME
+ _ZNK19CRadioRoutableAudio21AudioRoutingSupportedEv @ 51 NONAME
+ _ZNK22CRadioPropertyObserver8ValueDesEv @ 52 NONAME
+ _ZNK22CRadioPropertyObserver8ValueIntEv @ 53 NONAME
+ _ZNK22CRadioPropertyObserver9ValueDes8Ev @ 54 NONAME
+ _ZTI15CRadioEngineTls @ 55 NONAME ; #<TI>#
+ _ZTI19CRadioRoutableAudio @ 56 NONAME ; #<TI>#
+ _ZTV15CRadioEngineTls @ 57 NONAME ; #<VT>#
+ _ZTV19CRadioRoutableAudio @ 58 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/group/bld.inf Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "../../group/buildflags.hrh"
+
+#ifdef COMPILE_IN_WK48_ENV
+# include <domain/osextensions/platform_paths.hrh>
+#else
+# include <platform_paths.hrh>
+#endif // COMPILE_IN_WK48_ENV
+
+PRJ_PLATFORMS
+WINSCW ARMV5
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+radioengineutils.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/group/radioengineutils.mmp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "../../group/buildflags.hrh"
+
+#ifdef COMPILE_IN_WK48_ENV
+# include <domain/osextensions/platform_paths.hrh>
+#else
+# include <platform_paths.hrh>
+#endif // COMPILE_IN_WK48_ENV
+
+#include <data_caging_paths.hrh>
+
+TARGET radioengineutils.dll
+TARGETTYPE DLL
+UID 0x1000008D 0x10281CB8
+VERSION 10.0
+
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+PAGED
+
+USERINCLUDE ../api
+USERINCLUDE ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/remcon
+SYSTEMINCLUDE /epoc32/include/internal
+SYSTEMINCLUDE /epoc32/include/mmf/common
+SYSTEMINCLUDE /epoc32/include/platform/mw
+
+SOURCEPATH ../src
+SOURCE radioengineutils.cpp
+SOURCE cradioenginetls.cpp
+SOURCE cradioroutableaudio.cpp
+SOURCE cradioaudiorouter.cpp
+SOURCE cradioaccessoryobserver.cpp
+SOURCE cradiopropertyobserver.cpp
+SOURCE cradiopubsub.cpp
+SOURCE cradiopubsubimp.cpp
+SOURCE cradioremcontarget.cpp
+SOURCE cradioremcontargetimp.cpp
+SOURCE cradiorepositoryentitybase.cpp
+SOURCE cradiorepositorymanager.cpp
+SOURCE cradiorepositorymanagerimp.cpp
+SOURCE cradiosystemeventdetector.cpp
+SOURCE cradiosystemeventcollector.cpp
+SOURCE cradiosystemeventcollectorimp.cpp
+SOURCE cradioenginelogger.cpp
+
+LIBRARY bafl.lib
+LIBRARY accclient.lib
+LIBRARY accpolicy.lib
+LIBRARY centralrepository.lib
+LIBRARY commonengine.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY cone.lib
+LIBRARY remconcoreapi.lib
+LIBRARY remconextensionapi.lib
+LIBRARY remconinterfacebase.lib
+LIBRARY featmgr.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradioaccessoryobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIOACCESSORYOBSERVER_H
+#define CRADIOACCESSORYOBSERVER_H
+
+#include <accessoryserver.h>
+#include <accessoryconnection.h>
+#include <accpolsubblocknamearray.h>
+
+class MRadioHeadsetEventObserver;
+
+/**
+ * Observer of accessory states.
+ *
+ * Instance of this class observes notifications of headset state changes.
+ * In its turn it sends notifications to its observer of those changes.
+ *
+ */
+NONSHARABLE_CLASS( CRadioAccessoryObserver ): public CActive
+ {
+public:
+
+ /**
+ * C++ default constructor.
+ */
+ CRadioAccessoryObserver();
+
+ /**
+ * Static constructor.
+ */
+ static CRadioAccessoryObserver* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CRadioAccessoryObserver();
+
+ /**
+ * Sets observer. The observer will be notified when headset has been
+ * pressed or headset is connected/disconnected.
+ *
+ * @param aObserver Observer
+ */
+ void SetObserver( MRadioHeadsetEventObserver* aObserver );
+
+ /**
+ * Tells if there is a headset connected.
+ *
+ * @return <code>ETrue </code> if headset accessory is connected,
+ * <code>EFalse</code> otherwise
+ */
+ TBool IsHeadsetConnectedL() const;
+
+// from base class CActive
+ /**
+ * From CActive
+ *
+ * @see CActive::RunL()
+ */
+ void RunL();
+
+ /**
+ * From CActive
+ *
+ * @see CActive::DoCancel()
+ */
+ void DoCancel();
+
+private:
+
+ /**
+ * Finds an accessory. All wired and bluetooth accessories are taken into account.
+ *
+ * @param aAcceptOnlyHeadset If ETrue, search is succesful only if there is a headset connected.
+ * @param aOutputType The output type of the found accessory ( private/public )
+ * @return ETrue, if suitable accessory was found, EFalse otherwise
+ */
+ TBool FindAccessoryL( TBool aAcceptOnlyHeadset, TAccAudioOutPutType& aOutputType ) const;
+
+ /**
+ * Tells whether the given accessory is a lineout ( and not a headset ).
+ *
+ * @param aAccPolGenId The accessory being investigated.
+ * @return ETrue if the accessory is a lineout, EFalse otherwise.
+ */
+ TBool IsLineoutConnectedL( TAccPolGenericID& aAccPolGenId ) const;
+
+private:
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ *
+ * @param aAccessoryServer Existing session for The Accessory Server.
+ */
+ void ConstructL();
+
+private:
+
+ /**
+ * Updates the set of known accessories.
+ * Method also informs the caller about added/removed accessories.
+ *
+ * @param aNroChangedAccessories On return contains the number of added/removed accessories.
+ */
+ void UpdateCurrentAccessoriesL( TInt& aNroChangedAccessories );
+
+ /**
+ * Counts the removed accessories.
+ *
+ * @return The number of removed accessories.
+ */
+ TInt CountRemovedAccessoriesL() const;
+
+ /**
+ * Counts the added accessories.
+ *
+ * @return The number of added accessories.
+ */
+ TInt CountAddedAccessoriesL() const;
+
+private:
+
+ /**
+ * Instance that gets notifications of the headset state changes
+ * Not owned.
+ */
+ MRadioHeadsetEventObserver* iObserver;
+
+ /**
+ * Session for The Accessory Server.
+ * Owned.
+ */
+ RAccessoryServer iAccessoryServer;
+
+ /**
+ * Accessory Connection.
+ * Owned.
+ */
+ RAccessoryConnection iAccessoryConn;
+
+ /**
+ * Known set of accessories. CRadioAccessoryObserver uses this set to deduce
+ * which accessory has been removed ( or added ) and whether or not it was an acceptable accessory.
+ * Owned.
+ */
+ RArray<TAccPolGenericID> iSavedAccessories;
+
+ /**
+ * Array of connected accessories.
+ */
+ TAccPolGenericIDArray iAccPolGenIdArr;
+
+ };
+
+#endif // CRADIOACCESSORYOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradioenginetls.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef C_RADIOENGINETLS_H
+#define C_RADIOENGINETLS_H
+
+#include <e32base.h>
+
+class MRadioEngineLogger;
+class CCoeEnv;
+class RFs;
+
+/**
+ * TLS handler
+ */
+class CRadioEngineTls : public CBase
+ {
+
+friend class RadioEngineUtils;
+
+public:
+
+ /**
+ * Returns the CRadioEngineTls instance from TLS
+ *
+ * @since Live TV UI v1.0
+ * @return Reference to CRadioEngineTls instance
+ */
+ static CRadioEngineTls& Instance();
+
+ /**
+ * Return the logger storage if logging is enabled
+ *
+ * @since Live TV UI v1.0
+ */
+ static MRadioEngineLogger* Logger();
+
+ /**
+ * Return the eikon environment
+ *
+ * @since Live TV UI v1.0
+ * @return Pointer to CEikonEnv
+ */
+ static CCoeEnv* Env();
+
+ /**
+ * Returns the file server session
+ *
+ * @since Live TV UI v1.0
+ * @return Reference to file server session
+ */
+ static RFs& FsSession();
+
+ /**
+ * Increase reference count
+ */
+ void AddRef();
+
+ /**
+ * Decrease reference count
+ * Deletes self when ref count reaches zero.
+ */
+ void Release();
+
+private:
+
+ static void InitializeL( CCoeEnv* aEnv = NULL, RFs* aFs = NULL );
+
+ CRadioEngineTls( CCoeEnv* aEnv, RFs* aFs );
+
+ ~CRadioEngineTls();
+
+ void ConstructL();
+
+#ifdef LOGGING_ENABLED
+ /**
+ * File logger
+ * Own.
+ */
+ CRadioEngineLogger* iLogger;
+#endif
+
+ /**
+ * Pointer to the eikon environment
+ * Not own.
+ */
+ CCoeEnv* iEnv;
+
+ /**
+ * Flag to indicate whether or not the file server session is owned
+ */
+ TBool iFsOwned;
+
+ /**
+ * File server session.
+ * Own status determined by iFsOwned member variable
+ */
+ RFs* iFs;
+
+ /**
+ * Reference count
+ */
+ TInt iRefs;
+
+ };
+
+#endif // C_RADIOENGINETLS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradiopropertyobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIOPROPERTYOBSERVER_H
+#define CRADIOPROPERTYOBSERVER_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+/**
+ * MRadioPropertyChangeObserver
+ *
+ * Abstract interface for handling property change events.
+ */
+class MRadioPropertyChangeObserver
+{
+
+public:
+
+ /**
+ * This is a callback function which is called when a property value of
+ * type int is changed.
+ *
+ * @param aCategory UID of Publish And Subscribe category
+ * @param aKey subkey to specify the category event; to be used with
+ * Publish And Subscribe
+ *
+ * @param aValue the new value
+ */
+ virtual void HandlePropertyChangeL(
+ const TUid& aCategory,
+ const TUint aKey,
+ const TInt aValue ) = 0;
+
+ /**
+ * This is a callback function which is called when a property value of
+ * type byte array is changed.
+ *
+ * @param aCategory UID of Publish And Subscribe category
+ * @param aKey subkey to specify the category event; to be used with
+ * Publish And Subscribe
+ * @param aValue the new value
+ **/
+ virtual void HandlePropertyChangeL(
+ const TUid& aCategory,
+ const TUint aKey,
+ const TDesC8& aValue ) = 0;
+
+ /**
+ * This is a callback function which is called when a property value of
+ * type text is changed.
+ *
+ * @param aCategory UID of Publish And Subscribe category
+ * @param aKey subkey to specify the category event; to be used with
+ * Publish And Subscribe
+ * @param aValue the new value
+ **/
+ virtual void HandlePropertyChangeL(
+ const TUid& aCategory,
+ const TUint aKey,
+ const TDesC& aValue ) = 0;
+
+ /**
+ * This is a callback function which is called when a P&S components
+ * returns an error
+ *
+ * @param aCategory UID of Publish And Subscribe category
+ * @param aKey subkey to specify the category event
+ * @param aError an error code
+ */
+ virtual void HandlePropertyChangeErrorL(
+ const TUid& aCategory,
+ const TUint aKey,
+ TInt aError ) = 0;
+
+};
+
+
+/**
+ * Observer class that observes changes of Property values and propogates
+ * them further.
+ * The class defines a handle to a property, a single data value representing
+ * an item of state information.
+ *
+ */
+NONSHARABLE_CLASS( CRadioPropertyObserver ) : public CActive
+ {
+
+ public:
+
+ /**
+ * Property type. Cannot use RProperty::TType because EByteArray == EText.
+ */
+ enum TRadioPropertyType
+ {
+ ERadioPropertyInt, // Integral property type.
+ ERadioPropertyByteArray, // Byte-array ( 8 bit ), max size 512 bytes
+ ERadioPropertyText // Text ( 16 bit ), max size 512 bytes
+ };
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param aObserver a reference to the observer interface implementer
+ * @param aCategory UID of Publish And Subscribe category
+ * @param aKey subkey to specify the category event; to be used with
+ * Publish And Subscribe
+ * @param aPropertyType property type to observe
+ */
+ IMPORT_C static CRadioPropertyObserver* NewL(
+ MRadioPropertyChangeObserver& aObserver,
+ const TUid& aCategory,
+ const TUint aKey,
+ const TRadioPropertyType aPropertyType );
+
+ ~CRadioPropertyObserver();
+
+ /**
+ * Subscribes the object to listen to the specified key. Does nothing if already active.
+ * Must be called after construction, or after calling Cancel().
+ */
+ IMPORT_C void ActivateL();
+
+ /**
+ * Returns current integer property value
+ *
+ * @return int value
+ */
+ IMPORT_C TInt ValueInt() const;
+
+ /**
+ * Returns current byte array property value
+ *
+ * @return byte array value
+ */
+ IMPORT_C const TDesC8& ValueDes8() const;
+
+ /**
+ * Returns current text property value
+ *
+ * @return text value
+ */
+ IMPORT_C const TDesC& ValueDes() const;
+
+private:
+
+ /**
+ * C++ default constructor overload.
+ * Two-phased constructor.
+ *
+ * @param aObserver a reference to the observer interface implementer
+ * @param aCategory UID of Publish And Subscribe category
+ * @param aKey subkey to specify the category event; to be used with
+ * Publish And Subscribe
+ * @param aPropertyType property type to observe
+ */
+ CRadioPropertyObserver(
+ MRadioPropertyChangeObserver& aObserver,
+ const TUid& aCategory,
+ const TUint aKey,
+ const TRadioPropertyType aPropertyType );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ **/
+ void ConstructL();
+
+protected:
+
+ // from base class Cactive
+ /**
+ * From CActive
+ *
+ * @see CActive::RunL()
+ */
+ void RunL();
+
+ /**
+ * From CActive,
+ *
+ * @see CActive::DoCancel()
+ */
+ void DoCancel();
+
+private: // data
+
+ /**
+ * Value of a subscribed category property of type int.
+ */
+ TInt iValueInt;
+
+ /**
+ * Value of a subscribed category property of type byte array.
+ */
+ HBufC8* iValueByteArray;
+
+ /**
+ * Value of a subscribed category property of type text.
+ */
+ HBufC* iValueText;
+
+ /**
+ * Handle to Publish And Subscribe component
+ */
+ RProperty iProperty;
+
+ /**
+ * Observer to be notified when particular Property value has changed
+ */
+ MRadioPropertyChangeObserver& iObserver;
+
+ /**
+ * UID of Publish And Subscribe category
+ */
+ TUid iCategory;
+
+ /**
+ * Subkey to be used with Publish And Subscribe
+ */
+ TUint iKey;
+
+ /**
+ * Type of the observed property.
+ */
+ TRadioPropertyType iPropertyType;
+
+ };
+
+#endif // CRADIOPROPERTYOBSERVER_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradiopubsubimp.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef CRADIOPUBSUBIMP_H
+#define CRADIOPUBSUBIMP_H
+
+// User includes
+#include "cradiopubsub.h"
+#include "cradiopropertyobserver.h"
+
+/**
+ * Publish & Subscribe interface of Radio Application.
+ */
+NONSHARABLE_CLASS( CRadioPubSubImp ) : public CRadioPubSub
+ , public MRadioPropertyChangeObserver
+ {
+public:
+
+ static CRadioPubSubImp* NewL();
+
+ ~CRadioPubSubImp();
+
+private:
+
+ CRadioPubSubImp();
+
+ void ConstructL();
+
+// from base class CRadioPubSub
+
+ TBool PublishChannel( TInt aChannelId ) const;
+ TBool PublishFrequency( TUint32 aFreq ) const;
+ TBool PublishPowerState( TBool aPowerOn ) const;
+ TBool PublishVolume( TInt aVol ) const;
+ TBool PublishChannelDataChanged( TInt aChannelId ) const;
+ TBool PublishTuningState( TRadioPSTuningState aTuningState ) const;
+ TBool PublishRadioMuteState( TBool aMuted ) const;
+ TBool PublishApplicationRunningState( TRadioPSApplicationRunningState aRunningState ) const;
+ TBool PublishHeadsetStatus( TRadioPSHeadsetStatus aHeadsetStatus ) const;
+ TBool PublishFrequencyDecimalCount( TRadioPSFrequencyDecimalCount aDecimalCount ) const;
+ TBool PublishLoudspeakerStatus( TRadioPSLoudspeakerStatus aLoudspeakerStatus ) const;
+ TBool PublishRdsProgramService( const TDesC& aProgramService ) const;
+ TBool PublishRdsRadioText( const TDesC& aRadioText ) const;
+ TBool PublishChannelName( const TDesC& aName ) const;
+ TBool PublishActivePreseListCount( TInt aCount ) const;
+ TBool PublishActivePreseListFocus( TInt aIndex ) const;
+ TBool PublishAntennaState( TRadioPSRadioAntennaState aState ) const;
+ void SetControlEventObserver( MRadioControlEventObserver* aControlEventObserver );
+
+// from base class MVRPropertyChangeObserver
+
+ void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TInt aValue );
+ void HandlePropertyChangeL( const TUid& /*aCategory*/, const TUint /*aKey*/, const TDesC8& /*aValue*/ ) {}
+ void HandlePropertyChangeL( const TUid& /*aCategory*/, const TUint /*aKey*/, const TDesC& /*aValue*/ ) {}
+ void HandlePropertyChangeErrorL( const TUid& /*aCategory*/, const TUint /*aKey*/, TInt /*aError*/ ) {}
+
+// New functions
+
+ /**
+ * Defines a property.
+ *
+ * @param aKey The key of the property.
+ * @param aAttr Attributes of the property.
+ * @param aDataProperty ETrue if the property is a data property, EFalse
+ * if it is a control property
+ */
+ void DefinePropertyL( TUint aKey, TInt aAttr, TBool aDataProperty ) const;
+
+ /**
+ * Deletes a property.
+ *
+ * @param aKey The key of the property.
+ */
+ void DeleteProperty( TUint aKey ) const;
+
+ /**
+ * Creates a property observer
+ *
+ * @param aKey Property key
+ * @param aPropertyType Property type
+ */
+ void CreatePropertyObserverL( const TUint aKey, const TInt aPropertyType );
+
+ /**
+ * Gets the integer value stored in a property.
+ *
+ * @param aKey The key of the property.
+ * @return The value contained in the property.
+ */
+ TBool Get( TUint aKey, TInt& aValue ) const;
+
+ /**
+ * Sets the value in an integer property.
+ *
+ * @param aKey The key of the property.
+ * @param aValue The value to set.
+ */
+ TBool Set( TUint aKey, TInt aValue ) const;
+
+ /**
+ * Sets the value in a text property.
+ *
+ * @param aKey The key of the property.
+ * @param aValue The value to set.
+ */
+ TBool Set( TUint aKey, const TDesC& aValue ) const;
+
+private: // data
+
+ /**
+ * Pointer to observer in UI side, can be NULL. Not owned.
+ */
+ MRadioControlEventObserver* iObserver;
+
+ /**
+ * An array of handlers to P&S interface.
+ */
+ RPointerArray<CRadioPropertyObserver> iPropertyArray;
+
+ };
+
+#endif // CRADIOPUBSUBIMP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradioremcontargetimp.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIOREMCONTARGETIMP_H
+#define CRADIOREMCONTARGETIMP_H
+
+// System includes
+#include <remconcallhandlingtargetobserver.h>
+#include <remconcoreapitargetobserver.h>
+
+// User includes
+#include "cradioremcontarget.h"
+
+// Forward declarations
+class CRemConCallHandlingTarget;
+class CRemConCoreApiTarget;
+class CRemConInterfaceSelector;
+
+// Class declaration
+
+/**
+ * Media key listener
+ */
+NONSHARABLE_CLASS( CRadioRemConTargetImp ) : public CRadioRemConTarget
+ , public MRemConCoreApiTargetObserver
+ , public MRemConCallHandlingTargetObserver
+ {
+public:
+
+ static CRadioRemConTargetImp* NewL();
+
+ virtual ~CRadioRemConTargetImp();
+
+private:
+
+// from base class CRadioRemConTarget
+
+ void SetControlEventObserver( MRadioControlEventObserver* aControlEventObserver );
+
+// from base class MRemConCoreApiTargetObserver
+
+ void MrccatoCommand( TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct );
+ void MrccatoPlay( TRemConCoreApiPlaybackSpeed aSpeed, TRemConCoreApiButtonAction aButtonAct );
+ void MrccatoTuneFunction( TBool aTwoPart, TUint aMajorChannel, TUint aMinorChannel, TRemConCoreApiButtonAction aButtonAct );
+ void MrccatoSelectDiskFunction( TUint aDisk, TRemConCoreApiButtonAction aButtonAct );
+ void MrccatoSelectAvInputFunction( TUint8 aAvInputSignalNumber, TRemConCoreApiButtonAction aButtonAct );
+ void MrccatoSelectAudioInputFunction( TUint8 aAudioInputSignalNumber, TRemConCoreApiButtonAction aButtonAct );
+
+// from base class MRemConCallHandlingTargetObserver
+
+ void AnswerCall();
+ void AnswerEndCall();
+ void DialCall( const TDesC8& aTelNumber );
+ void EndCall();
+ void GenerateDTMF( const TChar aChar );
+ void LastNumberRedial();
+ void MultipartyCalling( const TDesC8& aData );
+ void SpeedDial( const TInt aIndex );
+ void VoiceDial( const TBool aActivate );
+
+private:
+
+ CRadioRemConTargetImp();
+
+ void ConstructL();
+
+ /**
+ * Callback for repeat timer.
+ * @param aPtr Pointer to this class.
+ */
+ static TInt RepeatTimerCallback( TAny* aPtr );
+
+private: // data
+
+ /** Pointer to observer in UI side, can be NULL. Not owned. */
+ MRadioControlEventObserver* iObserver;
+
+ /** RemCon interface selector. */
+ CRemConInterfaceSelector* iInterfaceSelector;
+
+ /** RemCon Core API target class. */
+ CRemConCoreApiTarget* iCoreTarget;
+
+ /** RemCon Call API target class. */
+ CRemConCallHandlingTarget* iCallTarget;
+
+ /** Timer for generating repeat events. */
+ CPeriodic* iRepeatTimer;
+
+ /** Operation id to repeat. */
+ TRemConCoreApiOperationId iRepeatId;
+
+ };
+
+#endif // CRADIOREMCONTARGETIMP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradiorepositoryentity.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOREPOSITORYENTITY_H
+#define C_RADIOREPOSITORYENTITY_H
+
+#include <centralrepository.h>
+#include "cradiorepositoryentitybase.h"
+#include "mradiorepositoryentityobserver.h"
+
+/**
+ * Templated class to listen to a single key within the central repository.
+ *
+ * Notifies the observer of changes in the key, and provides caching for the key's value.
+ */
+template <typename T>
+NONSHARABLE_CLASS( CRadioRepositoryEntity ) : public CRadioRepositoryEntityBase
+ {
+
+public:
+
+ static CRadioRepositoryEntity<T>* NewL( const TUid& aUid,
+ TUint32 aKey,
+ MRadioRepositoryEntityObserver& aObserver,
+ CActive::TPriority aPriority = CActive::EPriorityStandard );
+
+ ~CRadioRepositoryEntity();
+
+ /**
+ * Sets the value of the entity.
+ * The value is written into the central repository immediately.
+ *
+ * @param aValue The value to set.
+ * @param aSavingEnabled If ETrue, saving to central repository file is enabled
+ */
+ TInt SetValue( const T& aValue, TBool aSavingEnabled );
+
+ /**
+ * Returns a cached reference to the value of the entity.
+ *
+ * @return The cached value of the entity.
+ */
+ const T& Value() const;
+
+ /**
+ * Forcibly updates the key's value from the central repository and caches it.
+ */
+ void UpdateL();
+
+// from base class CActive
+
+ void RunL();
+ void DoCancel();
+
+private:
+
+ CRadioRepositoryEntity( const TUid& aUid,
+ TUint32 aKey,
+ MRadioRepositoryEntityObserver& aObserver,
+ CActive::TPriority aPriority );
+
+ void ConstructL();
+
+protected:
+
+ /** The central repository client. */
+ CRepository* iRepository;
+
+ /** The cached value of the key. */
+ T iValue;
+
+ };
+
+#include "cradiorepositoryentity.inl"
+
+#endif // C_RADIOREPOSITORYENTITY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradiorepositoryentity.inl Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+template <typename T>
+CRadioRepositoryEntity<T>* CRadioRepositoryEntity<T>::NewL( const TUid& aUid,
+ TUint32 aKey,
+ MRadioRepositoryEntityObserver& aObserver,
+ CActive::TPriority aPriority )
+ {
+ CRadioRepositoryEntity<T>* self = new ( ELeave ) CRadioRepositoryEntity<T>( aUid, aKey, aObserver, aPriority );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+template <typename T>
+CRadioRepositoryEntity<T>::CRadioRepositoryEntity( const TUid& aUid,
+ TUint32 aKey,
+ MRadioRepositoryEntityObserver& aObserver,
+ CActive::TPriority aPriority )
+ : CRadioRepositoryEntityBase( aUid, aKey, aObserver, aPriority )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+template <typename T>
+void CRadioRepositoryEntity<T>::ConstructL()
+ {
+ iRepository = CRepository::NewL( iUid );
+
+ CActiveScheduler::Add( this );
+ RunL();
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+template <typename T>
+CRadioRepositoryEntity<T>::~CRadioRepositoryEntity()
+ {
+ Cancel();
+ delete iRepository;
+ }
+
+// -----------------------------------------------------------------------------
+// Sets the value of the key.
+// -----------------------------------------------------------------------------
+//
+template <typename T>
+TInt CRadioRepositoryEntity<T>::SetValue( const T& aValue, TBool aSavingEnabled )
+ {
+ iValue = aValue;
+ if ( aSavingEnabled )
+ {
+ return iRepository->Set( iKey, aValue );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// Returns the cached copy of the key's value.
+// -----------------------------------------------------------------------------
+//
+template <typename T>
+const T& CRadioRepositoryEntity<T>::Value() const
+ {
+ return iValue;
+ }
+
+// -----------------------------------------------------------------------------
+// Forcibly updates the cached value from the repository.
+// -----------------------------------------------------------------------------
+//
+template <typename T>
+void CRadioRepositoryEntity<T>::UpdateL()
+ {
+ User::LeaveIfError( iRepository->Get( iKey, iValue ) );
+ }
+
+// -----------------------------------------------------------------------------
+// Executed when the key's value is changed.
+// -----------------------------------------------------------------------------
+//
+template <typename T>
+void CRadioRepositoryEntity<T>::RunL()
+ {
+ User::LeaveIfError( iRepository->NotifyRequest( iKey, iStatus ) );
+ SetActive();
+
+ TInt err = iRepository->Get( iKey, iValue );
+ iObserver.HandleRepositoryValueChangeL( iUid, iKey, iValue, err );
+ }
+
+// -----------------------------------------------------------------------------
+// Cancels all pending notifications.
+// -----------------------------------------------------------------------------
+//
+template <typename T>
+void CRadioRepositoryEntity<T>::DoCancel()
+ {
+ iRepository->NotifyCancel( iKey );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradiorepositoryentitybase.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef C_RADIOREPOSITORYENTITYBASE_H
+#define C_RADIOREPOSITORYENTITYBASE_H
+
+#include <e32base.h>
+
+class MRadioRepositoryEntityObserver;
+
+/**
+ * Base class for a central repository entity.
+ *
+ * All instantiable central repository entities must be derived from this class.
+ * The class is provided so that a heterogenous array of templated objects can be created, and to
+ * provide common data fields for the said purpose.
+ */
+NONSHARABLE_CLASS( CRadioRepositoryEntityBase ) : public CActive
+ {
+
+public:
+
+ ~CRadioRepositoryEntityBase();
+
+ /**
+ * Returns the UID of the repository the entity is bound to.
+ *
+ * @return The UID of the repository the entity is bound to.
+ */
+ const TUid& Uid() const;
+
+ /**
+ * Returns the key the entity is bound to.
+ *
+ * @return The key the entity is bound to.
+ */
+ TUint32 Key() const;
+
+protected:
+
+ /**
+ * Constructor.
+ *
+ * @param aUid The UID of the repository that this entity will be bound to.
+ * @param aKey The key within the repository that this entity will be bound to.
+ * @param aObserver The observer that is notified whenever the value of the key within the repository changes.
+ * @param aPriority The priority of the active object.
+ */
+ CRadioRepositoryEntityBase( const TUid& aUid, TUint32 aKey, MRadioRepositoryEntityObserver& aObserver, CActive::TPriority aPriority );
+
+protected:
+
+ /** The observer that is notified of changes in the key. */
+ MRadioRepositoryEntityObserver& iObserver;
+
+ /** The UID of the repository the entity is bound to. */
+ TUid iUid;
+
+ /** The key the entity is bound to.. */
+ TUint32 iKey;
+
+ };
+
+#endif // C_RADIOREPOSITORYENTITYBASE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradiorepositorymanagerimp.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef C_RADIOREPOSITORYMANAGERIMP_H
+#define C_RADIOREPOSITORYMANAGERIMP_H
+
+// System includes
+#include <centralrepository.h>
+
+// User includes
+#include "mradiorepositoryentityobserver.h"
+
+// Forward declarations
+class CRadioRepositoryEntityBase;
+
+/**
+ * Central repository entity manager.
+ *
+ * Manages central repository entities that listen to specific repository and a key within it, notifying the observer
+ * whenever the key's value changes.
+ *
+ * Also a set of static methods are provided that wrap the common use case of central repository where the user
+ * is only interested to read or write the value of a key and then discard the repository object.
+ */
+NONSHARABLE_CLASS( CRadioRepositoryManagerImp ) : public CRadioRepositoryManager
+ , public MRadioRepositoryEntityObserver
+ {
+
+public:
+
+ static CRadioRepositoryManagerImp* NewL( TInt aGranularity );
+
+ ~CRadioRepositoryManagerImp();
+
+ /**
+ * Sets the value of an integer key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue The value to set.
+ */
+ static void SetRepositoryValueL( const TUid& aUid, TUint32 aKey, TInt aValue );
+
+ /**
+ * Sets the value of a floating point key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue The value to set.
+ */
+ static void SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TReal& aValue );
+
+ /**
+ * Sets the value of a binary key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue The value to set.
+ */
+ static void SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TDesC8& aValue );
+
+ /**
+ * Sets the value of a string key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue The value to set.
+ */
+ static void SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TDesC16& aValue );
+
+ /**
+ * Gets the value of an integer key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue On return, the value of the key within the repository.
+ */
+ static void GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TInt& aValue );
+
+ /**
+ * Gets the value of a floating point key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue On return, the value of the key within the repository.
+ */
+ static void GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TReal& aValue );
+
+ /**
+ * Gets the value of a binary key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue On return, the value of the key within the repository.
+ */
+ static void GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TDes8& aValue );
+
+ /**
+ * Gets the value of a string key in the repository.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue On return, the value of the key within the repository.
+ */
+ static void GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TDes16& aValue );
+
+private:
+
+ CRadioRepositoryManagerImp( TInt aGranularity );
+
+ void ConstructL();
+
+// from base class CRadioRepositoryManager
+
+ void AddObserverL( MRadioRepositoryEntityObserver* aObserver );
+ void RemoveObserver( MRadioRepositoryEntityObserver* aObserver );
+ void EnableSave( TBool aEnable );
+ void AddEntityL( const TUid& aUid, TUint32 aKey, TRadioEntityType aType );
+ void RemoveEntity( const TUid& aUid, TUint32 aKey );
+ TInt SetEntityValue( const TUid& aUid, TUint32 aKey, TInt aValue );
+ TInt SetEntityValue( const TUid& aUid, TUint32 aKey, const TReal& aValue );
+ TInt SetEntityValue( const TUid& aUid, TUint32 aKey, const TDesC8& aValue );
+ TInt SetEntityValue( const TUid& aUid, TUint32 aKey, const TDesC16& aValue );
+ TInt EntityValueInt( const TUid& aUid, TUint32 aKey ) const;
+ const TReal& EntityValueReal( const TUid& aUid, TUint32 aKey ) const;
+ const TDesC8& EntityValueDes8( const TUid& aUid, TUint32 aKey ) const;
+ const TDesC16& EntityValueDes16( const TUid& aUid, TUint32 aKey ) const;
+
+ /**
+ * Sets the value of an entity.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param aValue The value to set.
+ */
+ template <typename T>
+ TInt DoSetEntityValue( const TUid& aUid, TUint32 aKey, const T& aValue );
+
+ /**
+ * Returns an entity's cached value.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @return The cached value of the entity.
+ */
+ template <typename T>
+ const T& DoEntityValue( const TUid& aUid, TUint32 aKey ) const;
+
+ /**
+ * Sets the value of a key.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @param aValue The value to set.
+ */
+ template <typename T>
+ static void DoSetRepositoryValueL( const TUid& aUid, TUint32 aKey, const T& aValue );
+
+ /**
+ * Returns a key's value.
+ *
+ * @param aUid The UID of the repository.
+ * @param aKey The key within the repository.
+ * @return The key's value.
+ */
+ template <typename T>
+ static void DoGetRepositoryValueL( const TUid& aUid, TUint32 aKey, T& aValue );
+
+ /**
+ * Returns the entity's index by its UID and key.
+ *
+ * @param aUid The UID of the entity.
+ * @param aKey The key of the entity.
+ * @param The entity's index or <code>KErrNotFound</code> if no such entity could be found.
+ */
+ TInt EntityIndex( const TUid& aUid, TUint32 aKey ) const;
+
+ /**
+ * SIS installation does not update central repository, this checks that the new keys are in the repository.
+ */
+ void CheckRepositoryKeysL();
+
+// from base class MRadioRepositoryEntityObserver
+
+ void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError );
+ void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, const TReal& aValue, TInt aError );
+ void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, const TDesC8& aValue, TInt aError );
+ void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, const TDesC16& aValue, TInt aError );
+
+private: // data
+
+ /** The observers that are notified of changes in the entities' values. */
+ RPointerArray<MRadioRepositoryEntityObserver> iObservers;
+
+ /** The entities registered. */
+ RPointerArray<CRadioRepositoryEntityBase> iEntities;
+
+ /** Indicates whether or not the entities are allowed to write to the repository. */
+ TBool iEnableSave;
+
+ };
+
+#endif // C_RADIOREPOSITORYMANAGERIMP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradiosystemeventcollectorimp.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIOSYSTEMEVENTCOLLECTORIMP_H
+#define CRADIOSYSTEMEVENTCOLLECTORIMP_H
+
+#include "cradiosystemeventcollector.h"
+#include "mradioaudioroutingobserver.h"
+#include "mradioheadseteventobserver.h"
+#include "mradiosystemeventdetectorobserver.h"
+#include "mradiosystemeventobserver.h"
+
+class CRadioAccessoryObserver;
+class CRadioSystemEventDetector;
+
+/**
+ * Collects system events and forwards them to observers
+ * Class also wraps up the getters for some system states
+ */
+NONSHARABLE_CLASS( CRadioSystemEventCollectorImp ) : public CRadioSystemEventCollector
+ , public MRadioAudioRoutingObserver
+ , public MRadioHeadsetEventObserver
+ , public MRadioSystemEventDetectorObserver
+ {
+public:
+
+ static CRadioSystemEventCollectorImp* NewL();
+
+ ~CRadioSystemEventCollectorImp();
+
+private:
+
+ CRadioSystemEventCollectorImp();
+
+ void ConstructL();
+
+// from base class CRadioSystemEventCollector
+
+ void AddObserverL( MRadioSystemEventObserver* aSystemObserver );
+ void RemoveObserver( MRadioSystemEventObserver* aSystemObserver );
+ TBool IsNetworkCoverage() const;
+ TBool IsMobileNetworkCoverage() const;
+ TBool IsCallActive() const;
+ TBool IsAudioResourcesAvailable() const;
+ TBool IsHeadsetConnectedL() const;
+ TBool IsVoiceUiActive() const;
+
+ void NotifyObserversL( TRadioSystemEventType aEvent );
+
+// from base class MRadioSystemEventDetectorObserver
+
+ void NetworkUpCallbackL();
+ void NetworkDownCallbackL();
+ void CallActivatedCallbackL();
+ void CallDeactivatedCallbackL();
+ void AudioResourcesAvailableL();
+ void AudioAutoResumeForbiddenL();
+ void ErrorCallbackL( TInt aError );
+
+// from base class MRadioHeadsetEventObserver
+
+ void HeadsetConnectedCallbackL();
+ void HeadsetDisconnectedCallbackL();
+
+// from base class MRadioAudioRoutingObserver
+
+ void AudioRouteChangedL( RadioEngine::TRadioAudioRoute aRoute );
+
+private: // data
+
+ /**
+ * Array of system event observers
+ */
+ RPointerArray<MRadioSystemEventObserver> iSystemEventObservers;
+
+ /**
+ * Detects system events
+ */
+ CRadioSystemEventDetector* iSystemEventDetector;
+
+ /**
+ * Observer for accessory events
+ */
+ CRadioAccessoryObserver* iHeadsetObserver;
+
+ };
+
+#endif // CRADIOSYSTEMEVENTCOLLECTORIMP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/cradiosystemeventdetector.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CRADIOSYSTEMEVENTDETECTOR_H
+#define CRADIOSYSTEMEVENTDETECTOR_H
+
+#include <e32base.h>
+
+#include "cradiopropertyobserver.h"
+
+class MRadioSystemEventDetectorObserver;
+
+/**
+* Catches notification of the call and network state changes.
+*
+* Class provides implementation to detect system events and notify UI components of the event,
+* Class keeps several instances of CVPropertyObserver, and those instances send event notifications
+* about the particular system component state change.
+*/
+NONSHARABLE_CLASS( CRadioSystemEventDetector ) : public CBase
+ , public MRadioPropertyChangeObserver
+ {
+public:
+
+ static CRadioSystemEventDetector* NewL( MRadioSystemEventDetectorObserver& aObserver );
+
+ virtual ~CRadioSystemEventDetector();
+
+ /**
+ * Returns network coverage state ( wlan or mobile ).
+ */
+ TBool IsNetworkCoverage() const;
+
+ /**
+ * Returns mobile network coverage state.
+ */
+ TBool IsMobileNetworkCoverage() const;
+
+ /**
+ * Returns current call state.
+ */
+ TBool IsCallActive() const;
+
+ /**
+ * Returns current audio resources state.
+ * @return audio resources state
+ */
+ TBool IsAudioResourcesAvailable() const;
+
+ /**
+ * Returns current Voice UI state.
+ * @return ETrue if Voice UI is active, EFalse otherwise
+ */
+ TBool IsVoiceUiActive() const;
+
+protected:
+
+// from base class MRadioPropertyChangeObserver
+
+ void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TInt aValue );
+ void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TDesC8& aValue );
+ void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TDesC& aValue );
+ void HandlePropertyChangeErrorL( const TUid& aCategory, const TUint aKey, TInt aError );
+
+private:
+
+ void ConstructL();
+
+ /**
+ * Used internally to change network coverage status and report it to observer.
+ */
+ void SetNetworkCoverageL( const TBool aIsMobileNetworkCoverage, const TBool aIsWlanCoverage );
+
+ CRadioSystemEventDetector( MRadioSystemEventDetectorObserver& aObserver );
+
+private: // data
+
+ /** Observer which will be notified of the call and network state changes*/
+ MRadioSystemEventDetectorObserver& iObserver;
+
+ /** handler to Publish & Subscribe interface*/
+ CRadioPropertyObserver* iCallStatusObserver;
+ /** handler to Publish & Subscribe interface*/
+ CRadioPropertyObserver* iNetworkStatusObserver;
+ /** handler to Publish & Subscribe interface*/
+ CRadioPropertyObserver* iVoiceUiObserver;
+ /** handler to Publish & Subscribe interface*/
+ CRadioPropertyObserver* iAudioPolicyObserver;
+
+ /**Indicator for the mobile network status*/
+ TBool iIsMobileNetworkCoverage;
+
+ /**Indicator for the wlan network status*/
+ TBool iIsWlanCoverage;
+
+ /**Indicator for the call status*/
+ TBool iIsCallActive;
+
+ /** Array of audio policy categories that VR must not resume after. */
+ RArray<TInt> iNoAutoResumeAudioCategories;
+
+ /** Indicator for audio resource status. */
+ TBool iIsAudioResourcesAvailable;
+
+ /** Indicator for Voice UI status. */
+ TBool iIsVoiceUiActive;
+
+ };
+
+#endif // CRADIOSYSTEMEVENTDETECTOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/mradioheadseteventobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MRADIOHEADSETEVENTOBSERVER_H
+#define MRADIOHEADSETEVENTOBSERVER_H
+
+
+// Class declaration
+/**
+*
+* Observer for the Headset button state. Implementer will be notified each time the headset button
+* state has changed ( button pressed ).
+*/
+NONSHARABLE_CLASS( MRadioHeadsetEventObserver )
+ {
+public:
+
+ /**
+ * This callback will notify of the Headset to be connected
+ */
+ virtual void HeadsetConnectedCallbackL() = 0;
+
+ /**
+ * This callback will notify of the Headset to be disconnected
+ */
+ virtual void HeadsetDisconnectedCallbackL() = 0;
+
+ };
+
+#endif // MRADIOHEADSETEVENTOBSERVER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/inc/mradiosystemeventdetectorobserver.h Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MRADIOSYSTEMEVENTDETECTOROBSERVER_H
+#define MRADIOSYSTEMEVENTDETECTOROBSERVER_H
+
+// Class declaration
+/**
+*
+* Observer for the call and network state. Implementer will be notified each time the state has changed
+*/
+NONSHARABLE_CLASS( MRadioSystemEventDetectorObserver )
+ {
+public:
+
+ /**
+ * This callback notifies when networks comes up.
+ */
+ virtual void NetworkUpCallbackL() = 0;
+
+ /**
+ * This callback notifies when network goes down.
+ */
+ virtual void NetworkDownCallbackL() = 0;
+
+ /**
+ * This callback notifies when call becomes active.
+ */
+ virtual void CallActivatedCallbackL() = 0;
+
+ /**
+ * This callback notifies when call becomes deactive.
+ */
+ virtual void CallDeactivatedCallbackL() = 0;
+
+ /**
+ * This callback notifies when audio resources become available.
+ */
+ virtual void AudioResourcesAvailableL() = 0;
+
+ /**
+ * This callback notifies when audio auto resuming is forbidden.
+ */
+ virtual void AudioAutoResumeForbiddenL() = 0;
+
+ /**
+ * This callback notifies when an error occured
+ * @param aError an error code
+ */
+ virtual void ErrorCallbackL( TInt aError ) = 0;
+
+ };
+
+#endif // MRADIOSYSTEMEVENTDETECTOROBSERVER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradioaccessoryobserver.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,357 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradioenginelogger.h"
+
+#include "cradioaccessoryobserver.h"
+#include "mradioheadseteventobserver.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioAccessoryObserver::CRadioAccessoryObserver()
+ : CActive( CActive::EPriorityStandard )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioAccessoryObserver::ConstructL()
+ {
+ LOG_METHOD_AUTO;
+ User::LeaveIfError( iAccessoryServer.Connect() );
+
+ // Creates a new sub-session within an existing session.
+ User::LeaveIfError( iAccessoryConn.CreateSubSession( iAccessoryServer ) );
+ User::LeaveIfError( iAccessoryConn.GetAccessoryConnectionStatus( iAccPolGenIdArr ) );
+
+ TInt nroChangedAccessories( 0 );
+ UpdateCurrentAccessoriesL( nroChangedAccessories );
+ LOG_FORMAT( "CRadioAccessoryObserver::ConstructL() -- Found %d wired/BT accessories ( %d accessories in total ).",
+ nroChangedAccessories, iAccPolGenIdArr.Count() );
+ CActiveScheduler::Add( this );
+ // Accessory is always listened
+ iAccessoryConn.NotifyAccessoryConnectionStatusChanged( iStatus, iAccPolGenIdArr );
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioAccessoryObserver* CRadioAccessoryObserver::NewL()
+ {
+ CRadioAccessoryObserver* self = new( ELeave ) CRadioAccessoryObserver;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioAccessoryObserver::~CRadioAccessoryObserver()
+ {
+ Cancel();
+ iAccessoryConn.CloseSubSession();
+ iAccessoryServer.Close();
+ iSavedAccessories.Close();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioAccessoryObserver::FindAccessoryL( TBool aAcceptOnlyHeadset, TAccAudioOutPutType& aOutputType ) const
+ {
+#ifdef __WINS__
+ TBool accessoryFound = ETrue;
+ aAcceptOnlyHeadset = ETrue;
+ aOutputType = EAccAudioOutPutTypePrivate;
+#else
+ TBool accessoryFound = EFalse;
+
+ LOG_FORMAT( "CRadioAccessoryObserver::FindAccessoryL - Connected accessories count = %d", iAccPolGenIdArr.Count());
+ for ( TInt i = 0; i < iAccPolGenIdArr.Count() && !accessoryFound; i++ )
+ {
+ TAccPolGenericID accPolGenId = iAccPolGenIdArr.GetGenericIDL( i );
+
+ //Check if physical connection is of acceptable type
+ TUint32 physicalConnectionCaps = accPolGenId.PhysicalConnectionCaps();
+ if ( physicalConnectionCaps & KPCWired || physicalConnectionCaps & KPCBluetooth )
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::FindAccessoryL - is wired or BT ( physicalConnectionCaps = %d )", physicalConnectionCaps );
+
+ if ( !aAcceptOnlyHeadset )
+ {
+ accessoryFound = ETrue;
+ }
+ //Get device type ( check if is HeadSet )
+ TUint32 deviceType = accPolGenId.DeviceTypeCaps();
+ if ( deviceType & KDTHeadset )
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::FindAccessoryL - is HeadSet( deviceType = %d )", deviceType );
+ if ( !IsLineoutConnectedL( accPolGenId ) )
+ {
+ LOG( "CRadioAccessoryObserver::FindAccessoryL - Is a normal headSet" );
+ accessoryFound = ETrue;
+ }
+ }
+ else if ( deviceType & KDTLoopset )
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::FindAccessoryL - is Loopset( deviceType = %d )", deviceType );
+ accessoryFound = ETrue;
+ }
+ else
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::FindWiredAccessoryL - is NOT HeadSet or Loopset( deviceType = %d )", deviceType );
+ }
+
+ if ( accessoryFound )
+ {
+ // get the public/private status
+ TAccPolNameRecord nameRecord;
+ nameRecord.SetNameL( KAccAudioOutputType );
+
+ TAccValueTypeTInt audioOutputTypeValue;
+ iAccessoryConn.GetValueL( accPolGenId, nameRecord, audioOutputTypeValue );
+
+ aOutputType = static_cast<TAccAudioOutPutType>( audioOutputTypeValue.iValue );
+ LOG_FORMAT( "CRadioAccessoryObserver::FindAccessoryL - AudioOutputType = %d", aOutputType );
+ }
+ }
+ else
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::FindAccessoryL - is NOT wired or BT ( physicalConnectionCaps = %d )", physicalConnectionCaps );
+ }
+ }
+#endif
+ return accessoryFound;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioAccessoryObserver::IsHeadsetConnectedL() const
+ {
+ TAccAudioOutPutType audioOutputType( EAccAudioOutPutTypePrivate );
+ return FindAccessoryL( ETrue , audioOutputType );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioAccessoryObserver::IsLineoutConnectedL( TAccPolGenericID& aAccPolGenId ) const
+ {
+ TBool isLineOut( EFalse );
+
+ CAccPolSubblockNameArray* nameArray = CAccPolSubblockNameArray::NewL();
+ CleanupStack::PushL( nameArray );
+ iAccessoryConn.GetSubblockNameArrayL( aAccPolGenId, *nameArray );
+
+ TBool isAudioOutValue = nameArray->HasName( KAccAudioOut );
+ CleanupStack::PopAndDestroy( nameArray );
+ if ( isAudioOutValue )
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::IsLineoutConnectedL - isAudioOutValue = ( %d )", isAudioOutValue );
+
+ TAccPolNameRecord nameRecord;
+ nameRecord.SetNameL( KAccAudioOut );
+
+ //Check if connected accessory is LineOut
+ TAccValueTypeTInt audioOutValue;
+ iAccessoryConn.GetValueL( aAccPolGenId, nameRecord, audioOutValue );
+
+ LOG( "CRadioAccessoryObserver::IsLineoutConnectedL - GetValueL() - OK" );
+ if ( TAccAudioOutLineout == audioOutValue.iValue )
+ {
+ //is lineout
+ LOG_FORMAT( "CRadioAccessoryObserver::IsLineoutConnectedL - Accessory is LineOut( audioOutValue = %d )", audioOutValue.iValue );
+ isLineOut = ETrue;
+ }
+ }
+ return isLineOut;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioAccessoryObserver::UpdateCurrentAccessoriesL( TInt& aNroChangedAccessories )
+ {
+ // first check, the removed accessories.
+ TInt removedAccessories = CountRemovedAccessoriesL();
+ LOG_FORMAT( "CRadioAccessoryObserver::UpdateCurrentAccessoriesL() -- %d accessories removed.", removedAccessories );
+ aNroChangedAccessories += removedAccessories;
+ TInt addedAccessories = CountAddedAccessoriesL();
+ LOG_FORMAT( "CRadioAccessoryObserver::UpdateCurrentAccessoriesL() -- %d accessories added.", addedAccessories );
+ aNroChangedAccessories += addedAccessories;
+
+ iSavedAccessories.Reset();
+
+ for ( TInt i = 0; i < iAccPolGenIdArr.Count(); i++ )
+ {
+ iSavedAccessories.AppendL( iAccPolGenIdArr.GetGenericIDL( i ) );
+ LOG_FORMAT( "CRadioAccessoryObserver::UpdateCurrentAccessoriesL() -- accessory in slot %d: %d",
+ i, iAccPolGenIdArr.GetGenericIDL( i ).UniqueID() );
+ }
+ LOG_FORMAT( "CRadioAccessoryObserver::UpdateCurrentAccessoriesL() -- %d accessories in total.", iSavedAccessories.Count() );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioAccessoryObserver::CountRemovedAccessoriesL() const
+ {
+ TInt removedAccessories( 0 );
+
+ for ( TInt i = 0; i < iSavedAccessories.Count(); i++ )
+ {
+ TAccPolGenericID savedAcc = iSavedAccessories[i];
+
+ TUint32 physicalConnectionCaps = savedAcc.PhysicalConnectionCaps();
+
+ if ( physicalConnectionCaps & KPCWired || physicalConnectionCaps & KPCBluetooth )
+ {
+ TBool found( EFalse );
+
+ for ( TInt j = 0; j < iAccPolGenIdArr.Count() && !found; j++ )
+ {
+ TAccPolGenericID freshAcc = iAccPolGenIdArr.GetGenericIDL( j );
+ if ( freshAcc.UniqueID() == savedAcc.UniqueID() )
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::CountRemovedAccessoriesL() -- Accessory with id = %d found.", savedAcc.UniqueID() );
+ found = ETrue;
+ }
+ }
+ if ( !found )
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::CountRemovedAccessoriesL() -- Accessory with id = %d removed.", savedAcc.UniqueID() );
+ removedAccessories++;
+ }
+ }
+ }
+ return removedAccessories;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioAccessoryObserver::CountAddedAccessoriesL() const
+ {
+ TInt addedAccessories( 0 );
+
+ for ( TInt i = 0; i < iAccPolGenIdArr.Count(); i++ )
+ {
+ TAccPolGenericID freshAcc = iAccPolGenIdArr.GetGenericIDL( i );
+
+ TUint32 physicalConnectionCaps = freshAcc.PhysicalConnectionCaps();
+
+ if ( physicalConnectionCaps & KPCWired || physicalConnectionCaps & KPCBluetooth )
+ {
+ TBool found( EFalse );
+
+ for ( TInt j = 0; j < iSavedAccessories.Count() && !found; j++ )
+ {
+ TAccPolGenericID savedAcc = iSavedAccessories[j];
+ if ( savedAcc.UniqueID() == freshAcc.UniqueID() )
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::CountAddedAccessoriesL() -- Accessory with id = %d found.", freshAcc.UniqueID() );
+ found = ETrue;
+ }
+ }
+ if ( !found )
+ {
+ LOG_FORMAT( "CRadioAccessoryObserver::CountAddedAccessoriesL() -- Accessory with id = %d added.", freshAcc.UniqueID() );
+ addedAccessories++;
+ }
+ }
+ }
+ return addedAccessories;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioAccessoryObserver::SetObserver( MRadioHeadsetEventObserver* aObserver )
+ {
+ iObserver = aObserver;
+ }
+
+// ---------------------------------------------------------------------------
+// From class CActive
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioAccessoryObserver::RunL()
+ {
+ TRequestStatus status = iStatus;
+ iAccessoryConn.NotifyAccessoryConnectionStatusChanged( iStatus, iAccPolGenIdArr );
+
+ SetActive();
+
+ TInt nroChangedAccessories( 0 );
+ UpdateCurrentAccessoriesL( nroChangedAccessories );
+
+ if ( status == KErrNone && nroChangedAccessories != 0 )
+ {
+ TAccAudioOutPutType audioOutputType( EAccAudioOutPutTypePrivate );
+
+ if ( FindAccessoryL( EFalse, audioOutputType ) )
+ {
+ // Accessory mode may change when combined connection status changes
+ // or when audio routing status changes.
+ if ( audioOutputType == EAccAudioOutPutTypePrivate )
+ {
+ LOG( "CRadioAccessoryObserver::RunL - Headset connected" );
+ iObserver->HeadsetConnectedCallbackL();
+ }
+ else
+ {
+ LOG( "CRadioAccessoryObserver::RunL - Public wired or BT accessory connected." );
+ iObserver->HeadsetDisconnectedCallbackL();
+ }
+ }
+ else
+ {
+ LOG( "CRadioAccessoryObserver::RunL - No wired or BT accessories available" );
+ iObserver->HeadsetDisconnectedCallbackL();
+ }
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class CActive
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioAccessoryObserver::DoCancel()
+ {
+ iAccessoryConn.CancelNotifyAccessoryConnectionStatusChanged();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradioaudiorouter.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradioenginelogger.h"
+#include "cradioaudiorouter.h"
+#include "mradioaudioroutingobserver.h"
+#include "cradioroutableaudio.h"
+#include "radioengineutils.h"
+
+
+const TInt KVisualRadioInitialRoutableAudioArraySize( 2 );
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioAudioRouter::CRadioAudioRouter( MRadioAudioRoutingObserver& aAudioRoutingObserver )
+ : iAudioRoutingObserver( aAudioRoutingObserver )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioAudioRouter* CRadioAudioRouter::NewL( MRadioAudioRoutingObserver& aAudioRoutingObserver )
+ {
+ CRadioAudioRouter* self = new( ELeave ) CRadioAudioRouter( aAudioRoutingObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioAudioRouter::~CRadioAudioRouter()
+ {
+ iRoutableAudios.Close();
+ RadioEngineUtils::Release();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioAudioRouter::ConstructL()
+ {
+ RadioEngineUtils::InitializeL();
+ iRoutableAudios = RArray<CRadioRoutableAudio*>( KVisualRadioInitialRoutableAudioArraySize );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets audio route
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioAudioRouter::SetAudioRouteL( RadioEngine::TRadioAudioRoute aAudioRoute )
+ {
+ LOG_FORMAT( "CRadioAudioRouter::SetAudioRouteL: Route: %d", aAudioRoute );
+
+ for ( TInt i = 0 ; i < iRoutableAudios.Count(); i++ )
+ {
+ iRoutableAudios[i]->SetAudioRouteL( aAudioRoute );
+ }
+ iAudioRoutingObserver.AudioRouteChangedL( aAudioRoute );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioAudioRouter::RegisterRoutableAudio( CRadioRoutableAudio* aRoutableAudio )
+ {
+ LOG( "CRadioAudioRouter::RegisterRoutableAudio" );
+ iRoutableAudios.Append( aRoutableAudio );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioAudioRouter::UnRegisterRoutableAudio( CRadioRoutableAudio* aRoutableAudio )
+ {
+ LOG( "CRadioAudioRouter::UnRegisterRoutableAudio" );
+
+ TInt objectIndex = iRoutableAudios.Find( aRoutableAudio );
+
+ __ASSERT_DEBUG( objectIndex != KErrNotFound, User::Panic( _L("VisualRadio" ), KErrAbort ) );
+
+ if ( objectIndex != KErrNotFound )
+ {
+ iRoutableAudios.Remove( objectIndex );
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradioenginelogger.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,480 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradioenginelogger.h"
+#include "cradioenginetls.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Return the logger instance.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MRadioEngineLogger* MRadioEngineLogger::Logger()
+ {
+ return CRadioEngineTls::Logger();
+ }
+
+#ifdef LOGGING_ENABLED
+
+#include <bautils.h>
+
+// Indentation
+_LIT( KLogSpace, " " ); // 32 empty spaces
+const TInt KMaxIndent = 32;
+
+/**
+ * Timestamp formatter string
+ */
+_LIT8( KTimestampFormat, "%02d.%02d.%4d %02d:%02d:%02d.%05d" );
+
+/**
+ * Timestamp separator string
+ */
+_LIT8( KTimestampSeparator, " " );
+
+// Memory card path. Has to contain directory ( \\) or BaflUtils::PathExists fails
+_LIT( KMemoryCard, "E:\\" );
+
+_LIT( KLogEnter, "\\ %S" );
+_LIT( KLogExit, "/ %S" );
+_LIT8( KLogLine, "| " );
+_LIT( KLogLeave, "#+ %S: LEAVE!" );
+_LIT( KLogExitRet, "/ %S, Returning " );
+
+_LIT8( KNewLine, "\r\n" );
+_LIT8( KHexFormat, "ptr: 0x%X" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineLogger* CRadioEngineLogger::NewL( RFs& aFs )
+ {
+ CRadioEngineLogger* self = new (ELeave) CRadioEngineLogger( aFs );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineLogger::CRadioEngineLogger( RFs& aFs )
+ : iFs( aFs )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineLogger::ConstructL()
+ {
+ if ( KLogFile().FindF( KMemoryCard ) == 0 )
+ {
+ TBool readOnly = EFalse;
+
+ // Returns KErrPathNotFound if memory card is not present
+ TInt err = BaflUtils::DiskIsReadOnly( iFs, KMemoryCard, readOnly );
+ if ( err || readOnly )
+ {
+ // Log file path points to the memory card and the card is not
+ // present or is read only => change the drive to C:
+ TFileName fileName( _L( "C:" ) );
+ TParsePtrC parse( KLogFile );
+ fileName.Append( parse.Path() );
+ fileName.Append( parse.NameAndExt() );
+ iFileName = fileName.AllocL();
+ }
+ }
+
+ if ( !iFileName )
+ {
+ iFileName = KLogFile().AllocL();
+ }
+
+ BaflUtils::EnsurePathExistsL( iFs, *iFileName );
+
+ User::LeaveIfError( Dll::SetTls( this ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineLogger::~CRadioEngineLogger()
+ {
+ iFile.Close();
+ delete iFileName;
+ }
+
+// ---------------------------------------------------------------------------
+// Clear the log by deleting the logfile.
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::ClearLog()
+ {
+ if ( BaflUtils::FileExists( iFs, *iFileName ) )
+ {
+ // Returned error code ignored intentionally because there is no way
+ // to report an error
+ BaflUtils::DeleteFile( iFs, *iFileName );
+ }
+
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a 8-bit string to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::Add( const TDesC8& aMsg )
+ {
+ AddDesC<TPtrC8, TDesC8>( aMsg );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a 16-bit string to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::Add( const TDesC& aMsg )
+ {
+ // Note! No character conversion is performed while going from 16-bit
+ // descriptor to 8-bit descriptor. This is considered acceptable in a
+ // debugging utility
+ AddDesC<TPtrC, TDesC>( aMsg );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a TInt to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::Add( TInt aInt )
+ {
+ TBuf8<20> buf8;
+ buf8.Num( aInt );
+ Add( buf8 );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a TReal to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::Add( const TReal& aReal )
+ {
+ TBuf8<20> buf8;
+ buf8.Format( _L8( "%f" ), aReal );
+ Add( buf8 );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a c-style string to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::Add( const char* aText )
+ {
+ Add( TPtrC8( reinterpret_cast<const TText8*>( aText ) ) );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a pointer value to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::Add( const TAny* aPtr )
+ {
+ TBuf8<20> buf8;
+ buf8.Format( KHexFormat, aPtr );
+ Add( buf8 );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a timestamp of current time to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::Add( const TTime& aTime )
+ {
+ TTimestamp timestamp;
+ ParseTimestamp( aTime, timestamp );
+ Add( timestamp );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a timestamp of current time to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::AddTimestamp()
+ {
+ TTime now;
+ now.HomeTime();
+ return Add( now );
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a formatted string to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::AddFormat( TRefByValue<const TDesC> aFmt, ... )
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+
+ TBuf<KLogBufferLength> buf16;
+
+ // Calls Overflow() if it doesn't fit
+ buf16.AppendFormatList( aFmt, list, this );
+
+ VA_END( list );
+
+ Add( buf16 );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds the line indentation with line prefix to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::AddIndent( const TDesC& aMarker )
+ {
+ Add( aMarker );
+ Add( KLogSpace().Mid( 0, iIndent ) );
+ Add( KLogLine() );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds the line indentation to log line
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::AddIndentClear( const TDesC& aMarker )
+ {
+ Add( aMarker );
+ Add( KLogSpace().Mid( 0, iIndent ) );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// From TDes16Overflow
+// Handles the overflow from AppendFormatList()
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineLogger::Overflow( TDes16& /*aDes*/ )
+ {
+ // aDes contains the part that did fit in the descriptor, but the part that
+ // didn't is lost. Modifying the descriptor here would modify it in AddFormat(),
+ // but since it gets logged there we only need to add a message about the overflow.
+ Add( _L( "FORMAT OVERFLOW! " ) );
+ }
+
+// ---------------------------------------------------------------------------
+// Increment indentation
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::IncIndent()
+ {
+ if ( ++iIndent > KMaxIndent )
+ {
+ iIndent = KMaxIndent;
+ }
+
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Decrement indentation
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::DecIndent()
+ {
+ if ( --iIndent < 0 )
+ {
+ iIndent = 0;
+ }
+
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Commits the log line to file and RDebug and resets internal buffer
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger& CRadioEngineLogger::Commit( TBool aNewLine )
+ {
+ // Write log buffer to RDebug
+ RDebug::RawPrint( iBuf8 );
+
+ // Write log buffer to file
+ TInt err = iFile.Open( iFs, *iFileName, EFileWrite );
+ if ( err )
+ {
+ err = iFile.Create( iFs, *iFileName, EFileWrite );
+ }
+
+ if ( !err )
+ {
+ TInt unused = 0;
+ if ( iFile.Seek( ESeekEnd, unused ) == KErrNone )
+ {
+ if ( !iTimeStampWritten )
+ {
+ // First print a timestamp to log
+ TTimestamp timestamp;
+ TTime now;
+ now.HomeTime();
+ ParseTimestamp( now, timestamp );
+ iFile.Write( timestamp );
+ iFile.Write( KTimestampSeparator );
+ iTimeStampWritten = ETrue;
+ }
+
+ iFile.Write( iBuf8 );
+
+ if ( aNewLine )
+ {
+ iFile.Write( KNewLine );
+ iTimeStampWritten = EFalse;
+ }
+ }
+
+ iFile.Close();
+ }
+
+ iBuf8.Zero();
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the amount of characters that still fit in the buffer
+// ---------------------------------------------------------------------------
+//
+TInt CRadioEngineLogger::Available() const
+ {
+ return iBuf8.MaxLength() - iBuf8.Length();
+ }
+
+// ---------------------------------------------------------------------------
+// Templated function to add either 8-bit or 16-bit descriptor to buffer
+// ---------------------------------------------------------------------------
+//
+template<class PTR, class DESC>
+void CRadioEngineLogger::AddDesC( const DESC& aDesc )
+ {
+ PTR ptr( aDesc );
+ while ( ptr.Length() > Available() )
+ {
+ PTR writePtr = ptr.Left( Available() );
+ iBuf8.Append( writePtr );
+
+ ptr.Set( ptr.Mid( writePtr.Length() ) );
+ Commit( EFalse );
+ }
+
+ iBuf8.Append( ptr );
+ }
+
+// ---------------------------------------------------------------------------
+// Parses the timestamp from the given TTime
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineLogger::ParseTimestamp( const TTime& aTime, TTimestamp& aTimestamp )
+ {
+ TDateTime dateTime = aTime.DateTime();
+ aTimestamp.Zero();
+ aTimestamp.Format( KTimestampFormat, dateTime.Day() + 1,
+ dateTime.Month() + 1,
+ dateTime.Year(),
+ dateTime.Hour(),
+ dateTime.Minute(),
+ dateTime.Second(),
+ dateTime.MicroSecond() );
+ }
+
+// ---------------------------------------------------------------------------
+// Constructor. Log method entry
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TRadioMethodLogger::TRadioMethodLogger( const TText* aFunc,
+ const TText* aRetFormat )
+ : iFunc( aFunc )
+ , iRetFormat( aRetFormat )
+ {
+ MRadioEngineLogger* logger = MRadioEngineLogger::Logger();
+ logger->AddIndentClear( KMarkerEngine ).AddFormat( KLogEnter, &iFunc ).Commit();
+ logger->IncIndent();
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor. Log method exit
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TRadioMethodLogger::~TRadioMethodLogger()
+ {
+ MRadioEngineLogger::Logger()->DecIndent();
+
+ if ( std::uncaught_exception() ) // Leave is an exception
+ {
+ // The function exited with a leave
+ MRadioEngineLogger::Logger()->AddIndentClear( KMarkerEngine ).AddFormat( KLogLeave, &iFunc ).Commit();
+ }
+ else
+ {
+ // The function exited normally
+ if ( iRetFormat.Length() == 0 )
+ {
+ MRadioEngineLogger::Logger()->AddIndentClear( KMarkerEngine ).AddFormat( KLogExit, &iFunc ).Commit();
+ }
+ else
+ {
+ TBuf<100> format( KLogExitRet );
+ format.Append( iRetFormat );
+ #if defined( __WINS__ )
+
+ TInt32 retVal = 0;
+ _asm( mov retVal, ebx );
+ MRadioEngineLogger::Logger()->AddIndentClear( KMarkerEngine ).AddFormat( format, &iFunc, retVal ).Commit();
+
+ #else
+
+ MRadioEngineLogger::Logger()->AddIndentClear( KMarkerEngine ).AddFormat( KLogExit, &iFunc ).Commit();
+
+ #endif
+ }
+ }
+ }
+
+#else // #ifdef LOGGING_ENABLED
+
+// ===========================================================================
+// Dummy function definitions to keep the exports unchanged when logging is turned off
+// These can not be used.
+// ===========================================================================
+EXPORT_C TRadioMethodLogger::TRadioMethodLogger( const TText*, const TText* ) {}
+EXPORT_C TRadioMethodLogger::~TRadioMethodLogger() {}
+
+#endif // #ifdef LOGGING_ENABLED
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradioenginetls.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <coemain.h>
+#include <e32svr.h>
+
+#include "cradioenginelogger.h"
+#include "cradioenginetls.h"
+
+const int KUidRadioEngineTls = 0x10281CB8;
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Returns the CRadioEngineTls instance from TLS
+// ---------------------------------------------------------------------------
+//
+CRadioEngineTls& CRadioEngineTls::Instance()
+ {
+ return *static_cast<CRadioEngineTls*>( UserSvr::DllTls( KUidRadioEngineTls ) );
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineTls::InitializeL( CCoeEnv* aEnv, RFs* aFs )
+ {
+ if ( !UserSvr::DllTls( KUidRadioEngineTls ) )
+ {
+ CRadioEngineTls* self = new ( ELeave ) CRadioEngineTls( aEnv, aFs );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ User::LeaveIfError( UserSvr::DllSetTls( KUidRadioEngineTls, self ) );
+ CleanupStack::Pop( self );
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineTls::CRadioEngineTls( CCoeEnv* aEnv, RFs* aFs )
+ : iEnv( aEnv )
+ , iFs( aFs )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineTls::ConstructL()
+ {
+ if ( !iEnv )
+ {
+ iEnv = CCoeEnv::Static();
+ }
+
+ if ( !iFs )
+ {
+ iFsOwned = ETrue;
+ iFs = new ( ELeave ) RFs;
+ User::LeaveIfError( iFs->Connect() );
+ }
+
+#ifdef LOGGING_ENABLED
+ iLogger = CRadioEngineLogger::NewL( *iFs );
+#endif // LOGGING_ENABLED
+
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioEngineTls::~CRadioEngineTls()
+ {
+ UserSvr::DllFreeTls( KUidRadioEngineTls );
+
+#ifdef LOGGING_ENABLED
+ delete iLogger;
+#endif
+
+ if ( iFs && iFsOwned )
+ {
+ iFs->Close();
+ delete iFs;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// Return the logger storage if logging is enabled
+// ---------------------------------------------------------------------------
+//
+MRadioEngineLogger* CRadioEngineTls::Logger()
+ {
+#ifdef LOGGING_ENABLED
+ return CRadioEngineTls::Instance().iLogger;
+#else
+ return NULL;
+#endif
+ }
+
+
+// ---------------------------------------------------------------------------
+// Return the eikon environment
+// ---------------------------------------------------------------------------
+//
+CCoeEnv* CRadioEngineTls::Env()
+ {
+ return CRadioEngineTls::Instance().iEnv;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Returns the file server session
+// ---------------------------------------------------------------------------
+//
+RFs& CRadioEngineTls::FsSession()
+ {
+ return *CRadioEngineTls::Instance().iFs;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CRadioEngineTls::AddRef
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineTls::AddRef()
+ {
+ ++iRefs;
+ }
+
+// ---------------------------------------------------------------------------
+// CRadioEngineTls::Release
+// ---------------------------------------------------------------------------
+//
+void CRadioEngineTls::Release()
+ {
+ __ASSERT_DEBUG( iRefs > 0 , User::Panic( _L( "CRadioEngineTls" ), KErrCorrupt ) );
+ if ( !--iRefs )
+ {
+ delete this;
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradiopropertyobserver.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradioenginelogger.h"
+
+#include "cradiopropertyobserver.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRadioPropertyObserver::CRadioPropertyObserver( MRadioPropertyChangeObserver& aObserver,
+ const TUid& aCategory,
+ const TUint aKey,
+ const TRadioPropertyType aPropertyType )
+ : CActive( CActive::EPriorityStandard )
+ , iObserver( aObserver )
+ , iCategory( aCategory )
+ , iKey( aKey )
+ , iPropertyType( aPropertyType )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRadioPropertyObserver::ConstructL()
+ {
+ switch ( iPropertyType )
+ {
+ case ERadioPropertyInt:
+ {
+ break;
+ }
+ case ERadioPropertyByteArray:
+ {
+ iValueByteArray = HBufC8::NewL( RProperty::KMaxPropertySize );
+ break;
+ }
+ case ERadioPropertyText:
+ {
+ // Max size in bytes, length is size / 2
+ iValueText = HBufC::NewL( RProperty::KMaxPropertySize / 2 );
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ User::LeaveIfError( iProperty.Attach( iCategory, iKey ) );
+ CActiveScheduler::Add( this );
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRadioPropertyObserver* CRadioPropertyObserver::NewL( MRadioPropertyChangeObserver& aObserver,
+ const TUid& aCategory,
+ const TUint aKey,
+ const TRadioPropertyType aPropertyType )
+ {
+ CRadioPropertyObserver* self = new( ELeave )CRadioPropertyObserver( aObserver,
+ aCategory, aKey, aPropertyType );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CRadioPropertyObserver::~CRadioPropertyObserver()
+ {
+ Cancel();
+ iProperty.Close();
+ delete iValueByteArray;
+ delete iValueText;
+ }
+
+// ---------------------------------------------------------------------------
+// Subscribes to a property and reads the value, if not already active.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioPropertyObserver::ActivateL()
+ {
+ if ( !IsActive() )
+ {
+ RunL();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CRadioPropertyObserver::RunL()
+ {
+ LOG_METHOD_AUTO;
+
+ iProperty.Subscribe( iStatus );
+ SetActive();
+
+ TInt err( KErrNone );
+
+ switch ( iPropertyType )
+ {
+ case ERadioPropertyInt:
+ {
+ err = iProperty.Get( iValueInt );
+ if ( !err )
+ {
+ iObserver.HandlePropertyChangeL( iCategory, iKey, iValueInt );
+ }
+ break;
+ }
+ case ERadioPropertyByteArray:
+ {
+ TPtr8 ptr8( iValueByteArray->Des() );
+ err = iProperty.Get( ptr8 );
+ if ( !err )
+ {
+ iObserver.HandlePropertyChangeL( iCategory, iKey, *iValueByteArray );
+ }
+ break;
+ }
+ case ERadioPropertyText:
+ {
+ TPtr ptr( iValueText->Des() );
+ err = iProperty.Get( ptr );
+ if ( !err )
+ {
+ iObserver.HandlePropertyChangeL( iCategory, iKey, *iValueText );
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ if ( err )
+ {
+ iObserver.HandlePropertyChangeErrorL( iCategory, iKey, err );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// Cancels an outstanding active request
+// -----------------------------------------------------------------------------
+//
+void CRadioPropertyObserver::DoCancel()
+ {
+ iProperty.Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// Getter for integer value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CRadioPropertyObserver::ValueInt() const
+ {
+ return iValueInt;
+ }
+
+// -----------------------------------------------------------------------------
+// Getter for byte array value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CRadioPropertyObserver::ValueDes8() const
+ {
+ return *iValueByteArray;
+ }
+
+// -----------------------------------------------------------------------------
+// Getter for text value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CRadioPropertyObserver::ValueDes() const
+ {
+ return *iValueText;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradiopubsub.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradiopubsub.h"
+#include "cradiopubsubimp.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioPubSub* CRadioPubSub::NewL()
+ {
+ return CRadioPubSubImp::NewL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioPubSub::~CRadioPubSub()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradiopubsubimp.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,562 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "radiouid.hrh"
+
+#include "cradioenginelogger.h"
+#include "radiointernalpskeys.h"
+
+#include "mradiocontroleventobserver.h"
+#include "cradiopubsub.h"
+#include "cradiopubsubimp.h"
+#include "radioengineutils.h"
+
+// This has to be the last include.
+#ifdef STUB_CONSTELLATION
+# include "RadioStubManager.h"
+# define KRadioPSUid KStub_KRadioPSUid
+#endif //STUB_CONSTELLATION
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioPubSubImp::CRadioPubSubImp()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioPubSubImp::ConstructL()
+ {
+ RadioEngineUtils::InitializeL();
+ LOG_METHOD_AUTO;
+
+ // Define data properties.
+ DefinePropertyL( KRadioPSDataChannel, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataFrequency, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataRadioPowerState, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataVolume, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataChannelDataChanged, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataTuningState, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataRadioMuteState, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataApplicationRunning, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataHeadsetStatus, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataFrequencyDecimalCount, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataLoudspeakerStatus, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataRdsProgramService, RProperty::EText, ETrue );
+ DefinePropertyL( KRadioPSDataRdsRadioText, RProperty::EText, ETrue );
+ DefinePropertyL( KRadioPSDataChannelName, RProperty::EText, ETrue );
+ DefinePropertyL( KRadioPSDataActivePresetListCount, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataActivePresetListFocus, RProperty::EInt, ETrue );
+ DefinePropertyL( KRadioPSDataRadioAntennaState, RProperty::EInt, ETrue );
+
+ // Define control properties.
+ DefinePropertyL( KRadioPSControlStepToChannel, RProperty::EInt, EFalse );
+ DefinePropertyL( KRadioPSControlSetChannel, RProperty::EInt, EFalse );
+ DefinePropertyL( KRadioPSControlSeek, RProperty::EInt, EFalse );
+ DefinePropertyL( KRadioPSControlStepToFrequency, RProperty::EInt, EFalse );
+ DefinePropertyL( KRadioPSControlSetFrequency, RProperty::EInt, EFalse );
+ DefinePropertyL( KRadioPSControlAdjustVolume , RProperty::EInt, EFalse );
+ DefinePropertyL( KRadioPSControlSetRadioMuteState, RProperty::EInt, EFalse );
+ DefinePropertyL( KRadioPSControlSetAudioOutput, RProperty::EInt, EFalse );
+
+ // Observe control properties.
+ CreatePropertyObserverL( KRadioPSControlStepToChannel, CRadioPropertyObserver::ERadioPropertyInt );
+ CreatePropertyObserverL( KRadioPSControlSetChannel, CRadioPropertyObserver::ERadioPropertyInt );
+ CreatePropertyObserverL( KRadioPSControlSeek, CRadioPropertyObserver::ERadioPropertyInt );
+ CreatePropertyObserverL( KRadioPSControlStepToFrequency, CRadioPropertyObserver::ERadioPropertyInt );
+ CreatePropertyObserverL( KRadioPSControlSetFrequency, CRadioPropertyObserver::ERadioPropertyInt );
+ CreatePropertyObserverL( KRadioPSControlAdjustVolume, CRadioPropertyObserver::ERadioPropertyInt );
+ CreatePropertyObserverL( KRadioPSControlSetRadioMuteState, CRadioPropertyObserver::ERadioPropertyInt );
+ CreatePropertyObserverL( KRadioPSControlSetAudioOutput, CRadioPropertyObserver::ERadioPropertyInt );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioPubSubImp* CRadioPubSubImp::NewL()
+ {
+ CRadioPubSubImp* self = new ( ELeave ) CRadioPubSubImp();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioPubSubImp::~CRadioPubSubImp()
+ {
+ iPropertyArray.ResetAndDestroy();
+
+ DeleteProperty( KRadioPSDataChannel );
+ DeleteProperty( KRadioPSDataFrequency );
+ DeleteProperty( KRadioPSDataRadioPowerState );
+ DeleteProperty( KRadioPSDataVolume );
+ DeleteProperty( KRadioPSDataChannelDataChanged );
+ DeleteProperty( KRadioPSDataTuningState );
+ DeleteProperty( KRadioPSDataRadioMuteState );
+ DeleteProperty( KRadioPSDataApplicationRunning );
+ DeleteProperty( KRadioPSDataHeadsetStatus );
+ DeleteProperty( KRadioPSDataFrequencyDecimalCount );
+ DeleteProperty( KRadioPSDataLoudspeakerStatus );
+ DeleteProperty( KRadioPSDataRdsProgramService );
+ DeleteProperty( KRadioPSDataRdsRadioText );
+ DeleteProperty( KRadioPSDataChannelName );
+ DeleteProperty( KRadioPSDataActivePresetListCount );
+ DeleteProperty( KRadioPSDataActivePresetListFocus );
+ DeleteProperty( KRadioPSDataRadioAntennaState );
+
+ DeleteProperty( KRadioPSControlStepToChannel );
+ DeleteProperty( KRadioPSControlSetChannel );
+ DeleteProperty( KRadioPSControlSeek );
+ DeleteProperty( KRadioPSControlStepToFrequency );
+ DeleteProperty( KRadioPSControlSetFrequency );
+ DeleteProperty( KRadioPSControlAdjustVolume );
+ DeleteProperty( KRadioPSControlSetRadioMuteState );
+ DeleteProperty( KRadioPSControlSetAudioOutput );
+
+ RadioEngineUtils::Release();
+ }
+
+// ---------------------------------------------------------------------------
+// Defines a property.
+// ---------------------------------------------------------------------------
+//
+void CRadioPubSubImp::DefinePropertyL( TUint aKey, TInt aAttr, TBool aDataProperty ) const
+ {
+ _LIT_SECURITY_POLICY_PASS( KRadioExternalAccessPolicy );
+ _LIT_SECURITY_POLICY_S0( KRadioInternalAccessPolicy, KUidRadioApplication );
+
+ TInt err = KErrNone;
+ if ( aDataProperty )
+ {
+ // For data properties, grant read access for all, but write access only for radio application
+ err = RProperty::Define( KRadioPSUid, aKey, aAttr, KRadioExternalAccessPolicy, KRadioInternalAccessPolicy );
+ }
+ else
+ {
+ // For control properties, grant read access only for radio application, but write access for all
+ err = RProperty::Define( KRadioPSUid, aKey, aAttr, KRadioInternalAccessPolicy, KRadioExternalAccessPolicy );
+ }
+
+ if ( err && err != KErrAlreadyExists )
+ {
+ LOG_FORMAT( "CRadioPubSubImp::DefinePropertyL: Leaving with %d", err );
+ User::Leave( err );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Deletes a property
+// ---------------------------------------------------------------------------
+//
+void CRadioPubSubImp::DeleteProperty( TUint aKey ) const
+ {
+ RProperty::Delete( KRadioPSUid, aKey );
+ }
+
+// ---------------------------------------------------------------------------
+// Creates a property observer
+// ---------------------------------------------------------------------------
+//
+void CRadioPubSubImp::CreatePropertyObserverL( const TUint aKey,
+ const TInt aPropertyType )
+ {
+ CRadioPropertyObserver* observer = CRadioPropertyObserver::NewL( *this, KRadioPSUid,
+ aKey, static_cast<CRadioPropertyObserver::TRadioPropertyType>( aPropertyType ) );
+
+ if ( iPropertyArray.Append( observer ) == KErrNone )
+ {
+ observer->ActivateL();
+ }
+ else
+ {
+ delete observer;
+ observer = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the integer value stored in a property.
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::Get( TUint aKey, TInt& aValue ) const
+ {
+ return RProperty::Get( KRadioPSUid, aKey, aValue ) == KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Sets a property's value.
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::Set( TUint aKey, TInt aValue ) const
+ {
+ return RProperty::Set( KRadioPSUid, aKey, aValue ) == KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Sets a text property value
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::Set( TUint aKey, const TDesC& aValue ) const
+ {
+ return RProperty::Set( KRadioPSUid, aKey, aValue ) == KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioPubSubImp::HandlePropertyChangeL( const TUid& aCategory,
+ const TUint aKey,
+ const TInt aValue )
+ {
+ LOG_FORMAT( "CRadioPubSubImp::HandlePropertyChangeL: Category: %d, Key: %u. Value: %d",
+ aCategory.iUid, aKey, aValue );
+
+ if ( aCategory != KRadioPSUid )
+ {
+ LOG( "CRadioPubSubImp::HandlePropertyChangeL: Unknown category. Leaving" );
+ User::Leave( KErrArgument );
+ }
+
+ if ( !iObserver )
+ {
+ return;
+ }
+
+ if ( aKey == KRadioPSControlStepToChannel )
+ {
+ if ( aValue == ERadioPSStepToChannelUp )
+ {
+ iObserver->StepToChannelL( RadioEngine::ERadioUp );
+ }
+ else if ( aValue == ERadioPSStepToChannelDown )
+ {
+ iObserver->StepToChannelL( RadioEngine::ERadioDown );
+ }
+ }
+ else if ( aKey == KRadioPSControlSetChannel )
+ {
+ if ( aValue > 0 )
+ {
+ iObserver->SetChannelL( aValue );
+ }
+ }
+ else if ( aKey == KRadioPSControlSeek )
+ {
+ if ( aValue == ERadioPSSeekUp )
+ {
+ iObserver->SeekL( RadioEngine::ERadioUp );
+ }
+ else if ( aValue == ERadioPSSeekDown )
+ {
+ iObserver->SeekL( RadioEngine::ERadioDown );
+ }
+ }
+ else if ( aKey == KRadioPSControlStepToFrequency )
+ {
+ if ( aValue == ERadioPSStepToFrequencyUp )
+ {
+ iObserver->StepToFrequencyL( RadioEngine::ERadioUp );
+ }
+ else if ( aValue == ERadioPSStepToFrequencyDown )
+ {
+ iObserver->StepToFrequencyL( RadioEngine::ERadioDown );
+ }
+ }
+ else if ( aKey == KRadioPSControlSetFrequency )
+ {
+ if ( aValue > 0 )
+ {
+ iObserver->SetFrequencyL( aValue );
+ }
+ }
+ else if ( aKey == KRadioPSControlAdjustVolume )
+ {
+ if ( aValue == ERadioPSIncreaseVolume )
+ {
+ iObserver->AdjustVolumeL( RadioEngine::ERadioIncVolume );
+ }
+ else if ( aValue == ERadioPSDecreaseVolume )
+ {
+ iObserver->AdjustVolumeL( RadioEngine::ERadioDecVolume );
+ }
+ }
+ else if ( aKey == KRadioPSControlSetRadioMuteState )
+ {
+ if ( aValue == ERadioPSMuteStateOn )
+ {
+ iObserver->MuteL( ETrue );
+ }
+ else if ( aValue == ERadioPSMuteStateOff )
+ {
+ iObserver->MuteL( EFalse );
+ }
+ }
+ else if ( aKey == KRadioPSControlSetAudioOutput )
+ {
+ if ( aValue == ERadioPSAudioOutputHeadset )
+ {
+ iObserver->SetAudioRouteL( RadioEngine::ERadioHeadset );
+ }
+ else if ( aValue == ERadioPSAudioOutputSpeaker )
+ {
+ iObserver->SetAudioRouteL( RadioEngine::ERadioSpeaker );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishChannel( TInt aChannelId ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishChannel ( aChannelId = %d )", aChannelId );
+
+ TInt oldChannelId = 0;
+ if ( Get( KRadioPSDataChannel, oldChannelId ) && aChannelId != oldChannelId )
+ {
+ return Set( KRadioPSDataChannel, aChannelId );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishFrequency( TUint32 aFreq ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishFrequency ( aFreq = %u )", aFreq );
+
+ TInt oldFreq = 0;
+ if ( Get( KRadioPSDataFrequency, oldFreq ) && aFreq != oldFreq )
+ {
+ return Set( KRadioPSDataFrequency, aFreq );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishPowerState( TBool aPowerOn ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishStateL ( aPowerOn = %d )", aPowerOn );
+ // If VR process gets killed, power on state remains published.
+ // Must not compare state transition here, because then power on might not be published.
+ TRadioPSRadioPowerState newState = aPowerOn ? ERadioPSRadioPowerOn : ERadioPSRadioPowerOff;
+ return Set( KRadioPSDataRadioPowerState, newState );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishVolume( TInt aVol ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishVolume ( aVol = %d )", aVol );
+
+ TInt oldVol = 0;
+ if ( Get( KRadioPSDataVolume, oldVol ) && aVol != oldVol )
+ {
+ return Set( KRadioPSDataVolume, aVol );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishChannelDataChanged( TInt aChannelId ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishChannelDataChangedL ( aChannelId = %d )", aChannelId );
+
+ // Channel data changed notifications are allowed for the same channel multiple times, as the same channel's
+ // data can be changed many times in a row.
+
+ return Set( KRadioPSDataChannelDataChanged, aChannelId );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishTuningState( TRadioPSTuningState aTuningState ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishSeekingStateL ( aTuningState = %d )", aTuningState );
+
+ TInt oldState = 0;
+ if ( Get( KRadioPSDataTuningState, oldState ) && aTuningState != oldState )
+ {
+ return Set( KRadioPSDataTuningState, aTuningState );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishRadioMuteState( TBool aMuted ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishMuteStateL ( aMuted = %d )", aMuted );
+
+ TRadioPSRadioMuteState newState = aMuted ? ERadioPSMuteStateOn : ERadioPSMuteStateOff;
+
+ TInt oldState = 0;
+ if ( Get( KRadioPSDataRadioMuteState, oldState ) && oldState != newState )
+ {
+ return Set( KRadioPSDataRadioMuteState, newState );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishApplicationRunningState( TRadioPSApplicationRunningState aRunningState ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishApplicationRunningStateL ( aRunningState = %d )", aRunningState );
+ // If VR process gets killed, wrong running state remains published.
+ // Must not compare state transition here, because then application start might not be published.
+ return Set( KRadioPSDataApplicationRunning, aRunningState );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishHeadsetStatus( TRadioPSHeadsetStatus aHeadsetStatus ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishHeadsetStatusL ( aHeadsetStatus = %d )", aHeadsetStatus );
+
+ TInt oldStatus = 0;
+ if ( Get( KRadioPSDataHeadsetStatus, oldStatus ) && aHeadsetStatus != oldStatus )
+ {
+ return Set( KRadioPSDataHeadsetStatus, aHeadsetStatus );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishFrequencyDecimalCount( TRadioPSFrequencyDecimalCount aDecimalCount ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishFrequencyDecimalCountL ( aDecimalCount = %d )", aDecimalCount );
+
+ TInt oldCount = 0;
+ if ( Get( KRadioPSDataFrequencyDecimalCount, oldCount ) && aDecimalCount != oldCount )
+ {
+ return Set( KRadioPSDataFrequencyDecimalCount, aDecimalCount );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishLoudspeakerStatus( TRadioPSLoudspeakerStatus aLoudspeakerStatus ) const
+ {
+ LOG_FORMAT( "CRadioPubSubImp::PublishLoudspeakerStatusL ( aLoudspeakerStatus = %d )", aLoudspeakerStatus );
+ TInt oldStatus = 0;
+ if ( Get( KRadioPSDataLoudspeakerStatus, oldStatus ) && oldStatus != aLoudspeakerStatus )
+ {
+ return Set( KRadioPSDataLoudspeakerStatus, aLoudspeakerStatus );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishRdsProgramService( const TDesC& aProgramService ) const
+ {
+ return Set( KRadioPSDataRdsProgramService, aProgramService );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishRdsRadioText( const TDesC& aRadioText ) const
+ {
+ return Set( KRadioPSDataRdsRadioText, aRadioText );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishChannelName( const TDesC& aName ) const
+ {
+ return Set( KRadioPSDataChannelName, aName );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishActivePreseListCount( TInt aCount ) const
+ {
+ return Set( KRadioPSDataActivePresetListCount, aCount );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishActivePreseListFocus( TInt aIndex ) const
+ {
+ return Set( KRadioPSDataActivePresetListFocus, aIndex );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioPubSubImp::PublishAntennaState( TRadioPSRadioAntennaState aState ) const
+ {
+ return Set( KRadioPSDataRadioAntennaState, aState );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioPubSubImp::SetControlEventObserver( MRadioControlEventObserver* aControlEventObserver )
+ {
+ iObserver = aControlEventObserver;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradioremcontarget.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// User includes
+#include "cradioremcontarget.h"
+#include "cradioremcontargetimp.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioRemConTarget* CRadioRemConTarget::NewL()
+ {
+ return CRadioRemConTargetImp::NewL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRemConTarget::~CRadioRemConTarget()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradioremcontargetimp.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,436 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <remconcallhandlingtarget.h>
+#include <remconcoreapitarget.h>
+#include <remconinterfaceselector.h>
+
+// User includes
+#include "cradioenginelogger.h"
+#include "cradioremcontargetimp.h"
+#include "mradiocontroleventobserver.h"
+#include "radioengineutils.h"
+
+// Constants
+const TInt KVRVolumeTimerInitialDelay = 1000000; // Initial timer for headset volume up/down press event should expire immediately
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRemConTargetImp::CRadioRemConTargetImp()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::ConstructL()
+ {
+ RadioEngineUtils::InitializeL();
+ // Create interface selector.
+ iInterfaceSelector = CRemConInterfaceSelector::NewL();
+ // Create a new CRemConCoreApiTarget, owned by the interface selector.
+ iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
+ // Create a new CRemConCallHandlingTarget, owned by the interface selector.
+ iCallTarget = CRemConCallHandlingTarget::NewL( *iInterfaceSelector, *this );
+ // Start being a target.
+ iInterfaceSelector->OpenTargetL();
+ // Create repeat timer.
+ iRepeatTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRemConTargetImp* CRadioRemConTargetImp::NewL()
+ {
+ CRadioRemConTargetImp* self = new ( ELeave ) CRadioRemConTargetImp();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRemConTargetImp::~CRadioRemConTargetImp()
+ {
+ if ( iRepeatTimer )
+ {
+ iRepeatTimer->Cancel();
+ }
+ delete iRepeatTimer;
+ delete iInterfaceSelector; //deletes also iCallTarget and iCoreTarget
+ iCoreTarget = NULL;
+ iCallTarget = NULL;
+ RadioEngineUtils::Release();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::SetControlEventObserver( MRadioControlEventObserver* aControlEventObserver )
+ {
+ iObserver = aControlEventObserver;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::MrccatoCommand( TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct )
+ {
+ LOG_FORMAT( "CRadioRemConTargetImp::MrccatoCommand ( aOperationId = %d, aButtonAct = %d )", aOperationId, aButtonAct );
+ //TODO: Refactor
+ if ( iObserver )
+ {
+ switch ( aOperationId )
+ {
+ case ERemConCoreApiChannelUp:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE( iObserver->ChannelUpL( ETrue ); iObserver->ChannelUpL( EFalse ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonPress )
+ {
+ TRAP_IGNORE( iObserver->ChannelUpL( ETrue ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonRelease )
+ {
+ TRAP_IGNORE( iObserver->ChannelUpL( EFalse ));
+ }
+ else {}
+ break;
+ }
+ case ERemConCoreApiChannelDown:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE( iObserver->ChannelDownL( ETrue ); iObserver->ChannelDownL( EFalse ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonPress )
+ {
+ TRAP_IGNORE( iObserver->ChannelDownL( ETrue ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonRelease )
+ {
+ TRAP_IGNORE( iObserver->ChannelDownL( EFalse ));
+ }
+ else {}
+ break;
+ }
+ case ERemConCoreApiVolumeUp:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE( iObserver->VolumeUpL( ETrue ); iObserver->VolumeUpL( EFalse ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonPress )
+ {
+ iRepeatTimer->Cancel();
+ iRepeatId = ERemConCoreApiVolumeUp;
+ iRepeatTimer->Start( KVRVolumeTimerInitialDelay, KVRVolumeTimerInitialDelay, TCallBack( RepeatTimerCallback, this ));
+ TRAP_IGNORE( iObserver->VolumeUpL( ETrue ); iObserver->VolumeUpL( EFalse ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonRelease )
+ {
+ iRepeatTimer->Cancel();
+ }
+ else {}
+ break;
+ }
+ case ERemConCoreApiVolumeDown:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE( iObserver->VolumeDownL( ETrue ); iObserver->VolumeDownL( EFalse ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonPress )
+ {
+ iRepeatTimer->Cancel();
+ iRepeatId = ERemConCoreApiVolumeDown;
+ iRepeatTimer->Start( KVRVolumeTimerInitialDelay, KVRVolumeTimerInitialDelay, TCallBack( RepeatTimerCallback, this ));
+ TRAP_IGNORE( iObserver->VolumeDownL( ETrue ); iObserver->VolumeDownL( EFalse ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonRelease )
+ {
+ iRepeatTimer->Cancel();
+ }
+ else {}
+ break;
+ }
+ case ERemConCoreApiStop:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE( iObserver->StopL( ETrue ); iObserver->StopL( EFalse ));
+ }
+ break;
+ }
+ case ERemConCoreApiBackward:
+ {
+ if( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE( iObserver->BackwardL( ETrue ); iObserver->BackwardL( EFalse ));
+ }
+ break;
+ }
+ case ERemConCoreApiRewind:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonPress )
+ {
+ LOG( "ERemConCoreApiRewind" );
+ TRAP_IGNORE( iObserver->RewindL( ETrue ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonRelease )
+ {
+ TRAP_IGNORE( iObserver->RewindL( EFalse ));
+ }
+ else {}
+ break;
+ }
+ case ERemConCoreApiForward:
+ {
+ if( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE( iObserver->ForwardL( ETrue ); iObserver->ForwardL( EFalse ));
+ }
+ break;
+ }
+ case ERemConCoreApiFastForward:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonPress )
+ {
+ LOG( "ERemConCoreApiFastForward" );
+ TRAP_IGNORE( iObserver->FastForwardL( ETrue ));
+ }
+ else if ( aButtonAct == ERemConCoreApiButtonRelease )
+ {
+ TRAP_IGNORE( iObserver->FastForwardL( EFalse ));
+ }
+ else {}
+ break;
+ }
+ case ERemConCoreApiPlay:
+ case ERemConCoreApiPause:
+ case ERemConCoreApiPausePlayFunction:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE( iObserver->PausePlayL( ETrue ); iObserver->PausePlayL( EFalse ));
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/,
+ TRemConCoreApiButtonAction aButtonAct )
+ {
+ LOG( "CRadioRemConTargetImp::MrccatoPlay" );
+ if ( iObserver )
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE( iObserver->PlayL( ETrue ); iObserver->PlayL( EFalse ))
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::MrccatoTuneFunction( TBool /*aTwoPart*/,
+ TUint /*aMajorChannel*/,
+ TUint /*aMinorChannel*/,
+ TRemConCoreApiButtonAction /*aButtonAct*/)
+ {
+ LOG( "CRadioRemConTargetImp::MrccatoTuneFunction ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::MrccatoSelectDiskFunction( TUint /*aDisk*/,
+ TRemConCoreApiButtonAction /*aButtonAct*/)
+ {
+ LOG( "CRadioRemConTargetImp::MrccatoSelectDiskFunction ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::MrccatoSelectAvInputFunction( TUint8 /*aAvInputSignalNumber*/,
+ TRemConCoreApiButtonAction /*aButtonAct*/)
+ {
+ LOG( "CRadioRemConTargetImp::MrccatoSelectAvInputFunction ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::MrccatoSelectAudioInputFunction( TUint8 /*aAudioInputSignalNumber*/,
+ TRemConCoreApiButtonAction /*aButtonAct*/)
+ {
+ LOG( "CRadioRemConTargetImp::MrccatoSelectAudioInputFunction ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt CRadioRemConTargetImp::RepeatTimerCallback( TAny* aPtr )
+ {
+ LOG( "CRadioRemConTargetImp::RepeatTimerCallback" );
+
+ CRadioRemConTargetImp* self = reinterpret_cast<CRadioRemConTargetImp*>( aPtr );
+
+ if ( self )
+ {
+ if ( self->iObserver )
+ {
+ switch ( self->iRepeatId )
+ {
+ case ERemConCoreApiVolumeUp:
+ {
+ TRAP_IGNORE( self->iObserver->VolumeUpL( ETrue ); self->iObserver->VolumeUpL( EFalse ))
+ break;
+ }
+ case ERemConCoreApiVolumeDown:
+ {
+ TRAP_IGNORE( self->iObserver->VolumeDownL( ETrue ); self->iObserver->VolumeDownL( EFalse ))
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::AnswerCall()
+ {
+ LOG( "CRadioRemConTargetImp::AnswerCall() ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::AnswerEndCall()
+ {
+ LOG( "CRadioRemConTargetImp::AnswerEndCall() " );
+ if ( iObserver )
+ {
+ TRAP_IGNORE( iObserver->AnswerEndCallL())
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::DialCall( const TDesC8& /*aTelNumber*/ )
+ {
+ LOG( "CRadioRemConTargetImp::DialCall ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::EndCall()
+ {
+ LOG( "CRadioRemConTargetImp::EndCall() ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::GenerateDTMF( const TChar /*aChar*/ )
+ {
+ LOG( "CRadioRemConTargetImp::GenerateDTMF ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::LastNumberRedial()
+ {
+ LOG( "CRadioRemConTargetImp::LastNumberRedial ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::MultipartyCalling( const TDesC8& /*aData*/ )
+ {
+ LOG( "CRadioRemConTargetImp::MultipartyCalling ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::SpeedDial( const TInt /*aIndex*/ )
+ {
+ LOG( "CRadioRemConTargetImp::SpeedDial ( currently unsupported in Visual Radio )" );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRemConTargetImp::VoiceDial( const TBool /*aActivate*/ )
+ {
+ LOG( "CRadioRemConTargetImp::VoiceDial ( currently unsupported in Visual Radio )" );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradiorepositoryentitybase.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradiorepositoryentitybase.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRepositoryEntityBase::CRadioRepositoryEntityBase( const TUid& aUid,
+ TUint32 aKey,
+ MRadioRepositoryEntityObserver& aObserver,
+ CActive::TPriority aPriority )
+ : CActive( aPriority ), iObserver( aObserver ), iUid( aUid ), iKey( aKey )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRepositoryEntityBase::~CRadioRepositoryEntityBase()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the UID of this entity.
+// ---------------------------------------------------------------------------
+//
+const TUid& CRadioRepositoryEntityBase::Uid() const
+ {
+ return iUid;
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the key of this entity.
+// ---------------------------------------------------------------------------
+//
+TUint32 CRadioRepositoryEntityBase::Key() const
+ {
+ return iKey;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradiorepositorymanager.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradiorepositorymanager.h"
+#include "cradiorepositorymanagerimp.h"
+#include "radioengineutils.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioRepositoryManager* CRadioRepositoryManager::NewL( TInt aGranularity )
+ {
+ return CRadioRepositoryManagerImp::NewL( aGranularity );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioRepositoryManager::~CRadioRepositoryManager()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRepositoryManager::SetRepositoryValueL( const TUid& aUid, TUint32 aKey, TInt aValue )
+ {
+ CRadioRepositoryManagerImp::SetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRepositoryManager::SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TReal& aValue )
+ {
+ CRadioRepositoryManagerImp::SetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRepositoryManager::SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TDesC8& aValue )
+ {
+ CRadioRepositoryManagerImp::SetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRepositoryManager::SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TDesC16& aValue )
+ {
+ CRadioRepositoryManagerImp::SetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRepositoryManager::GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TInt& aValue )
+ {
+ CRadioRepositoryManagerImp::GetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRepositoryManager::GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TReal& aValue )
+ {
+ CRadioRepositoryManagerImp::GetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRepositoryManager::GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TDes8& aValue )
+ {
+ CRadioRepositoryManagerImp::GetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRepositoryManager::GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TDes16& aValue )
+ {
+ CRadioRepositoryManagerImp::GetRepositoryValueL( aUid, aKey, aValue );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradiorepositorymanagerimp.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,454 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradiorepositoryentity.h"
+#include "cradiorepositorymanager.h"
+#include "cradiorepositorymanagerimp.h"
+#include "radioengineutils.h"
+
+const TInt KVRRepositoryObserverArrayGranularity = 2;
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Panics the application.
+// ---------------------------------------------------------------------------
+//
+void Panic( TInt aReason )
+ {
+ _LIT( category, "CRadioRepositoryManagerImp" );
+ User::Panic( category, aReason );
+ }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRepositoryManagerImp* CRadioRepositoryManagerImp::NewL( TInt aGranularity )
+ {
+ CRadioRepositoryManagerImp* self = new ( ELeave ) CRadioRepositoryManagerImp( aGranularity );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::ConstructL()
+ {
+ RadioEngineUtils::InitializeL();
+ CheckRepositoryKeysL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRepositoryManagerImp::CRadioRepositoryManagerImp( TInt aGranularity )
+ : iObservers( KVRRepositoryObserverArrayGranularity )
+ , iEntities( aGranularity )
+ , iEnableSave( ETrue )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioRepositoryManagerImp::~CRadioRepositoryManagerImp()
+ {
+ iObservers.Close();
+ iEntities.ResetAndDestroy();
+ RadioEngineUtils::Release();
+ }
+
+// ---------------------------------------------------------------------------
+// Adds observer
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::AddObserverL( MRadioRepositoryEntityObserver* aObserver )
+ {
+ iObservers.AppendL( aObserver );
+ }
+
+// ---------------------------------------------------------------------------
+// Removes observer
+// ---------------------------------------------------------------------------
+//
+ void CRadioRepositoryManagerImp::RemoveObserver( MRadioRepositoryEntityObserver* aObserver )
+ {
+ TInt objectIndex = iObservers.Find( aObserver );
+
+ if ( objectIndex != KErrNotFound )
+ {
+ iObservers.Remove( objectIndex );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Enables or disables the saving of entities.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::EnableSave( TBool aEnable )
+ {
+ iEnableSave = aEnable;
+ }
+
+// ---------------------------------------------------------------------------
+// Adds an entity.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::AddEntityL( const TUid& aUid, TUint32 aKey, TRadioEntityType aType )
+ {
+ CRadioRepositoryEntityBase* entity = NULL;
+
+ switch ( aType )
+ {
+ case ERadioEntityInt:
+ entity = CRadioRepositoryEntity<TInt>::NewL( aUid, aKey, *this );
+ break;
+ case ERadioEntityReal:
+ entity = CRadioRepositoryEntity<TReal>::NewL( aUid, aKey, *this );
+ break;
+ case ERadioEntityDes8:
+ entity = CRadioRepositoryEntity<TRadioEntityBuf8>::NewL( aUid, aKey, *this );
+ break;
+ case ERadioEntityDes16:
+ entity = CRadioRepositoryEntity<TRadioEntityBuf16>::NewL( aUid, aKey, *this );
+ break;
+ default:
+ User::Leave( KErrNotSupported );
+ break;
+ }
+
+ CleanupStack::PushL( entity );
+ iEntities.AppendL( entity );
+ CleanupStack::Pop( entity );
+ }
+
+// ---------------------------------------------------------------------------
+// Removes an entity.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::RemoveEntity( const TUid& aUid, TUint32 aKey )
+ {
+ TInt idx = EntityIndex( aUid, aKey );
+
+ if ( idx >= 0 )
+ {
+ CRadioRepositoryEntityBase* entity = iEntities[idx];
+ iEntities.Remove( idx );
+ iEntities.GranularCompress();
+ delete entity;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Sets an entity's value.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioRepositoryManagerImp::SetEntityValue( const TUid& aUid, TUint32 aKey, TInt aValue )
+ {
+ return DoSetEntityValue<TInt>( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets an entity's value.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioRepositoryManagerImp::SetEntityValue( const TUid& aUid, TUint32 aKey, const TReal& aValue )
+ {
+ return DoSetEntityValue<TReal>( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets an entity's value.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioRepositoryManagerImp::SetEntityValue( const TUid& aUid, TUint32 aKey, const TDesC8& aValue )
+ {
+ return DoSetEntityValue<TRadioEntityBuf8>( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets an entity's value.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioRepositoryManagerImp::SetEntityValue( const TUid& aUid, TUint32 aKey, const TDesC16& aValue )
+ {
+ return DoSetEntityValue<TRadioEntityBuf16>( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Returns an entity's value.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioRepositoryManagerImp::EntityValueInt( const TUid& aUid, TUint32 aKey ) const
+ {
+ return DoEntityValue<TInt>( aUid, aKey );
+ }
+
+// ---------------------------------------------------------------------------
+// Returns an entity's value.
+// ---------------------------------------------------------------------------
+//
+const TReal& CRadioRepositoryManagerImp::EntityValueReal( const TUid& aUid, TUint32 aKey ) const
+ {
+ return DoEntityValue<TReal>( aUid, aKey );
+ }
+
+// ---------------------------------------------------------------------------
+// Returns an entity's value.
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CRadioRepositoryManagerImp::EntityValueDes8( const TUid& aUid, TUint32 aKey ) const
+ {
+ return DoEntityValue<TDesC8>( aUid, aKey );
+ }
+
+// ---------------------------------------------------------------------------
+// Returns an entity's value.
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CRadioRepositoryManagerImp::EntityValueDes16( const TUid& aUid, TUint32 aKey ) const
+ {
+ return DoEntityValue<TDesC16>( aUid, aKey );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::SetRepositoryValueL( const TUid& aUid, TUint32 aKey, TInt aValue )
+ {
+ DoSetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TReal& aValue )
+ {
+ DoSetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TDesC8& aValue )
+ {
+ DoSetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::SetRepositoryValueL( const TUid& aUid, TUint32 aKey, const TDesC16& aValue )
+ {
+ DoSetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TInt& aValue )
+ {
+ DoGetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TReal& aValue )
+ {
+ DoGetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TDes8& aValue )
+ {
+ DoGetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Gets the value of a repository key.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::GetRepositoryValueL( const TUid& aUid, TUint32 aKey, TDes16& aValue )
+ {
+ DoGetRepositoryValueL( aUid, aKey, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets an entity's value.
+// ---------------------------------------------------------------------------
+//
+template <typename T>
+TInt CRadioRepositoryManagerImp::DoSetEntityValue( const TUid& aUid, TUint32 aKey, const T& aValue )
+ {
+ TInt idx = EntityIndex( aUid, aKey );
+
+ // If the entity could not be found, panic the application.
+ __ASSERT_ALWAYS( idx >= 0, ::Panic( KErrArgument ) );
+
+ return static_cast<CRadioRepositoryEntity<T>*>( iEntities[idx] )->SetValue( aValue, iEnableSave );
+ }
+
+// ---------------------------------------------------------------------------
+// Returns an entity's value.
+// ---------------------------------------------------------------------------
+//
+template <typename T>
+const T& CRadioRepositoryManagerImp::DoEntityValue( const TUid& aUid, TUint32 aKey ) const
+ {
+ TInt idx = EntityIndex( aUid, aKey );
+
+ // If the entity could not be found, panic the application.
+ __ASSERT_ALWAYS( idx >= 0, ::Panic( KErrArgument ) );
+
+ return static_cast<CRadioRepositoryEntity<T>*>( iEntities[idx] )->Value();
+ }
+
+// ---------------------------------------------------------------------------
+// Sets a key's value in the repository.
+// ---------------------------------------------------------------------------
+//
+template <typename T>
+void CRadioRepositoryManagerImp::DoSetRepositoryValueL( const TUid& aUid, TUint32 aKey, const T& aValue )
+ {
+ CRepository* repository = CRepository::NewLC( aUid );
+ User::LeaveIfError( repository->Set( aKey, aValue ) );
+ CleanupStack::PopAndDestroy( repository );
+ }
+
+// ---------------------------------------------------------------------------
+// Returns a key's value in the repository.
+// ---------------------------------------------------------------------------
+//
+template <typename T>
+void CRadioRepositoryManagerImp::DoGetRepositoryValueL( const TUid& aUid, TUint32 aKey, T& aValue )
+ {
+ CRepository* repository = CRepository::NewLC( aUid );
+ User::LeaveIfError( repository->Get( aKey, aValue ) );
+ CleanupStack::PopAndDestroy( repository );
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the entity's index that matches the supplied arguments.
+// ---------------------------------------------------------------------------
+//
+TInt CRadioRepositoryManagerImp::EntityIndex( const TUid& aUid, TUint32 aKey ) const
+ {
+ TInt idx = KErrNotFound;
+
+ for ( TInt i = 0; i < iEntities.Count(); i++ )
+ {
+ CRadioRepositoryEntityBase* entity = iEntities[i];
+ if ( entity->Uid() == aUid && entity->Key() == aKey )
+ {
+ idx = i;
+ break;
+ }
+ }
+
+ return idx;
+ }
+
+// ---------------------------------------------------------------------------
+// SIS installation does not update central repository, this checks that the new keys are in the repository.
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::CheckRepositoryKeysL()
+ {
+ // After adding a new cenrep key to radiointernalcrkeys.h, add it also here with a default value
+ /*
+ CRepository* repository = CRepository::NewLC( KVRCRUid );
+
+ TInt ret = repository->Create( KVRCRNewValue, TInt( 123 ) );
+ if ( ret != KErrAlreadyExists )
+ {
+ User::LeaveIfError( ret );
+ }
+
+ CleanupStack::PopAndDestroy( repository );
+ */
+ }
+
+// ---------------------------------------------------------------------------
+// Forwards the repository value changes
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::HandleRepositoryValueChangeL( const TUid& aUid,
+ TUint32 aKey, TInt aValue, TInt aError )
+ {
+ for ( TInt i = 0; i < iObservers.Count(); i++ )
+ {
+ iObservers[i]->HandleRepositoryValueChangeL( aUid, aKey, aValue, aError );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Forwards the repository value changes
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::HandleRepositoryValueChangeL( const TUid& aUid,
+ TUint32 aKey, const TReal& aValue, TInt aError )
+ {
+ for ( TInt i = 0; i < iObservers.Count(); i++ )
+ {
+ iObservers[i]->HandleRepositoryValueChangeL( aUid, aKey, aValue, aError );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Forwards the repository value changes
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::HandleRepositoryValueChangeL( const TUid& aUid,
+ TUint32 aKey, const TDesC8& aValue, TInt aError )
+ {
+ for ( TInt i = 0; i < iObservers.Count(); i++ )
+ {
+ iObservers[i]->HandleRepositoryValueChangeL( aUid, aKey, aValue, aError );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Forwards the repository value changes
+// ---------------------------------------------------------------------------
+//
+void CRadioRepositoryManagerImp::HandleRepositoryValueChangeL( const TUid& aUid,
+ TUint32 aKey, const TDesC16& aValue, TInt aError )
+ {
+ for ( TInt i = 0; i < iObservers.Count(); i++ )
+ {
+ iObservers[i]->HandleRepositoryValueChangeL( aUid, aKey, aValue, aError );
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradioroutableaudio.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <audiooutput.h>
+#include "cradioroutableaudio.h"
+#include "cradioaudiorouter.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioRoutableAudio::CRadioRoutableAudio( CRadioAudioRouter* aAudioRouter )
+ : iAudioRouter( aAudioRouter )
+ {
+ iAudioRouter->RegisterRoutableAudio( this );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioRoutableAudio::~CRadioRoutableAudio()
+ {
+ iAudioRouter->UnRegisterRoutableAudio( this );
+ delete iAudioOutput;
+ delete iAudioRouter;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRoutableAudio::SetAudioOutput( CAudioOutput* aAudioOutput )
+ {
+ delete iAudioOutput;
+ iAudioOutput = aAudioOutput;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRoutableAudio::DeleteAudioOutput()
+ {
+ delete iAudioOutput;
+ iAudioOutput = NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRadioRoutableAudio::SetAudioRouteL( RadioEngine::TRadioAudioRoute aRoute )
+ {
+ if ( iAudioOutput )
+ {
+ iAudioOutput->SetAudioOutputL( aRoute == RadioEngine::ERadioSpeaker ? CAudioOutput::EPublic
+ : CAudioOutput::EPrivate );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CRadioRoutableAudio::AudioRoutingSupported() const
+ {
+#ifdef __WINS__
+ return ETrue;
+#else
+ return iAudioOutput ? ETrue : EFalse;
+#endif
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradiosystemeventcollector.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cradiosystemeventcollector.h"
+#include "cradiosystemeventcollectorimp.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioSystemEventCollector* CRadioSystemEventCollector::NewL()
+ {
+ return CRadioSystemEventCollectorImp::NewL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRadioSystemEventCollector::~CRadioSystemEventCollector()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradiosystemeventcollectorimp.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,264 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <e32cmn.h>
+#include <uiklafinternalcrkeys.h>
+#include "cradioenginelogger.h"
+
+#include "cradioaccessoryobserver.h"
+#include "cradiorepositorymanager.h"
+#include "cradiosystemeventcollectorimp.h"
+#include "cradiosystemeventdetector.h"
+#include "radioengineutils.h"
+
+const TInt KVRObserverArrayGranularity( 2 );
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSystemEventCollectorImp::CRadioSystemEventCollectorImp() :
+ iSystemEventObservers( KVRObserverArrayGranularity )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::ConstructL()
+ {
+ RadioEngineUtils::InitializeL();
+ iSystemEventDetector = CRadioSystemEventDetector::NewL( *this );
+
+ iHeadsetObserver = CRadioAccessoryObserver::NewL();
+ iHeadsetObserver->SetObserver( this );
+
+ TInt criticalLevel;
+ CRadioRepositoryManager::GetRepositoryValueL( KCRUidUiklaf,
+ KUikOODDiskCriticalThreshold, criticalLevel );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSystemEventCollectorImp* CRadioSystemEventCollectorImp::NewL()
+ {
+ CRadioSystemEventCollectorImp* self = new( ELeave ) CRadioSystemEventCollectorImp;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSystemEventCollectorImp::~CRadioSystemEventCollectorImp()
+ {
+ delete iSystemEventDetector;
+ delete iHeadsetObserver;
+
+ iSystemEventObservers.Close();
+ RadioEngineUtils::Release();
+ }
+
+// ---------------------------------------------------------------------------
+// Adds a system event observer
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::AddObserverL( MRadioSystemEventObserver* aHeadsetObserver )
+ {
+ iSystemEventObservers.AppendL( aHeadsetObserver );
+ }
+
+// ---------------------------------------------------------------------------
+// Removes a system event observer
+// ---------------------------------------------------------------------------
+//
+ void CRadioSystemEventCollectorImp::RemoveObserver( MRadioSystemEventObserver* aSystemObserver )
+ {
+ TInt objectIndex = iSystemEventObservers.Find( aSystemObserver );
+
+ if ( objectIndex != KErrNotFound )
+ {
+ iSystemEventObservers.Remove( objectIndex );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Getter for mobile network state
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSystemEventCollectorImp::IsMobileNetworkCoverage() const
+ {
+ return iSystemEventDetector->IsMobileNetworkCoverage();
+ }
+
+// ---------------------------------------------------------------------------
+// Getter for network state
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSystemEventCollectorImp::IsNetworkCoverage() const
+ {
+ return iSystemEventDetector->IsNetworkCoverage();
+ }
+
+// ---------------------------------------------------------------------------
+// Getter for call state
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSystemEventCollectorImp::IsCallActive() const
+ {
+ return iSystemEventDetector->IsCallActive();
+ }
+
+// ---------------------------------------------------------------------------
+// Getter for audio resource state
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSystemEventCollectorImp::IsAudioResourcesAvailable() const
+ {
+ return iSystemEventDetector->IsAudioResourcesAvailable();
+ }
+
+// ---------------------------------------------------------------------------
+// Getter for headset connection status
+// ---------------------------------------------------------------------------
+TBool CRadioSystemEventCollectorImp::IsHeadsetConnectedL() const
+ {
+ return iHeadsetObserver->IsHeadsetConnectedL();
+ }
+
+// ---------------------------------------------------------------------------
+// Getter Vocie UI state
+// ---------------------------------------------------------------------------
+TBool CRadioSystemEventCollectorImp::IsVoiceUiActive() const
+ {
+ return iSystemEventDetector->IsVoiceUiActive();
+ }
+
+// ---------------------------------------------------------------------------
+// Notifies the observers of system event
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::NotifyObserversL( TRadioSystemEventType aEvent )
+ {
+ for ( TInt i = 0; i < iSystemEventObservers.Count(); ++i )
+ {
+ iSystemEventObservers[i]->HandleSystemEventL( aEvent );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSystemEventDetectorObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::NetworkUpCallbackL()
+ {
+ NotifyObserversL( ERadioNetworkCoverageUp );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSystemEventDetectorObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::NetworkDownCallbackL()
+ {
+ NotifyObserversL( ERadioNetworkCoverageDown );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSystemEventDetectorObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::CallActivatedCallbackL()
+ {
+ NotifyObserversL( ERadioCallActivated );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSystemEventDetectorObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::CallDeactivatedCallbackL()
+ {
+ NotifyObserversL( ERadioCallDeactivated );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSystemEventDetectorObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::AudioResourcesAvailableL()
+ {
+ NotifyObserversL( ERadioAudioResourcesAvailable );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSystemEventDetectorObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::AudioAutoResumeForbiddenL()
+ {
+ NotifyObserversL( ERadioAudioAutoResumeForbidden );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioSystemEventDetectorObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::ErrorCallbackL( TInt DEBUGVAR( aError ) )
+ {
+ LOG_FORMAT( "CRadioSystemEventCollectorImp::ErrorCallbackL - %d", aError );
+ // P&S get fail not considered as a critical issue.
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioHeadsetEventObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::HeadsetConnectedCallbackL()
+ {
+ NotifyObserversL( ERadioHeadsetConnected );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioHeadsetEventObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::HeadsetDisconnectedCallbackL()
+ {
+ NotifyObserversL( ERadioHeadsetDisconnected );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MRadioAudioRoutingObserver.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventCollectorImp::AudioRouteChangedL( RadioEngine::TRadioAudioRoute aRoute )
+ {
+ TRadioSystemEventType ev = ERadioAudioRouteHeadset;
+ if ( aRoute != RadioEngine::ERadioHeadset )
+ {
+ ev = ERadioAudioRouteSpeaker;
+ }
+
+ NotifyObserversL( ev );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/cradiosystemeventdetector.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,440 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <e32def.h> // Define before audiopolicy defs
+#include <e32std.h> // Define before audiopolicy defs
+#include <eikdef.h>
+
+#ifndef __WINS__
+
+#include <audiopolicypubsubdata.h>
+#include <audiosw_pubsubkeys.h>
+
+#endif //__WINS__
+
+#include <ctsydomainpskeys.h>
+#include <publicruntimeids.hrh>
+#include <sacls.h>
+#ifdef COMPILE_IN_IVALO
+# include <voiceuidomainpskeys.h>
+#endif //COMPILE_IN_IVALO
+#include <featmgr.h>
+#include "cradioenginelogger.h"
+
+#include "cradiosystemeventdetector.h"
+#include "mradiosystemeventdetectorobserver.h"
+
+/** Granularity for audio category arrays. */
+const TInt KVRAudioCategoryArrayGranularity = 3;
+
+// This has to be the last include.
+#ifdef STUB_CONSTELLATION
+# include "RadioStubManager.h"
+# define KUidSystemCategory KStub_KUidSystemCategory
+# define KPSUidCtsyCallInformation KStub_KPSUidCtsyCallInformation
+# define KPSUidVoiceUiAccMonitor KStub_KPSUidVoiceUiAccMonitor
+# define KPSUidMMFAudioServer KStub_KPSUidMMFAudioServer
+#endif //STUB_CONSTELLATION
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSystemEventDetector::CRadioSystemEventDetector( MRadioSystemEventDetectorObserver& aObserver )
+ : iObserver( aObserver )
+ , iIsMobileNetworkCoverage( EFalse )
+ , iIsWlanCoverage( EFalse )
+ , iIsCallActive( EFalse )
+ , iIsAudioResourcesAvailable( ETrue )
+ , iIsVoiceUiActive( EFalse )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventDetector::ConstructL()
+ {
+// FeatureManager::InitializeLibL();
+// TBool wlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+// FeatureManager::UnInitializeLib();
+ TBool wlanSupported = EFalse; //TODO: Check if we have any need for this
+
+ iNetworkStatusObserver = CRadioPropertyObserver::NewL( *this,
+ KUidSystemCategory,
+ KUidNetworkStatusValue,
+ CRadioPropertyObserver::ERadioPropertyInt );
+ iNetworkStatusObserver->ActivateL();
+
+ iIsMobileNetworkCoverage = iNetworkStatusObserver->ValueInt() == ESANetworkAvailable;
+
+ // On S60 platform, there is no guaranteed way of seeing whether WLAN is explicitly turned off
+ // in the settings, or whether the network is available. For now, we only check the existence of
+ // the WLAN support in the feature manager. We might also want to check whether WLAN access points
+ // have been configured.
+ iIsWlanCoverage = wlanSupported;
+
+ // Initialize call state observer.
+ iCallStatusObserver = CRadioPropertyObserver::NewL( *this,
+ KPSUidCtsyCallInformation,
+ KCTsyCallState,
+ CRadioPropertyObserver::ERadioPropertyInt );
+ iCallStatusObserver->ActivateL();
+ iIsCallActive = iCallStatusObserver->ValueInt() != EPSCTsyCallStateNone;
+
+#ifdef COMPILE_IN_IVALO
+ // Initialize voice ui observer.
+ iVoiceUiObserver = CRadioPropertyObserver::NewL( *this,
+ KPSUidVoiceUiAccMonitor,
+ KVoiceUiOpenKey,
+ CRadioPropertyObserver::ERadioPropertyInt );
+ iVoiceUiObserver->ActivateL();
+#endif //COMPILE_IN_IVALO
+
+#ifndef __WINS__
+ // Define audio types for not resuming.
+ iNoAutoResumeAudioCategories = RArray<TInt>( KVRAudioCategoryArrayGranularity );
+ iNoAutoResumeAudioCategories.AppendL( ECatMediaPlayer );
+ iNoAutoResumeAudioCategories.AppendL( ECatMobileTv );
+ iNoAutoResumeAudioCategories.AppendL( ECatUnknownPlayer );
+ iNoAutoResumeAudioCategories.Compress();
+ // Start listening audio client events.
+ iAudioPolicyObserver = CRadioPropertyObserver::NewL( *this, KPSUidMMFAudioServer, KAudioPolicyAudioClients, CRadioPropertyObserver::ERadioPropertyByteArray );
+ iAudioPolicyObserver->ActivateL();
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSystemEventDetector::~CRadioSystemEventDetector()
+ {
+ FeatureManager::UnInitializeLib();
+ delete iCallStatusObserver;
+ delete iNetworkStatusObserver;
+ delete iVoiceUiObserver;
+ delete iAudioPolicyObserver;
+
+ iNoAutoResumeAudioCategories.Close();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CRadioSystemEventDetector* CRadioSystemEventDetector::NewL( MRadioSystemEventDetectorObserver& aObserver )
+ {
+ CRadioSystemEventDetector* self = new ( ELeave ) CRadioSystemEventDetector( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Handling of the int property changes is done here.
+// Observer components are getting notifications in correspondence with what
+// has changed
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventDetector::HandlePropertyChangeL( const TUid& aCategory,
+ const TUint aKey,
+ const TInt aValue )
+ {
+ //TODO: Refactor
+ if ( aCategory == KUidSystemCategory && aKey == KUidNetworkStatusValue )
+ {
+ switch ( aValue )
+ {
+ case ESANetworkAvailable:
+ {
+ SetNetworkCoverageL( ETrue, iIsWlanCoverage );
+ break;
+ }
+ case ESANetworkUnAvailable:
+ {
+ SetNetworkCoverageL( EFalse, iIsWlanCoverage );
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ else if ( aCategory == KPSUidCtsyCallInformation && aKey == KCTsyCallState )
+ {
+ if ( (!iIsCallActive ) && ( aValue > EPSCTsyCallStateNone ))
+ {
+ iIsCallActive = ETrue;
+ iObserver.CallActivatedCallbackL();
+ }
+ else if ( ( iIsCallActive ) && ( aValue <= EPSCTsyCallStateNone ))
+ {
+ iIsCallActive = EFalse;
+ iObserver.CallDeactivatedCallbackL();
+ }
+ else
+ {
+ // No change
+ }
+ }
+#ifdef COMPILE_IN_IVALO
+ else if ( aCategory == KPSUidVoiceUiAccMonitor && aKey == KVoiceUiOpenKey )
+ {
+ switch ( aValue )
+ {
+ case KVoiceUiIsClose:
+ {
+ if ( iIsVoiceUiActive )
+ {
+ iIsVoiceUiActive = EFalse;
+ LOG( "Voice UI not active." );
+ if ( iIsAudioResourcesAvailable )
+ {
+ LOG( "Audio resources available. Change informed." );
+ iObserver.AudioResourcesAvailableL();
+ }
+ }
+ break;
+ }
+ case KVoiceUiIsOpen:
+ {
+ if ( !iIsVoiceUiActive )
+ {
+ iIsVoiceUiActive = ETrue;
+ LOG( "Voice UI active." );
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+#endif //COMPILE_IN_IVALO
+ else // NOP
+ {
+ }
+ }
+
+#ifndef __WINS__
+// ---------------------------------------------------------------------------
+// Handling of the byte array property changes is done here.
+// Observer components are getting notifications in correspondence with what
+// has changed
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventDetector::HandlePropertyChangeL( const TUid& aCategory,
+ const TUint aKey,
+ const TDesC8& aValue )
+ {
+#if 0
+ LOG_METHOD_AUTO;
+ LOG_FORMAT( "Category: %d, Key: %d", aCategory, aKey );
+ if ( aCategory == KPSUidMMFAudioServer )
+ {
+ if ( aKey == KAudioPolicyAudioClients )
+ {
+ TBool atLeastOneAutoResumeAudioPlaying( EFalse );
+ TBool atLeastOneNoAutoResumeAudioPlaying( EFalse );
+ TBool radioPlaying( EFalse );
+ TAudioClientList audioClients;
+ audioClients.Copy( aValue );
+ // Check all playing audios!
+ for ( TInt i = 0; i < audioClients().iNumOfProcesses ; i++ )
+ {
+ TInt cat = audioClients().iClientCategoryList[i];
+ LOG_FORMAT( "Check audio cat %x", cat );
+ if ( cat == ECatFmRadio )
+ {
+ radioPlaying = ETrue;
+ }
+ else if ( iNoAutoResumeAudioCategories.Find( cat ) != KErrNotFound )
+ {
+ atLeastOneNoAutoResumeAudioPlaying = ETrue;
+ }
+ else
+ {
+ atLeastOneAutoResumeAudioPlaying = ETrue;
+ }
+ }
+
+ if ( !radioPlaying )
+ {
+ // Decide audio resource availability from audio category info.
+ if ( atLeastOneNoAutoResumeAudioPlaying )
+ {
+ LOG( "Audio resources not available. Change informed." );
+ iIsAudioResourcesAvailable = EFalse;
+ iObserver.AudioAutoResumeForbiddenL();
+ }
+ else if ( !atLeastOneAutoResumeAudioPlaying )
+ {
+ if ( !iIsVoiceUiActive )
+ {
+ LOG( "Audio resources available. Change informed." );
+ iIsAudioResourcesAvailable = ETrue;
+ iObserver.AudioResourcesAvailableL();
+ }
+ else
+ {
+ LOG( "Audio resources available. Change not informed." );
+ iIsAudioResourcesAvailable = ETrue;
+ }
+ }
+ else
+ {
+ LOG( "Audio resources not available. Change not informed." );
+ iIsAudioResourcesAvailable = EFalse;
+ }
+ }
+ else // audio resources are considered to be available when radio is playing
+ {
+ iIsAudioResourcesAvailable = ETrue;
+ }
+ }
+ }
+#endif
+ }
+
+#else //__WINS__
+// ---------------------------------------------------------------------------
+// Dummy version for WINS in order to avoid compiler warnings.
+// The real implementation of function is above.
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventDetector::HandlePropertyChangeL( const TUid& /*aCategory*/,
+ const TUint /*aKey*/,
+ const TDesC8& /*aValue*/)
+ {
+ }
+#endif
+
+// ---------------------------------------------------------------------------
+// Handling of the text property changes is done here.
+// Observer components are getting notifications in correspondence with what
+// has changed
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventDetector::HandlePropertyChangeL( const TUid& /*aCategory*/,
+ const TUint /*aKey*/,
+ const TDesC& /*aValue*/)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// This is a callback function which is called when a P&S components returns
+// an error
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventDetector::HandlePropertyChangeErrorL( const TUid& aCategory,
+ const TUint aKey,
+ TInt aError )
+ {
+#ifdef COMPILE_IN_IVALO
+ if ( aCategory == KPSUidVoiceUiAccMonitor && aKey == KVoiceUiOpenKey && aError == KErrNotFound )
+ {
+ HandlePropertyChangeL( KPSUidVoiceUiAccMonitor, KVoiceUiOpenKey, KVoiceUiIsClose );
+ }
+ else
+ {
+ iObserver.ErrorCallbackL( aError );
+ }
+#else
+ (void)aCategory;
+ (void)aKey;
+ (void)aError;
+#endif //COMPILE_IN_IVALO
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSystemEventDetector::IsMobileNetworkCoverage() const
+ {
+ return iIsMobileNetworkCoverage;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSystemEventDetector::IsNetworkCoverage() const
+ {
+ return iIsWlanCoverage || iIsMobileNetworkCoverage;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSystemEventDetector::IsCallActive() const
+ {
+ return iIsCallActive;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSystemEventDetector::IsAudioResourcesAvailable() const
+ {
+ return iIsAudioResourcesAvailable;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CRadioSystemEventDetector::IsVoiceUiActive() const
+ {
+ return iIsVoiceUiActive;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CRadioSystemEventDetector::SetNetworkCoverageL( const TBool aIsMobileNetworkCoverage,
+ const TBool aIsWlanCoverage )
+ {
+ LOG_FORMAT( "CRadioSystemEventDetector::SetNetworkCoverageL ( mobile = %d wlan = %d )", aIsMobileNetworkCoverage, aIsWlanCoverage );
+
+ TBool wasCoverage = IsNetworkCoverage();
+ iIsMobileNetworkCoverage = aIsMobileNetworkCoverage;
+ iIsWlanCoverage = aIsWlanCoverage;
+ TBool isCoverage = IsNetworkCoverage();
+
+ if ( isCoverage != wasCoverage )
+ {
+ if ( isCoverage )
+ {
+ iObserver.NetworkUpCallbackL();
+ }
+ else
+ {
+ iObserver.NetworkDownCallbackL();
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/radioengine/utils/src/radioengineutils.cpp Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// System includes
+#include <stringloader.h>
+#include <utf.h>
+
+// User includes
+#include "radioengineutils.h"
+#include "cradioenginetls.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RadioEngineUtils::InitializeL( CCoeEnv* aCoeEnv )
+ {
+ CRadioEngineTls::InitializeL( aCoeEnv );
+ CRadioEngineTls::Instance().AddRef();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RadioEngineUtils::Release()
+ {
+ CRadioEngineTls::Instance().Release();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MRadioEngineLogger* RadioEngineUtils::Logger()
+ {
+ return CRadioEngineTls::Instance().Logger();
+ }
+
+// ---------------------------------------------------------------------------
+// Return the cone environment
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCoeEnv* RadioEngineUtils::Env()
+ {
+ return CRadioEngineTls::Instance().Env();
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the file server session
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RFs& RadioEngineUtils::FsSession()
+ {
+ return CRadioEngineTls::Instance().FsSession();
+ }
+
+// ---------------------------------------------------------------------------
+// Utility method for frequency formatting.
+// Frequency is assumed to be in kilohertz format.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* RadioEngineUtils::ReadFrequencyStringLC( TUint32 aFreq,
+ TInt aDecimalCount,
+ TInt aResourceId )
+ {
+ TBuf<KDefaultRealWidth> freqText;
+ freqText.AppendNum( static_cast<TReal>( aFreq ) / 1000.0f, TRealFormat( KDefaultRealWidth, aDecimalCount ) ); // Converts kilohertz to megahertz.
+
+ // Converts the numbers to the proper display mode.
+
+ HBufC* channelFreq = NULL;
+
+ if ( aResourceId == KErrNotFound ) // No resource string.
+ {
+ channelFreq = freqText.AllocLC();
+ }
+ else
+ {
+ channelFreq = StringLoader::LoadLC( aResourceId, freqText );
+ }
+
+ return channelFreq;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RadioEngineUtils::FormatFrequencyString( TDes& aDest,
+ TUint32 aFreq,
+ TInt aDecimalCount,
+ TDesC& aFormat )
+ {
+ TBuf<KDefaultRealWidth> freqText;
+ freqText.AppendNum( static_cast<TReal>( aFreq ) / 1000.0f, TRealFormat( KDefaultRealWidth, aDecimalCount ) ); // Converts kilohertz to megahertz.
+
+ // Converts the numbers to the proper display mode.
+
+ if ( aFormat.Length() <= 0 || freqText.Length() > aDest.MaxLength() ) // No format.
+ {
+ aDest.Copy( freqText.Left( aDest.Length() ) );
+ }
+ else
+ {
+ StringLoader::Format( aDest, aFormat, KErrNotFound, freqText );
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rom/bld.inf Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include<platform_paths.hrh>
+
+PRJ_EXPORTS
+fmradio.iby CORE_APP_LAYER_IBY_EXPORT_PATH(fmradio.iby)
+fmradio_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(fmradio_resources.iby)
+
+PRJ_EXTENSIONS
+#ifdef MARM
+ START EXTENSION app-services/buildstubsis
+ OPTION SRCDIR .
+ OPTION SISNAME qtfmradio_stub
+ END
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rom/fmradio.iby Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Iby file for FMRadio
+*
+*/
+
+
+#ifndef FMRADIO_IBY
+#define FMRADIO_IBY
+
+// Use standard macros
+#include <data_caging_paths_for_iby.hrh>
+
+S60_APP_EXE(qtfmradio)
+data=ZPRIVATE\10003a3f\import\apps\qtfmradio_reg.rsc private\10003a3f\import\apps\qtfmradio_reg.rsc
+
+file=ABI_DIR\BUILD_DIR\radioenginewrapper.dll SHARED_LIB_DIR\radioenginewrapper.dll
+file=ABI_DIR\BUILD_DIR\radiopresetstorage.dll SHARED_LIB_DIR\radiopresetstorage.dll
+file=ABI_DIR\BUILD_DIR\radiouiengine.dll SHARED_LIB_DIR\radiouiengine.dll
+file=ABI_DIR\BUILD_DIR\radiowidgets.dll SHARED_LIB_DIR\radiowidgets.dll
+
+file=ABI_DIR\BUILD_DIR\radioengine.dll SHARED_LIB_DIR\radioengine.dll
+file=ABI_DIR\BUILD_DIR\radioengineutils.dll SHARED_LIB_DIR\radioengineutils.dll
+file=ABI_DIR\BUILD_DIR\radioenginesettings.dll SHARED_LIB_DIR\radioenginesettings.dll
+
+data=ZPRIVATE\10202be9\101FF976.txt private\10202be9\101FF976.txt
+data=\epoc32\data\z\resource\radioenginesettings.rsc \resource\radioenginesettings.rsc
+
+data=\epoc32\data\z\system\install\qtfmradio_stub.sis system\install\qtfmradio_stub.sis
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rom/fmradio_resources.iby Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Iby file for FMRadio
+*
+*/
+
+
+#ifndef FMRADIO_RESOURCES_IBY
+#define FMRADIO_RESOURCES_IBY
+
+// Use standard macros
+#include <data_caging_paths_for_iby.hrh>
+
+S60_APP_RESOURCE(qtfmradio)
+
+//TODO: change to fmradio.qm once availabe
+data=DATAZ_\QT_TRANSLATIONS_DIR\fmradio_en.qm QT_TRANSLATIONS_DIR\fmradio.qm
+
+#endif // FMRADIO_RESOURCES_IBY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rom/qtfmradio_stub.pkg Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,27 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Stub package file for FMRadio
+;
+
+; Languages
+&EN
+
+; Header
+#{"fmradio"}, (0xE6fe9aac), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
\ No newline at end of file
--- a/sysdef_1_4_0.dtd Tue Feb 02 00:17:10 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
- <!ELEMENT SystemDefinition (systemModel?, build?)>
- <!ATTLIST SystemDefinition
- name CDATA #REQUIRED
- schema CDATA #REQUIRED>
- <!ELEMENT systemModel (layer+)>
- <!ELEMENT layer (logicalset* | module*)*>
- <!ATTLIST layer
- name CDATA #REQUIRED
- levels CDATA #IMPLIED
- span CDATA #IMPLIED>
- <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalset name CDATA #REQUIRED>
- <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalsubset name CDATA #REQUIRED>
- <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
- <!ATTLIST module
- name CDATA #REQUIRED
- level CDATA #IMPLIED>
- <!ELEMENT component (unit* | package* | prebuilt*)*>
- <!ATTLIST component name CDATA #REQUIRED>
- <!ELEMENT unit EMPTY>
- <!ATTLIST unit
- unitID ID #REQUIRED
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- bldFile CDATA #REQUIRED
- priority CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT package EMPTY>
- <!ATTLIST package
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT prebuilt EMPTY>
- <!ATTLIST prebuilt
- name CDATA #REQUIRED
- version CDATA #REQUIRED
- late (Y|N) #IMPLIED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
- <!ELEMENT unitList (unitRef+)>
- <!ATTLIST unitList
- name ID #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT unitRef EMPTY>
- <!ATTLIST unitRef unit IDREF #REQUIRED>
- <!ELEMENT targetList EMPTY>
- <!ATTLIST targetList
- name ID #REQUIRED
- description CDATA #REQUIRED
- target IDREFS #REQUIRED>
- <!ELEMENT target EMPTY>
- <!ATTLIST target
- name ID #REQUIRED
- abldTarget CDATA #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT option EMPTY>
- <!ATTLIST option
- name ID #REQUIRED
- abldOption CDATA #REQUIRED
- description CDATA #REQUIRED
- enable (Y | N | y | n) #REQUIRED>
- <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
- <!ATTLIST configuration
- name ID #REQUIRED
- description CDATA #REQUIRED
- filter CDATA #REQUIRED>
- <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
- <!ELEMENT unitListRef EMPTY>
- <!ATTLIST unitListRef unitList IDREF #REQUIRED>
- <!ELEMENT layerRef EMPTY>
- <!ATTLIST layerRef layerName CDATA #REQUIRED>
- <!ELEMENT buildLayer EMPTY>
- <!ATTLIST buildLayer
- command CDATA #REQUIRED
- targetList IDREFS #IMPLIED
- unitParallel (Y | N | y | n) #REQUIRED
- targetParallel (Y | N | y | n) #IMPLIED>
- <!ELEMENT specialInstructions EMPTY>
- <!ATTLIST specialInstructions
- name CDATA #REQUIRED
- cwd CDATA #REQUIRED
- command CDATA #REQUIRED>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd Fri Mar 19 09:29:04 2010 +0200
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ proFile CDATA #IMPLIED
+ qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>