From 7c32f538ca587635a0a2ba41ee71ab65c3745491 Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Wed, 23 Jul 2025 09:46:33 +0100 Subject: [PATCH 01/13] modifications to use custom_alarm_msg. --- pdbApp/pvif.cpp | 31 ++++++++++++++++- testApp/test_custom_alarm.db | 10 ++++++ testApp/testpvif.cpp | 66 ++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 testApp/test_custom_alarm.db diff --git a/pdbApp/pvif.cpp b/pdbApp/pvif.cpp index 6f26d9c..8d7b9a7 100644 --- a/pdbApp/pvif.cpp +++ b/pdbApp/pvif.cpp @@ -27,6 +27,13 @@ #include +#include +#include + +#ifdef HAVE_UTAG +#define ISIS_CUSTOM_ALARM_MSG +#endif + #ifdef EPICS_VERSION_INT # if EPICS_VERSION_INT>=VERSION_INT(3,16,1,0) # define USE_INT64 @@ -344,18 +351,32 @@ void attachAll(PVX& pvm, const pvd::PVStructurePtr& pv) } template +#ifdef ISIS_CUSTOM_ALARM_MSG +void mapStatus(const Meta& meta, pvd::PVInt* status, pvd::PVString* message, dbChannel *chan) +#else void mapStatus(const Meta& meta, pvd::PVInt* status, pvd::PVString* message) +#endif { +#ifdef ISIS_CUSTOM_ALARM_MSG + pdbRecordIterator info(chan); + const char *userMsg = info.info("q:alarm:user_message"); +#endif #ifdef HAVE_UTAG if(meta.amsg[0]!='\0') { message->put(meta.amsg); } else #endif +#ifdef ISIS_CUSTOM_ALARM_MSG + if(userMsg != NULL && meta.status > NO_ALARM) { + message->put(userMsg); + } else +#endif + { if(meta.statusput(epicsAlarmConditionStrings[meta.status]); else message->put("???"); - + } // Arbitrary mapping from DB status codes unsigned out; switch(meta.status) { @@ -425,7 +446,11 @@ void putTime(const pvTimeAlarm& pv, unsigned dbe, db_field_log *pfl) putMetaImpl(pv, meta); if(dbe&DBE_ALARM) { + #ifdef ISIS_CUSTOM_ALARM_MSG + mapStatus(meta, pv.status.get(), pv.message.get(), pv.chan); + #else mapStatus(meta, pv.status.get(), pv.message.get()); + #endif pv.severity->put(meta.severity); } } @@ -571,7 +596,11 @@ void putMeta(const pvCommon& pv, unsigned dbe, db_field_log *pfl) putMetaImpl(pv, meta); #define FMAP(MNAME, FNAME) pv.MNAME->put(meta.FNAME) if(dbe&DBE_ALARM) { + #ifdef ISIS_CUSTOM_ALARM_MSG + mapStatus(meta, pv.status.get(), pv.message.get(), pv.chan); + #else mapStatus(meta, pv.status.get(), pv.message.get()); + #endif FMAP(severity, severity); } if(dbe&DBE_PROPERTY) { diff --git a/testApp/test_custom_alarm.db b/testApp/test_custom_alarm.db new file mode 100644 index 0000000..a5c8453 --- /dev/null +++ b/testApp/test_custom_alarm.db @@ -0,0 +1,10 @@ +record(ai, "custom:ai") { + field(DESC, "Custom Analog Input for Alarm Test") + field(DTYP, "Soft Channel") + field(SCAN, "Passive") + field(HIHI, "50.0") + field(HIGH, "40.0") + field(HHSV, "MAJOR") + field(HSV, "MINOR") + info(q:alarm:user_message, "Custom Msg Alarm AI!") +} \ No newline at end of file diff --git a/testApp/testpvif.cpp b/testApp/testpvif.cpp index df0b609..e277c61 100644 --- a/testApp/testpvif.cpp +++ b/testApp/testpvif.cpp @@ -20,6 +20,11 @@ #include "pvif.h" #include "utilities.h" + +#ifdef HAVE_UTAG +#define ISIS_CUSTOM_ALARM_MSG +#endif + namespace pvd = epics::pvData; extern "C" @@ -637,12 +642,70 @@ void testFilters() testFieldEqual(root, "dut.value", expected); #endif // >= 7.0 } +#ifdef ISIS_CUSTOM_ALARM_MSG +void testCustomAlarmMessage() +{ + testDiag("testCustomAlarmMessage"); + + TestIOC IOC; + + testdbReadDatabase("p2pTestIoc.dbd", NULL, NULL); + p2pTestIoc_registerRecordDeviceDriver(pdbbase); + testdbReadDatabase("test_custom_alarm.db", NULL, NULL); + + aiRecord *prec_custom_ai = (aiRecord*)testdbRecordPtr("custom:ai"); + testTrue(prec_custom_ai != NULL); + + IOC.init(); + + DBCH chan_ai("custom:ai"); + + pvd::PVStructurePtr root; + p2p::auto_ptr pvif_ai; + { + ScalarBuilder builder_ai(chan_ai); + + pvd::StructureConstPtr dtype_root(pvd::getFieldCreate()->createFieldBuilder() + ->add("custom_ai", builder_ai.dtype()) + ->createStructure()); + root = pvd::getPVDataCreate()->createPVStructure(dtype_root); + pvif_ai.reset(builder_ai.attach(root, FieldName("custom_ai"))); + } + + pvd::BitSet mask; + + dbScanLock((dbCommon*)prec_custom_ai); + prec_custom_ai->val = 55.0; + dbProcess((dbCommon*)prec_custom_ai); + dbScanUnlock((dbCommon*)prec_custom_ai); + + pvif_ai->put(mask, DBE_ALARM|DBE_PROPERTY, NULL); + + testFieldEqual(root, "custom_ai.alarm.message", "Custom Msg Alarm AI!"); + testFieldEqual(root, "custom_ai.alarm.severity", 2); + testFieldEqual(root, "custom_ai.alarm.status", 1); + + dbScanLock((dbCommon*)prec_custom_ai); + prec_custom_ai->val = 25.0; + dbProcess((dbCommon*)prec_custom_ai); + dbScanUnlock((dbCommon*)prec_custom_ai); + pvif_ai->put(mask, DBE_ALARM|DBE_PROPERTY, NULL); + + testFieldEqual(root, "custom_ai.alarm.message", "NO_ALARM"); + testFieldEqual(root, "custom_ai.alarm.severity", 0); + testFieldEqual(root, "custom_ai.alarm.status", 0); +} +#endif // ISIS_CUSTOM_ALARM_MSG } // namespace MAIN(testpvif) { +#ifdef ISIS_CUSTOM_ALARM_MSG + testPlan(105); +#else testPlan(98); +#endif #ifdef USE_INT64 testDiag("Testing of 64-bit field access"); #else @@ -651,5 +714,8 @@ MAIN(testpvif) testScalar(); testPlain(); testFilters(); +#ifdef ISIS_CUSTOM_ALARM_MSG + testCustomAlarmMessage(); +#endif return testDone(); } From 42a3c4bba1f12e78dc119395e1a2d6de35f6e0ac Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Wed, 23 Jul 2025 11:47:46 +0100 Subject: [PATCH 02/13] Fixed minor issues. Removed unused include files. --- pdbApp/pvif.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/pdbApp/pvif.cpp b/pdbApp/pvif.cpp index 8d7b9a7..08baaa7 100644 --- a/pdbApp/pvif.cpp +++ b/pdbApp/pvif.cpp @@ -27,9 +27,6 @@ #include -#include -#include - #ifdef HAVE_UTAG #define ISIS_CUSTOM_ALARM_MSG #endif From 4618074962c33717bb4719d833dd475526e8f19a Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Thu, 24 Jul 2025 09:17:26 +0100 Subject: [PATCH 03/13] Add Chocolatey install step to AppVeyor CI --- .appveyor.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 2b42845..ae8caa1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,8 +11,10 @@ cache: #---------------------------------# install: -# for the sequencer - - cinst re2c + - ps: Set-ExecutionPolicy Bypass -Scope Process -Force + - ps: [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 + - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + - choco install re2c -y - cmd: git submodule update --init --recursive #---------------------------------# From 787535d22c47161d98e286ba2f5fa9b191814238 Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Thu, 24 Jul 2025 10:01:54 +0100 Subject: [PATCH 04/13] modified monior issue --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index ae8caa1..8b7cb5a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,7 +12,7 @@ cache: install: - ps: Set-ExecutionPolicy Bypass -Scope Process -Force - - ps: [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 + - ps: '[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072' - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - choco install re2c -y - cmd: git submodule update --init --recursive From 03d33f272a19ace3c38d0cf7a0daf8189e4de351 Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Thu, 24 Jul 2025 11:10:48 +0100 Subject: [PATCH 05/13] add pip install setuptools --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor.yml b/.appveyor.yml index 8b7cb5a..d8b2318 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -16,6 +16,7 @@ install: - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - choco install re2c -y - cmd: git submodule update --init --recursive + - cmd: pip install setuptools #---------------------------------# # repository cloning # From a98225cf4bd179d53883a9b6d594d21746ef9ee0 Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Thu, 24 Jul 2025 12:22:10 +0100 Subject: [PATCH 06/13] Changed the custom tag name and the long alarm message format. --- pdbApp/pvif.cpp | 14 +++++++------- testApp/test_custom_alarm.db | 2 +- testApp/testpvif.cpp | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pdbApp/pvif.cpp b/pdbApp/pvif.cpp index 08baaa7..047be11 100644 --- a/pdbApp/pvif.cpp +++ b/pdbApp/pvif.cpp @@ -28,7 +28,7 @@ #include #ifdef HAVE_UTAG -#define ISIS_CUSTOM_ALARM_MSG +#define CUSTOM_ALARM_MSG #endif #ifdef EPICS_VERSION_INT @@ -348,22 +348,22 @@ void attachAll(PVX& pvm, const pvd::PVStructurePtr& pv) } template -#ifdef ISIS_CUSTOM_ALARM_MSG +#ifdef CUSTOM_ALARM_MSG void mapStatus(const Meta& meta, pvd::PVInt* status, pvd::PVString* message, dbChannel *chan) #else void mapStatus(const Meta& meta, pvd::PVInt* status, pvd::PVString* message) #endif { -#ifdef ISIS_CUSTOM_ALARM_MSG +#ifdef CUSTOM_ALARM_MSG pdbRecordIterator info(chan); - const char *userMsg = info.info("q:alarm:user_message"); + const char *userMsg = info.info("Q:alarm:msg"); #endif #ifdef HAVE_UTAG if(meta.amsg[0]!='\0') { message->put(meta.amsg); } else #endif -#ifdef ISIS_CUSTOM_ALARM_MSG +#ifdef CUSTOM_ALARM_MSG if(userMsg != NULL && meta.status > NO_ALARM) { message->put(userMsg); } else @@ -443,7 +443,7 @@ void putTime(const pvTimeAlarm& pv, unsigned dbe, db_field_log *pfl) putMetaImpl(pv, meta); if(dbe&DBE_ALARM) { - #ifdef ISIS_CUSTOM_ALARM_MSG + #ifdef CUSTOM_ALARM_MSG mapStatus(meta, pv.status.get(), pv.message.get(), pv.chan); #else mapStatus(meta, pv.status.get(), pv.message.get()); @@ -593,7 +593,7 @@ void putMeta(const pvCommon& pv, unsigned dbe, db_field_log *pfl) putMetaImpl(pv, meta); #define FMAP(MNAME, FNAME) pv.MNAME->put(meta.FNAME) if(dbe&DBE_ALARM) { - #ifdef ISIS_CUSTOM_ALARM_MSG + #ifdef CUSTOM_ALARM_MSG mapStatus(meta, pv.status.get(), pv.message.get(), pv.chan); #else mapStatus(meta, pv.status.get(), pv.message.get()); diff --git a/testApp/test_custom_alarm.db b/testApp/test_custom_alarm.db index a5c8453..9ca8751 100644 --- a/testApp/test_custom_alarm.db +++ b/testApp/test_custom_alarm.db @@ -6,5 +6,5 @@ record(ai, "custom:ai") { field(HIGH, "40.0") field(HHSV, "MAJOR") field(HSV, "MINOR") - info(q:alarm:user_message, "Custom Msg Alarm AI!") + info(Q:alarm:msg, "Custom Msg Alarm AI!") } \ No newline at end of file diff --git a/testApp/testpvif.cpp b/testApp/testpvif.cpp index e277c61..5b3799f 100644 --- a/testApp/testpvif.cpp +++ b/testApp/testpvif.cpp @@ -22,7 +22,7 @@ #ifdef HAVE_UTAG -#define ISIS_CUSTOM_ALARM_MSG +#define CUSTOM_ALARM_MSG #endif namespace pvd = epics::pvData; @@ -642,7 +642,7 @@ void testFilters() testFieldEqual(root, "dut.value", expected); #endif // >= 7.0 } -#ifdef ISIS_CUSTOM_ALARM_MSG +#ifdef CUSTOM_ALARM_MSG void testCustomAlarmMessage() { testDiag("testCustomAlarmMessage"); @@ -696,12 +696,12 @@ void testCustomAlarmMessage() testFieldEqual(root, "custom_ai.alarm.severity", 0); testFieldEqual(root, "custom_ai.alarm.status", 0); } -#endif // ISIS_CUSTOM_ALARM_MSG +#endif // CUSTOM_ALARM_MSG } // namespace MAIN(testpvif) { -#ifdef ISIS_CUSTOM_ALARM_MSG +#ifdef CUSTOM_ALARM_MSG testPlan(105); #else testPlan(98); @@ -714,7 +714,7 @@ MAIN(testpvif) testScalar(); testPlain(); testFilters(); -#ifdef ISIS_CUSTOM_ALARM_MSG +#ifdef CUSTOM_ALARM_MSG testCustomAlarmMessage(); #endif return testDone(); From 5c70f948534dd11576c408492baa1ebd211dfbbd Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Fri, 25 Jul 2025 10:51:44 +0100 Subject: [PATCH 07/13] added choco install strawberryperl --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor.yml b/.appveyor.yml index d8b2318..b976d74 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -14,6 +14,7 @@ install: - ps: Set-ExecutionPolicy Bypass -Scope Process -Force - ps: '[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072' - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + - choco install strawberryperl -y - choco install re2c -y - cmd: git submodule update --init --recursive - cmd: pip install setuptools From d64917c402e3915c8a15a498e8889aaa7cf7ed90 Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Fri, 25 Jul 2025 10:57:35 +0100 Subject: [PATCH 08/13] modified choco install strawberryperl --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index b976d74..a4aefb9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -14,7 +14,7 @@ install: - ps: Set-ExecutionPolicy Bypass -Scope Process -Force - ps: '[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072' - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - - choco install strawberryperl -y + - choco install strawberryperl -y --force - choco install re2c -y - cmd: git submodule update --init --recursive - cmd: pip install setuptools From 0acb61a7db9b374bf796ed460a01c3aa1f4e375d Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Fri, 25 Jul 2025 11:03:46 +0100 Subject: [PATCH 09/13] delete choco install strawberryperl --- .appveyor.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index a4aefb9..47b9bd9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -14,10 +14,22 @@ install: - ps: Set-ExecutionPolicy Bypass -Scope Process -Force - ps: '[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072' - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - - choco install strawberryperl -y --force - choco install re2c -y - cmd: git submodule update --init --recursive - cmd: pip install setuptools + # .ci/cue.py Á¸Àç È®ÀÎ, ¾øÀ¸¸é °­Á¦ fetch & ¿À·ù ¸Þ½ÃÁö + - cmd: | + if not exist .ci\cue.py ( + echo ERROR: .ci\cue.py not found! Please check that .ci submodule is correctly initialized. + git submodule deinit -f .ci + git submodule update --init --recursive + if not exist .ci\cue.py ( + echo FATAL: .ci/cue.py is STILL missing after submodule update! Failing build. + exit /b 2 + ) + ) else ( + echo Found .ci\cue.py + ) #---------------------------------# # repository cloning # From d49cb28e879fb4a11d1d29245623424547da103f Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Fri, 25 Jul 2025 11:08:03 +0100 Subject: [PATCH 10/13] delete checkfile --- .appveyor.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 47b9bd9..510e520 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,19 +17,7 @@ install: - choco install re2c -y - cmd: git submodule update --init --recursive - cmd: pip install setuptools - # .ci/cue.py Á¸Àç È®ÀÎ, ¾øÀ¸¸é °­Á¦ fetch & ¿À·ù ¸Þ½ÃÁö - - cmd: | - if not exist .ci\cue.py ( - echo ERROR: .ci\cue.py not found! Please check that .ci submodule is correctly initialized. - git submodule deinit -f .ci - git submodule update --init --recursive - if not exist .ci\cue.py ( - echo FATAL: .ci/cue.py is STILL missing after submodule update! Failing build. - exit /b 2 - ) - ) else ( - echo Found .ci\cue.py - ) + #---------------------------------# # repository cloning # From 5abc5ec848de423f52bc8dd491e990b65a01f033 Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Fri, 25 Jul 2025 17:38:24 +0100 Subject: [PATCH 11/13] rollback appveyor.yml file --- .appveyor.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 510e520..2607c4d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,13 +11,9 @@ cache: #---------------------------------# install: - - ps: Set-ExecutionPolicy Bypass -Scope Process -Force - - ps: '[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072' - - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - - choco install re2c -y +# for the sequencer + - choco install re2c - cmd: git submodule update --init --recursive - - cmd: pip install setuptools - #---------------------------------# # repository cloning # From 47955dde53995ee0db923e3e228c3d569eeed9f8 Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Mon, 28 Jul 2025 09:40:58 +0100 Subject: [PATCH 12/13] Add Python 3.10 setup to fix missing distutils in Appveyor --- .appveyor.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 2607c4d..0082b63 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,8 +11,13 @@ cache: #---------------------------------# install: -# for the sequencer - - choco install re2c + - choco install python --version=3.10.9 -y + - refreshenv + - python -m ensurepip --upgrade + - python -m pip install --upgrade pip setuptools + + # for the sequencer + - choco install re2c -y - cmd: git submodule update --init --recursive #---------------------------------# From c4a3386d81e6e3dcbe2dc0a9e16408ad672ccf38 Mon Sep 17 00:00:00 2001 From: jongmin kim Date: Mon, 28 Jul 2025 10:07:11 +0100 Subject: [PATCH 13/13] Fix Appveyor CI by manually installing Python 3.10.9 to restore distutils support --- .appveyor.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0082b63..1720729 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,14 +11,15 @@ cache: #---------------------------------# install: - - choco install python --version=3.10.9 -y + + - powershell -Command "Invoke-WebRequest https://www.python.org/ftp/python/3.10.9/python-3.10.9-amd64.exe -OutFile python-install.exe" + - start /wait python-install.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 - refreshenv - - python -m ensurepip --upgrade - python -m pip install --upgrade pip setuptools - # for the sequencer + # For the sequencer - choco install re2c -y - - cmd: git submodule update --init --recursive + - git submodule update --init --recursive #---------------------------------# # repository cloning #