Skip to content

Commit 70b91b3

Browse files
committed
PUB_ConfigurationFinished: Add new message
This message is sent after the JSON configuration for a panel or notebook is finished.
1 parent 899165b commit 70b91b3

6 files changed

+87
-7
lines changed

Packages/MIES/MIES_Configuration.ipf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,9 @@ Function CONF_RestoreWindow(string fName, [string rigFile])
512512
Abort
513513
endif
514514
endtry
515+
516+
PUB_ConfigurationFinished(wName, panelType, fName, rigFile)
517+
515518
JSON_Release(jsonID)
516519
End
517520

Packages/MIES/MIES_Constants.ipf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,6 +1868,7 @@ StrConstant ANALYSIS_FUNCTION_SE = "analysis function:seal evaluati
18681868
StrConstant ANALYSIS_FUNCTION_VM = "analysis function:true resting membrane potential"
18691869
StrConstant DAQ_TP_STATE_CHANGE_FILTER = "data acquisition:state change"
18701870
StrConstant ANALYSIS_FUNCTION_AR = "analysis function:access resistance smoke"
1871+
StrConstant CONFIG_FINISHED_FILTER = "configuration:finished"
18711872
///@}
18721873

18731874
/// which is sufficient to represent each sample point time with a distinctive number up to rates of 10 MHz.

Packages/MIES/MIES_ForeignFunctionInterface.ipf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,20 @@ End
8484
/// :cpp:var:ZMQ_FILTER_TPRESULT_5s TP evaluation result (every 5s) :cpp:func:PUB_TPResult
8585
/// :cpp:var:ZMQ_FILTER_TPRESULT_10s TP evaluation result (every 10s) :cpp:func:PUB_TPResult
8686
/// :cpp:var:ZMQ_FILTER_TPRESULT_NOW_WITH_DATA TP evaluation result with AD data (all TPs) :cpp:func:PUB_TPResult
87+
/// :cpp:var:CONFIG_FINISHED_FILTER JSON configuration for panel has finished :cpp:func:PUB_ConfigurationFinished
8788
/// ============================================ ==================================================== =============================================
8889
///
8990
/// \endrst
9091
///
9192
Function/WAVE FFI_GetAvailableMessageFilters()
9293

93-
Make/FREE/T wv = {ZeroMQ_HEARTBEAT, PRESSURE_STATE_FILTER, PRESSURE_SEALED_FILTER, \
94-
PRESSURE_BREAKIN_FILTER, AUTO_TP_FILTER, AMPLIFIER_CLAMP_MODE_FILTER, \
95-
AMPLIFIER_AUTO_BRIDGE_BALANCE, ANALYSIS_FUNCTION_PB, ANALYSIS_FUNCTION_SE, \
96-
ANALYSIS_FUNCTION_VM, DAQ_TP_STATE_CHANGE_FILTER, \
97-
ANALYSIS_FUNCTION_AR, ZMQ_FILTER_TPRESULT_NOW, ZMQ_FILTER_TPRESULT_1S, \
98-
ZMQ_FILTER_TPRESULT_5S, ZMQ_FILTER_TPRESULT_10S, ZMQ_FILTER_TPRESULT_NOW_WITH_DATA}
94+
Make/FREE/T wv = {ZeroMQ_HEARTBEAT, PRESSURE_STATE_FILTER, PRESSURE_SEALED_FILTER, \
95+
PRESSURE_BREAKIN_FILTER, AUTO_TP_FILTER, AMPLIFIER_CLAMP_MODE_FILTER, \
96+
AMPLIFIER_AUTO_BRIDGE_BALANCE, ANALYSIS_FUNCTION_PB, ANALYSIS_FUNCTION_SE, \
97+
ANALYSIS_FUNCTION_VM, DAQ_TP_STATE_CHANGE_FILTER, \
98+
ANALYSIS_FUNCTION_AR, ZMQ_FILTER_TPRESULT_NOW, ZMQ_FILTER_TPRESULT_1S, \
99+
ZMQ_FILTER_TPRESULT_5S, ZMQ_FILTER_TPRESULT_10S, ZMQ_FILTER_TPRESULT_NOW_WITH_DATA, \
100+
CONFIG_FINISHED_FILTER}
99101

100102
Note/K wv, "Heartbeat is sent every 5 seconds."
101103

Packages/MIES/MIES_Publish.ipf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,3 +910,36 @@ threadsafe static Function PUB_CheckPublishingTime(string pubFilter, variable pe
910910

911911
return 0
912912
End
913+
914+
/// Filter: #CONFIG_FINISHED_FILTER
915+
///
916+
/// Example:
917+
///
918+
/// \rst
919+
/// .. code-block:: json
920+
///
921+
/// {
922+
/// "device": null,
923+
/// "fileName": "fileA",
924+
/// "headstage": "NaN",
925+
/// "panelType": "DataBrowser",
926+
/// "rigFileName": "fileB",
927+
/// "sweep number": "NaN",
928+
/// "timestamp": "2025-02-25T15:06:19Z",
929+
/// "window": "Databrowser"
930+
/// }
931+
///
932+
/// \endrst
933+
Function PUB_ConfigurationFinished(string windowName, string panelType, string fileName, string rigfileName)
934+
935+
variable jsonID
936+
937+
jsonID = PUB_GetJSONTemplate("", NaN)
938+
939+
JSON_AddString(jsonID, "window", windowName)
940+
JSON_AddString(jsonID, "panelType", panelType)
941+
JSON_AddString(jsonID, "fileName", fileName)
942+
JSON_AddString(jsonID, "rigFileName", rigFileName)
943+
944+
PUB_Publish(jsonID, CONFIG_FINISHED_FILTER)
945+
End

Packages/tests/Basic/UTF_Configuration.ipf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ static Function TCONF_SaveNotebookAndRestore()
320320
string fName = "NotebookTest.json"
321321
string nbTextRef = "This is fine."
322322
string nbTextRef2 = "This is not fine."
323-
string nbText
323+
string nbText, expected, actual
324+
variable jsonID
325+
326+
PrepareForPublishTest()
324327

325328
DoWindow/K $wName
326329
NewNotebook/N=$wName/F=0
@@ -339,6 +342,11 @@ static Function TCONF_SaveNotebookAndRestore()
339342
CONF_RestoreWindow(PrependExperimentFolder_IGNORE(fName))
340343
nbText = GetNotebookText(wName, mode = 2)
341344
CHECK_EQUAL_STR(nbTextRef2, nbText)
345+
346+
jsonID = FetchAndParseMessage(CONFIG_FINISHED_FILTER)
347+
expected = wName
348+
actual = JSON_GetString(jsonID, "window")
349+
CHECK_EQUAL_STR(actual, expected)
342350
End
343351

344352
/// @brief Checks if every (qualified) panel has a panel type set

Packages/tests/Basic/UTF_ZeroMQPublishing.ipf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,3 +626,36 @@ static Function CheckTPPublishingWithData()
626626

627627
JSON_Release(jsonID)
628628
End
629+
630+
static Function CheckConfigurationFinished()
631+
632+
string windowName, file, rigFile, panelType, actual, expected
633+
variable jsonID
634+
635+
windowName = "Databrowser"
636+
file = "fileA"
637+
rigFile = "fileB"
638+
panelType = PANELTAG_DATABROWSER
639+
640+
PUB_ConfigurationFinished(windowName, panelType, file, rigFile)
641+
642+
jsonID = FetchAndParseMessage(CONFIG_FINISHED_FILTER)
643+
644+
actual = JSON_GetString(jsonID, "/window")
645+
expected = windowName
646+
CHECK_EQUAL_STR(actual, expected)
647+
648+
actual = JSON_GetString(jsonID, "/panelType")
649+
expected = panelType
650+
CHECK_EQUAL_STR(actual, expected)
651+
652+
actual = JSON_GetString(jsonID, "/fileName")
653+
expected = file
654+
CHECK_EQUAL_STR(actual, expected)
655+
656+
actual = JSON_GetString(jsonID, "/rigFileName")
657+
expected = rigFile
658+
CHECK_EQUAL_STR(actual, expected)
659+
660+
JSON_Release(jsonID)
661+
End

0 commit comments

Comments
 (0)