LineClaim

Top  Previous  Next

Message

 

LineClaim <linenumber> [-input|-output] [-ResetOn|-ResetOff|-Leave] [–alias <alias>]

LineClaim <devicegroup> <devicename> [-input|-output] [-ResetOn|-ResetOff|-Leave] [–alias <alias>]

 

Originator

 

Client

 

Response

 

Info: ClaimAccepted: Line <linenumber> For input|output As <alias>

Error: ClaimRejected: Line <linenumber> <reason>

SyntaxError: insufficient parameters to LineClaim

SyntaxError: invalid parameters to LineClaim

 

For example,

 

       Error: ClaimRejected: Line 112 is a non-existent line

       Error: ClaimRejected: Line 5 is already claimed

       Error: ClaimRejected: Line 7 is not an input line

 

If you set an alias, you will also get messages concerning the success or failure of the alias command. You may also get a message of the form

 

       Info: ClaimAccepted: Line 5 For Input As 5 (ALIAS NOT SET)

 

if the claim succeeded but the alias was improperly formed.        

 

Response (immediate socket)

 

Success

Failure

 

If you request an alias, you will only get Success if the alias command also succeeds.        

 

Details

 

Claims hardware line linenumber for input or output. By default, or if 'reset' is specified, output lines are turned off. If 'leave' is specified, the line is left in its current state. This parameter also determines what happens if the client falls off the edge of the earth. Lines are numbered from 0, so a typical single-board system has lines 0–71.

 

Input | output. Whether a line is an input or an output line is not determined by the input/output parameter, but by the configuration of the server (which you can set, on the server, depending on how you wire up the apparatus). This parameter is merely a statement of your intent. You do not have to specify 'input' or 'output' when you claim the line. However, it is advisable. If you claim an input line and subsequently try to set its state, you will get an error message. It is better to state when you claim the line that you think it is an output line; if you are wrong, then the error message comes immediately and you know things aren't safe to proceed.

 

ResetOn | ResetOff | Leave. If you specify 'ResetOn' or 'ResetOff' and the line is an output line, it will be turned on/off immediately, and when the client gives up the line. Otherwise it will be left in its current state, whatever that is. The default is 'Leave'. (Note that it is only possible to set the reset state when you claim a line, and not later; this is deliberate, as it is meant as a safety feature and not to be fiddled around with willy-nilly.) This feature is currently not included in the SDK control version of LineClaim. If it is important to you, it can be achieved by using the SendToServer command, e.g.

 

Whisker.SendToServer "LineClaim box1 IVPump -output -alias pump -ResetOff"

 

Server device names. If you use the second form of the command, the line specified by the combination of the devicegroup and devicename parameters is claimed.        

 

SDK Control Method

 

Function Whisker.LineClaim(GroupName As String, DeviceName As String, ServerLineNumber As Integer, LineName As String, IsInput As Boolean)

 

Attempts to claim the line given in the DDF as DeviceName in Group GroupName. If either of these is an empty string, attempts to claim line number ServerLineNumber. Once claimed, it asks for the line to be referred to by the alias LineName (see Details above). IsInput should be True if the Client believes the line to be an Input, or response line.

Evaluates to True if the claim succeeds.

 

ClientLib

 

bool LineClaim(int iLine, bool bOutput, enum _whisker_reset_state reset, const CString& strAlias);

bool LineClaim(const CString& strDeviceGroup, const CString& strDeviceName, bool bOutput, enum _whisker_reset_state reset = WHISKER_RESET_LEAVE, const CString& strAlias = "");

 

Attempts to claim line number iLine (first overloaded syntax), or the line described in the DDF by strDeviceName and strDeviceGroup (second syntax), with the I/O function reset state described by bOutput and reset. If alias is no a zero-length string, attempts to set this as the claimed line's alias. Returns true for success, false for failure.

 

Revision history

 

Implemented in WhiskerServer version 1 as ClaimLine.

Renamed in WhiskerServer version 2.3.

 

See also

 

Digital I/O devices
Device names and aliases
LineSetAlias
LineRelinquishAll