internetradio2.0/activeidleinc/iractiveidle.h
changeset 14 896e9dbc5f19
parent 12 608f67c22514
child 15 065198191975
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  The content publisher for Internet Radio Active Idle plugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IRACTIVEIDLE_H
       
    20 #define IRACTIVEIDLE_H
       
    21 
       
    22 #include <aicontentpublisher.h>
       
    23 #include <aieventhandlerextension.h>
       
    24 #include <aipropertyextension.h>
       
    25 
       
    26 #include "iractiveidleengnotifyhandler.h"
       
    27 
       
    28 class CIRActiveIdleEng;
       
    29 class CIRActiveIdleStateDetector;
       
    30 class CIRMetaData;
       
    31 class MAiContentItemIterator;
       
    32 class MAiContentObserver;
       
    33 
       
    34 #define KMAXLENGTH 256
       
    35 
       
    36 /**
       
    37  *  Internet Radio Active Idle plugin
       
    38  *
       
    39  *  @lib iractiveidle.lib
       
    40  */
       
    41 class CIRActiveIdle : public CAiContentPublisher, 
       
    42                       public MAiPropertyExtension,
       
    43                       public MAiEventHandlerExtension,
       
    44                       public MIRActiveIdleEngNotifyHandler
       
    45     {
       
    46 public:
       
    47 
       
    48     /**
       
    49      * Two-phased constructor.
       
    50      */
       
    51     static CIRActiveIdle* NewL();
       
    52 
       
    53     /**
       
    54      * Destructor.
       
    55      */
       
    56     /*lint -save -e1509 (Warning -- base class destructor for class 'MAiPropertyExtension' is not virtual -- Effective C++ #14)
       
    57                         (Warning -- base class destructor for class 'MAiEventHandlerExtension' is not virtual -- Effective C++ #14)*/
       
    58     virtual ~CIRActiveIdle();
       
    59     /*lint -restore*/
       
    60 
       
    61 	// from base class CAiContentPublisher
       
    62 	/**
       
    63      *void Resume( TAiTransitionReason aReason )
       
    64      *To actively publish data to observers. 
       
    65      *@param aReason Defines set of reasons for plug-in state change.
       
    66      */
       
    67     void Resume( TAiTransitionReason aReason );
       
    68     
       
    69     /**
       
    70      *void Suspend( TAiTransitionReason aReason )
       
    71      *Cancels outstanding asynchronous operations
       
    72      *@param aReason Defines set of reasons for plug-in state change.
       
    73      */
       
    74     void Suspend( TAiTransitionReason aReason );
       
    75     
       
    76     /**
       
    77      *void Stop( TAiTransitionReason aReason )
       
    78      *Frees all memory and CPU resources and close all open files.
       
    79      *@param aReason Defines set of reasons for plug-in state change.
       
    80      */
       
    81     void Stop( TAiTransitionReason aReason );
       
    82     
       
    83     /**
       
    84      *void SubscribeL( MAiContentObserver& aObserver )
       
    85      *Adds the content observer / subscriber to plug-in.
       
    86      *@param aObserver The observer to be notified of the changes in the keys.
       
    87      */
       
    88     void SubscribeL( MAiContentObserver& aObserver );
       
    89     
       
    90     /**
       
    91      *void ConfigureL( RAiSettingsItemArray& aSettings )
       
    92      *Configures the plug-in.
       
    93      *@param aSettings setting items defined in the UI definition.
       
    94      *This plugin takes ownership of the MAiPluginSettings objects 
       
    95      *in the array.
       
    96      */
       
    97     void ConfigureL( RAiSettingsItemArray& aSettings );
       
    98     
       
    99     /**
       
   100      *TAny* Extension( TUid aUid )
       
   101      *Returns interface extension.
       
   102      *@param aUid 
       
   103      *@return Returns pointer to extension type
       
   104      */
       
   105     TAny* Extension( TUid aUid );
       
   106 
       
   107 	// from base class MAiPropertyExtension
       
   108 	/**
       
   109      *TAny* GetPropertyL( TInt aProperty )
       
   110      *Reads a plugin property.
       
   111      *@param aProperty identification of property.
       
   112      *@return Pointer to property value
       
   113      */
       
   114     TAny* GetPropertyL( TInt aProperty );
       
   115     
       
   116     /**
       
   117      *void SetPropertyL( TInt aProperty, TAny* aValue )
       
   118      *Sets a plugin property
       
   119      *@param aProperty  identification of property.
       
   120      *@param aValue contains pointer to property value.
       
   121      */
       
   122     void SetPropertyL( TInt aProperty, TAny* aValue );
       
   123 
       
   124 	// from base class MAiEventHandlerExtension
       
   125 	/**
       
   126      *void HandleEvent( TInt aEvent, const TDesC& aParam )
       
   127      *Sets a plugin property
       
   128      *@param aEvent unique identifier of event from plug-in content model.
       
   129      *@param aParam Parameters associated with event
       
   130      */
       
   131     void HandleEvent( TInt aEvent, const TDesC& aParam );
       
   132 
       
   133 // from base class MIRActiveIdleEngNotifyHandler
       
   134 
       
   135     void HandleChannelChangeL();
       
   136     void HandleMetaDataReceivedL( const CIRMetaData& aMetaData );
       
   137     void HandleVolumeChangeL( const TInt aVolume );
       
   138     void HandlePlayStopL( TIRStopPlayState aState );
       
   139     void HandleApplicationRunningStateChangeL(  const TIRPSApplicationRunningState aRunningState );
       
   140     void HandleBufferingStateL(TIRBufferingState aState );
       
   141     
       
   142    private:
       
   143 
       
   144     /**
       
   145      * Constructor.
       
   146      */
       
   147     CIRActiveIdle();
       
   148 
       
   149     /**
       
   150      * Second-phase constructor.
       
   151      */
       
   152     void ConstructL();
       
   153 
       
   154     /**
       
   155      * Initialize resource file for loading resources.
       
   156      */
       
   157     void InitializeResourceLoadingL();
       
   158 
       
   159     /**
       
   160      * Loads the required resources.
       
   161      */
       
   162     void LoadResourcesL();
       
   163 
       
   164     /**
       
   165      * Cleans all data fields from plugin.
       
   166      */
       
   167     void Clean();
       
   168 
       
   169     /**
       
   170      * Starts an application.
       
   171      * @param aUid The uid value of the application
       
   172      * @param aCommandLine The command line (if any) to be passed to the process
       
   173      */
       
   174     void StartApplicationL( const TUid& aUid, const TDesC8& aCommandLine );
       
   175 
       
   176 private: // data
       
   177 
       
   178     /** IR's Active Idle engine. */
       
   179     CIRActiveIdleEng*                   iEngine;
       
   180 
       
   181     /** 
       
   182      * Detects Internet Radio process termination
       
   183      * Owned.
       
   184      */
       
   185     CIRActiveIdleStateDetector*         iIRTerminationDetector;
       
   186     
       
   187     /**
       
   188      * Current meta data information.
       
   189      * Owned.
       
   190      */
       
   191     CIRMetaData*                        iMetaData;
       
   192      
       
   193     /** Observers that are informed about changes state or new content available. */
       
   194     RPointerArray<MAiContentObserver>   iObservers;
       
   195     /** */
       
   196     TAiPublisherInfo                    iInfo;
       
   197     /** */
       
   198     MAiContentItemIterator*             iContent;
       
   199     /** */
       
   200     MAiContentItemIterator*             iResources;
       
   201     /** */
       
   202     MAiContentItemIterator*             iEvents;
       
   203     
       
   204     /** Active Idle's resource offset. */
       
   205     TInt                                iActiveIdleResourceOffset;
       
   206     /** Internet Radio application running state */
       
   207     TIRPSApplicationRunningState        iRunningState;
       
   208     
       
   209  	// Meta data info
       
   210     TBuf 	<KMAXLENGTH> iChannelName;
       
   211     TInt 	iPresetIndex;
       
   212     
       
   213     //Application volume level
       
   214     enum TIRPSVolumeLevel
       
   215     	{
       
   216     	EVolumeLevel0 = 0,
       
   217 	    EVolumeLevel1,      
       
   218 	    EVolumeLevel2,   
       
   219 	    EVolumeLevel3,   
       
   220 	    EVolumeLevel4,   
       
   221 	    EVolumeLevel5,   
       
   222 	    EVolumeLevel6,   
       
   223 	    EVolumeLevel7,   
       
   224 	    EVolumeLevel8,   
       
   225 	    EVolumeLevel9,   
       
   226 	    EVolumeLevel10                    
       
   227 	    };
       
   228     
       
   229     TInt                                iLastSetVolume;
       
   230     };
       
   231 
       
   232 #endif // IRACTIVEIDLE_H