Retrochallenge 2009
      Mark Wickens
      29-Jan-2009 21:01
                                        Programming 4

      Well, we're pretty much done. I got the RCU program working a couple of days
      ago, and I've just been putting the final touches to it, including the character
      terminal interface and help text.

      To use the command line interface, you run the program like this:

      $ RCU/ADDRESS=192.168.1.199/SWITCH=TOGGLE/INTERFACE=CLI ANCIL

      the /ADDRESS qualifier specifies the IP address or hostname (if defined) for the
      Mirrorbow controller unit. The /SWITCH qualifier can either switch the named
      device on, off or toggle its' current state. The /INTERFACE qualifier specifies
      CLI in this case. SMG is also implemented for the character terminal based
      version (see below). The parameter ANCIL is the name of the device to switch.
      These are currently hardcoded into the C program, but it wouldn't take much to
      get this information out into a configuration file.

      The program consists of the following source files:

      RCU.C - the main program
      CMDLINE.C - command line processing
      SMG.C - code for the character-cell interface
      TCPIP$MIRRORBOW.C - TCP/IP interface

      There are header files for each of these defining structures and functions.

      The build script is very straightforward:

      $ cc/debug/noopt rcu
      $ cc/debug/noopt cmdline
      $ cc/debug/noopt tcpip$mirrorbow
      $ cc/debug/noopt smg
      $ link rcu,cmdline,smg,tcpip$mirrorbow

      An install script takes care of defining the command for the local environment
      and building and installing a HELP library:

      $ set command rcu
      $ library/help/create rcu rcu
      $ cwd = f$environment("DEFAULT")
      $ define hlp$library 'cwd'rcu

      The help library provides a summary of the command and the valid command
      parameters and qualifiers:
      ________________________________________________________________________________
      RCU

          Invokes the RCU utility. RCU stands for Remote Control Unit. The
          utility is used to control a Mirrorbow Ethernet-based I/O Interface
          attached to a Power Distribution Unit. The two combined allow the
          remote control of mains operated devices.

          Format:

            RCU machine-name
        Additional information available:

        Parameters Qualifiers
        /ADDRESS=hostname     /PORT=port-number     /SWITCH=option
        /DIRECTION[=direction]           /INTERFACE=interface

      @RCU RCU Subtopic?
      ________________________________________________________________________________

      The character-cell interface uses the OpenVMS SMG library. I have to admit that
      I was able to re-use the code of an existing example that creates an SMG menu
      within a window to mimic the display on the mirrorbow LCD and allow the user to
      select an option to toggle. You can see the display below:

      SMG Interface

      The cursor keys can be used to highlight one of the available machines. The
      menu is created using the settings read from the Mirrorbow interface. When the
      ENTER key is pressed on one of the options a TOGGLE command is generated which
      toggles the power on the currently selected machine, the LCD display on the
      Mirrorbow is updated and the new port status is read from the mirrorbow and
      updated as a new menu in the character-terminal display. At this point the
      program exits.

      A useful extension would be to have the program loop round so that multiple
      devices could be controlled but this would require either an additional 'EXIT'
      menu item or some way of exiting the program via a key press (ESC would be the
      obvious choice).

      I've already used the program several times! I needed to copy some DVDs this
      morning, so I used the command line interface to turn on the Linux box. I could
      then telnet in via the VAX and copy a couple of DVDs (as it happens I was being
      lazy and used the k3b graphical program rather than the cdrecord command line
      tools. I've experienced problems with running linux applications remotely to the
      VAX, so resorted to running a VNC server on the linux box and using a VAX
      compiled VNC viewer. The display is pretty yucky but it is good enough to get
      the job done).

      The source code for the RCU program is available in a gzipped tar file[1] and a
      backup saveset[2].

      So that's pretty much a wrap! I'm going to do a final post with some thoughts
      about the whole process and some ideas for the next challenge!

      
      ENDNOTES

      1. RCU.TAR-GZ

      2. RCU.SAV