Go to the source code of this file.
Data Structures | |
struct | Commands |
Client command action function data structure. More... | |
Defines | |
#define | CMD_OK 0 |
Command executed OK, return completion status. | |
#define | CMD_ERR -1 |
Command execution resulted in an error. | |
#define | CMD_NOOP 1 |
Command execution requires no further action (no-op). | |
Functions | |
int | cmd_quit (char *, MsgType, char *) |
QUIT command. | |
int | cmd_ping (char *, MsgType, char *) |
PING command - communication handshaking request. | |
int | cmd_pong (char *, MsgType, char *) |
PONG command - communication handshaking acknowledgment. | |
int | cmd_info (char *, MsgType, char *) |
INFO command - report client application runtime information. | |
int | cmd_version (char *, MsgType, char *) |
VERSION command - report application version and compilation info. | |
int | cmd_verbose (char *, MsgType, char *) |
VERBOSE command - toggle verbose console output on/off. | |
int | cmd_debug (char *, MsgType, char *) |
DEBUG command - toggle debugging (super-verbose) console output on/off. | |
int | cmd_help (char *, MsgType, char *) |
HELP command - print a list of commands on the client console. | |
int | cmd_history (char *, MsgType, char *) |
HISTORY command - show the application's interactive command history. | |
int | cmd_status (char *, MsgType, char *) |
STATUS command - report client status. | |
int | cmd_read (char *, MsgType, char *) |
READ command - read a barcode label. | |
int | cmd_send (char *, MsgType, char *) |
SEND command - send a raw command to the barcode reader. | |
int | cmd_query (char *, MsgType, char *) |
QUERY command - send a raw device query to the barcode reader. | |
int | cmd_ports (char *, MsgType, char *) |
PORTS command - report info about open barcode reader comm ports. | |
int | cmd_setto (char *, MsgType, char *) |
TIMEOUT command - set/query the barcode reader communications timeout interval in seconds. | |
int | cmd_reset (char *, MsgType, char *) |
RESET command - reload the runtime config paramters and re-initialize the barcode reader. | |
Variables | |
Commands | cmdtab [] |
Client command action function data structure. | |
int | NumCommands = sizeof(cmdtab)/sizeof(struct Commands) |
number of commands defined |
To add a command, you need to
See commands.c for the full implementation details.
|
Command executed OK, return completion status.
|
|
Command execution resulted in an error.
|
|
Command execution requires no further action (no-op).
|
|
QUIT command.
|
|
PING command - communication handshaking request.
PINGs are actually handled separately in the SocketCommand() handler (nothing is done by the KeyboardCommand() handler) because the PONG sent back acknowledging the comm handshaking request is, in effect, a pseudo-command (implicit REQ:), not a "DONE:" response to a command request. This exception to the general messaging syntax has to be handled carefully to prevent problems, especially to ensure backwards compatibility with older IMPv applications.
|
|
PONG command - communication handshaking acknowledgment.
cmd_pong doesn't do anything except return a CMD_NOOP (since this "command" must NOT result in a reply back to the sender). In more sophisticated apps, we might actually use receipt of a pong to do something useful (e.g., help build up a node table), so at the very least this module works as a placeholder for future expansion.
|
|
INFO command - report client application runtime information.
The format of cmd_info should be tailored specifically for the particular client application. If a client controls specific instrument or interface functions, the state of those functions should be reported in the info string, making it an omnibus "what is your status" command. |
|
VERSION command - report application version and compilation info.
|
|
VERBOSE command - toggle verbose console output on/off.
In general "Verbose" output refers only to client application level output (i.e., echoing socket message traffic, printing status update info, etc.). An more chatty DEBUG mode is provided that prints more engineering-level info for detailed low-level system debugging.
|
|
DEBUG command - toggle debugging (super-verbose) console output on/off.
DEBUG mode is a super-verbose mode that spews lots of I/O chatter onto the application console, useful during client debugging or for troubleshooting. For example, in client applications that control stepper motors, the full motor control chatter is echoed to the console during DEBUG mode to enable the user to follow the steps the system is (or is not) taking, watch encoder and limit switches assert (or not), etc. DEBUG is normally disabled during normal user operations.
|
|
HELP command - print a list of commands on the client console.
|
|
HISTORY command - show the application's interactive command history.
|
|
STATUS command - report client status.
|
|
READ command - read a barcode label.
As a failsafe, the cmd_read function waits for a specified communications timeout interval (defined by the mask.timeout member), so that we don't wait forever for a reply from a barcode scanner that is malfunctioning or just turned off. On success, the reply string contains the text of the barcode label in IMPv2-compliant format as a keyword=value pair, the keyword text taken from the mask.Name string. For example, if mask.Name="MaskID", and the barcode label is read successfully as "MODS1-040231-Abell2203b" it will return to be passed back to the calling process (either echoed on the command console if a keyboard "READ" command, or back to the calling remote client if received as an "REQ: READ" command request). Raw reads, without IMPv2 reply formatting, can be accomplished by sending the "query \<X\>" command.
|
|
SEND command - send a raw command to the barcode reader.
Raw means RAW: the user must type <> delimiters.
|
|
QUERY command - send a raw device query to the barcode reader.
This routine sends a raw query and waits for a reply or timeout (e.g., if controller not there). The comm timeout is set by the mask.timeout member in global barcode struct. To send a command that produces no reply from the controller, use the "send" command, cmd_send(). To read a barcode in the reader's beam, use the "read" command, cmd_read()
|
|
PORTS command - report info about open barcode reader comm ports.
|
|
TIMEOUT command - set/query the barcode reader communications timeout interval in seconds.
If TIMEOUT was given without arguments, it returns the current communications timeout interval as an IMPv2-compliant keyword=value pair. If a number is given on the command line (e.g., TIMEOUT 5) it validates the number (converts to an integer) and sets the communications timeout (mask.timeout member), returning the new timeout value as an IMPv2-compliant keyword=value pair. If an invalid timeout interval is given, it returns an error message. The communications timeout interval should be at least as long as the barcode reader's internal no-decode timeout (usually 2 seconds), and typically is set to twice the no-decode timeout. Setting a shorter comm timeout could result in false no-read errors. Setting it to 0, while formally allowed, is just a bad idea. |
|
RESET command - reload the runtime config paramters and re-initialize the barcode reader.
This provides the client application with a warm restart facility. |
|
Client command action function data structure.
|
|
number of commands defined
|