38 DEBUG=False):
39
40 modules = {}
41 fanout_devices=[]
42
43 if FANOUT_DEVICE_NAME:
44 fanout_devices.append(FANOUT_DEVICE_NAME)
45
46 if FIRMWARE_TYPE == 'pdi':
47 thi_class='TimingHardwareManagerPDI'
48 elif FIRMWARE_TYPE == 'pdii':
49 thi_class='TimingHardwareManagerPDII'
50 else:
51 raise Exception(f"'Unexpected firmware type: {FIRMWARE_TYPE}")
52
53 modules = [
54 DAQModule( name="thi",
55 plugin=thi_class,
56 conf= thi.ConfParams(connections_file=CONNECTIONS_FILE,
57 gather_interval=GATHER_INTERVAL,
58 gather_interval_debug=GATHER_INTERVAL_DEBUG,
59 monitored_device_name_master=MASTER_DEVICE_NAME,
60 monitored_device_names_fanout=fanout_devices,
61 monitored_device_name_endpoint="",
62 monitored_device_name_hsi=HSI_DEVICE_NAME,
63 uhal_log_level=UHAL_LOG_LEVEL)),
64 ]
65
66 mgraph = ModuleGraph(modules)
67
68 mgraph.add_endpoint("timing_cmds", "thi.timing_cmds", "TimingHwCmd", Direction.IN, check_endpoints=False)
69
70 if MASTER_DEVICE_NAME:
71 mgraph.add_endpoint(MASTER_DEVICE_NAME+"_info", "thi."+MASTER_DEVICE_NAME+"_info", "JSON", Direction.OUT, is_pubsub=True)
72 if HSI_DEVICE_NAME:
73 mgraph.add_endpoint(HSI_DEVICE_NAME+"_info", "thi."+HSI_DEVICE_NAME+"_info", "JSON", Direction.OUT, is_pubsub=True)
74 if FANOUT_DEVICE_NAME:
75 mgraph.add_endpoint(FANOUT_DEVICE_NAME+"_info", "thi."+FANOUT_DEVICE_NAME+"_info", "JSON", Direction.OUT, is_pubsub=True)
76
77 thi_app = App(modulegraph=mgraph, host=HOST, name="THIApp")
78
79 if DEBUG:
80 thi_app.export("thi_app.dot")
81
82 return thi_app