--- source_files: - DataPRO/CanFDApiProxy/Interfaces/ICANFDApi.cs generated_at: "2026-04-17T16:30:03.655597+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "b24ad9d8b14edfc6" --- # Interfaces ### Purpose This module defines the `ICANFDApi` interface, which abstracts communication with CAN-FD (Controller Area Network with Flexible Data-rate) devices. It provides a comprehensive contract for retrieving device status, configuring hardware settings, and managing file operations on remote CAN-FD devices identified by a device host string. ### Public Interface **Interface: `ICANFDApi`** **Read Operations (all async, return `Task`):** - `Task GetUsbTree(string deviceHost, CancellationToken cancellationToken)` - Retrieves USB tree structure. - `Task GetUsbStats(string deviceHost, CancellationToken cancellationToken)` - Retrieves USB statistics. - `Task GetSerial(string deviceHost, CancellationToken cancellationToken)` - Retrieves serial information. - `Task GetLEDs(string deviceHost, CancellationToken cancellationToken)` - Retrieves LED status. - `Task GetClocks(string deviceHost, CancellationToken cancellationToken)` - Retrieves clock information. - `Task GetEventPin(string deviceHost, CancellationToken cancellationToken)` - Retrieves event pin status. - `Task GetCANConfig(string deviceHost, CancellationToken cancellationToken)` - Retrieves CAN configuration. - `Task GetCANInfo(string deviceHost, CancellationToken cancellationToken)` - Retrieves CAN information. - `Task GetCANState(string deviceHost, CancellationToken cancellationToken)` - Retrieves CAN state. - `Task GetCANStats(string deviceHost, CancellationToken cancellationToken)` - Retrieves CAN statistics. - `Task GetBattery(string deviceHost, CancellationToken cancellationToken)` - Retrieves battery status. - `Task GetServices(string deviceHost, CancellationToken cancellationToken)` - Retrieves services information. - `Task GetNtp(string deviceHost, CancellationToken cancellationToken)` - Retrieves NTP configuration. - `Task GetPower(string deviceHost, CancellationToken cancellationToken)` - Retrieves power status. - `Task GetDeviceInfo(string deviceHost, CancellationToken cancellationToken)` - Retrieves device information. - `Task GetRecording(string deviceHost, CancellationToken cancellationToken)` - Retrieves recording status. - `Task GetNetwork(string deviceHost, CancellationToken cancellationToken)` - Retrieves network configuration. **Write Operations (all async):** - `Task SetSerial(string deviceHost, SerialRequest serialRequest, CancellationToken cancellationToken)` - Sets serial configuration. - `Task SetLEDs(string deviceHost, LedName led, LedCmd cmd, LedColor color, CancellationToken cancellationToken)` - Controls LED state. - `Task SetClocks(string deviceHost, DateTime dateTime, CancellationToken cancellationToken)` - Sets device clock. - `Task SetEventPinArm(string deviceHost, CancellationToken cancellationToken)` - Arms the event pin. - `Task SetEventPinDisarm(string deviceHost, CancellationToken cancellationToken)` - Disarms the event pin. - `Task SyncClocks(string deviceHost, CancellationToken cancellationToken)` - Synchronizes clocks. - `Task SetCANConfig(string deviceHost, CANConfigRequest canConfigRequest, CancellationToken cancellationToken)` - Sets CAN configuration. - `Task SetPowerOff(string deviceHost, CancellationToken cancellationToken)` - Powers off the device. - `Task SetPowerReboot(string deviceHost, CancellationToken cancellationToken)` - Reboots the device. - `Task SetRecordingStart(string deviceHost, CancellationToken cancellationToken)` - Starts recording. - `Task SetRecordingStop(string deviceHost, CancellationToken cancellationToken)` - Stops recording. - `Task SetNetwork(string deviceHost, NetworkRequest networkRequest, CancellationToken cancellationToken)` - Sets network configuration. **File Operations:** - `Task Download(string deviceHost, string usbPath, string destinationDirectory, TimeSpan timeOut, CancellationToken cancellationToken)` - Downloads a file from device. - `Task Upload(string deviceHost, string uploadUsbPath, string sourcefile, TimeSpan timeOut, CancellationToken cancellationToken)` - Uploads a file to device. - `Task Delete(string deviceHost, string usbPath, CancellationToken cancellationToken)` - Deletes a file on device. ### Invariants - All interface methods require a non-null `deviceHost` string (not enforced at interface level, but implied by design). - All operations are cancellable via `CancellationToken`. - All operations are asynchronous and return `Task` or `Task`. ### Dependencies **Depends on:** - `CANFDApiProxy.Messages` - Message types for responses (UsbTreeMessage, SerialMessage, etc.) - `CANFDApiProxy.Requests` - Request types for write operations (SerialRequest, CANConfigRequest, NetworkRequest) - `System`, `System.Threading`, `System.Threading.Tasks` - BCL types **Depended on by:** Implementations of this interface (not present