From afd7b3879d25c39bb13d99b3fe58377280b86295 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Thu, 18 Apr 2013 12:40:56 +1000 Subject: [PATCH] Generic fake Galil derived from Taipan version. Added instrument name as a command line argument. --- .../TEST_SICS/fakeGalil/SIM_GALIL.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 site_ansto/instrument/TEST_SICS/fakeGalil/SIM_GALIL.py diff --git a/site_ansto/instrument/TEST_SICS/fakeGalil/SIM_GALIL.py b/site_ansto/instrument/TEST_SICS/fakeGalil/SIM_GALIL.py new file mode 100755 index 00000000..b88fbe3e --- /dev/null +++ b/site_ansto/instrument/TEST_SICS/fakeGalil/SIM_GALIL.py @@ -0,0 +1,39 @@ +#!/usr//bin/env python +# vim: ts=8 sts=4 sw=4 expandtab +# Author: Douglas Clowes (dcl@ansto.gov.au) 2012-06-29 +from twisted.internet import reactor +from twisted.python import log +from twisted.internet.task import LoopingCall +import argparse +import random +import re +import sys +import time +import inspect +from galilfactory import GalilFactory + + +def device_iterator(): + now = time.time() + +def main(**kwargs): + parser = argparse.ArgumentParser( description="Generates fake Galil controllers for testing SICS" ) + parser.add_argument("instrument", help="The instrument name") + args = parser.parse_args() + + basePort = { + 'echidna': 62034, 'wombat': 62134, 'kowari': 62335, 'quokka': 62430, 'platypus': 62530, + 'pelican': 62630, 'taipan': 62730, 'lyrebird': 62830, 'kookaburra': 62930 + } + log.startLogging(sys.stdout) + devices = {} + for dev in range(0, 6): + port = basePort[args.instrument] + dev + controllerName = "mc%d" % (dev + 1) + factory = GalilFactory(port) + devices[controllerName] = factory.device + reactor.listenTCP(port, factory) + reactor.run() + +if __name__ == '__main__': + main()