usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/DismountClient.h
branchRCL_3
changeset 92 dde4619868dc
parent 86 703a2b94c06c
child 95 55a3258355ea
equal deleted inserted replaced
86:703a2b94c06c 92:dde4619868dc
     1 /*
       
     2 * Copyright (c) 2010 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef DISMOUNTCLIENT_H
       
    19 #define DISMOUNTCLIENT_H
       
    20 
       
    21 #include <e32base.h>	// For CActive, link against: euser.lib
       
    22 #include <e32std.h>		// For RTimer, link against: euser.lib
       
    23 #include <StifLogger.h>
       
    24 #include <f32file.h>
       
    25 
       
    26 enum TAllowDismountOption
       
    27 {
       
    28     EAllowDismount,
       
    29     EAllowDismountAfter2Sec,
       
    30     EAllowDismountTooLate,
       
    31     ENotAllowDismount
       
    32 };
       
    33 
       
    34 class CDismountClient : public CActive
       
    35     {
       
    36 public:
       
    37     // Cancel and destroy
       
    38     ~CDismountClient();
       
    39 
       
    40     // Two-phased constructor.
       
    41     static CDismountClient* NewL(CStifLogger *aLog);
       
    42 
       
    43     // Two-phased constructor.
       
    44     static CDismountClient* NewLC(CStifLogger *aLog);
       
    45 
       
    46 public:
       
    47     // New functions
       
    48     // Function for making the initial request
       
    49     void StartL(TAllowDismountOption aAllowDismountOption);
       
    50 
       
    51 private:
       
    52     // C++ constructor
       
    53     CDismountClient();
       
    54 
       
    55     // Second-phase constructor
       
    56     void ConstructL(CStifLogger *aLog);
       
    57 
       
    58 private:
       
    59     // From CActive
       
    60     // Handle completion
       
    61     void RunL();
       
    62 
       
    63     // How to cancel me
       
    64     void DoCancel();
       
    65 
       
    66     // Override to handle leaves from RunL(). Default implementation causes
       
    67     // the active scheduler to panic.
       
    68     TInt RunError(TInt aError);
       
    69 
       
    70 private:
       
    71     enum TDismountClientState
       
    72         {
       
    73         EWaitForDelay,
       
    74         EDelay,
       
    75         EUninitialized, // Uninitialized
       
    76         EInitialized, // Initalized
       
    77         EError // Error condition
       
    78         };
       
    79   
       
    80 private:
       
    81     TInt iState; // State of the active object
       
    82     RFs iFs;
       
    83     CStifLogger *iLog;
       
    84     RTimer iTimer;
       
    85     TAllowDismountOption iAllowDismountOption;
       
    86     
       
    87     };
       
    88 
       
    89 #endif // DISMOUNTCLIENT_H