using RobotNet.VDA5050.Type; namespace RobotNet10.RobotApp.Interfaces; public enum PeripheralButton { Start, Reset, Stop, } public enum SystemState { INIT, PAUSED, IDLE, PROCCESSING, DOCKING, MAINTENANCE, MANUAL, OVERRIDE, CHARGING, ERROR, } public enum StopStateType { EMC, Bumper, FrontProtective, BackProtective, TimProtective, None, } public enum OperationState { Move, Lifting, LiftRotating, None, } public enum RFMode { Maintenance, Override, Default, None } public enum SafetySpeed { Very_Slow, Slow, Normal, Medium, Optimal, Fast, Very_Fast, } public interface IPlcController { event Action? OnPeripheralModeChanged; event Action? OnButtonPressed; event Action? OnStop; event Action? OnSafetySpeedChanged; bool IsReady { get; } bool IsDisconected { get; } OperatingMode PeripheralMode { get; } SafetySpeed SafetySpeed { get; } bool Emergency { get; } bool Bumper { get; } bool LidarFrontProtectField { get; } bool LidarBackProtectField { get; } bool LidarFrontTimProtectField { get; } bool LiftedUp { get; } bool LiftedDown { get; } bool LiftHome { get; } bool LeftMotorReady { get; } bool RightMotorReady { get; } bool LiftMotorReady { get; } bool ButtonStart { get; } bool ButtonStop { get; } bool ButtonReset { get; } bool HasLoad { get; } bool EnabledCharger { get; } bool Charging { get; } bool MutedBase { get; } bool MutedLoad { get; } // Write state tracking (các giá trị đã được ghi xuống PLC) SystemState CurrentSystemState { get; } OperationState CurrentOperationState { get; } RFMode CurrentRFMode { get; } bool SetHorizontalLoadValue { get; } bool SetMutedBaseValue { get; } bool SetMutedLoadValue { get; } bool SetEnableChargerValue { get; } bool SetHasLoadValue { get; } bool SetRFEStopValue { get; } bool SetBatteryLowValue { get; } bool SetLightOnValue { get; } void SetSystemState(SystemState state); void SetOperationState(OperationState state); void SetEnableCharger(bool value); void SetHorizontalLoad(bool value); void SetMutedBase(bool muted); void SetMutedLoad(bool muted); void SetRFMode(RFMode mode); void SetHasLoad(bool hasLoad); void SetRFEStop(bool stop); void SetBatteryLow(bool value); /// Bật/tắt đèn — ghi coil M918 (TCP address 2966). void SetLightOn(bool value); /// Ghi hướng di chuyển xuống PLC: tiến M931, lùi M932; không đi thì cả hai off. void SetDirectionForwardBackward(bool forward, bool backward); /// Ghi M815 Alarm Reset xuống PLC (pulse) — PLC thực hiện alarm reset. void WriteAlarmResetM815(); /// Lift: Homing (pulse coil M933). void LiftHoming(); /// Lift: Điều khiển theo velocity — lên/xuống/dừng (coils M934, M935). void SetLiftVelocity(bool up, bool down); /// Lift: Ghi vị trí đích (internal units: 10000 = 0.01m) và trigger di chuyển (pulse M936). void SetLiftPositionAndGo(int position); Task Start(CancellationToken cancellationToken); void Stop(); }