camerauis/cameraapp/generic/inc/cameracontroller/camflashsimulator.h
branchRCL_3
changeset 54 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
53:61bc0f252b2b 54:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 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:  Declaration of CCamFlashSimulator class.
       
    15 *                Simulates flash charging when real implementation
       
    16 *                cannot be used.
       
    17 *
       
    18 */
       
    19 
       
    20 #ifndef CAMFLASHSIMULATOR_H
       
    21 #define CAMFLASHSIMULATOR_H
       
    22 
       
    23 // ===========================================================================
       
    24 // Includes
       
    25 #include <e32base.h>
       
    26 #include "mcamcameraobserver.h"
       
    27 
       
    28 
       
    29 // ===========================================================================
       
    30 // Constants
       
    31 
       
    32 // Duration of simulated flash charging delay 
       
    33 // Value: 10 seconds
       
    34 const TInt KSimulatedChargingTime = 10*1000*1000; // [us]
       
    35 
       
    36 
       
    37 // ===========================================================================
       
    38 // Forward declarations
       
    39 class CCamCameraController;
       
    40 
       
    41 // ===========================================================================
       
    42 // Class declarations
       
    43 
       
    44 /**
       
    45 * Flash simulator class
       
    46 */
       
    47 class CCamFlashSimulator: public CBase,
       
    48                           public MCamCameraObserver
       
    49   {
       
    50   public:
       
    51     
       
    52     /**
       
    53     * Two-phased constructor
       
    54     */
       
    55     static CCamFlashSimulator* NewL( CCamCameraController& aController );
       
    56     
       
    57     /**
       
    58     * Destructor
       
    59     */
       
    60     ~CCamFlashSimulator();
       
    61 
       
    62   public: // From MCamCameraObserver
       
    63   
       
    64     virtual void HandleCameraEventL( TInt              aStatus, 
       
    65                                      TCamCameraEventId aEventId, 
       
    66                                      TAny*             aEventData = NULL );
       
    67 
       
    68   public: // Other
       
    69 
       
    70     /**
       
    71     * Set flash requirement status
       
    72     */
       
    73     void SetFlashRequired( TBool aFlashRequired );   
       
    74     
       
    75     /**
       
    76     * Set flash error state
       
    77     */
       
    78     void SetFlashError( TBool aFlashError );     
       
    79     
       
    80     /**
       
    81     * Start recharging of the flash. In case aError is true,
       
    82     * error flag shall be 
       
    83     * @param aError
       
    84     */       
       
    85     void StartRecharging( TBool aError = EFalse );
       
    86     
       
    87     /**
       
    88     * Is the flash currently being recharged
       
    89     */
       
    90     TBool Recharging();       
       
    91                 
       
    92   private:
       
    93 
       
    94     /**
       
    95     * Notify Camera Controller of flash status
       
    96     */
       
    97     void NotifyController();
       
    98     
       
    99     /**
       
   100     * Callback function for recharging timer
       
   101     * @param aSelf
       
   102     */
       
   103     static TInt RechargeTimerCallback( TAny* aSelf );
       
   104 
       
   105   private: // Constructors
       
   106 
       
   107     /**
       
   108     * C++ default constructor
       
   109     */
       
   110     CCamFlashSimulator( CCamCameraController& aController );
       
   111     
       
   112     /**
       
   113     * Second phase constructor
       
   114     */
       
   115     void ConstructL();
       
   116        
       
   117   private:
       
   118 
       
   119     CCamCameraController& iController;
       
   120     CPeriodic*            iRechargeTimer;
       
   121     TBool                 iError;
       
   122     TBool                 iFlashRequired;
       
   123     TBool                 iFlashReady;
       
   124   };
       
   125 
       
   126 #endif // CAMFLASHSIMULATOR_H
       
   127 
       
   128