uiacceltk/hitchcock/plugins/alftranseffect/alftfxserverplugin/inc/alftransitionserver.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:   This is the API used by Theme server to control the
       
    15 *                appearence of transitions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef R_TRANSITIONSERVER_H
       
    22 #define R_TRANSITIONSERVER_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <gfxtranseffect/gfxtransdatatype.h>
       
    26 #include <alfdecoderserverclient.h>
       
    27 
       
    28 class CWaitingTimer;
       
    29 class TParse;
       
    30 
       
    31 /**
       
    32  *  transition control interface.
       
    33  *
       
    34  *  This class is used to control transition appearence and behaviour
       
    35  *  in the KML transition server.
       
    36  *
       
    37  *  @since S60 3.2
       
    38  */
       
    39 class CAlfTransitionServerClient : public CBase
       
    40 	{
       
    41 	//the Shutdown() should only be called from within the CTransitionServerController.
       
    42 	//This makes sure that is true.
       
    43 	friend class CAlfTransitionServerController;
       
    44 public:
       
    45     /**
       
    46      * The different list types that can be configured with different KML. 
       
    47      */
       
    48     enum TListBoxType
       
    49         {
       
    50         /**
       
    51          * The default alternative: Use this one to register KML for all
       
    52          * kinds of list.
       
    53          */
       
    54         EListTypeAny,
       
    55         
       
    56         /**
       
    57          * Main pane lists and 1-column grids.
       
    58          */
       
    59         EListTypeMainPane,
       
    60         
       
    61         /**
       
    62          * Options menu and lists in popups.
       
    63          */
       
    64         EListTypeMenuPaneOrPopup,
       
    65         
       
    66         /**
       
    67          * Lists in settings pages.
       
    68          */
       
    69         EListTypeSettingPage,
       
    70         
       
    71         /**
       
    72          * Grids with more than one column.
       
    73          */
       
    74         EListTypeGrid
       
    75         };
       
    76 
       
    77 	/**
       
    78      * default constructor
       
    79      *
       
    80      * @since S60 3.2
       
    81      */
       
    82 	CAlfTransitionServerClient();
       
    83 	
       
    84 	/**
       
    85      * default destructor
       
    86      *
       
    87      * @since S60 3.2
       
    88      */
       
    89 	~CAlfTransitionServerClient();
       
    90 	
       
    91 	/**
       
    92      * connects to the transition server.
       
    93      *
       
    94      * @since S60 3.2
       
    95      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
    96      */
       
    97 	TInt Connect();
       
    98 	
       
    99 	/**
       
   100      * disconnects from the transition server
       
   101      *
       
   102      * @since S60 3.2
       
   103      */
       
   104 	void Disconnect();
       
   105 	
       
   106 	/**
       
   107      * Registers the KML file and resource directory to be used by a fullscreen effect.
       
   108      * The KML file and resource directory will be used for fullscreen effects with 
       
   109      * the corresponding aActionID and aUid. KNullUid will be treated as the "default" 
       
   110      * Uid - fullscreen effects that supply a not registered Uid will use the KML file 
       
   111      * associated with <aActionId, KNullUid>
       
   112      * Any aActionID that has not got a KML file associated to it, will be treated as
       
   113      * "unsupported".
       
   114      * If a <aActionId, aUid> pair is registered with aFilename a length zero the pair will be 
       
   115      * treated as "unsupported" even if there is a default filename for the aActionId
       
   116      *
       
   117      * @since S60 3.2
       
   118      * @param aActionID the fullscreen effect ID to associate this kml file with.
       
   119      * @param aUid the TUid to associate the kml with, KNullUid as default
       
   120      * @param aResourceDir the resource directory
       
   121      * @param aFilename the kml file to use, must be relative the resource directory.
       
   122      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   123      */
       
   124 	TInt RegisterFullscreenKml(TUint aActionID, const TUid& aUid, const TDesC& aResourceDir, 
       
   125 										const TDesC& aFilename);
       
   126 	
       
   127 	/**
       
   128      * tells transition server to remove the KML for a specific fullscreen effect, 
       
   129      * from now treating it as "unsupported"
       
   130      *
       
   131      * @since S60 3.2
       
   132      * @param aActionId the fullscreen effect ID to remove KML from.
       
   133      * @param aUid the Uid.
       
   134      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   135      */
       
   136 	TInt UnregisterFullscreenKml(TUint aActionID, const TUid& aUid);
       
   137 	
       
   138 	/**
       
   139      * Blocks all fullscreen transitions with a certain Uid independently of the actionId
       
   140      * Transitions can be blocked both when doing a fullscreen effect from the Uid and when 
       
   141      * doing a fullscreen effect to the Uid.
       
   142      * The blocking of a Uid can be removed by setting aBlockFrom and aBlockTo to EFalse.
       
   143      *	
       
   144      * @since S60 3.2
       
   145      * @param aUid the TUid that should be blocked 
       
   146      * @param aBlockFrom ETrue if transitions should be blocked when doing a transition from the Uid.
       
   147      * @param aBlockTo ETrue if transitions should be blocked when doing a transition to the Uid.
       
   148      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   149      */    
       
   150 	TInt BlockFullScreenUid(const TUid& aUid, TBool aBlockFrom, TBool aBlockTo);
       
   151 	
       
   152 	/**
       
   153      * Registers the KML file and resource directory to be used for a control transition.
       
   154      * The KML file and resource directory will be used for control transitions with 
       
   155      * the corresponding aUid.
       
   156      * Any aUid that has not got a KML file associated to it, will be treated as
       
   157      * "unsupported"
       
   158      * If you register a KML file on a previously registered uid, the old KML will
       
   159      * be automaticly unregistered, and its actions removed.
       
   160      *
       
   161      * @since S60 3.2
       
   162      * @param aUid the TUid to associate the kml with
       
   163      * @param aResourceDir the resource directory
       
   164      * @param aFilename the kml file to use, must be relative the resource directory.
       
   165      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   166      */    
       
   167 	TInt RegisterControlKml(const TUid &aUid, const TDesC& aResourceDir, const TDesC& aFilename);
       
   168 
       
   169 	/**
       
   170      * Registers the KML file and resource directory to be used for a control transition.
       
   171      * The KML file and resource directory will be used for control transitions with 
       
   172      * the corresponding aUid.
       
   173      * Any aUid that has not got a KML file associated to it, will be treated as
       
   174      * "unsupported"
       
   175      * If you register a KML file on a previously registered uid, the old KML will
       
   176      * be automaticly unregistered, and its actions removed.
       
   177      *
       
   178      * @since S60 3.2
       
   179      * @param aUid the TUid to associate the kml with
       
   180      * @param aResourceDir the resource directory
       
   181      * @param aFilename the kml file to use, must be relative the resource directory.
       
   182      * @param aWantedTime Specifies the wanted time between frames for this control effect.
       
   183      			If below zero the default wanted time will be used.
       
   184      * @param aMinTime Specifies the minimum allowed time between frames for this control effect.
       
   185      			If below zero the default minimum time will be used.
       
   186      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   187      */    
       
   188 	TInt RegisterControlKml(const TUid &aUid, const TDesC& aResourceDir, const TDesC& aFilename,
       
   189 									 TInt aWantedTime, TInt aMinTime);
       
   190 
       
   191   	/**
       
   192      * Unregisters all of KML files and resource directory for the current thread.
       
   193      *
       
   194      * @since S60 3.2
       
   195      * 
       
   196      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   197      */ 
       
   198   	TInt UnregisterAllKml();
       
   199   	
       
   200   	/**
       
   201      * Unregisters the KML file and resource directory for a control transition.
       
   202      * The Uid will not have any KML file associated with it.
       
   203      * This also unregisters all control actions that have been registered for this
       
   204      * Uid. 
       
   205      *
       
   206      * @since S60 3.2
       
   207      * @param aUid the Uid to unregister
       
   208      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   209      */ 
       
   210   	TInt UnregisterControlKml(const TUid &aUid);
       
   211   
       
   212   	/**
       
   213      * Registers an action string to be used with a <aUid, aActionID> pair for a control 
       
   214      * transition. 
       
   215      * When a control transition is started the TfxServer will use the KML file
       
   216      * registered with the Uid. The TfxServer will then use the aUid and aActionId to find
       
   217      * the corresponding aActionString. The TfxServer will then run the action in the KML file
       
   218      * with the name aActionString.
       
   219      *
       
   220      * The registration will fail if there isn't a KML file registered with the Uid.
       
   221      *
       
   222      * @since S60 3.2
       
   223      * @param aUid the Uid that will be sent through the GfxTransEffect API
       
   224      * @param aActionID the actionID that will be sent through the GfxTransEffect API
       
   225      * @param aActionString the name of the action in the KML file
       
   226      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   227      */    
       
   228 	TInt RegisterControlAction(const TUid& aUid, TUint aActionID, const TDesC& aActionString);
       
   229 
       
   230   	/**
       
   231      * Unregisters a aActionString from a <aUid, aActionID> pair. This means that there will not be
       
   232      * any transitions for the specified <aUid, aActionId> pair. 
       
   233      *
       
   234      * @since S60 3.2
       
   235      * @param aUid the Uid
       
   236      * @param aActionId the ActionId
       
   237      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   238      */    
       
   239 	TInt UnregisterControlAction(const TUid& aUid, TUint aActionID);
       
   240 
       
   241 	/**
       
   242      * Sets wanted time between frames.
       
   243      * @since S60 3.2
       
   244      *
       
   245      * @param aTime. Time in milliseconds (0-99).
       
   246      * @return KErrNone or any of the system error codes.
       
   247     */  
       
   248 	TInt SetWantedTime(TInt aTime);
       
   249 
       
   250 	/**
       
   251      * Sets minimum allowed time between frames.
       
   252      * @since S60 3.2
       
   253      *
       
   254      * @param aTime. Time in milliseconds (0-99).
       
   255      * @return KErrNone or any of the system error codes.
       
   256     */  
       
   257 	TInt SetMinTime(TInt aTime);
       
   258 
       
   259 	/**
       
   260      * Registers the KML file and resource directory to be used by a fullscreen effect.
       
   261      * The KML file and resource directory will be used for fullscreen effects with 
       
   262      * the corresponding aActionID and aUid. KNullUid will be treated as the "default" 
       
   263      * Uid - fullscreen effects that supply a not registered Uid will use the KML file 
       
   264      * associated with <aActionId, KNullUid>
       
   265      * Any aActionID that has not got a KML file associated to it, will be treated as
       
   266      * "unsupported".
       
   267      * If a <aActionId, aUid> pair is registered with aFilename of length zero the pair will be 
       
   268      * treated as "unsupported" even if there is a default filename for the aActionId
       
   269      *
       
   270      * @since S60 3.2
       
   271      * @param aActionID the fullscreen effect ID to associate this kml file with.
       
   272      * @param aUid the TUid to associate the kml with, KNullUid as default
       
   273      * @param aResourceDir the resource directory
       
   274      * @param aFilename the kml file to use, must be relative the resource directory.
       
   275      * @param aCachePriority The priority of the resources for this fullscreen effect in the cache.
       
   276      			(higher numbers have higher priority). If below zero the default priority will be used.
       
   277      * @param aWantedTime Specifies the wanted time between frames for this fullscreen effect.
       
   278      			If below zero the default wanted time will be used.
       
   279      * @param aMinTime Specifies the minimum allowed time between frames for this fullscreen effect.
       
   280      			If below zero the default minimum time will be used.
       
   281      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   282      */
       
   283 	TInt RegisterFullscreenKml(TUint aActionID, const TUid& aUid, const TDesC& aResourceDir, 
       
   284 										const TDesC& aFilename, TInt aCachePriority, TInt aWantedTime,
       
   285 										TInt aMinTime);
       
   286 
       
   287 	/**
       
   288 	 * Register the KML files and resource directory to be used by a listbox.
       
   289 	 * The KML files and resource directory will be used for listboxes of the specified type
       
   290      * in the process with the Uid aUid.
       
   291      *
       
   292      * KNullUid will be treated as the "default" Uid - listboxes in processes
       
   293 	 * with no KML registered for their uid will use KML registered with KNullUid.
       
   294 	 * EListTypeAny works the same way for listbox types.  More specific settings have 
       
   295      * priority over less specific ones, and the uid has higher priority than the list type,
       
   296      * which means that when assigning KML to a specific listbox, the search for KML is
       
   297      * done in the following order:
       
   298      *
       
   299      * 1. KML that has been registered with the uid of the listbox' app and with the
       
   300      *    listbox type that matches the specific listbox.
       
   301      * 2. KML that has been registered with the uid of the listbox' app, with type EListTypeAny.
       
   302      * 3. KML that has been registered with KNullUid and with the matching listbox type.
       
   303      * 4. KML that has been registered with KNullUid and EListTypeAny.
       
   304      *
       
   305 	 * If a Uid is registered with aBackgroundFileName of length zero this Uid will be treated as
       
   306 	 * having no effect, even if there is a "default" Uid. 
       
   307 	 *
       
   308 	 * @since S60 v3.1
       
   309 	 * @param aUid the TUid to associate the kml files with, KNullUid as default
       
   310      * @param aListBoxType the type of listbox to associate the KML files with,
       
   311      *        EListTypeAny to associate it with any type of list.
       
   312 	 * @param aResourceDir the resource directory
       
   313 	 * @param aBackgroundFileName the kml file to use for the background and highlight of the listbox, 
       
   314 	 		  must be relative the resource directory.
       
   315 	 * @param aListItemFilename the kml file to use for the listitems of the listbox, 
       
   316 	 		  must be relative the resource directory.
       
   317 	 * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   318 	 */
       
   319 	TInt RegisterListBoxKml(const TUid& aUid, const TListBoxType aListBoxType, 
       
   320                                      const TDesC& aResourceDir, 
       
   321 									 const TDesC& aBackgroundFilename, 
       
   322 									 const TDesC& aListItemFilename);
       
   323 
       
   324 	/**
       
   325 	 * Unregisters KML files previously registered for a listbox.
       
   326 	 *
       
   327 	 * @since S60 S60 v3.1
       
   328 	 * @param aUid the Uid to unregisted KML files for.
       
   329      * @param aListBoxType The listbox type to unregister KML files for.
       
   330 	 * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   331 	 */    
       
   332 	TInt UnregisterListBoxKml(const TUid& aUid, const TListBoxType aListBoxType);
       
   333 
       
   334     /**
       
   335      * Set the wanted time per frame for listbox effects.
       
   336      *
       
   337      * @param aWantedTime The wanted time per frame, in milliseconds.
       
   338      * 
       
   339      * @return KErrNone on success, or one of the system-wide error codes.
       
   340      */
       
   341     TInt SetListBoxFrameTime( const TInt aWantedTime );
       
   342     
       
   343     /**
       
   344      * Set the minimum time per frame for listbox effects.
       
   345      *
       
   346      * @param aMinFrameTime The minimum time per frame, in milliseconds.
       
   347      *
       
   348      * @return KErrNone on success, or ome of the system-wide error codes.
       
   349      */    
       
   350     TInt SetListBoxMinFrameTime( const TInt aMinFrameTime );
       
   351 
       
   352     /**
       
   353      * Set the wanted time per frame for listbox effects.
       
   354      *
       
   355      * @param aWantedTime The wanted time per frame, in milliseconds.
       
   356      * 
       
   357      * @return KErrNone on success, or one of the system-wide error codes.
       
   358      */
       
   359     TInt SetControlFrameTime( const TInt aWantedTime );
       
   360     
       
   361     /**
       
   362      * Set the minimum time per frame for listbox effects.
       
   363      *
       
   364      * @param aMinFrameTime The minimum time per frame, in milliseconds.
       
   365      *
       
   366      * @return KErrNone on success, or ome of the system-wide error codes.
       
   367      */    
       
   368     TInt SetControlMinFrameTime( const TInt aMinFrameTime );
       
   369 
       
   370 	/**
       
   371      * Checks if the system is connected.
       
   372      * @since S60 3.2
       
   373      *
       
   374      * @return ETrue if connected, otherwise EFalse.
       
   375     */  
       
   376     TBool IsConnected();
       
   377     
       
   378     /**
       
   379      * Switch Tfx Server working on low memory mode from good memory mode.
       
   380      * 
       
   381      * @since S60 3.2
       
   382      * 
       
   383      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   384      */ 
       
   385   	TInt FreeRam();
       
   386   	
       
   387   	/**
       
   388      * Switch Tfx Server working on good memory mode from low memory mode.
       
   389      *
       
   390      * @since S60 3.2
       
   391      * 
       
   392      * @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   393      */ 
       
   394   	TInt MemoryGood();
       
   395   	
       
   396   	
       
   397 private:
       
   398 	/**
       
   399 	 * Verifies that server really is alive.
       
   400 	 * @since S60 3.2
       
   401 	 *
       
   402 	 * @return KErrNone if alive, otherwise any of the system error codes.
       
   403 	 */
       
   404 	TInt VerifyConnection();
       
   405 
       
   406 	/**
       
   407      * shuts down the server. Not to be called by other then the transitionservercontroller
       
   408      * @since S60 3.2
       
   409      *
       
   410      * @return KErrNone or any of the system error codes.
       
   411     */  
       
   412     TInt Shutdown(TThreadId& aServerId);
       
   413 
       
   414     /**
       
   415      * @see RegisterListBoxKml
       
   416      */
       
   417 	TInt RegisterListBoxKmlL(const TUid& aUid, const TListBoxType aListBoxType, 
       
   418                              const TDesC& aResourceDir, 
       
   419                              const TDesC& aBackgroundFilename, 
       
   420                              const TDesC& aListItemFilename);
       
   421 	
       
   422 	/**
       
   423 	 * Only needed to allow finding effect files on different drives
       
   424 	 */
       
   425 	TInt FindEffectFile( const TDesC& aResourceDir, const TDesC& aFilename ); 
       
   426 
       
   427                              
       
   428 private: // data
       
   429     
       
   430    	RAlfTfxClient iTfxServer;
       
   431 	TUid iPluginImplementation;
       
   432 	TBool iConnected;
       
   433 	TBool iHasPlugin;
       
   434 	// We keep these as members to avoid allocating and deallocating memory all the time
       
   435 	HBufC8* iTransferBuffer;
       
   436 	HBufC8* iReturnBuffer;
       
   437 	// RFs, filename and parse are needed only to allow overriding the drive definition
       
   438 	// from the manifest file
       
   439     RFs iFs; // file system
       
   440     TParse iParse; // for parsing filename locations
       
   441 	RFile iFile;
       
   442 	};
       
   443 	
       
   444 	
       
   445 #endif // R_TRANSITIONSERVER_H
       
   446 
       
   447