diff --git a/dll/commdll.dll b/dll/commdll.dll index 8dd2c3b..f9e2da5 100644 Binary files a/dll/commdll.dll and b/dll/commdll.dll differ diff --git a/dll/iodll.dll b/dll/iodll.dll index e81fe81..28eb6c5 100644 Binary files a/dll/iodll.dll and b/dll/iodll.dll differ diff --git a/dll/iodllD.dll b/dll/iodllD.dll index 07eb1e5..7a72648 100644 Binary files a/dll/iodllD.dll and b/dll/iodllD.dll differ diff --git a/dll/mcctrdll.dll b/dll/mcctrdll.dll index c789c50..2bf7a26 100644 Binary files a/dll/mcctrdll.dll and b/dll/mcctrdll.dll differ diff --git a/dll/mcctrdllD.dll b/dll/mcctrdllD.dll index 244fe7c..ff1bd3d 100644 Binary files a/dll/mcctrdllD.dll and b/dll/mcctrdllD.dll differ diff --git a/dll/secsgemdll.dll b/dll/secsgemdll.dll index 9b5aa35..20f2326 100644 Binary files a/dll/secsgemdll.dll and b/dll/secsgemdll.dll differ diff --git a/dll/utility.dll b/dll/utility.dll index 5b0611a..3c575af 100644 Binary files a/dll/utility.dll and b/dll/utility.dll differ diff --git a/iodll/Include/DebugStucture.h b/iodll/Include/DebugStucture.h index 6ad6907..800cf62 100644 --- a/iodll/Include/DebugStucture.h +++ b/iodll/Include/DebugStucture.h @@ -14,6 +14,7 @@ namespace nsDebug { using stDebug = struct _stDebug { stHardware Hardware; stHardware InitController; + stHardware MmfLog; }; } @@ -59,13 +60,15 @@ namespace nsDebug { { getValue(j, "Hardware", x.Hardware); getValue(j, "InitController", x.InitController); + getValue(j, "MmfLog", x.MmfLog); } inline void to_json(json& j, const stDebug& x) { j = nlohmann::json{ { "Hardware", x.Hardware }, - { "InitController", x.InitController } + { "InitController", x.InitController }, + { "MmfLog", x.MmfLog } }; } } \ No newline at end of file diff --git a/iodll/Include/InputController.h b/iodll/Include/InputController.h index 59a1061..e7fc966 100644 --- a/iodll/Include/InputController.h +++ b/iodll/Include/InputController.h @@ -13,13 +13,6 @@ class CInputSetting; -class IODLLCLASS CIpStatus -{ -public: - char m_cPtName[100]; - bool m_bOn; -}; - class IODLLCLASS CInputController : public CCard { public: diff --git a/iodll/Include/InputStatus.h b/iodll/Include/InputStatus.h new file mode 100644 index 0000000..dadff0c --- /dev/null +++ b/iodll/Include/InputStatus.h @@ -0,0 +1,51 @@ +#pragma once + +#include "nlohmann/json.hpp" + +#include "GeneralUtils.h" + +namespace nsMMF +{ + // !!! Do Not change the order to support MMF use case + using InputStatus = struct _InputStatus { + char PtName[100]{}; + bool On{ false }; + + // Assignment operator overload + _InputStatus& operator=(const _InputStatus& rhs) + { + // + strcpy_s(PtName, rhs.PtName); + + On = rhs.On; + + return *this; + } + }; +} + +namespace nsMMF +{ + using namespace nlohmann; + using namespace nsUtils; + + void from_json(const json& j, InputStatus& x); + void to_json(json& j, const InputStatus& x); + + inline void from_json(const json& j, InputStatus& x) + { + std::string name = j.at("PtName").get(); + strcpy_s(x.PtName, name.c_str()); + + getValue(j, "On", x.On); + } + + inline void to_json(json& j, const InputStatus& x) + { + j = nlohmann::json{ + { "PtName", x.PtName }, + { "On", x.On } + }; + } + +} \ No newline at end of file diff --git a/iodll/Include/MotionController.h b/iodll/Include/MotionController.h index 8e06385..5c7a34e 100644 --- a/iodll/Include/MotionController.h +++ b/iodll/Include/MotionController.h @@ -11,27 +11,6 @@ #include "DllDefines.h" #include "HardwareCfgFactory.h" -class IODLLCLASS CMtrStatus -{ -public: - bool m_bNegLimHit; // 0 - bool m_bPosLimHit; // 1 - bool m_bHomed; // 2 - bool m_bServoReady; // 3 - bool m_bServoAlarm; // 4 - bool m_bInPosition; // 5 - bool m_bMtrOn; // 6 - bool m_bpMtrCurOnOff; // 7 // array to store motor On/Off States before maintenance mode - double m_dMtrPos; // 8 - double m_dPosErr; // 16 - unsigned short m_usMotionStatus; // 24 - unsigned short m_usStatus; // 26 - int m_iMtrNo; // 28 // motor no wrt the type of card used - int m_iMtrType; // 32 // servo or stepper, with or without encoder feedback - int m_ipMtrCurPos; // 36 // array to store motor position before maintenance mode - char m_cMotorName[104]; // 40~ 144 (original size 4 bytes - but has to end on a 8-byte align address) -}; - class IODLLCLASS CMotionController : public CCard { public: diff --git a/iodll/Include/MotorStatus.h b/iodll/Include/MotorStatus.h new file mode 100644 index 0000000..ceae6da --- /dev/null +++ b/iodll/Include/MotorStatus.h @@ -0,0 +1,107 @@ +#pragma once + +#include "nlohmann/json.hpp" + +#include "GeneralUtils.h" + +namespace nsMMF +{ + // !!! Do Not change the order to support MMF use case + using MotorStatus = struct _MotorStatus { + bool NegLimHit{ false }; // 0 + bool PosLimHit{ false }; // 1 + bool Homed{ false }; // 2 + bool ServoReady{ false }; // 3 + bool ServoAlarm{ false }; // 4 + bool InPosition{ false }; // 5 + bool MtrOn{ false }; // 6 + bool MtrCurOnOff{ false }; // 7 // array to store motor On/Off States before maintenance mode + double MtrPos{ 0. }; // 8 + double PosErr{ 0. }; // 16 + unsigned short MotionStatus{ 0 }; // 24 + unsigned short Status{ 0 }; // 26 + int MtrNo{ 0 }; // 28 // motor no wrt the type of card used + int MtrType{ 0 }; // 32 // servo or stepper, with or without encoder feedback + int MtrCurPos{ 0 }; // 36 // array to store motor position before maintenance mode + char MotorName[104]{ "AACC" }; // 40~ 144 (original size 4 bytes - but has to end on a 8-byte align address) + + // Assignment operator overload + _MotorStatus& operator=(const _MotorStatus& rhs) + { + NegLimHit = rhs.NegLimHit; + PosLimHit = rhs.PosLimHit; + Homed = rhs.Homed; + ServoReady = rhs.ServoReady; + ServoAlarm = rhs.ServoAlarm; + InPosition = rhs.InPosition; + MtrOn = rhs.MtrOn; + MtrCurOnOff = rhs.MtrCurOnOff; + MtrPos = rhs.MtrPos; + PosErr = rhs.PosErr; + MotionStatus = rhs.MotionStatus; + Status = rhs.Status; + MtrNo = rhs.MtrNo; + MtrType = rhs.MtrType; + MtrCurPos = rhs.MtrCurPos; + // + strcpy_s(MotorName, rhs.MotorName); + + return *this; + } + }; +} + +namespace nsMMF +{ + using namespace nlohmann; + using namespace nsUtils; + + void from_json(const json& j, MotorStatus& x); + void to_json(json& j, const MotorStatus& x); + + inline void from_json(const json& j, MotorStatus& x) + { + getValue(j, "NegLimHit", x.NegLimHit); + getValue(j, "PosLimHit", x.PosLimHit); + getValue(j, "Homed", x.Homed); + getValue(j, "ServoReady", x.ServoReady); + getValue(j, "ServoAlarm", x.ServoAlarm); + getValue(j, "InPosition", x.InPosition); + getValue(j, "MtrOn", x.MtrOn); + getValue(j, "MtrCurOnOff", x.MtrCurOnOff); + getValue(j, "MtrPos", x.MtrPos); + getValue(j, "PosErr", x.PosErr); + getValue(j, "MotionStatus", x.MotionStatus); + getValue(j, "Status", x.Status); + getValue(j, "MtrNo", x.MtrNo); + getValue(j, "MtrType", x.MtrType); + getValue(j, "MtrCurPos", x.MtrCurPos); + //getValue(j, "MotorName", x.MotorName); + + std::string name = j.at("MotorName").get(); + strcpy_s(x.MotorName, name.c_str()); + } + + inline void to_json(json& j, const MotorStatus& x) + { + j = nlohmann::json{ + { "NegLimHit", x.NegLimHit }, + { "PosLimHit", x.PosLimHit }, + { "Homed", x.Homed }, + { "ServoReady", x.ServoReady }, + { "ServoAlarm", x.ServoAlarm }, + { "InPosition", x.InPosition }, + { "MtrOn", x.MtrOn }, + { "MtrCurOnOff", x.MtrCurOnOff }, + { "MtrPos", x.MtrPos }, + { "PosErr", x.PosErr }, + { "MotionStatus", x.MotionStatus }, + { "Status", x.Status }, + { "MtrNo", x.MtrNo }, + { "MtrType", x.MtrType }, + { "MtrCurPos", x.MtrCurPos }, + { "MotorName", x.MotorName } + }; + } + +} \ No newline at end of file diff --git a/iodll/Include/OutputController.h b/iodll/Include/OutputController.h index e0b68db..3cc5dc2 100644 --- a/iodll/Include/OutputController.h +++ b/iodll/Include/OutputController.h @@ -15,15 +15,6 @@ class COutputSetting; -class IODLLCLASS COpStatus -{ -public: - char m_cPtName[100]; - bool m_bOn; - bool m_bRequestChgState; - bool m_bChgStateOn; -}; - class IODLLCLASS COutputController : public CCard { public: diff --git a/iodll/Include/OutputStatus.h b/iodll/Include/OutputStatus.h new file mode 100644 index 0000000..7d7bd9e --- /dev/null +++ b/iodll/Include/OutputStatus.h @@ -0,0 +1,59 @@ +#pragma once + +#include "nlohmann/json.hpp" + +#include "GeneralUtils.h" + +namespace nsMMF +{ + // !!! Do Not change the order to support MMF use case + using OutputStatus = struct _OutputStatus { + char PtName[100]{}; + bool On{ false }; + bool RequestChgState{ false }; + bool ChgStateOn{ false }; + + // Assignment operator overload + _OutputStatus& operator=(const _OutputStatus& rhs) + { + // + strcpy_s(PtName, rhs.PtName); + + On = rhs.On; + RequestChgState = rhs.RequestChgState; + ChgStateOn = rhs.ChgStateOn; + return *this; + } + }; +} + +namespace nsMMF +{ + using namespace nlohmann; + using namespace nsUtils; + + void from_json(const json& j, OutputStatus& x); + void to_json(json& j, const OutputStatus& x); + + + inline void from_json(const json& j, OutputStatus& x) + { + std::string name = j.at("PtName").get(); + strcpy_s(x.PtName, name.c_str()); + + getValue(j, "On", x.On); + getValue(j, "RequestChgState", x.RequestChgState); + getValue(j, "ChgStateOn", x.ChgStateOn); + } + + inline void to_json(json& j, const OutputStatus& x) + { + j = nlohmann::json{ + { "PtName", x.PtName }, + { "On", x.On }, + { "RequestChgState", x.RequestChgState }, + { "ChgStateOn", x.ChgStateOn } + }; + } + +} \ No newline at end of file diff --git a/iodll/lib/iodll.lib b/iodll/lib/iodll.lib index 82dc972..a322a07 100644 Binary files a/iodll/lib/iodll.lib and b/iodll/lib/iodll.lib differ diff --git a/iodll/lib/iodllD.lib b/iodll/lib/iodllD.lib index fce10a8..b9140ac 100644 Binary files a/iodll/lib/iodllD.lib and b/iodll/lib/iodllD.lib differ