diff --git a/src/pandablocks_ioc/_hdf_ioc.py b/src/pandablocks_ioc/_hdf_ioc.py index 27bf8ddf..e42cc7d5 100644 --- a/src/pandablocks_ioc/_hdf_ioc.py +++ b/src/pandablocks_ioc/_hdf_ioc.py @@ -18,7 +18,8 @@ from softioc import alarm, builder from softioc.pythonSoftIoc import RecordWrapper -from ._types import ONAM_STR, ZNAM_STR +from ._pvi import PviGroup, add_pvi_info +from ._types import ONAM_STR, ZNAM_STR, EpicsName class HDF5RecordController: @@ -52,51 +53,76 @@ def __init__(self, client: AsyncioClient, record_prefix: str): # Create the records, including an uppercase alias for each # Naming convention and settings (mostly) copied from FSCN2 HDF5 records - file_path_record_name = self._HDF5_PREFIX + ":FilePath" + file_path_record_name = EpicsName(self._HDF5_PREFIX + ":FilePath") self._file_path_record = builder.longStringOut( file_path_record_name, length=path_length, DESC="File path for HDF5 files", validate=self._parameter_validate, ) + add_pvi_info( + PviGroup.INPUTS, + self._file_path_record, + file_path_record_name, + builder.longStringOut, + ) self._file_path_record.add_alias( record_prefix + ":" + file_path_record_name.upper() ) - file_name_record_name = self._HDF5_PREFIX + ":FileName" + file_name_record_name = EpicsName(self._HDF5_PREFIX + ":FileName") self._file_name_record = builder.longStringOut( file_name_record_name, length=filename_length, DESC="File name prefix for HDF5 files", validate=self._parameter_validate, ) + add_pvi_info( + PviGroup.INPUTS, + self._file_name_record, + file_name_record_name, + builder.longStringOut, + ) self._file_name_record.add_alias( record_prefix + ":" + file_name_record_name.upper() ) - num_capture_record_name = self._HDF5_PREFIX + ":NumCapture" + num_capture_record_name = EpicsName(self._HDF5_PREFIX + ":NumCapture") self._num_capture_record = builder.longOut( num_capture_record_name, initial_value=0, # Infinite capture DESC="Number of frames to capture. 0=infinite", DRVL=0, ) + + add_pvi_info( + PviGroup.INPUTS, + self._num_capture_record, + num_capture_record_name, + builder.longOut, + ) # No validate - users are allowed to change this at any time self._num_capture_record.add_alias( record_prefix + ":" + num_capture_record_name.upper() ) - flush_period_record_name = self._HDF5_PREFIX + ":FlushPeriod" + flush_period_record_name = EpicsName(self._HDF5_PREFIX + ":FlushPeriod") self._flush_period_record = builder.aOut( flush_period_record_name, initial_value=1.0, DESC="Frequency that data is flushed (seconds)", ) + add_pvi_info( + PviGroup.INPUTS, + self._flush_period_record, + flush_period_record_name, + builder.aOut, + ) self._flush_period_record.add_alias( record_prefix + ":" + flush_period_record_name.upper() ) - capture_control_record_name = self._HDF5_PREFIX + ":Capture" + capture_control_record_name = EpicsName(self._HDF5_PREFIX + ":Capture") self._capture_control_record = builder.boolOut( capture_control_record_name, ZNAM=ZNAM_STR, @@ -105,27 +131,45 @@ def __init__(self, client: AsyncioClient, record_prefix: str): validate=self._capture_validate, DESC="Start/stop HDF5 capture", ) + add_pvi_info( + PviGroup.INPUTS, + self._capture_control_record, + capture_control_record_name, + builder.boolOut, + ) self._capture_control_record.add_alias( record_prefix + ":" + capture_control_record_name.upper() ) - status_message_record_name = self._HDF5_PREFIX + ":Status" + status_message_record_name = EpicsName(self._HDF5_PREFIX + ":Status") self._status_message_record = builder.stringIn( status_message_record_name, initial_value="OK", DESC="Reports current status of HDF5 capture", ) + add_pvi_info( + PviGroup.OUTPUTS, + self._status_message_record, + status_message_record_name, + builder.stringIn, + ) self._status_message_record.add_alias( record_prefix + ":" + status_message_record_name.upper() ) - currently_capturing_record_name = self._HDF5_PREFIX + ":Capturing" + currently_capturing_record_name = EpicsName(self._HDF5_PREFIX + ":Capturing") self._currently_capturing_record = builder.boolIn( currently_capturing_record_name, ZNAM=ZNAM_STR, ONAM=ONAM_STR, DESC="If HDF5 file is currently being written", ) + add_pvi_info( + PviGroup.OUTPUTS, + self._currently_capturing_record, + currently_capturing_record_name, + builder.boolIn, + ) self._currently_capturing_record.add_alias( record_prefix + ":" + currently_capturing_record_name.upper() ) diff --git a/src/pandablocks_ioc/_pvi.py b/src/pandablocks_ioc/_pvi.py index c2730691..f58a7b12 100644 --- a/src/pandablocks_ioc/_pvi.py +++ b/src/pandablocks_ioc/_pvi.py @@ -79,7 +79,6 @@ def add_pvi_info( access = "rw" else: - # TODO: What value do I write? PandA uses an empty string component = SignalX(record_name, record_name, value="") access = "x" elif writeable: diff --git a/tests/test-bobfiles/HDF5.bob b/tests/test-bobfiles/HDF5.bob new file mode 100644 index 00000000..5a973d2d --- /dev/null +++ b/tests/test-bobfiles/HDF5.bob @@ -0,0 +1,171 @@ + + Display + 0 + 0 + 426 + 277 + 4 + 4 + + Title + TITLE + HDF5 - TEST-PREFIX: + 0 + 0 + 426 + 25 + + + + + + + + + true + 1 + + + INPUTS + 5 + 30 + 351 + 156 + true + + Label + HDF5: File Path + 0 + 0 + 250 + 20 + + + TextEntry + TEST-PREFIX:HDF5:FilePath + 255 + 0 + 60 + 20 + 1 + + + Label + HDF5: File Name + 0 + 25 + 250 + 20 + + + TextEntry + TEST-PREFIX:HDF5:FileName + 255 + 25 + 60 + 20 + 1 + + + Label + HDF5: Num Capture + 0 + 50 + 250 + 20 + + + TextEntry + TEST-PREFIX:HDF5:NumCapture + 255 + 50 + 60 + 20 + 1 + + + Label + HDF5: Flush Period + 0 + 75 + 250 + 20 + + + TextEntry + TEST-PREFIX:HDF5:FlushPeriod + 255 + 75 + 60 + 20 + 1 + + + Label + HDF5: Capture + 0 + 100 + 250 + 20 + + + TextEntry + TEST-PREFIX:HDF5:Capture + 255 + 100 + 60 + 20 + 1 + + + + OUTPUTS + 5 + 191 + 416 + 81 + true + + Label + HDF5: Status + 0 + 0 + 250 + 20 + + + TextUpdate + TEST-PREFIX:HDF5:Status + 255 + 0 + 125 + 20 + + + + + 1 + + + Label + HDF5: Capturing + 0 + 25 + 250 + 20 + + + TextUpdate + TEST-PREFIX:HDF5:Capturing + 255 + 25 + 125 + 20 + + + + + 1 + + + diff --git a/tests/test-bobfiles/TOP.bob b/tests/test-bobfiles/TOP.bob index 5b36375d..15413d75 100644 --- a/tests/test-bobfiles/TOP.bob +++ b/tests/test-bobfiles/TOP.bob @@ -3,7 +3,7 @@ 0 0 278 - 105 + 130 4 4 @@ -35,7 +35,7 @@ Label - SEQ: PVI + HDF5: PVI 23 55 250 @@ -43,10 +43,18 @@ Label - PULSE: PVI + SEQ: PVI 23 80 250 20 + + Label + PULSE: PVI + 23 + 105 + 250 + 20 +