Server-based device names and device definition files

Top  Previous  Next

Clients may claim devices (displays, audio devices, digital I/O lines, etc.) by number, and clients may assign useful aliases to these devices. Additionally, the server knows about a set of 'standard' device names for the equipment it is controlling.

 

Server-based device names bring the following advantages:

 

Ease of client programming. Clients usually know that they need (for example) a pellet dispenser and a lever in order to function, but they don't care whether the lever is on line 52 or line 87. Server-based names take this chore away from the client.
Client portability. If a client refers to its lines by name only, then it can run on a computer that has the same devices (device names), but wired to different lines.
Control of device groupings. A typical experimental computer might have six operant chambers, each with a pellet dispenser and a lever. If the client decides it wants to use box 4, and can simply say to the server 'I'd like the following devices… for box 4', it simplifies client programming.
Exclusion of other clients using device groupings. The client can prevent others from taking control of devices in the same chamber. For example, if our client uses the pellet dispenser and the lever, but (unbeknownst to it) the chamber also has a clicker, a different client could control the clicker. This might be useful to you, the experimenter (perhaps you want to superimpose a noncontingent click upon your behavioural task without reprogramming that task) but it might be a nuisance (you've written a program to set all your boxes' clickers going, but you don't want someone to run this program accidentally and disturb your IV self-administration task). To avoid this, Whisker allows you to claim all the devices for a particular device group (a device group typically represents an operant chamber) – thus temporarily preventing any other client from using devices in that chamber.

 

The server's device definition file

 

The device definition file is typically a text (.TXT) file that you edit using a standard text editor. A sample file is provided, and is shown below. Note that the first line must match the sample's exactly, as WhiskerServer reads this line as a quick check that it has found the correct sort of file.

 

WhiskerServer v2.0 - DEVICE DEFINITION FILE - DO NOT ALTER THIS LINE ####################################################################

# This file defines device names used by the WhiskerServer program.

# Lines beginning with a hash (#) are comments and are ignored.

#

# Each line takes the following format:

#

#        <device_type> <device_number> <group_name> <device_name>

#

# where <device_type> may be

#        line                = digital I/O line

#        display        = display device (monitor)

#        audio                = audio device (sound card, or half-sound card; see manual)

#

# The <device_number> is the number of the line/display/audio device that you see

# on the server's console - the number that you would otherwise claim.

#

# The COMBINATION of the <group_name> and <device_name> must be unique.

# If the server encounters non-unique device group/name pairs in this file,

# all but the first will be ignored.

# Neither the <group_name> nor the <device_name> may start with a number.

line                0                box1                LEFTLEVER

line                0                box1                ALTERNATIVE_NAME

line                1                box1                RIGHTLEVER

line                2                box2                LEFTLEVER

line                3                box2                RIGHTLEVER

line                7                box1                LEFTLIGHT

line                8                box1                RIGHTLIGHT

line                9                box2                LEFTLIGHT

line                10                box2                RIGHTLIGHT

display                0                human                display

audio                0                box1                leftsound

audio                1                box1                rightsound

audio                2                box2                leftsound

audio                3                box3                rightsound

 

Device names may not start with a number. This allows WhiskerServer to distinguish whether a client is talking about a device number or a name.

 

You may give one device more than one name, as long as the {device group + device name} combination remains unique. (Only one of the names will appear on the server's console displays.) This feature allows you, for example, to run a task that requires a clicker in an operant chamber that doesn't have one, but has a spare light. Simply add the device name that the task expects to exist (e.g. 'CLICKER') as an alternative name for your light. (Beware, though: if the task also uses the light, it may perform strangely!)

 

When you have a definition file that is suitable for your equipment, tell WhiskerServer where it is (see Set server device definition file).

 

When the server starts, the following entries appear in its event log:

 

Reading device definition file.

All device names read. Found 13 device names.

 

You may want to create 'fake' lines to support tasks that would not otherwise run on your equipment. For example, if your task requires a device named PUMP, and you don't have a pump but don't mind running the task without one, then install some fake lines and edit your device definition file so that one of the fake lines has the name PUMP in the appropriate device group.

 

Ways to claim devices using their names

 

Whenever you claim an individual device using a server-based device name, you must specify it by its group and device name. The following commands support this:

 

LineClaim
AudioClaim
DisplayClaim

 

Additionally, you may claim whole groups, using the ClaimGroup command.

 

See also

 

LineClaim
AudioClaim
DisplayClaim
ClaimGroup
Device names and aliases
Fake I/O lines