Controlling groups of lines |
Top Previous Next |
The LineSetAlias and LineSetState commands supports grouping. That is, two lines can be given common (as well as distinct) aliases:
LineClaim 4 –alias Houselight LineClaim 5 LineSetAlias 5 LeftStimulusLight –– This illustrates two ways to set an alias LineClaim 6 –alias RightStimulusLight LineSetAlias LeftStimulusLight LIGHTGROUP LineSetAlias RightStimulusLight LIGHTGROUP LineSetState 4 on LineSetState LIGHTGROUP on –– This will turn lines 5 and 6 on. LineSetState LeftStimulusLight off –– This will turn line 5 off. LineSetAlias LIGHTGROUP ANOTHERALIAS LineSetState ANOTHERALIAS off –– You can add another alias for a whole group. This will turn lines 5 and 6 off.
The grouping function makes it very easy to implement yoking. For example, if your task currently looks like this:
LineClaim 4 –alias Houselight LineClaim 5 –alias LeftStimulusLight LineClaim 6 –alias RightStimulusLight (*) LineSetState Houselight on LineSetState LeftStimulusLight on
and you want another box to be yoked to it (which has lines 15–17 for these same devices), you can add the following lines at or before the point marked (*):
LineClaim 15 –alias Houselight LineClaim 16 –alias LeftStimulusLight LineClaim 17 –alias RightStimulusLight
and the main program will happily control the devices as before, except when it switches the houselight on in the main box, it will also switch it on in the yoked box.
Though you can use group aliases with LineSetEvent, LineClearEventByLine (described later) and LineReadState, I think this is unwise. In particular, this practice may lead to confusing results with LineReadState: if you issue a LineReadState command on the main socket, the server will respond with the status of all applicable lines, but if you do the same thing on the immediate socket – where a single instant response is the only reply you ever get – the server will provide the status of just one of the applicable lines (chosen at random).
See also
|