MOOS 0.2375
|
00001 00002 // 00003 // MOOS - Mission Oriented Operating Suite 00004 // 00005 // A suit of Applications and Libraries for Mobile Robotics Research 00006 // Copyright (C) 2001-2005 Massachusetts Institute of Technology and 00007 // Oxford University. 00008 // 00009 // This software was written by Paul Newman at MIT 2001-2002 and Oxford 00010 // University 2003-2005. email: pnewman@robots.ox.ac.uk. 00011 // 00012 // This file is part of a MOOS Core Component. 00013 // 00014 // This program is free software; you can redistribute it and/or 00015 // modify it under the terms of the GNU General Public License as 00016 // published by the Free Software Foundation; either version 2 of the 00017 // License, or (at your option) any later version. 00018 // 00019 // This program is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 // General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with this program; if not, write to the Free Software 00026 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00027 // 02111-1307, USA. 00028 // 00030 // MOOSSerialPort.h: interface for the CMOOSLinuxSerialPort class. 00031 // 00033 #ifdef _WIN32 00034 #pragma warning(disable : 4786) 00035 #endif 00036 00037 #if !defined(AFX_MOOSLINUXSERIALPORT_H__7C4C08B7_D9E9_4226_A227_81B9621BC09A__INCLUDED_) 00038 #define AFX_MOOSLINUXSERIALPORT_H__7C4C08B7_D9E9_4226_A227_81B9621BC09A__INCLUDED_ 00039 00040 #if _MSC_VER > 1000 00041 #pragma once 00042 #endif // _MSC_VER > 1000 00043 00044 #include <string> 00045 //using namespace std; 00046 00047 #ifndef _WIN32 00048 #include <fcntl.h> 00049 #include <sys/signal.h> 00050 #include <sys/types.h> 00051 #include <termios.h> 00052 #include <unistd.h> 00053 00054 #include <stdio.h> 00055 #endif 00056 #include "MOOSSerialPort.h" 00057 00059 class CMOOSLinuxSerialPort :public CMOOSSerialPort 00060 { 00061 public: 00062 virtual bool Close(); 00063 00064 CMOOSLinuxSerialPort(); 00065 00066 virtual ~CMOOSLinuxSerialPort(); 00067 00069 virtual bool Create(const char * pPortNum=DEFAULT_PORT, int nBaudRate=DEFAULT_BAUDRATE); 00070 00072 int Write(const char* Str,int nLen, double* pTime=NULL); 00073 00075 virtual void Break(); 00076 00077 /*Flush the Port */ 00078 virtual int Flush(); 00079 00081 int GetFD(); 00082 protected: 00084 int m_nPortFD; 00085 00087 virtual int GrabN(char * pBuffer,int nRequired); 00088 00089 #ifndef _WIN32 00090 struct termios m_OldPortOptions; 00091 struct termios m_PortOptions; 00092 #endif 00093 00094 00095 }; 00096 00097 #endif // !defined(AFX_MOOSSERIALPORT_H__7C4C08B7_D9E9_4226_A227_81B9621BC09A__INCLUDED_)