diff -r f87e8c4ac026 -r 3eb824b18d67 videoplayback/videohelix/src/mpxcalldetector.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/videohelix/src/mpxcalldetector.cpp Wed Sep 15 12:15:24 2010 +0300 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2010 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: +* +*/ + +// Version : %version: 1 % + +// INCLUDE FILES +#include + +#include "mpxcalldetector.h" +#include "mpxvideo_debug.h" + + +// --------------------------------------------------------------------------- +// CCallDetector::NewL +// +// --------------------------------------------------------------------------- +// +CMPXCallDetector* CMPXCallDetector::NewL( MMPXCallDetectorObserver* aObserver ) +{ + MPX_ENTER_EXIT(_L("CMPXCallDetector::NewL()")); + + CMPXCallDetector* self = new( ELeave ) CMPXCallDetector( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; +} + +// --------------------------------------------------------------------------- +// Destructor +// +// --------------------------------------------------------------------------- +// +CMPXCallDetector::~CMPXCallDetector() +{ + Cancel(); + iTsyProperty.Close(); +} + +// --------------------------------------------------------------------------- +// CCallDetector::RequestNotification +// +// --------------------------------------------------------------------------- +// +void CMPXCallDetector::RequestNotification() +{ + MPX_ENTER_EXIT(_L("CCallDetector::RequestNotification()")); + + iTsyProperty.Subscribe( iStatus ); + SetActive(); +} + +// --------------------------------------------------------------------------- +// Constructor +// +// --------------------------------------------------------------------------- +// +CMPXCallDetector::CMPXCallDetector( MMPXCallDetectorObserver* aObserver ) + : CActive( EPriorityStandard ), iObserver( aObserver ) +{ +} + +// --------------------------------------------------------------------------- +// CCallDetector::ConstructL +// +// --------------------------------------------------------------------------- +// +void CMPXCallDetector::ConstructL() +{ + MPX_ENTER_EXIT(_L("CCallDetector::ConstructL")); + + User::LeaveIfError( iTsyProperty.Attach( KPSUidCtsyCallInformation, KCTsyCallState ) ); + + CActiveScheduler::Add( this ); +} + +// --------------------------------------------------------------------------- +// CCallDetector::RunL +// Called when the voice line status changes. +// --------------------------------------------------------------------------- +// +void CMPXCallDetector::RunL() +{ + TInt status = iStatus.Int(); + + RequestNotification(); + + if ( status == KErrNone ) + { + TInt status; + iTsyProperty.Get( status ); + + if ( status != EPSCTsyCallStateNone ) + { + iObserver->CallDetectedL(); + } + } +} + +// --------------------------------------------------------------------------- +// CCallDetector::DoCancel +// +// --------------------------------------------------------------------------- +// +void CMPXCallDetector::DoCancel() +{ + iTsyProperty.Cancel(); +} + +// End of File