SerialPort.hpp   SerialPort.hpp 
skipping to change at line 30 skipping to change at line 30
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this library; if not, write to the Free Software along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, US A. Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, US A.
*/ */
#ifndef _SERIAL_PORT_HPP_ #ifndef _SERIAL_PORT_HPP_
#define _SERIAL_PORT_HPP_ #define _SERIAL_PORT_HPP_
#include "Connection.hpp" #include "Connection.hpp"
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>
#else #else
#include <termios.h> #include <termios.h>
#endif #endif
//! Serial interface connection. //! Serial interface connection.
class SerialPort : public Connection class SerialPort : public Connection
{ {
public: public:
//! Class constructor. //! Class constructor.
//! @param serial_device A string containing the name of a serial po rt. //! @param serial_device A string containing the name of a serial po rt.
//! On UNIX systems, this should be something like "/dev/ttyS0". //! On UNIX systems, this should be something like "/dev/ttyS0".
//! On Microsoft Windows systems, this should be something like "COM 1:". //! On Microsoft Windows systems, this should be something like "COM 1:".
SerialPort(Server &server, const char *serial_device); SerialPort(Server &server, const char *serial_device);
~SerialPort(void); ~SerialPort(void);
//! Returns true if the connection is closed. //! Returns true if the connection is closed.
//! This method has different platform-dependent implementations. //! This method has different platform-dependent implementations.
virtual bool isClosed(void) const virtual bool isClosed(void) const
{ {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
return (handle == INVALID_HANDLE_VALUE); return (handle == INVALID_HANDLE_VALUE);
#else #else
return IS_INVALID_SOCKET(fd); return IS_INVALID_SOCKET(fd);
#endif #endif
} }
protected: protected:
void prepareSelectFds(fd_set&, fd_set&, int&); void prepareSelectFds(fd_set&, fd_set&, int&);
private: private:
//! Returns false, as SerialPort implements a serial port connection . //! Returns false, as SerialPort implements a serial port connection .
bool isTcpConnection(void) const {return false;} bool isTcpConnection(void) const {return false;}
//! Returns true, as SerialPort implements a serial port connection. //! Returns true, as SerialPort implements a serial port connection.
bool isAsciiConnection(void) const {return true;} bool isAsciiConnection(void) const {return true;}
private: private:
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
int readNonblocking(char *buf, int count); int readNonblocking(char *buf, int count);
int writeNonblocking(const char *buf, int count); int writeNonblocking(const char *buf, int count);
void handleSelectFds(const fd_set&, const fd_set&) {} void handleSelectFds(const fd_set&, const fd_set&) {}
HANDLE handle; HANDLE handle;
DCB dcb_original; DCB dcb_original;
#else #else
struct termios termios_original; struct termios termios_original;
#endif #endif
}; };
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/