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.9 KiB
55 lines
1.9 KiB
#ifndef __ARGUS_NODE_ETHERNET2SERIAL_HEADER__
|
|
#define __ARGUS_NODE_ETHERNET2SERIAL_HEADER__
|
|
|
|
#include "rgooseNode.h"
|
|
#include "rgooseHardwareResource.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 ARGUS_ETH2UART: public argusNetNode, public argusHardwareResource, 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 ARGUS_ETH2UART( uint32_t nodeID );
|
|
~ARGUS_ETH2UART();
|
|
virtual bool create( void );
|
|
virtual bool validate( void );
|
|
virtual bool sendData( uint8_t *Data, int DataSize );
|
|
virtual bool reconnect( void );
|
|
};
|
|
|
|
|
|
#endif
|
|
|