os/kernelhwsrv/kerneltest/f32test/smassstorage/inc/tstate.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef __TSTATE_H__
sl@0
    17
#define __TSTATE_H__
sl@0
    18
sl@0
    19
#include "usbmsshared.h"
sl@0
    20
#include "cpropertywatch.h"
sl@0
    21
sl@0
    22
class TState
sl@0
    23
{
sl@0
    24
public:
sl@0
    25
    TState(int id) : stateId(id) {}
sl@0
    26
    virtual ~TState() {}
sl@0
    27
    
sl@0
    28
    virtual void MoveTo(int aStateId) const = 0;
sl@0
    29
    TInt GetStateId() const {return stateId;}
sl@0
    30
sl@0
    31
private:
sl@0
    32
    const TInt stateId;
sl@0
    33
};
sl@0
    34
sl@0
    35
//////////////////////////////////////////////////////////////
sl@0
    36
sl@0
    37
class TDisconnected : public TState
sl@0
    38
{
sl@0
    39
public:
sl@0
    40
    TDisconnected() : TState(EUsbMsDriveState_Disconnected){}
sl@0
    41
    ~TDisconnected(){}
sl@0
    42
sl@0
    43
    void MoveTo(TInt aStateId) const;
sl@0
    44
sl@0
    45
private:
sl@0
    46
    void MoveToConnecting() const;
sl@0
    47
    void MoveToConnected() const;
sl@0
    48
};
sl@0
    49
sl@0
    50
//////////////////////////////////////////////////////////////
sl@0
    51
sl@0
    52
class TConnecting : public TState
sl@0
    53
{
sl@0
    54
public:
sl@0
    55
    TConnecting() : TState(EUsbMsDriveState_Connecting){}
sl@0
    56
    ~TConnecting(){}
sl@0
    57
sl@0
    58
    void MoveTo(TInt aStateId) const;
sl@0
    59
sl@0
    60
private:
sl@0
    61
    void MoveToWritten() const;
sl@0
    62
};
sl@0
    63
sl@0
    64
//////////////////////////////////////////////////////////////
sl@0
    65
sl@0
    66
class TConnected : public TState
sl@0
    67
{
sl@0
    68
public:
sl@0
    69
    TConnected() : TState(EUsbMsDriveState_Connected){}
sl@0
    70
    ~TConnected(){}
sl@0
    71
sl@0
    72
    void MoveTo(TInt aStateId) const;
sl@0
    73
sl@0
    74
private:
sl@0
    75
    void MoveToActive() const;
sl@0
    76
};
sl@0
    77
sl@0
    78
//////////////////////////////////////////////////////////////
sl@0
    79
sl@0
    80
class TDisconnecting : public TState
sl@0
    81
{
sl@0
    82
public:
sl@0
    83
    TDisconnecting() : TState(EUsbMsDriveState_Disconnecting){}
sl@0
    84
    ~TDisconnecting(){}
sl@0
    85
sl@0
    86
    void MoveTo(TInt aStateId) const;
sl@0
    87
sl@0
    88
private:
sl@0
    89
    void MoveToDisconnected() const;
sl@0
    90
};
sl@0
    91
sl@0
    92
//////////////////////////////////////////////////////////////
sl@0
    93
sl@0
    94
class TActive : public TState
sl@0
    95
{
sl@0
    96
public:
sl@0
    97
    TActive() : TState(EUsbMsDriveState_Active){}
sl@0
    98
    ~TActive(){}
sl@0
    99
sl@0
   100
    void MoveTo(TInt aStateId) const;
sl@0
   101
    
sl@0
   102
private:
sl@0
   103
    void MoveToLocked() const;
sl@0
   104
    void MoveToDisconnecting() const;
sl@0
   105
};
sl@0
   106
sl@0
   107
//////////////////////////////////////////////////////////////
sl@0
   108
sl@0
   109
class TLocked : public TState
sl@0
   110
{
sl@0
   111
public:
sl@0
   112
    TLocked() : TState(EUsbMsDriveState_Locked){}
sl@0
   113
    ~TLocked(){}
sl@0
   114
sl@0
   115
    void MoveTo(TInt aStateId) const;
sl@0
   116
sl@0
   117
private:
sl@0
   118
    void MoveToDisconnecting() const;
sl@0
   119
};
sl@0
   120
sl@0
   121
//////////////////////////////////////////////////////////////
sl@0
   122
sl@0
   123
class TWritten : public TState
sl@0
   124
{
sl@0
   125
public:
sl@0
   126
    TWritten() : TState(EUsbMsState_Written){}
sl@0
   127
    ~TWritten(){}
sl@0
   128
sl@0
   129
    void MoveTo(TInt aStateId) const;
sl@0
   130
sl@0
   131
private:
sl@0
   132
    void MoveToRead() const;
sl@0
   133
};
sl@0
   134
sl@0
   135
//////////////////////////////////////////////////////////////
sl@0
   136
sl@0
   137
class TRead : public TState
sl@0
   138
{
sl@0
   139
public:
sl@0
   140
    TRead() : TState(EUsbMsState_Read){}
sl@0
   141
    ~TRead(){}
sl@0
   142
sl@0
   143
    void MoveTo(TInt aStateId) const;
sl@0
   144
sl@0
   145
private:
sl@0
   146
    void MoveToDisconnected() const;
sl@0
   147
};
sl@0
   148
sl@0
   149
#endif // __TSTATE_H__    
sl@0
   150
   
sl@0
   151
sl@0
   152