canserial-peak.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008 SCHUNK GmbH & Co. KG
00003  * Copyright (c) 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *   http://www.apache.org/licenses/LICENSE-2.0
00010 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 //======================================================================
00029 //======================================================================
00030 
00031 #ifndef CANSERIAL_PEAK_H_
00032 #define CANSERIAL_PEAK_H_
00033 
00034 //----------------------------------------------------------------------
00035 // System Includes - include with <>
00036 //----------------------------------------------------------------------
00037 
00038 
00039 //----------------------------------------------------------------------
00040 // Project Includes - include with ""
00041 //----------------------------------------------------------------------
00042 
00043 #include "sdhexception.h"
00044 #include "serialbase.h"
00045 #include "basisdef.h"
00046 #include "sdhlibrary_settings.h"
00047 
00048 //----------------------------------------------------------------------
00049 // Defines, enums, unions, structs,
00050 //----------------------------------------------------------------------
00051 
00052 NAMESPACE_SDH_START
00053 
00054 //----------------------------------------------------------------------
00055 // Global variables
00056 //----------------------------------------------------------------------
00057 
00058 
00059 //----------------------------------------------------------------------
00060 // Function and class member declarations
00061 //----------------------------------------------------------------------
00062 
00063 
00065 class cCANSerial_PEAK_Internal;
00066 
00067 
00068 
00072 class VCC_EXPORT cCANSerial_PEAKException: public cSerialBaseException
00073 {
00074 public:
00075   cCANSerial_PEAKException(cMsg const & _msg)
00076     : cSerialBaseException("cCANSerial_PEAKException", _msg)
00077   {}
00078 };
00079 //======================================================================
00080 
00081 
00095 class VCC_EXPORT cCANSerial_PEAK : public cSerialBase
00096 {
00097 
00098 protected:
00099 
00101   unsigned long baudrate;
00102 
00104   int id_read;
00105 
00107   int id_write;
00108 
00109   // handle was removed from here, see class comment and GetHandle()
00110 
00112   int BaudrateToBaudrateCode(unsigned long baudrate)
00113   throw (cCANSerial_PEAKException*);
00114 
00115   char m_device[64];
00116 
00117 private:
00119   cCANSerial_PEAK_Internal* pimpl;
00120 
00122   cCANSerial_PEAK(cCANSerial_PEAK const& other);
00123 
00125   cCANSerial_PEAK& operator=(cCANSerial_PEAK const& rhs);
00126 
00127 public:
00138   cCANSerial_PEAK(unsigned long _baudrate, double _timeout, int _id_read, int _id_write, const char *device = "/dev/pcanusb0")
00139   throw (cCANSerial_PEAKException*);
00140 
00150   cCANSerial_PEAK(tDeviceHandle _peak_handle, double _timeout, int _id_read, int _id_write)
00151   throw (cCANSerial_PEAKException*);
00152 
00154   ~cCANSerial_PEAK();
00155 
00163   tDeviceHandle GetHandle();
00164 
00168   void Open(void)
00169   throw (cCANSerial_PEAKException*);
00170 
00172   bool IsOpen(void)
00173   throw();
00174 
00176   void Close(void)
00177   throw (cCANSerial_PEAKException*);
00178 
00180 
00188   int write(char const *ptr, int len = 0)
00189   throw (cCANSerial_PEAKException*);
00190 
00199   ssize_t Read(void *data, ssize_t size, long timeout_us, bool return_on_less_data)
00200   throw (cCANSerial_PEAKException*);
00201 
00203   void SetTimeout(double _timeout)
00204   throw (cSerialBaseException*);
00205 
00209   virtual tErrorCode GetErrorNumber();
00210 
00216   virtual char const* GetErrorMessage(tErrorCode dw);
00217 
00218 };
00219 //======================================================================
00220 
00221 NAMESPACE_SDH_END
00222 
00223 #endif
00224 
00225 
00226 //======================================================================
00227 /*
00228  Here are some settings for the emacs/xemacs editor (and can be safely ignored):
00229  (e.g. to explicitely set C++ mode for *.h header files)
00230 
00231  Local Variables:
00232  mode:C++
00233  mode:ELSE
00234  End:
00235 */
00236 //======================================================================


schunk_sdh
Author(s): Mathias Luedtke , Florian Weisshardt
autogenerated on Sat Jun 8 2019 20:25:21