automotive-message-broker  0.14.803
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
canframeinfo.h
1 /*
2 Copyright (C) 2015 Cogent Embedded Inc.
3 Copyright (C) 2015 Renesas Electronics Corporation
4 
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9 
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 #ifndef CANFRAMEINFO_H
21 #define CANFRAMEINFO_H
22 
28 #include <stdlib.h>
29 #include <linux/can.h>
30 
31 #include "timestamp.h"
32 
37 {
38  CANFrameInfo(const can_frame &frame)
39  {
40  this->status = CANFrameInfo::CANMessageStatus::GOOD;
41  this->frame = frame;
42  this->timestamp = amb::currentTime();
43  }
44 
45  CANFrameInfo() { }
46 
47  enum CANMessageStatus {
48  TIMEOUT = -2,
49  EMPTY = 0,
50  GOOD = 1,
51  };
52 
56  struct can_frame frame;
57 
61  CANFrameInfo::CANMessageStatus status;
62 
66  double timestamp;
67 };
68 
69 #endif // CANFRAMEINFO_H
70