Interface DeviceClient

All Known Implementing Classes:
MockDeviceClient, RealDeviceClient

public interface DeviceClient
Interface defining the contract for communicating with the signal analysis hardware.

Implementations of this interface handle the low-level details of connection management, command transmission, and data retrieval.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Registers a listener to receive data and error events.
    boolean
    Establishes a connection to the specified port.
    void
    Closes the active connection and releases resources.
    Retrieves a list of currently available serial ports on the system.
    void
    Sends a command to the connected device.
  • Method Details

    • connect

      boolean connect(String port)
      Establishes a connection to the specified port.
      Parameters:
      port - The system port name (e.g., "COM3", "/dev/ttyACM0").
      Returns:
      true if the connection was successfully established, false otherwise.
    • disconnect

      void disconnect()
      Closes the active connection and releases resources.
    • sendCommand

      void sendCommand(DeviceCommand cmd)
      Sends a command to the connected device.
      Parameters:
      cmd - The DeviceCommand to send.
    • addListener

      void addListener(DataListener listener)
      Registers a listener to receive data and error events.
      Parameters:
      listener - The DataListener to add.
    • getAvailablePorts

      List<String> getAvailablePorts()
      Retrieves a list of currently available serial ports on the system.
      Returns:
      A list of port names.