DbcSignal.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_SIGNAL_H
36 #define _NEW_EAGLE_DBC_SIGNAL_H
37 
38 #include <ros/ros.h>
39 
40 #include <string>
41 
42 namespace NewEagle
43 {
44  struct DbcSignalComment
45  {
46  uint32_t Id;
47  std::string SignalName;
48  std::string Comment;
49  };
50 
51  enum SignType
52  {
53  UNSIGNED = 0,
54  SIGNED = 1
55  };
56 
57  enum ByteOrder
58  {
59  LITTLE_END = 0,
60  BIG_END = 1
61  };
62 
63  enum DataType
64  {
65  INT = 0,
66  FLOAT = 1,
67  DOUBLE = 2
68  };
69 
70  enum MultiplexerMode
71  {
72  NONE = 0,
73  MUX_SWITCH = 1,
74  MUX_SIGNAL = 2
75  };
76 
77  class DbcSignal {
78  public:
79  DbcSignal(
80  uint8_t dlc,
81  double gain,
82  double offset,
83  uint8_t startBit,
84  ByteOrder endianness,
85  uint8_t length,
86  SignType sign,
87  std::string name,
88  MultiplexerMode multiplexerMode);
89 
90  DbcSignal(
91  uint8_t dlc,
92  double gain,
93  double offset,
94  uint8_t startBit,
95  ByteOrder endianness,
96  uint8_t length,
97  SignType sign,
98  std::string name,
99  MultiplexerMode multiplexerMode,
100  int32_t multiplexerSwitch);
101 
103 
104  uint8_t GetDlc() const;
105  double GetResult() const;
106  double GetGain() const;
107  double GetOffset() const;
108  uint8_t GetStartBit() const;
110  uint8_t GetLength() const;
111  SignType GetSign() const;
112  std::string GetName() const;
113  void SetResult(double result);
115  void SetInitialValue(double value);
116  double GetInitialValue();
118  void SetDataType(DataType type);
120  int32_t GetMultiplexerSwitch() const;
121 
122  private:
123  uint8_t _dlc;
124  double _result;
125  double _gain;
126  double _offset;
127  uint8_t _startBit;
129  uint8_t _length;
130  SignType _sign;
131  std::string _name;
133  double _initialValue;
134  DataType _type;
136  int32_t _multiplexerSwitch;
137  };
138 }
139 
140 #endif // _NEW_EAGLE_DBC_SIGNAL_H
NewEagle::DbcSignal::SetInitialValue
void SetInitialValue(double value)
Definition: DbcSignal.cpp:176
NewEagle::DbcSignal::SetComment
void SetComment(NewEagle::DbcSignalComment comment)
Definition: DbcSignal.cpp:171
NewEagle::DbcSignalComment::Id
uint32_t Id
Definition: DbcSignal.h:110
NewEagle::DataType
DataType
Definition: DbcSignal.h:95
NewEagle::DbcSignal::GetMultiplexerMode
MultiplexerMode GetMultiplexerMode() const
Definition: DbcSignal.cpp:195
ros.h
NewEagle::DbcSignal::_result
double _result
Definition: DbcSignal.h:156
NewEagle::DbcSignal::_length
uint8_t _length
Definition: DbcSignal.h:161
NewEagle::DbcSignal::_type
DataType _type
Definition: DbcSignal.h:166
NewEagle::DbcSignalComment
Definition: DbcSignal.h:76
NewEagle::FLOAT
@ FLOAT
Definition: DbcSignal.h:98
NewEagle::DbcSignal::_endianness
ByteOrder _endianness
Definition: DbcSignal.h:160
NewEagle::DbcSignal::GetDlc
uint8_t GetDlc() const
Definition: DbcSignal.cpp:121
NewEagle
Definition: Dbc.h:45
NewEagle::DbcSignal::DbcSignal
DbcSignal(uint8_t dlc, double gain, double offset, uint8_t startBit, ByteOrder endianness, uint8_t length, SignType sign, std::string name, MultiplexerMode multiplexerMode)
Definition: DbcSignal.cpp:71
NewEagle::INT
@ INT
Definition: DbcSignal.h:97
NewEagle::DbcSignalComment::Comment
std::string Comment
Definition: DbcSignal.h:112
NewEagle::NONE
@ NONE
Definition: DbcSignal.h:104
NewEagle::UNSIGNED
@ UNSIGNED
Definition: DbcSignal.h:85
NewEagle::DbcSignal::GetResult
double GetResult() const
Definition: DbcSignal.cpp:126
NewEagle::MultiplexerMode
MultiplexerMode
Definition: DbcSignal.h:102
NewEagle::ByteOrder
ByteOrder
Definition: DbcSignal.h:89
NewEagle::DbcSignal::GetName
std::string GetName() const
Definition: DbcSignal.cpp:161
NewEagle::SignType
SignType
Definition: DbcSignal.h:83
NewEagle::DbcSignal
Definition: DbcSignal.h:109
NewEagle::DbcSignal::_dlc
uint8_t _dlc
Definition: DbcSignal.h:155
NewEagle::DbcSignal::GetDataType
DataType GetDataType()
Definition: DbcSignal.cpp:190
NewEagle::DbcSignal::SetDataType
void SetDataType(DataType type)
Definition: DbcSignal.cpp:185
NewEagle::DbcSignal::GetOffset
double GetOffset() const
Definition: DbcSignal.cpp:136
NewEagle::BIG_END
@ BIG_END
Definition: DbcSignal.h:92
NewEagle::DbcSignal::_sign
SignType _sign
Definition: DbcSignal.h:162
NewEagle::MUX_SIGNAL
@ MUX_SIGNAL
Definition: DbcSignal.h:106
NewEagle::DbcSignal::GetGain
double GetGain() const
Definition: DbcSignal.cpp:131
NewEagle::DbcSignal::_initialValue
double _initialValue
Definition: DbcSignal.h:165
NewEagle::DbcSignal::_multiplexerSwitch
int32_t _multiplexerSwitch
Definition: DbcSignal.h:168
NewEagle::SIGNED
@ SIGNED
Definition: DbcSignal.h:86
NewEagle::DOUBLE
@ DOUBLE
Definition: DbcSignal.h:99
NewEagle::DbcSignal::_multiplexerMode
MultiplexerMode _multiplexerMode
Definition: DbcSignal.h:167
NewEagle::DbcSignalComment::SignalName
std::string SignalName
Definition: DbcSignal.h:111
NewEagle::DbcSignal::GetStartBit
uint8_t GetStartBit() const
Definition: DbcSignal.cpp:141
NewEagle::DbcSignal::~DbcSignal
~DbcSignal()
Definition: DbcSignal.cpp:117
NewEagle::LITTLE_END
@ LITTLE_END
Definition: DbcSignal.h:91
NewEagle::DbcSignal::GetSign
SignType GetSign() const
Definition: DbcSignal.cpp:156
NewEagle::DbcSignal::GetEndianness
ByteOrder GetEndianness() const
Definition: DbcSignal.cpp:146
NewEagle::MUX_SWITCH
@ MUX_SWITCH
Definition: DbcSignal.h:105
NewEagle::DbcSignal::GetLength
uint8_t GetLength() const
Definition: DbcSignal.cpp:151
NewEagle::DbcSignal::SetResult
void SetResult(double result)
Definition: DbcSignal.cpp:166
NewEagle::DbcSignal::_gain
double _gain
Definition: DbcSignal.h:157
NewEagle::DbcSignal::_offset
double _offset
Definition: DbcSignal.h:158
NewEagle::DbcSignal::_comment
NewEagle::DbcSignalComment _comment
Definition: DbcSignal.h:164
NewEagle::DbcSignal::_name
std::string _name
Definition: DbcSignal.h:163
NewEagle::DbcSignal::_startBit
uint8_t _startBit
Definition: DbcSignal.h:159
NewEagle::DbcSignal::GetInitialValue
double GetInitialValue()
Definition: DbcSignal.cpp:180
NewEagle::DbcSignal::GetMultiplexerSwitch
int32_t GetMultiplexerSwitch() const
Definition: DbcSignal.cpp:200


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