From: Christian P. <cp...@us...> - 2005-05-06 16:09:28
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22346/include/pclasses/System Added Files: SerialDevice.h Log Message: - Added the beginning of SerialDevice --- NEW FILE: SerialDevice.h --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef P_System_SerialDevice_h #define P_System_SerialDevice_h #include <pclasses/Export.h> #include <pclasses/IO/IODevice.h> namespace P { namespace System { //! Serial device interface class class PSYSTEM_EXPORT SerialDevice: public IO::IODevice { public: enum Parity { None, Odd, Even }; SerialDevice() throw(); SerialDevice(const std::string& path, AccessMode access, ShareMode share) throw(IO::IOError); ~SerialDevice() throw(); void open(const std::string& path, AccessMode access, ShareMode share) throw(IO::IOError); void setBaudRate(unsigned int baudRate) throw(IO::IOError); unsigned int baudRate() const throw(); void setHardwareFlowControl(bool hwFlow) throw(IO::IOError); bool hardwareFlowControl() const throw(); void setSoftwareFlowControl(bool swFlow) throw(IO::IOError); bool softwareFlowControl() const throw(); protected: // IODevice related methods... void _close() throw(IO::IOError); size_t _read(char* buffer, size_t count) throw(IO::IOError); size_t _peek(char* buffer, size_t count) throw(IO::IOError); size_t _write(const char* buffer, size_t count) throw(IO::IOError); void _sync() const throw(IO::IOError); //! Returns the internal O/S handle unsigned long handle() const throw(); private: void init() throw(IO::IOError); unsigned long _handle; unsigned int _baudRate; bool _hwFlow; bool _swFlow; }; } // !namespace System } // !namespace P #endif |