A COMMAND SCRIPT FILE SYNTAX
Command script files are written as a sequence of commands, one command per line. The commands are executed one after the other, the execution of the next command being started when the answer to the previous command is received, or when a timeout occurs (default timeout is one second). By default, the command script is aborted on the first syntax error or on the first error reply encountered.
Valid command lines may appear in any order in the file. Leading spacing characters are ignored, allowing indentation of the commands for clarity. Empty lines (i.e. with only spacing characters) and lines starting with a first non-spacing character equal to the `#' character are ignored. All the command lines are composed of a case sensitive key word, and, if any, of a separator (the token " : " composed of one space character, one colon character and another space character) and an argument which includes all the characters after the separator till the carriage return character.
The syntax of each possible command line is given in the next table.
Table 1: Commands
Keyword |
Separator |
Argument |
Comments |
NODE |
Yes |
node name |
Maximum 7 characters. Apply until another NODE command is found. |
PROCESS |
Yes |
process name |
Maximum 19 characters. Apply until another PROCESS command is found. |
MAX_DELAY |
Yes |
maximum waiting time in milliseconds between two commands (time-out) |
Translated to an integer. Defaulted to 1000 (ms) at the beginning of each command script. Used only when waiting for the answer to a COMMAND command line. |
PARAMETER_SET |
Yes |
parameter set file name |
File contains definition of database parameter names to be loaded in the monitoring window. |
STOP_ON_ERROR |
No |
N/A |
Apply until a CONT_ON_ERROR command is found. A STOP_ON_ERROR command is implicit at the beginning of each command script. |
CONT_ON_ERROR |
No |
N/A |
Apply until a STOP_ON_ERROR command is found |
WAIT |
Yes |
waiting time in seconds |
Translated to an integer. This command suspends the script execution for the given amount of seconds. |
COMMAND |
Yes |
command name and argument values list |
The command is sent to the target node and process. This command suspends the script execution until the answer to the command is received or until the last given maximum delay is consumed |
The following example shows a typical initialization command script.
# Define script behaviour
# Define target environment, process and parameters
PARAMETER_SET: evt_alrm.ps
# Configure the interface as log server
COMMAND: ERRSTRT "lccServer"
# Enable automatic logging
COMMAND: LOGERDB Specific,:PARAMS:SCALARS.scalar_logical:PARAMS:VECTORS.vector_uint32(0:0)
COMMAND: LOGEWDB Specific,:PARAMS:SCALARS.scalar_double:PARAMS:VECTORS.vector_uint32(1:1)
COMMAND: EVTCNF:PARAMS:VECTORS.vector_int32(5:5), 10, 5, -5,-10, 2
COMMAND: EVTCNFA ":PARAMS:VECTORS.vector_int32(5:5)", 1, 2, 3, 4
# Request database changes monitoring
COMMAND: EVTATT ":PARAMS:VECTORS.vector_int32(5:5)", DeadBand
COMMAND: EVTATTA ":PARAMS:VECTORS.vector_int32(5:5)"
COMMAND: EVTSSR "Sec", 10
COMMAND: AIOCNF ":SIGNALS:ANALOG.aInput1", "/aio0", 1, "Input", 0.5, -10, 10, "100", 0.0
COMMAND: AIOCNF ":SIGNALS:ANALOG.aOutput1", "/aio0", 1, "Output", 0.5, -10, 10, "100", 0.0
COMMAND: DIOCNF ":SIGNALS:DIGITAL.dInput1", "/acro0", 0, 4, "Input", "High", 0
COMMAND: DIOCNF ":SIGNALS:DIGITAL.dInput2", "/acro0", 4, 4, "Input", "Low", 0
COMMAND: DIOCNF ":SIGNALS:DIGITAL.dInput3", "/acro0", 8, 1, "Input", "High", 0
COMMAND: DIOCNF ":SIGNALS:DIGITAL.dInput4", "/acro0", 9, 1, "Input", "Low",
COMMAND: DIOCNF ":SIGNALS:DIGITAL.dOutput1", "/acro0", 0, 4, "Output", "High", 0
COMMAND: DIOCNF ":SIGNALS:DIGITAL.dOutput2", "/acro0", 4, 4, "Output", "Low", 0
COMMAND: DIOCNF ":SIGNALS:DIGITAL.dOutput3", "/acro0", 8, 1, "Output", "High", 0
COMMAND: DIOCNF ":SIGNALS:DIGITAL.dOutput4", "/acro0", 9, 1, "Output", "Low", 0
2 PARAMETER SET FILE SYNTAX
Parameter set files are written when the "Save Parameter Set" command is issued from the Database Monitoring Window, and are read when the "Load Parameter Set" command is issued either from the Database Monitoring Window or from a command script. It is not foreseen to give direct access to these files, but they are ASCII files with a precise contents.
A parameter set file starts always with three lines for node, process and monitoring period definitions, followed by one line giving the number of parameters in the set. Then the file is continued with lines containing parameters description: names, values, parameter type, value type and value size, for each parameter in the set. No empty lines nor comments lines are allowed in the file.
Each line is composed of a case sensitive key word, a separator (the token " : " composed of one space character, one colon character and another space character) and one argument which includes all the characters after the separator till the carriage return character.
The next table gives all the details for each different kind of line.
Table 2: Parameter Set
Keyword |
Argument |
Comments |
NODE |
none name |
Maximum 7 characters. Always the first line of the file. |
PROCESS |
process name |
Maximum 19 characters. Always the second line of the file. |
PERIOD |
monitoring period in seconds |
An integer value. Always the third line of the file. |
PARAMETER NUMBER |
number of parameters in the set |
A positive or null integer value. Always the fourth line in the file |
PARAMETER |
database item name |
An ascii string addressing a valid atomic value of a valid database item. Always the first line of a parameter description. |
VALUE |
database item value |
Always paired with the previous PARAMETER line. Always the second line of a parameter description. |
ATTRIBUTE TYPE |
database item type |
An integer: 0 for scalar items, 1 for vector items and 2 for table items. Always the third line of a parameter description. |
VALUE TYPE |
value type |
An integer: 1 for logical, 2 for int8, 3 for uint8, 4 for int16, 5 for uint16, 6 for int32, 7 for uint32, 8 for float, 9 for double, 10 for polar, 11 for rectangular, 16 for string4, 17 for string8, 18 for string12, 19 for string16, 20 for string20, 21 for string32, 22 for string48, 23 for string64, 23 for string80, 25 for string128, 26 for string256, 28 for XRef, 29 for date, 30 for timeOfDay, 31 for AbsTime Always the fourth line of a parameter description. |
VALUE SIZE |
value size in bytes |
A integer whose value is related to the value type: 1 for logical, int8 and uint8, 2 for int16 and uint16, 4 for int32, uint32, float and string4, 8 for double, date, timeOfDay, absTime and string8, 12 for string12 and XRef, 16 for string16, polar and rectangular, 20 for string20, 32 for string32, 48 for string48, 64 for string64, 80 for string80, 128 for string128 and 256 for string256. Always the fifth line of a parameter description. |
The following example uses syntactically correct database item names but not valid for any real database. It gives an extensive description of parameter set description capabilities.
PARAMETER : :PARAMS:SCALARS.scalar_logical
PARAMETER : :PARAMS:SCALARS.scalar_uint8
PARAMETER : :PARAMS:SCALARS.scalar_uint16
PARAMETER : :PARAMS:SCALARS.scalar_int32
PARAMETER : :PARAMS:SCALARS.scalar_double
PARAMETER : :PARAMS:SCALARS.scalar_string4
PARAMETER : :PARAMS:SCALARS.scalar_string64
PARAMETER : :PARAMS:SCALARS.scalar_string128
PARAMETER : :PARAMS:SCALARS.scalar_string256
PARAMETER : :PARAMS:VECTORS.vector_logical(1:1)
PARAMETER : :PARAMS:VECTORS.vector_uint16(0:0)
PARAMETER : :PARAMS:VECTORS.vector_int32(7:7)
PARAMETER : :PARAMS:VECTORS.vector_double(4:4)
PARAMETER : :PARAMS:VECTORS.vector_double(5:5)
PARAMETER : :PARAMS:VECTORS.vector_string20(5:5)
PARAMETER : :PARAMS:TABLES.full_table(0:0,logical:logical)
PARAMETER : :PARAMS:TABLES.full_table(0:0,uint32:uint32)
PARAMETER : :PARAMS:TABLES.full_table(0:0,string32:string32)
PARAMETER : :PARAMS:TABLES.full_table(1:1,0:0)
PARAMETER : :PARAMS:TABLES.full_table(1:1,1:1)
3 COMMAND INTERPRETER TABLE SYNTAX
Command interpreter table files are written as a sequence of mapping instructions, one per line. Each mapping instruction gives the command name, its associated function name, its execution mode (either as a function or as a separated task) and optional parameters for the spawned task (if any). Empty lines and comments lines (starting with the "//" token) are allowed anywhere in the file.
The different parts of a mapping line (e.g. the command name, the routine name, ...) are separated by a separator, the comma character. All the spacing characters (i.e. the space, the horizonal tab and the form feed (new page) characters) are ignored, enabling the user to adapt the line to its favourite presentation. Use of the vertical tab is not allowed.
A mapping line for local execution of the routine as a function looks like:
COMMAND,routineName,FUNCTION,options
where the command name is a string of maximum seven characters, the routine name is a string,
FUNCTION is a key word and options are defined below. These three fields are mandatory.
A mapping line for separated execution of the routine as a task looks like:
COMMAND,routineName,TASK,taskName,priority,run-time_flags,stack_size,options
where the command name is a string of maximum seven characters, the routine name is a string, TASK is a key word, taskName is the spawned task name, the priority an integer number between 0 and 255, the run-time flags are valid VxWorks run-time flags, the stack size is a positive even integer giving the stack size of the spawned task and the possible options are described below. The first three fields are mandatory. The four last fields are optional, and can be entered as an empty field (i.e. two comma characters separated by any number of ignored spacing characters). When a field is not defined in the line, the VxWorks default value will be used for the field. When all the trailing fields of a line are defaulted, the separators are also optional.
Keyword
DUMMY allows to specify that a command shall not be executed. An empty reply is sent by the Command Interpreter without other processing. The mapping is defined as follow:
COMMAND,routineName,DUMMY
where the command name is a string of maximum seven characters and the routine name is a string. The three fields are mandatory.
options1 field allows to specify additional optional processing features:
·
RAW: parameters are passed without processing to the function associated to the command,
·
LOADED, STAND-BY, STAND-ALONE, ON-LINE: LCU states for wich the command is rejected by the Command Interpreter.
·
REGISTER: specifies if a command that is spawned as task should register the message system. The task is registered with the name
taskName. With this option
ccsInit is called before the the code of the routine is executed and
ccsExit is called after the execution,
·
BREAK: break handler of the command,
·
KILL: kill handler of the command.
The options must be given in the given order, separated by commas, except for LCU states which shall be separated by spaces.
It is also possible to include command interpreter tables in a command interpreter table with the
#include statement. The following rules applies:
· it is possible to have nested include files
· the include files are searched in the directories $INTROOT/vw/CIT or $VLTROOT/vw/CIT
//==============================================================================
//==============================================================================
DBBCKP, IdbBackup, TASK, tBackup, 20, , 30000, SETID
DBBCKP2,IdbBackup, TASK,,,,,REGISTER, BREAK bHandler, KILL kHandler
DBDREM, IdbDisRemoteAccess, TASK , , , ,
DBDSIM, IdbDisSim, FUNCTION, RAW
DBEREM, IdbEnRemoteAccess, FUNCTION, SETID
DBESIM, IdbEnSim, FUNCTION
DBGALS, IdbGetAlias, FUNCTION, RAW, SETID, LOADED ON-LINE
DBGAINF, IdbGetAttrInfo, FUNCTION, LOADED STAND-BY
DBGANAM, IdbGetAttrNames, FUNCTION
DBGANUM, IdbGetAttrNumber, FUNCTION, RAW, STAND-BY
DBGDIRA, IdbGetDirAddr, FUNCTION
DBGFAM, IdbGetFamily, FUNCTION
DBGFNAM, IdbGetFieldNames, FUNCTION
DBGPAR, IdbGetParent, FUNCTION
DBGCWP, IdbGetCwp, FUNCTION
DBLOAD, IdbLoad, TASK , , , ,SETID
DBLCKA, IdbLockAttr, FUNCTION
DBLCKP, IdbLockPoint, FUNCTION
DBREAD, IdbReadSymbolic, FUNCTION
DBULCKP, IdbUnlockPoint, FUNCTION
DBWRIT, IdbWriteSymbolic, FUNCTION
DBREST, IdbRestore, FUNCTION
DBSCWP, IdbSetCwp, FUNCTION
DBULOAD, IdbUnload, DUMMY
DBULCKA, IdbUnlockAttr, DUMMY
4 COMMAND DEFINITION TABLE EXAMPLE
The syntax of the command definition table is explained in the chapter
2.11 of this manual. An example of command definition table is given, derived from the database commands provided by the LCC software.
//==============================================================================
//==============================================================================
PAR_NAME= pointOrFileName
PAR_RANGE= ENUM "File" , "Buffer"
PAR_RANGE= ENUM "Branch" , "Point"
Save the value of a branch or a single point of the database in the file or in
//==============================================================================
SYNONYMS= dbDisRemoteAccess
Disable the access to remote databases.
//==============================================================================
Disable simulation of the remote database access.
//==============================================================================
SYNONYMS= dbEnRemoteAccess
Enable the access to remote databases.
//==============================================================================
Enable simulation of the remote database access.
//==============================================================================
DISPLAY_FORMAT = "Alias: %s"
Get the alias of a point.
//==============================================================================
DISPLAY_FORMAT = "Point: %s"
Get the name of a point corresponding to the given alias.
//==============================================================================
Get information about an attribute.
//==============================================================================
Get the list of attributes of a point.
//==============================================================================
SYNONYMS= dbGetAttrNumber
DISPLAY_FORMAT= "%d attributes"
Get the number of attributes for a point.
//==============================================================================
DISPLAY_FORMAT= "Level:%s Plin:%d Ain:%d (%d:%d,%d:%d)"
Get the direct address of a point or an attribute.
//==============================================================================
Get the plins of child points and parent.
//==============================================================================
SYNONYMS= dbGetFamilyNames
PAR_RANGE= ENUM "Absolute", "Relative", "Alias"
Get the name of child points and parent.
//==============================================================================
SYNONYMS= dbGetFieldNames
Get the field names of a table attribute.
//==============================================================================
DISPLAY_FORMAT= "ParentPlin: %d"
Get the plins of parent only.
//==============================================================================
DISPLAY_FORMAT= "Current Working Point: %s"
Get the current working point in a remote database.
//==============================================================================
Load the definition of the local database from disk.
//==============================================================================
Load the definition of a branch of the local database from disk.
//==============================================================================
Lock an attribute (write only).
//==============================================================================
Lock a point in a remote database for read and write access. All the
attributes inside the point are locked.
//==============================================================================
Read a remote database attribute. The attribute is accessed by symbolic name.
This command is also used by the LCU Common Software to access a remote
database. The remote database can reside on a workstation (CCS on-line
database) or another LCU.
//==============================================================================
Read a remote database scalar attribute. The attribute is accessed by symbolic
//==============================================================================
Unlock a locked point in a remote database.
//==============================================================================
SYNONYMS= dbWriteSymbolic
Write a remote database attribute. The attribute is accessed by symbolic name.
//==============================================================================
Write a remote database scalar attribute. The attribute is accessed by symbolic
//==============================================================================
PAR_RANGE= ENUM "File" , "Buffer"
Restore the value of a set of database attributes, from a file or a buffer.
//==============================================================================
Set the current working point in a remote database.
//==============================================================================
Unload the local database on disk.
//==============================================================================
Unload the definition of a branch of the local database to disk.
//==============================================================================
//==============================================================================
//==============================================================================
Request a Command Interpreter to load new Command Definition and Command
//==============================================================================
SYNONYMS= cmdSetTestError
Set the error number to be returned with the next command.
//==============================================================================
//==============================================================================
1
The SETID option found in lccServer.cit and rdbServer.cit is only for internal use. The process id of command interpreter is replaced by process id of sender of the command during execution of the command. It is mutually exclusive with REGISTER.