SUMMARY OF WHISKER COMMANDS

Top  Previous  Next

The heart of the Whisker control system is the exchange of messages between Whisker server and those clients to which it is connected. First, the scope of Whisker will be outlined by listing the purpose of all the commands you can send to it. After that, the communications system will be described in detail, and in Part 2, each command and message will be described in full.

 

In the text, messages sent by the server will be blue and the commands sent by the client will be red.

 

Messages from the Server

 

These messages are sent down the main communication channel. They are unpredictable in that they may be sent at any time. The arrival of these should cause the client to deal with them 'as soon as possible': this is handled for you in most event-driven programming environments (such as Visual Basic and Visual C++).

 

Event:

When the server detects an event that the client has expressed an interest in, such as a digital line changing state, a timer triggering, or a picture being touched, it sends an Event: message to the client.

Info:

Info: messages are sent to inform a client about the completion of commands issued by that client.

Error:

If a command cannot be completed, an Error: message will be sent.

SyntaxError:

If a command is unrecognised, or malformed, a SyntaxError: message will be sent.

ClientMessage:

If a client allows, the server may pass on a ClientMessage: from one client to another (typically a 'remote-control' message).

KeyEvent:

If a client attached to a multimedia edition of Whisker has asked for keyboard notification for a display which has the input focus on the server, that client may receive KeyEvent: messages when a key is pressed on the keyboard.

 

Commands to the Server

 

Clients may issue a variety of commands to the server. These commands can be grouped into device commands - which control or interrogate the hardware managed by the server, and general commands - for example, those to alter the way in which the server communicates with the client. Devices which can be controlled by a client are timers, digital I/O lines, and (for multimedia editions of Whisker only) video display devices and audio output channels.

 

Timer Devices

 

Timers are simple software devices which are used to generate events after pre-specified intervals.

 

TimerSetEvent

Creates a timer.

TimerClearEvent

Cancels (kills) a timer.

TimerClearAllEvents

Cancels (kills) all timers.

 

Line Devices

 

LineClaim

Takes control of a digital input or output line.

LineSetAlias

Gives the line one or more alternative names.

LineRelinquishAll

Gives up control of claimed lines.

LineSetState

Sets the state of an output line (or lines).

LineReadState

Reads the state of a line (be it an input or an output line).

LineSetEvent

Causes Whisker to generate an event when the state of the line changes in a specified way.

LineClearEvent

Clears a specific event associated with a line.

LineClearEventByLine

Clears all events associated with a line.

LineClearAllEvents

Clears all events on all line devices.

LineSetSafetyTimer

Protects critical devices (such as intravenous infusion pumps) by specifying that the line should return to a safe state after a certain time.

LineClearSafetyTimer

Clears a safety timer.

 

Audio Devices (Multimedia Edition only)

 

AudioClaim

Takes control of an audio output device.

AudioSetAlias

Gives an audio device an alternative name.

AudioRelinquishAll

Relinquishes control of all audio devices.

AudioPlayFile

Plays a WAV (waveformat) file directly.

AudioLoadSound

Loads a WAV file, attaching it to a specified audio device.

AudioLoadTone

Creates simple sounds without the need for a WAV file.

AudioPlaySound

Plays a sound that has been loaded with AudioLoadSound or AudioLoadTone.

AudioSetSoundVolume

Sets playback volume for the device.

AudioStopSound

Stops playback, keeping the sound in memory.

AudioUnloadSound

Unloads the specified sound, freeing the memory it occupied.

AudioSilenceDevice

Stops playback of all sounds currently playing on the specified device.

AudioUnloadAll

Unloads all sounds from the device.

 

Display Devices (Multimedia Edition only)

 

To display things using Whisker, you place objects into documents and show those documents on display devices. A document's content may be altered whether or not it is being displayed.

 

DisplayClaim

Takes control of a 'physical' display (usually a dedicated monitor on a multimonitor computer).

DisplaySetAlias

Gives a display an alternative name.

DisplayRelinquishAll

Releases all display devices.

DisplayCreateDevice

Creates a 'virtual' device (usually a new window on the Windows desktop).

DisplayDeleteDevice

Deletes a virtual device created with DisplayCreateDevice.

DisplayGetSize

Finds out how big a display device is.

DisplayKeyboardEvents

Causes the display to respond to keypresses (only applicable when your display has the Windows input focus but useful if you want to use the keyboard as an input device in your testing). Keyboard events are sent to the client with a special KeyEvent: message.

DisplayCreateDocument

Creates a document.

DisplayShowDocument

Places a document on a display device.

DisplayBlank

Removes a document from a display device.

DisplayDeleteDocument

Deletes a document.

DisplaySetBackgroundColour

Sets the background colour for a document.

DisplayAddObject

Adds an object to a document. (Objects can be of many types.)

DisplayBringToFront

Brings an object to the front of a document.

DisplaySendToBack

Sends an object to the back of a document.

DisplayDeleteObject

Removes an object from a document.

DisplaySetEvent

Makes an object respond to being touched or clicked with the mouse.

DisplayClearEvent

Clears an event created with DisplaySetEvent.

DisplaySetObjectEventTransparency

Determines whether objects behind the specified object are also allowed to respond to touches or mouse clicks.

DisplayEventCoords

Obtain high-precision information about the location of touches and mouse clicks.

DisplayScaleDocuments

Although Whisker will display documents sensibly, you can gain extra control over the way your documents are scaled (if need be, adopting your own coordinate system to scale documents for different monitor sizes) using DisplayScaleCoordinates and DisplaySetDocumentSize.

DisplaySetDocumentSize

Sets the logical size of the document (for use with DisplayScaleCoordinates).

 

Claiming groups of devices

 

ClaimGroup

You may claim digital I/O lines, displays, and audio devices by device number, or by using names that you define to the server using a device definition file. This allows you to define groups of devices (e.g. all those that correspond to a single operant chamber) and claim them all at once using ClaimGroup.

 

Timing of events

 

TimeStamps

Determines whether the server appends a time-stamp to all messages it sends to the client. This facility can be used to record accurate timing information.

ResetClock

Resets the timestamp clock to zero.

RequestTime

Requests the time as judged by the timestamp clock (in milliseconds).

 

Communications management

 

These commands control the exchange of messages with the server.

 

Shutdown

Closes all communications with the server, freeing all claimed resources in the process.

ImmPort:

Informs the client which TCP port number to use in order to establish a second communication channel with the server. (The second channel is called the "immediate" socket, as opposed to the "main" socket that is established when the client first connects to the server).

Code:

Informs the client of the code to use when using the Link command.

Link

Informs the server that a particular "immediate" socket is to be functionally linked to a particular "main" socket because both are owned by the same client.

TestNetworkLatency

Tests the speed of the network connecting the client and the server.

 

Status reporting and miscellany

 

Version

Detects the server's version information.

ReportName

Reports the client's name to the server.

ReportStatus

Reports the client's current status to the server.

ReportComment

Sends a comment to the server (primarily for debugging).

WhiskerStatus

Requests information about the clients connected to the server, and their current status. (Used to monitor the Whisker system as a whole.)

SetMediaDirectory

Audio and display devices may use multimedia resource files such as wave-format (WAV) sound files and bitmap (BMP) pictures. These must be stored on the WhiskerServer machine. Tell the server where to find them with SetMediaDirectory. If a file cannot be found here, the server will try its own resource directory before trying the raw filename.

 

Client–client communication

 

The server assists clients to communicate with each other directly, if so desired.

 

SendToClient

Sends a message to another client. (If the server and recipient permit the message, the recipient will receive the message in a ClientMessage: message from the server; q.v.).

PermitClientMessages

Tells the server whether the client will permit incoming messages from other clients.

 

Video commands

 

Video objects are controlled using these conventional object-manipulation commands:

 

DisplayAddObject (option: video)
DisplayDeleteObject
DisplaySetEvent
DisplayClearEvent
DisplaySetEventTransparency
DisplayEventCoords
DisplayBringToFront
DisplaySendToBack

 

... and these video-specific commands:

 

DisplaySetAudioDevice
VideoPlay
VideoPause
VideoStop
VideoSeekAbsolute
VideoSeekRelative
VideoGetTime
VideoGetDuration
VideoTimestamps
VideoSetVolume