YULTek/Otarcik_CAN/Sources/CANMessage.h
2023-01-21 15:31:49 -05:00

49 lines
1.7 KiB
C++

#ifndef CANMESSAGE_H
#define CANMESSAGE_H
#include <QByteArray>
#include <QDataStream>
#include "PCANBasic.h"
#include "CANSignal.h"
#include <QList>
class CCANMessage
{
public:
CCANMessage();
CCANMessage(const CCANMessage &Src);
CCANMessage(const quint32 Channel,const TPCANMsg CANMsg,const TPCANTimestamp CANTimeStamp);
~CCANMessage();
unsigned int mCANChannel;
unsigned int mCANMsgType; // Type of the message, using the PCAN interface driver encoding defined in PCANbasic.h
QByteArray mCANMsgData; // Raw data structure of the message, max size = 8 bytes
quint64 mCANRawDataMotorola, mCANRawDataIntel;
//Database generated message structure
QString mCANMsgName; //Name of message in dbc file
QString mCANMsgComment; //misc comment from database
unsigned int mCANMsgID; // 11/29-bit message identifier from database
quint32 mCANMsgFlags; //Message flags from database
unsigned int mCANMsgLength; // Data Length Code of the message (0..8) from database
QList<CCANSignal*> mSignalsList;
//Timestamp
quint64 mCANMsgMillisecs; // Base-value: milliseconds: 0.. 2^32-1
quint32 mCANMsgMillisecsOverflow; // Roll-arounds of millis
quint32 mCANMsgMicrosecs; // Microseconds: 0..999
CCANMessage &operator=(const CCANMessage *source);
int SetDataFromDriver(quint32 Channel,TPCANMsg CANMsg,TPCANTimestamp CANTimeStamp);
int AddSignal(CCANSignal* NewSignal);
int UpdateValue(CCANMessage* NewDeviceMessage);
};
QDataStream &operator<<(QDataStream &out, const CCANMessage &source);
QDataStream &operator>>(QDataStream &in, CCANMessage &dest);
#endif // CANMESSAGE_H