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

# fps.hpp

    00001
    00061 #ifndef FPS_H
    00062    #define FPS_H
    00063
    00064    #include "tcpipconnector.hpp" // class CTCPIPConnector
    00065    #include "commandstring.hpp"  // ADDRESS_TYPE
    00066    #include "addresses.hpp"      // RcvTimeOut
    00067    #include "rcvbuffer.hpp"      // class CRcvBuffer
    00068    #include "convert.hpp"        // class CFpsConvert
    00069    #include "misc.h"             // WaitWithoutHanging ( for external access only )
    00070    #include <string>             // stl class string
    00071    #include <vector>             // stl class vector
    00072    #include <assert.h>           // macro assert
    00073
    00079    struct SENSOR_TYPE
    00080    {
    00081       int open;
    00082       int c;
    00083       int b;
    00084       int a;
    00085       int closed;
    00086    };
    00087
    00092    class Cfps : public CTCPIPConnector
    00093    {
    00094       public:
    00095          Cfps();
    00096          virtual ~Cfps();
    00097
    00099          enum VERBINDUNG
    00100          {
    00101             MODEM,
    00102             NETZWERK,
    00103             RS232
    00104          };
    00105
    00107          enum CONVERT_TO
    00108          {
    00109             SPEC,
    00110             MV,
    00111             MM
    00112          };
    00113
    00114          // exported api functions
    00115
    00120          VERBINDUNG GetCurrentConnectionType( void ) const;
    00121
    00126          void SetCurrentConnectionType( const VERBINDUNG eNewConnectionType );
    00127
    00133          void GetCallnumber( char* pcCallnumber, unsigned int ucBufLen );
    00134
    00139          void SetCallnumber( char* pcNewCallnumber );
    00140
    00167          bool GetOperatingState( int& Flags );
    00168
    00174          bool SetOperatingState( int Flags );
    00175
    00197          bool ReadSensor( SENSOR_TYPE& CurrentSensorValues );
    00198
    00204          bool WriteSensor( SENSOR_TYPE NewSensorValues );
    00205
    00211          bool ReadInterpolatedSensor( SENSOR_TYPE& CurrentSensorValues );
    00212
    00230          bool GetOutOfRangeFlags( int& Flags );
    00231
    00240          bool FetchStuetzArrayFromFps( void );
    00241
    00247          bool StoreStuetzArrayInFps( void );
    00248
    00255          void  GetTolerance( float& fUnterTolerance, float& fUeberTolerance );
    00256
    00263          void SaveTolerance( float fUnterTolerance, float fUeberTolerance );
    00264
    00276          bool GetSensorSamples(  float SenSamp[       640 ], unsigned int uiBegin= 0, unsigned int uiLength= 640 );
    00277
    00289          bool GetVoltageSamples( float VoltageSample[ 640 ], unsigned int uiBegin= 0, unsigned int uiLength= 640 );
    00290
    00302          bool GetPortBSamples(   int   PortBSample[   640 ], unsigned int uiBegin= 0, unsigned int uiLength= 640 );
    00303
    00318          bool GetCurrentSensorValue( float& CurSen, CONVERT_TO eConvertTo= SPEC );
    00319
    00324          bool GetCurrentVoltage( float& CurOperatingVoltage );
    00325
    00331          bool GetCurrentTemperature( float& CurrentTemperature );
    00332
    00356          bool GetPortB( int& Flags );
    00357
    00365          bool StartSampling( void );
    00366
    00372          bool IsSamplingDone( bool& bDone );
    00373
    00380          bool ResetEx( void );
    00381
    00389          bool GetServiceInfo( int& Week, int& Year, int& Serialnumber );
    00390
    00400          bool PasswordLogin( char* szIpAddress, char* szPassword, unsigned int uiBasePort, unsigned int uiPortnumber );
    00401
    00407          void GetCallNumber( char* pcCallNumber, unsigned int uiBufLen );
    00408
    00413          void SetCallNumber( char* pcNewCallNumber );
    00414
    00435          bool InitModem( void );
    00436
    00444          virtual bool initialize( void );
    00445
    00451          void GetModemInitString( char* pcModemInitString, unsigned int BufLen );
    00452
    00458          void SetModemInitString( char* pcNewModemInitString );
    00459
    00466          void GetModemDialString( char* pcModemDialString, unsigned int BufLen );
    00467
    00473          void SetModemDialString( char* pcNewModemDialString );
    00474
    00482          void GetModemOkString( char* pcModemOkString, unsigned int BufLen );
    00483
    00490          void SetModemOkString( char* pcModemOkString );
    00491
    00499          void GetModemConnectString( char* pcModemConnectString, unsigned int BufLen );
    00500
    00507          void SetModemConnectString( char* pcModemConnectString );
    00508
    00513          unsigned int GetModemInitTimeout( void ) const;
    00514
    00519          void SetModemInitTimeout( const unsigned int uiNewTimeOut );
    00520
    00525          unsigned int GetModemDialTimeout( void ) const;
    00526
    00531          void SetModemDialTimeout( const unsigned int uiNewTimeoutValue );
    00532
    00537          void SetTcpIpAddress( char const* pcIpAddress );
    00538
    00544          void GetTcpIpAddress( char* pcIpAddress, SIZE_T BufLen );
    00545
    00550          void SetTcpIpPort( unsigned int uiNewPort );
    00551
    00557          unsigned int GetTcpIpPort( void );
    00558
    00562          void SetBasePort( const unsigned int nBasePort );
    00563
    00567          unsigned int GetBasePort( void ) const;
    00568
    00573          void SetRcvTimeOut( const DWORD dwNewTimeOut );
    00574
    00580          DWORD GetRcvTimeOut( void ) const;
    00581
    00600          void ReadProfileFile( const std::string & sFilename );
    00601
    00606          void ReadProfileFileConnectionType( const std::string & sFilename );
    00607
    00608
    00618          void WriteProfileFile( std::string sFilename );
    00619
    00621          bool FetchData( RECEIVED_TYPE& Command,
    00622                          ADDRESS_TYPE& nAddress,
    00623                          unsigned int& uiLength,
    00624                          std::vector<unsigned char>& aucData );
    00625
    00627          bool StoreData( const RECEIVED_TYPE Command,
    00628                          const ADDRESS_TYPE  nAddress,
    00629                          const unsigned int  uiLength,
    00630                          const std::vector<unsigned char>& aucData= std::vector<unsigned char>::vector() );
    00631
    00643          CFpsConvert m_oConvert;
    00644
    00645       protected:
    00646          // low level routine for communication with the fps device
    00647
    00654          bool ReadFpsEeprom( ADDRESS_TYPE nAddress, unsigned int uiLength );
    00655
    00663          bool ReadFpsProgram( ADDRESS_TYPE nAddress, unsigned int uiLength );
    00664
    00672          bool ReadFpsRam( ADDRESS_TYPE nAddress, unsigned int uiLength );
    00673
    00681          bool WriteFpsEeprom( ADDRESS_TYPE nAddress, unsigned int uiLength, std::vector<unsigned char> aucData );
    00682
    00690          bool WriteFpsProgram( ADDRESS_TYPE nAddress, unsigned int uiLength, std::vector<unsigned char> aucData );
    00691
    00699          bool WriteFpsRam( ADDRESS_TYPE nAddress, unsigned int uiLength,std::vector<unsigned char> aucData );
    00700
    00706          RECEIVED_TYPE WaitForData( void );
    00707
    00708       private:
    00710          CRcvBuffer m_oRcvBuffer;
    00711
    00713          Cfps( const Cfps& NewObject );
    00714
    00716          Cfps& operator= ( const Cfps& OldObject );
    00717
    00722          bool ReadDataPointHeader( void );
    00723
    00728          bool ReadDataPoints( void );
    00729
    00734          bool WriteDataPointHeader( void );
    00735
    00740          bool WriteDataPoints( void );
    00741
    00742          // implementing pure virtual functions for CTCPIPConnector
    00743          // will be called if the corresponding command was received
    00744
    00751          void ReadEepromDataReq( ADDRESS_TYPE nAddress,
    00752                                  unsigned int uiLength );
    00753
    00760          void ReadProgramDataReq( ADDRESS_TYPE nAddress,
    00761                                   unsigned int uiLength );
    00762
    00769          void ReadRamDataReq( ADDRESS_TYPE nAddress,
    00770                               unsigned int uiLength );
    00771
    00778          void WriteEepromDataReq( ADDRESS_TYPE nAddress,
    00779                                   unsigned int uiLength,
    00780                                   const std::vector<unsigned char>& aucData );
    00781
    00788          void WriteProgramDataReq( ADDRESS_TYPE nAddress,
    00789                                    unsigned int uiLength,
    00790                                    const std::vector<unsigned char>& aucData );
    00791
    00796          void WriteRamDataReq( ADDRESS_TYPE nAddress,
    00797                                unsigned int uiLength,
    00798                                const std::vector<unsigned char>& aucData );
    00799
    00804          void ReadEepromDataCnf( ADDRESS_TYPE nAddress,
    00805                                  unsigned int uiLength,
    00806                                  const std::vector<unsigned char>& aucData );
    00807
    00812          void ReadProgramDataCnf( ADDRESS_TYPE nAddress,
    00813                                   unsigned int uiLength,
    00814                                   const std::vector<unsigned char>& aucData );
    00815
    00820          void ReadRamDataCnf( ADDRESS_TYPE nAddress,
    00821                               unsigned int uiLength,
    00822                               const std::vector<unsigned char>& aucData );
    00823
    00828          void WriteEepromDataCnf( ADDRESS_TYPE nAddress,
    00829                                   unsigned int uiLength );
    00830
    00835          void WriteProgramDataCnf( ADDRESS_TYPE nAddress,
    00836                                    unsigned int uiLength );
    00837
    00842          void WriteRamDataCnf( ADDRESS_TYPE nAddress,
    00843                                unsigned int uiLength );
    00844
    00849          void StatusInfo( ADDRESS_TYPE nAddress,
    00850                           unsigned int uiLength,
    00851                           const std::vector<unsigned char>& aucData );
    00852
    00853          // implementing pure virtual functions for CTCPIPConnect
    00854
    00859          void ConnectIndication( void );
    00860
    00865          void DisconnectIndication( void );
    00866
    00871          unsigned int GetMaxRetryCount( void ) const;
    00872
    00877          void SetMaxRetryCount( const unsigned int uiNewRetryCount );
    00878
    00883          unsigned int GetMaxBlockLength( void ) const;
    00884
    00889          void SetMaxBlockLength( unsigned int uiNewMaxBlockLength );
    00890
    00895          void InformAboutNewData( const HANDLE hEvent ) const;
    00896
    00905          bool TestRcvData( RECEIVED_TYPE Command,
    00906                            ADDRESS_TYPE  nAddress,
    00907                            unsigned int  uiLength,
    00908                            std::vector<unsigned char>& aucTestedData );
    00909
    00918          bool Loc_GetRcvData( RECEIVED_TYPE eExpectedRcvType, ADDRESS_TYPE nAddress,
    00919                               unsigned int uiLength, std::vector<unsigned char>& aucBuffer );
    00920
    00926          bool LockFpsReq( void );
    00927
    00933          bool UnlockFpsReq( void );
    00934
    00935          // Eventhandles for signaling received data from network
    00936
    00938          HANDLE m_hRcvEventFpsDataMovement;
    00939
    00941          HANDLE m_hRcvEventConnect;
    00942
    00944          HANDLE m_hRcvEventDisconnect;
    00945
    00947          DWORD m_dwRcvTimeOut;
    00948
    00950          VERBINDUNG m_eNeuVerb;
    00951
    00953          char m_sCallNumber[ 200 ];
    00954
    00956          char m_sTcpIpAddress[ 200 ];
    00957
    00959          unsigned int m_uiTcpIpPort;
    00960
    00962          unsigned int m_uiBasePort;
    00963
    00965          unsigned int m_uiMaxRetry;
    00966
    00968          unsigned int m_uiMaxBlockLength;
    00969
    00971          char m_sModemInitString[ 200 ];
    00972
    00974          char m_sModemDialString[ 200 ];
    00975
    00977          char m_sModemOkString[      200 ];
    00978
    00980          char m_sModemConnectString[ 200 ];
    00981
    00983          int m_uiModemInitTimeout;
    00984
    00986          int m_uiModemDailTimeout;
    00987
    00989          std::vector<unsigned char> m_aucEeprom;
    00990
    00992          std::vector<unsigned char> m_aucProgram;
    00993
    00995          std::vector<unsigned char> m_aucRam;
    00996
    00998          HANDLE m_hBlockRequest;
    00999
    01000    };
    01001 #endif