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

91 lines
1.7 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CANSIGNAL_H
#define CANSIGNAL_H
#include <QtGlobal>
#include <QString>
class CCANSignal
{
public:
enum eCANSignalEncoding
{
CAN_SIGNAL_ENCODING_INTEL = 0,
CAN_SIGNAL_ENCODING_MOTOROLA,
CAN_SIGNAL_ENCODING_INVALID,
CAN_SIGNAL_ENCODING_MAX
};
enum eCANSignalMultiplexing
{
CAN_SIGNAL_MULTIPLEXING_NONE,
CAN_SIGNAL_MULTIPLEXING_SWITCH,
CAN_SIGNAL_MULTIPLEXING_MULTIPLEXED,
CAN_SIGNAL_MULTIPLEXING_MAX
};
enum eCANSIgnalValueType
{
CAN_SIGNAL_TYPE_INVALID,
CAN_SIGNAL_TYPE_SIGNED_INT,
CAN_SIGNAL_TYPE_UNSIGNED_INT,
CAN_SIGNAL_TYPE_32_BIT_FLOAT,
CAN_SIGNAL_TYPE_64_BIT_DOUBLE,
CAN_SIGNAL_TYPE_MAX
};
public:
CCANSignal();
QString mSignalName;
QString mSignalComment;
unsigned int mEncoding;
unsigned int mMultiplexing;
unsigned int mStartBit;
unsigned int mSignalSize;
unsigned int mValueType;
double mValueFactor;
double mValueOffset;
double mMinValue;
double mMaxValue;
QString mSignalUnit;
int ComputeNewSignalValue(quint64 MotorolaValue, quint64 IntelValue);
private:
quint64 mRawValue;
double mPhysicalValue;
};
#endif // CANSIGNAL_H
/*
physical_value = raw_value * factor + offset
raw_value = (physical_value offset) / factor
*/
/*
* Signal: name='_BA_Resp_SW_Ver_Revision', unit=''
qname='IVT-S_all-variations_12082020.IVT_Msg_Response._BA_Resp_SW_Ver_Revision'
comment=''
encoding='Motorola'
representation='Unsigned'
value min=0.00, value max=0.00
scale faktor=1.00, offset=0.00
startbit=24, length=8
*/