ditscmd - Sends a command to a Dits task and waits for the response.

Function

Sends a command to a Dits task and waits for the response.

Description

This program provides a simple user interface to a Dits task. It first gets the path to the specified Dits task and sends an obey message with the specified name and arguments. It waits for the response, outputting the details of any Error for Informational messages received from the task. When the subsidiary action completes, DITSCMD exits, returning the completion status of the subsidiary action.

Synopsis

ditscmd [options] task action [action_arguments ...]

Under VxWorks, all options and arguments should be enclosed in the one string.

Command arguments

task
The name of the task to send the message to. If a remote task use the format task@node, where node is the internet node name of the machine the task is running on.
action
The name of the action or parameter to in the task

action_arguments
All other arguments are considered arguments to the task, and are encoded as character strings in an argument structure. If the string contains an equals sign, it is assumed that the characters before the equals sign are the parameter name, and the characters after are a string value. Otherwise each argument has the name
                           Argument
Where <n> is the number of the argument, starting at 1. The -z option can be used to change the equals sign to something else.

If doing a parameter get operation, the arguments are names of extra parameters to fetch.

Options

-b size
Depreciated. Size is the total message buffer size. Default 15000. This size should be about bigger then that required by the reply values specified by the "-m" option. This is now sized automatically if you change the reply buffer sizes - the relevant part of the "-m" spec. In that case the global buffer will always be set to be at least large enough to set up the reply buffer.

-m n1:n2:n3
Sets message buffer sizes for the connection. n1 = Messages bytes allowed for message to be sent n2 = Messages bytes allowed for return messages n3 = Number of return messages which may occur Default is 800:800:10 which should be sufficient for most command line level tasks. The first item is actually overridden to a size appropriate for the argument to be sent - its use here is historical.

Depreciated - in most cases -r will do what you need

-r n
Sets the reply buffer size. Sets max replies to 1 This replaces -m for most use cases.

-n name
The name this task should register itself as. Default is DITSCMD_<n> where <N> is a hex representation of the process id. This option may be required if you intend to have several versions of this program outstanding at one time.

-o
Send obey message (default).
-k
Send kick message.
-s
Send set message.
-g
Send get message. (Actually multiple parameter get message, but this works ok one only one parameter is specified).
-c
Send control message.
-p
Send parameter monitor message.
-l
Send multiple parameter get message (redundant, you can use -g).
-v
Report responses verbosely using SdsList, not briefly using ArgToString. Overrides any -w option.
-w
Write any returned Sds structure to the file ditscmd_out.sds. Overrides any -v option. On successfully completion program will exit quietly after writing the file. Can be replaced by -t when not on VxWorks
-t <file>
Write any returned Sds structure to the file <file>. Overrides any -v option. On successfully completion program will exit quietly after writing the file. Not available on VxWorks
-a <file>
Read the obey arguments from the specified file rather then the command line. Non-VxWorks versions only. Any extra arguments will cause an error.
-z <c>
Change from using "equals" in the Name=value argument naming convention to using the specified character. Only the first character of the value is used.
-q
Special fetch of parameters. Instead of outputting the result using MsgOut, it is directly output to stdout. This makes it easier to fetch parameter values in scripts. Is overridden by -w, -v and any flag which causes another message type to be sent.
-x
If the sub-task exits, then don't return an error code from this program.
--
Stop processing options. You will need to use this if your arguments contain negative numbers or other values prefixed by a dash.

-e n
Specifies the expected return code for the message. This allows you to specify error code values which are the expected status from the message and if that is returned then ditscmd returns ok, otherwise it returns an error even if status is ok. Often used to check to expected error conditions in regression testing. 'n' is a positive integer. Not supported in VxWorks
-h
Output help on this program.

Language

C

Support

Tony Farrell, AAO

Click here for the DRAMA home page and here for the AAO home page.

 For more information, contact tony.farrell@mq.edu.au