/* * Copyright (c) 2001 by Cliff Green. All rights reserved. Individual files * may be covered by other copyrights (as noted in the file itself). * * Redistribution and use in source and binary forms are permitted * provided that this entire copyright notice is duplicated in all such * copies. * * This software is provided "as is" and without any expressed or implied * warranties, including, without limitation, the implied warranties of * merchantibility and fitness for any particular purpose. */ //---------------------------------------------------------------------- // Source file: serialcommunix.h // Written by: Cliff Green, 2001 // Compiler: Metrowerks CodeWarrior Pro 6 // History: // Modified: 8/08/2001 // By: Cliff Green // Comments: Changed to match latest BinaryBuf interface. Note that // the current version of this code has not yet been // compiled and tested on a Unix flavored platform. //---------------------------------------------------------------------- // This commentheader supports documentation tools such as Doc++ and // Doxygen: http://www.doxygen.org/ //---------------------------------------------------------------------- /// Class for encapsulating binary comm over Unix serial ports. /** * This class implements communicating binary characters over Unix * serial ports. Except for the bracketing start and end characters, the * internal binary data is converted to character hex representation, * so that issues of port protocols are diminished. * * The BinaryBuf utility class is used for sending and receiving. * * See 'Advanced Programming in the Unix Environment', Stevens, pg 354, * for more details on the port setting function calls. */ #ifndef SERIALCOMMUNIX_H #define SERIALCOMMUNIX_H #include "binarybuf.h" #include namespace Util { class SerialCommUnix { public: explicit SerialCommUnix(const char* devName); ~SerialCommUnix(); bool transmit (const BinaryBuf<>&) const; const BinaryBuf<> receive () const; private: int mFd; termios mOrigIos; private: bool tty_raw (); bool tty_reset (); private: SerialCommUnix(const SerialCommUnix& ); // copy ctor SerialCommUnix& operator=(const SerialCommUnix& ); // assign op }; // end class } // end namespace #endif // end header