1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/smassstorage/inc/tstate.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,152 @@
1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __TSTATE_H__
1.20 +#define __TSTATE_H__
1.21 +
1.22 +#include "usbmsshared.h"
1.23 +#include "cpropertywatch.h"
1.24 +
1.25 +class TState
1.26 +{
1.27 +public:
1.28 + TState(int id) : stateId(id) {}
1.29 + virtual ~TState() {}
1.30 +
1.31 + virtual void MoveTo(int aStateId) const = 0;
1.32 + TInt GetStateId() const {return stateId;}
1.33 +
1.34 +private:
1.35 + const TInt stateId;
1.36 +};
1.37 +
1.38 +//////////////////////////////////////////////////////////////
1.39 +
1.40 +class TDisconnected : public TState
1.41 +{
1.42 +public:
1.43 + TDisconnected() : TState(EUsbMsDriveState_Disconnected){}
1.44 + ~TDisconnected(){}
1.45 +
1.46 + void MoveTo(TInt aStateId) const;
1.47 +
1.48 +private:
1.49 + void MoveToConnecting() const;
1.50 + void MoveToConnected() const;
1.51 +};
1.52 +
1.53 +//////////////////////////////////////////////////////////////
1.54 +
1.55 +class TConnecting : public TState
1.56 +{
1.57 +public:
1.58 + TConnecting() : TState(EUsbMsDriveState_Connecting){}
1.59 + ~TConnecting(){}
1.60 +
1.61 + void MoveTo(TInt aStateId) const;
1.62 +
1.63 +private:
1.64 + void MoveToWritten() const;
1.65 +};
1.66 +
1.67 +//////////////////////////////////////////////////////////////
1.68 +
1.69 +class TConnected : public TState
1.70 +{
1.71 +public:
1.72 + TConnected() : TState(EUsbMsDriveState_Connected){}
1.73 + ~TConnected(){}
1.74 +
1.75 + void MoveTo(TInt aStateId) const;
1.76 +
1.77 +private:
1.78 + void MoveToActive() const;
1.79 +};
1.80 +
1.81 +//////////////////////////////////////////////////////////////
1.82 +
1.83 +class TDisconnecting : public TState
1.84 +{
1.85 +public:
1.86 + TDisconnecting() : TState(EUsbMsDriveState_Disconnecting){}
1.87 + ~TDisconnecting(){}
1.88 +
1.89 + void MoveTo(TInt aStateId) const;
1.90 +
1.91 +private:
1.92 + void MoveToDisconnected() const;
1.93 +};
1.94 +
1.95 +//////////////////////////////////////////////////////////////
1.96 +
1.97 +class TActive : public TState
1.98 +{
1.99 +public:
1.100 + TActive() : TState(EUsbMsDriveState_Active){}
1.101 + ~TActive(){}
1.102 +
1.103 + void MoveTo(TInt aStateId) const;
1.104 +
1.105 +private:
1.106 + void MoveToLocked() const;
1.107 + void MoveToDisconnecting() const;
1.108 +};
1.109 +
1.110 +//////////////////////////////////////////////////////////////
1.111 +
1.112 +class TLocked : public TState
1.113 +{
1.114 +public:
1.115 + TLocked() : TState(EUsbMsDriveState_Locked){}
1.116 + ~TLocked(){}
1.117 +
1.118 + void MoveTo(TInt aStateId) const;
1.119 +
1.120 +private:
1.121 + void MoveToDisconnecting() const;
1.122 +};
1.123 +
1.124 +//////////////////////////////////////////////////////////////
1.125 +
1.126 +class TWritten : public TState
1.127 +{
1.128 +public:
1.129 + TWritten() : TState(EUsbMsState_Written){}
1.130 + ~TWritten(){}
1.131 +
1.132 + void MoveTo(TInt aStateId) const;
1.133 +
1.134 +private:
1.135 + void MoveToRead() const;
1.136 +};
1.137 +
1.138 +//////////////////////////////////////////////////////////////
1.139 +
1.140 +class TRead : public TState
1.141 +{
1.142 +public:
1.143 + TRead() : TState(EUsbMsState_Read){}
1.144 + ~TRead(){}
1.145 +
1.146 + void MoveTo(TInt aStateId) const;
1.147 +
1.148 +private:
1.149 + void MoveToDisconnected() const;
1.150 +};
1.151 +
1.152 +#endif // __TSTATE_H__
1.153 +
1.154 +
1.155 +