cdlCOM.h
Go to the documentation of this file.
00001 /*
00002  *   Katana Native Interface - A C++ interface to the robot arm Katana.
00003  *   Copyright (C) 2005 Neuronics AG
00004  *   Check out the AUTHORS file for detailed contact information.
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   This program is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with this program; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 
00022 
00023 #ifndef _CDLCOM_H_
00024 #define _CDLCOM_H_
00025 
00026 #include "common/dllexport.h"
00027 
00028 #include "KNI/cdlBase.h"
00029 #include "KNI/cdlCOMExceptions.h"
00030 
00031 //<tfromm date="22.05.2009">
00032 //#include <string>
00033 #include <cstring>
00034 //</tfromm>
00035 
00036 //-------------------------------------------------------//
00037 #ifdef WIN32
00038 //-------------------------------------------------------//
00039         #include <windows.h>
00040 //-------------------------------------------------------//
00041 #else //LINUX
00042 //-------------------------------------------------------//
00043         #include <termios.h>
00044         #include <fcntl.h>
00045         #include <cerrno>
00046 //-------------------------------------------------------//
00047 #endif //WIN32 else LINUX
00048 //-------------------------------------------------------//
00049 
00050 
00055 struct TCdlCOMDesc {
00056         int     port;   
00057         int     baud;   
00058         int     data;   
00059         int     parity; 
00060         int     stop;   
00061         int     rttc;   
00062         int     wttc;   
00063 };
00064 
00065 //--------------------------------------------------------------------------//
00066 
00067 
00075 class DLLDIR CCdlCOM : public CCdlBase {
00076 private:
00077         std::string _deviceName;
00078 
00079 protected:
00080 
00081         TCdlCOMDesc _ccd;       
00082 
00083 //-------------------------------------------------------//
00084 #ifdef WIN32
00085 //-------------------------------------------------------//
00086         HANDLE _prtHdl; 
00087         COMMTIMEOUTS _oto;      
00088 //-------------------------------------------------------//
00089 #else //LINUX
00090 //-------------------------------------------------------//
00091         int _prtHdl;    
00092         struct termios _oto;    
00093 //-------------------------------------------------------//
00094 #endif //WIN32 else LINUX
00095 //-------------------------------------------------------//
00096 
00097 protected:
00098 
00101         static char digit(const int _val) {
00102                 return (char)((int)'0' + _val);
00103         }
00104 
00105 public:
00112         CCdlCOM(TCdlCOMDesc ccd);
00113         virtual ~CCdlCOM();
00116         virtual int  send(const void* buf, int size);
00119         virtual int  recv(void* buf, int size);
00122 };
00123 
00124 
00125 #endif //_CDLCOM_H_
00126 


kni
Author(s): Martin Günther
autogenerated on Thu Aug 27 2015 13:40:06