00001 /*************************************************************************** 00002 * Copyright (C) 2001 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This file is part of the conexus library. * 00006 * * 00007 * The conexus library is free software; you can redistribute it and/or * 00008 * modify it under the terms of the GNU General Public License * 00009 * version 3 as published by the Free Software Foundation. * 00010 * * 00011 * The conexus library is distributed in the hope that it will be * 00012 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * 00013 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this software. If not see <http://www.gnu.org/licenses/>. * 00018 ***************************************************************************/ 00019 #ifndef CONEXUSSERIAL_H 00020 #define CONEXUSSERIAL_H 00021 00022 #include <conexus/filedescriptor.h> 00023 00030 namespace Conexus 00031 { 00032 00042 class Serial : public FileDescriptor 00043 { 00044 protected: 00045 00046 Serial( const std::string& device = std::string(), ReadWrite rwmode = READ_WRITE ); 00047 00048 public: 00049 00050 typedef ConexusPointer<Serial> pointer; 00051 00052 CONEXUS_ENDPOINT_GENERIC_CREATE(); 00053 00054 static Serial::pointer create( const std::string& device = std::string(), ReadWrite rwmode = READ_WRITE ); 00055 00056 virtual ~Serial(); 00057 00061 virtual void open( const std::string name, ReadWrite rwmode = READ_WRITE_UNCHANGED ) throw ( open_exception ); 00062 00067 virtual void open() throw ( open_exception ); 00068 00069 ReadWrite rw_mode(); 00070 00074 std::string device(); 00075 00088 void set_device( const std::string& d, ReadWrite rwmode = READ_WRITE_UNCHANGED ) throw ( open_exception ); 00089 00090 sigc::signal<void> signal_device_changed(); 00091 00092 protected: 00093 std::string m_device; 00094 ReadWrite m_rwmode; 00095 00096 sigc::signal<void> m_signal_device_changed; 00097 }; 00098 00099 } 00100 00101 #endif