camappengine/StillConverter/Src/CaeStillConverter.cpp
changeset 15 50d5061ee01e
parent 14 34024902876b
child 17 880d946921e4
equal deleted inserted replaced
14:34024902876b 15:50d5061ee01e
     1 /*
       
     2 * Copyright (c) 2002-2006 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:  Still Image Converter base class for Camera Application Engine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <eikenv.h>
       
    22 
       
    23 #include "CaeStillConverter.h"
       
    24 
       
    25 #ifdef CAE_TEST_VERSION
       
    26 #include "CaeStillConverterTestErrors.h"
       
    27 #endif
       
    28 
       
    29 // CONSTANTS
       
    30 const TInt KImageQueueGranularity = 6;
       
    31 
       
    32 
       
    33 
       
    34 // ================= MEMBER FUNCTIONS =======================
       
    35 
       
    36 
       
    37 // ---------------------------------------------------------
       
    38 // CCaeStillConverter::~CCaeStillConverter
       
    39 // Destructor.
       
    40 // ---------------------------------------------------------
       
    41 //
       
    42 CCaeStillConverter::~CCaeStillConverter()
       
    43     {
       
    44     if ( iImageQueue )
       
    45         {
       
    46         iImageQueue->ResetAndDestroy();
       
    47         delete iImageQueue;
       
    48         }
       
    49 
       
    50     // For RTRT code coverage analysis.
       
    51     // #pragma attol insert _ATCPQ_DUMP(0);
       
    52     }
       
    53 
       
    54 
       
    55 // ---------------------------------------------------------
       
    56 // CCaeStillConverter::RunL
       
    57 // Handles an active object’s request completion event.
       
    58 // ---------------------------------------------------------
       
    59 //
       
    60 void CCaeStillConverter::RunL()
       
    61     {
       
    62     switch ( iState )
       
    63         {
       
    64         case EIdle:
       
    65             break;
       
    66 
       
    67         case EConvert:
       
    68             {
       
    69             ConversionComplete( iStatus.Int() );
       
    70 
       
    71             // Start the next image conversion
       
    72             if ( iImageQueue->Count() > 0 )
       
    73                 {
       
    74                 TRAPD( error, ConvertL() );
       
    75                 if ( error != KErrNone )
       
    76                     {
       
    77                     ConversionComplete( error );
       
    78                     }
       
    79                 }
       
    80             }
       
    81             break;
       
    82 
       
    83         default:
       
    84             break;
       
    85         }
       
    86     }
       
    87 
       
    88 
       
    89 // ---------------------------------------------------------
       
    90 // CCaeStillConverter::RunError
       
    91 // From CActive, handles the leaving RunL().
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 TInt CCaeStillConverter::RunError( TInt aError )
       
    95     {
       
    96     ConversionComplete( aError );
       
    97     return KErrNone;
       
    98     }
       
    99 
       
   100 
       
   101 // ---------------------------------------------------------
       
   102 // CCaeStillConverter::CCaeStillConverter
       
   103 // Default constructor. 
       
   104 // This can NOT leave.
       
   105 // ---------------------------------------------------------
       
   106 //
       
   107 CCaeStillConverter::CCaeStillConverter() :
       
   108 CActive( EPriorityStandard ),
       
   109 iState( EIdle )
       
   110     {
       
   111     }
       
   112 
       
   113 
       
   114 // ---------------------------------------------------------
       
   115 // CCaeStillConverter::ConstructL
       
   116 // Symbian 2nd phase constructor that can leave.
       
   117 // ---------------------------------------------------------
       
   118 //
       
   119 void CCaeStillConverter::ConstructL()
       
   120     {
       
   121     iImageQueue = new( ELeave ) RPointerArray<CImageItem>( KImageQueueGranularity );
       
   122     }
       
   123 
       
   124 
       
   125 // ---------------------------------------------------------
       
   126 // CCaeStillConverter::IsBusy
       
   127 // Returns ETrue if Still Converter is busy.
       
   128 // ---------------------------------------------------------
       
   129 //
       
   130 TBool CCaeStillConverter::IsBusy() const
       
   131     {
       
   132     return ( iState != EIdle );
       
   133     }
       
   134 
       
   135 
       
   136 //  End of File