Class HardwareStatusIndicator

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class HardwareStatusIndicator extends JPanel
A hardware status indicator that shows the status of connected Emrick Receivers and Transmitters. This replaces the need to prompt users every time they need to use hardware.
See Also:
  • Field Details

    • availableTransmitters

      private Map<String,SerialTransmitter> availableTransmitters
    • availableReceivers

      private Map<String,SerialTransmitter> availableReceivers
    • selectedTransmitter

      private SerialTransmitter selectedTransmitter
    • selectedReceiver

      private SerialTransmitter selectedReceiver
    • transmitterLabel

      private JLabel transmitterLabel
    • receiverLabel

      private JLabel receiverLabel
    • scanTimer

      private Timer scanTimer
    • parent

      private MediaEditorGUI parent
    • spinnerLabel

      private JLabel spinnerLabel
    • spinnerTimer

      private Timer spinnerTimer
    • scanning

      private volatile boolean scanning
    • SPINNER_CHARS

      private final String[] SPINNER_CHARS
    • spinnerIndex

      private int spinnerIndex
    • CONNECTED_COLOR

      private static final Color CONNECTED_COLOR
    • DISCONNECTED_COLOR

      private static final Color DISCONNECTED_COLOR
    • MULTIPLE_COLOR

      private static final Color MULTIPLE_COLOR
    • SCANNING_COLOR

      private static final Color SCANNING_COLOR
  • Constructor Details

    • HardwareStatusIndicator

      public HardwareStatusIndicator(MediaEditorGUI parent)
  • Method Details

    • initializeUI

      private void initializeUI()
    • startHardwareScanning

      private void startHardwareScanning()
    • startScanAnimation

      public void startScanAnimation()
      Start a simple spinner animation and color change to indicate scanning. Safe to call from any thread.
    • doStartScanAnimation

      private void doStartScanAnimation()
    • stopScanAnimation

      public void stopScanAnimation()
      Stop the spinner animation and restore the status display. Safe to call from any thread.
    • doStopScanAnimation

      private void doStopScanAnimation()
    • scanForHardware

      private void scanForHardware()
    • performPortScan

      private HardwareStatusIndicator.ScanResult performPortScan()
    • scanForHardwareBlocking

      public void scanForHardwareBlocking()
      Blocking version of scanForHardware that runs on the calling thread. Use this for short synchronous rescans from event handlers when caller wants an immediate result. This method will still update the UI (animation start/stop) on EDT.
    • updateStatusDisplay

      private void updateStatusDisplay()
    • getShortPortName

      private String getShortPortName(String fullPortName)
    • handleTransmitterClick

      private void handleTransmitterClick()
    • handleReceiverClick

      private void handleReceiverClick()
    • getPortNameForTransmitter

      private String getPortNameForTransmitter(SerialTransmitter st)
    • getPortNameForReceiver

      private String getPortNameForReceiver(SerialTransmitter st)
    • getTransmitter

      public SerialTransmitter getTransmitter()
      Get the currently selected or available transmitter
      Returns:
      SerialTransmitter object or null if none available
    • getReceiver

      public SerialTransmitter getReceiver()
      Get the currently selected or available receiver
      Returns:
      SerialTransmitter object or null if none available
    • isValidTransmitter

      private boolean isValidTransmitter(SerialTransmitter st)
    • isValidReceiver

      private boolean isValidReceiver(SerialTransmitter st)
    • getTransmitterBypass

      public SerialTransmitter getTransmitterBypass()
    • isTransmitterAvailable

      public boolean isTransmitterAvailable()
      Check if a transmitter is available
      Returns:
      true if at least one transmitter is connected
    • isReceiverAvailable

      public boolean isReceiverAvailable()
      Check if a receiver is available
      Returns:
      true if at least one receiver is connected
    • stopScanning

      public void stopScanning()
      Stop the hardware scanning timer