Plusieurs développements, dont l'implémentation du endian Intel
This commit is contained in:
parent
48e9ca3f9c
commit
9f79fb6390
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -3,16 +3,16 @@
|
||||
# Generated by qmake (3.1) (Qt 5.14.2)
|
||||
# Project: Otarcik_CAN.pro
|
||||
# Template: app
|
||||
# Command: C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
|
||||
# Command: C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=qtquickcompiler"
|
||||
#############################################################################
|
||||
|
||||
MAKEFILE = Makefile
|
||||
|
||||
EQ = =
|
||||
|
||||
first: debug
|
||||
install: debug-install
|
||||
uninstall: debug-uninstall
|
||||
first: release
|
||||
install: release-install
|
||||
uninstall: release-uninstall
|
||||
QMAKE = C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe
|
||||
DEL_FILE = del
|
||||
CHK_DIR_EXISTS= if not exist
|
||||
@ -37,24 +37,10 @@ RES_FILE =
|
||||
SED = $(QMAKE) -install sed
|
||||
MOVE = move
|
||||
SUBTARGETS = \
|
||||
debug \
|
||||
release
|
||||
release \
|
||||
debug
|
||||
|
||||
|
||||
debug: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug
|
||||
debug-make_first: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug
|
||||
debug-all: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug all
|
||||
debug-clean: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug clean
|
||||
debug-distclean: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug distclean
|
||||
debug-install: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug install
|
||||
debug-uninstall: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug uninstall
|
||||
release: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release
|
||||
release-make_first: FORCE
|
||||
@ -69,6 +55,20 @@ release-install: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release install
|
||||
release-uninstall: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release uninstall
|
||||
debug: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug
|
||||
debug-make_first: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug
|
||||
debug-all: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug all
|
||||
debug-clean: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug clean
|
||||
debug-distclean: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug distclean
|
||||
debug-install: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug install
|
||||
debug-uninstall: FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug uninstall
|
||||
|
||||
Makefile: Otarcik_CAN.pro C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/win32-g++/qmake.conf C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/spec_pre.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/qdevice.pri \
|
||||
@ -237,11 +237,11 @@ Makefile: Otarcik_CAN.pro C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/win32-g++/qma
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resolve_config.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exclusive_builds_post.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/default_post.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qml_debug.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qtquickcompiler.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/precompile_header.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/warn_on.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/moc.prf \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/opengl.prf \
|
||||
@ -262,7 +262,7 @@ Makefile: Otarcik_CAN.pro C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/win32-g++/qma
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Core.prl \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/qtmain.prl \
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/build_pass.prf
|
||||
$(QMAKE) -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
|
||||
$(QMAKE) -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=qtquickcompiler"
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/spec_pre.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/qdevice.pri:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/device_config.prf:
|
||||
@ -430,11 +430,11 @@ C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/default_pre.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resolve_config.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exclusive_builds_post.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/default_post.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qml_debug.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qtquickcompiler.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/precompile_header.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/warn_on.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/moc.prf:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/opengl.prf:
|
||||
@ -456,32 +456,32 @@ C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Core.prl:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/qtmain.prl:
|
||||
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/build_pass.prf:
|
||||
qmake: FORCE
|
||||
@$(QMAKE) -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
|
||||
@$(QMAKE) -o Makefile Otarcik_CAN.pro -spec win32-g++ "CONFIG+=qtquickcompiler"
|
||||
|
||||
qmake_all: FORCE
|
||||
|
||||
make_first: debug-make_first release-make_first FORCE
|
||||
all: debug-all release-all FORCE
|
||||
clean: debug-clean release-clean FORCE
|
||||
distclean: debug-distclean release-distclean FORCE
|
||||
make_first: release-make_first debug-make_first FORCE
|
||||
all: release-all debug-all FORCE
|
||||
clean: release-clean debug-clean FORCE
|
||||
distclean: release-distclean debug-distclean FORCE
|
||||
-$(DEL_FILE) Makefile
|
||||
|
||||
debug-mocclean:
|
||||
$(MAKE) -f $(MAKEFILE).Debug mocclean
|
||||
release-mocclean:
|
||||
$(MAKE) -f $(MAKEFILE).Release mocclean
|
||||
mocclean: debug-mocclean release-mocclean
|
||||
debug-mocclean:
|
||||
$(MAKE) -f $(MAKEFILE).Debug mocclean
|
||||
mocclean: release-mocclean debug-mocclean
|
||||
|
||||
debug-mocables:
|
||||
$(MAKE) -f $(MAKEFILE).Debug mocables
|
||||
release-mocables:
|
||||
$(MAKE) -f $(MAKEFILE).Release mocables
|
||||
mocables: debug-mocables release-mocables
|
||||
debug-mocables:
|
||||
$(MAKE) -f $(MAKEFILE).Debug mocables
|
||||
mocables: release-mocables debug-mocables
|
||||
|
||||
check: first
|
||||
|
||||
benchmark: first
|
||||
FORCE:
|
||||
|
||||
$(MAKEFILE).Debug: Makefile
|
||||
$(MAKEFILE).Release: Makefile
|
||||
$(MAKEFILE).Debug: Makefile
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -52,7 +52,9 @@ SOURCES += Sources/main.cpp \
|
||||
Sources/CloudLogging/CloudParams.cpp \
|
||||
Sources/CloudLogging/MQTTMessage.cpp \
|
||||
Sources/CloudLogging/MQTTClientWrapper.cpp \
|
||||
Sources/Gui/CCANWatchdogSettingsPage.cpp
|
||||
Sources/Gui/CCANWatchdogSettingsPage.cpp \
|
||||
Sources/CANBus/CANWatchdogConfig.cpp \
|
||||
Sources/CANBus/CANWatchdog.cpp
|
||||
|
||||
HEADERS += Sources/MainWindow.h \
|
||||
Sources/PCANInterface.h \
|
||||
@ -76,7 +78,9 @@ HEADERS += Sources/MainWindow.h \
|
||||
Sources/CloudLogging/CloudParams.h \
|
||||
Sources/CloudLogging/MQTTMessage.h \
|
||||
Sources/CloudLogging/MQTTClientWrapper.h \
|
||||
Sources/Gui/CCANWatchdogSettingsPage.h
|
||||
Sources/Gui/CCANWatchdogSettingsPage.h \
|
||||
Sources/CANBus/CANWatchdogConfig.h \
|
||||
Sources/CANBus/CANWatchdog.h
|
||||
|
||||
FORMS += Sources/Gui/MainWindow.ui \
|
||||
Sources/Gui/GeneralStatusPage.ui \
|
||||
|
||||
75
Otarcik_CAN/PCtelemetrie20230601.dbc
Normal file
75
Otarcik_CAN/PCtelemetrie20230601.dbc
Normal file
@ -0,0 +1,75 @@
|
||||
VERSION ""
|
||||
|
||||
|
||||
NS_ :
|
||||
NS_DESC_
|
||||
CM_
|
||||
BA_DEF_
|
||||
BA_
|
||||
VAL_
|
||||
CAT_DEF_
|
||||
CAT_
|
||||
FILTER
|
||||
BA_DEF_DEF_
|
||||
EV_DATA_
|
||||
ENVVAR_DATA_
|
||||
SGTYPE_
|
||||
SGTYPE_VAL_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_SGTYPE_
|
||||
SIG_TYPE_REF_
|
||||
VAL_TABLE_
|
||||
SIG_GROUP_
|
||||
SIG_VALTYPE_
|
||||
SIGTYPE_VALTYPE_
|
||||
BO_TX_BU_
|
||||
BA_DEF_REL_
|
||||
BA_REL_
|
||||
BA_DEF_DEF_REL_
|
||||
BU_SG_REL_
|
||||
BU_EV_REL_
|
||||
BU_BO_REL_
|
||||
SG_MUL_VAL_
|
||||
|
||||
BS_:
|
||||
|
||||
BU_: Parker_watchdog Parker_master PC
|
||||
|
||||
|
||||
BO_ 262 stationESS2: 8 Parker_master
|
||||
SG_ batt4_low_cell_t : 56|8@1- (1,0) [0|0] "°C" Vector__XXX
|
||||
SG_ batt3_low_cell_t : 48|8@1- (1,0) [0|0] "°C" Vector__XXX
|
||||
SG_ batt2_low_cell_t : 40|8@1- (1,0) [0|0] "°C" Vector__XXX
|
||||
SG_ batt1_low_cell_t : 32|8@1- (1,0) [0|0] "°C" Vector__XXX
|
||||
SG_ batt4_high_cell_t : 24|8@1- (1,0) [0|0] "°C" Vector__XXX
|
||||
SG_ batt3_high_cell_t : 16|8@1- (1,0) [0|0] "°C" Vector__XXX
|
||||
SG_ batt2_high_cell_t : 8|8@1- (1,0) [0|0] "°C" Vector__XXX
|
||||
SG_ batt1_high_cell_t : 0|8@1- (1,0) [0|0] "°C" Vector__XXX
|
||||
|
||||
BO_ 768 PC_dateTime: 8 PC
|
||||
|
||||
BO_ 512 WDT_state: 8 Parker_watchdog
|
||||
|
||||
BO_ 277 station_state1: 8 Parker_master
|
||||
|
||||
BO_ 272 station_ver: 8 Parker_master
|
||||
|
||||
BO_ 261 stationESS1: 8 Parker_master
|
||||
SG_ DC_bus_voltage : 48|16@1+ (0.1,0) [0|0] "V" Vector__XXX
|
||||
SG_ summed_ESS_current : 32|16@1- (0.1,0) [0|0] "A" Vector__XXX
|
||||
SG_ SOC_battery4 : 24|8@1+ (0.5,0) [0|127.5] "%" Vector__XXX
|
||||
SG_ SOC_battery3 : 16|8@1+ (0.5,0) [0|127.5] "%" Vector__XXX
|
||||
SG_ SOC_battery2 : 8|8@1+ (0.5,0) [0|127.5] "%" Vector__XXX
|
||||
SG_ SOC_battery1 : 0|8@1+ (0.5,0) [0|127.5] "%" Vector__XXX
|
||||
|
||||
BO_ 256 parker_dateTime: 8 Parker_master
|
||||
SG_ parker_time : 16|16@1+ (0.001,0) [0|0] "h" Vector__XXX
|
||||
SG_ parker_date : 0|16@1+ (1,0) [0|0] "d" Vector__XXX
|
||||
|
||||
|
||||
|
||||
CM_ SG_ 256 parker_time "hours elapsed since midnight, for example 18.25";
|
||||
CM_ SG_ 256 parker_date "number of days that have passed since 1899-12-30";
|
||||
BA_DEF_ "BusType" STRING ;
|
||||
BA_DEF_DEF_ "BusType" "";
|
||||
|
||||
@ -91,7 +91,9 @@ void CCANAnalyzer::CANTimerExpired()
|
||||
{
|
||||
QList<CCANMessage *> NewMessagesList = mCANDriverIF->ReadCANFullBuffer(mCANDeviceHandle);
|
||||
|
||||
qDebug("CAN Buffer size: %d",NewMessagesList.size());
|
||||
int BufferSize = NewMessagesList.size();
|
||||
// qDebug("CAN Buffer size: %d",BufferSize);
|
||||
|
||||
|
||||
|
||||
for(int i = 0 ; i < NewMessagesList.size(); i++)
|
||||
@ -113,7 +115,7 @@ void CCANAnalyzer::CANTimerExpired()
|
||||
}
|
||||
|
||||
|
||||
mDevicePtr->NewMessageParsed();
|
||||
mDevicePtr->NewMessageParsed(BufferSize);
|
||||
|
||||
|
||||
if(NewMessagesList.isEmpty())
|
||||
|
||||
@ -72,12 +72,14 @@ int CCANDevice::Init()
|
||||
{
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Le dispositif [%1] n'a pas pu s'initialiser").arg(mDeviceConfigInfo.mDeviceName),true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_ERROR_STATUS);
|
||||
mProgramPtr->SetCANConnectionStatusRequest(false);
|
||||
mProgramPtr->UpdateCANModuleStatusRequest(mDeviceConfigInfo.mDeviceName,"Déconnecté","NOUPDATE");
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
mCANDataLogger.SetMQTTTopicDevice(QString("CANBus/%1/").arg(mDeviceConfigInfo.mDeviceName));
|
||||
mCANDataLogger.SetMQTTClient(mCANMQTTClient);
|
||||
mProgramPtr->SetCANConnectionStatusRequest(true);
|
||||
mProgramPtr->UpdateCANModuleStatusRequest(mDeviceConfigInfo.mDeviceName,"Connecté","NOUPDATE");
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Dispositif [%1] initialisé avec succès!").arg(mDeviceConfigInfo.mDeviceName),true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_SUCCESS_STATUS);
|
||||
return RET_OK;
|
||||
@ -97,10 +99,11 @@ int CCANDevice::Init(QString DatabaseFileName, TPCANHandle CANDeviceID, TPCANBau
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCANDevice::NewMessageParsed()
|
||||
int CCANDevice::NewMessageParsed(int BufferSize)
|
||||
{
|
||||
mCANDataLogger.LogNewData(&mMessageList);
|
||||
mProgramPtr->UpdateCANViewerDataRequest(&mMessageList);
|
||||
mProgramPtr->UpdateCANModuleStatusRequest(mDeviceConfigInfo.mDeviceName,"NOUPDATE",QString("%1").arg(BufferSize));
|
||||
|
||||
for(int i = 0; i < mMessageList.size(); i++)
|
||||
mMessageList.at(i)->mPendingData = false;
|
||||
|
||||
@ -43,7 +43,7 @@ public:
|
||||
|
||||
// CCANDevice &operator=(const CCANDevice *source);
|
||||
|
||||
int NewMessageParsed();
|
||||
int NewMessageParsed(int BufferSize = 0);
|
||||
|
||||
private:
|
||||
bool mConfigSet;
|
||||
|
||||
@ -40,19 +40,19 @@ QDataStream &operator<<(QDataStream &out, const CCANDeviceConfig &source)
|
||||
return out;
|
||||
}
|
||||
|
||||
CCANDeviceConfig& CCANDeviceConfig::operator=(const CCANDeviceConfig *source)
|
||||
CCANDeviceConfig& CCANDeviceConfig::operator=(const CCANDeviceConfig &source)
|
||||
{
|
||||
if(source == this)
|
||||
if(&source == this)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
this->mCANDeviceID = source->mCANDeviceID;
|
||||
this->mCANDeviceBaudrate = source->mCANDeviceBaudrate;
|
||||
this->mCANDeviceDatabaseFilename = source->mCANDeviceDatabaseFilename;
|
||||
this->mDeviceDescription = source->mDeviceDescription;
|
||||
this->mDeviceName = source->mDeviceName;
|
||||
this->mDevicePollPeriod = source->mDevicePollPeriod;
|
||||
this->mCANDeviceID = source.mCANDeviceID;
|
||||
this->mCANDeviceBaudrate = source.mCANDeviceBaudrate;
|
||||
this->mCANDeviceDatabaseFilename = source.mCANDeviceDatabaseFilename;
|
||||
this->mDeviceDescription = source.mDeviceDescription;
|
||||
this->mDeviceName = source.mDeviceName;
|
||||
this->mDevicePollPeriod = source.mDevicePollPeriod;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ public:
|
||||
QString mDeviceName;
|
||||
unsigned int mDevicePollPeriod;
|
||||
|
||||
CCANDeviceConfig &operator=(const CCANDeviceConfig *source);
|
||||
CCANDeviceConfig &operator=(const CCANDeviceConfig &source);
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CCANDeviceConfig &source);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include "CANSignal.h"
|
||||
#include "defines.h"
|
||||
#include <QtEndian>
|
||||
|
||||
|
||||
CCANSignal::CCANSignal():
|
||||
@ -14,12 +15,18 @@ int CCANSignal::ComputeNewSignalValue(quint64 NewValue, quint16 MessageSize)
|
||||
{
|
||||
if(mEncoding == CAN_SIGNAL_ENCODING_INTEL)
|
||||
{
|
||||
//TODO: trouver un device qui crache du intel??
|
||||
mRawValue = NewValue;
|
||||
|
||||
mRawValue = qFromBigEndian(NewValue);
|
||||
// mRawValue = NewValue;
|
||||
mRawValue >>= mStartBit;
|
||||
quint64 mask = 1;
|
||||
mask <<= mSignalSize;
|
||||
mask -= 1;
|
||||
mRawValue &= mask;
|
||||
|
||||
}
|
||||
else if(mEncoding == CAN_SIGNAL_ENCODING_MOTOROLA)
|
||||
{
|
||||
//mRawValue = MotorolaValue;
|
||||
mRawValue = NewValue;
|
||||
int StartIndex = mStartBit - (mStartBit % 8) + 7 - (mStartBit % 8);
|
||||
int shift = ((MessageSize * 8) - StartIndex -1);
|
||||
@ -36,9 +43,67 @@ int CCANSignal::ComputeNewSignalValue(quint64 NewValue, quint16 MessageSize)
|
||||
}
|
||||
|
||||
|
||||
mPhysicalValue = ((signed) mRawValue * mValueFactor) + mValueOffset;
|
||||
// mPhysicalValueUINT = ((quint64)((quint64) mRawValue * mValueFactor)) + (quint64)mValueOffset;
|
||||
// mPhysicalValue = (qint64)((qint64) mRawValue * mValueFactor) + (qint64)mValueOffset;
|
||||
//JFM 2023-06-13 - Ajout casting des variables en fonction du data size.
|
||||
//L'idée c'est de contenir la valeur physique dans un double, ce qui permet de ne pas avoir à gérer le type
|
||||
//à chaque fois qu'on accède à la donnée. Mais pour que ça marche, il faut initialiser ce double comme il faut
|
||||
//en castant en fonction de la taille et du signe de la donnée
|
||||
qint64 SignedRawValue = 0;
|
||||
if(mSignalSize <= 8)
|
||||
{
|
||||
if(mValueType == CAN_SIGNAL_TYPE_SIGNED_INT)
|
||||
{
|
||||
SignedRawValue = (double)((qint8)mRawValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
SignedRawValue = (double)((quint8)mRawValue);
|
||||
}
|
||||
|
||||
}
|
||||
else if(mSignalSize <= 16)
|
||||
{
|
||||
if(mValueType == CAN_SIGNAL_TYPE_SIGNED_INT)
|
||||
{
|
||||
SignedRawValue = (double)((qint16)mRawValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
SignedRawValue = (double)((quint16)mRawValue);
|
||||
}
|
||||
// qint16 RawShort = (qint16)mRawValue;
|
||||
// SignedRawValue = (double)RawShort;
|
||||
}
|
||||
else if(mSignalSize <= 32)
|
||||
{
|
||||
if(mValueType == CAN_SIGNAL_TYPE_SIGNED_INT)
|
||||
{
|
||||
SignedRawValue = (double)((qint32)mRawValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
SignedRawValue = (double)((quint32)mRawValue);
|
||||
}
|
||||
//SignedRawValue = (signed)mRawValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(mValueType == CAN_SIGNAL_TYPE_SIGNED_INT)
|
||||
{
|
||||
SignedRawValue = (double)((signed)mRawValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
SignedRawValue = (double)(mRawValue);
|
||||
}
|
||||
}
|
||||
mPhysicalValue = (double)SignedRawValue;
|
||||
mPhysicalValue *= mValueFactor;
|
||||
mPhysicalValue += mValueOffset;
|
||||
|
||||
//JFM 2023-06-13 tentative de corriger le casting avec la vraie patente
|
||||
//mPhysicalValue = ((signed) mRawValue * mValueFactor) + mValueOffset;
|
||||
|
||||
|
||||
|
||||
return RET_OK;
|
||||
|
||||
|
||||
55
Otarcik_CAN/Sources/CANBus/CANWatchdog.cpp
Normal file
55
Otarcik_CAN/Sources/CANBus/CANWatchdog.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
|
||||
#include "CANWatchdog.h"
|
||||
#include "GeneralMessagesLogDispatcher.h"
|
||||
|
||||
CCANWatchdog::CCANWatchdog()
|
||||
{
|
||||
mCANDriverIF = new CPCANInterface;
|
||||
mIsCANInitialized = false;
|
||||
|
||||
mWatchdogTimer = new QTimer;
|
||||
mWatchdogTimer->setSingleShot(false);
|
||||
|
||||
connect(mWatchdogTimer,&QTimer::timeout,this,&CCANWatchdog::WatchdogTimeoutTimerExpired);
|
||||
}
|
||||
|
||||
int CCANWatchdog::Init(quint8 CANDeviceID, WORD CANDeviceBaudrate, unsigned int WDTPeriod)
|
||||
{
|
||||
if(WDTPeriod < 200)
|
||||
{
|
||||
WDTPeriod = 200;
|
||||
qDebug("CANWatchdog:: Trying to init with WDT period lower tan 200ms");
|
||||
}
|
||||
|
||||
mCANDeviceID = CANDeviceID;
|
||||
mWDTPeriod = WDTPeriod;
|
||||
mCANDeviceBaudrate = CANDeviceBaudrate;
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage("Démarrage du Watchdog CAN...");
|
||||
|
||||
if(mCANDriverIF->GetDeviceHandle(mCANDeviceID,mCANDeviceHandle) != RET_OK)
|
||||
{
|
||||
QString Log = QString("Impossible de trouver le module CAN Watchdog sur le channel %1").arg(mCANDeviceID);
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(Log,true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_ERROR_STATUS);
|
||||
mIsCANInitialized = false;
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
if(mCANDriverIF->Init(mCANDeviceHandle,mCANDeviceBaudrate) != RET_OK)
|
||||
{
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage("Impossible d'initialiser la puck CAN du Watchdog",true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_ERROR_STATUS);
|
||||
mIsCANInitialized = false;
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
// mCANReadTimer->start(mCANPollPeriod);
|
||||
mIsCANInitialized = true;
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CCANWatchdog::WatchdogTimeoutTimerExpired()
|
||||
{
|
||||
|
||||
}
|
||||
32
Otarcik_CAN/Sources/CANBus/CANWatchdog.h
Normal file
32
Otarcik_CAN/Sources/CANBus/CANWatchdog.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef CANWATCHDOG_H
|
||||
#define CANWATCHDOG_H
|
||||
|
||||
#include <QObject>
|
||||
#include "PCANInterface.h"
|
||||
#include <QTimer>
|
||||
|
||||
class CCANWatchdog: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CCANWatchdog();
|
||||
|
||||
int Init(quint8 CANDeviceID, TPCANBaudrate CANDeviceBaudrate, unsigned int WDTPeriod);
|
||||
|
||||
CPCANInterface *mCANDriverIF;
|
||||
unsigned int mWDTPeriod;
|
||||
quint8 mCANDeviceID;
|
||||
TPCANBaudrate mCANDeviceBaudrate;
|
||||
QTimer *mWatchdogTimer;
|
||||
|
||||
private:
|
||||
bool mIsCANInitialized;
|
||||
TPCANHandle mCANDeviceHandle;
|
||||
|
||||
public slots:
|
||||
void WatchdogTimeoutTimerExpired();
|
||||
|
||||
};
|
||||
|
||||
#endif // CANWATCHDOG_H
|
||||
35
Otarcik_CAN/Sources/CANBus/CANWatchdogConfig.cpp
Normal file
35
Otarcik_CAN/Sources/CANBus/CANWatchdogConfig.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include "CANWatchdogConfig.h"
|
||||
|
||||
CCANWatchdogConfig::CCANWatchdogConfig()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCANWatchdogConfig& CCANWatchdogConfig::operator=(const CCANWatchdogConfig &source)
|
||||
{
|
||||
if(&source == this)
|
||||
return *this;
|
||||
|
||||
this->mCANDeviceID = source.mCANDeviceID;
|
||||
this->mCANDeviceBaudrate = source.mCANDeviceBaudrate;
|
||||
this->mWatchdogTimeout = source.mWatchdogTimeout;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, CCANWatchdogConfig &dest)
|
||||
{
|
||||
in >> dest.mCANDeviceID
|
||||
>> dest.mCANDeviceBaudrate
|
||||
>> dest.mWatchdogTimeout;
|
||||
return in;
|
||||
}
|
||||
QDataStream &operator<<(QDataStream &out, const CCANWatchdogConfig &source)
|
||||
{
|
||||
out << source.mCANDeviceID
|
||||
<< source.mCANDeviceBaudrate
|
||||
<< source.mWatchdogTimeout;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
25
Otarcik_CAN/Sources/CANBus/CANWatchdogConfig.h
Normal file
25
Otarcik_CAN/Sources/CANBus/CANWatchdogConfig.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef CANWATCHDOGCONFIG_H
|
||||
#define CANWATCHDOGCONFIG_H
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QString>
|
||||
|
||||
#include "PCANBasic.h"
|
||||
|
||||
|
||||
class CCANWatchdogConfig
|
||||
{
|
||||
public:
|
||||
CCANWatchdogConfig();
|
||||
|
||||
quint8 mCANDeviceID;
|
||||
TPCANBaudrate mCANDeviceBaudrate;
|
||||
unsigned int mWatchdogTimeout;
|
||||
|
||||
CCANWatchdogConfig &operator=(const CCANWatchdogConfig &source);
|
||||
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CCANWatchdogConfig &source);
|
||||
QDataStream &operator>>(QDataStream &in, CCANWatchdogConfig &dest);
|
||||
#endif // CANWATCHDOGCONFIG_H
|
||||
@ -28,19 +28,19 @@ QDataStream &operator<<(QDataStream &out, const CCloudParams &source)
|
||||
return out;
|
||||
}
|
||||
|
||||
CCloudParams& CCloudParams::operator=(const CCloudParams *source)
|
||||
CCloudParams& CCloudParams::operator=(const CCloudParams &source)
|
||||
{
|
||||
if(source == this)
|
||||
if(&source == this)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
this->mMQTTBrokerHostName = source->mMQTTBrokerHostName;
|
||||
this->mMQTTBrokerPassword = source->mMQTTBrokerPassword;
|
||||
this->mMQTTBrokerPort = source->mMQTTBrokerPort;
|
||||
this->mMQTTBrokerUserName = source->mMQTTBrokerUserName;
|
||||
this->mMQTTTopicPrefix = source->mMQTTTopicPrefix;
|
||||
this->mMQTTTransmitTimeout = source->mMQTTTransmitTimeout;
|
||||
this->mMQTTBrokerHostName = source.mMQTTBrokerHostName;
|
||||
this->mMQTTBrokerPassword = source.mMQTTBrokerPassword;
|
||||
this->mMQTTBrokerPort = source.mMQTTBrokerPort;
|
||||
this->mMQTTBrokerUserName = source.mMQTTBrokerUserName;
|
||||
this->mMQTTTopicPrefix = source.mMQTTTopicPrefix;
|
||||
this->mMQTTTransmitTimeout = source.mMQTTTransmitTimeout;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ public:
|
||||
quint32 mMQTTBrokerPort;
|
||||
quint32 mMQTTTransmitTimeout;
|
||||
|
||||
CCloudParams &operator=(const CCloudParams *source);
|
||||
CCloudParams &operator=(const CCloudParams &source);
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CCloudParams &source);
|
||||
|
||||
@ -150,6 +150,10 @@ void CCANViewerPage::MessageSelectionChanged()
|
||||
|
||||
//Phys value
|
||||
|
||||
//JFM 2023-06-13 changé pour forcer toujours à float
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(Msg->mSignalsList.at(signal).mPhysicalValue,0,'f',1));
|
||||
|
||||
/*
|
||||
if(Msg->mSignalsList.at(signal).mValueType == CCANSignal::CAN_SIGNAL_TYPE_UNSIGNED_INT)
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg((quint64)Msg->mSignalsList.at(signal).mPhysicalValue));
|
||||
@ -163,7 +167,7 @@ void CCANViewerPage::MessageSelectionChanged()
|
||||
Msg->mSignalsList.at(signal).mValueType == CCANSignal::CAN_SIGNAL_TYPE_64_BIT_DOUBLE)
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(Msg->mSignalsList.at(signal).mPhysicalValue,0,'f',1));
|
||||
}
|
||||
}*/
|
||||
ui->mCANSignalTableWidget->setItem(signal,1,NewItem);
|
||||
|
||||
//Raw value
|
||||
@ -198,6 +202,12 @@ int CCANViewerPage::UpdateSignalsTable()
|
||||
ui->mCANSignalTableWidget->item(row,0)->setText(Msg->mSignalsList.at(signal).mSignalName);
|
||||
|
||||
//Phys value
|
||||
//JFM 2023-06-13 changé pour forcer toujours à float
|
||||
//Mais cette fonciton n'est jamais appelée et NE FONCTIONNE PAS.
|
||||
//TODO: Corriger les index des colonnes des items à afficher
|
||||
ui->mCANSignalTableWidget->item(row,0)->setText(QString("%1").arg(Msg->mSignalsList.at(signal).mPhysicalValue,0,'f',1));
|
||||
|
||||
/*
|
||||
if(Msg->mSignalsList.at(signal).mValueType == CCANSignal::CAN_SIGNAL_TYPE_UNSIGNED_INT)
|
||||
{
|
||||
ui->mCANSignalTableWidget->item(row,0)->setText(QString("%1").arg((quint64)Msg->mSignalsList.at(signal).mPhysicalValue));
|
||||
@ -210,7 +220,7 @@ int CCANViewerPage::UpdateSignalsTable()
|
||||
Msg->mSignalsList.at(signal).mValueType == CCANSignal::CAN_SIGNAL_TYPE_64_BIT_DOUBLE)
|
||||
{
|
||||
ui->mCANSignalTableWidget->item(row,0)->setText(QString("%1").arg(Msg->mSignalsList.at(signal).mPhysicalValue,0,'f',1));
|
||||
}
|
||||
}*/
|
||||
|
||||
//Raw value
|
||||
ui->mCANSignalTableWidget->item(row,0)->setText(QString("0x%1").arg(Msg->mSignalsList.at(signal).mRawValue,0,16));
|
||||
|
||||
@ -64,6 +64,7 @@ CCANbusSettingsPage::CCANbusSettingsPage(QWidget *parent) :
|
||||
ui->mDatabaseFileSelectBtn->hide();
|
||||
ui->mCANBaudrateComboBx->setEnabled(false);
|
||||
//ui->mCANIDComboBx->setEnabled(false);
|
||||
ui->mCANDeviceIDSpinBx->setValue(1);
|
||||
ui->mCANDeviceIDSpinBx->setEnabled(false); //JFM 2023-06-02
|
||||
ui->mDevicePollPeriodSpinBx->setEnabled(false);
|
||||
ui->mCancelModifyParamsBtn->hide();
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
#include "CCANWatchdogSettingsPage.h"
|
||||
#include "ui_CCANWatchdogSettingsPage.h"
|
||||
#include "CANDevice.h"
|
||||
#include "OtarcikCan.h"
|
||||
|
||||
CCANWatchdogSettingsPage::CCANWatchdogSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CCANWatchdogSettingsPage)
|
||||
{
|
||||
mProgramHandle = 0;
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->mCANWatchdogChangBtn,&QPushButton::pressed,this,&CCANWatchdogSettingsPage::ChangeSettingsButtonPressed);
|
||||
@ -67,6 +69,7 @@ void CCANWatchdogSettingsPage::ChangeSettingsButtonPressed()
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
mIsSettingsChangeMode = false;
|
||||
|
||||
ui->mCANWatchdogCancelBtn->setVisible(false);
|
||||
@ -74,5 +77,28 @@ void CCANWatchdogSettingsPage::ChangeSettingsButtonPressed()
|
||||
ui->mCANWatchdogDeviceIDSpinBx->setEnabled(false);
|
||||
ui->mCANWatchdogTimeoutSpinBx->setEnabled(false);
|
||||
ui->mCANWatchdogChangBtn->setText("Modifier");
|
||||
|
||||
//Save data...
|
||||
mCANWatchdogConfig.mCANDeviceID = ui->mCANWatchdogDeviceIDSpinBx->value();
|
||||
mCANWatchdogConfig.mWatchdogTimeout = ui->mCANWatchdogTimeoutSpinBx->value();
|
||||
mCANWatchdogConfig.mCANDeviceBaudrate = ui->mCANWatchdogBaudrateComboBx->currentData().toInt();
|
||||
|
||||
mProgramHandle->SaveCANWatchdogSettingsRequest(&mCANWatchdogConfig);
|
||||
}
|
||||
}
|
||||
|
||||
int CCANWatchdogSettingsPage::SetCANWatchdogConfig(CCANWatchdogConfig *Config)
|
||||
{
|
||||
if(Config == 0)
|
||||
{
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
mCANWatchdogConfig = *Config;
|
||||
|
||||
ui->mCANWatchdogDeviceIDSpinBx->setValue(mCANWatchdogConfig.mCANDeviceID);
|
||||
ui->mCANWatchdogTimeoutSpinBx->setValue(mCANWatchdogConfig.mWatchdogTimeout);
|
||||
ui->mCANWatchdogBaudrateComboBx->setCurrentIndex(ui->mCANWatchdogBaudrateComboBx->findData(mCANWatchdogConfig.mCANDeviceBaudrate));
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
#define CCANWATCHDOGSETTINGSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "CANWatchdogConfig.h"
|
||||
|
||||
class COtarcikCan;
|
||||
|
||||
namespace Ui {
|
||||
class CCANWatchdogSettingsPage;
|
||||
@ -15,10 +18,15 @@ public:
|
||||
explicit CCANWatchdogSettingsPage(QWidget *parent = 0);
|
||||
~CCANWatchdogSettingsPage();
|
||||
bool mIsSettingsChangeMode;
|
||||
COtarcikCan *mProgramHandle;
|
||||
|
||||
int SetCANWatchdogConfig(CCANWatchdogConfig* Config);
|
||||
|
||||
private:
|
||||
Ui::CCANWatchdogSettingsPage *ui;
|
||||
|
||||
CCANWatchdogConfig mCANWatchdogConfig;
|
||||
|
||||
public slots:
|
||||
void ChangeSettingsButtonPressed();
|
||||
void CancelButtonPressed();
|
||||
|
||||
@ -13,6 +13,9 @@ CGeneralStatusPage::CGeneralStatusPage(QWidget *parent) :
|
||||
connect(ui->mClearGenMsgTxtBtn,&QPushButton::clicked,this,&CGeneralStatusPage::ClearGenMsgAreaBtnPressed);
|
||||
SetMQTTConnectionStatus(false);
|
||||
SetCANConnectionStatus(false);
|
||||
|
||||
ui->mCANModuleStatusTableWdgt->setColumnCount(3);
|
||||
ui->mCANModuleStatusTableWdgt->setHorizontalHeaderLabels(QStringList() << "Nom" << "Statut" << "Buffer");
|
||||
}
|
||||
|
||||
CGeneralStatusPage::~CGeneralStatusPage()
|
||||
@ -138,3 +141,46 @@ int CGeneralStatusPage::SetCANConnectionStatus(bool Connected)
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CGeneralStatusPage::UpdateCANModuleStatus(QString ModuleName, QString ModuleStatus, QString Buffer)
|
||||
{
|
||||
QList<QTableWidgetItem *> Items = ui->mCANModuleStatusTableWdgt->findItems(ModuleName,Qt::MatchFixedString);
|
||||
|
||||
if(Items.isEmpty())
|
||||
{
|
||||
//first update, we add the item to the table
|
||||
QTableWidgetItem *NewItem;
|
||||
int row = ui->mCANModuleStatusTableWdgt->rowCount();
|
||||
ui->mCANModuleStatusTableWdgt->setRowCount(row + 1);
|
||||
|
||||
NewItem = new QTableWidgetItem(ModuleName);
|
||||
ui->mCANModuleStatusTableWdgt->setItem(row,0,NewItem);
|
||||
|
||||
NewItem = new QTableWidgetItem(ModuleStatus);
|
||||
ui->mCANModuleStatusTableWdgt->setItem(row,1,NewItem);
|
||||
|
||||
if(Buffer == "NOUPDATE")
|
||||
Buffer = "?";
|
||||
NewItem = new QTableWidgetItem(Buffer);
|
||||
ui->mCANModuleStatusTableWdgt->setItem(row,2,NewItem);
|
||||
}
|
||||
else if(Items.size() == 1)
|
||||
{
|
||||
int row = ui->mCANModuleStatusTableWdgt->row(Items.at(0));
|
||||
|
||||
if(ModuleStatus != "NOUPDATE")
|
||||
{
|
||||
ui->mCANModuleStatusTableWdgt->item(row,1)->setText(ModuleStatus);
|
||||
}
|
||||
if(Buffer != "NOUPDATE")
|
||||
{
|
||||
ui->mCANModuleStatusTableWdgt->item(row,2)->setText(Buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("Two CAN modules with same name in the Modules Status Table");
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ public:
|
||||
|
||||
int SetMQTTConnectionStatus(bool Connected);
|
||||
int SetCANConnectionStatus(bool Connected);
|
||||
int UpdateCANModuleStatus(QString ModuleName, QString ModuleStatus, QString Buffer);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -50,8 +50,8 @@
|
||||
<widget class="QLabel" name="mPuckCANLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>520</y>
|
||||
<x>1220</x>
|
||||
<y>210</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@ -68,8 +68,8 @@
|
||||
<widget class="QLabel" name="mClientMQTTLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>550</y>
|
||||
<x>1200</x>
|
||||
<y>240</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@ -86,8 +86,8 @@
|
||||
<widget class="QLabel" name="mPuckCANConStatLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>470</x>
|
||||
<y>520</y>
|
||||
<x>1300</x>
|
||||
<y>210</y>
|
||||
<width>121</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@ -106,8 +106,8 @@
|
||||
<widget class="QLabel" name="mClientMQTTConnStatLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>470</x>
|
||||
<y>550</y>
|
||||
<x>1300</x>
|
||||
<y>240</y>
|
||||
<width>121</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@ -123,15 +123,35 @@
|
||||
<string>Déconnecté</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<widget class="QTableWidget" name="mCANModuleStatusTableWdgt">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>1190</x>
|
||||
<y>40</y>
|
||||
<width>371</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>1200</x>
|
||||
<y>20</y>
|
||||
<width>371</width>
|
||||
<height>441</height>
|
||||
<width>221</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Statut des module CAN </string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include "OtarcikCan.h"
|
||||
#include "PCANBasic.h"
|
||||
#include "QtEndian"
|
||||
|
||||
COtarcikCan::COtarcikCan(QObject *parent) : QObject(parent)
|
||||
{
|
||||
@ -44,9 +45,9 @@ COtarcikCan::~COtarcikCan()
|
||||
int COtarcikCan::Start()
|
||||
{
|
||||
|
||||
|
||||
mMainWindow.mCANbusSettingsPage->mProgramPtr = this;
|
||||
mMainWindow.mDataLoggingSettingsPage->mProgramHandle = this;
|
||||
mMainWindow.mCANWatchdogSettingsPage->mProgramHandle = this;
|
||||
|
||||
mMainWindow.show();
|
||||
|
||||
@ -74,6 +75,8 @@ int COtarcikCan::Start()
|
||||
mCANBusMQTTClient.ConnectToBroker();
|
||||
mCANBusMQTTClient.SetCANDevicesList(&mCANDevicesList);
|
||||
|
||||
mMainWindow.mCANWatchdogSettingsPage->SetCANWatchdogConfig(mSystemConfig.GetCANWatchdogConfig());
|
||||
|
||||
mGPTimer->setSingleShot(false);
|
||||
mGPTimer->start(5000);
|
||||
|
||||
@ -203,3 +206,16 @@ int COtarcikCan::SetMQTTConnectionSatusRequest(bool Connected)
|
||||
{
|
||||
return mMainWindow.mGeneralStatusPage->SetMQTTConnectionStatus(Connected);
|
||||
}
|
||||
|
||||
int COtarcikCan::UpdateCANModuleStatusRequest(QString ModuleName, QString ModuleStatus, QString Buffer)
|
||||
{
|
||||
return mMainWindow.mGeneralStatusPage->UpdateCANModuleStatus(ModuleName,ModuleStatus,Buffer);
|
||||
}
|
||||
|
||||
|
||||
int COtarcikCan::SaveCANWatchdogSettingsRequest(CCANWatchdogConfig *CANWatchdogConfig)
|
||||
{
|
||||
mSystemConfig.SetCANWatchdogConfig(CANWatchdogConfig);
|
||||
return mSystemConfig.SaveConfig();
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,9 @@ public:
|
||||
|
||||
int SetCANConnectionStatusRequest(bool Connected);
|
||||
int SetMQTTConnectionSatusRequest(bool Connected);
|
||||
int UpdateCANModuleStatusRequest(QString ModuleName, QString ModuleStatus, QString Buffer);
|
||||
|
||||
int SaveCANWatchdogSettingsRequest(CCANWatchdogConfig *CANWatchdogConfig);
|
||||
|
||||
private:
|
||||
QList<CCANDevice*> mCANDevicesList;
|
||||
|
||||
@ -73,6 +73,9 @@ int CSystemConfig::LoadConfig()
|
||||
//Load general program settings
|
||||
*InputStream >> mSaveLocalLogFile;
|
||||
|
||||
//Load CAN Watchdog parameters
|
||||
*InputStream >> mCANWatchdogParams;
|
||||
|
||||
|
||||
ConfigFile->close();
|
||||
delete ConfigFile;
|
||||
@ -124,6 +127,9 @@ int CSystemConfig::SaveConfig()
|
||||
//Save the general system parameters
|
||||
*OutputStream << mSaveLocalLogFile;
|
||||
|
||||
//Save the CAN Watchdog params
|
||||
*OutputStream << mCANWatchdogParams;
|
||||
|
||||
ConfigFile->flush();
|
||||
ConfigFile->close();
|
||||
|
||||
@ -166,6 +172,19 @@ CCloudParams *CSystemConfig::GetCloudParams()
|
||||
return &mCloudLoggingParams;
|
||||
}
|
||||
|
||||
CCANWatchdogConfig *CSystemConfig::GetCANWatchdogConfig()
|
||||
{
|
||||
return &mCANWatchdogParams;
|
||||
}
|
||||
|
||||
int CSystemConfig::SetCANWatchdogConfig(CCANWatchdogConfig *Config)
|
||||
{
|
||||
if(Config == 0)
|
||||
return RET_GENERAL_ERROR;
|
||||
|
||||
mCANWatchdogParams = *Config;
|
||||
}
|
||||
|
||||
int CSystemConfig::SetCloudParams(CCloudParams *CloudParams)
|
||||
{
|
||||
if(CloudParams == 0)
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include <QDataStream>
|
||||
#include "CANDeviceConfig.h"
|
||||
#include "CloudParams.h"
|
||||
#include "CANWatchdogConfig.h"
|
||||
|
||||
#define OTARCIK_CURRENT_CONFIG_FILE_VERSION 0x01
|
||||
#define OTARCIK_CONFIG_FILE_MAGIC_NBR 0xDEADBEEF
|
||||
@ -30,6 +31,7 @@ public:
|
||||
|
||||
|
||||
|
||||
|
||||
//Can devices configs
|
||||
QList<CCANDeviceConfig*> mCANDeviceConfigList;
|
||||
|
||||
@ -39,6 +41,11 @@ public:
|
||||
//Misc general system settings
|
||||
bool mSaveLocalLogFile;
|
||||
|
||||
//CAN Module watchdog settings
|
||||
CCANWatchdogConfig mCANWatchdogParams;
|
||||
CCANWatchdogConfig *GetCANWatchdogConfig();
|
||||
int SetCANWatchdogConfig(CCANWatchdogConfig *Config);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@ -19,6 +19,8 @@ debug/CloudParams.o
|
||||
debug/MQTTMessage.o
|
||||
debug/MQTTClientWrapper.o
|
||||
debug/CCANWatchdogSettingsPage.o
|
||||
debug/CANWatchdogConfig.o
|
||||
debug/CANWatchdog.o
|
||||
debug/moc_MainWindow.o
|
||||
debug/moc_PCANInterface.o
|
||||
debug/moc_OtarcikCan.o
|
||||
@ -31,3 +33,4 @@ debug/moc_CANAnalyzer.o
|
||||
debug/moc_CANDevice.o
|
||||
debug/moc_MQTTClientWrapper.o
|
||||
debug/moc_CCANWatchdogSettingsPage.o
|
||||
debug/moc_CANWatchdog.o
|
||||
|
||||
@ -19,6 +19,8 @@ release/CloudParams.o
|
||||
release/MQTTMessage.o
|
||||
release/MQTTClientWrapper.o
|
||||
release/CCANWatchdogSettingsPage.o
|
||||
release/CANWatchdogConfig.o
|
||||
release/CANWatchdog.o
|
||||
release/moc_MainWindow.o
|
||||
release/moc_PCANInterface.o
|
||||
release/moc_OtarcikCan.o
|
||||
@ -31,3 +33,4 @@ release/moc_CANAnalyzer.o
|
||||
release/moc_CANDevice.o
|
||||
release/moc_MQTTClientWrapper.o
|
||||
release/moc_CCANWatchdogSettingsPage.o
|
||||
release/moc_CANWatchdog.o
|
||||
|
||||
Binary file not shown.
@ -29,7 +29,8 @@ public:
|
||||
QLabel *mClientMQTTLbl;
|
||||
QLabel *mPuckCANConStatLbl;
|
||||
QLabel *mClientMQTTConnStatLbl;
|
||||
QTableWidget *tableWidget;
|
||||
QTableWidget *mCANModuleStatusTableWdgt;
|
||||
QLabel *label;
|
||||
|
||||
void setupUi(QWidget *CGeneralStatusPage)
|
||||
{
|
||||
@ -51,17 +52,17 @@ public:
|
||||
mClearGenMsgTxtBtn->setGeometry(QRect(30, 480, 80, 22));
|
||||
mPuckCANLbl = new QLabel(CGeneralStatusPage);
|
||||
mPuckCANLbl->setObjectName(QString::fromUtf8("mPuckCANLbl"));
|
||||
mPuckCANLbl->setGeometry(QRect(390, 520, 81, 16));
|
||||
mPuckCANLbl->setGeometry(QRect(1220, 210, 81, 16));
|
||||
QFont font1;
|
||||
font1.setPointSize(12);
|
||||
mPuckCANLbl->setFont(font1);
|
||||
mClientMQTTLbl = new QLabel(CGeneralStatusPage);
|
||||
mClientMQTTLbl->setObjectName(QString::fromUtf8("mClientMQTTLbl"));
|
||||
mClientMQTTLbl->setGeometry(QRect(370, 550, 101, 16));
|
||||
mClientMQTTLbl->setGeometry(QRect(1200, 240, 101, 16));
|
||||
mClientMQTTLbl->setFont(font1);
|
||||
mPuckCANConStatLbl = new QLabel(CGeneralStatusPage);
|
||||
mPuckCANConStatLbl->setObjectName(QString::fromUtf8("mPuckCANConStatLbl"));
|
||||
mPuckCANConStatLbl->setGeometry(QRect(470, 520, 121, 16));
|
||||
mPuckCANConStatLbl->setGeometry(QRect(1300, 210, 121, 16));
|
||||
QFont font2;
|
||||
font2.setPointSize(12);
|
||||
font2.setBold(true);
|
||||
@ -69,11 +70,19 @@ public:
|
||||
mPuckCANConStatLbl->setFont(font2);
|
||||
mClientMQTTConnStatLbl = new QLabel(CGeneralStatusPage);
|
||||
mClientMQTTConnStatLbl->setObjectName(QString::fromUtf8("mClientMQTTConnStatLbl"));
|
||||
mClientMQTTConnStatLbl->setGeometry(QRect(470, 550, 121, 16));
|
||||
mClientMQTTConnStatLbl->setGeometry(QRect(1300, 240, 121, 16));
|
||||
mClientMQTTConnStatLbl->setFont(font2);
|
||||
tableWidget = new QTableWidget(CGeneralStatusPage);
|
||||
tableWidget->setObjectName(QString::fromUtf8("tableWidget"));
|
||||
tableWidget->setGeometry(QRect(1200, 20, 371, 441));
|
||||
mCANModuleStatusTableWdgt = new QTableWidget(CGeneralStatusPage);
|
||||
mCANModuleStatusTableWdgt->setObjectName(QString::fromUtf8("mCANModuleStatusTableWdgt"));
|
||||
mCANModuleStatusTableWdgt->setGeometry(QRect(1190, 40, 371, 131));
|
||||
label = new QLabel(CGeneralStatusPage);
|
||||
label->setObjectName(QString::fromUtf8("label"));
|
||||
label->setGeometry(QRect(1200, 20, 221, 16));
|
||||
QFont font3;
|
||||
font3.setPointSize(11);
|
||||
font3.setBold(true);
|
||||
font3.setWeight(75);
|
||||
label->setFont(font3);
|
||||
|
||||
retranslateUi(CGeneralStatusPage);
|
||||
|
||||
@ -88,6 +97,7 @@ public:
|
||||
mClientMQTTLbl->setText(QCoreApplication::translate("CGeneralStatusPage", "Client MQTT:", nullptr));
|
||||
mPuckCANConStatLbl->setText(QCoreApplication::translate("CGeneralStatusPage", "D\303\251connect\303\251e", nullptr));
|
||||
mClientMQTTConnStatLbl->setText(QCoreApplication::translate("CGeneralStatusPage", "D\303\251connect\303\251", nullptr));
|
||||
label->setText(QCoreApplication::translate("CGeneralStatusPage", "Statut des module CAN ", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
8
TODO.txt
8
TODO.txt
@ -1,7 +1,11 @@
|
||||
- Ajouter lignes de statut du MQTT dans le log principal
|
||||
x Ajouter états de connexion (CAN et MQTT) dans onglet Statut
|
||||
- Automatiser le démarrage
|
||||
- Ajouter la taille du quue du module CAN dans l'onglet statut
|
||||
x Ajouter la taille du quue du module CAN dans l'onglet statut
|
||||
- Ajouter timeout de comm avec la puck CAN
|
||||
- Corriger le bug de sélection du data quand il y a plus qu'une puck
|
||||
- Implémenter une liste de messages MQTT non envoyés pour ne pas perdre de messages provenant du CAN
|
||||
x Implémenter une liste de messages MQTT non envoyés pour ne pas perdre de messages provenant du CAN
|
||||
- Ajouter la gestion du Client ID MQTT
|
||||
- Implémenter le watchdog CAN
|
||||
- Valider pourquoi le MQTT ne se connecte pas au reboot
|
||||
- Corriger le UTF pour l'affichage des degrés dans le tableau
|
||||
Loading…
x
Reference in New Issue
Block a user