1 from __future__
import division, absolute_import
3 from twistedActor
import DeviceSet, LinkCommands, UserCmd
5 __all__ = [
"MirrorDeviceSet"]
8 SlotList = (
"prim",
"sec",
"tert")
13 """!Construct an MirrorDeviceSet
15 @param[in] actor actor (instance of twistedActor.BaseActor);
16 used for writeToUsers in this class, and subclasses may make additonal use of it
17 @param[in] devList prim, sec, and tert device; any can be None if it does not exist
19 @throw RuntimeError if len(devList) != 3
21 DeviceSet.__init__(self,
25 connStateKeyword =
"mirrorConnState",
30 dev.startKWForwarding()
32 def connectOrInit(self, slotList=None, userCmd=None, timeLim=DefaultTimeLim):
33 """!Connect and stop axis controllers
35 Specified axis controllers that are already connected are simply stopped.
37 @param[in] slotList collection of slot names, or None for all filled slots
38 @param[in] userCmd user command whose set state is set to Done or Failed when all device commands are done;
39 if None a new UserCmd is created and returned
40 @param[in] timeLim time limit for command (sec)
41 @return userCmd: the supplied userCmd or a newly created UserCmd
44 expSlotList = self.expandSlotList(slotList)
45 connSlotList = [slot
for slot
in expSlotList
if self.get(slot).isConnected]
46 notConnSlotList = list(set(expSlotList) - set(connSlotList))
47 initUserCmd = self.
init(connSlotList, timeLim=timeLim)
48 connUserCmd = self.connect(notConnSlotList, timeLim=timeLim)
51 LinkCommands(userCmd, (initUserCmd, connUserCmd))
54 def status(self, slotList=None, userCmd=None, timeLim=DefaultTimeLim):
55 """!Get status from the mirror controllers
57 @param[in] slotList collection of slot names, or None for all filled slots
58 @param[in] userCmd user command whose set state is set to Done or Failed when all device commands are done;
59 if None a new UserCmd is created and returned
60 @param[in] timeLim time limit for command (sec)
61 @return userCmd: the supplied userCmd or a newly created UserCmd
63 @throw RuntimeError if slotList has empty or non-existent slots
65 self.showConnState(userCmd=userCmd)
66 return self.startCmd(cmdStrOrList=
"status", slotList=slotList, userCmd=userCmd, timeLim=timeLim)
68 def init(self, slotList=None, userCmd=None, timeLim=DefaultTimeLim):
69 """!Initialize the mirror controllers
71 @param[in] slotList collection of slot names, or None for all filled slots
72 @param[in] userCmd user command whose set state is set to Done or Failed when all device commands are done;
73 if None a new UserCmd is created and returned
74 @param[in] timeLim time limit for command (sec)
75 @return userCmd: the supplied userCmd or a newly created UserCmd
77 @throw RuntimeError if slotList has empty or non-existent slots
79 return self.startCmd(cmdStrOrList=
"stop", slotList = slotList, userCmd=userCmd, timeLim=timeLim)
def __init__
Construct an MirrorDeviceSet.
def connectOrInit
Connect and stop axis controllers.
def init
Initialize the mirror controllers.
def status
Get status from the mirror controllers.