Return | Jackpot | Comms | HostInterface | Config | Timer | JackSystem

/*
 * JackSystem.java
 */


/**
 * Jackpot system object provides access to general purpose system methods which
 * can be used to access some system resources (e.g Activity LED, Audio Relay)
 * and to provide mechanism for reporting critical failures.
 */
class JackSystem
{
    static final int OFF = 0;
    static final int ON = 1;


    /**
     * Initialises the Jackpot hardware. Must be called at startup.
     */
    static native void Initialise();

    /**
     * Controls the activity Led.
     *
     * @param   Action can be ON or OFF value
     */
    static native void Led(int Action);

    /**
     * Controls the audio relay.
     *
     * @param   Action can be ON or OFF value
     */
    static native void Relay(int Action);

    /**
     * Resets the Jackpot.
     */
    static native void Reset();

    /**
     * Copies source array into destination at specified positions.
     * Array objects can be only of java primitive types.
     *
     * @param   src source array object
     * @param   src_position starting position in source array
     * @param   dst destination array object
     * @param   dst_position starting position in destination array
     * @param   length number of array elements to copy
     */
    static native void arraycopy(Object src, int src_position,
                                 Object dst, int dst_position,
                                 int length);

    /**
     * Wrapper method for Reset method. It turns the activity Led on for
     * specified time and then calls Reset method.
     *
     * @param   Delay time in ms before Jackpot is re-started
     */
    static void SystemReset(int Delay)
    {
        Led(ON);
        Thread.sleep(Delay);
        Reset();
    }

    /**
     * Flashes the the activity Led in the infinite loop. Method is called
     * if a critical error occurs to indicate that something is wrong.
     *
     * @param   Count number of flashes
     * @param   Delay time in ms between the flashes
     */
    static void FailFlash(int Count, int Delay)
    {
        while (true)
        {
            for (int i=0; i < Count; i++)
            {
                JackSystem.Led(JackSystem.ON);
                Thread.sleep(10);
                JackSystem.Led(JackSystem.OFF);
                Thread.sleep(50);
            }
            Thread.sleep(Delay);
        }
    }
}

Return | Jackpot | Comms | HostInterface | Config | Timer | JackSystem