os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ECamObserverTest.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ECamObserverTest.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,111 @@
     1.4 +
     1.5 +// ECamObserverTest.cpp
     1.6 +
     1.7 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.8 +// All rights reserved.
     1.9 +// This component and the accompanying materials are made available
    1.10 +// under the terms of "Eclipse Public License v1.0"
    1.11 +// which accompanies this distribution, and is available
    1.12 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.13 +//
    1.14 +// Initial Contributors:
    1.15 +// Nokia Corporation - initial contribution.
    1.16 +//
    1.17 +// Contributors:
    1.18 +//
    1.19 +// Description:
    1.20 +//
    1.21 +
    1.22 +#include <ecam.h>
    1.23 +
    1.24 +#include "ECamObserverTest.h"
    1.25 +
    1.26 +
    1.27 +void RECamObserverTest::HandleEvent(const TECAMEvent& aEvent)
    1.28 +	{
    1.29 +	TBool eventEncapsulation = TECAMEvent2::IsEventEncapsulationValid(aEvent);
    1.30 +	
    1.31 +	if(eventEncapsulation)
    1.32 +		{
    1.33 +		TECAMEvent2 ecamEvent = static_cast<const TECAMEvent2&>(aEvent);
    1.34 +		
    1.35 +		iEventUid = ecamEvent.iEventType;
    1.36 +		iParam	  = ecamEvent.iParam;
    1.37 +		iError	= ecamEvent.iErrorCode;
    1.38 +		return;
    1.39 +		}
    1.40 +		
    1.41 +	iEventUidTwo = iEventUid; 
    1.42 +	iEventUid 	= aEvent.iEventType;
    1.43 +	iError  	= aEvent.iErrorCode;
    1.44 +	}
    1.45 +	
    1.46 +void RECamObserverTest::ViewFinderReady(MCameraBuffer& /*aCameraBuffer*/,TInt aError)
    1.47 +	{
    1.48 +	iError  = aError;
    1.49 +	}
    1.50 +	
    1.51 +void RECamObserverTest::ImageBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt aError)
    1.52 +	{
    1.53 +	iError  = aError;
    1.54 +	}
    1.55 +	
    1.56 +void RECamObserverTest::VideoBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt aError)
    1.57 +	{
    1.58 +	iError  = aError;
    1.59 +	}
    1.60 +	
    1.61 +void RECamObserverTest::CheckNotification(const TUid& aEventUid, TVerdict& aResult)
    1.62 +	{
    1.63 +    INFO_PRINTF4(_L("Expected event %x, received event %x. Error %d."), aEventUid.iUid, iEventUid.iUid, iError); 
    1.64 +	if (aEventUid != iEventUid || iError != KErrNone)
    1.65 +		{
    1.66 +	    aResult = EFail;
    1.67 +	    }	
    1.68 +	}
    1.69 +	
    1.70 +void RECamObserverTest::CheckNotificationTwo(const TUid& aEventUid, TVerdict& aResult)
    1.71 +	{
    1.72 +    INFO_PRINTF4(_L("Expected event %x, received event %x. Error %d."), aEventUid.iUid, iEventUid.iUid, iError); 
    1.73 +    if (aEventUid != iEventUidTwo || iError != KErrNone)
    1.74 +		{
    1.75 +	    aResult = EFail;
    1.76 +	    }	
    1.77 +	}
    1.78 +	
    1.79 +void RECamObserverTest::CheckNotificationNeg(const TUid& aEventUid, TVerdict& aResult)
    1.80 +	{
    1.81 +    INFO_PRINTF4(_L("Expected event %x, received event %x. Error %d."), aEventUid.iUid, iEventUid.iUid, iError); 
    1.82 +	if (aEventUid != iEventUid || iError == KErrNone)
    1.83 +		{
    1.84 +	    aResult = EFail;
    1.85 +	    }
    1.86 +	}
    1.87 +	
    1.88 +void RECamObserverTest::CheckNotificationImgProc(const TUid& aEventUid, TInt aParam, TVerdict& aResult)
    1.89 +	{
    1.90 +    INFO_PRINTF3(_L("Expected event %x, received event %x."), aEventUid.iUid, iEventUid.iUid); 
    1.91 +    INFO_PRINTF3(_L("Expected param %d, received param %d."), aParam, iParam); 
    1.92 +    INFO_PRINTF2(_L("Error %d."), iError); 
    1.93 +	if (aEventUid != iEventUid || aParam != iParam || iError != KErrNone)
    1.94 +		{
    1.95 +	    aResult = EFail;
    1.96 +	    }	
    1.97 +	}
    1.98 +
    1.99 +
   1.100 +
   1.101 +void RECamContinousZoomObserverTest::ContinuousZoomProgress(CCamera::CCameraContinuousZoom& /*aContinuousZoomHandle*/, TInt aZoomFactor, TInt aError)
   1.102 +	{
   1.103 +	INFO_PRINTF3(_L("ContinuousZoomProgress: New zoom factor achieved = %d, error %d"), aZoomFactor, aError);
   1.104 +	}
   1.105 +
   1.106 +void RECamContinousZoomObserverTest::ContinuousZoomCompleted(CCamera::CCameraContinuousZoom& /*aContinuousZoomHandle*/, TInt aFinalZoomFactor, TInt aError)
   1.107 +	{
   1.108 +	INFO_PRINTF3(_L("ContinuousZoomCompleted: Target zoom factor %d reached. Completed with error %d"), aFinalZoomFactor, aError);
   1.109 +	}
   1.110 +
   1.111 +TInt RECamContinousZoomObserverTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
   1.112 +	{
   1.113 +	return KErrNone;
   1.114 +	}