os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ECamObserverTest.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
sl@0
     2
// ECamObserverTest.cpp
sl@0
     3
sl@0
     4
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     5
// All rights reserved.
sl@0
     6
// This component and the accompanying materials are made available
sl@0
     7
// under the terms of "Eclipse Public License v1.0"
sl@0
     8
// which accompanies this distribution, and is available
sl@0
     9
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
    10
//
sl@0
    11
// Initial Contributors:
sl@0
    12
// Nokia Corporation - initial contribution.
sl@0
    13
//
sl@0
    14
// Contributors:
sl@0
    15
//
sl@0
    16
// Description:
sl@0
    17
//
sl@0
    18
sl@0
    19
#include <ecam.h>
sl@0
    20
sl@0
    21
#include "ECamObserverTest.h"
sl@0
    22
sl@0
    23
sl@0
    24
void RECamObserverTest::HandleEvent(const TECAMEvent& aEvent)
sl@0
    25
	{
sl@0
    26
	TBool eventEncapsulation = TECAMEvent2::IsEventEncapsulationValid(aEvent);
sl@0
    27
	
sl@0
    28
	if(eventEncapsulation)
sl@0
    29
		{
sl@0
    30
		TECAMEvent2 ecamEvent = static_cast<const TECAMEvent2&>(aEvent);
sl@0
    31
		
sl@0
    32
		iEventUid = ecamEvent.iEventType;
sl@0
    33
		iParam	  = ecamEvent.iParam;
sl@0
    34
		iError	= ecamEvent.iErrorCode;
sl@0
    35
		return;
sl@0
    36
		}
sl@0
    37
		
sl@0
    38
	iEventUidTwo = iEventUid; 
sl@0
    39
	iEventUid 	= aEvent.iEventType;
sl@0
    40
	iError  	= aEvent.iErrorCode;
sl@0
    41
	}
sl@0
    42
	
sl@0
    43
void RECamObserverTest::ViewFinderReady(MCameraBuffer& /*aCameraBuffer*/,TInt aError)
sl@0
    44
	{
sl@0
    45
	iError  = aError;
sl@0
    46
	}
sl@0
    47
	
sl@0
    48
void RECamObserverTest::ImageBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt aError)
sl@0
    49
	{
sl@0
    50
	iError  = aError;
sl@0
    51
	}
sl@0
    52
	
sl@0
    53
void RECamObserverTest::VideoBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt aError)
sl@0
    54
	{
sl@0
    55
	iError  = aError;
sl@0
    56
	}
sl@0
    57
	
sl@0
    58
void RECamObserverTest::CheckNotification(const TUid& aEventUid, TVerdict& aResult)
sl@0
    59
	{
sl@0
    60
    INFO_PRINTF4(_L("Expected event %x, received event %x. Error %d."), aEventUid.iUid, iEventUid.iUid, iError); 
sl@0
    61
	if (aEventUid != iEventUid || iError != KErrNone)
sl@0
    62
		{
sl@0
    63
	    aResult = EFail;
sl@0
    64
	    }	
sl@0
    65
	}
sl@0
    66
	
sl@0
    67
void RECamObserverTest::CheckNotificationTwo(const TUid& aEventUid, TVerdict& aResult)
sl@0
    68
	{
sl@0
    69
    INFO_PRINTF4(_L("Expected event %x, received event %x. Error %d."), aEventUid.iUid, iEventUid.iUid, iError); 
sl@0
    70
    if (aEventUid != iEventUidTwo || iError != KErrNone)
sl@0
    71
		{
sl@0
    72
	    aResult = EFail;
sl@0
    73
	    }	
sl@0
    74
	}
sl@0
    75
	
sl@0
    76
void RECamObserverTest::CheckNotificationNeg(const TUid& aEventUid, TVerdict& aResult)
sl@0
    77
	{
sl@0
    78
    INFO_PRINTF4(_L("Expected event %x, received event %x. Error %d."), aEventUid.iUid, iEventUid.iUid, iError); 
sl@0
    79
	if (aEventUid != iEventUid || iError == KErrNone)
sl@0
    80
		{
sl@0
    81
	    aResult = EFail;
sl@0
    82
	    }
sl@0
    83
	}
sl@0
    84
	
sl@0
    85
void RECamObserverTest::CheckNotificationImgProc(const TUid& aEventUid, TInt aParam, TVerdict& aResult)
sl@0
    86
	{
sl@0
    87
    INFO_PRINTF3(_L("Expected event %x, received event %x."), aEventUid.iUid, iEventUid.iUid); 
sl@0
    88
    INFO_PRINTF3(_L("Expected param %d, received param %d."), aParam, iParam); 
sl@0
    89
    INFO_PRINTF2(_L("Error %d."), iError); 
sl@0
    90
	if (aEventUid != iEventUid || aParam != iParam || iError != KErrNone)
sl@0
    91
		{
sl@0
    92
	    aResult = EFail;
sl@0
    93
	    }	
sl@0
    94
	}
sl@0
    95
sl@0
    96
sl@0
    97
sl@0
    98
void RECamContinousZoomObserverTest::ContinuousZoomProgress(CCamera::CCameraContinuousZoom& /*aContinuousZoomHandle*/, TInt aZoomFactor, TInt aError)
sl@0
    99
	{
sl@0
   100
	INFO_PRINTF3(_L("ContinuousZoomProgress: New zoom factor achieved = %d, error %d"), aZoomFactor, aError);
sl@0
   101
	}
sl@0
   102
sl@0
   103
void RECamContinousZoomObserverTest::ContinuousZoomCompleted(CCamera::CCameraContinuousZoom& /*aContinuousZoomHandle*/, TInt aFinalZoomFactor, TInt aError)
sl@0
   104
	{
sl@0
   105
	INFO_PRINTF3(_L("ContinuousZoomCompleted: Target zoom factor %d reached. Completed with error %d"), aFinalZoomFactor, aError);
sl@0
   106
	}
sl@0
   107
sl@0
   108
TInt RECamContinousZoomObserverTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
sl@0
   109
	{
sl@0
   110
	return KErrNone;
sl@0
   111
	}