* http://www.pulse-eight.net/
*/
-#include "../os.h"
-#include "../util/buffer.h"
+#include "lib/platform/os.h"
+#include "lib/platform/util/buffer.h"
#include <string>
#include <stdint.h>
class CSerialSocket : public CCommonSocket<serial_socket_t>
{
public:
- CSerialSocket(const CStdString &strName, uint32_t iBaudrate, SerialDataBits iDatabits = SERIAL_DATA_BITS_EIGHT, SerialStopBits iStopbits = SERIAL_STOP_BITS_ONE, SerialParity iParity = SERIAL_PARITY_NONE) :
+ CSerialSocket(const std::string &strName, uint32_t iBaudrate, SerialDataBits iDatabits = SERIAL_DATA_BITS_EIGHT, SerialStopBits iStopbits = SERIAL_STOP_BITS_ONE, SerialParity iParity = SERIAL_PARITY_NONE) :
CCommonSocket<serial_socket_t>(INVALID_SERIAL_SOCKET_VALUE, strName),
+ #ifdef __WINDOWS__
+ m_iCurrentReadTimeout(MAXDWORD),
+ #endif
m_bIsOpen(false),
m_iBaudrate(iBaudrate),
m_iDatabits(iDatabits),
protected:
#ifndef __WINDOWS__
struct termios m_options;
+ #else
+ bool SetTimeouts(serial_socket_t socket, int* iError, DWORD iTimeoutMs);
+ DWORD m_iCurrentReadTimeout;
#endif
bool m_bIsOpen;
class CSerialPort : public CProtectedSocket<CSerialSocket>
{
public:
- CSerialPort(const CStdString &strName, uint32_t iBaudrate, SerialDataBits iDatabits = SERIAL_DATA_BITS_EIGHT, SerialStopBits iStopbits = SERIAL_STOP_BITS_ONE, SerialParity iParity = SERIAL_PARITY_NONE) :
+ CSerialPort(const std::string &strName, uint32_t iBaudrate, SerialDataBits iDatabits = SERIAL_DATA_BITS_EIGHT, SerialStopBits iStopbits = SERIAL_STOP_BITS_ONE, SerialParity iParity = SERIAL_PARITY_NONE) :
CProtectedSocket<CSerialSocket> (new CSerialSocket(strName, iBaudrate, iDatabits, iStopbits, iParity)) {}
virtual ~CSerialPort(void) {}
};