You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.8 KiB
55 lines
1.8 KiB
#ifndef __DEVICE_NODE_ETHERNET2SERIAL_HEADER__
|
|
#define __DEVICE_NODE_ETHERNET2SERIAL_HEADER__
|
|
|
|
#include "deviceNode.h"
|
|
#include "hardwareResource.h"
|
|
#include "../../components/base/basicTransport.h"
|
|
#include "../../components/base/basicDualThread.h"
|
|
|
|
#ifndef MAXIMAL_SOCKET_PACKET_LENGTH
|
|
#define MAXIMAL_SOCKET_PACKET_LENGTH 102400
|
|
#endif
|
|
|
|
#ifndef MAXIMAL_SERIAL_PACKET_LENGTH
|
|
#define MAXIMAL_SERIAL_PACKET_LENGTH MAXIMAL_SOCKET_PACKET_LENGTH
|
|
#endif
|
|
|
|
class deviceETH2UART: public deviceNode, public hardwareResource, public basicTransport, public basicDualThread{
|
|
private:
|
|
//basicLogCollection * m_pLog;
|
|
DBC_UART_DATA m_sUartData;
|
|
|
|
int m_iDeviceFD;
|
|
int m_iMasterFD;
|
|
#ifdef __linux__
|
|
int m_iInFID;
|
|
int m_iOutFID;
|
|
#else
|
|
DCB PortDCB;
|
|
HANDLE m_ioFID;
|
|
#endif
|
|
bool pingDevice();
|
|
bool create_SOL();
|
|
bool closePort();
|
|
int sendBlock(unsigned char *Data, int DataSize);
|
|
int recptBlock(unsigned char *Buffer, int *BufferLength);
|
|
protected:
|
|
U8 m_pInputBuffer[MAXIMAL_SOCKET_PACKET_LENGTH];
|
|
U8 m_pOutputBuffer[MAXIMAL_SOCKET_PACKET_LENGTH];
|
|
int m_nInputBufferSize;
|
|
int m_nOutputBufferSize;
|
|
|
|
virtual void m_fThreadAProc(void);
|
|
virtual void m_fThreadBProc(void);
|
|
public:
|
|
explicit deviceETH2UART( uint32_t nodeID );
|
|
~deviceETH2UART();
|
|
virtual bool create( void );
|
|
virtual bool validate( void );
|
|
virtual bool sendData( uint8_t *Data, int DataSize );
|
|
virtual bool reconnect( void );
|
|
};
|
|
|
|
|
|
#endif
|
|
|