#include "isisclient.h"
#include "ifwtool.h"
#include "commands.h"
#include "ifwutils.h"
#include <readline/readline.h>
#include <readline/history.h>
Functions | |
int | cmd_quit (char *args, MsgType msgtype, char *reply) |
QUIT command. | |
int | cmd_ping (char *args, MsgType msgtype, char *reply) |
PING command - communication handshaking request. | |
int | cmd_pong (char *args, MsgType msgtype, char *reply) |
PONG command - communication handshaking acknowledgment. | |
int | cmd_version (char *args, MsgType msgtype, char *reply) |
VERSION command - report application version and compilation info. | |
int | cmd_verbose (char *args, MsgType msgtype, char *reply) |
VERBOSE command - toggle verbose console output on/off. | |
int | cmd_debug (char *args, MsgType msgtype, char *reply) |
DEBUG command - toggle debugging (super-verbose) console output on/off. | |
int | cmd_info (char *args, MsgType msgtype, char *reply) |
INFO command - report client application runtime information. | |
int | cmd_help (char *args, MsgType msgtype, char *reply) |
HELP command - print a list of commands on the client console. | |
int | cmd_history (char *args, MsgType msgtype, char *reply) |
HISTORY command - show the application's interactive command history. | |
int | cmd_ports (char *args, MsgType msgtype, char *reply) |
PORTS command - report info about open IFW comm ports. | |
int | cmd_status (char *args, MsgType msgtype, char *reply) |
STATUS command - report application status. | |
int | cmd_send (char *args, MsgType msgtype, char *reply) |
SEND command - send a raw command to the IFW. | |
int | cmd_filter (char *args, MsgType msgtype, char *reply) |
FILTER command - set/query the filter position. | |
int | cmd_home (char *args, MsgType msgtype, char *reply) |
HOME command - return the filter wheel to position 1. | |
int | cmd_setto (char *args, MsgType msgtype, char *reply) |
TIMEOUT command - set/query the IFW communications timeout interval in seconds. | |
int | cmd_init (char *args, MsgType msgtype, char *reply) |
RESET command - reload the runtime config paramters and re-initialize the IFW. | |
void | KeyboardCommand (char *line) |
Process a command from the client's console keyboard. | |
void | SocketCommand (char *buf) |
Process a message/command from the client socekt. |
|
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.
|
|
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.
|
|
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. |
|
HELP command - print a list of commands on the client console.
If an argument is given, it tries to find that string in the command list, and if successful, prints a brief description and usage message. Help is meant to be simple. It can give help on particular commands (really a reminder of the command's function and syntax), or a list of all commands. |
|
HISTORY command - show the application's interactive command history.
|
|
PORTS command - report info about open IFW comm ports.
|
|
STATUS command - report application status.
|
|
SEND command - send a raw command to the IFW.
|
|
FILTER command - set/query the filter position.
|
|
HOME command - return the filter wheel to position 1.
|
|
TIMEOUT command - set/query the IFW 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 (ifw.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 long enough to allow the IFW to complete the longest move. For the IFW, the manual says that this is the WHOME command, which can take up to 20 seconds to complete. Setting a shorter comm timeout could result in false timeout errors. Setting it to 0, while formally allowed, is just a bad idea. |
|
RESET command - reload the runtime config paramters and re-initialize the IFW.
This provides the ifwtool application with a warm restart facility. |
|
Process a command from the client's console keyboard.
This function parses the interactive command line and calls the appropriate low-level cmd_xxx() command action functions for excuting most commands, as well as servicing ">XX msgtype: command" format raw IMPv2 message sending requests. All keyboard commands are treated as EXEC: type IMPv2 messages. This makes the downstream cmd_xxx() action functions insensitive to whether or not the command came from the keyboard or from a remote ISIS server or client application.
|
|
Process a message/command from the client socekt.
More sophisticated handlers might pass such messages on to parsers/handlers of their own if the inputs were actually used for something other than "visual" information for the user of this application. All messages received from an ISIS node are assumed to be in the proper IMPv2 messaging syntax. Note that EXEC: is new to IMPv2. It allows remote nodes to transmit protected "executive" commands to clients, giving them access to commands that would otherwise only be available on the console keyboard (e.g., the "quit" command). Thus a remote EXEC: command means "act as if this was typed at the keyboard". It is the responsibility of the remote application to make sure that EXEC: is used with care, as you could do something stupid (though your client application should not allow actions that would be physically unsafe to personnel or equipment).
|