tCanMessage.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
22 //----------------------------------------------------------------------
24 
25 #include <string.h>
26 
27 namespace icl_hardware {
28 namespace can {
29 
30 tCanMessage::tCanMessage(unsigned param_id, unsigned char param_dlc,
31  unsigned char param_rtr, const unsigned char* param_data)
32 {
33  // initialization of fill bytes
34  memset(this, 0, sizeof(tCanMessage));
35 
36  id = param_id;
37  dlc = param_dlc;
38  rtr = param_rtr;
39  memset(data, 0, sizeof(data));
40  if (param_data)
41  memcpy(data, param_data, sizeof(data));
42 #ifdef _IC_BUILDER_CAN_ITEC_
43  eff = 0;
44  tv.tv_sec=0;
45  tv.tv_usec=0;
46 #endif
47 }
48 
50 {
51  // initialization of fill bytes
52  memset(this, 0, sizeof(tCanMessage));
53 
54  id=other.id;
55  dlc=other.dlc;
56  rtr=other.rtr;
57  memcpy(data, other.data, sizeof(data));
58 #ifdef _IC_BUILDER_CAN_ITEC_
59  eff = other.eff;
60  tv = other.tv;
61 #endif
62 }
63 
65 {
66  id=other.id;
67  dlc=other.dlc;
68  rtr=other.rtr;
69  memcpy(data, other.data, sizeof(data));
70 #ifdef _IC_BUILDER_CAN_ITEC_
71  eff = other.eff;
72  tv = other.tv;
73 #endif
74  return *this;
75 }
76 
77 }
78 }
tCanMessage(unsigned param_id=0, unsigned char param_dlc=0, unsigned char param_rtr=0, const unsigned char *param_data=0)
Definition: tCanMessage.cpp:30
Implements a struct representing a can message.
Definition: tCanMessage.h:43
void * memcpy(void *dest, void *src, size_t count)
Contains CAN driver interface functions.
void * memset(void *dest, int c, size_t count)
tCanMessage & operator=(const tCanMessage &other)
Definition: tCanMessage.cpp:64


fzi_icl_can
Author(s):
autogenerated on Mon Jun 10 2019 13:17:02