40 lines
1.1 KiB
Python
Executable File
40 lines
1.1 KiB
Python
Executable File
#!/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()
|