ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/src/cpbevent.cpp
branchGCC_SURGE
changeset 25 59ea2209bb67
parent 23 08cc4cc059d4
parent 15 a92d00fca574
equal deleted inserted replaced
23:08cc4cc059d4 25:59ea2209bb67
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Contains the CPBConnect class definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <pictbridge.h>
       
    21 
       
    22 #include "cpbevent.h"
       
    23 #include "mpbobserver.h"
       
    24 #include "clog.h"
       
    25 
       
    26 CPBEvent* CPBEvent::NewL( CDpsEngine& aEngine, MPBObserver& aObserver )
       
    27     {
       
    28     LOG("CPBEvent::NewL begin");
       
    29     CPBEvent* self = new (ELeave) CPBEvent(aEngine, aObserver);
       
    30     CleanupStack::PushL(self);
       
    31     self->ConstructL();
       
    32     CleanupStack::Pop();	// self
       
    33     LOG("CPBEvent::NewL end");
       
    34     return self;
       
    35     }
       
    36     
       
    37 CPBEvent::CPBEvent( CDpsEngine& aEngine, MPBObserver& aObserver) :
       
    38 CActive( CActive::EPriorityStandard ), iDpsEngine( aEngine ), iObserver( aObserver )
       
    39     {
       
    40     LOG("CPBEvent::CPBEvent begin");
       
    41     CActiveScheduler::Add(this);
       
    42     LOG("CPBEvent::CPBEvent end");
       
    43     }
       
    44     
       
    45 CPBEvent::~CPBEvent()
       
    46     {
       
    47     LOG("CPBEvent::~CPBEvent begin");
       
    48     Cancel();
       
    49     LOG("CPBEvent::~CPBEvent end");
       
    50     }
       
    51 
       
    52 void CPBEvent::ConstructL()
       
    53     {
       
    54     LOG("CPBEvent::ConstructL begin");
       
    55     LOG("CPBEvent::ConstructL end");
       
    56     }
       
    57     
       
    58 void CPBEvent::Listen()
       
    59     {
       
    60     LOG("CPBEvent::Listen begin");
       
    61     if ( !IsActive() )
       
    62         {
       
    63         iDpsEngine.DpsEventNotify( iEvent, iStatus );
       
    64         SetActive();
       
    65         }    
       
    66 	LOG("CPBEvent::Listen end");
       
    67     }
       
    68     
       
    69 void CPBEvent::RunL()
       
    70     {
       
    71     LOG2("CPBEvent::RunL begin, status %d event %d", iStatus.Int(), iEvent.iEvent );
       
    72     if (iEvent.iEvent == EDpsEvtNotifyJobStatus)
       
    73         {
       
    74         iObserver.JobNotify( iEvent.iJobEvent );
       
    75         }
       
    76     else if (iEvent.iEvent == EDpsEvtNotifyDeviceStatus)
       
    77         {
       
    78         iObserver.PrinterNotify( iEvent.iPrinterEvent );
       
    79         }
       
    80     Listen();
       
    81     LOG("CPBEvent::RunL end");
       
    82     }
       
    83     
       
    84 void CPBEvent::DoCancel()
       
    85     {
       
    86     LOG("CPBEvent::DoCancel begin");
       
    87     iDpsEngine.CancelDpsEventNotify();
       
    88     LOG("CPBEvent::DoCancel end");
       
    89     }
       
    90 
       
    91 //  End of File