uiacceltk/hitchcock/plugins/alftranseffect/alftfxserverplugin/src/alftransitionserver.cpp
changeset 0 15bf7259bb7c
child 49 c9d868f1e20c
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 implementation of the API used by theme server
       
    15 *                to control transition appearance.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #include <s32mem.h>
       
    22 #include <TfxSrvEcomIds.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 #include <alf/AlfTransEffectPlugin.h>
       
    26 #include <mtransitionservercontroller.h>
       
    27 #include "alftfxserverdef.h"
       
    28 #include "alftransitionserver.h"
       
    29 #include "alflogger.h"
       
    30 
       
    31 // ======== MEMBER FUNCTIONS ========
       
    32 
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 CAlfTransitionServerClient::CAlfTransitionServerClient():
       
    38 iPluginImplementation( TUid::Null() )
       
    39 	{
       
    40 	__ALFFXLOGSTRING("CAlfTransitionServerClient::CAlfTransitionServerClient - starting");
       
    41 	}
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 CAlfTransitionServerClient::~CAlfTransitionServerClient()
       
    47 	{
       
    48 	// We don't unload plugin here, we let CGfxTransAdapterTfx keep it.
       
    49 	// Maybe CGfxTransAdapterTfx should not unload it either?
       
    50 	// We assume that when two clients tell RAlfTfxClient to load the plugin,
       
    51 	// we always get the same instance of the plugin as it is loaded in the
       
    52 	// server side and runs in the server thread.
       
    53 	__ALFFXLOGSTRING("CAlfTransitionServerClient::~CAlfTransitionServerClient >>");
       
    54 	iTfxServer.Close();
       
    55 	iConnected = EFalse;
       
    56 	iHasPlugin = EFalse;
       
    57 	delete iTransferBuffer;
       
    58 	delete iReturnBuffer;
       
    59 	iFs.Close();
       
    60 	__ALFFXLOGSTRING("CAlfTransitionServerClient::~CAlfTransitionServerClient <<");
       
    61 	}
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 TInt CAlfTransitionServerClient::Connect()
       
    67 	{
       
    68 	__ALFFXLOGSTRING("CAlfTransitionServerClient::Connect >>");
       
    69 	TInt err = KErrNone;
       
    70 	TInt fsErr = KErrNone;
       
    71 	if ( !iTransferBuffer )
       
    72 	    {
       
    73         iTransferBuffer = HBufC8::New( 1024 );
       
    74 	    }
       
    75 	if ( !iReturnBuffer )
       
    76 	    {
       
    77 	    // This is actually not used for anything
       
    78         iReturnBuffer = HBufC8::New( 10 );
       
    79 	    }
       
    80 	    
       
    81 	if ( !iTransferBuffer || !iReturnBuffer )
       
    82 	    {
       
    83 	    __ALFFXLOGSTRING("CAlfTransitionServerClient::Connect - return KErrNoMemory");
       
    84 	    return KErrNoMemory;
       
    85 	    }
       
    86 
       
    87 	if ( iPluginImplementation == TUid::Null() )
       
    88 	    {
       
    89         RImplInfoPtrArray pluginArray;
       
    90         TRAP( err, REComSession::ListImplementationsL( KAlfGfxPluginInterfaceUId, pluginArray ) );
       
    91     	if ( pluginArray.Count() > 0 )
       
    92     	    {
       
    93     	    iPluginImplementation = pluginArray[0]->ImplementationUid();
       
    94     	    }
       
    95 	    }
       
    96 	
       
    97 	if( !iConnected )
       
    98 	    {
       
    99         err = iTfxServer.Open();	
       
   100         if ( err == KErrNone )
       
   101             {
       
   102             iConnected = ETrue;
       
   103             }
       
   104 	    }
       
   105 	    
       
   106 	if ( iConnected && !iHasPlugin )
       
   107 	    {
       
   108         if( iPluginImplementation != TUid::Null() )
       
   109             {
       
   110             err = iTfxServer.LoadTfxPlugin( iPluginImplementation );
       
   111             // 
       
   112             if ( err == KErrNone || err == KErrAlreadyExists )
       
   113                 {
       
   114                 iHasPlugin = ETrue;
       
   115                 err = KErrNone;
       
   116                 // RFs is needed only to allow replacing drive given in manifest file
       
   117                 fsErr = iFs.Connect();
       
   118                 }
       
   119             __ALFFXLOGSTRING("CAlfTransitionServerClient Has Plugin!");
       
   120             }
       
   121 	    }
       
   122 	// We lie about the result.
       
   123 	// At the time being starting alf is taking way too long.
       
   124 	// We must retry later. 
       
   125 	// We only return error if all is well except we cannot connect to the file server
       
   126    
       
   127 	__ALFFXLOGSTRING1("CAlfTransitionServerClient::Connect - return %d ", fsErr);
       
   128 	return fsErr;
       
   129 	}
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 void CAlfTransitionServerClient::Disconnect() 
       
   135 	{
       
   136 	__ALFFXLOGSTRING("CAlfTransitionServerClient::Disconnect >>");
       
   137 	iTfxServer.Close();
       
   138 	iConnected = EFalse;
       
   139 	iHasPlugin = EFalse;
       
   140 	__ALFFXLOGSTRING("CAlfTransitionServerClient::Disconnect <<");
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 TInt CAlfTransitionServerClient::Shutdown(TThreadId& /*aThreadId*/)
       
   147     {
       
   148     __ALFFXLOGSTRING("CAlfTransitionServerClient::Shutdown >>");
       
   149     // we don't have a separate server to shut down as our server side
       
   150     // is actually alf. only the plugin could be destroyed.
       
   151     Disconnect();
       
   152     __ALFFXLOGSTRING("CAlfTransitionServerClient::Shutdown <<");
       
   153 	return KErrNone;
       
   154     }
       
   155 
       
   156 // ---------------------------------------------------------------------------
       
   157 // Checks if the system is connected.
       
   158 // ---------------------------------------------------------------------------
       
   159 //
       
   160 TBool CAlfTransitionServerClient::IsConnected()
       
   161 	{
       
   162 	__ALFFXLOGSTRING1("CAlfTransitionServerClient::IsConnected - return %d", iHasPlugin);
       
   163 	// We are not properly connected unless we also have managed to load the plugin
       
   164 	return iHasPlugin;	
       
   165 	}
       
   166 
       
   167 // ---------------------------------------------------------------------------
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 TInt CAlfTransitionServerClient::RegisterFullscreenKml(	TUint aActionID, const TUid& aUid,
       
   171 														const TDesC& aResourceDir,
       
   172 														const TDesC& aFilename )
       
   173 	{
       
   174 	__ALFFXLOGSTRING("CAlfTransitionServerClient::RegisterFullscreenKml >>");
       
   175 	TInt err = KErrNone;
       
   176 	
       
   177 	if ( !iHasPlugin )
       
   178 	    {
       
   179 	    err = Connect();
       
   180 	    }
       
   181 	if ( !iHasPlugin || err != KErrNone )
       
   182 	    {
       
   183 	    // if we are started too early we just bail out without doing anything
       
   184         return err;
       
   185 	    }
       
   186    
       
   187 	TPtr8 inPtr = iTransferBuffer->Des();
       
   188 	inPtr.Zero();
       
   189 	TPtr8 outPtr = iReturnBuffer->Des();
       
   190 	outPtr.Zero();
       
   191 	RDesWriteStream inBuf( inPtr );
       
   192 	RThread me;
       
   193 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpAddFullscreenKML;
       
   194     err =  FindEffectFile( aResourceDir, aFilename ); 
       
   195 	TRAP( err, 
       
   196 	    {
       
   197 	    inBuf.WriteInt32L( op );
       
   198 		inBuf.WriteUint32L( aActionID );
       
   199 		inBuf.WriteInt32L( aUid.iUid );
       
   200 		TUint64 id = me.Id();
       
   201 		TUint8* ptr = reinterpret_cast<TUint8*>( &id );
       
   202 		inBuf.WriteL( ptr, 8 );
       
   203 //		inBuf << aResourceDir;
       
   204         inBuf << iParse.DriveAndPath();
       
   205 		inBuf << aFilename;
       
   206         inBuf.CommitL();
       
   207 		});
       
   208 		
       
   209 	inBuf.Release();
       
   210 	inBuf.Close();	
       
   211 	
       
   212 	if ( err == KErrNone )
       
   213 	    {
       
   214         err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   215 	    }
       
   216 
       
   217     inPtr.Zero();
       
   218     outPtr.Zero();
       
   219     __ALFFXLOGSTRING1("CAlfTransitionServerClient::RegisterFullscreenKml - return %d <<", err);
       
   220     return err;
       
   221 	}
       
   222 	 
       
   223 // ---------------------------------------------------------------------------
       
   224 // ---------------------------------------------------------------------------
       
   225 //
       
   226 TInt CAlfTransitionServerClient::UnregisterFullscreenKml(TUint aActionID, const TUid& aUid)
       
   227 	{
       
   228 	__ALFFXLOGSTRING("CAlfTransitionServerClient::UnregisterFullscreenKml >>");
       
   229 	TInt err = KErrNone;
       
   230 	
       
   231 	if ( !iHasPlugin )
       
   232 	    {
       
   233 	    err = Connect();
       
   234 	    }
       
   235 	if ( !iHasPlugin || err != KErrNone )
       
   236 	    {
       
   237 	    // if we are started too early we just bail out without doing anything
       
   238         return err;
       
   239 	    }
       
   240 	    
       
   241 	TPtr8 inPtr = iTransferBuffer->Des();
       
   242 	inPtr.Zero();
       
   243 	TPtr8 outPtr = iReturnBuffer->Des();
       
   244 	outPtr.Zero();
       
   245 	RDesWriteStream inBuf( inPtr );
       
   246 	    
       
   247 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpRemoveFullscreenKML;
       
   248 	// These writes cannot leave
       
   249 	TRAP_IGNORE(
       
   250 	    {
       
   251 	    inBuf.WriteInt32L( op );
       
   252 		inBuf.WriteUint32L( aActionID );
       
   253 		inBuf.WriteInt32L( aUid.iUid );
       
   254         inBuf.CommitL();		
       
   255 		});
       
   256 	inBuf.Release();
       
   257 	inBuf.Close();	
       
   258 	
       
   259     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   260 
       
   261     inPtr.Zero();
       
   262     outPtr.Zero();
       
   263     __ALFFXLOGSTRING1("CAlfTransitionServerClient::UnregisterFullscreenKml - return %d ", err);
       
   264     return err;
       
   265 	}
       
   266 
       
   267 // ---------------------------------------------------------------------------
       
   268 // ---------------------------------------------------------------------------
       
   269 //
       
   270 TInt CAlfTransitionServerClient::RegisterListBoxKmlL(const TUid& aUid,
       
   271                         const TListBoxType aListBoxType, const TDesC& aResourceDir,
       
   272                         const TDesC& aBackgroundFilename, const TDesC& aListItemFilename)
       
   273     {
       
   274 	__ALFFXLOGSTRING("CAlfTransitionServerClient::RegisterListBoxKmlL >>");
       
   275     TInt err = KErrNone;
       
   276 	
       
   277 	if ( !iHasPlugin )
       
   278 	    {
       
   279 	    err = Connect();
       
   280 	    }
       
   281 	if ( !iHasPlugin || err != KErrNone )
       
   282 	    {
       
   283 	    // if we are started too early we just bail out without doing anything
       
   284         return err;
       
   285 	    }
       
   286 	    
       
   287 	TPtr8 inPtr = iTransferBuffer->Des();
       
   288 	inPtr.Zero();
       
   289 	TPtr8 outPtr = iReturnBuffer->Des();
       
   290 	outPtr.Zero();
       
   291 	RDesWriteStream inBuf( inPtr );
       
   292 	
       
   293 	RThread me;
       
   294 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpListBoxRegisterKML;
       
   295     err = FindEffectFile( aResourceDir, aBackgroundFilename );
       
   296 	TRAP( err, 
       
   297 	    {
       
   298         inBuf.WriteInt32L( op );
       
   299     	inBuf.WriteInt32L( aUid.iUid );
       
   300     	TUint64 id = me.Id();
       
   301     	TUint8* ptr = reinterpret_cast<TUint8*>( &id );
       
   302     	inBuf.WriteL( ptr, 8 );
       
   303         inBuf.WriteInt32L( ( TInt32 )aListBoxType );
       
   304         inBuf << iParse.DriveAndPath();
       
   305 //    	inBuf << aResourceDir;
       
   306     	inBuf << aBackgroundFilename;
       
   307     	inBuf << aListItemFilename;
       
   308         inBuf.CommitL();
       
   309 	    });
       
   310     
       
   311 	inBuf.Release();
       
   312 	inBuf.Close();	
       
   313 	
       
   314 	if ( err == KErrNone )
       
   315 	    {
       
   316         err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   317 	    }
       
   318 
       
   319     inPtr.Zero();
       
   320     outPtr.Zero();
       
   321     __ALFFXLOGSTRING1("CAlfTransitionServerClient::RegisterListBoxKmlL return: %d ", err);
       
   322     return err;
       
   323     }
       
   324 
       
   325 TInt CAlfTransitionServerClient::RegisterListBoxKml(const TUid& aUid,
       
   326                                  const TListBoxType aListBoxType, const TDesC& aResourceDir,
       
   327                                  const TDesC& aBackgroundFilename, const TDesC& aListItemFilename)
       
   328     {
       
   329 	__ALFFXLOGSTRING("CAlfTransitionServerClient::RegisterListBoxKml >>");
       
   330     TInt err = KErrNone;
       
   331 	
       
   332 	if ( !iHasPlugin )
       
   333 	    {
       
   334 	    err = Connect();
       
   335 	    }
       
   336 	if ( !iHasPlugin || err != KErrNone )
       
   337 	    {
       
   338 	    // if we are started too early we just bail out without doing anything
       
   339         return err;
       
   340 	    }
       
   341 	    
       
   342     TRAP( err, RegisterListBoxKmlL( aUid, aListBoxType, aResourceDir,
       
   343                                      aBackgroundFilename, aListItemFilename ) );
       
   344 
       
   345     __ALFFXLOGSTRING1("CAlfTransitionServerClient::RegisterListBoxKml - return %d ", err);
       
   346     return err;
       
   347     }
       
   348 
       
   349 // ---------------------------------------------------------------------------
       
   350 // ---------------------------------------------------------------------------
       
   351 //
       
   352 TInt CAlfTransitionServerClient::UnregisterListBoxKml(const TUid& aUid, const TListBoxType aListBoxType)
       
   353     {
       
   354     __ALFFXLOGSTRING("CAlfTransitionServerClient::UnregisterListBoxKml >>");
       
   355 	TInt err = KErrNone;
       
   356 	
       
   357 	if ( !iHasPlugin )
       
   358 	    {
       
   359 	    err = Connect();
       
   360 	    }
       
   361 	if ( !iHasPlugin || err != KErrNone )
       
   362 	    {
       
   363 	    // if we are started too early we just bail out without doing anything
       
   364         return err;
       
   365 	    }
       
   366 	    
       
   367 	TPtr8 inPtr = iTransferBuffer->Des();
       
   368 	inPtr.Zero();
       
   369 	TPtr8 outPtr = iReturnBuffer->Des();
       
   370 	outPtr.Zero();
       
   371 	RDesWriteStream inBuf( inPtr );
       
   372 	    
       
   373 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpListBoxUnregisterKML;
       
   374 	// These writes cannot leave
       
   375 	TRAP_IGNORE( 
       
   376 	    {
       
   377 	    inBuf.WriteInt32L( op );
       
   378 		inBuf.WriteInt32L( aUid.iUid );
       
   379         inBuf.WriteInt32L( ( TInt32 )aListBoxType );
       
   380         inBuf.CommitL();		
       
   381 		} );
       
   382 		
       
   383 	inBuf.Release();
       
   384 	inBuf.Close();	
       
   385 	
       
   386     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   387 
       
   388     inPtr.Zero();
       
   389     outPtr.Zero();
       
   390     __ALFFXLOGSTRING1("CAlfTransitionServerClient::UnregisterListBoxKml - return %d ", err);
       
   391     return err;
       
   392     }
       
   393 
       
   394 // ---------------------------------------------------------------------------
       
   395 // ---------------------------------------------------------------------------
       
   396 //
       
   397 TInt CAlfTransitionServerClient::SetListBoxFrameTime( const TInt aWantedTime )
       
   398     {
       
   399     __ALFFXLOGSTRING("CAlfTransitionServerClient::SetListBoxFrameTime >>");
       
   400 	TInt err = KErrNone;
       
   401 	
       
   402 	if ( !iHasPlugin )
       
   403 	    {
       
   404 	    err = Connect();
       
   405 	    }
       
   406 	if ( !iHasPlugin || err != KErrNone )
       
   407 	    {
       
   408 	    // if we are started too early we just bail out without doing anything
       
   409         return err;
       
   410 	    }
       
   411 	    
       
   412 	TPtr8 inPtr = iTransferBuffer->Des();
       
   413 	inPtr.Zero();
       
   414 	TPtr8 outPtr = iReturnBuffer->Des();
       
   415 	outPtr.Zero();
       
   416 	RDesWriteStream inBuf( inPtr );
       
   417 	    
       
   418 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpListBoxSetFrameTime;
       
   419 	// These writes cannot leave
       
   420 	TRAP_IGNORE( 
       
   421 	    {
       
   422 	    inBuf.WriteInt32L( op );
       
   423 		inBuf.WriteInt32L( aWantedTime );
       
   424         inBuf.CommitL();		
       
   425 		} );
       
   426 	inBuf.Release();
       
   427 	inBuf.Close();	
       
   428 	
       
   429     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   430 
       
   431     inPtr.Zero();
       
   432     outPtr.Zero();
       
   433     __ALFFXLOGSTRING1("CAlfTransitionServerClient::SetListBoxFrameTime - return: %d <<", err);
       
   434     return err;
       
   435     }
       
   436 
       
   437 // ---------------------------------------------------------------------------
       
   438 // ---------------------------------------------------------------------------
       
   439 //
       
   440 TInt CAlfTransitionServerClient::SetListBoxMinFrameTime( const TInt aMinTime )
       
   441     {
       
   442     __ALFFXLOGSTRING("CAlfTransitionServerClient::SetListBoxMinFrameTime >>");
       
   443 	TInt err = KErrNone;
       
   444 	
       
   445 	if ( !iHasPlugin )
       
   446 	    {
       
   447 	    err = Connect();
       
   448 	    }
       
   449 	if ( !iHasPlugin || err != KErrNone )
       
   450 	    {
       
   451 	    // if we are started too early we just bail out without doing anything
       
   452         return err;
       
   453 	    }
       
   454 	    
       
   455 	TPtr8 inPtr = iTransferBuffer->Des();
       
   456 	inPtr.Zero();
       
   457 	TPtr8 outPtr = iReturnBuffer->Des();
       
   458 	outPtr.Zero();
       
   459 	RDesWriteStream inBuf( inPtr );
       
   460 	    
       
   461 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpListBoxSetMinFrameTime;
       
   462 	// These writes cannot leave
       
   463 	TRAP_IGNORE( 
       
   464 	    {
       
   465 	    inBuf.WriteInt32L( op );
       
   466 		inBuf.WriteInt32L( aMinTime );
       
   467         inBuf.CommitL();		
       
   468 		} );
       
   469 	inBuf.Release();
       
   470 	inBuf.Close();	
       
   471 	
       
   472     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   473 
       
   474     inPtr.Zero();
       
   475     outPtr.Zero();
       
   476     __ALFFXLOGSTRING1("CAlfTransitionServerClient::SetListBoxMinFrameTime - return: %d <<", err );
       
   477     return err;
       
   478     }
       
   479 
       
   480 
       
   481 // ---------------------------------------------------------------------------
       
   482 // ---------------------------------------------------------------------------
       
   483 //
       
   484 TInt CAlfTransitionServerClient::SetControlFrameTime( const TInt aWantedTime )
       
   485     {
       
   486     __ALFFXLOGSTRING("CAlfTransitionServerClient::SetControlFrameTime >>");
       
   487 	TInt err = KErrNone;
       
   488 	
       
   489 	if ( !iHasPlugin )
       
   490 	    {
       
   491 	    err = Connect();
       
   492 	    }
       
   493 	if ( !iHasPlugin || err != KErrNone )
       
   494 	    {
       
   495 	    // if we are started too early we just bail out without doing anything
       
   496         return err;
       
   497 	    }
       
   498 	    
       
   499 	TPtr8 inPtr = iTransferBuffer->Des();
       
   500 	inPtr.Zero();
       
   501 	TPtr8 outPtr = iReturnBuffer->Des();
       
   502 	outPtr.Zero();
       
   503 	RDesWriteStream inBuf( inPtr );
       
   504 	    
       
   505 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpControlSetFrameTime;
       
   506 	// These writes cannot leave
       
   507 	TRAP_IGNORE( 
       
   508 	    {
       
   509 	    inBuf.WriteInt32L( op );
       
   510 		inBuf.WriteInt32L( aWantedTime );
       
   511         inBuf.CommitL();		
       
   512 		} );
       
   513 	inBuf.Release();
       
   514 	inBuf.Close();	
       
   515 	
       
   516     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   517 
       
   518     inPtr.Zero();
       
   519     outPtr.Zero();
       
   520     __ALFFXLOGSTRING1("CAlfTransitionServerClient::SetControlFrameTime - return: %d <<", err);
       
   521     return err;
       
   522     }
       
   523 
       
   524 // ---------------------------------------------------------------------------
       
   525 // ---------------------------------------------------------------------------
       
   526 //
       
   527 TInt CAlfTransitionServerClient::SetControlMinFrameTime( const TInt aMinTime )
       
   528     {
       
   529     __ALFFXLOGSTRING("CAlfTransitionServerClient::SetControlMinFrameTime >>");
       
   530 	TInt err = KErrNone;
       
   531 	
       
   532 	if ( !iHasPlugin )
       
   533 	    {
       
   534 	    err = Connect();
       
   535 	    }
       
   536 	if ( !iHasPlugin || err != KErrNone )
       
   537 	    {
       
   538 	    // if we are started too early we just bail out without doing anything
       
   539         return err;
       
   540 	    }
       
   541 	    
       
   542 	TPtr8 inPtr = iTransferBuffer->Des();
       
   543 	inPtr.Zero();
       
   544 	TPtr8 outPtr = iReturnBuffer->Des();
       
   545 	outPtr.Zero();
       
   546 	RDesWriteStream inBuf( inPtr );
       
   547 	    
       
   548 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpControlSetMinFrameTime;
       
   549 	// These writes cannot leave
       
   550 	TRAP( err, 
       
   551 	    {
       
   552 	    inBuf.WriteInt32L( op );
       
   553 		inBuf.WriteInt32L( aMinTime );
       
   554         inBuf.CommitL();		
       
   555 		} );
       
   556 	inBuf.Release();
       
   557 	inBuf.Close();	
       
   558 	
       
   559     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   560 
       
   561     inPtr.Zero();
       
   562     outPtr.Zero();
       
   563     __ALFFXLOGSTRING1("CAlfTransitionServerClient::SetControlMinFrameTime - return: %d <<", err );
       
   564     return err;
       
   565     }
       
   566 
       
   567 
       
   568 // ---------------------------------------------------------------------------
       
   569 // ---------------------------------------------------------------------------
       
   570 //
       
   571 TInt CAlfTransitionServerClient::BlockFullScreenUid(const TUid& aUid, TBool aBlockFrom, TBool aBlockTo )
       
   572 	{
       
   573 	__ALFFXLOGSTRING("CAlfTransitionServerClient::BlockFullScreenUid >>");
       
   574 	TInt err = KErrNone;
       
   575 	
       
   576 	if ( !iHasPlugin )
       
   577 	    {
       
   578 	    err = Connect();
       
   579 	    }
       
   580 	if ( !iHasPlugin || err != KErrNone )
       
   581 	    {
       
   582 	    // if we are started too early we just bail out without doing anything
       
   583         return err;
       
   584 	    }
       
   585 	    
       
   586 	TPtr8 inPtr = iTransferBuffer->Des();
       
   587 	inPtr.Zero();
       
   588 	TPtr8 outPtr = iReturnBuffer->Des();
       
   589 	outPtr.Zero();
       
   590 	RDesWriteStream inBuf( inPtr );
       
   591 	    
       
   592 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpBlockFullscreenUid;
       
   593 	// These writes cannot leave
       
   594 	TRAP_IGNORE( 
       
   595 	    {
       
   596 	    inBuf.WriteInt32L( op );
       
   597 		inBuf.WriteInt32L( aUid.iUid );
       
   598 		inBuf.WriteInt32L( aBlockFrom );
       
   599 		inBuf.WriteInt32L( aBlockTo );
       
   600         inBuf.CommitL();		
       
   601 		} );
       
   602 	inBuf.Release();
       
   603 	inBuf.Close();	
       
   604 	
       
   605     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   606 
       
   607     inPtr.Zero();
       
   608     outPtr.Zero();
       
   609     __ALFFXLOGSTRING1("CAlfTransitionServerClient::BlockFullScreenUid - return: %d <<", err);
       
   610     return err;
       
   611 	}
       
   612 	
       
   613 // ---------------------------------------------------------------------------
       
   614 // ---------------------------------------------------------------------------
       
   615 //
       
   616 TInt CAlfTransitionServerClient::RegisterControlAction(	const TUid& aUid, TUint aActionID, 
       
   617 														const TDesC& aActionString )
       
   618 	{
       
   619 	__ALFFXLOGSTRING("CAlfTransitionServerClient::RegisterControlAction >>");
       
   620 	TInt err = KErrNone;
       
   621 	
       
   622 	if ( !iHasPlugin )
       
   623 	    {
       
   624 	    err = Connect();
       
   625 	    }
       
   626 	if ( !iHasPlugin || err != KErrNone )
       
   627 	    {
       
   628 	    // if we are started too early we just bail out without doing anything
       
   629         return err;
       
   630 	    }
       
   631 	    
       
   632 	TPtr8 inPtr = iTransferBuffer->Des();
       
   633 	inPtr.Zero();
       
   634 	TPtr8 outPtr = iReturnBuffer->Des();
       
   635 	outPtr.Zero();
       
   636 	RDesWriteStream inBuf( inPtr );
       
   637 	    
       
   638 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpControlPolicyUpdate;
       
   639 	// These writes cannot leave
       
   640 	TRAP_IGNORE( 
       
   641 	    {
       
   642 	    inBuf.WriteInt32L( op );
       
   643 		inBuf.WriteInt32L( aUid.iUid );
       
   644 		inBuf.WriteUint32L( aActionID );
       
   645 		inBuf << aActionString;
       
   646         inBuf.CommitL();		
       
   647 		} );
       
   648 	inBuf.Release();
       
   649 	inBuf.Close();	
       
   650 	
       
   651     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   652 
       
   653     inPtr.Zero();
       
   654     outPtr.Zero();
       
   655     __ALFFXLOGSTRING1("CAlfTransitionServerClient::RegisterControlAction - return: %d <<", err);
       
   656     return err;
       
   657 	}
       
   658 	
       
   659 	
       
   660 // ---------------------------------------------------------------------------
       
   661 // ---------------------------------------------------------------------------
       
   662 //
       
   663 TInt CAlfTransitionServerClient::UnregisterControlAction(const TUid& aUid, TUint aActionID )
       
   664 	{
       
   665 	__ALFFXLOGSTRING("CAlfTransitionServerClient::UnregisterControlAction >>");
       
   666 	TInt err = KErrNone;
       
   667 	
       
   668 	if ( !iHasPlugin )
       
   669 	    {
       
   670 	    err = Connect();
       
   671 	    }
       
   672 	if ( !iHasPlugin || err != KErrNone )
       
   673 	    {
       
   674 	    // if we are started too early we just bail out without doing anything
       
   675         return err;
       
   676 	    }
       
   677 	    
       
   678 	TPtr8 inPtr = iTransferBuffer->Des();
       
   679 	inPtr.Zero();
       
   680 	TPtr8 outPtr = iReturnBuffer->Des();
       
   681 	outPtr.Zero();
       
   682 	RDesWriteStream inBuf( inPtr );
       
   683 	    
       
   684 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpControlPolicyRemove;
       
   685 	// These writes cannot leave
       
   686 	TRAP_IGNORE(  
       
   687 	    {
       
   688 	    inBuf.WriteInt32L( op );
       
   689 		inBuf.WriteInt32L( aUid.iUid );
       
   690 		inBuf.WriteUint32L( aActionID );
       
   691         inBuf.CommitL();		
       
   692 		} );
       
   693 	inBuf.Release();
       
   694 	inBuf.Close();	
       
   695 	
       
   696     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   697 
       
   698     inPtr.Zero();
       
   699     outPtr.Zero();
       
   700     __ALFFXLOGSTRING1("CAlfTransitionServerClient::UnregisterControlAction - return: %d <<", err);
       
   701     return err;
       
   702 	}
       
   703 	
       
   704 // ---------------------------------------------------------------------------
       
   705 // ---------------------------------------------------------------------------
       
   706 //
       
   707 TInt CAlfTransitionServerClient::RegisterControlKml(const TUid& aUid, const TDesC& aResourceDir, 
       
   708 													const TDesC& aFilename)
       
   709 	{
       
   710 	__ALFFXLOGSTRING("CAlfTransitionServerClient::RegisterControlKml >>");
       
   711 	TInt err = KErrNone;
       
   712 	
       
   713 	if ( !iHasPlugin )
       
   714 	    {
       
   715 	    err = Connect();
       
   716 	    }
       
   717 	if ( !iHasPlugin || err != KErrNone )
       
   718 	    {
       
   719 	    // if we are started too early we just bail out without doing anything
       
   720         return err;
       
   721 	    }
       
   722 	    
       
   723 	TPtr8 inPtr = iTransferBuffer->Des();
       
   724 	inPtr.Zero();
       
   725 	TPtr8 outPtr = iReturnBuffer->Des();
       
   726 	outPtr.Zero();
       
   727     RDesWriteStream inBuf( inPtr );
       
   728     err = FindEffectFile( aResourceDir, aFilename ); 
       
   729 
       
   730 	TRAP( err, 
       
   731 	    {
       
   732     	RThread me;
       
   733     	TInt op = MAlfGfxEffectPlugin::ETfxServerOpRegisterControlKml;
       
   734         inBuf.WriteInt32L( op );
       
   735     	inBuf.WriteInt32L( aUid.iUid );
       
   736     	TUint64 id = me.Id();
       
   737     	TUint8* ptr = reinterpret_cast<TUint8*>( &id );
       
   738     	inBuf.WriteL( ptr, 8 );
       
   739         inBuf << iParse.DriveAndPath();
       
   740 //    	inBuf << aResourceDir;
       
   741     	inBuf << aFilename;
       
   742         inBuf.CommitL();		
       
   743 	    });
       
   744 	    
       
   745 	inBuf.Release();
       
   746 	inBuf.Close();	
       
   747 	
       
   748 	if ( err == KErrNone )
       
   749 	    {
       
   750         err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   751 	    }
       
   752 
       
   753     inPtr.Zero();
       
   754     outPtr.Zero();
       
   755     __ALFFXLOGSTRING1("CAlfTransitionServerClient::RegisterControlKml - return: %d <<", err );
       
   756     return err;
       
   757 	}
       
   758 
       
   759 // ---------------------------------------------------------------------------
       
   760 // ---------------------------------------------------------------------------
       
   761 //
       
   762 TInt CAlfTransitionServerClient::RegisterControlKml(const TUid& aUid, const TDesC& aResourceDir, 
       
   763 													const TDesC& aFilename, TInt aWantedTime,
       
   764 													TInt aMinTime)
       
   765 	{
       
   766 	__ALFFXLOGSTRING("CAlfTransitionServerClient::RegisterControlKml >>");
       
   767 	TInt err = KErrNone;
       
   768 	
       
   769 	if ( !iHasPlugin )
       
   770 	    {
       
   771 	    err = Connect();
       
   772 	    }
       
   773 	if ( !iHasPlugin || err != KErrNone )
       
   774 	    {
       
   775 	    // if we are started too early we just bail out without doing anything
       
   776         return err;
       
   777 	    }
       
   778 	    
       
   779 	TPtr8 inPtr = iTransferBuffer->Des();
       
   780 	inPtr.Zero();
       
   781 	TPtr8 outPtr = iReturnBuffer->Des();
       
   782 	outPtr.Zero();
       
   783     RDesWriteStream inBuf( inPtr );
       
   784 
       
   785 	RThread me;
       
   786 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpRegisterControlKmlEx;
       
   787     err = FindEffectFile( aResourceDir, aFilename ); 
       
   788 	TRAP( err, 
       
   789 	    {
       
   790         inBuf.WriteInt32L( op );
       
   791     	inBuf.WriteInt32L( aUid.iUid );
       
   792     	TUint64 id = me.Id();
       
   793     	TUint8* ptr = reinterpret_cast<TUint8*>( &id );
       
   794     	inBuf.WriteL( ptr, 8 );
       
   795         inBuf << iParse.DriveAndPath();
       
   796 //    	inBuf << aResourceDir;
       
   797     	inBuf << aFilename;
       
   798         inBuf.WriteInt32L( aWantedTime );
       
   799     	inBuf.WriteInt32L( aMinTime );
       
   800         inBuf.CommitL();		
       
   801 	    });
       
   802 	
       
   803 	inBuf.Release();
       
   804 	inBuf.Close();	
       
   805 	
       
   806 	if ( err == KErrNone )
       
   807 	    {
       
   808         err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   809 	    }
       
   810 
       
   811     inPtr.Zero();
       
   812     outPtr.Zero();
       
   813     __ALFFXLOGSTRING1("CAlfTransitionServerClient::RegisterControlKml - return: %d <<", err);
       
   814     return err;
       
   815 	}
       
   816 
       
   817 // ---------------------------------------------------------------------------
       
   818 // ---------------------------------------------------------------------------
       
   819 //
       
   820 TInt CAlfTransitionServerClient::UnregisterAllKml()
       
   821 	{
       
   822 	__ALFFXLOGSTRING("CAlfTransitionServerClient::UnregisterAllKml >>");
       
   823 	TInt err = KErrNone;
       
   824 	
       
   825 	if ( !iHasPlugin )
       
   826 	    {
       
   827 	    err = Connect();
       
   828 	    }
       
   829 	if ( !iHasPlugin || err != KErrNone )
       
   830 	    {
       
   831 	    // if we are started too early we just bail out without doing anything
       
   832         return err;
       
   833 	    }
       
   834 	    
       
   835 	TPtr8 inPtr = iTransferBuffer->Des();
       
   836 	inPtr.Zero();
       
   837 	TPtr8 outPtr = iReturnBuffer->Des();
       
   838 	outPtr.Zero();
       
   839 	RDesWriteStream inBuf( inPtr );
       
   840 
       
   841 	// Out only parameter will be our thread id 
       
   842 	RThread me;
       
   843    	TInt op = MAlfGfxEffectPlugin::ETfxServerOpRemoveAllKml;
       
   844 	// These writes cannot leave
       
   845 	TRAP_IGNORE( 
       
   846 	    {
       
   847 	    inBuf.WriteInt32L( op );
       
   848     	TUint64 id = me.Id();
       
   849 	    TUint8* ptr = reinterpret_cast<TUint8*>( &id );
       
   850 	    inBuf.WriteL( ptr, 8 );
       
   851         inBuf.CommitL();		
       
   852 		} );
       
   853 	inBuf.Release();
       
   854 	inBuf.Close();
       
   855    
       
   856     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   857 	 
       
   858     inPtr.Zero();
       
   859     outPtr.Zero();
       
   860     __ALFFXLOGSTRING1("CAlfTransitionServerClient::UnregisterAllKml - return: %d <<", err);
       
   861     return KErrNone;
       
   862 	}
       
   863 
       
   864 
       
   865 // ---------------------------------------------------------------------------
       
   866 // ---------------------------------------------------------------------------
       
   867 //
       
   868 TInt CAlfTransitionServerClient::UnregisterControlKml(const TUid& aUid)
       
   869 	{
       
   870 	__ALFFXLOGSTRING("CAlfTransitionServerClient::UnregisterControlKml >>");
       
   871 	TInt err = KErrNone;
       
   872 	
       
   873 	if ( !iHasPlugin )
       
   874 	    {
       
   875 	    err = Connect();
       
   876 	    }
       
   877 	if ( !iHasPlugin || err != KErrNone )
       
   878 	    {
       
   879 	    // if we are started too early we just bail out without doing anything
       
   880         return err;
       
   881 	    }
       
   882 	    
       
   883 	TPtr8 inPtr = iTransferBuffer->Des();
       
   884 	inPtr.Zero();
       
   885 	TPtr8 outPtr = iReturnBuffer->Des();
       
   886 	outPtr.Zero();
       
   887 	RDesWriteStream inBuf( inPtr );
       
   888 	    
       
   889 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpRemoveControlKml;
       
   890 	// These writes cannot leave
       
   891 	TRAP( err, 
       
   892 	    {
       
   893 	    inBuf.WriteInt32L( op );
       
   894 		inBuf.WriteInt32L( aUid.iUid );
       
   895         inBuf.CommitL();		
       
   896 		} );
       
   897 	inBuf.Release();
       
   898 	inBuf.Close();	
       
   899 	
       
   900     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   901 
       
   902     inPtr.Zero();
       
   903     outPtr.Zero();
       
   904     __ALFFXLOGSTRING1("CAlfTransitionServerClient::UnregisterControlKml - return: %d <<", err);
       
   905     return err;
       
   906 	}
       
   907 
       
   908 // ---------------------------------------------------------------------------
       
   909 // ---------------------------------------------------------------------------
       
   910 //
       
   911 TInt CAlfTransitionServerClient::SetWantedTime( TInt aTime )
       
   912 	{
       
   913 	__ALFFXLOGSTRING("CAlfTransitionServerClient::SetWantedTime >>");
       
   914 	TInt err = KErrNone;
       
   915 	
       
   916 	if ( !iHasPlugin )
       
   917 	    {
       
   918 	    err = Connect();
       
   919 	    }
       
   920 	if ( !iHasPlugin || err != KErrNone )
       
   921 	    {
       
   922 	    // if we are started too early we just bail out without doing anything
       
   923         return err;
       
   924 	    }
       
   925 	    
       
   926 	TPtr8 inPtr = iTransferBuffer->Des();
       
   927 	inPtr.Zero();
       
   928 	TPtr8 outPtr = iReturnBuffer->Des();
       
   929 	outPtr.Zero();
       
   930 	RDesWriteStream inBuf( inPtr );
       
   931 	    
       
   932 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpSetWantedTime;
       
   933 	// These writes cannot leave
       
   934 	TRAP_IGNORE( 
       
   935 	    {
       
   936 	    inBuf.WriteInt32L( op );
       
   937 		inBuf.WriteInt32L( aTime );
       
   938         inBuf.CommitL();		
       
   939 		} );
       
   940 	inBuf.Release();
       
   941 	inBuf.Close();	
       
   942 	
       
   943     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   944 
       
   945     inPtr.Zero();
       
   946     outPtr.Zero();
       
   947     __ALFFXLOGSTRING1("CAlfTransitionServerClient::SetWantedTime - return: %d <<", err);
       
   948     return err;
       
   949 	}
       
   950 
       
   951 // ---------------------------------------------------------------------------
       
   952 // ---------------------------------------------------------------------------
       
   953 //	
       
   954 TInt CAlfTransitionServerClient::SetMinTime(TInt aTime)
       
   955 	{
       
   956 	__ALFFXLOGSTRING1("CAlfTransitionServerClient::SetMinTime - aTime: %d >>", aTime );
       
   957 	TInt err = KErrNone;
       
   958 	
       
   959 	if ( !iHasPlugin )
       
   960 	    {
       
   961 	    err = Connect();
       
   962 	    }
       
   963 	if ( !iHasPlugin || err != KErrNone )
       
   964 	    {
       
   965 	    // if we are started too early we just bail out without doing anything
       
   966         __ALFFXLOGSTRING1("CAlfTransitionServerClient::SetMinTime - return: %d <<", err);
       
   967 	    return err;
       
   968 	    }
       
   969 	    
       
   970 	TPtr8 inPtr = iTransferBuffer->Des();
       
   971 	inPtr.Zero();
       
   972 	TPtr8 outPtr = iReturnBuffer->Des();
       
   973 	outPtr.Zero();
       
   974 	RDesWriteStream inBuf( inPtr );
       
   975 	    
       
   976 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpSetMinTime;
       
   977 	// These writes cannot leave
       
   978 	TRAP_IGNORE( 
       
   979 	    {
       
   980 	    inBuf.WriteInt32L( op );
       
   981 		inBuf.WriteInt32L( aTime );
       
   982         inBuf.CommitL();		
       
   983 		} );
       
   984 	inBuf.Release();
       
   985 	inBuf.Close();	
       
   986 	
       
   987     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
   988 
       
   989     inPtr.Zero();
       
   990     outPtr.Zero();
       
   991     __ALFFXLOGSTRING1("CAlfTransitionServerClient::SetMinTime - return: %d <<", err);
       
   992     return err;
       
   993 	}	
       
   994 
       
   995 // ---------------------------------------------------------------------------
       
   996 // ---------------------------------------------------------------------------
       
   997 //	
       
   998 TInt CAlfTransitionServerClient::RegisterFullscreenKml(	TUint aActionID, const TUid& aUid, 
       
   999 														const TDesC& aResourceDir, const TDesC& aFilename,
       
  1000 														TInt aCachePriority, TInt aWantedTime,
       
  1001 														TInt aMinTime)
       
  1002 	{
       
  1003 	__ALFFXLOGSTRING("CAlfTransitionServerClient::RegisterFullscreenKml >>");
       
  1004 	TInt err = KErrNone;
       
  1005 	
       
  1006 	if ( !iHasPlugin )
       
  1007 	    {
       
  1008 	    err = Connect();
       
  1009 	    }
       
  1010 	if ( !iHasPlugin || err != KErrNone )
       
  1011 	    {
       
  1012 	    // if we are started too early we just bail out without doing anything
       
  1013         return err;
       
  1014 	    }
       
  1015 	    
       
  1016 	// Streaming test    
       
  1017 	    
       
  1018 	TPtr8 inPtr = iTransferBuffer->Des();
       
  1019 	inPtr.Zero();
       
  1020 	TPtr8 outPtr = iReturnBuffer->Des();
       
  1021 	outPtr.Zero();
       
  1022 	RDesWriteStream inBuf( inPtr );
       
  1023 	RThread me;
       
  1024 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpAddFullscreenKMLEx;
       
  1025     err = FindEffectFile( aResourceDir, aFilename ); 
       
  1026 	TRAP( err, 
       
  1027 	    {
       
  1028 	    inBuf.WriteInt32L( op );
       
  1029 		inBuf.WriteUint32L( aActionID );
       
  1030 		inBuf.WriteInt32L( aUid.iUid );
       
  1031     	TUint64 id = me.Id();
       
  1032 	    TUint8* ptr = reinterpret_cast<TUint8*>( &id );
       
  1033 	    inBuf.WriteL( ptr, 8 );
       
  1034         inBuf << iParse.DriveAndPath();
       
  1035 //		inBuf << aResourceDir;
       
  1036 		inBuf << aFilename;
       
  1037 		inBuf.WriteInt32L( aCachePriority );
       
  1038 		inBuf.WriteInt32L( aWantedTime );
       
  1039 		inBuf.WriteInt32L( aMinTime );
       
  1040         inBuf.CommitL();		
       
  1041 		} );
       
  1042 		
       
  1043 	inBuf.Release();
       
  1044 	inBuf.Close();	
       
  1045    
       
  1046     if ( err == KErrNone )
       
  1047         {
       
  1048         err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
  1049         }
       
  1050 
       
  1051     inPtr.Zero();
       
  1052     outPtr.Zero();
       
  1053     __ALFFXLOGSTRING("CAlfTransitionServerClient::RegisterFullscreenKml - return KErrNone <<");
       
  1054     return KErrNone;
       
  1055 	}
       
  1056 	
       
  1057 // ---------------------------------------------------------------------------
       
  1058 // ---------------------------------------------------------------------------
       
  1059 //	
       
  1060 TInt CAlfTransitionServerClient::VerifyConnection()
       
  1061 	{
       
  1062 	__ALFFXLOGSTRING("CAlfTransitionServerClient::VerifyConnection >>");
       
  1063 	TInt err = KErrNone;
       
  1064 	
       
  1065 	if ( !iHasPlugin )
       
  1066 	    {
       
  1067 	    err = Connect();
       
  1068 	    }
       
  1069 	if ( !iHasPlugin || err != KErrNone )
       
  1070 	    {
       
  1071 	    // if we are started too early we just bail out without doing anything
       
  1072         return err;
       
  1073 	    }
       
  1074 	    
       
  1075 	TPtr8 inPtr = iTransferBuffer->Des();
       
  1076 	inPtr.Zero();
       
  1077 	TPtr8 outPtr = iReturnBuffer->Des();
       
  1078 	outPtr.Zero();
       
  1079 	RDesWriteStream inBuf( inPtr );
       
  1080 	    
       
  1081 	TInt op = MAlfGfxEffectPlugin::ETfxServerVerifyConnection;
       
  1082 	// These writes cannot leave
       
  1083 	TRAP_IGNORE( 
       
  1084 	    {
       
  1085 	    inBuf.WriteInt32L( op );
       
  1086         inBuf.CommitL();		
       
  1087 		} );
       
  1088 	inBuf.Release();
       
  1089 	inBuf.Close();	
       
  1090 	
       
  1091     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
  1092 
       
  1093     inPtr.Zero();
       
  1094     outPtr.Zero();
       
  1095     __ALFFXLOGSTRING1("CAlfTransitionServerClient::VerifyConnection - return: %d <<", err);
       
  1096     return err;
       
  1097 	}
       
  1098 	
       
  1099 // ---------------------------------------------------------------------------
       
  1100 // ---------------------------------------------------------------------------
       
  1101 //
       
  1102 TInt CAlfTransitionServerClient::FreeRam()
       
  1103 	{
       
  1104 	__ALFFXLOGSTRING("CAlfTransitionServerClient::FreeRam >>");
       
  1105 	TInt err = KErrNone;
       
  1106 	
       
  1107 	if ( !iHasPlugin )
       
  1108 	    {
       
  1109 	    err = Connect();
       
  1110 	    }
       
  1111 	if ( !iHasPlugin || err != KErrNone )
       
  1112 	    {
       
  1113 	    // if we are started too early we just bail out without doing anything
       
  1114         return err;
       
  1115 	    }
       
  1116 	    
       
  1117 	TPtr8 inPtr = iTransferBuffer->Des();
       
  1118 	inPtr.Zero();
       
  1119 	TPtr8 outPtr = iReturnBuffer->Des();
       
  1120 	outPtr.Zero();
       
  1121 	RDesWriteStream inBuf( inPtr );
       
  1122 	    
       
  1123 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpFreeRam;
       
  1124 	// These writes cannot leave
       
  1125 	TRAP_IGNORE( 
       
  1126 	    {
       
  1127 	    inBuf.WriteInt32L( op );
       
  1128         inBuf.CommitL();		
       
  1129 		} );
       
  1130 	inBuf.Release();
       
  1131 	inBuf.Close();	
       
  1132 	
       
  1133     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
  1134     
       
  1135     // Here the server should actually return something
       
  1136 
       
  1137     inPtr.Zero();
       
  1138     outPtr.Zero();
       
  1139     __ALFFXLOGSTRING1("CAlfTransitionServerClient::FreeRam - return: %d <<", err);
       
  1140     return err;
       
  1141 	}
       
  1142 	
       
  1143 // ---------------------------------------------------------------------------
       
  1144 // ---------------------------------------------------------------------------
       
  1145 //
       
  1146 TInt CAlfTransitionServerClient::MemoryGood()
       
  1147 	{
       
  1148 	__ALFFXLOGSTRING("CAlfTransitionServerClient::MemoryGood >>");
       
  1149 	TInt err = KErrNone;
       
  1150 	
       
  1151 	if ( !iHasPlugin )
       
  1152 	    {
       
  1153 	    err = Connect();
       
  1154 	    }
       
  1155 	if ( !iHasPlugin || err != KErrNone )
       
  1156 	    {
       
  1157 	    // if we are started too early we just bail out without doing anything
       
  1158         return err;
       
  1159 	    }
       
  1160 	    
       
  1161 	TPtr8 inPtr = iTransferBuffer->Des();
       
  1162 	inPtr.Zero();
       
  1163 	TPtr8 outPtr = iReturnBuffer->Des();
       
  1164 	outPtr.Zero();
       
  1165 	RDesWriteStream inBuf( inPtr );
       
  1166 	    
       
  1167 	TInt op = MAlfGfxEffectPlugin::ETfxServerOpMemoryGood;
       
  1168 	// These writes cannot leave
       
  1169 	TRAP_IGNORE( 
       
  1170 	    {
       
  1171 	    inBuf.WriteInt32L( op );
       
  1172         inBuf.CommitL();		
       
  1173 		} );
       
  1174 	inBuf.Release();
       
  1175 	inBuf.Close();	
       
  1176 	
       
  1177     err = iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
       
  1178     
       
  1179     // Here the server should actually return something
       
  1180 
       
  1181     inPtr.Zero();
       
  1182     outPtr.Zero();
       
  1183     __ALFFXLOGSTRING1("CAlfTransitionServerClient::MemoryGood - return: %d <<", err);
       
  1184     return err;
       
  1185 	}
       
  1186 
       
  1187 TInt CAlfTransitionServerClient::FindEffectFile( const TDesC& aResourceDir, const TDesC& aFilename )
       
  1188     {
       
  1189     __ALFFXLOGSTRING2("CAlfTransitionServerClient::FindEffectFile - Dir: %S File: %S>>", &aResourceDir, &aFilename);
       
  1190     // TODO:
       
  1191     // This function allows an alternative drive for finding effect files
       
  1192     // By default the effect files are in ROM
       
  1193     // To make testing easier, the it is allowed to have them on C-drive in the emulator
       
  1194     // or memory card in the phone.
       
  1195     // If the default memory card in the phone is not letter E, this needs to be adjusted.
       
  1196     // When this testing functionality is not needed any more (should not be present in final release builds)
       
  1197     // modify the function so that iParse always contains the original resource directory.
       
  1198 #ifdef __WINS__
       
  1199     _LIT( KOptionalDrive, "C:" );
       
  1200 #else
       
  1201     _LIT( KOptionalDrive, "F:" );
       
  1202 #endif
       
  1203     
       
  1204     TInt err = KErrNone;
       
  1205     iParse.Set( KOptionalDrive, &aResourceDir, &aFilename );
       
  1206     
       
  1207     err = iFile.Open( iFs, iParse.FullName(), EFileRead );
       
  1208     if ( err != KErrNone )
       
  1209         {
       
  1210         iParse.Set( aResourceDir, NULL, NULL );
       
  1211         }
       
  1212     else
       
  1213         {
       
  1214         // close the file if we managed to open it
       
  1215         iFile.Close();
       
  1216         iParse.Set( KOptionalDrive, &aResourceDir, NULL );  
       
  1217         }
       
  1218     
       
  1219     // Now iParse contains the alternative path if the file is found in the alternative
       
  1220     // location, else it contains the original path.
       
  1221     __ALFFXLOGSTRING1("CAlfTransitionServerClient::FindEffectFile - return: %d <<", err);
       
  1222     return err;
       
  1223     }
       
  1224 	
       
  1225 // --- EOF ---
       
  1226