PCanDevice.h
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003  * 
00004  * Copyright (c) 2012 
00005  * 
00006  * SCHUNK GmbH & Co. KG
00007  *  
00008  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00009  * 
00010  * Project name: Drivers for "Amtec M5 Protocol" Electronics V4
00011  *                                                                        
00012  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00013  * 
00014  * Email:robotics@schunk.com
00015  * 
00016  * ToDo: 
00017  * 
00018  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00019  * 
00020  * Redistribution and use in source and binary forms, with or without 
00021  * modification, are permitted provided that the following conditions are met: 
00022  * 
00023  *  * Redistributions of source code must retain the above copyright 
00024  *    notice, this list of conditions and the following disclaimer. 
00025  *  * Redistributions in binary form must reproduce the above copyright 
00026  *    notice, this list of conditions and the following disclaimer in the 
00027  *    documentation and/or other materials provided with the distribution. 
00028  *  * Neither the name of SCHUNK GmbH & Co. KG nor the names of its 
00029  *    contributors may be used to endorse or promote products derived from 
00030  *    this software without specific prior written permission. 
00031  * 
00032  * This program is free software: you can redistribute it and/or modify 
00033  * it under the terms of the GNU Lesser General Public License LGPL as 
00034  * published by the Free Software Foundation, either version 3 of the 
00035  * License, or (at your option) any later version. 
00036  * 
00037  * This program is distributed in the hope that it will be useful, 
00038  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00039  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
00040  * GNU Lesser General Public License LGPL for more details. 
00041  * 
00042  * You should have received a copy of the GNU Lesser General Public 
00043  * License LGPL along with this program. 
00044  * If not, see <http://www.gnu.org/licenses/>.
00045  * 
00046  ******************************************************************************/
00047 
00048 
00049 #ifndef CPCANDEVICE_H
00050 #define CPCANDEVICE_H
00051 
00052 #include "../Device/ProtocolDevice.h"
00053 #include "libpcan.h"
00054 
00055 class CPCanDevice : public CProtocolDevice  
00056 {
00057         private:
00058 
00059                 // ---- private data ---------------------------------------------------- ;
00060         
00061                 // ---- private auxiliary functions ------------------------------------- ;
00062 
00063         protected:
00064 
00065                 // ---- protected data -------------------------------------------------- ;
00066 
00067                         HANDLE m_handle;
00068                         int m_hDevice;
00069                         int m_hSyncDevice;
00070                         int m_iDeviceId;
00071                         bool m_bInitialized;
00072                         unsigned long  m_uiBaudRate;    
00073                         unsigned short m_uiQueueSize;
00074                         unsigned long m_uiTimeOut;
00075                         int m_iNoOfRetries;
00076 
00077                 // ---- protected auxiliary functions ----------------------------------- ;
00078 
00079                         int getDeviceError(int iErrorState);
00080                         int setBaudRate();
00081                         int setBaudRate(unsigned char iBaudRate);
00082                         int setMessageId(unsigned long uiMessageId);
00083                         int clearReadQueue();
00084                         int reinit(unsigned char ucBaudRateId);
00085                         int readDevice(CProtocolMessage& rclProtocolMessage);
00086                         int writeDevice(CProtocolMessage& rclProtocolMessage);
00087                         char * m_DeviceName;
00088 
00089         public:
00090 
00091                 // ---- public data ----------------------------------------------------- ;
00092 
00093 
00094         
00095                 // ---- constructors / destructor --------------------------------------- ;
00096 
00098                         CPCanDevice();
00100                         CPCanDevice(const CPCanDevice& rclPCanDevice);
00102                         virtual ~CPCanDevice();
00103 
00104                 // ---- operators ------------------------------------------------------- ;
00105                 
00106                         // assignment operator
00107                         CPCanDevice& operator=(const CPCanDevice& rclPCanDevice);
00108 
00109                 // ---- query functions ------------------------------------------------- ;
00110 
00111                 // ---- modify functions ------------------------------------------------ ;
00112                         
00113                         void setQueueSize(unsigned short uiQueueSize);
00114                         void setTimeOut(unsigned long uiTimeOut);
00115 
00116                 // ---- I/O functions --------------------------------------------------- ;
00117 
00118                 // ---- exec functions -------------------------------------------------- ;
00119 
00120                         int init();
00121                         int init(unsigned long baudRate);
00122                         int init(const char* acInitString);
00123                         int exit();
00124                         int waitForStartMotionAll();
00125 };
00126 
00127 #endif


schunk_libm5api
Author(s): Florian Weisshardt
autogenerated on Mon Oct 6 2014 07:30:34