uiacceltk/hitchcock/Client/src/alfdirectclient.cpp
changeset 0 15bf7259bb7c
child 8 10534483575f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/Client/src/alfdirectclient.cpp	Tue Feb 02 07:56:43 2010 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   This direct client to alf server, that does not require Alf 
+*                environment.
+*                
+*/
+
+
+#include <alf/alfdirectclient.h>
+#include <alf/alfconstants.h>
+
+// ---------------------------------------------------------------------------
+// Send synchronous command
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RAlfDirectClient::MeasureFPS( TInt32 aId, TBool aStart )
+    {
+    if (!Handle())
+        {
+        TRAPD(err, OpenL());
+        if (err)
+            {
+            return;
+            }
+        }
+    TInt command = EAlfDirectClientFPSCounterOn;
+    if ( !aStart )
+        {
+        command = EAlfDirectClientFPSCounterOff;
+        }
+    Send( command, TIpcArgs(aId));
+    }
+
+EXPORT_C void RAlfDirectClient::EnableLowMemoryState( TBool aMode )
+    {
+    if (!Handle())
+        {
+        TRAPD(err, OpenL());
+        if (err)
+            {
+            return;
+            }
+        }
+    SendReceive(EAlfEnableLowMemoryState, TIpcArgs(aMode));
+    }
+
+EXPORT_C TInt RAlfDirectClient::ForceSwRendering( TBool aEnabled )
+    {
+    if (!Handle())
+        {
+        TRAPD(err, OpenL());
+        if (err)
+            {
+            return err;
+            }
+        }
+    return SendReceive(EAlfForceSwRendering, TIpcArgs(aEnabled));
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RAlfDirectClient::RAlfDirectClient()
+    : RAlfClientBase(KAlfServiceUid.iUid) 
+    {
+    // elegant SW design, right
+	TRAP_IGNORE(OpenL());
+    }
+
+// ---------------------------------------------------------------------------
+// "destructor"
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void RAlfDirectClient::Disconnect()
+    {
+    if (Handle())	
+    	     {
+    	     Close();
+    		   }
+    
+    }