Main Page | Data Structures | File List | Data Fields | Globals

client.h File Reference

fwheel client application header More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
#include <termios.h>
#include <fcntl.h>
#include <signal.h>
#include "isisclient.h"
#include "siutils.h"
#include "mechanism.h"

Go to the source code of this file.

Defines

#define DEFAULT_MYID   "FW"
 default client ISIS node name

#define DEFAULT_MYPORT   6101
 default client socket port

#define DEFAULT_RCFILE   "/home/darkstar/dts/Config/fwheel.ini"
 default client runtime config file

#define DEFAULT_LOGFILE   "/home/darkstar/dts/Logs/fwheel.log"
 default client runtime log file (unimplemented)

#define DEFAULT_ISISID   "IS"
 default ISIS server node name

#define DEFAULT_ISISHOST   "darkstar"
 default ISIS server host

#define DEFAULT_ISISPORT   6600
 default ISIS server port number

#define APP_VERSION   "1.0 Beta"
 placeholder version number, set in Makefile

#define APP_COMPDATE   "2004-01-01"
 placeholder compilation date, set by build script

#define APP_COMPTIME   "00:00:00"
 placeholder compilation time, set by build script


Functions

int LoadConfig (char *)
 Load/Parse ISIS client's runtime configuration file.

void KeyboardCommand (char *)
 Process a command from the client's console keyboard.

void SocketCommand (char *)
 Process a message/command from the client socket.

void HandleInt (int)
 Service Ctrl+C Interrupts (SIGINT signals).

void abortall (void)
 Abort all pending moves.


Variables

isisclient_t client
 ISISclient runtime config table for this app.

si_mechanism_t fw
 Filter wheel mechanism table.

si_drivepars_t fwpar
 Filter wheel drive parameter table.

int beamoff
int loadoff


Detailed Description

fwheel client application header

Client application header for fwheel. Defines default data, and provides the prototypes for client-specific routines implemented in clientutils.c, the I/O handlers implemented in commands.c, and the runtime configuration file loader, loadconfig.c

Date:
2004 June 10 (last mod)

Define Documentation

#define DEFAULT_MYID   "FW"
 

default client ISIS node name

#define DEFAULT_MYPORT   6101
 

default client socket port

#define DEFAULT_RCFILE   "/home/darkstar/dts/Config/fwheel.ini"
 

default client runtime config file

#define DEFAULT_LOGFILE   "/home/darkstar/dts/Logs/fwheel.log"
 

default client runtime log file (unimplemented)

#define DEFAULT_ISISID   "IS"
 

default ISIS server node name

#define DEFAULT_ISISHOST   "darkstar"
 

default ISIS server host

#define DEFAULT_ISISPORT   6600
 

default ISIS server port number

#define APP_VERSION   "1.0 Beta"
 

placeholder version number, set in Makefile

#define APP_COMPDATE   "2004-01-01"
 

placeholder compilation date, set by build script

#define APP_COMPTIME   "00:00:00"
 

placeholder compilation time, set by build script


Function Documentation

int LoadConfig char *  cfgfile  ) 
 

Load/Parse ISIS client's runtime configuration file.

Parameters:
cfgfile Path/name of the client runtime configuration file
Returns:
0 if success, <0 if failure. All error message are printed to the client's console.
The precise actions of LoadConfig() are tailored to the client application.

void KeyboardCommand char *  line  ) 
 

Process a command from the client's console keyboard.

Parameters:
line string with the keyboard command
This function is setup as a callback for readline(), the GNU command-line library that provides Emacs-like key bindings for command-line editing, rapid "arrow keys" command history browsing, and convenient command history commands (!, !!, etc.). This gives the client application's command-line interface a look-and-feel familiar to most users of Unix system command shells (e.g., the tcsh shell).

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.

See also:
SocketCommand()

void SocketCommand char *  buf  ) 
 

Process a message/command from the client socket.

Parameters:
buf string with the IMPv2 message received from the remote application
This function parses a message received from a remote ISIS server or client application, and interprets the message. All EXEC: and implicit REQ: type messages are passed to the corresponding cmd_xxx() action functions for handling, while the remaining informational messages are simply echoed to the console screen.

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).

See also:
KeyboardCommand()

void HandleInt int  signalValue  ) 
 

Service Ctrl+C Interrupts (SIGINT signals).

SIGINT signal trap for trapping Ctrl+C interrupts. Calls abortall() to immediately abort all moves in progress.

See also:
abortall()

void abortall void   ) 
 

Abort all pending moves.

Uses the low-level SCLAbort() function to send the motion abort (SK = Stop/Kill) command to all microstep drives. Sending SK to an idle microstep drive has no consequences, so this shotgun approach is the simplest and safest.

Invoked by the Ctrl+C interrupt handler (HandleInt()), and called at the end of the main program when the application is quitting to make sure we don't accidentally quit and leave things running.

See also:
HandleInt() and SCLAbort()


Variable Documentation

isisclient_t client
 

ISISclient runtime config table for this app.

si_mechanism_t fw
 

Filter wheel mechanism table.

si_drivepars_t fwpar
 

Filter wheel drive parameter table.

int beamoff
 

int loadoff
 


Generated on Thu Jul 22 19:58:41 2004 for Filter Wheel Agent by doxygen 1.3.7