Hauptseite | Klassenhierarchie | Alphabetische Liste | Auflistung der Klassen | Auflistung der Dateien | Klassen-Elemente

# statemaschine.hpp

    00001
    00035 #ifndef STATEMASCHINE_H
    00036    #define STATEMASCHINE_H
    00037
    00038    #pragma warning(disable:4786)
    00039
    00040    #include <set>
    00041    #include <map>
    00042
    00047    class CStatemaschine
    00048    {
    00049       public:
    00051          enum STATE
    00052          {
    00053             IDLE,
    00054             WAIT_COMMAND,
    00055             WAIT_ADDRESS,
    00056             WAIT_LENGTH,
    00057             WAIT_DATA,
    00058             WAIT_ETX,
    00059             WAIT_CRC
    00060          };
    00061
    00063          CStatemaschine();
    00064
    00066          virtual ~CStatemaschine() {};
    00067
    00068          // Input
    00075          bool  Input( const unsigned char ucInput );
    00076
    00077          // GetCurrentState
    00082          STATE GetCurrentState( void ) const;
    00083
    00084          // SetCurrentState
    00089          void  SetCurrentState( const STATE );
    00090
    00091          // IsCompleted
    00096          bool  IsCompleted( void ) const;
    00097       protected:
    00098       private:
    00104          bool StateIdle( unsigned char ucInput );
    00105
    00111          bool StateWaitCommand( unsigned char ucInput );
    00112
    00118          bool StateWaitAddress( unsigned char ucInput );
    00119
    00125          bool StateWaitLength(  unsigned char ucInput );
    00126
    00132          bool StateWaitData(    unsigned char ucInput );
    00133
    00139          bool StateWaitEtx(     unsigned char ucInput );
    00140
    00146          bool StateWaitCrc(     unsigned char ucInput );
    00147
    00148          STATE m_CurrentState;
    00149          bool  m_bFinished;
    00150          bool  m_bDatasegmentUsed;
    00151
    00152
    00153          unsigned int m_nCurrentByteOfAddress;
    00154          unsigned int m_nDatalength;
    00155          unsigned int m_nCurrentData;
    00156          unsigned int m_nCurrentByteOfCrc;
    00157
    00159          std::set<unsigned int> CmdWithOutDataSegements;
    00160
    00162          std::set<unsigned int> CmdWithDataSegements;
    00163    };
    00164
    00165 #endif