uiacceltk/hitchcock/plugins/alftranseffect/alftfxserverplugin/inc/alftransitionservercontroller.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Class used to start and stop the TFX Server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_TRANSITIONSERVERCONTROLLER_H
       
    20 #define C_TRANSITIONSERVERCONTROLLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <w32std.h>
       
    24 #include <mtransitionserver.h>
       
    25 #include <alfdecoderserverclient.h>
       
    26 
       
    27 #include "alfpsobserver.h"
       
    28 
       
    29 class RTfxServerInjector;
       
    30 class CWsEventEater;
       
    31 class CAlfPsObserver;
       
    32 class CRepository;
       
    33 
       
    34 /**
       
    35  * transition effect server controller
       
    36  * 
       
    37  * this class is used to load and start the TfxServer into the wserv process.
       
    38  * The code is loaded into the wserv through a CAnimDll wserv plugin.
       
    39  * because of this, when this class is destroyed, the TfxServer thread will be killed.
       
    40  */
       
    41  
       
    42 // MPsObserver will probably not bee needed - to be removed later
       
    43 NONSHARABLE_CLASS(CAlfTransitionServerController) : public CBase,
       
    44 								   		 public MPsObserver
       
    45     {
       
    46 public:
       
    47 	friend class CAlfTransitionServerClient;
       
    48 
       
    49 	/**
       
    50      * Public part of two phase construction.
       
    51      * @since S60 3.2
       
    52      *
       
    53      * @param Reference to a Window server session.
       
    54      * @return Pointer to the newly created CAlfTransitionServerController object.
       
    55     */  
       
    56     static CAlfTransitionServerController* NewL(RWsSession& /*aWsSession*/);
       
    57 
       
    58 	/**
       
    59      * Destructor
       
    60      * @since S60 3.2
       
    61      *
       
    62     */  
       
    63     virtual ~CAlfTransitionServerController();
       
    64 
       
    65 	/**
       
    66      * Start the transition server
       
    67      * @since S60 3.2
       
    68      *
       
    69      * @return KErrNone or any of the system error codes.
       
    70     */  
       
    71     TInt StartTransitionServer();
       
    72 
       
    73 	/**
       
    74      * Gracefully shut down the transition server.
       
    75      * @since S60 3.2
       
    76      *
       
    77      * @return KErrNone or any of the system error codes.
       
    78     */  
       
    79     TInt StopTransitionServer();
       
    80 
       
    81 	/**
       
    82      * Checks to see if server is running.
       
    83      * @since S60 3.2
       
    84      *
       
    85      * @return ETrue if server is running, otherwise EFalse.
       
    86     */  
       
    87     TBool ServerRunning();
       
    88     
       
    89    	/**
       
    90      * Start the transition server
       
    91      * @since S60 3.2
       
    92      * 
       
    93      * Starts the server with different values for MaxBytesOngoing and 
       
    94      * MaxBytesBetween than the default ones. 
       
    95      * MaxBytesOngoing is the maximum amount of bytes that may be cached while a transition
       
    96      * is ongoing. If this value is less than the total size of the 
       
    97 	 * decoded images in the effect the images has to be decoded every 
       
    98 	 * frame which will have a huge impact on performance. 
       
    99      *
       
   100      * MaxBytesBetween is the maximum amount of bytes that may be cached when a transition
       
   101 	 * is not ongoing.
       
   102 	 *
       
   103      * @param aMaxBytesOngoing maximum bytes in cache during a transition  	   
       
   104      * @param aMaxBytesBetween maximum bytes in cache between transitions
       
   105      * @return KErrNone or any of the system error codes.
       
   106     */  
       
   107     TInt StartTransitionServer(TInt32 aMaxBytesOngoing, TInt32 aMaxBytesBetween);
       
   108    
       
   109     static TInt ConnectionCallback( TAny* aParameter );
       
   110    
       
   111     TInt ConnectionAttempt();
       
   112     
       
   113   	void PsValueUpdated( const TUid aCategory, const TUint aKey, const TInt aVal );
       
   114   	
       
   115   	
       
   116 
       
   117 private:
       
   118 
       
   119 	/**
       
   120      * Private part of two phase construction.
       
   121      *
       
   122     */  
       
   123     void ConstructL();
       
   124 
       
   125 	/**
       
   126      * Private constructor.
       
   127     */  
       
   128     CAlfTransitionServerController();
       
   129     
       
   130 
       
   131     
       
   132 private: // data
       
   133 
       
   134     CAlfPsObserver* iPsObserver;
       
   135     
       
   136     // The public and subscribe value keeping track if server is running
       
   137     TInt iTransitionControlValue;
       
   138     
       
   139     // The value in central repository to keep track if effects are allowed
       
   140     TInt iEffectValue;
       
   141     
       
   142     CRepository* iRepository;
       
   143     
       
   144    	RAlfTfxClient iTfxServer;
       
   145    	TBool iIsConnected;
       
   146    	
       
   147    	CPeriodic* iTimer;
       
   148    	TBool iTimerRunning;
       
   149 
       
   150     };
       
   151 
       
   152 
       
   153 #endif //C_TRANSITIONSERVERCONTROLLER_H