tCanMessage.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00022 //----------------------------------------------------------------------
00023 #include "icl_hardware_can/tCanMessage.h"
00024 
00025 #include <string.h>
00026 
00027 namespace icl_hardware {
00028 namespace can {
00029 
00030 tCanMessage::tCanMessage(unsigned param_id, unsigned char param_dlc,
00031                          unsigned char param_rtr, const unsigned char* param_data)
00032 {
00033   // initialization of fill bytes
00034   memset(this, 0, sizeof(tCanMessage));
00035 
00036   id = param_id;
00037   dlc = param_dlc;
00038   rtr = param_rtr;
00039   memset(data, 0, sizeof(data));
00040   if (param_data)
00041     memcpy(data, param_data, sizeof(data));
00042 #ifdef _IC_BUILDER_CAN_ITEC_
00043   eff = 0;
00044   tv.tv_sec=0;
00045   tv.tv_usec=0;
00046 #endif
00047 }
00048 
00049 tCanMessage::tCanMessage(const tCanMessage &other)
00050 {
00051   // initialization of fill bytes
00052   memset(this, 0, sizeof(tCanMessage));
00053 
00054   id=other.id;
00055   dlc=other.dlc;
00056   rtr=other.rtr;
00057   memcpy(data, other.data, sizeof(data));
00058 #ifdef _IC_BUILDER_CAN_ITEC_
00059   eff = other.eff;
00060   tv = other.tv;
00061 #endif
00062 }
00063 
00064 tCanMessage& tCanMessage::operator = (const tCanMessage &other)
00065 {
00066   id=other.id;
00067   dlc=other.dlc;
00068   rtr=other.rtr;
00069   memcpy(data, other.data, sizeof(data));
00070 #ifdef _IC_BUILDER_CAN_ITEC_
00071   eff = other.eff;
00072   tv = other.tv;
00073 #endif
00074   return *this;
00075 }
00076 
00077 }
00078 }


fzi_icl_can
Author(s):
autogenerated on Tue Aug 8 2017 03:07:51