vtprotocolplugins/VideoSource/src/cactivewait.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Video Source subsystem.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cactivewait.h"
       
    21 
       
    22 const TInt KFirstFrameIndx = 0;
       
    23 
       
    24 // MACROS
       
    25 
       
    26 #ifdef _DEBUG
       
    27 #    define __IF_DEBUG(t) {RDebug::t;}
       
    28 #else
       
    29 #    define __IF_DEBUG(t)
       
    30 #endif
       
    31 
       
    32 // ============================ CVSActiveWait ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CVSActiveWait::~CVSActiveWait()
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 template <class R>
       
    39 CVSActiveWait< R >::~CVSActiveWait()
       
    40     {
       
    41     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() >>"), RThread().Id().operator TUint()));
       
    42     Cancel();
       
    43     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() <<"), RThread().Id().operator TUint()));
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CVSActiveWait::RequestStatus()
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 template <class R>
       
    51 TRequestStatus* CVSActiveWait< R >::RequestStatus()
       
    52     {
       
    53     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() >>"), RThread().Id().operator TUint()));
       
    54     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() <<"), RThread().Id().operator TUint()));
       
    55     return &iStatus;
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CVSActiveWait::Signal( TInt aError )
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 template <class R>
       
    63 void CVSActiveWait< R >::Signal( TInt aError )
       
    64     {
       
    65     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() >>"), RThread().Id().operator TUint()));
       
    66     if( IsActive() )
       
    67         {
       
    68         TRequestStatus* status = &iStatus;
       
    69         User::RequestComplete( status, aError );
       
    70         }
       
    71     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() <<"), RThread().Id().operator TUint()));
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CVSActiveWait::RunL()
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 template <class R>
       
    79 void CVSActiveWait< R >::RunL()
       
    80     {
       
    81     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() >>"), RThread().Id().operator TUint()));
       
    82     (iRequester->*iCallback)( iStatus.Int() );
       
    83     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() <<"), RThread().Id().operator TUint()));
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CVSActiveWait::DoCancel()
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 template <class R>
       
    91 void CVSActiveWait< R >::DoCancel()
       
    92     {
       
    93     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() >>"), RThread().Id().operator TUint()));
       
    94     TRequestStatus* pStatus = &iStatus;
       
    95     User::RequestComplete( pStatus, KErrCancel );
       
    96     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() <<"), RThread().Id().operator TUint()));
       
    97     }
       
    98     
       
    99