remotestoragefw/remotefileengine/inc/rsfwmountstatemachine.h
branchRCL_3
changeset 19 88ee4cf65e19
parent 16 87c71b25c937
child 20 1aa8c82cb4cb
equal deleted inserted replaced
16:87c71b25c937 19:88ee4cf65e19
     1 /*
       
     2 * Copyright (c) 2005-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:  State machine for mounting
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_RSFW_MOUNTSTATEMACHINE_H
       
    19 #define C_RSFW_MOUNTSTATEMACHINE_H
       
    20 
       
    21 #include <rsfwmountentry.h> // KMaxMountNameLength
       
    22 
       
    23 #include "rsfwwaitnotestatemachine.h"
       
    24 #include "rsfwcontrol.h"
       
    25 #include "rsfwauthenticationdlgrequest.h"
       
    26 
       
    27 class CRsfwVolume;
       
    28 class CRsfwVolumeTable;
       
    29 
       
    30 /**
       
    31  *  State machine for mounting.
       
    32  *
       
    33  *  This state machine assumes that connection awareness is off.
       
    34  *  In "connection awareness" error state for mounting is quite different,
       
    35  *  as failure to connect to the server is not considered to be fatal,
       
    36  *  but instead puts the engine to disconnected mode.
       
    37  *  Feasible strategy is probably to create an alternative initial state
       
    38  *  with a different ErrorL, set if connection awareness is on.
       
    39  *
       
    40  */
       
    41 class CRsfwMountStateMachine : public CRsfwWaitNoteStateMachine
       
    42     {
       
    43 public:
       
    44     static CRsfwMountStateMachine* NewL(TRsfwMountConfig aMountConfig, 
       
    45                                         TInt aMountState,
       
    46                                         CRsfwVolumeTable* aVolumeTable);
       
    47 private:
       
    48     void ConstructL(TRsfwMountConfig aMountConfig, 
       
    49                                         TInt aMountState,
       
    50                                         CRsfwVolumeTable* aVolumeTable);    
       
    51 public:
       
    52     // STATES 
       
    53     // requesting connection state e.g. sending OPTIONS to WebDAV server 
       
    54     class TRequestConnectionState : public CRsfwMountStateMachine::TState
       
    55         {
       
    56     public:
       
    57         TRequestConnectionState(CRsfwMountStateMachine* aOperation);
       
    58         void EnterL();
       
    59         TState* CompleteL();
       
    60         TState* ErrorL(TInt aCode);
       
    61     private:
       
    62         // backpointer to the operation
       
    63         CRsfwMountStateMachine* iOperation;
       
    64         };
       
    65         
       
    66     // dismiss the wait note    
       
    67     class TDismissConnectionWaitNoteState : public CRsfwMountStateMachine::TState
       
    68         {
       
    69     public:
       
    70         TDismissConnectionWaitNoteState(CRsfwMountStateMachine* aOperation);   
       
    71         void EnterL(); 
       
    72         TState* CompleteL();
       
    73         TState* ErrorL(TInt aCode);
       
    74     private:
       
    75         // backpointer to the operation
       
    76         CRsfwMountStateMachine* iOperation;       
       
    77         };    
       
    78     
       
    79     // asynchronously waits for user to type in authentication infomation    
       
    80     class TGetAuthCredentials : public CRsfwMountStateMachine::TState
       
    81         {
       
    82     public:
       
    83         TGetAuthCredentials(CRsfwMountStateMachine* aOperation);
       
    84         void EnterL();
       
    85         TState* CompleteL();
       
    86         TState* ErrorL(TInt aCode);
       
    87     private:
       
    88         // backpointer to the operation
       
    89         CRsfwMountStateMachine* iOperation;
       
    90         TRsfwAuthenticationDlgRequest iAuthRequest;
       
    91         
       
    92         };    
       
    93 
       
    94       // asynchronously waits for "drive unavailabe, retry? query" 
       
    95     class TUnavailableRetry : public CRsfwMountStateMachine::TState
       
    96         {
       
    97     public:
       
    98         TUnavailableRetry(CRsfwMountStateMachine* aOperation);
       
    99         void EnterL();
       
   100         TState* CompleteL();
       
   101         TState* ErrorL(TInt aCode);
       
   102     private:
       
   103         // backpointer to the operation
       
   104         CRsfwMountStateMachine* iOperation;
       
   105         TRsfwNotPluginRequest iRetryRequest;
       
   106         };    
       
   107 
       
   108         
       
   109 public: 
       
   110     CRsfwRfeStateMachine::TState* CompleteRequestL(TInt aError);
       
   111     TState* ErrorOnStateEntry(TInt aError);                                            
       
   112 public:
       
   113     CRsfwVolume* iVolume; // volume to be mounter or recovered
       
   114 
       
   115     // parameters of the operation  
       
   116     // we read from mountconfig a drive letter to be mounted or recovered
       
   117     // currently volumeId is always set by us
       
   118     TRsfwMountConfig iMountConfig;
       
   119     TInt iVolumeId; 
       
   120     TInt iMountState;
       
   121 private:        
       
   122     TBuf<KMaxMountNameLength> iFriendlyName;
       
   123     TBool iRequestingConnection; // flag indicating 'opening connection' event
       
   124     TInt iConnectingError; // remember why the connection attempt failed
       
   125     };
       
   126 
       
   127 
       
   128 #endif // C_RSFW_MOUNTSTATEMACHINE_H