Command Center

 
 
Remote clients can connect to ORCA via a BSD socket provided by the command center. Remote commands can do such things as start/stop runs, request status information, etc. The command center is opened from the main menu, Windows->Command Center. The setup dialog of the command center provides a port number for client to connect to, however in the current version of ORCA the port defaults to port 4667.


Sending Commands


The format of the commands is a modified form of Obj-C method calls. For example, the command to start a run from a client is:


[RunControl startRun];


Similarly stopping the run would be:


[RunControl stopRun];


The commands can be any Obj-C method understood by the object, with the exception that the arguments, if any, can not be pointers. The receiver of the command must either be the name of a registered object, such as RunControl or HeartBeat, or it can the general ID of a hardware object. For example, the command


[ORShaper,0,1 setThreshold:3 withValue:23];


would set the threshold for the shaper card in crate 0, slot 1. If the crate and card is left off,


[ORShaper setThreshold:3 withValue:23];


the channel 3 threshold of ALL shaper cards would be set. There is no way to set the values of all channels with one command at this time. To do that, use the Hardware Wizard.


Multiple commands can be sent as long as the ';' separates all commands. Also, a file full of commands can be sent from the dialog (see below). The input dialog is meant mainly to test suits of commands that a remote client might send.


Note that the commands described above are NOT OrcaScript commands.


Receiving Information


To receive information back, just use a variable in front of the command like so:


x = [RunControl isRunning];


Then a response will be sent back with the variable name followed by the requested value, like this:


x:1

 

You can enter a command here. Useful for testing.

There is a history, use the arrow keys to cycle to previous commands.

Set the port to use. Default port is 4667.

Bring up the Script IDE

This area would should a list of connected clients and the time that they originally connected.

Send a whole file of commands

Formating Complex Arguments


It is possible to send complex objects like NSDictionaries as arguments. To do this you remove the plist XML header and wrap the plist in curly brackets. For example a dictionary with following information:


key = x

value = 1.1

key = y

value = 2.2


would be normally represented in Cocoa as the following plist:


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>x</key>

<real>1.1</real>

<key>y</key>

<real>2.2</real>

</dict>

</plist>


To send it in a command remove the header and trailer and replace them with curly brackets. As a command argument the example command would look like this:


[ORScriptTaskModel,1 shipDataRecord: {

<dict>

<key>x</key>

<real>1.1</real>

<key>y</key>

<real>2.2</real>

</dict> }

tag:0];


Any valid plist can be used, which includes nested objects.


Of course it is not normally practical to type such long commands directly into the command center, but commands usually come from remotely connected programs so the formatting can be done programmatically.