ProtocolDevice.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 CPROTOCOLDEVICE_H
00050 #define CPROTOCOLDEVICE_H
00051 
00052 #include "../Device/Device.h"
00053 #include "../Device/ProtocolMessage.h"
00054 #include "../Util/Random.h"
00055 #include "../Util/StopWatch.h"
00056 
00057 #define READ 1
00058 #define WRITE 0
00059 
00060 class CProtocolDevice : public CDevice  
00061 {
00062         private:
00063 
00064                 // ---- private data ---------------------------------------------------- ;
00065         
00066                 // ---- private auxiliary functions ------------------------------------- ;
00067 
00068         protected:
00069 
00070                 // ---- protected data -------------------------------------------------- ;
00071 
00072                         CRITICAL_SECTION m_csDevice;
00073                         CStopWatch m_clTimer;
00074 
00075                 // ---- protected auxiliary functions ----------------------------------- ;
00076 
00077                         int getUnsignedLong(int iModuleId, unsigned long* puiData);
00078 
00079                         int readChar(int iModuleId, int iCommandId, int iParameterId, char* pcData);
00080                         int readUnsignedChar(int iModuleId, int iCommandId, int iParameterId, unsigned char* pucData);
00081                         int readShort(int iModuleId, int iCommandId, int iParameterId, short* piData);
00082                         int readUnsignedShort(int iModuleId, int iCommandId, int iParameterId, unsigned short* puiData);
00083                         int readLong(int iModuleId, int iCommandId, int iParameterId, long* piData);
00084                         int readUnsignedLong(int iModuleId, int iCommandId, int iParameterId, unsigned long* puiData);
00085                         int readFloat(int iModuleId, int iCommandId, int iParameterId, float* pfData);
00086 
00087                         int readLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long* piData, unsigned char* pucData1, unsigned char* pucData2);
00088                         int readFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float* pfData, unsigned char* pucData1, unsigned char* pucData2);
00089 
00090                         int write8Bytes(int iModuleId, bool bAck, void* pBytes); 
00091 
00092                         int writeChar(int iModuleId, int iCommandId, int iParameterId, char cData);
00093                         int writeUnsignedChar(int iModuleId, int iCommandId, int iParameterId, unsigned char ucData);
00094                         int writeShort(int iModuleId, int iCommandId, int iParameterId, short iData);
00095                         int writeUnsignedShort(int iModuleId, int iCommandId, int iParameterId, unsigned short uiData);
00096                         int writeLong(int iModuleId, int iCommandId, int iParameterId, long iData);
00097                         int writeUnsignedLong(int iModuleId, int iCommandId, int iParameterId, unsigned long uiData);
00098                         int writeFloat(int iModuleId, int iCommandId, int iParameterId, float fData);
00099 
00100                         int writeAll(int iCommandId, int iParameterId);
00101                         int writeCommand(int iModuleId, int iCommandId);
00102 
00103                         int writeLongShort(int iModuleId, int iCommandId, int iParameterId, long iData1, short iData2);
00104                         int writeFloatShort(int iModuleId, int iCommandId, int iParameterId, float fData, short iData);
00105 
00106                         int writeShortReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, short iData, long* piData, unsigned char* pucData1, unsigned char* pucData2);
00107                         int writeLongReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long iData, long* piData, unsigned char* pucData1, unsigned char* pucData2);
00108                         int writeLongShortReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long iData1, short iData2, long* piData, unsigned char* pucData1, unsigned char* pucData2);
00109                         int writeFloatReadFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float fData, float* pfData, unsigned char* pucData1, unsigned char* pucData2);
00110                         int writeFloatShortReadFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float fData, short iData, float* pfData, unsigned char* pucData1, unsigned char* pucData2);
00111 
00112                         virtual int reinit(unsigned char ucBaudRateId) = 0;
00113                         virtual int clearReadQueue() = 0;
00114                         virtual int setMessageId(unsigned long uiMessageId) = 0;
00115                         virtual int readDevice(CProtocolMessage& rclProtocolMessage) = 0;
00116                         virtual int writeDevice(CProtocolMessage& rclProtocolMessage) = 0;
00117                         int printMessage(CProtocolMessage & rclProtocolMessage, bool read);
00118 
00119         public:
00120 
00121                 // ---- public data ----------------------------------------------------- ;
00122 
00123         
00124                 // ---- constructors / destructor --------------------------------------- ;
00125 
00127                         CProtocolDevice();
00129                         CProtocolDevice(const CProtocolDevice& rclProtocolDevice);
00131                         virtual ~CProtocolDevice();
00132 
00133                 // ---- operators ------------------------------------------------------- ;
00134                 
00135                         // assignment operator
00136                         CProtocolDevice& operator=(const CProtocolDevice& rclProtocolDevice);
00137 
00138                 // ---- query functions ------------------------------------------------- ;
00139 
00140                         int getDataDLR_FTS(std::vector<float>& rafData, long* piState);
00141                         int getDataSCHUNK_FTC(int iModuleId, int iChannelTypeId, std::vector<float>& rafData, short* piState);
00142                         int getDataMP55_IO(int iModuleId, float* pfData);
00143                         int getDataMP55_IO_fast(int iModuleId, float* pfData);
00144                         int getCanOpenRawAbsEnc(int iModuleId, short* piValue);
00145 
00146                 // ---- modify functions ------------------------------------------------ ;
00147 
00148                         int setNullSCHUNK_FTC(int iModuleId, short* piState);
00149                         int setTaraMP55_IO(int iModuleId, float fTara);
00150                         int setInitMP55_IO_fast(int iModuleId);
00151 
00152                 // ---- I/O functions --------------------------------------------------- ;
00153 
00154                 // ---- exec functions -------------------------------------------------- ;
00155 
00156                         int initDLR_FTS();
00157 
00158 };
00159 
00160 #endif


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