conexus logo

serial.h

Go to the documentation of this file.
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/conexus-config.h>
00023 #include <conexus/filedescriptor.h>
00024 #include <conexus/serial_interface.h>
00025 
00032 namespace Conexus
00033 {
00034 
00044   class Serial : public FileDescriptor, public virtual SerialInterface
00045   {
00046     protected:
00047 
00048       Serial( const std::string& device = std::string(), ReadWrite rwmode = READ_WRITE );
00049 
00050     public:
00051 
00052       typedef ConexusPointer<Serial> pointer;
00053       
00054       CONEXUS_ENDPOINT_GENERIC_CREATE();
00055 
00056       static Serial::pointer create( const std::string& device = std::string(), ReadWrite rwmode = READ_WRITE );
00057 
00058       virtual ~Serial();
00059       
00061       virtual void open( const std::string& device, ReadWrite rwmode = READ_WRITE_UNCHANGED ) throw ( open_exception );
00062 
00067       virtual void open() throw ( open_exception );
00068 
00069       virtual uint32_t rw_mode();
00070 
00074       virtual std::string device();
00075 
00088       virtual void set_device( const std::string& device, ReadWrite rwmode = READ_WRITE_UNCHANGED ) throw ( open_exception );
00089       
00090       virtual sigc::signal<void>& signal_device_changed();
00091       
00092       #ifdef CONEXUS_HAVE_UDEV
00093 
00097       struct Device {
00098         Device(const std::string& n, const std::string& p):
00099             name(n), path(p) { }
00100         std::string name;
00101         std::string path;
00102       };
00103       
00105       typedef std::vector<Device> Devices;
00106       
00114       static Devices enumerate_devices(bool include_virtuals=false);
00115       #endif
00116 
00117     protected:
00118       std::string m_device;
00119       ReadWrite m_rwmode;
00120 
00121       sigc::signal<void> m_signal_device_changed;
00122   };
00123 
00124 }
00125 
00126 #endif

Generated on Wed Jul 8 15:50:08 2009 for conexus by doxygen 1.5.8