- 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 TypeMethodDescriptionvoidaddListener(DataListener listener) Registers a listener to receive data and error events.booleanEstablishes a connection to the specified port.voidCloses the active connection and releases resources.Retrieves a list of currently available serial ports on the system.voidsendCommand(DeviceCommand cmd) Sends a command to the connected device.
-
Method Details
-
connect
Establishes a connection to the specified port.- Parameters:
port- The system port name (e.g., "COM3", "/dev/ttyACM0").- Returns:
trueif the connection was successfully established,falseotherwise.
-
disconnect
void disconnect()Closes the active connection and releases resources. -
sendCommand
Sends a command to the connected device.- Parameters:
cmd- TheDeviceCommandto send.
-
addListener
Registers a listener to receive data and error events.- Parameters:
listener- TheDataListenerto add.
-
getAvailablePorts
Retrieves a list of currently available serial ports on the system.- Returns:
- A list of port names.
-