1 /*
2 * Copyright © 2016 Greg Chabala
3 *
4 * This file is part of brick-control-lab.
5 *
6 * brick-control-lab is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * brick-control-lab is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with brick-control-lab. If not, see http://www.gnu.org/licenses/.
18 */
19 package org.chabala.brick.controllab;
20
21 import java.util.EventListener;
22
23 /**
24 * The listener interface for receiving stop button events.
25 *
26 * @see StopButtonEvent
27 */
28 @FunctionalInterface
29 public interface StopButtonListener extends EventListener {
30
31 /**
32 * Invoked when the stop button is first pressed. The hardware will have
33 * a flashing LED next to the stop button to indicate a paused state.
34 * <p>
35 * While the OEM implementation of the control lab software would halt
36 * program operation in this state, the hardware does not hamper the flow
37 * of input data and continues to track output commands, only the physical
38 * outputs are prevented from receiving power. Actual behavior is left to
39 * the implementor of the interface.
40 *
41 * @param stopButtonEvent The event that triggered this callback.
42 */
43 void stopButtonPressed(StopButtonEvent stopButtonEvent);
44
45 /**
46 * Invoked when the stop button is disengaged. The hardware will have
47 * an unlit LED next to the stop button to indicate the computer is
48 * connected. Any outputs that were powered prior to the stop button
49 * being pressed will return to their prior state. Any output commands
50 * issued while in the stopped state will also take effect.
51 * <p>
52 * The default implementation is no-op.
53 *
54 * @param stopButtonEvent The event that triggered this callback.
55 */
56 default void stopButtonReleased(StopButtonEvent stopButtonEvent) {
57 }
58 }