sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __TSTATE_H__ sl@0: #define __TSTATE_H__ sl@0: sl@0: #include "usbmsshared.h" sl@0: #include "cpropertywatch.h" sl@0: sl@0: class TState sl@0: { sl@0: public: sl@0: TState(int id) : stateId(id) {} sl@0: virtual ~TState() {} sl@0: sl@0: virtual void MoveTo(int aStateId) const = 0; sl@0: TInt GetStateId() const {return stateId;} sl@0: sl@0: private: sl@0: const TInt stateId; sl@0: }; sl@0: sl@0: ////////////////////////////////////////////////////////////// sl@0: sl@0: class TDisconnected : public TState sl@0: { sl@0: public: sl@0: TDisconnected() : TState(EUsbMsDriveState_Disconnected){} sl@0: ~TDisconnected(){} sl@0: sl@0: void MoveTo(TInt aStateId) const; sl@0: sl@0: private: sl@0: void MoveToConnecting() const; sl@0: void MoveToConnected() const; sl@0: }; sl@0: sl@0: ////////////////////////////////////////////////////////////// sl@0: sl@0: class TConnecting : public TState sl@0: { sl@0: public: sl@0: TConnecting() : TState(EUsbMsDriveState_Connecting){} sl@0: ~TConnecting(){} sl@0: sl@0: void MoveTo(TInt aStateId) const; sl@0: sl@0: private: sl@0: void MoveToWritten() const; sl@0: }; sl@0: sl@0: ////////////////////////////////////////////////////////////// sl@0: sl@0: class TConnected : public TState sl@0: { sl@0: public: sl@0: TConnected() : TState(EUsbMsDriveState_Connected){} sl@0: ~TConnected(){} sl@0: sl@0: void MoveTo(TInt aStateId) const; sl@0: sl@0: private: sl@0: void MoveToActive() const; sl@0: }; sl@0: sl@0: ////////////////////////////////////////////////////////////// sl@0: sl@0: class TDisconnecting : public TState sl@0: { sl@0: public: sl@0: TDisconnecting() : TState(EUsbMsDriveState_Disconnecting){} sl@0: ~TDisconnecting(){} sl@0: sl@0: void MoveTo(TInt aStateId) const; sl@0: sl@0: private: sl@0: void MoveToDisconnected() const; sl@0: }; sl@0: sl@0: ////////////////////////////////////////////////////////////// sl@0: sl@0: class TActive : public TState sl@0: { sl@0: public: sl@0: TActive() : TState(EUsbMsDriveState_Active){} sl@0: ~TActive(){} sl@0: sl@0: void MoveTo(TInt aStateId) const; sl@0: sl@0: private: sl@0: void MoveToLocked() const; sl@0: void MoveToDisconnecting() const; sl@0: }; sl@0: sl@0: ////////////////////////////////////////////////////////////// sl@0: sl@0: class TLocked : public TState sl@0: { sl@0: public: sl@0: TLocked() : TState(EUsbMsDriveState_Locked){} sl@0: ~TLocked(){} sl@0: sl@0: void MoveTo(TInt aStateId) const; sl@0: sl@0: private: sl@0: void MoveToDisconnecting() const; sl@0: }; sl@0: sl@0: ////////////////////////////////////////////////////////////// sl@0: sl@0: class TWritten : public TState sl@0: { sl@0: public: sl@0: TWritten() : TState(EUsbMsState_Written){} sl@0: ~TWritten(){} sl@0: sl@0: void MoveTo(TInt aStateId) const; sl@0: sl@0: private: sl@0: void MoveToRead() const; sl@0: }; sl@0: sl@0: ////////////////////////////////////////////////////////////// sl@0: sl@0: class TRead : public TState sl@0: { sl@0: public: sl@0: TRead() : TState(EUsbMsState_Read){} sl@0: ~TRead(){} sl@0: sl@0: void MoveTo(TInt aStateId) const; sl@0: sl@0: private: sl@0: void MoveToDisconnected() const; sl@0: }; sl@0: sl@0: #endif // __TSTATE_H__ sl@0: sl@0: sl@0: