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

# tcpipconnector.hpp

    00001
    00049 #ifndef TCPIPCONNECTOR_H
    00050    #define TCPIPCONNECTOR_H
    00051
    00052    #include "tcpipcomm.h"
    00053    #include "commandstring.hpp"
    00054    #include "statemaschine.hpp"
    00055    #include <vector>
    00056
    00057    class CCOMConnector;
    00058
    00060    const long MAXRECVBUFFERLEN = 256 + 8;
    00061
    00116    class CTCPIPConnector : public CTCPIPComm
    00117    {
    00118       public:
    00119           friend class CCOMConnector;
    00120
    00121          CTCPIPConnector();
    00122          virtual ~CTCPIPConnector();
    00123
    00129          virtual bool initialize( const short TCPport, const char* pIPAddress );
    00130
    00140          bool ReadEepromData(   ADDRESS_TYPE nAddress, unsigned int uiLength );
    00141
    00148          bool SendReadEepromDataCnf( ADDRESS_TYPE nAddress, const std::vector<unsigned char>& aucData );
    00149
    00159          bool ReadProgramData(  ADDRESS_TYPE nAddress, unsigned int uiLength );
    00160
    00167          bool SendReadProgramDataCnf( ADDRESS_TYPE nAddress, const std::vector<unsigned char>& aucData );
    00168
    00178          bool ReadRamData(      ADDRESS_TYPE nAddress, unsigned int uiLength );
    00179
    00186          bool SendReadRamDataCnf( ADDRESS_TYPE nAddress, const std::vector<unsigned char>& aucData );
    00187
    00197          bool WriteEepromData(  ADDRESS_TYPE nAddress, const std::vector<unsigned char>& aucData );
    00198
    00205          bool SendWriteEepromDataCnf( ADDRESS_TYPE nAddress, unsigned int uiLength );
    00206
    00216          bool WriteProgramData( ADDRESS_TYPE nAddress, const std::vector<unsigned char>& aucData );
    00217
    00224          bool SendWriteProgramDataCnf( ADDRESS_TYPE nAddress, unsigned int uiLength );
    00225
    00235          bool WriteRamData(     ADDRESS_TYPE nAddress, const std::vector<unsigned char>& aucData );
    00236
    00243          bool SendWriteRamDataCnf( ADDRESS_TYPE nAddress, unsigned int uiLength );
    00244
    00252          bool SendStatusInfo( ADDRESS_TYPE nAddress, unsigned int uiLength, std::vector<unsigned char> aucData );
    00253
    00258          bool terminate( void );
    00259
    00260
    00265          CCOMConnector * GetCOMPort( void ) const { return m_pCOMPort; }
    00266
    00271          void SetCOMPort(CCOMConnector * pMsg ) { m_pCOMPort = pMsg; }
    00272
    00278         bool IsConnected( void ) const;
    00279
    00280       protected:
    00286          void Receive ( void *pData, long DataLen );
    00287
    00295          virtual void ReadEepromDataReq(   ADDRESS_TYPE nAddress,
    00296                                            unsigned int uiLength )= 0;
    00297
    00305          virtual void ReadProgramDataReq(  ADDRESS_TYPE nAddress,
    00306                                            unsigned int uiLength )= 0;
    00307
    00315          virtual void ReadRamDataReq(      ADDRESS_TYPE nAddress,
    00316                                            unsigned int uiLength )= 0;
    00317
    00326          virtual void WriteEepromDataReq(  ADDRESS_TYPE nAddress,
    00327                                            unsigned int uiLength,
    00328                                            const std::vector<unsigned char>& aucData )= 0;
    00329
    00338          virtual void WriteProgramDataReq( ADDRESS_TYPE nAddress,
    00339                                            unsigned int uiLength,
    00340                                            const std::vector<unsigned char>& aucData )= 0;
    00341
    00350          virtual void WriteRamDataReq(     ADDRESS_TYPE nAddress,
    00351                                            unsigned int uiLength,
    00352                                            const std::vector<unsigned char>& aucData )= 0;
    00353
    00362          virtual void ReadEepromDataCnf(   ADDRESS_TYPE nAddress,
    00363                                            unsigned int uiLength,
    00364                                            const std::vector<unsigned char>& aucData )= 0;
    00365
    00374          virtual void ReadProgramDataCnf(  ADDRESS_TYPE nAddress,
    00375                                            unsigned int uiLength,
    00376                                            const std::vector<unsigned char>& aucData )= 0;
    00377
    00386          virtual void ReadRamDataCnf(      ADDRESS_TYPE nAddress,
    00387                                            unsigned int uiLength,
    00388                                            const std::vector<unsigned char>& aucData )= 0;
    00389
    00397          virtual void WriteEepromDataCnf(  ADDRESS_TYPE nAddress,
    00398                                            unsigned int uiLength )= 0;
    00399
    00407          virtual void WriteProgramDataCnf( ADDRESS_TYPE nAddress,
    00408                                            unsigned int uiLength )= 0;
    00409
    00417          virtual void WriteRamDataCnf(     ADDRESS_TYPE nAddress,
    00418                                            unsigned int uiLength )= 0;
    00419
    00428          virtual void StatusInfo(          ADDRESS_TYPE nAddress,
    00429                                            unsigned int uiLength,
    00430                                            const std::vector<unsigned char>& aucData )= 0;
    00431
    00436          void SetUseCrcCheck( const bool bUseCrc );
    00437
    00440          bool GetUseCrcCheck( void ) const;
    00441
    00442          // for connect with modem
    00443
    00451          bool m_bRcvRawData;
    00452
    00458          bool m_bRcvRawDataFinished;
    00459
    00462          char m_sRcvRawDataString[ 200 ];
    00463
    00464       private:
    00466          CStatemaschine             m_oStatemaschine;
    00467
    00469          std::vector<unsigned char> m_aucReceivedData;
    00470
    00475          void CallMessageFunc( const CCommandstring& oCommandstring );
    00476
    00484          bool send_data(       CCommandstring::CmdCode  Command, ADDRESS_TYPE  nAddress,
    00485                                unsigned int uiLength,
    00486                                const std::vector<unsigned char>&  aucData );
    00487
    00489          HANDLE m_hSendBlock;
    00490
    00492          bool m_bUseCrcCheck;
    00493
    00494          CCOMConnector * m_pCOMPort;
    00495    };
    00496 #endif