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 CPROTOCOLMESSAGE_H 00050 #define CROTOCOLMESSAGE_H 00051 00052 #include "../Util/GlobalDefines.h" 00053 00054 class CProtocolMessage 00055 { 00056 public: 00057 00058 // ---- public data ----------------------------------------------------- ; 00059 00060 unsigned long m_uiMessageId; // Identifier 11-/29-Bit 00061 // 11 bit in low word, 29 bit complete 00062 unsigned char m_ucMessageLength; // number of data bytes (0-8) 00063 unsigned char m_aucMessageData[8]; // Array for up to 8 data bytes 00064 unsigned char m_ucMessageState; // Bit coded information for state 00065 bool m_bRTRFlag; // RTR-Bit: 0=Dataframe, 1=Remoteframe 00066 double m_fTime; // time stamp in sec 00067 int m_iModuleId; // module bus address 00068 00069 // ---- constructors / destructor --------------------------------------- ; 00070 00072 CProtocolMessage(); 00074 CProtocolMessage(const CProtocolMessage& rclProtocolMessage); 00076 ~CProtocolMessage(); 00077 // ---- operators ------------------------------------------------------ ; 00078 00079 // assignment operator 00080 CProtocolMessage& operator=(const CProtocolMessage& rclProtocolMessage); 00081 }; 00082 00083 typedef struct 00084 { 00085 unsigned char m_aucMessageId[2]; 00086 unsigned char m_aucMessageData[8]; 00087 unsigned char m_ucMessageLength; 00088 } CRS232Message; 00089 00090 typedef union 00091 { 00092 unsigned char aucData[4]; 00093 char acData[4]; 00094 unsigned short auiData[2]; 00095 short aiData[2]; 00096 unsigned long uiData; 00097 long iData; 00098 float fData; 00099 } CProtocolData; 00100 00101 #endif