diff --git a/README.md b/README.md index 2a7a7a8..c92c230 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,22 @@ -# dbclib -C++ library that parses CAN DBC files. Under development. +# DBC Library version 1.0 + +## Summary + +The DBC library repository include a **C++ Library** that parses CAN database files (DBC) and a simple **DBC +Viewer**. The release 1.0 of the project support reading of DBC file. The DBC viewer can also read in MDF +CAN logger files and view its data. + +## Building + +The project uses CMAKE for building. The following third-party libraries are used and +needs to be downloaded and pre-built. + +- Boost Library. Required for the GUI applications. +- Flex and Bison. Required for the C++ library. +- WxWidgets Library. Required if the GUI applications should be built. +- Doxygen's application. Is required if the documentation should be built. +- Google Test Library. Is required for running and build the unit tests. + +## License + +The project uses the MIT license. See external LICENSE file in project root. diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..f40fbd8 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,5 @@ +_site +.sass-cache +.jekyll-cache +.jekyll-metadata +vendor diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..086a5c9 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,25 @@ +--- +permalink: /404.html +layout: default +--- + + + +
Page not found :(
+The requested page could not be found.
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
▼Ndbc | Main namespace for the DBC library |
CAttribute | Support class for handling attributes of network objects |
CDbcFile | Main user object that is an interface against a DBC file |
CDbcMessage | Wrapper class around a CAN message |
CEnvVar | Wrapper around an environment DBC variable |
CExtendedMux | Support function for the extended multiplexor functionality |
CISampleObserver | Interface that handles samples. Internal usage |
CMessage | DBC message configuration object |
CNetwork | Interface against a DBC network configuration |
CNode | Interface against a DBC node which normally is an ECU |
CSignal | Interface against a DBC signal configuration |
CSignalGroup | Interface against a signal group |
CSignalObserver | The sample observer hold a number of samples |
CSignalValue | Support function that holds the channel value for a signal |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
All DBC network objects may have attributes attached to them. +More...
+#include <string>
#include <vector>
#include <sstream>
Go to the source code of this file.
++Classes | |
class | dbc::Attribute |
Support class for handling attributes of network objects. More... | |
+Namespaces | |
namespace | dbc |
Main namespace for the DBC library. | |
+Enumerations | |
enum class | dbc::AttributeType : int { + dbc::DbcNetwork +, dbc::DbcNode +, dbc::DbcMessage +, dbc::DbcSignal +, + dbc::EnvironmentVariable +, dbc::NodeSignalRelation +, dbc::NodeMessageRelation + + } |
Define what type of network object the attribute is valid for. More... | |
enum class | dbc::AttributeValueType : int { + dbc::IntegerValue +, dbc::FloatValue +, dbc::StringValue +, dbc::EnumValue +, + dbc::HexValue + + } |
Data type of the attribute. More... | |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::Attribute, including all inherited members.
+Attribute(AttributeType type, const std::string &name) | dbc::Attribute | |
EnumList(const std::vector< std::string > &list) | dbc::Attribute | |
EnumList() const | dbc::Attribute | |
Max(double max) | dbc::Attribute | inline |
Max() const | dbc::Attribute | inline |
Min(double min) | dbc::Attribute | inline |
Min() const | dbc::Attribute | inline |
Name(const std::string &name) | dbc::Attribute | inline |
Name() const | dbc::Attribute | inline |
Type(AttributeType type) | dbc::Attribute | inline |
Type() const | dbc::Attribute | inline |
Value(const T &value) | dbc::Attribute | |
Value() const | dbc::Attribute | |
Value(const std::string &value) | dbc::Attribute | |
Value() const | dbc::Attribute | |
ValueType(AttributeValueType type) | dbc::Attribute | inline |
ValueType() const | dbc::Attribute | inline |
ValueTypeAsString() const | dbc::Attribute |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Support class for handling attributes of network objects. + More...
+ +#include <attribute.h>
+Public Member Functions | |
+ | Attribute (AttributeType type, const std::string &name) |
Constructor for an attribute or definition. | |
+void | Name (const std::string &name) |
Sets the name of the attribute. | |
+const std::string & | Name () const |
Retuns the attribute name. | |
+void | Type (AttributeType type) |
Sets the type of attribute. | |
+AttributeType | Type () const |
Return type of attribute. | |
+void | ValueType (AttributeValueType type) |
Sets the attribute data type. | |
+AttributeValueType | ValueType () const |
Returns the attribute data type. | |
+std::string | ValueTypeAsString () const |
Returns the attribute data type as string. | |
+void | Min (double min) |
Sets the min range. | |
+double | Min () const |
Min range. | |
+void | Max (double max) |
Sets the max range. | |
+double | Max () const |
Max range. | |
+void | EnumList (const std::vector< std::string > &list) |
Sets an enumerate string list. | |
+const std::vector< std::string > & | EnumList () const |
Returns an enumerated string list. | |
+template<typename T > | |
void | Value (const T &value) |
Sets the attribute value. | |
+template<typename T > | |
T | Value () const |
Returns the attribute value. | |
+template<> | |
void | Value (const std::string &value) |
Sets an attribute string value. | |
+template<> | |
std::string | Value () const |
Returns an attribute string value. | |
The Attribute class is a support class for handling attributes attached to DBC objects.
+The DBC file first specify a definition of an attribute. This definition defines range and data type i.e. a sort of template.
+Then the DBC file define the attribute that references a definition and has a value (constant).
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::DbcFile, including all inherited members.
+AddMessage(size_t index, const DbcMessage &message) | dbc::DbcFile | |
BaseTime(uint64_t ns1970) | dbc::DbcFile | inline |
BaseTime() const | dbc::DbcFile | inline |
Filename(const std::string &filename) | dbc::DbcFile | inline |
Filename() const | dbc::DbcFile | inline |
GetNetwork() | dbc::DbcFile | inline |
GetNetwork() const | dbc::DbcFile | inline |
LastError() const | dbc::DbcFile | inline |
Name() const | dbc::DbcFile | |
ParseFile() | dbc::DbcFile | |
ParseMessage(const DbcMessage &message) | dbc::DbcFile | |
ReparseMessageList() | dbc::DbcFile | |
ResetSampleCounter() const | dbc::DbcFile | |
SetMessageSize(size_t nof_messages) | dbc::DbcFile |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Main user object that is an interface against a DBC file. + More...
+ +#include <dbcfile.h>
+Public Member Functions | |
+void | Filename (const std::string &filename) |
Sets the file name. Full path required. | |
+const std::string & | Filename () const |
Returns the file name with full path. | |
+std::string | Name () const |
Returns the File name without path and extension. | |
+const std::string & | LastError () const |
Returns the last (parser) error text. | |
+Network * | GetNetwork () |
Returns the network object. | |
+const Network * | GetNetwork () const |
Returns the network object. | |
+bool | ParseFile () |
Parses the DBC file. Returns true on success. | |
void | BaseTime (uint64_t ns1970) |
Start time of messages. | |
+uint64_t | BaseTime () const |
Returns the base (start) time of first message. | |
+void | SetMessageSize (size_t nof_messages) |
Sets the maximum message queue size. | |
+void | AddMessage (size_t index, const DbcMessage &message) |
Adds q message to the message queue. | |
+bool | ParseMessage (const DbcMessage &message) |
Parses the message into signal values. | |
+void | ResetSampleCounter () const |
Resets the sample counter for all signals. | |
void | ReparseMessageList () |
Reparse the message queue. | |
The DBC file is the only object the user shall create. It handle the parsing of the file. A DBC file defines nodes, messages and signals for one CAN network.
+
+
|
+ +inline | +
The base time is the time of the first message. If not set, the AddMessage will set it to the first DBCMessage.
ns1970 | Nano-seconds since 1970. |
void dbc::DbcFile::ReparseMessageList | +( | +) | ++ |
This function is used to reparse the message queue. This function is used when the first parse message round just count number of samples while the next round, the user selects signals (SignalObserver) and reparse the message queue.
+ +
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::DbcMessage, including all inherited members.
+CanId(uint32_t can_id) | dbc::DbcMessage | inline |
CanId() const | dbc::DbcMessage | inline |
Data(const std::vector< uint8_t > &data) | dbc::DbcMessage | inline |
Data() const | dbc::DbcMessage | inline |
DataPage() const | dbc::DbcMessage | |
DbcMessage()=default | dbc::DbcMessage | |
DbcMessage(uint64_t time, uint32_t can_id, std::vector< uint8_t > data) | dbc::DbcMessage | |
DbcMessage(const DbcMessage &message)=default | dbc::DbcMessage | |
ExtendedDataPage() const | dbc::DbcMessage | |
PduFormat() const | dbc::DbcMessage | |
PduSpecific() const | dbc::DbcMessage | |
Pgn() const | dbc::DbcMessage | |
Priority() const | dbc::DbcMessage | |
Source() const | dbc::DbcMessage | |
Time(uint64_t ns1970) | dbc::DbcMessage | inline |
Time() const | dbc::DbcMessage | inline |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Wrapper class around a CAN message. + More...
+ +#include <dbcmessage.h>
+Public Member Functions | |
+ | DbcMessage ()=default |
Default constructor. | |
DbcMessage (uint64_t time, uint32_t can_id, std::vector< uint8_t > data) | |
Constructor that wraps a CAN message. | |
+ | DbcMessage (const DbcMessage &message)=default |
Default destructor. | |
+void | Time (uint64_t ns1970) |
Sets the time. | |
+uint64_t | Time () const |
Message time. | |
+void | CanId (uint32_t can_id) |
Sets the CAN ID. | |
+uint32_t | CanId () const |
CAN ID. | |
+void | Data (const std::vector< uint8_t > &data) |
Sets the CAN data bytes. | |
+const std::vector< uint8_t > & | Data () const |
Returns the CAN data bytes. | |
+uint32_t | Pgn () const |
PGN Program number. | |
+uint8_t | Priority () const |
Priority (0-8) | |
+bool | ExtendedDataPage () const |
True if extended data page. | |
+bool | DataPage () const |
True if data page. | |
+uint8_t | PduFormat () const |
PDU format. | |
+uint8_t | PduSpecific () const |
PDU specific. | |
+uint8_t | Source () const |
Source number. | |
Simple support class that holds a CAN message. CAN message has a time, ID and none or more data bytes. This sound simple but there are several protocols on top of CAN that treat the CAN ID and its data bytes differently.
+dbc::DbcMessage::DbcMessage | +( | +uint64_t | +time, | +
+ | + | uint32_t | +can_id, | +
+ | + | std::vector< uint8_t > | +data | +
+ | ) | ++ |
Constructor that wraps a CAN message.
time | Nano-seconds since 1970. |
can_id | 11/29-bit CAN ID. |
data | CAN data bytes. |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::EnvVar, including all inherited members.
+Access(AccessType type) | dbc::EnvVar | inline |
Access() const | dbc::EnvVar | inline |
Comment(const std::string &comment) | dbc::EnvVar | inline |
Comment() const | dbc::EnvVar | inline |
EnumList(const std::map< int64_t, std::string > &enum_list) | dbc::EnvVar | |
EnumList() const | dbc::EnvVar | |
Ident(uint64_t ident) | dbc::EnvVar | inline |
Ident() const | dbc::EnvVar | inline |
InitValue(double value) | dbc::EnvVar | inline |
InitValue() const | dbc::EnvVar | inline |
Max(double max) | dbc::EnvVar | inline |
Max() const | dbc::EnvVar | inline |
Min(double min) | dbc::EnvVar | inline |
Min() const | dbc::EnvVar | inline |
Name(const std::string &name) | dbc::EnvVar | inline |
Name() const | dbc::EnvVar | inline |
NodeList(const std::vector< std::string > &node_list) | dbc::EnvVar | inline |
NodeList() const | dbc::EnvVar | inline |
Type(EnvType type) | dbc::EnvVar | inline |
Type() const | dbc::EnvVar | inline |
TypeAsString() const | dbc::EnvVar | |
Unit(const std::string &unit) | dbc::EnvVar | inline |
Unit() const | dbc::EnvVar | inline |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Wrapper around an environment DBC variable. +
+ +#include <envvar.h>
+Public Member Functions | |
+void | Name (const std::string &name) |
Sets the name. | |
+const std::string & | Name () const |
Retuns the name. | |
+void | Comment (const std::string &comment) |
Sets the descriptive text. | |
+const std::string & | Comment () const |
Return the descriptive text. | |
+void | Type (EnvType type) |
Sets the data type. | |
+EnvType | Type () const |
Returns the data type. | |
+std::string | TypeAsString () const |
Returns the data type as string. | |
+void | Min (double min) |
Sets the min range. | |
+double | Min () const |
Min range. | |
+void | Max (double max) |
Sets the max range. | |
+double | Max () const |
Max range. | |
+void | Unit (const std::string &unit) |
Sets the unit. | |
+const std::string & | Unit () const |
Unit. | |
+void | InitValue (double value) |
Sets the initial value. | |
+double | InitValue () const |
Returns the initial value. | |
+void | Ident (uint64_t ident) |
Sets the identity. | |
+uint64_t | Ident () const |
Identity. | |
+void | Access (AccessType type) |
Sets the access. | |
+AccessType | Access () const |
Access. | |
+void | NodeList (const std::vector< std::string > &node_list) |
Sets the node list. | |
+const std::vector< std::string > & | NodeList () const |
Returns the node list. | |
+void | EnumList (const std::map< int64_t, std::string > &enum_list) |
Sets the enumerate list. | |
+const std::map< int64_t, std::string > & | EnumList () const |
Returns the node list. | |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::ISampleObserver, including all inherited members.
+DetachObserver()=0 | dbc::ISampleObserver | pure virtual |
ISampleObserver()=default | dbc::ISampleObserver | |
OnSample()=0 | dbc::ISampleObserver | pure virtual |
~ISampleObserver()=default | dbc::ISampleObserver | virtual |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Interface that handles samples. Internal usage. +
+ +#include <isampleobserver.h>
+Public Member Functions | |
+ | ISampleObserver ()=default |
Default constructor. | |
+virtual | ~ISampleObserver ()=default |
Default destructor. | |
virtual void | OnSample ()=0 |
Handle a sample. | |
virtual void | DetachObserver ()=0 |
Detach the observer object. | |
+
|
+ +pure virtual | +
Implemented in dbc::SignalObserver.
+ +
+
|
+ +pure virtual | +
Implemented in dbc::SignalObserver.
+ +
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::Message, including all inherited members.
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
DBC message configuration object. +
+ +#include <message.h>
+Public Member Functions | |
void | Ident (uint64_t ident) |
uint64_t | Ident () const |
+bool | IsExtended () const |
True if 29-bit ID. | |
+bool | IsJ1939 () const |
True if it is a J1939 message. | |
+uint32_t | CanId () const |
Returns CAN ID. | |
+uint8_t | Priority () const |
J1939 Priority. | |
+uint32_t | Pgn () const |
J1939 PGN. | |
+uint8_t | Source () const |
J1939 Source. | |
+bool | ExtendedDataPage () const |
J1938 Data Page Flag. | |
+bool | DataPage () const |
J1938 Data Page Flag. | |
+uint8_t | PduFormat () const |
J1939 PF. | |
+uint8_t | PduSpecific () const |
J1939 PS. | |
+bool | IsPdu1 () const |
True if PDU1. | |
+bool | IsPdu2 () const |
True if PDU2. | |
+void | Name (const std::string &name) |
Sets the message name. | |
+const std::string & | Name () const |
Returns the message name. | |
+void | Comment (const std::string &comment) |
Sets the descriptive text. | |
+const std::string & | Comment () const |
Returns the descriptive text. | |
+void | NofBytes (size_t bytes) |
Sets the number of bytes. | |
+size_t | NofBytes () const |
Returns the number of bytes. | |
+void | Node (const std::string &node) |
Sets a node name. | |
+std::string | NodeName () const |
Returns the node name. | |
+Signal * | GetSignal (const std::string &name) |
Returns a signal by its name. | |
+const Signal * | GetSignal (const std::string &name) const |
Returns a signal by its name. | |
+Signal * | GetMultiplexor () |
Returns the multiplexer signal object. | |
+const Attribute * | GetAttribute (const std::string &name) const |
Returns an attribute by its name. | |
+const SignalList & | Signals () const |
Returns the signal list. | |
+const std::vector< std::string > & | Senders () const |
Returns a list of sender names. | |
+const std::vector< Attribute > & | Attributes () const |
Returns a list of attributes. | |
+bool | IsNodeSender (const std::string &node_name) const |
Returns true if the node is a sender. | |
+const std::vector< uint8_t > & | Data () const |
Returns the last message data buffer. | |
bool | UpdateData (const std::vector< uint8_t > &message, size_t offset=0, size_t data_index=0) |
Update the internal data buffer. | |
+void | ParseMessage (uint64_t ns1970, uint32_t can_id) |
Parses the message. Internal usage. | |
+void | ResetSequenceNumber () |
Reset the internal sequence counter. | |
+uint8_t | NextSequenceNumber () const |
Returns the next sequence number. | |
+void | ResetSampleCounter () const |
Reset the sample counters. | |
+void | StepSampleCounter () const |
Increments the internal sample counters. | |
+size_t | SampleCounter () const |
Returns number of samples. | |
+Attribute & | CreateAttribute (const Attribute &definition) |
Creates an attributes by using its definition. | |
+Signal & | CreateSignal (const std::string &name) |
Create a new signal by its name. | |
+
|
+ +inline | +
< Returns the message ID.
+ +
+
|
+ +inline | +
< Sets the message ID (29-bit)
+ +bool dbc::Message::UpdateData | +( | +const std::vector< uint8_t > & | +message, | +
+ | + | size_t | +offset = 0 , |
+
+ | + | size_t | +data_index = 0 |
+
+ | ) | ++ |
Sets the internal last message data buffer. Note that the input offset and destination offset is used if the message requires more than one CAN data message before it is complete.
+message | Message data. |
offset | Offset in the message data buffer (input index). |
data_index | Offset in the last message data buffer (dest index). |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::Network, including all inherited members.
+AddSignalGroup(const SignalGroup &group) | dbc::Network | |
AddValueTable(const std::string &name, const EnumMap &list) | dbc::Network | |
Attributes() const | dbc::Network | inline |
Bus(BusType type) | dbc::Network | |
Bus() const | dbc::Network | |
BusAsString() const | dbc::Network | |
Comment(const std::string &comment) | dbc::Network | inline |
Comment() const | dbc::Network | inline |
CreateAttribute(const Attribute &definition) | dbc::Network | |
CreateDefinition(const std::string &name) | dbc::Network | |
CreateMessage(uint64_t message_id) | dbc::Network | |
CreateNode(const std::string &name) | dbc::Network | |
Enums() const | dbc::Network | inline |
EnvVars() const | dbc::Network | inline |
Filename(const std::string &filename) | dbc::Network | inline |
Filename() const | dbc::Network | inline |
GetAttribute(const std::string &name) | dbc::Network | |
GetAttribute(const std::string &name) const | dbc::Network | |
GetEnvVar(const std::string &name) | dbc::Network | |
GetMessage(uint64_t message_id) | dbc::Network | |
GetMessage(uint64_t message_id) const | dbc::Network | |
GetMessageByCanId(uint64_t can_id) | dbc::Network | |
GetMessageByCanId(uint64_t can_id) const | dbc::Network | |
GetMessageByName(const std::string &name) const | dbc::Network | |
GetMessageByPgn(uint32_t pgn) | dbc::Network | |
GetMessageByPgnAndSource(uint32_t pgn, uint8_t source) | dbc::Network | |
GetNode(const std::string &name) | dbc::Network | |
GetNode(const std::string &name) const | dbc::Network | |
GetNodeBySource(uint8_t source) const | dbc::Network | |
GetSignal(uint64_t message_id, const std::string &signal_name) | dbc::Network | |
GetSignal(uint64_t message_id, const std::string &signal_name) const | dbc::Network | |
GetSignalByCanId(uint64_t can_id, const std::string &signal_name) const | dbc::Network | |
GetSignalByName(const std::string &signal_name) const | dbc::Network | |
GetSignalGroup(uint64_t message_id, const std::string &name) const | dbc::Network | |
GetSignalGroupByName(const std::string &name) const | dbc::Network | |
J1939(bool j1939) | dbc::Network | inline |
J1939() const | dbc::Network | inline |
LastMessage() | dbc::Network | |
Messages() const | dbc::Network | inline |
Name() const | dbc::Network | |
Nodes() const | dbc::Network | inline |
Protocol(ProtocolType type) | dbc::Network | |
Protocol() const | dbc::Network | |
ProtocolAsString() const | dbc::Network | |
SignalGroups() const | dbc::Network | inline |
Version(const std::string &version) | dbc::Network | inline |
Version() const | dbc::Network | inline |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Interface against a DBC network configuration. +
+ +#include <network.h>
+Public Member Functions | |
+std::string | Name () const |
Network name. | |
+void | Filename (const std::string &filename) |
Sets the file name. | |
+std::string | Filename () const |
Returns the file name. | |
void | Protocol (ProtocolType type) |
Sets the protocol type. Should be included in the file but sometimes is missing. | |
+ProtocolType | Protocol () const |
Returns what type of protocol the bus is using. | |
+std::string | ProtocolAsString () const |
Returns the network protocol as text. | |
+void | Bus (BusType type) |
Sets the type of bus. | |
+BusType | Bus () const |
Returns the type of bus. | |
+std::string | BusAsString () const |
Returns the type of bus as text. | |
+void | Version (const std::string &version) |
Sets the DBC (file) version. | |
+const std::string & | Version () const |
Returns the DBC file version. | |
+void | Comment (const std::string &comment) |
Sets the descriptive text for the DBC file. | |
+const std::string & | Comment () const |
Returns the desciptive text. | |
+Node * | GetNode (const std::string &name) |
Returns the node by its name. | |
+const Node * | GetNode (const std::string &name) const |
Returns the node by its name. | |
+const Node * | GetNodeBySource (uint8_t source) const |
Returns the node by its source number. | |
+void | J1939 (bool j1939) |
Set to true if this is a J1939 bus. | |
+bool | J1939 () const |
Returns true if this is a J1939 bus. | |
+Message * | GetMessage (uint64_t message_id) |
Returns a message object by its message ID. | |
+const Message * | GetMessage (uint64_t message_id) const |
Returns a message object by its message ID. | |
+Message * | GetMessageByCanId (uint64_t can_id) |
Returns a message object by its CAN ID. | |
+const Message * | GetMessageByCanId (uint64_t can_id) const |
Returns a message object by its CAN ID. | |
+const Message * | GetMessageByName (const std::string &name) const |
Returns a message object by its name. | |
+Message * | GetMessageByPgn (uint32_t pgn) |
Returns a message object by its PGN. | |
+Message * | GetMessageByPgnAndSource (uint32_t pgn, uint8_t source) |
Returns a message object by its PGN and source number. | |
+Signal * | GetSignal (uint64_t message_id, const std::string &signal_name) |
Returns a signal by its message ID and signal name. | |
+const Signal * | GetSignal (uint64_t message_id, const std::string &signal_name) const |
Returns a signal by its message ID and signal name. | |
+const Signal * | GetSignalByCanId (uint64_t can_id, const std::string &signal_name) const |
Returns a signal by its CAN ID and signal name. | |
+const Signal * | GetSignalByName (const std::string &signal_name) const |
Returns a signal by its name. | |
+const SignalGroup * | GetSignalGroup (uint64_t message_id, const std::string &name) const |
Returns a signal group by its message ID and group name. | |
+const SignalGroup * | GetSignalGroupByName (const std::string &name) const |
Returns a signal group by its group name. | |
+const std::map< std::string, EnvVar > & | EnvVars () const |
Returns the list of environment variables. | |
+const MessageList & | Messages () const |
Returns the list of messages. | |
+const std::map< std::string, Node > & | Nodes () const |
Returns the list of Nodes. | |
+const std::vector< SignalGroup > & | SignalGroups () const |
Returns the list of signal groups. | |
+const std::map< std::string, EnumMap > & | Enums () const |
Returns the list of enumerates. | |
+const std::vector< Attribute > & | Attributes () const |
Returns the list of attributes. | |
+Attribute * | GetAttribute (const std::string &name) |
Returns an attribute by its name. | |
+const Attribute * | GetAttribute (const std::string &name) const |
Returns an attribute by its name. | |
+void | AddValueTable (const std::string &name, const EnumMap &list) |
Adds a enumerate. | |
+void | AddSignalGroup (const SignalGroup &group) |
Adds a signal group. | |
+EnvVar & | GetEnvVar (const std::string &name) |
Parser function that gets/creates an environment variable. | |
+Node & | CreateNode (const std::string &name) |
Parser function that creates a node. | |
+Attribute & | CreateDefinition (const std::string &name) |
Parser function that creates a definition. | |
+Attribute & | CreateAttribute (const Attribute &definition) |
Parser function that creates an attribute. | |
+Message & | CreateMessage (uint64_t message_id) |
Parser function that creates a message. | |
+Message * | LastMessage () |
Returns the last message. | |
void dbc::Network::Protocol | +( | +ProtocolType | +type | ) | ++ |
type | Type of protocol. |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::Node, including all inherited members.
+Attributes() const | dbc::Node | inline |
Comment(const std::string &comment) | dbc::Node | inline |
Comment() const | dbc::Node | inline |
CreateAttribute(const Attribute &definition) | dbc::Node | |
GetAttribute(const std::string &name) const | dbc::Node | |
Name(const std::string &name) | dbc::Node | inline |
Name() const | dbc::Node | inline |
Source(uint8_t source) | dbc::Node | inline |
Source() const | dbc::Node |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Interface against a DBC node which normally is an ECU. + More...
+ +#include <node.h>
+Public Member Functions | |
+void | Name (const std::string &name) |
Sets the name. | |
+const std::string & | Name () const |
Returns the name. | |
+void | Source (uint8_t source) |
Source number is used in J1939 and is included in the CAN ID. | |
+uint8_t | Source () const |
Source number (J1939). | |
+void | Comment (const std::string &comment) |
Sets the descriptive text. | |
+const std::string & | Comment () const |
Returns the descriptive text. | |
+const std::vector< Attribute > & | Attributes () const |
Returns the attribute list. | |
+Attribute & | CreateAttribute (const Attribute &definition) |
Creates an attribute. Parser function. | |
+const Attribute * | GetAttribute (const std::string &name) const |
Returns an attribute by its name. | |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::Signal, including all inherited members.
+AttachObserver(ISampleObserver *observer) const | dbc::Signal | |
Attributes() const | dbc::Signal | inline |
BitLength(size_t length) | dbc::Signal | inline |
BitLength() const | dbc::Signal | inline |
BitStart(size_t start) | dbc::Signal | inline |
BitStart() const | dbc::Signal | inline |
ChannelValue(T &value) const | dbc::Signal | |
ChannelValue(std::string &value) const | dbc::Signal | |
ChannelValue(SignalValue &value) const | dbc::Signal | |
Comment(const std::string &comment) | dbc::Signal | inline |
Comment() const | dbc::Signal | inline |
CreateAttribute(const Attribute &definition) | dbc::Signal | |
DataType(SignalDataType type) | dbc::Signal | inline |
DataType() const | dbc::Signal | inline |
DataTypeAsString() const | dbc::Signal | |
DetachObserver(const ISampleObserver *observer) const | dbc::Signal | |
EngValue(T &value) const | dbc::Signal | |
EngValue(std::string &value) const | dbc::Signal | |
EnumList(const std::map< int64_t, std::string > &enum_list) | dbc::Signal | |
EnumList() const | dbc::Signal | |
GetEnumString(int64_t index) const | dbc::Signal | |
GetExtendedMux() | dbc::Signal | |
IsMultiplexed() const | dbc::Signal | |
LittleEndian(bool endian) | dbc::Signal | inline |
LittleEndian() const | dbc::Signal | inline |
Max(double max) | dbc::Signal | inline |
Max() const | dbc::Signal | inline |
MessageId(uint64_t message_id) | dbc::Signal | inline |
MessageId() const | dbc::Signal | inline |
Min(double min) | dbc::Signal | inline |
Min() const | dbc::Signal | inline |
Mux(MuxType type) | dbc::Signal | inline |
Mux() const | dbc::Signal | inline |
MuxAsString() const | dbc::Signal | |
MuxValue(int value) | dbc::Signal | inline |
MuxValue() const | dbc::Signal | inline |
Name(const std::string &name) | dbc::Signal | inline |
Name() const | dbc::Signal | inline |
Offset(double offset) | dbc::Signal | inline |
Offset() const | dbc::Signal | inline |
ParseMessage(const std::vector< uint8_t > &message, uint64_t ns1970, uint32_t can_id) | dbc::Signal | |
Receivers(const std::vector< std::string > &receiver_list) | dbc::Signal | |
Receivers() const | dbc::Signal | |
ResetSampleCounter() const | dbc::Signal | inline |
SampleCanId(uint32_t can_id) | dbc::Signal | inline |
SampleCanId() const | dbc::Signal | inline |
SampleCounter() const | dbc::Signal | inline |
SampleTime(uint64_t ns1970) | dbc::Signal | inline |
SampleTime() const | dbc::Signal | inline |
Scale(double scale) | dbc::Signal | inline |
Scale() const | dbc::Signal | inline |
StepSampleCounter() const | dbc::Signal | inline |
Unit(const std::string &unit) | dbc::Signal | inline |
Unit() const | dbc::Signal | inline |
Valid(bool valid) | dbc::Signal | inline |
Valid() const | dbc::Signal | inline |
~Signal() | dbc::Signal | virtual |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Interface against a DBC signal configuration. + More...
+ +#include <signal.h>
+Public Member Functions | |
+virtual | ~Signal () |
Destructor. | |
+void | Name (const std::string &name) |
Sets the signal name. | |
+const std::string & | Name () const |
Returns the signal name. | |
+void | Unit (const std::string &unit) |
Sets the unit of measure. | |
+const std::string & | Unit () const |
Returns the unit of measure. | |
+void | Comment (const std::string &comment) |
Sets the descriptive text. | |
+const std::string & | Comment () const |
Returns the descriptive text. | |
+void | DataType (SignalDataType type) |
Sets the data type. | |
+SignalDataType | DataType () const |
Returns the data type. | |
+std::string | DataTypeAsString () const |
Returns the data type as text. | |
+void | Mux (MuxType type) |
Sets the multiplexer type. | |
+MuxType | Mux () const |
Returns the multiplexer type. | |
+std::string | MuxAsString () const |
Returns the multiplexer type as text. | |
+void | MuxValue (int value) |
Sets the multiplexor value. | |
+int | MuxValue () const |
Returns the multiplexor value. | |
+void | BitStart (size_t start) |
Sets the start bit. | |
+size_t | BitStart () const |
Returns the start bit. | |
+void | BitLength (size_t length) |
Sets the bit length. | |
+size_t | BitLength () const |
Returns the bit length. | |
+void | LittleEndian (bool endian) |
Set true if little endian byte order. | |
+bool | LittleEndian () const |
Return true if little endian byte order. | |
+void | Scale (double scale) |
Sets the scaling constant. | |
+double | Scale () const |
Scaling constant. | |
+void | Offset (double offset) |
Sets the offset. | |
+double | Offset () const |
Return offset. | |
+void | Min (double min) |
Sets min range. | |
+double | Min () const |
Min range. | |
+void | Max (double max) |
Sets the max range. | |
+double | Max () const |
Max range. | |
+void | EnumList (const std::map< int64_t, std::string > &enum_list) |
Sets the enumeration. | |
+const std::map< int64_t, std::string > & | EnumList () const |
Returns the enumeration. | |
+void | Receivers (const std::vector< std::string > &receiver_list) |
Sets the receiver list. | |
+const std::vector< std::string > & | Receivers () const |
Return the receiver list. | |
+const std::vector< Attribute > & | Attributes () const |
Returns the attribute list. | |
+void | MessageId (uint64_t message_id) |
Sets the signals message ID. | |
+uint64_t | MessageId () const |
Returns the message ID that the signal belongs to. | |
+bool | IsMultiplexed () const |
True if multiplexed signal. | |
+Attribute & | CreateAttribute (const Attribute &definition) |
Creates an attribute. | |
+ExtendedMux & | GetExtendedMux () |
Creates an extended multiplexor struct. | |
+std::string | GetEnumString (int64_t index) const |
Returns the enumerate text for an index. | |
+void | ParseMessage (const std::vector< uint8_t > &message, uint64_t ns1970, uint32_t can_id) |
Parse out the signal value from a message data buffer. | |
+void | ResetSampleCounter () const |
Resets the sample counter. | |
+void | StepSampleCounter () const |
Steps the sample counter. | |
+size_t | SampleCounter () const |
Returns the sample counter. | |
+void | SampleTime (uint64_t ns1970) |
Sets the sample time. | |
+uint64_t | SampleTime () const |
Returns the sample time. | |
+void | SampleCanId (uint32_t can_id) |
Sets the CAN ID for the sample. | |
+uint64_t | SampleCanId () const |
Returns the CAN ID for latest sample. | |
+void | Valid (bool valid) |
Set to true if valid value. | |
+bool | Valid () const |
Trie if value is valid. | |
+template<typename T > | |
bool | ChannelValue (T &value) const |
Returns the channel value. | |
+template<typename T > | |
bool | EngValue (T &value) const |
Returns the scaled engineering value. | |
+void | AttachObserver (ISampleObserver *observer) const |
Attach a sample observer. | |
+void | DetachObserver (const ISampleObserver *observer) const |
Detach a sample observer. | |
+template<> | |
bool | ChannelValue (std::string &value) const |
Returns the signal value as a string. | |
+template<> | |
bool | ChannelValue (SignalValue &value) const |
Returns the signal value as a signal value. | |
+template<> | |
bool | EngValue (std::string &value) const |
Returns the engineering value as a string value. | |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::SignalGroup, including all inherited members.
+MessageId(uint64_t message_id) | dbc::SignalGroup | inline |
MessageId() const | dbc::SignalGroup | inline |
Name(const std::string &name) | dbc::SignalGroup | inline |
Name() const | dbc::SignalGroup | inline |
Repetition(size_t rep) | dbc::SignalGroup | inline |
Repetition() const | dbc::SignalGroup | inline |
Signals(const std::vector< std::string > &signals) | dbc::SignalGroup | |
Signals() const | dbc::SignalGroup |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Interface against a signal group. +
+ +#include <signalgroup.h>
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This is the complete list of members for dbc::SignalObserver, including all inherited members.
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
The sample observer hold a number of samples. + More...
+ +#include <signalobserver.h>
+Public Member Functions | |
+ | SignalObserver (const Signal &signal) |
Constructor. | |
+ | SignalObserver ()=delete |
Default constructor. | |
+ | ~SignalObserver () override |
Default destructor. | |
+void | MaxSamples (size_t max_nof_samples) |
Sets the maximum number of samples. | |
+size_t | MaxSamples () const |
Returns the max number of samples. | |
+const Signal & | GetSignal () const |
Returns the signal object. | |
+uint64_t | Time (size_t index) const |
Returns the absolute time for a sample. | |
+uint32_t | CanId (size_t index) const |
Returns the CAN ID for a sample. | |
template<typename V > | |
bool | ChannelValue (size_t index, uint64_t &ns1970, V &value) const |
Returns the unscaled signal value. | |
template<typename V > | |
bool | EngValue (size_t index, uint64_t &ns1970, V &value) const |
Returns the scaled signal value. | |
+void | ResetSampleIndex () |
Reset the sample index. | |
+size_t | FirstIndex () const |
First sample. | |
+size_t | LastIndex () const |
Last sample. | |
+size_t | NofSamples () const |
Returns number of samples. | |
+size_t | NofValidSamples () const |
Returns number of valid samples. | |
+size_t | SampleToIndex (size_t sample) const |
Sample number (0..) to internal index. | |
+std::pair< size_t, bool > | TimeToIndex (uint64_t time) const |
Sample time to internal index. | |
void | DetachObserver () override |
Detach an observer. | |
void | OnSample () override |
On sample callback handler. | |
+template<> | |
bool | ChannelValue (size_t index, uint64_t &ns1970, std::string &value) const |
Returns the unscaled signal value as a string. | |
+template<> | |
bool | EngValue (size_t index, uint64_t &ns1970, std::string &value) const |
Returns the scaled signal value as a string'. | |
Public Member Functions inherited from dbc::ISampleObserver | |
+ | ISampleObserver ()=default |
Default constructor. | |
+virtual | ~ISampleObserver ()=default |
Default destructor. | |
virtual void | OnSample ()=0 |
Handle a sample. | |
virtual void | DetachObserver ()=0 |
Detach the observer object. | |
The observer holds signal values in a circular buffer of a maximum number of samples size. The user shall access the samples in normal sample order i.e the first sample is 0 while the internal circular index might be something else.
+bool dbc::SignalObserver::ChannelValue | +( | +size_t | +index, | +
+ | + | uint64_t & | +ns1970, | +
+ | + | V & | +value | +
+ | ) | +const | +
Returns the unscaled signal value for a specific sample.
V | Value type. |
index | Sample index (0..). |
ns1970 | Sample time nano-seconds since 1970. |
value | Sample value. |
+
|
+ +overridevirtual | +
Implements dbc::ISampleObserver.
+ +bool dbc::SignalObserver::EngValue | +( | +size_t | +index, | +
+ | + | uint64_t & | +ns1970, | +
+ | + | V & | +value | +
+ | ) | +const | +
Returns the scaled signal value for a specific sample.
V | Value type. |
index | Sample index (0..). |
ns1970 | Sample time nano-seconds since 1970. |
value | Sample value. |
+
|
+ +overridevirtual | +
Implements dbc::ISampleObserver.
+ +
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
The DBC file object is the main user object. +More...
+Go to the source code of this file.
++Classes | |
class | dbc::DbcFile |
Main user object that is an interface against a DBC file. More... | |
+Namespaces | |
namespace | dbc |
Main namespace for the DBC library. | |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Wrapper around a CAN message. +More...
+#include <cstdint>
#include <vector>
Go to the source code of this file.
++Classes | |
class | dbc::DbcMessage |
Wrapper class around a CAN message. More... | |
+Namespaces | |
namespace | dbc |
Main namespace for the DBC library. | |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+Files | |
file | attribute.h [code] |
All DBC network objects may have attributes attached to them. | |
file | dbcfile.h [code] |
The DBC file object is the main user object. | |
file | dbcmessage.h [code] |
file | envvar.h [code] |
Wrapper wrong environment variables. | |
file | isampleobserver.h [code] |
Internal object that define an observer interface that handle samples. | |
file | message.h [code] |
file | network.h [code] |
Defines a DBC network configuration object. | |
file | node.h [code] |
Interface against a DBC node (Device(ECU). | |
file | signal.h [code] |
Interface against a DBC signal configuration. | |
file | signalgroup.h [code] |
Defines a signal group. | |
file | signalobserver.h [code] |
The sample observer holds sample values for a signal. | |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+Directories | |
directory | dbc |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Wrapper wrong environment variables. +More...
+#include <cstdint>
#include <string>
#include <vector>
#include <map>
Go to the source code of this file.
++Classes | |
class | dbc::EnvVar |
Wrapper around an environment DBC variable. More... | |
+Namespaces | |
namespace | dbc |
Main namespace for the DBC library. | |
+Enumerations | |
enum class | dbc::EnvType : int { dbc::IntegerType = 0 +, dbc::FloatType = 1 +, dbc::StringType = 2 +, dbc::DataType = 3 + } |
The variable data type. More... | |
enum class | dbc::AccessType : int { dbc::Unrestricted = 0 +, dbc::ReadOnly = 1 +, dbc::WriteOnly = 2 +, dbc::ReadWrite = 3 + } |
Type of access. More... | |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
▼ include | |
▼ dbc | |
attribute.h | All DBC network objects may have attributes attached to them |
dbcfile.h | The DBC file object is the main user object |
dbcmessage.h | Wrapper around a CAN message |
envvar.h | Wrapper wrong environment variables |
isampleobserver.h | Internal object that define an observer interface that handle samples |
message.h | DBC message configuration object |
network.h | Defines a DBC network configuration object |
node.h | Interface against a DBC node (Device(ECU) |
signal.h | Interface against a DBC signal configuration |
signalgroup.h | Defines a signal group |
signalobserver.h | The sample observer holds sample values for a signal |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
This page explains how to interpret the graphs that are generated by doxygen.
+Consider the following example:
This will result in the following graph:
+The boxes in the above graph have the following meaning:
+The arrows have the following meaning:
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Cdbc::Attribute | Support class for handling attributes of network objects |
Cdbc::DbcFile | Main user object that is an interface against a DBC file |
Cdbc::DbcMessage | Wrapper class around a CAN message |
Cdbc::EnvVar | Wrapper around an environment DBC variable |
Cdbc::ExtendedMux | Support function for the extended multiplexor functionality |
▼Cdbc::ISampleObserver | Interface that handles samples. Internal usage |
Cdbc::SignalObserver | The sample observer hold a number of samples |
Cdbc::Message | DBC message configuration object |
Cdbc::Network | Interface against a DBC network configuration |
Cdbc::Node | Interface against a DBC node which normally is an ECU |
Cdbc::Signal | Interface against a DBC signal configuration |
Cdbc::SignalGroup | Interface against a signal group |
Cdbc::SignalValue | Support function that holds the channel value for a signal |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
The DBC C++ library is a C++ interface against CAN DBC files.
+The project consist of the following main components.
+The DBC file defines a CAN network. The network consist of devices (nodes), messages and signals.
+The C++ library can also parse a CAN message into signal values. Additional the library support adding multiple CAN messages into signal sample values.
+
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
+ + |
+ + |
+ + |
+ + |
+ + |
+ + |
+ + |
+ + |
+ + |
+ + |
+ + |
+ + |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+
Internal object that define an observer interface that handle samples. +More...
+#include <cstdint>
Go to the source code of this file.
++Classes | |
class | dbc::ISampleObserver |
Interface that handles samples. Internal usage. More... | |
+Namespaces | |
namespace | dbc |
Main namespace for the DBC library. | |
+ DbcLib 1.0
+
+ CAN DBC C++ library.
+ |
+