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 #include "ProtocolMessage.h" 00050 #include <string.h> 00051 00052 // ========================================================================== ; 00053 // ; 00054 // ---- constructors / destructor ------------------------------------------- ; 00055 // ; 00056 // ========================================================================== ; 00057 00058 CProtocolMessage::CProtocolMessage() : 00059 m_uiMessageId(0), 00060 m_ucMessageLength(0), 00061 m_ucMessageState(0), 00062 m_bRTRFlag(false), 00063 m_fTime(0.0), 00064 m_iModuleId(0) 00065 { 00066 } 00067 00068 CProtocolMessage::CProtocolMessage(const CProtocolMessage& rclProtocolMessage) : 00069 m_uiMessageId(rclProtocolMessage.m_uiMessageId), 00070 m_ucMessageLength(rclProtocolMessage.m_ucMessageLength), 00071 m_ucMessageState(rclProtocolMessage.m_ucMessageState), 00072 m_bRTRFlag(rclProtocolMessage.m_bRTRFlag), 00073 m_fTime(rclProtocolMessage.m_fTime), 00074 m_iModuleId(rclProtocolMessage.m_iModuleId) 00075 { 00076 memcpy(m_aucMessageData, rclProtocolMessage.m_aucMessageData, m_ucMessageLength); 00077 } 00078 00079 CProtocolMessage::~CProtocolMessage() 00080 { 00081 } 00082 00083 // ========================================================================== ; 00084 // ; 00085 // ---- operators ----------------------------------------------------------- ; 00086 // ; 00087 // ========================================================================== ; 00088 00089 CProtocolMessage& CProtocolMessage::operator=(const CProtocolMessage& rclProtocolMessage) 00090 { 00091 m_uiMessageId = rclProtocolMessage.m_uiMessageId; 00092 m_ucMessageLength = rclProtocolMessage.m_ucMessageLength; 00093 m_ucMessageState = rclProtocolMessage.m_ucMessageState; 00094 m_bRTRFlag = rclProtocolMessage.m_bRTRFlag; 00095 m_fTime = rclProtocolMessage.m_fTime; 00096 m_iModuleId = rclProtocolMessage.m_iModuleId; 00097 memcpy(m_aucMessageData, rclProtocolMessage.m_aucMessageData, m_ucMessageLength); 00098 return *this; 00099 } 00100