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:
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:
Additionally, you may claim whole groups, using the ClaimGroup command.
See also
|