diff -r 5b2a402e96ac -r 25fce757be94 usbclasses/pictbridgeengine/src/dpsconnectnotifier.cpp --- a/usbclasses/pictbridgeengine/src/dpsconnectnotifier.cpp Thu Aug 19 10:54:11 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* Copyright (c) 2006, 2007 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 class implements functions of the notification of the -* PTP printer connction and disconnection. -* -*/ - - -#include -#include "dpsconnectnotifier.h" -#include "dpsusbnotifier.h" - -#ifdef _DEBUG -# define IF_DEBUG(t) {RDebug::t;} -#else -# define IF_DEBUG(t) -#endif - -const TUint KUsbAllStates = 0xFFFFFFFF; - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CDpsConnectNotifier* CDpsConnectNotifier::NewL(CDpsUsbNotifier* aParent) - { - IF_DEBUG(Print(_L("CDpsConnectNotifier::NewL"))); - CDpsConnectNotifier* self = new(ELeave) CDpsConnectNotifier(aParent); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CDpsConnectNotifier::CDpsConnectNotifier(CDpsUsbNotifier* aParent) : - CActive(EPriorityNormal), iNotifier(aParent) - { - IF_DEBUG(Print(_L(">>>CDpsConnectNotifier::Ctor"))); - CActiveScheduler::Add(this); - IF_DEBUG(Print(_L("<<>>CDpsConnectNotifier::~"))); - Cancel(); - IF_DEBUG(Print(_L("<<>>CDpsConnectNotifier::ConnectNotify"))); - if (!IsActive()) - { - iNotifier->iUsbM.DeviceStateNotification(KUsbAllStates, - iNotifier->iConnectState, - iStatus); - SetActive(); - } - IF_DEBUG(Print(_L("<<>>CDpsConnectNotifier::RunL %x"), iNotifier->iConnectState)); - if (KErrNone == iStatus.Int()) - { - - // notify connect (by set personality) - if (iNotifier->iConnectState == EUsbDeviceStateConfigured && - !iNotifier->iConfigured) - { - iNotifier->PtpNotify(KErrNone); - } - // Notify disconnect on cable disconnection and for compatible printer - // also when other device state than configured or suspended is entered. - else if ( (iNotifier->iConnectState == EUsbDeviceStateUndefined) || - ( iNotifier->IsConfigured() && - (iNotifier->iConnectState != EUsbDeviceStateConfigured) && - (iNotifier->iConnectState != EUsbDeviceStateSuspended) ) ) - { - iNotifier->DisconnectNotify(iNotifier->iConnectState); - } - else // not the state we are interested, keep on listening - { - iNotifier->iUsbM.DeviceStateNotification(KUsbAllStates, - iNotifier->iConnectState, - iStatus); - SetActive(); - } - - } - else - { - IF_DEBUG(Print(_L("\tthe iStatus is wrong!!!"))); - } - IF_DEBUG(Print(_L("<<>>CDpsConnectNotifier::DoCancel"))); - iNotifier->iUsbM.DeviceStateNotificationCancel(); - IF_DEBUG(Print(_L("<<