windowing/windowserver/tframerate/wsframerate.cpp
changeset 110 7f25ef56562d
parent 98 bf7481649c98
child 111 29ddb8a72f0e
equal deleted inserted replaced
98:bf7481649c98 110:7f25ef56562d
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test - Test client library used to communicate between framerate plug-in and twsgraphs.
       
    19  @internalComponent - Internal Symbian test code
       
    20 */
       
    21 
       
    22 #include "wsframerate.h"
       
    23 
       
    24 //Constant message handle, which is used to send count value between client and plug-in
       
    25 const TUint8 KCmdCount=0;
       
    26 
       
    27 LOCAL_C const TUid KUidWsGraphicTestFrameRate = {0x1028292A};
       
    28 
       
    29 /**
       
    30 Creates new object of type CGraphicTestFrameRate based on existing plug-in id.
       
    31 This interally constructs CWsGraphic object
       
    32 
       
    33 @param	TUid	Test plug-in id
       
    34 */
       
    35 
       
    36 EXPORT_C CGraphicTestFrameRate* CGraphicTestFrameRate::NewL(TUid aUid)
       
    37 	{
       
    38 	CGraphicTestFrameRate* self = new(ELeave) CGraphicTestFrameRate;
       
    39 	CleanupStack::PushL(self);
       
    40 	self->BaseConstructL(aUid,KUidWsGraphicTestFrameRate,KNullDesC8());
       
    41 	CleanupStack::Pop(self);
       
    42 	return self;
       
    43 	}
       
    44 
       
    45 /**
       
    46 Creates new object of type CGraphicTestFrameRate based on active screen number.
       
    47 This interally constructs CWsGraphic object
       
    48 
       
    49 @param	TInt	Screen number
       
    50 */
       
    51 EXPORT_C CGraphicTestFrameRate* CGraphicTestFrameRate::NewL(TInt aScreen)
       
    52 	{
       
    53 	CGraphicTestFrameRate* self = new(ELeave) CGraphicTestFrameRate;
       
    54 	CleanupStack::PushL(self);
       
    55 	TBuf8<1> data;
       
    56 	data.Append((TUint8)aScreen);
       
    57 	self->BaseConstructL(KUidWsGraphicTestFrameRate,data);
       
    58 	CleanupStack::Pop(self);
       
    59 	return self;
       
    60 	}
       
    61 
       
    62 EXPORT_C CGraphicTestFrameRate::~CGraphicTestFrameRate()
       
    63 	{
       
    64 	}
       
    65 
       
    66 CGraphicTestFrameRate::CGraphicTestFrameRate()
       
    67 	{
       
    68 	}
       
    69 
       
    70 /**
       
    71 Handles message between client and Twsgraphs test call.
       
    72 
       
    73 @param	TDesc8	Descriptor values passed between client and plugin
       
    74 */
       
    75 void CGraphicTestFrameRate::HandleMessage(const TDesC8& aData)
       
    76 	{
       
    77 	if (aData.Size()>1)
       
    78 		{
       
    79 		Mem::Copy(iCount, aData.Ptr(),(aData.Size()));
       
    80 		}
       
    81 	iCallBack.CallBack();
       
    82 	}
       
    83 
       
    84 void CGraphicTestFrameRate::OnReplace()
       
    85 	{
       
    86 	}
       
    87 
       
    88 /**
       
    89 Query a message value from test plug-in.
       
    90 
       
    91 @param	TAnimRate	Drawing count for two animations.
       
    92 */
       
    93 EXPORT_C TInt CGraphicTestFrameRate::QueryPlugin(TAnimRate& aCount)
       
    94 	{
       
    95 	TBuf8<1> cmd;
       
    96 	cmd.Append(KCmdCount);
       
    97 	SendMessage(cmd);
       
    98 	TInt err = Flush();
       
    99 	if (err!=KErrNone)
       
   100 		return err;
       
   101 	iCount=&aCount;
       
   102 	return KErrNone;
       
   103 	}
       
   104 
       
   105 /**
       
   106 Set the callback function
       
   107 
       
   108 @param	TCallBack	Name of the callback function to invoke.
       
   109 */
       
   110 EXPORT_C void CGraphicTestFrameRate::SetCallBack(TCallBack aCallBack)
       
   111 	{
       
   112 	iCallBack = aCallBack;
       
   113 	}