Index: denali.pro =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- denali.pro (.../denali.pro) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ denali.pro (.../denali.pro) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -93,6 +93,7 @@ HEADERS += \ \ # common common/AlarmDefs.h \ + common/Compatible.h \ common/DGDefs.h \ common/HDDefs.h \ common/MsgDefs.h \ Index: denali.pro.user =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- denali.pro.user (.../denali.pro.user) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ denali.pro.user (.../denali.pro.user) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -1,6 +1,6 @@ - + EnvironmentId Index: en_US.udic =================================================================== diff -u -r1b24a85761c65a685fac98f396e244af97b94443 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- en_US.udic (.../en_US.udic) (revision 1b24a85761c65a685fac98f396e244af97b94443) +++ en_US.udic (.../en_US.udic) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -139,3 +139,13 @@ CRC fprintf dialin +Msg +VEvent +HDPOSTDone +HDPOSTItem +DGPOSTDone +DGPOSTItem +UIPOSTDone +UIPost +vID +vMODEL Index: main.cpp =================================================================== diff -u -r13d6a4fae2f910ab6e289ac9280258a94f734405 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- main.cpp (.../main.cpp) (revision 13d6a4fae2f910ab6e289ac9280258a94f734405) +++ main.cpp (.../main.cpp) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -37,6 +37,9 @@ #include #include +// FW +#include "Compatible.h" + // Project #include "MainTimer.h" #include "CanInterface.h" @@ -138,15 +141,15 @@ QCoreApplication::translate("main", "Show the Message Output")); parser.addOption(optionConsoleoutFrameInterface); - // --- -m : msgOut + // --- -l : logOut QCommandLineOption optionConsoleoutLogs( QStringList() << "l" << "logOut", QCoreApplication::translate("main", "Show the Logs Output")); parser.addOption(optionConsoleoutLogs); // --- -0 : enable-keep-awake (the fast mode) QCommandLineOption optionSendEmptyKeepAwake(QStringList() << "0" << "enable-keep-awake", - QCoreApplication::translate("main", "Enable send low priority, empty message on the CANBus just to keep UI board CAN driver awake")); + QCoreApplication::translate("main", "Enable send low priority, empty message on the CANBus just to keep UI board CAN driver awake")); parser.addOption(optionSendEmptyKeepAwake); // --- -i : fake-interval @@ -173,12 +176,12 @@ // --- -u : disable-unhandled-report QCommandLineOption optionDisableUnhandledReport(QStringList() << "u" << "disable-unhandled-report", - QCoreApplication::translate("main", "Disable unhandled messages report as an error in the log")); + QCoreApplication::translate("main", "Disable unhandled messages report as an error in the log")); parser.addOption(optionDisableUnhandledReport); - // --- -u : disable-unhandled-report + // --- -q : disable-timeout QCommandLineOption optionDisableTimeout(QStringList() << "q" << "disable-timeout", - QCoreApplication::translate("main", "Disables HD communication timeout")); + QCoreApplication::translate("main", "Disables HD communication timeout")); parser.addOption(optionDisableTimeout); // --- parse command lines @@ -217,38 +220,44 @@ * and revision(build) version will be set to current date/time. */ void setApplicationVersion() { - bool ver_revis_empty = false; + bool isOnServer = true; QString ver_major = QString("%1").arg(VER_MAJOR ); QString ver_minor = QString("%1").arg(VER_MINOR ); QString ver_micro = QString("%1").arg(VER_MICRO ); QString ver_revis = QString("%1").arg(VER_REVIS ); QString ver_branch = QString("%1").arg(VER_BRANCH ); + QString ver_comp = QString("%1").arg(SW_COMPATIBILITY_REV ); if (ver_revis.isEmpty()) { ver_revis = VER_REVIS_DEV; - ver_revis_empty = true; + isOnServer = false; } - const char * masterbranch = "master"; - bool isOnMaster = !ver_branch.compare(masterbranch); - if (isOnMaster) { - ver_branch = ver_revis_empty ? masterbranch : ""; - ver_major += '.'; - ver_minor += '.'; - ver_micro += '.'; + bool isOnMaster = ver_branch == "master"; + bool isNotStory = isOnMaster + || ver_branch == "staging" + || ver_branch == "develop"; + if (isNotStory) { + if (isOnServer) { + if (isOnMaster ) { + ver_branch = ""; // if only is built on server master branch don't show branch + } + ver_major += '.'; + ver_minor += '.'; + ver_micro += '.'; + } } - else { - ver_branch = VER_BRANCH ; - ver_revis = VER_REVIS_DEV ; - } + if ( ! ver_branch.isEmpty()) ver_branch += '.'; QCoreApplication::setApplicationVersion( - QString("%1%2%3%4%5") + QString("%1%2%3%4%5.%6") .arg(ver_branch) .arg(ver_major) .arg(ver_minor) .arg(ver_micro) - .arg(ver_revis)); + .arg(ver_revis) + .arg(ver_comp ) + ); } #ifdef UNIT_TEST Index: sources/canbus/MessageDispatcher.cpp =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -421,9 +421,14 @@ * \param vData - Data model contains HD Version state. * \return void */ -void MessageDispatcher::onAdjustment(const AdjustVersionsRequestData &) +void MessageDispatcher::onAdjustment(const AdjustVersionsRequestData &vData) { QVariantList mData; + mData += QVariant::fromValue(vData.ver_major); + mData += QVariant::fromValue(vData.ver_minor); + mData += QVariant::fromValue(vData.ver_micro); + mData += QVariant::fromValue(vData.ver_revis); + mData += QVariant::fromValue(vData.ver_comp ); onActionTransmit(GuiActionType::ID_AdjustVersionsReq, mData); } Index: sources/canbus/MessageDispatcher.h =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/canbus/MessageDispatcher.h (.../MessageDispatcher.h) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ sources/canbus/MessageDispatcher.h (.../MessageDispatcher.h) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -105,8 +105,9 @@ QThread *_thread = nullptr; bool _init = false; + // List of the transmit(request) only, messages which require acknowledge back(AckBack). QList _needsAcknow { - // Power on self test + // POST GuiActionType::ID_UIPostFinalResultData , // Alarm GuiActionType::ID_AlarmUserActionReq , Index: sources/canbus/MessageGlobals.h =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -50,11 +50,11 @@ {Gui::GuiActionType::ID_KeepAlive , 255 }, // 0 => 255 to be able to run a multi-frame test. // POST - {Gui::GuiActionType::ID_UIPostFinalResultData , 1 * 4 }, // 1 parameters each 4bytes {Gui::GuiActionType::ID_HDPostSingleResultData , 2 * 4 }, // 2 parameters each 4bytes {Gui::GuiActionType::ID_HDPostFinalResultData , 1 * 4 }, // 1 parameters each 4bytes {Gui::GuiActionType::ID_DGPostSingleResultData , 2 * 4 }, // 2 parameters each 4bytes {Gui::GuiActionType::ID_DGPostFinalResultData , 1 * 4 }, // 1 parameters each 4bytes + {Gui::GuiActionType::ID_UIPostFinalResultData , 1 * 4 }, // 1 parameters each 4bytes // ----- {Gui::GuiActionType::ID_TreatmentTime , 3 * 4 }, // 3 parameters each 4bytes @@ -205,7 +205,7 @@ {Gui::GuiActionType::ID_TreatmentLogEventData , 3 * 4 }, // 3 parameter each 4bytes // ---- Versions - {Gui::GuiActionType::ID_AdjustVersionsReq , 0 * 4 }, // 0 parameters each 4bytes + {Gui::GuiActionType::ID_AdjustVersionsReq ,1+1+1+2+4 }, // variable length parameters {Gui::GuiActionType::ID_AdjustVersionsHDRsp ,1+1+1+2+1+1+1+1}, // variable length parameters {Gui::GuiActionType::ID_AdjustVersionsDGRsp ,1+1+1+2+1+1+1+1}, // variable length parameters {Gui::GuiActionType::ID_AdjustSerialHDRsp , 15 * 1 }, // 1 parameter 15bytes Index: sources/canbus/MessageInterpreter.cpp =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ sources/canbus/MessageInterpreter.cpp (.../MessageInterpreter.cpp) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -239,7 +239,7 @@ // POST case Gui::GuiActionType::ID_UIPostFinalResultData : INTERPRET_TRANSMIT_MESSAGE(AdjustUIPostFinalResultRequestData ); break; // Settings - case Gui::GuiActionType::ID_AdjustVersionsReq : INTERPRET_TRSMT_MT_MESSAGE(AdjustVersionsRequestData ); break; + case Gui::GuiActionType::ID_AdjustVersionsReq : INTERPRET_TRANSMIT_MESSAGE(AdjustVersionsRequestData ); break; case Gui::GuiActionType::ID_AdjustHDDateTimeReq : INTERPRET_TRANSMIT_MESSAGE(AdjustHDDateTimeRequestData ); break; case Gui::GuiActionType::ID_AdjustDGDateTimeReq : INTERPRET_TRANSMIT_MESSAGE(AdjustDGDateTimeRequestData ); break; case Gui::GuiActionType::ID_AdjustServiceReq : INTERPRET_TRSMT_MT_MESSAGE(AdjustServiceRequestData ); break; @@ -372,6 +372,10 @@ case Gui::GuiActionType::ID_PowerOff : ok = notify(vMessage, vData, Gui::GuiActionType::ID_PowerOff ); break; case Gui::GuiActionType::ID_ShuttingDown : ok = true; LOG_EVENT("HD,ShuttingDown"); break; // TODO : implement notify<>() + // ----- POST + case Gui::GuiActionType::ID_HDPostSingleResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDPostSingleResultData ); break; + case Gui::GuiActionType::ID_HDPostFinalResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDPostFinalResultData ); break; + // ----- Settings case Gui::GuiActionType::ID_AdjustVersionsHDRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustVersionsHDRsp ); break; case Gui::GuiActionType::ID_AdjustSerialHDRsp : ok = notify(vMessage, vData, Gui::GuiActionType::ID_AdjustSerialHDRsp ); break; @@ -387,8 +391,6 @@ // ----- Datum case Gui::GuiActionType::ID_HDAccelerometerData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDAccelerometerData ); break; - case Gui::GuiActionType::ID_HDPostSingleResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDPostSingleResultData ); break; - case Gui::GuiActionType::ID_HDPostFinalResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_HDPostFinalResultData ); break; // ----- Datum - Treatment case Gui::GuiActionType::ID_TreatmentRanges : ok = notify(vMessage, vData, Gui::GuiActionType::ID_TreatmentRanges ); break; @@ -488,6 +490,10 @@ ok = true; LOG_EVENT(QString("DG,CheckIn," + QVariant(vData).toStringList().join(','))); break; + // ----- POST + case Gui::GuiActionType::ID_DGPostSingleResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGPostSingleResultData ); break; + case Gui::GuiActionType::ID_DGPostFinalResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGPostFinalResultData ); break; + // DG data messages case Gui::GuiActionType::ID_DGROPumpData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGROPumpData ); break; case Gui::GuiActionType::ID_DGPressuresData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGPressuresData ); break; @@ -500,8 +506,6 @@ case Gui::GuiActionType::ID_DGTemperaturesData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGTemperaturesData ); break; case Gui::GuiActionType::ID_DGDebugText : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGDebugText ); break; case Gui::GuiActionType::ID_DGAccelerometerData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGAccelerometerData ); break; - case Gui::GuiActionType::ID_DGPostSingleResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGPostSingleResultData ); break; - case Gui::GuiActionType::ID_DGPostFinalResultData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGPostFinalResultData ); break; // ----- Datum - Pre-Treatment progress case Gui::GuiActionType::ID_DGFilterFlushData : ok = notify(vMessage, vData, Gui::GuiActionType::ID_DGFilterFlushData ); break; // ----- Datum - Disinfection Index: sources/model/dg/data/post/MDGPostFinalResultData.h =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/model/dg/data/post/MDGPostFinalResultData.h (.../MDGPostFinalResultData.h) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ sources/model/dg/data/post/MDGPostFinalResultData.h (.../MDGPostFinalResultData.h) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -27,7 +27,7 @@ namespace Model { /*! - * rief The MDGPostFinalResult class + * \brief The MDGPostFinalResult class * \details Model for the final DG post result * * | MSG | CAN ID | Type | Ack | Src | Dst | Description | @@ -44,9 +44,9 @@ *

Logging info

* | || * | || - * | typeText | Event | - * | unitText | DG | - * | infoText | DGPostFinalResult | + * | typeText | Event | + * | unitText | DG | + * | infoText | DGPOSTDone | * */ @@ -63,9 +63,9 @@ public: - Type_Enum typeText () const override { return Type_Enum::eDatum ;} - Unit_Enum unitText () const override { return Unit_Enum::eDG ;} - QString infoText () const override { return QString("DGPostFinalResult") ;} + Type_Enum typeText () const override { return Type_Enum::eDatum ;} + Unit_Enum unitText () const override { return Unit_Enum::eDG ;} + QString infoText () const override { return QString("DGPOSTDone") ;} struct Data { quint32 mResult; Index: sources/model/dg/data/post/MDGPostSingleResultData.h =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/model/dg/data/post/MDGPostSingleResultData.h (.../MDGPostSingleResultData.h) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ sources/model/dg/data/post/MDGPostSingleResultData.h (.../MDGPostSingleResultData.h) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -27,7 +27,7 @@ namespace Model { /*! - * rief The MDGPostSingleResult class + * \brief The MDGPostSingleResult class * \details Model for a single DG post result * * | MSG | CAN ID | Type | Ack | Src | Dst | Description | @@ -45,9 +45,9 @@ *

Logging info

* | || * | || - * | typeText | Event | - * | unitText | DG | - * | infoText | DGPostSingleResult | + * | typeText | Event | + * | unitText | DG | + * | infoText | DGPOSTItem | * */ @@ -65,9 +65,9 @@ public: - Type_Enum typeText () const override { return Type_Enum::eDatum ;} - Unit_Enum unitText () const override { return Unit_Enum::eDG ;} - QString infoText () const override { return QString("DGPostSingleResult") ;} + Type_Enum typeText () const override { return Type_Enum::eDatum ;} + Unit_Enum unitText () const override { return Unit_Enum::eDG ;} + QString infoText () const override { return QString("DGPOSTItem") ;} struct Data { quint32 mResult; Index: sources/model/hd/adjustment/settings/MAdjustHDRequests.h =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/model/hd/adjustment/settings/MAdjustHDRequests.h (.../MAdjustHDRequests.h) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ sources/model/hd/adjustment/settings/MAdjustHDRequests.h (.../MAdjustHDRequests.h) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -17,7 +17,10 @@ // Qt -//project +// FW +#include "Compatible.h" + +// project #include "MAdjustRequestsBase.h" using namespace Gui; @@ -96,16 +99,31 @@ * * | Payload || * | || - * | (N/A) || + * | #1:(U08) | major | + * | #2:(U08) | minor | + * | #3:(U08) | micro | + * | #4:(U16) | revision(build) | + * | #5:(U32) | compatibility | * */ class MAdjustVersionsReq : public MModel { public: + quint8 ver_major = QString("%1").arg(VER_MAJOR ).toUInt(); + quint8 ver_minor = QString("%1").arg(VER_MINOR ).toUInt(); + quint8 ver_micro = QString("%1").arg(VER_MICRO ).toUInt(); + quint16 ver_revis = QString("%1").arg(VER_REVIS ).toUInt(); + quint32 ver_comp = QString("%1").arg(SW_COMPATIBILITY_REV).toUInt(); + // coco begin validated : Has been validated manually. // This object is used statically for now, kept the logic for later usage. QString toString() { - return toString({}); + return toString({ ver_major , + ver_minor , + ver_micro , + ver_revis , + ver_comp , + }); } // coco end static QString toString(const QVariantList &vParameters) { @@ -170,7 +188,7 @@ } // coco end static QString toString(const QVariantList &vParameters) { - return MModel::toString("AdjustUIPostFinalResult", vParameters); + return MModel::toString("UIPOSTDone", vParameters); } }; } Index: sources/model/hd/data/post/MHDPostFinalResultData.h =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/model/hd/data/post/MHDPostFinalResultData.h (.../MHDPostFinalResultData.h) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ sources/model/hd/data/post/MHDPostFinalResultData.h (.../MHDPostFinalResultData.h) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -27,7 +27,7 @@ namespace Model { /*! - * rief The MHDPostFinalResult class + * \brief The MHDPostFinalResult class * \details Model for the final HD post result * * | MSG | CAN ID | Type | Ack | Src | Dst | Description | @@ -44,9 +44,9 @@ *

Logging info

* | || * | || - * | typeText | Event | - * | unitText | HD | - * | infoText | HDPostFinalResult | + * | typeText | Event | + * | unitText | HD | + * | infoText | HDPOSTDone | * */ @@ -63,9 +63,9 @@ public: - Type_Enum typeText () const override { return Type_Enum::eDatum ;} - Unit_Enum unitText () const override { return Unit_Enum::eHD ;} - QString infoText () const override { return QString("HDPostFinalResult") ;} + Type_Enum typeText () const override { return Type_Enum::eDatum ;} + Unit_Enum unitText () const override { return Unit_Enum::eHD ;} + QString infoText () const override { return QString("HDPOSTDone") ;} struct Data { quint32 mResult; Index: sources/model/hd/data/post/MHDPostSingleResultData.h =================================================================== diff -u -r667baa15f6fc3a9438dae68ded8cee26c2ca7450 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/model/hd/data/post/MHDPostSingleResultData.h (.../MHDPostSingleResultData.h) (revision 667baa15f6fc3a9438dae68ded8cee26c2ca7450) +++ sources/model/hd/data/post/MHDPostSingleResultData.h (.../MHDPostSingleResultData.h) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -27,7 +27,7 @@ namespace Model { /*! - * rief The MHDPostSingleResult class + * \brief The MHDPostSingleResult class * \details Model for a single HD post result * * | MSG | CAN ID | Type | Ack | Src | Dst | Description | @@ -45,9 +45,9 @@ *

Logging info

* | || * | || - * | typeText | Event | - * | unitText | HD | - * | infoText | HDPostSingleResult | + * | typeText | Event | + * | unitText | HD | + * | infoText | HDPOSTItem | * */ @@ -65,9 +65,9 @@ public: - Type_Enum typeText () const override { return Type_Enum::eDatum ;} - Unit_Enum unitText () const override { return Unit_Enum::eHD ;} - QString infoText () const override { return QString("HDPostSingleResult") ;} + Type_Enum typeText () const override { return Type_Enum::eDatum ;} + Unit_Enum unitText () const override { return Unit_Enum::eHD ;} + QString infoText () const override { return QString("HDPOSTItem") ;} struct Data { quint32 mResult; Index: sources/utility/format.cpp =================================================================== diff -u -r13d6a4fae2f910ab6e289ac9280258a94f734405 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/utility/format.cpp (.../format.cpp) (revision 13d6a4fae2f910ab6e289ac9280258a94f734405) +++ sources/utility/format.cpp (.../format.cpp) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -77,51 +77,95 @@ QByteArray Format::fromVariant(const QVariant &vData) { QByteArray mData; - if(vData.type() == QVariant::String) { + + switch (static_cast(vData.type())) { + case QMetaType::QString: // string + { mData += vData.toByteArray(); return mData; } - if(vData.type() == QVariant::ByteArray) { + case QMetaType::QByteArray: // byte array + { mData += vData.toByteArray(); return mData; } - if ( vData.type() == static_cast(QMetaType::Float) || - vData.type() == QVariant::Double ) { + case QMetaType::QVariantList: // list + { + QVariantList list = vData.toList(); + for(auto item: list) { + mData += fromVariant(item); + } + return mData; + } + case QMetaType::Bool: // bool + { + mData += vData.toUInt(); + return mData; + } + + case QMetaType::Float: + case QMetaType::Double: // F32 + { Types::F32 f32; f32.value = vData.toFloat(); Types::setValue(f32, mData); return mData; } - if ( vData.type() == QVariant::UInt ) { + case QMetaType::UInt: // U32 + { Types::U32 u32; u32.value = vData.toUInt(); Types::setValue(u32, mData); return mData; } - if ( vData.type() == QVariant::Int ) { + case QMetaType::Int: // S32 + { Types::S32 s32; s32.value = vData.toInt(); Types::setValue(s32, mData); return mData; } - if ( vData.type() == QVariant::List ) { - QVariantList list = vData.toList(); - for(auto item: list) { - mData += fromVariant(item); - } + case QMetaType::Short: // S16 + { + Types::S16 s16; + s16.value = vData.toInt(); + Types::setValue(s16, mData); return mData; } - if ( vData.type() == QVariant::Bool ) { - mData += vData.toUInt(); + case QMetaType::UShort: // U16 + { + Types::U16 u16; + u16.value = vData.toInt(); + Types::setValue(u16, mData); return mData; } + case QMetaType::Char: // S08 + { + Types::S08 s08; + s08.value = vData.toInt(); + Types::setValue(s08, mData); + return mData; + } + + case QMetaType::UChar: // U08 + { + Types::U08 u08; + u08.value = vData.toInt(); + Types::setValue(u08, mData); + return mData; + } + + default: + break; + } + mData += '\0'; return mData; } Index: sources/utility/types.h =================================================================== diff -u -r64d87d540594252e8039ab2595016d98f1e3cc28 -r2f0d1d22a15f0ddb459c6527b4746439f66bfe1b --- sources/utility/types.h (.../types.h) (revision 64d87d540594252e8039ab2595016d98f1e3cc28) +++ sources/utility/types.h (.../types.h) (revision 2f0d1d22a15f0ddb459c6527b4746439f66bfe1b) @@ -52,61 +52,72 @@ * \details This is the union which will be used to extract the bytes of a float type value * 4 bytes */ - union F32 { + union F32 { // F32 float value = 0; quint8 bytes[sizeof(float)]; }; /*! - * \brief The U08 union - * \details This is the union which will be used to extract the byte of an unsigned char type value - * 1 byte + * \brief The U32 union + * \details This is the union which will be used to extract the bytes of an unsigned int type value + * 4 bytes */ - union U08 { - quint8 value = 0; - quint8 bytes[sizeof(quint8)]; + union U32 { // U32 + quint32 value = 0; + quint8 bytes[sizeof(quint32)]; }; /*! + * \brief The S32 union + * \details This is the union which will be used to extract the bytes of an signed int type value + * 4 bytes + */ + union S32 { // S32 + qint32 value = 0; + quint8 bytes[sizeof(qint32)]; + }; + + /*! * \brief The U16 union * \details This is the union which will be used to extract the bytes of an unsigned char type value * 2 bytes */ - union U16 { + union U16 { // U16 quint16 value = 0; quint8 bytes[sizeof(quint16)]; }; /*! - * \brief The U32 union - * \details This is the union which will be used to extract the bytes of an unsigned int type value - * 4 bytes - */ - union U32 { - quint32 value = 0; - quint8 bytes[sizeof(quint32)]; - }; - - /*! * \brief The S32 union * \details This is the union which will be used to extract the bytes of an signed int type value * 4 bytes */ - union S16 { + union S16 { // S16 qint16 value = 0; quint8 bytes[sizeof(qint16)]; }; /*! - * \brief The S32 union - * \details This is the union which will be used to extract the bytes of an signed int type value - * 4 bytes + * \brief The U08 union + * \details This is the union which will be used to extract the byte of an unsigned char type value + * 1 byte */ - union S32 { - qint32 value = 0; - quint8 bytes[sizeof(qint32)]; + union U08 { // U08 + quint8 value = 0; + quint8 bytes[sizeof(quint8)]; }; + /*! + * \brief The S08 union + * \details This is the union which will be used to extract the byte of an signed char type value + * 1 byte + */ + union S08 { // S08 + qint8 value = 0; + qint8 bytes[sizeof(qint8)]; + }; + + static bool floatCompare(float f1, float f2); template < typename T >