LineSetState |
Top Previous Next |
Message
LineSetState <linenumber>|<alias> on|off
Originator
Client
Response (main socket)
A successful call generates no response. Otherwise an error message will be generated:
Error: can't set line lineNumber SyntaxError: insufficient parameters to LineSetState SyntaxError: invalid parameters to LineSetState SyntaxError: invalid line to LineSetState
Response (immediate socket)
Success Failure
Details
Turns output lines on/off. The LineSetState command supports grouping. That is, you can do this:
LineClaim 4 –alias Houselight LineClaim 5 –alias LeftStimLight LineClaim 6 –alias RightStimLight LineSetAlias LeftStimLight LIGHTGROUP LineSetAlias RightStimLight LIGHTGROUP LineSetState LIGHTGROUP on –– This will turn lines 5 and 6 on. LineSetState LeftStimLight off; LineSetState RightStimLight off –– Remember that multiple commands can be given in one line.
If a group is set, multiple error messages may be generated on the main socket, but only a single value will return on the immediate socket – this value will be Success if all lines were set correctly, and Failure if a single line could not be set.
From WhiskerServer v2.9.04, if you attempt to set the state of a pegged output, a Warning is also sent.
SDK Control
Function LineSetState(MyLine As String, NewState As wsLineState) As Boolean
Sets the state of digital I/O line MyLine to NewState. Evaluates to True if request succeeds, otherwise False.
A simpler property format can also be used to set a line state
Property LineState(MyLine As String) As wsLineState
Example VB syntax: 'To check if it succeeds Dim bSetLineOK As Boolean bSetLineOK = Whisker.LineSetState(MyLine,NewState) 'simpler syntax would be Whisker.LineState(MyLine) = NewState
Notes
NewState can be either wsOn (defined as 1) or wsOff (defined as 0). You can also use the value -1 (True in VisualBasic), which is interpreted as wsOn. Attempting to set the state of a line to any other value will fail, and generate a WhiskerError message.
ClientLib
bool LineSetState(const CString& strLine, bool bState);
Attempts to set the state of strLine to bState. Returns true for success, false for failure.
Revision history
Implemented in WhiskerServer version 1 as SetState. Renamed in WhiskerServer version 2.3.
See also
|