                Channel Access Perl or C Client Exercise
                ========================================

    You are working at the Simulated Photon Source, which has 36 beamlines.
    Each beamline has a front-end shutter, which is opened and closed by the
    beamline experimenters. An EPICS PV reports the current state of the
    shutter for each beamline.

    Your task is to write a long-running CA client application that connects
    to the shutter PVs of all beamlines, watches the shutters opening and
    closing and calculates the total amount of time that each beamline has
    had their shutter open over the run period.

    The shutter PVs are named 'id01:shutter' through 'id36:shutter' and have
    the value 0 (or "Closed") when closed and 1 (or "Open") when open. The
    PV also provides the time when the shutter changed to its current state
    as the timestamp metadata for the channel.


    Perl Development
    ----------------

    A skeleton Perl program template.pl is included in your home directory
    to get you started. It shows you how to load the CA library and connect
    to a PV with a connection callback. Look at the source code to see what
    it does, then try running it.

    Make a copy of the template program and modify it to subscribe to value
    changes from a single shutter PV, say 'id01:shutter'. Print the state of
    the shutter whenever it opens or closes. Now change your subscription to
    use one of the DBR_TIME_xxx data types and print the timestamp as well
    as the shutter state. Test your program.

    Modify your program to save the timestamp when the shutter opens, and
    then when it closes, calculate how long the exposure was. Add up the
    exposure times to keep a running total of the exposures for the run.
    Test your program.

    Make another copy of your first program and modify it to connect to all
    of the beamline shutter PVs and record the total exposure for each
    beamline individually. Add code to the interrupt callback subroutine
    that prints the total exposure time for all beamlines. Test your
    program.


    C Development
    -------------

    Type these commands to create a build area with some example CA client
    program sources in it:

        mkdir clients
        cd clients
        makeBaseApp.pl -t caClient clientApp
        make

    Try running the resulting programs like this:

        bin/linux-x86/caExample id01:shutter

        echo id01:shutter > pvfile
        bin/linux-x86/caMonitor pvfile

    Examine the source files in the clientApp directory.
