DbcMessage.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018 New Eagle
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of New Eagle nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 #ifndef _NEW_EAGLE_DBC_MESSAGE_H
36 #define _NEW_EAGLE_DBC_MESSAGE_H
37 
38 #include <string>
39 #include <can_msgs/Frame.h>
40 
42 
43 namespace NewEagle
44 {
45  struct DbcMessageComment
46  {
47  uint32_t Id;
48  std::string Comment;
49  };
50 
51  enum IdType
52  {
53  STD = 0,
54  EXT = 1
55  };
56 
57  typedef struct {
58  uint8_t :8;
59  uint8_t :8;
60  uint8_t :8;
61  uint8_t :8;
62  uint8_t :8;
63  uint8_t :8;
64  uint8_t :8;
65  uint8_t :8;
66  } EmptyData;
67 
68  class DbcMessage
69  {
70  public:
71  DbcMessage();
72  DbcMessage(
73  uint8_t dlc,
74  uint32_t id,
75  IdType idType,
76  std::string name,
77  uint32_t rawId
78  );
79 
80  ~DbcMessage();
81 
82  uint8_t GetDlc();
83  uint32_t GetId();
84  IdType GetIdType();
85  std::string GetName();
86  can_msgs::Frame GetFrame();
87  uint32_t GetSignalCount();
88  void SetFrame(const can_msgs::Frame::ConstPtr& msg);
89  void AddSignal(std::string signalName, NewEagle::DbcSignal signal);
90  NewEagle::DbcSignal* GetSignal(std::string signalName);
91  void SetRawText(std::string rawText);
92  uint32_t GetRawId();
94  std::map<std::string, NewEagle::DbcSignal>* GetSignals();
96 
97  private:
98  std::map<std::string, NewEagle::DbcSignal> _signals;
99  uint8_t _data[8];
100  uint8_t _dlc;
101  uint32_t _id;
102  IdType _idType;
103  std::string _name;
104  uint32_t _rawId;
106  };
107 }
108 #endif // _NEW_EAGLE_DBC_UTILITIES_H
NewEagle::DbcMessage::GetSignals
std::map< std::string, NewEagle::DbcSignal > * GetSignals()
Definition: DbcMessage.cpp:244
NewEagle::DbcMessage::AddSignal
void AddSignal(std::string signalName, NewEagle::DbcSignal signal)
Definition: DbcMessage.cpp:208
NewEagle::DbcMessage::DbcMessage
DbcMessage()
Definition: DbcMessage.cpp:73
NewEagle::DbcMessage::GetDlc
uint8_t GetDlc()
Definition: DbcMessage.cpp:95
NewEagle::DbcMessage::GetId
uint32_t GetId()
Definition: DbcMessage.cpp:100
NewEagle::DbcMessage::_dlc
uint8_t _dlc
Definition: DbcMessage.h:132
NewEagle::DbcMessage::GetRawId
uint32_t GetRawId()
Definition: DbcMessage.cpp:105
NewEagle::EXT
@ EXT
Definition: DbcMessage.h:86
NewEagle::DbcMessage::~DbcMessage
~DbcMessage()
Definition: DbcMessage.cpp:91
NewEagle::DbcMessage::AnyMultiplexedSignals
bool AnyMultiplexedSignals()
Definition: DbcMessage.cpp:249
NewEagle
Definition: Dbc.h:45
NewEagle::DbcMessage::_idType
IdType _idType
Definition: DbcMessage.h:134
NewEagle::IdType
IdType
Definition: DbcMessage.h:83
NewEagle::DbcMessage::GetSignal
NewEagle::DbcSignal * GetSignal(std::string signalName)
Definition: DbcMessage.cpp:213
NewEagle::DbcMessageComment::Comment
std::string Comment
Definition: DbcMessage.h:112
NewEagle::DbcMessage::SetComment
void SetComment(NewEagle::DbcMessageComment comment)
Definition: DbcMessage.cpp:239
DbcSignal.h
NewEagle::DbcMessage::_data
uint8_t _data[8]
Definition: DbcMessage.h:131
NewEagle::DbcMessage::_id
uint32_t _id
Definition: DbcMessage.h:133
NewEagle::DbcMessageComment
Definition: DbcMessage.h:77
NewEagle::DbcMessage::SetFrame
void SetFrame(const can_msgs::Frame::ConstPtr &msg)
Definition: DbcMessage.cpp:166
NewEagle::DbcSignal
Definition: DbcSignal.h:109
NewEagle::DbcMessage::_signals
std::map< std::string, NewEagle::DbcSignal > _signals
Definition: DbcMessage.h:130
NewEagle::DbcMessage::_name
std::string _name
Definition: DbcMessage.h:135
NewEagle::DbcMessage::SetRawText
void SetRawText(std::string rawText)
Definition: DbcMessage.cpp:229
NewEagle::DbcMessage::GetIdType
IdType GetIdType()
Definition: DbcMessage.cpp:110
NewEagle::DbcMessage::GetName
std::string GetName()
Definition: DbcMessage.cpp:115
NewEagle::DbcMessage::GetSignalCount
uint32_t GetSignalCount()
Definition: DbcMessage.cpp:234
NewEagle::STD
@ STD
Definition: DbcMessage.h:85
NewEagle::DbcMessageComment::Id
uint32_t Id
Definition: DbcMessage.h:111
NewEagle::DbcMessage::_comment
NewEagle::DbcMessageComment _comment
Definition: DbcMessage.h:137
NewEagle::DbcMessage::GetFrame
can_msgs::Frame GetFrame()
Definition: DbcMessage.cpp:120
NewEagle::DbcMessage::_rawId
uint32_t _rawId
Definition: DbcMessage.h:136


can_dbc_parser
Author(s): Ryan Borchert
autogenerated on Sat Apr 9 2022 02:34:32