00001 /* 00002 * Copyright (c) 2012 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 #ifndef CPROTOCOLMESSAGE_H 00019 #define CROTOCOLMESSAGE_H 00020 00021 #include "../Util/GlobalDefines.h" 00022 00023 class CProtocolMessage 00024 { 00025 public: 00026 00027 // ---- public data ----------------------------------------------------- ; 00028 00029 unsigned long m_uiMessageId; // Identifier 11-/29-Bit 00030 // 11 bit in low word, 29 bit complete 00031 unsigned char m_ucMessageLength; // number of data bytes (0-8) 00032 unsigned char m_aucMessageData[8]; // Array for up to 8 data bytes 00033 unsigned char m_ucMessageState; // Bit coded information for state 00034 bool m_bRTRFlag; // RTR-Bit: 0=Dataframe, 1=Remoteframe 00035 double m_fTime; // time stamp in sec 00036 int m_iModuleId; // module bus address 00037 00038 // ---- constructors / destructor --------------------------------------- ; 00039 00041 CProtocolMessage(); 00043 CProtocolMessage(const CProtocolMessage& rclProtocolMessage); 00045 ~CProtocolMessage(); 00046 // ---- operators ------------------------------------------------------ ; 00047 00048 // assignment operator 00049 CProtocolMessage& operator=(const CProtocolMessage& rclProtocolMessage); 00050 }; 00051 00052 typedef struct 00053 { 00054 unsigned char m_aucMessageId[2]; 00055 unsigned char m_aucMessageData[8]; 00056 unsigned char m_ucMessageLength; 00057 } CRS232Message; 00058 00059 typedef union 00060 { 00061 unsigned char aucData[4]; 00062 char acData[4]; 00063 unsigned short auiData[2]; 00064 short aiData[2]; 00065 unsigned long uiData; 00066 long iData; 00067 float fData; 00068 } CProtocolData; 00069 00070 #endif