def _correct_pv_name(self, name):
     return BlockserverPVNames.prepend_blockserver(name)
from BlockServer.core.constants import TAG_RC_LOW, TAG_RC_HIGH, TAG_RC_ENABLE, TAG_RC_OUT_LIST
from BlockServer.core.on_the_fly_pv_interface import OnTheFlyPvInterface
from server_common.utilities import print_and_log, compress_and_hex, check_pv_name_valid, create_pv_name, \
    convert_to_json, ioc_restart_pending
from server_common.channel_access import ChannelAccess
from BlockServer.core.pv_names import BlockserverPVNames

TAG_RC_DICT = {"LOW": TAG_RC_LOW, "HIGH": TAG_RC_HIGH, "ENABLE": TAG_RC_ENABLE}
RC_IOC_PREFIX = "CS:PS:RUNCTRL_01"
RC_START_PV = "CS:IOC:RUNCTRL_01:DEVIOS:STARTTOD"
RUNCONTROL_SETTINGS = "rc_settings.cmd"
AUTOSAVE_DIR = "autosave"
RUNCONTROL_IOC = "RUNCTRL_01"

RUNCONTROL_OUT_PV = BlockserverPVNames.prepend_blockserver('GET_RC_OUT')
RUNCONTROL_GET_PV = BlockserverPVNames.prepend_blockserver('GET_RC_PARS')

# number of loops to wait for assuming the run control is not going to start
MAX_LOOPS_TO_WAIT_FOR_START = 60  # roughly 2 minutes at standard time

class RunControlManager(OnTheFlyPvInterface):
    """A class for taking care of setting up run-control.
    """

    def __init__(self, prefix, config_dir, var_dir, ioc_control, active_configholder, block_server,
                 channel_access=ChannelAccess()):
        """Constructor.

        Args:
            prefix (string): The instrument prefix