diff --git a/src/main/java/com/iflytop/gd/app/cmd/DemoCommand.java b/src/main/java/com/iflytop/gd/app/cmd/DemoCommand.java new file mode 100644 index 0000000..93919b4 --- /dev/null +++ b/src/main/java/com/iflytop/gd/app/cmd/DemoCommand.java @@ -0,0 +1,21 @@ +package com.iflytop.gd.app.cmd; + +import com.iflytop.gd.app.core.BaseCommandHandler; +import com.iflytop.gd.app.model.dto.CmdDTO; +import com.iflytop.gd.common.annotation.CommandMapping; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + + +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("demo_command")//业务指令注解 +public class DemoCommand extends BaseCommandHandler { + + @Override + public void handle(CmdDTO cmdDTO) { + log.info("cmdDTO:{}", cmdDTO); + } +} diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStartHeatingCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStartHeatingCommandHandler.java similarity index 68% rename from src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStartHeatingCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStartHeatingCommandHandler.java index 7460410..9950e41 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStartHeatingCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStartHeatingCommandHandler.java @@ -1,12 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; -import com.iflytop.gd.app.service.WebSocketService; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; -import com.iflytop.gd.common.notification.Notification; -import com.iflytop.gd.system.devices.ColdTray; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStartRecycleCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStartRecycleCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStartRecycleCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStartRecycleCommandHandler.java index ebfe368..d40f168 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStartRecycleCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStartRecycleCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStartRefrigerationCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStartRefrigerationCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStartRefrigerationCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStartRefrigerationCommandHandler.java index 9e6c116..ab76de8 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStartRefrigerationCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStartRefrigerationCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStopHeatingCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStopHeatingCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStopHeatingCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStopHeatingCommandHandler.java index c852c02..778cb84 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStopHeatingCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStopHeatingCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStopRecycleCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStopRecycleCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStopRecycleCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStopRecycleCommandHandler.java index c722127..da603ee 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStopRecycleCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStopRecycleCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStopRefrigerationCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStopRefrigerationCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStopRefrigerationCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStopRefrigerationCommandHandler.java index 1813b36..17d4958 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/ColdTrapStopRefrigerationCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/ColdTrapStopRefrigerationCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorLiftDownCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorLiftDownCommandHandler.java similarity index 64% rename from src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorLiftDownCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorLiftDownCommandHandler.java index f397a2f..8b021bd 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorLiftDownCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorLiftDownCommandHandler.java @@ -1,13 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; -import com.iflytop.gd.app.service.WebSocketService; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; -import com.iflytop.gd.common.notification.Notification; -import com.iflytop.gd.system.constants.VelocityUnit; -import com.iflytop.gd.system.devices.StepMotor; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorLiftUpCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorLiftUpCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorLiftUpCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorLiftUpCommandHandler.java index 41a62cf..a3d6fc4 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorLiftUpCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorLiftUpCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorResetCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorResetCommandHandler.java similarity index 80% rename from src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorResetCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorResetCommandHandler.java index f0cc33a..0a50744 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorResetCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorResetCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; /** * 处理拍子抬升电机复位指令 diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorStopCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorStopCommandHandler.java similarity index 80% rename from src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorStopCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorStopCommandHandler.java index 785763b..64bc55a 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/CoverElevatorStopCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/CoverElevatorStopCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; /** * 处理拍子抬升电机停止指令 diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/DoorCloseCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/DoorCloseCommandHandler.java similarity index 79% rename from src/main/java/com/iflytop/gd/debug/services/cmds/DoorCloseCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/DoorCloseCommandHandler.java index 6c8080d..bc7fe5e 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/DoorCloseCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/DoorCloseCommandHandler.java @@ -1,10 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; -import com.iflytop.gd.system.devices.Door; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/DoorOpenCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/DoorOpenCommandHandler.java similarity index 67% rename from src/main/java/com/iflytop/gd/debug/services/cmds/DoorOpenCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/DoorOpenCommandHandler.java index 125840f..d70319e 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/DoorOpenCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/DoorOpenCommandHandler.java @@ -1,12 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; -import com.iflytop.gd.app.service.WebSocketService; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; -import com.iflytop.gd.common.notification.Notification; -import com.iflytop.gd.system.devices.Door; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/DoorStopCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/DoorStopCommandHandler.java similarity index 79% rename from src/main/java/com/iflytop/gd/debug/services/cmds/DoorStopCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/DoorStopCommandHandler.java index c737ea7..56fdf8e 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/DoorStopCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/DoorStopCommandHandler.java @@ -1,10 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; -import com.iflytop.gd.system.devices.Door; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStartCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStartCommandHandler.java similarity index 84% rename from src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStartCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStartCommandHandler.java index 4042e74..5f55f37 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStartCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStartCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStartHeatMaintainingCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStartHeatMaintainingCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStartHeatMaintainingCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStartHeatMaintainingCommandHandler.java index 94c98a7..523ed25 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStartHeatMaintainingCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStartHeatMaintainingCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStopCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStopCommandHandler.java similarity index 84% rename from src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStopCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStopCommandHandler.java index f94a27a..8c0bce5 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStopCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStopCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStopMaintainingCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStopMaintainingCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStopMaintainingCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStopMaintainingCommandHandler.java index 1edc57c..d8eb9cd 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/HeaterStopMaintainingCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/HeaterStopMaintainingCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/HoldingJawCloseCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/HoldingJawCloseCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/HoldingJawCloseCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/HoldingJawCloseCommandHandler.java index 0ccd024..0959ad3 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/HoldingJawCloseCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/HoldingJawCloseCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/HoldingJawOpenCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/HoldingJawOpenCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/HoldingJawOpenCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/HoldingJawOpenCommandHandler.java index fea1549..ea7b28e 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/HoldingJawOpenCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/HoldingJawOpenCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/HoldingJawPauseCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/HoldingJawPauseCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/HoldingJawPauseCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/HoldingJawPauseCommandHandler.java index ae8105c..7ec830d 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/HoldingJawPauseCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/HoldingJawPauseCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidArmResetCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidArmResetCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/LiquidArmResetCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/LiquidArmResetCommandHandler.java index 6d240bf..e8475f8 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidArmResetCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidArmResetCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidArmRotateCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidArmRotateCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/LiquidArmRotateCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/LiquidArmRotateCommandHandler.java index 63cfa07..c3bb30f 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidArmRotateCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidArmRotateCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidArmStopCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidArmStopCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/LiquidArmStopCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/LiquidArmStopCommandHandler.java index f302f37..8892153 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidArmStopCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidArmStopCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpPreEvacuateCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpPreEvacuateCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpPreEvacuateCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpPreEvacuateCommandHandler.java index e3b338b..b907480 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpPreEvacuateCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpPreEvacuateCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpPrefillCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpPrefillCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpPrefillCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpPrefillCommandHandler.java index 7b183ab..bc2e29c 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpPrefillCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpPrefillCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpStartCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpStartCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpStartCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpStartCommandHandler.java index d6cb8b6..03aeb22 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpStartCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpStartCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpStopCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpStopCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpStopCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpStopCommandHandler.java index a246452..0ab86fd 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/LiquidPumpStopCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpStopCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/PalletElevatorLiftDownCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/PalletElevatorLiftDownCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/PalletElevatorLiftDownCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/PalletElevatorLiftDownCommandHandler.java index d6015ff..579d93a 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/PalletElevatorLiftDownCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/PalletElevatorLiftDownCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/PalletElevatorLiftUpCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/PalletElevatorLiftUpCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/PalletElevatorLiftUpCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/PalletElevatorLiftUpCommandHandler.java index b7fcf4b..58301c6 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/PalletElevatorLiftUpCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/PalletElevatorLiftUpCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/PalletElevatorStopCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/PalletElevatorStopCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/PalletElevatorStopCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/PalletElevatorStopCommandHandler.java index c0b29b5..b9e159d 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/PalletElevatorStopCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/PalletElevatorStopCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/ShakerStartCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/ShakerStartCommandHandler.java similarity index 84% rename from src/main/java/com/iflytop/gd/debug/services/cmds/ShakerStartCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/ShakerStartCommandHandler.java index 632f17d..9f874fa 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/ShakerStartCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/ShakerStartCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/ShakerStopCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/ShakerStopCommandHandler.java similarity index 84% rename from src/main/java/com/iflytop/gd/debug/services/cmds/ShakerStopCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/ShakerStopCommandHandler.java index 9d027e2..c96360d 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/ShakerStopCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/ShakerStopCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/TransportationArmMoveCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/TransportationArmMoveCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/TransportationArmMoveCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/TransportationArmMoveCommandHandler.java index 3587661..5577165 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/TransportationArmMoveCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/TransportationArmMoveCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/TransportationArmResetCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/TransportationArmResetCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/TransportationArmResetCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/TransportationArmResetCommandHandler.java index c8acd26..5ae4d51 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/TransportationArmResetCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/TransportationArmResetCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/TransportationArmStopCommandHandler.java b/src/main/java/com/iflytop/gd/app/cmd/debug/TransportationArmStopCommandHandler.java similarity index 85% rename from src/main/java/com/iflytop/gd/debug/services/cmds/TransportationArmStopCommandHandler.java rename to src/main/java/com/iflytop/gd/app/cmd/debug/TransportationArmStopCommandHandler.java index e6bc1d4..60a6569 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/TransportationArmStopCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/TransportationArmStopCommandHandler.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.debug.services.cmds; +package com.iflytop.gd.app.cmd.debug; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/iflytop/gd/app/config/CraftsStateMachineConfig.java b/src/main/java/com/iflytop/gd/app/config/CraftsStateMachineConfig.java index b0fc658..17a980c 100644 --- a/src/main/java/com/iflytop/gd/app/config/CraftsStateMachineConfig.java +++ b/src/main/java/com/iflytop/gd/app/config/CraftsStateMachineConfig.java @@ -1,7 +1,7 @@ package com.iflytop.gd.app.config; -import com.iflytop.gd.app.common.enums.CraftEvents; -import com.iflytop.gd.app.common.enums.CraftStates; +import com.iflytop.gd.common.enums.CraftEvents; +import com.iflytop.gd.common.enums.CraftStates; import org.springframework.context.annotation.Configuration; import org.springframework.statemachine.config.EnableStateMachineFactory; import org.springframework.statemachine.config.StateMachineConfigurerAdapter; diff --git a/src/main/java/com/iflytop/gd/infrastructure/config/MybatisPlusConfig.java b/src/main/java/com/iflytop/gd/app/config/MybatisPlusConfig.java similarity index 97% rename from src/main/java/com/iflytop/gd/infrastructure/config/MybatisPlusConfig.java rename to src/main/java/com/iflytop/gd/app/config/MybatisPlusConfig.java index 53e188c..a474d08 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/config/MybatisPlusConfig.java +++ b/src/main/java/com/iflytop/gd/app/config/MybatisPlusConfig.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.config; +package com.iflytop.gd.app.config; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.core.config.GlobalConfig; diff --git a/src/main/java/com/iflytop/gd/infrastructure/config/SwaggerConfig.java b/src/main/java/com/iflytop/gd/app/config/SwaggerConfig.java similarity index 98% rename from src/main/java/com/iflytop/gd/infrastructure/config/SwaggerConfig.java rename to src/main/java/com/iflytop/gd/app/config/SwaggerConfig.java index 25de415..09706cb 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/config/SwaggerConfig.java +++ b/src/main/java/com/iflytop/gd/app/config/SwaggerConfig.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.config; +package com.iflytop.gd.app.config; import cn.hutool.core.util.ArrayUtil; import io.swagger.v3.oas.models.Components; diff --git a/src/main/java/com/iflytop/gd/infrastructure/config/WebConfig.java b/src/main/java/com/iflytop/gd/app/config/WebConfig.java similarity index 91% rename from src/main/java/com/iflytop/gd/infrastructure/config/WebConfig.java rename to src/main/java/com/iflytop/gd/app/config/WebConfig.java index 05999c1..52cdc05 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/config/WebConfig.java +++ b/src/main/java/com/iflytop/gd/app/config/WebConfig.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.config; +package com.iflytop.gd.app.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; diff --git a/src/main/java/com/iflytop/gd/infrastructure/config/WebSocketConfig.java b/src/main/java/com/iflytop/gd/app/config/WebSocketConfig.java similarity index 88% rename from src/main/java/com/iflytop/gd/infrastructure/config/WebSocketConfig.java rename to src/main/java/com/iflytop/gd/app/config/WebSocketConfig.java index a3a8006..9b9d910 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/config/WebSocketConfig.java +++ b/src/main/java/com/iflytop/gd/app/config/WebSocketConfig.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.config; +package com.iflytop.gd.app.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/com/iflytop/gd/infrastructure/config/WebSocketServer.java b/src/main/java/com/iflytop/gd/app/config/WebSocketServer.java similarity index 96% rename from src/main/java/com/iflytop/gd/infrastructure/config/WebSocketServer.java rename to src/main/java/com/iflytop/gd/app/config/WebSocketServer.java index 9ff39eb..54f2655 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/config/WebSocketServer.java +++ b/src/main/java/com/iflytop/gd/app/config/WebSocketServer.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.config; +package com.iflytop.gd.app.config; import jakarta.websocket.*; import jakarta.websocket.server.ServerEndpoint; diff --git a/src/main/java/com/iflytop/gd/app/controller/AuthController.java b/src/main/java/com/iflytop/gd/app/controller/AuthController.java index acb1acc..83dd60c 100644 --- a/src/main/java/com/iflytop/gd/app/controller/AuthController.java +++ b/src/main/java/com/iflytop/gd/app/controller/AuthController.java @@ -2,11 +2,11 @@ package com.iflytop.gd.app.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.iflytop.gd.app.model.dto.LoginDTO; +import com.iflytop.gd.app.model.entity.User; +import com.iflytop.gd.app.service.UserService; import com.iflytop.gd.common.enums.Deleted; import com.iflytop.gd.common.result.Result; import com.iflytop.gd.common.result.ResultCode; -import com.iflytop.gd.infrastructure.repository.entity.User; -import com.iflytop.gd.infrastructure.repository.service.UserService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; diff --git a/src/main/java/com/iflytop/gd/app/controller/CmdController.java b/src/main/java/com/iflytop/gd/app/controller/CmdController.java index ae70a12..e462bec 100644 --- a/src/main/java/com/iflytop/gd/app/controller/CmdController.java +++ b/src/main/java/com/iflytop/gd/app/controller/CmdController.java @@ -3,7 +3,7 @@ package com.iflytop.gd.app.controller; import com.iflytop.gd.common.cmd.CommandHandler; import com.iflytop.gd.app.core.CommandHandlerRegistry; import com.iflytop.gd.app.model.dto.CmdDTO; -import com.iflytop.gd.app.service.exceptions.UnSupportCommandException; +import com.iflytop.gd.common.exception.UnSupportCommandException; import com.iflytop.gd.common.result.Result; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/com/iflytop/gd/debug/controller/CmdDebugController.java b/src/main/java/com/iflytop/gd/app/controller/CmdDebugController.java similarity index 92% rename from src/main/java/com/iflytop/gd/debug/controller/CmdDebugController.java rename to src/main/java/com/iflytop/gd/app/controller/CmdDebugController.java index 7dc7b95..c37b279 100644 --- a/src/main/java/com/iflytop/gd/debug/controller/CmdDebugController.java +++ b/src/main/java/com/iflytop/gd/app/controller/CmdDebugController.java @@ -1,8 +1,7 @@ -package com.iflytop.gd.debug.controller; +package com.iflytop.gd.app.controller; import com.iflytop.gd.app.model.dto.CmdDTO; -import com.iflytop.gd.app.service.WebSocketService; -import com.iflytop.gd.app.service.exceptions.UnSupportCommandException; +import com.iflytop.gd.common.exception.UnSupportCommandException; import com.iflytop.gd.common.result.Result; import com.iflytop.gd.common.cmd.CommandHandler; import com.iflytop.gd.app.core.CommandHandlerRegistry; diff --git a/src/main/java/com/iflytop/gd/app/controller/OresController.java b/src/main/java/com/iflytop/gd/app/controller/OresController.java index 52b1b4e..90d3fa6 100644 --- a/src/main/java/com/iflytop/gd/app/controller/OresController.java +++ b/src/main/java/com/iflytop/gd/app/controller/OresController.java @@ -3,7 +3,7 @@ package com.iflytop.gd.app.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.iflytop.gd.app.model.entity.Ores; import com.iflytop.gd.app.model.vo.OresCraftsListVO; -import com.iflytop.gd.infrastructure.repository.base.BasePageQuery; +import com.iflytop.gd.common.base.BasePageQuery; import com.iflytop.gd.common.result.PageResult; import com.iflytop.gd.app.service.OresService; import com.iflytop.gd.common.result.Result; diff --git a/src/main/java/com/iflytop/gd/app/controller/SolutionsController.java b/src/main/java/com/iflytop/gd/app/controller/SolutionsController.java index 5e30a40..0c318b0 100644 --- a/src/main/java/com/iflytop/gd/app/controller/SolutionsController.java +++ b/src/main/java/com/iflytop/gd/app/controller/SolutionsController.java @@ -7,7 +7,7 @@ import com.iflytop.gd.app.service.SolutionsService; import com.iflytop.gd.common.result.PageResult; import com.iflytop.gd.common.result.Result; import com.iflytop.gd.common.result.ResultCode; -import com.iflytop.gd.infrastructure.repository.base.BasePageQuery; +import com.iflytop.gd.common.base.BasePageQuery; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/com/iflytop/gd/app/controller/UserController.java b/src/main/java/com/iflytop/gd/app/controller/UserController.java index f2cdf60..0fc5ca8 100644 --- a/src/main/java/com/iflytop/gd/app/controller/UserController.java +++ b/src/main/java/com/iflytop/gd/app/controller/UserController.java @@ -3,12 +3,12 @@ package com.iflytop.gd.app.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.iflytop.gd.infrastructure.repository.base.BasePageQuery; +import com.iflytop.gd.common.base.BasePageQuery; import com.iflytop.gd.common.result.PageResult; import com.iflytop.gd.common.result.Result; import com.iflytop.gd.common.result.ResultCode; -import com.iflytop.gd.infrastructure.repository.entity.User; -import com.iflytop.gd.infrastructure.repository.service.UserService; +import com.iflytop.gd.app.model.entity.User; +import com.iflytop.gd.app.service.UserService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/com/iflytop/gd/app/core/BaseCommandHandler.java b/src/main/java/com/iflytop/gd/app/core/BaseCommandHandler.java index 51a77bf..3087258 100644 --- a/src/main/java/com/iflytop/gd/app/core/BaseCommandHandler.java +++ b/src/main/java/com/iflytop/gd/app/core/BaseCommandHandler.java @@ -4,7 +4,7 @@ package com.iflytop.gd.app.core; import com.iflytop.gd.common.annotation.CheckedRunnable; import com.iflytop.gd.common.cmd.CommandHandler; -import com.iflytop.gd.common.device.CommandFuture; +import com.iflytop.gd.common.cmd.CommandFuture; import com.iflytop.gd.common.utils.LambdaUtil; import java.util.Arrays; diff --git a/src/main/java/com/iflytop/gd/app/core/CommandHandlerRegistry.java b/src/main/java/com/iflytop/gd/app/core/CommandHandlerRegistry.java index 65b78f7..35fa891 100644 --- a/src/main/java/com/iflytop/gd/app/core/CommandHandlerRegistry.java +++ b/src/main/java/com/iflytop/gd/app/core/CommandHandlerRegistry.java @@ -1,6 +1,6 @@ package com.iflytop.gd.app.core; -import com.iflytop.gd.app.service.exceptions.UnSupportCommandException; +import com.iflytop.gd.common.exception.UnSupportCommandException; import com.iflytop.gd.common.annotation.CommandMapping; import com.iflytop.gd.common.cmd.CommandHandler; import io.micrometer.common.lang.NonNull; diff --git a/src/main/java/com/iflytop/gd/app/core/CraftsContext.java b/src/main/java/com/iflytop/gd/app/core/CraftsContext.java index 968f09c..6865d34 100644 --- a/src/main/java/com/iflytop/gd/app/core/CraftsContext.java +++ b/src/main/java/com/iflytop/gd/app/core/CraftsContext.java @@ -1,8 +1,8 @@ package com.iflytop.gd.app.core; import cn.hutool.json.JSONUtil; -import com.iflytop.gd.app.common.enums.CraftEvents; -import com.iflytop.gd.app.common.enums.CraftStates; +import com.iflytop.gd.common.enums.CraftEvents; +import com.iflytop.gd.common.enums.CraftStates; import com.iflytop.gd.app.model.bo.CraftsStep; import com.iflytop.gd.app.model.entity.Crafts; import com.iflytop.gd.app.model.entity.Ores; diff --git a/src/main/java/com/iflytop/gd/infrastructure/repository/mapper/UserMapper.java b/src/main/java/com/iflytop/gd/app/mapper/UserMapper.java similarity index 63% rename from src/main/java/com/iflytop/gd/infrastructure/repository/mapper/UserMapper.java rename to src/main/java/com/iflytop/gd/app/mapper/UserMapper.java index 718a3e4..52e030d 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/repository/mapper/UserMapper.java +++ b/src/main/java/com/iflytop/gd/app/mapper/UserMapper.java @@ -1,7 +1,7 @@ -package com.iflytop.gd.infrastructure.repository.mapper; +package com.iflytop.gd.app.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.iflytop.gd.infrastructure.repository.entity.User; +import com.iflytop.gd.app.model.entity.User; import org.apache.ibatis.annotations.Mapper; /** diff --git a/src/main/java/com/iflytop/gd/common/notification/Notification.java b/src/main/java/com/iflytop/gd/app/model/bo/Notification.java similarity index 98% rename from src/main/java/com/iflytop/gd/common/notification/Notification.java rename to src/main/java/com/iflytop/gd/app/model/bo/Notification.java index 82f3b0d..5504949 100644 --- a/src/main/java/com/iflytop/gd/common/notification/Notification.java +++ b/src/main/java/com/iflytop/gd/app/model/bo/Notification.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.common.notification; +package com.iflytop.gd.app.model.bo; import cn.hutool.core.date.DateTime; import com.iflytop.gd.app.model.dto.CmdDTO; diff --git a/src/main/java/com/iflytop/gd/system/models/Point3D.java b/src/main/java/com/iflytop/gd/app/model/bo/Point3D.java similarity index 90% rename from src/main/java/com/iflytop/gd/system/models/Point3D.java rename to src/main/java/com/iflytop/gd/app/model/bo/Point3D.java index 0cb6470..7ab4aa7 100644 --- a/src/main/java/com/iflytop/gd/system/models/Point3D.java +++ b/src/main/java/com/iflytop/gd/app/model/bo/Point3D.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.system.models; +package com.iflytop.gd.app.model.bo; import lombok.Getter; diff --git a/src/main/java/com/iflytop/gd/app/model/entity/Container.java b/src/main/java/com/iflytop/gd/app/model/entity/Container.java index 4bf4d1e..892d4e3 100644 --- a/src/main/java/com/iflytop/gd/app/model/entity/Container.java +++ b/src/main/java/com/iflytop/gd/app/model/entity/Container.java @@ -1,7 +1,7 @@ package com.iflytop.gd.app.model.entity; import com.baomidou.mybatisplus.annotation.TableName; -import com.iflytop.gd.infrastructure.repository.base.BaseEntity; +import com.iflytop.gd.common.base.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.*; import lombok.Data; diff --git a/src/main/java/com/iflytop/gd/app/model/entity/Crafts.java b/src/main/java/com/iflytop/gd/app/model/entity/Crafts.java index b51a4b4..730639b 100644 --- a/src/main/java/com/iflytop/gd/app/model/entity/Crafts.java +++ b/src/main/java/com/iflytop/gd/app/model/entity/Crafts.java @@ -1,7 +1,7 @@ package com.iflytop.gd.app.model.entity; import com.baomidou.mybatisplus.annotation.TableName; -import com.iflytop.gd.infrastructure.repository.base.BaseEntity; +import com.iflytop.gd.common.base.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; diff --git a/src/main/java/com/iflytop/gd/app/model/entity/DeviceParamConfig.java b/src/main/java/com/iflytop/gd/app/model/entity/DeviceParamConfig.java index 53b1804..9856f00 100644 --- a/src/main/java/com/iflytop/gd/app/model/entity/DeviceParamConfig.java +++ b/src/main/java/com/iflytop/gd/app/model/entity/DeviceParamConfig.java @@ -1,7 +1,7 @@ package com.iflytop.gd.app.model.entity; import com.baomidou.mybatisplus.annotation.TableName; -import com.iflytop.gd.infrastructure.repository.base.BaseEntity; +import com.iflytop.gd.common.base.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; diff --git a/src/main/java/com/iflytop/gd/app/model/entity/Ores.java b/src/main/java/com/iflytop/gd/app/model/entity/Ores.java index 18698a6..cfd3948 100644 --- a/src/main/java/com/iflytop/gd/app/model/entity/Ores.java +++ b/src/main/java/com/iflytop/gd/app/model/entity/Ores.java @@ -1,9 +1,8 @@ package com.iflytop.gd.app.model.entity; import com.baomidou.mybatisplus.annotation.TableName; -import com.iflytop.gd.infrastructure.repository.base.BaseEntity; +import com.iflytop.gd.common.base.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/src/main/java/com/iflytop/gd/app/model/entity/Solutions.java b/src/main/java/com/iflytop/gd/app/model/entity/Solutions.java index 00de4e7..464127e 100644 --- a/src/main/java/com/iflytop/gd/app/model/entity/Solutions.java +++ b/src/main/java/com/iflytop/gd/app/model/entity/Solutions.java @@ -1,9 +1,8 @@ package com.iflytop.gd.app.model.entity; import com.baomidou.mybatisplus.annotation.TableName; -import com.iflytop.gd.infrastructure.repository.base.BaseEntity; +import com.iflytop.gd.common.base.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/src/main/java/com/iflytop/gd/app/model/entity/SystemConfig.java b/src/main/java/com/iflytop/gd/app/model/entity/SystemConfig.java index 50ea070..8c7f204 100644 --- a/src/main/java/com/iflytop/gd/app/model/entity/SystemConfig.java +++ b/src/main/java/com/iflytop/gd/app/model/entity/SystemConfig.java @@ -1,7 +1,7 @@ package com.iflytop.gd.app.model.entity; import com.baomidou.mybatisplus.annotation.TableName; -import com.iflytop.gd.infrastructure.repository.base.BaseEntity; +import com.iflytop.gd.common.base.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; diff --git a/src/main/java/com/iflytop/gd/infrastructure/repository/entity/User.java b/src/main/java/com/iflytop/gd/app/model/entity/User.java similarity index 85% rename from src/main/java/com/iflytop/gd/infrastructure/repository/entity/User.java rename to src/main/java/com/iflytop/gd/app/model/entity/User.java index 49db9cc..d06733e 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/repository/entity/User.java +++ b/src/main/java/com/iflytop/gd/app/model/entity/User.java @@ -1,12 +1,11 @@ -package com.iflytop.gd.infrastructure.repository.entity; +package com.iflytop.gd.app.model.entity; import com.baomidou.mybatisplus.annotation.TableName; -import com.iflytop.gd.infrastructure.repository.base.BaseEntity; +import com.iflytop.gd.common.base.BaseEntity; import com.iflytop.gd.common.enums.Deleted; import com.iflytop.gd.common.enums.FixedUser; import com.iflytop.gd.common.enums.UsrRole; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/src/main/java/com/iflytop/gd/app/model/vo/CraftStatusVO.java b/src/main/java/com/iflytop/gd/app/model/vo/CraftStatusVO.java index 58db65a..f028f9a 100644 --- a/src/main/java/com/iflytop/gd/app/model/vo/CraftStatusVO.java +++ b/src/main/java/com/iflytop/gd/app/model/vo/CraftStatusVO.java @@ -1,6 +1,6 @@ package com.iflytop.gd.app.model.vo; -import com.iflytop.gd.app.common.enums.CraftStates; +import com.iflytop.gd.common.enums.CraftStates; import com.iflytop.gd.app.model.bo.CraftsStep; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/src/main/java/com/iflytop/gd/app/service/CraftsService.java b/src/main/java/com/iflytop/gd/app/service/CraftsService.java index 8050e62..1101eb3 100644 --- a/src/main/java/com/iflytop/gd/app/service/CraftsService.java +++ b/src/main/java/com/iflytop/gd/app/service/CraftsService.java @@ -2,8 +2,8 @@ package com.iflytop.gd.app.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.iflytop.gd.app.common.enums.CraftEvents; -import com.iflytop.gd.app.common.enums.CraftStates; +import com.iflytop.gd.common.enums.CraftEvents; +import com.iflytop.gd.common.enums.CraftStates; import com.iflytop.gd.app.core.CraftsContext; import com.iflytop.gd.app.mapper.CraftsMapper; import com.iflytop.gd.app.model.entity.Crafts; diff --git a/src/main/java/com/iflytop/gd/app/service/DeviceParamConfigService.java b/src/main/java/com/iflytop/gd/app/service/DeviceParamConfigService.java index 25c4a05..a9bc8c9 100644 --- a/src/main/java/com/iflytop/gd/app/service/DeviceParamConfigService.java +++ b/src/main/java/com/iflytop/gd/app/service/DeviceParamConfigService.java @@ -7,8 +7,8 @@ import com.iflytop.gd.app.model.entity.DeviceParamConfig; import com.iflytop.gd.app.model.vo.DeviceParamGroupVO; import com.iflytop.gd.app.model.vo.ModuleIdVO; import com.iflytop.gd.app.model.vo.RegIndexVO; -import com.iflytop.gd.infrastructure.drivers.ModuleId; -import com.iflytop.gd.infrastructure.drivers.RegIndex; +import com.iflytop.gd.hardware.drivers.ModuleId; +import com.iflytop.gd.hardware.drivers.RegIndex; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/iflytop/gd/app/service/OresService.java b/src/main/java/com/iflytop/gd/app/service/OresService.java index 2593cd4..86c9c68 100644 --- a/src/main/java/com/iflytop/gd/app/service/OresService.java +++ b/src/main/java/com/iflytop/gd/app/service/OresService.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.iflytop.gd.app.model.vo.OresCraftsListVO; -import com.iflytop.gd.infrastructure.repository.base.BasePageQuery; +import com.iflytop.gd.common.base.BasePageQuery; import com.iflytop.gd.app.mapper.CraftsMapper; import com.iflytop.gd.app.mapper.OresMapper; import com.iflytop.gd.app.model.entity.Crafts; diff --git a/src/main/java/com/iflytop/gd/infrastructure/repository/service/UserService.java b/src/main/java/com/iflytop/gd/app/service/UserService.java similarity index 81% rename from src/main/java/com/iflytop/gd/infrastructure/repository/service/UserService.java rename to src/main/java/com/iflytop/gd/app/service/UserService.java index 0682ed5..afd8b03 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/repository/service/UserService.java +++ b/src/main/java/com/iflytop/gd/app/service/UserService.java @@ -1,9 +1,9 @@ -package com.iflytop.gd.infrastructure.repository.service; +package com.iflytop.gd.app.service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.iflytop.gd.common.enums.FixedUser; -import com.iflytop.gd.infrastructure.repository.mapper.UserMapper; -import com.iflytop.gd.infrastructure.repository.entity.User; +import com.iflytop.gd.app.mapper.UserMapper; +import com.iflytop.gd.app.model.entity.User; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; @@ -11,7 +11,6 @@ import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; /** * 用户业务实现类 diff --git a/src/main/java/com/iflytop/gd/app/service/WebSocketService.java b/src/main/java/com/iflytop/gd/app/service/WebSocketService.java index 9516794..34ab279 100644 --- a/src/main/java/com/iflytop/gd/app/service/WebSocketService.java +++ b/src/main/java/com/iflytop/gd/app/service/WebSocketService.java @@ -1,8 +1,8 @@ package com.iflytop.gd.app.service; import cn.hutool.json.JSONUtil; -import com.iflytop.gd.common.notification.Notification; -import com.iflytop.gd.infrastructure.config.WebSocketServer; +import com.iflytop.gd.app.model.bo.Notification; +import com.iflytop.gd.app.config.WebSocketServer; import com.iflytop.gd.app.model.dto.WebsocketResult; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/iflytop/gd/app/service/cmd/DemoCommand.java b/src/main/java/com/iflytop/gd/app/service/cmd/DemoCommand.java deleted file mode 100644 index 48b0a8c..0000000 --- a/src/main/java/com/iflytop/gd/app/service/cmd/DemoCommand.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.iflytop.gd.app.service.cmd; - -import com.iflytop.gd.app.core.BaseCommandHandler; -import com.iflytop.gd.app.model.dto.CmdDTO; -import com.iflytop.gd.common.annotation.CommandMapping; -import com.iflytop.gd.common.cmd.CommandHandler; -import com.iflytop.gd.common.device.CommandFuture; -import com.iflytop.gd.common.device.DeviceCommand; -import com.iflytop.gd.common.device.DeviceCommandGenerator; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - - -@Slf4j -@Component -@RequiredArgsConstructor -@CommandMapping("demo_command")//业务指令注解 -public class DemoCommand extends BaseCommandHandler { - - @Override - public void handle(CmdDTO cmdDTO) { - log.info("cmdDTO:{}", cmdDTO); - - //XYZ回原点 - DeviceCommand motorXOriginCommand = DeviceCommandGenerator.motorXOrigin(); - DeviceCommand motorYOriginCommand = DeviceCommandGenerator.motorYOrigin(); - DeviceCommand motorZOriginCommand = DeviceCommandGenerator.motorZOrigin(); - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/repository/base/BaseEntity.java b/src/main/java/com/iflytop/gd/common/base/BaseEntity.java similarity index 95% rename from src/main/java/com/iflytop/gd/infrastructure/repository/base/BaseEntity.java rename to src/main/java/com/iflytop/gd/common/base/BaseEntity.java index 1e73461..717a1cb 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/repository/base/BaseEntity.java +++ b/src/main/java/com/iflytop/gd/common/base/BaseEntity.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.repository.base; +package com.iflytop.gd.common.base; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; diff --git a/src/main/java/com/iflytop/gd/infrastructure/repository/base/BasePageQuery.java b/src/main/java/com/iflytop/gd/common/base/BasePageQuery.java similarity index 91% rename from src/main/java/com/iflytop/gd/infrastructure/repository/base/BasePageQuery.java rename to src/main/java/com/iflytop/gd/common/base/BasePageQuery.java index 0661b0e..b16bbd3 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/repository/base/BasePageQuery.java +++ b/src/main/java/com/iflytop/gd/common/base/BasePageQuery.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.repository.base; +package com.iflytop.gd.common.base; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/src/main/java/com/iflytop/gd/infrastructure/repository/base/IBaseEnum.java b/src/main/java/com/iflytop/gd/common/base/IBaseEnum.java similarity index 97% rename from src/main/java/com/iflytop/gd/infrastructure/repository/base/IBaseEnum.java rename to src/main/java/com/iflytop/gd/common/base/IBaseEnum.java index 3da4bad..5c26744 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/repository/base/IBaseEnum.java +++ b/src/main/java/com/iflytop/gd/common/base/IBaseEnum.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.repository.base; +package com.iflytop.gd.common.base; import cn.hutool.core.util.ObjectUtil; diff --git a/src/main/java/com/iflytop/gd/common/device/CommandFuture.java b/src/main/java/com/iflytop/gd/common/cmd/CommandFuture.java similarity index 96% rename from src/main/java/com/iflytop/gd/common/device/CommandFuture.java rename to src/main/java/com/iflytop/gd/common/cmd/CommandFuture.java index c3154c1..7c81029 100644 --- a/src/main/java/com/iflytop/gd/common/device/CommandFuture.java +++ b/src/main/java/com/iflytop/gd/common/cmd/CommandFuture.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.common.device; +package com.iflytop.gd.common.cmd; import cn.hutool.json.JSONObject; import lombok.Getter; diff --git a/src/main/java/com/iflytop/gd/common/device/CyclicNumberGenerator.java b/src/main/java/com/iflytop/gd/common/cmd/CyclicNumberGenerator.java similarity index 96% rename from src/main/java/com/iflytop/gd/common/device/CyclicNumberGenerator.java rename to src/main/java/com/iflytop/gd/common/cmd/CyclicNumberGenerator.java index da0d2b8..2320bdd 100644 --- a/src/main/java/com/iflytop/gd/common/device/CyclicNumberGenerator.java +++ b/src/main/java/com/iflytop/gd/common/cmd/CyclicNumberGenerator.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.common.device; +package com.iflytop.gd.common.cmd; public class CyclicNumberGenerator { // 饿汉式单例,在类加载时就创建实例 diff --git a/src/main/java/com/iflytop/gd/common/device/DeviceCommand.java b/src/main/java/com/iflytop/gd/common/cmd/DeviceCommand.java similarity index 92% rename from src/main/java/com/iflytop/gd/common/device/DeviceCommand.java rename to src/main/java/com/iflytop/gd/common/cmd/DeviceCommand.java index 12d9c2d..c50aa50 100644 --- a/src/main/java/com/iflytop/gd/common/device/DeviceCommand.java +++ b/src/main/java/com/iflytop/gd/common/cmd/DeviceCommand.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.common.device; +package com.iflytop.gd.common.cmd; import lombok.Data; diff --git a/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java b/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java new file mode 100644 index 0000000..45ebc0a --- /dev/null +++ b/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java @@ -0,0 +1,24 @@ +package com.iflytop.gd.common.cmd; + + +import java.util.Map; + +/** + * 生成给设备发送的指令 + */ +public class DeviceCommandGenerator { + + /** + * 设备指令包装 + */ + private static DeviceCommand deviceCmd(String code, String device, String action, Map params, String commandName) { + DeviceCommand cmdToDevice = new DeviceCommand(); + cmdToDevice.setCmdCode(code); + cmdToDevice.setDevice(device); + cmdToDevice.setAction(action); + cmdToDevice.setParam(params); + cmdToDevice.setCmdName(commandName); + return cmdToDevice; + } +} + diff --git a/src/main/java/com/iflytop/gd/common/controller/BaseCmdController.java b/src/main/java/com/iflytop/gd/common/controller/BaseCmdController.java deleted file mode 100644 index 3bf7d96..0000000 --- a/src/main/java/com/iflytop/gd/common/controller/BaseCmdController.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.iflytop.gd.common.controller; - -public class BaseCmdController { -} diff --git a/src/main/java/com/iflytop/gd/common/controller/NotificationWebsocketEndpoint.java b/src/main/java/com/iflytop/gd/common/controller/NotificationWebsocketEndpoint.java deleted file mode 100644 index e2979c3..0000000 --- a/src/main/java/com/iflytop/gd/common/controller/NotificationWebsocketEndpoint.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.iflytop.gd.common.controller; - -import com.iflytop.gd.infrastructure.modules.WebSocketNotificationPushMgrImpl; -import jakarta.annotation.Resource; -import jakarta.websocket.EndpointConfig; -import jakarta.websocket.OnOpen; -import jakarta.websocket.Session; -import jakarta.websocket.server.ServerEndpoint; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -@ServerEndpoint(value = "/api/v1/ws/notifications") -@Slf4j -@Component -public class NotificationWebsocketEndpoint { - - @Resource - private WebSocketNotificationPushMgrImpl notificationMgr; - - @OnOpen - public void onOpen(Session session, EndpointConfig endpointConfig) { - // 保存 session 到对象 - this.notificationMgr.addSession(session); - log.info("[websocket] 新的连接:id={}", session.getId()); - } -} diff --git a/src/main/java/com/iflytop/gd/common/device/DeviceCommandGenerator.java b/src/main/java/com/iflytop/gd/common/device/DeviceCommandGenerator.java deleted file mode 100644 index 61b0ca5..0000000 --- a/src/main/java/com/iflytop/gd/common/device/DeviceCommandGenerator.java +++ /dev/null @@ -1,501 +0,0 @@ -package com.iflytop.gd.common.device; - - -import java.util.HashMap; -import java.util.Map; - -/** - * 生成给设备发送的指令 - */ -public class DeviceCommandGenerator { - - /** - * 全部关闭三通阀 - */ - public static DeviceCommand threeWayValveCloseAll() { - // 上层方法直接取方法注释“全部关闭三通阀” - return threeWayValveControl("close_all", "全部关闭三通阀"); - } - - /** - * 打开三通阀喷嘴管路 - */ - public static DeviceCommand threeWayValveOpenSyringePipeline() { - return threeWayValveControl("open_syringe", "打开三通阀喷嘴管路"); - } - - /** - * 打开三通阀注射器管路 - */ - public static DeviceCommand threeWayValveOpenNozzlePipeline() { - return threeWayValveControl("open_nozzle", "打开三通阀注射器管路"); - } - - /** - * 控制三通阀 - */ - public static DeviceCommand threeWayValveControl(String action, String commandName) { - // 调用中层 controlCmd 时,直接用方法注释固定描述"控制三通阀" - return controlCmd("three_way_valve", action, null, commandName != null ? commandName : "控制三通阀"); - } - - /** - * 关闭清洗阀 - */ - public static DeviceCommand washValveClose() { - return washValveControl("close", "关闭清洗阀"); - } - - /** - * 开启清洗阀 - */ - public static DeviceCommand washValveOpen() { - return washValveControl("open", "开启清洗阀"); - } - - /** - * 控制清洗阀 - */ - public static DeviceCommand washValveControl(String action, String commandName) { - return controlCmd("wash_valve", action, null, commandName != null ? commandName : "控制清洗阀"); - } - - /** - * 关闭喷嘴阀 - */ - public static DeviceCommand nozzleValveClose() { - return nozzleValveControl("close", "关闭喷嘴阀"); - } - - /** - * 开启喷嘴阀 - */ - public static DeviceCommand nozzleValveOpen() { - return nozzleValveControl("open", "开启喷嘴阀"); - } - - /** - * 控制喷嘴阀 - */ - public static DeviceCommand nozzleValveControl(String action, String commandName) { - return controlCmd("nozzle_valve", action, null, commandName != null ? commandName : "控制喷嘴阀"); - } - - /** - * 关闭除湿阀 - */ - public static DeviceCommand dehumidifierValveClose() { - return dehumidifierValveControl("close", "关闭除湿阀"); - } - - /** - * 开启除湿阀 - */ - public static DeviceCommand dehumidifierValveOpen() { - return dehumidifierValveControl("open", "开启除湿阀"); - } - - /** - * 控制除湿阀 - */ - public static DeviceCommand dehumidifierValveControl(String action, String commandName) { - return controlCmd("dehumidifier_valve", action, null, commandName != null ? commandName : "控制除湿阀"); - } - - /** - * 关闭照明灯板 - */ - public static DeviceCommand lightingPanelClose() { - return controlCmd("lighting_panel", "close", null, "关闭照明灯板"); - } - - /** - * 打开照明灯板 - */ - public static DeviceCommand lightingPanelOpen() { - return controlCmd("lighting_panel", "open", null, "打开照明灯板"); - } - - /** - * 控制照明灯板 - */ - public static DeviceCommand lightingPanelControl(String action, String commandName) { - return controlCmd("lighting_panel", action, null, commandName != null ? commandName : "控制照明灯板"); - } - - /** - * 关闭激光 - */ - public static DeviceCommand laserControlClose() { - return laserControl("close", null); - } - - /** - * 打开激光 - * - * @param power 功率[0-100] - */ - public static DeviceCommand laserControlOpen(Double power) { - return laserControl("open", power); - } - - /** - * 控制激光 - * - * @param power 功率[0-100] - */ - public static DeviceCommand laserControl(String action, Double power) { - Map params = new HashMap<>(); - params.put("power", power); - return controlCmd("laser", action, params, "控制激光"); - } - - /** - * 关闭高压 - */ - public static DeviceCommand highVoltageClose() { - return highVoltageControl("close", null); - } - - /** - * 开启高压 - */ - public static DeviceCommand highVoltageOpen(Double voltage) { - return highVoltageControl("open", voltage); - } - - /** - * 控制高压 - */ - public static DeviceCommand highVoltageControl(String action, Double voltage) { - Map params = new HashMap<>(); - params.put("voltage", voltage); - return controlCmd("high_voltage", action, params, "控制高压"); - } - - /** - * 停止推动注射泵 - */ - public static DeviceCommand syringePumpStop() { - return controlCmd("syringe_pump", "stop", null, "停止推动注射泵"); - } - - /** - * 推动移动注射泵 - * - * @param speed 是指注射泵每分钟注射多少微升(volume 最低0.1) - */ - public static DeviceCommand syringePumpStart(String direction, Double speed) { - Map params = new HashMap<>(); - params.put("direction", direction); - params.put("speed", speed); - return controlCmd("syringe_pump", "move", params, "推动移动注射泵"); - } - - /** - * 推动移动注射泵 - * - * @param speed 是指注射泵每分钟注射多少微升(volume 最低0.1) - */ - public static DeviceCommand syringePumpForward(Double speed) { - Map params = new HashMap<>(); - params.put("direction", "forward"); - params.put("speed", speed); - return controlCmd("syringe_pump", "move", params, "推动移动注射泵"); - } - - /** - * 注射泵流速设置 - */ - public static DeviceCommand syringePumpVolumeSet(Double speed) { - Map params = new HashMap<>(); - params.put("speed", speed); - return controlCmd("syringe_pump", "set", params, "注射泵流速设置"); - } - - /** - * 控制注射泵 - */ - public static DeviceCommand syringePumpControl(String action, String forward, Double volume) { - Map params = new HashMap<>(); - params.put("current", forward); - params.put("volume", volume); - return controlCmd("syringe_pump", action, params, "控制注射泵"); - } - - /** - * 获取设备当前湿度 - */ - public static DeviceCommand humidityGet() { - return getInfoCmd("humidity", "获取设备当前湿度"); - } - - /** - * 获取设备当前温度 - */ - public static DeviceCommand temperatureGet() { - return getInfoCmd("temperature", "获取设备当前温度"); - } - - /** - * 推入玻片托盘 - */ - public static DeviceCommand slideTrayIn(Double position, Double speed) { - return motorYPositionSet(position, speed, "推入玻片托盘"); - } - - /** - * 推出玻片托盘 - */ - public static DeviceCommand slideTrayOut(Double position, Double speed) { - return motorYPositionSet(position, speed, "推出玻片托盘"); - } - - /** - * 获得电机XYZ相对原点坐标 - */ - public static DeviceCommand motorXyzPositionGet() { - return getInfoCmd("xyz", "获得电机XYZ相对原点坐标"); - } - - /** - * x轴停止移动 - */ - public static DeviceCommand motorXStop() { - return controlMotorCmd("x", "stop", null, null, null, null, "x轴停止移动"); - } - - /** - * y轴停止移动 - */ - public static DeviceCommand motorYStop() { - return controlMotorCmd("y", "stop", null, null, null, null, "y轴停止移动"); - } - - /** - * z轴停止移动 - */ - public static DeviceCommand motorZStop() { - return controlMotorCmd("z", "stop", null, null, null, null, "z轴停止移动"); - } - - /** - * x轴回原点 - */ - public static DeviceCommand motorXOrigin() { - return controlMotorCmd("x", "origin", null, null, null, null, "x轴回原点"); - } - - /** - * y轴回原点 - */ - public static DeviceCommand motorYOrigin() { - return controlMotorCmd("y", "origin", null, null, null, null, "y轴回原点"); - } - - /** - * z轴回原点 - */ - public static DeviceCommand motorZOrigin() { - return controlMotorCmd("z", "origin", null, null, null, null, "z轴回原点"); - } - - /** - * 移动x轴到指定位置 - */ - public static DeviceCommand motorXPositionSet(Double position) { - return motorXPositionSet(position, null, "移动x轴到指定位置"); - } - - /** - * 移动y轴到指定位置 - */ - public static DeviceCommand motorYPositionSet(Double position) { - return motorYPositionSet(position, null, "移动y轴到指定位置"); - } - - /** - * 移动z轴到指定位置 - */ - public static DeviceCommand motorZPositionSet(Double position) { - return motorZPositionSet(position, null, "移动z轴到指定位置"); - } - - /** - * 移动x轴到指定位置 - */ - public static DeviceCommand motorXPositionSet(Double position, Double speed) { - return motorXPositionSet(position, speed, "移动x轴到指定位置"); - } - - /** - * 移动y轴到指定位置 - */ - public static DeviceCommand motorYPositionSet(Double position, Double speed) { - return motorYPositionSet(position, speed, "移动y轴到指定位置"); - } - - /** - * 移动z轴到指定位置 - */ - public static DeviceCommand motorZPositionSet(Double position, Double speed) { - return motorZPositionSet(position, speed, "移动z轴到指定位置"); - } - - /** - * 移动x轴到指定位置 - */ - private static DeviceCommand motorXPositionSet(Double position, Double speed, String commandName) { - return controlMotorCmd("x", "move", null, "forward", position, speed, commandName); - } - - /** - * 移动y轴到指定位置 - */ - private static DeviceCommand motorYPositionSet(Double position, Double speed, String commandName) { - return controlMotorCmd("y", "move", null, "forward", position, speed, commandName); - } - - /** - * 移动z轴到指定位置 - */ - private static DeviceCommand motorZPositionSet(Double position, Double speed, String commandName) { - return controlMotorCmd("z", "move", null, "forward", position, speed, commandName); - } - - /** - * x电机方向设置 - */ - public static DeviceCommand motorXDirectionSet(String direction) { - return controlMotorCmd("x", "set", null, direction, null, null, "x电机方向设置"); - } - - /** - * y电机方向设置 - */ - public static DeviceCommand motorYDirectionSet(String direction) { - return controlMotorCmd("y", "set", null, direction, null, null, "y电机方向设置"); - } - - /** - * z电机方向设置 - */ - public static DeviceCommand motorZDirectionSet(String direction) { - return controlMotorCmd("z", "set", null, direction, null, null, "z电机方向设置"); - } - - /** - * x轴电机电流设置 - */ - public static DeviceCommand motorXCurrentSet(Double current) { - return controlMotorCmd("x", "set", current, null, null, null, "x轴电机电流设置"); - } - - /** - * y轴电机电流设置 - */ - public static DeviceCommand motorYCurrentSet(Double current) { - return controlMotorCmd("y", "set", current, null, null, null, "y轴电机电流设置"); - } - - /** - * z轴电机电流设置 - */ - public static DeviceCommand motorZCurrentSet(Double current) { - return controlMotorCmd("z", "set", current, null, null, null, "z轴电机电流设置"); - } - - /** - * x轴电机速度设置 - */ - public static DeviceCommand motorXSpeedSet(Double speed) { - return controlMotorCmd("x", "set", null, null, null, speed, "x轴电机速度设置"); - } - - /** - * y轴电机速度设置 - */ - public static DeviceCommand motorYSpeedSet(Double speed) { - return controlMotorCmd("y", "set", null, null, null, speed, "y轴电机速度设置"); - } - - /** - * z轴电机速度设置 - */ - public static DeviceCommand motorZSpeedSet(Double speed) { - return controlMotorCmd("z", "set", null, null, null, speed, "z轴电机速度设置"); - } - - /** - * x轴电机控制 - */ - public static DeviceCommand motorX(String action, Double current, String direction, Double position, Double speed) { - return controlMotorCmd("x", action, current, direction, position, speed, "x轴电机控制"); - } - - /** - * y轴电机控制 - */ - public static DeviceCommand motorY(String action, Double current, String direction, Double position, Double speed) { - return controlMotorCmd("y", action, current, direction, position, speed, "y轴电机控制"); - } - - /** - * z轴电机控制 - */ - public static DeviceCommand motorZ(String action, Double current, String direction, Double position, Double speed) { - return controlMotorCmd("z", action, current, direction, position, speed, "z轴电机控制"); - } - - /** - * 控制设备电机 - */ - public static DeviceCommand controlMotorCmd(String device, String action, Double current, String direction, Double position, Double speed, String commandName) { - if (commandName == null) { - commandName = "控制设备电机"; - } - Map params = new HashMap<>(); - params.put("current", current); - params.put("direction", direction); - params.put("position", position); - params.put("speed", speed); - return deviceCmd("controlMotorCmd", device, action, params, commandName); - } - - /** - * 获取设备整体状态 - */ - public static DeviceCommand overallDeviceStatusGet() { - return getInfoCmd("device", "获取设备整体状态"); - } - - /** - * 设备控制指令包装 - */ - private static DeviceCommand controlCmd(String device, String action, Map params, String commandName) { - return deviceCmd("controlCmd", device, action, params, commandName); - } - - /** - * 获取设备信息指令包装 - */ - private static DeviceCommand getInfoCmd(String device, String commandName) { - return deviceCmd("getInfoCmd", device, "get", null, commandName); - } - - /** - * 设备指令包装 - */ - private static DeviceCommand deviceCmd(String code, String device, String action, Map params, String commandName) { -// int cmdId = CyclicNumberGenerator.getInstance().generateNumber(); - DeviceCommand cmdToDevice = new DeviceCommand(); -// cmdToDevice.setCmdId(cmdId); - cmdToDevice.setCmdCode(code); - cmdToDevice.setDevice(device); - cmdToDevice.setAction(action); - cmdToDevice.setParam(params); - cmdToDevice.setCmdName(commandName); - return cmdToDevice; - } -} - diff --git a/src/main/java/com/iflytop/gd/app/common/enums/CraftEvents.java b/src/main/java/com/iflytop/gd/common/enums/CraftEvents.java similarity index 89% rename from src/main/java/com/iflytop/gd/app/common/enums/CraftEvents.java rename to src/main/java/com/iflytop/gd/common/enums/CraftEvents.java index fde3fd2..3b5b403 100644 --- a/src/main/java/com/iflytop/gd/app/common/enums/CraftEvents.java +++ b/src/main/java/com/iflytop/gd/common/enums/CraftEvents.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.app.common.enums; +package com.iflytop.gd.common.enums; /** * 工艺状态机事件枚举 diff --git a/src/main/java/com/iflytop/gd/app/common/enums/CraftStates.java b/src/main/java/com/iflytop/gd/common/enums/CraftStates.java similarity index 90% rename from src/main/java/com/iflytop/gd/app/common/enums/CraftStates.java rename to src/main/java/com/iflytop/gd/common/enums/CraftStates.java index 3cbef12..183d2ed 100644 --- a/src/main/java/com/iflytop/gd/app/common/enums/CraftStates.java +++ b/src/main/java/com/iflytop/gd/common/enums/CraftStates.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.app.common.enums; +package com.iflytop.gd.common.enums; /** * 工艺状态机状态枚举 diff --git a/src/main/java/com/iflytop/gd/system/exceptions/CommandExecTimeoutException.java b/src/main/java/com/iflytop/gd/common/exception/CommandExecTimeoutException.java similarity index 93% rename from src/main/java/com/iflytop/gd/system/exceptions/CommandExecTimeoutException.java rename to src/main/java/com/iflytop/gd/common/exception/CommandExecTimeoutException.java index 8926964..64f50d3 100644 --- a/src/main/java/com/iflytop/gd/system/exceptions/CommandExecTimeoutException.java +++ b/src/main/java/com/iflytop/gd/common/exception/CommandExecTimeoutException.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.system.exceptions; +package com.iflytop.gd.common.exception; public class CommandExecTimeoutException extends Exception{ public CommandExecTimeoutException() { diff --git a/src/main/java/com/iflytop/gd/system/exceptions/HardwareErrorException.java b/src/main/java/com/iflytop/gd/common/exception/HardwareErrorException.java similarity index 93% rename from src/main/java/com/iflytop/gd/system/exceptions/HardwareErrorException.java rename to src/main/java/com/iflytop/gd/common/exception/HardwareErrorException.java index ddbe843..e5d168c 100644 --- a/src/main/java/com/iflytop/gd/system/exceptions/HardwareErrorException.java +++ b/src/main/java/com/iflytop/gd/common/exception/HardwareErrorException.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.system.exceptions; +package com.iflytop.gd.common.exception; public class HardwareErrorException extends Exception{ public HardwareErrorException() { diff --git a/src/main/java/com/iflytop/gd/app/service/exceptions/UnSupportCommandException.java b/src/main/java/com/iflytop/gd/common/exception/UnSupportCommandException.java similarity index 93% rename from src/main/java/com/iflytop/gd/app/service/exceptions/UnSupportCommandException.java rename to src/main/java/com/iflytop/gd/common/exception/UnSupportCommandException.java index 2fabf71..998be6c 100644 --- a/src/main/java/com/iflytop/gd/app/service/exceptions/UnSupportCommandException.java +++ b/src/main/java/com/iflytop/gd/common/exception/UnSupportCommandException.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.app.service.exceptions; +package com.iflytop.gd.common.exception; /** * 不支持的命令异常 diff --git a/src/main/java/com/iflytop/gd/system/utils/ByteArray.java b/src/main/java/com/iflytop/gd/common/utils/ByteArray.java similarity index 98% rename from src/main/java/com/iflytop/gd/system/utils/ByteArray.java rename to src/main/java/com/iflytop/gd/common/utils/ByteArray.java index bb981b5..d363d7a 100644 --- a/src/main/java/com/iflytop/gd/system/utils/ByteArray.java +++ b/src/main/java/com/iflytop/gd/common/utils/ByteArray.java @@ -1,5 +1,5 @@ // Source code is decompiled from a .class file using FernFlower decompiler. -package com.iflytop.gd.system.utils; +package com.iflytop.gd.common.utils; import org.springframework.lang.NonNull; diff --git a/src/main/java/com/iflytop/gd/infrastructure/comm/rs485/driver/d.txt b/src/main/java/com/iflytop/gd/hardware/comm/can/driver/d.txt similarity index 100% rename from src/main/java/com/iflytop/gd/infrastructure/comm/rs485/driver/d.txt rename to src/main/java/com/iflytop/gd/hardware/comm/can/driver/d.txt diff --git a/src/main/java/com/iflytop/gd/infrastructure/comm/rs485/listener/d.txt b/src/main/java/com/iflytop/gd/hardware/comm/can/listener/d.txt similarity index 100% rename from src/main/java/com/iflytop/gd/infrastructure/comm/rs485/listener/d.txt rename to src/main/java/com/iflytop/gd/hardware/comm/can/listener/d.txt diff --git a/src/main/java/com/iflytop/gd/infrastructure/comm/rs485/protocol/d.txt b/src/main/java/com/iflytop/gd/hardware/comm/can/protocol/d.txt similarity index 100% rename from src/main/java/com/iflytop/gd/infrastructure/comm/rs485/protocol/d.txt rename to src/main/java/com/iflytop/gd/hardware/comm/can/protocol/d.txt diff --git a/src/main/java/com/iflytop/gd/infrastructure/comm/can/driver/d.txt b/src/main/java/com/iflytop/gd/hardware/comm/rs485/driver/d.txt similarity index 100% rename from src/main/java/com/iflytop/gd/infrastructure/comm/can/driver/d.txt rename to src/main/java/com/iflytop/gd/hardware/comm/rs485/driver/d.txt diff --git a/src/main/java/com/iflytop/gd/infrastructure/comm/can/listener/d.txt b/src/main/java/com/iflytop/gd/hardware/comm/rs485/listener/d.txt similarity index 100% rename from src/main/java/com/iflytop/gd/infrastructure/comm/can/listener/d.txt rename to src/main/java/com/iflytop/gd/hardware/comm/rs485/listener/d.txt diff --git a/src/main/java/com/iflytop/gd/infrastructure/comm/can/protocol/d.txt b/src/main/java/com/iflytop/gd/hardware/comm/rs485/protocol/d.txt similarity index 100% rename from src/main/java/com/iflytop/gd/infrastructure/comm/can/protocol/d.txt rename to src/main/java/com/iflytop/gd/hardware/comm/rs485/protocol/d.txt diff --git a/src/main/java/com/iflytop/gd/hardware/constants/Dim.java b/src/main/java/com/iflytop/gd/hardware/constants/Dim.java new file mode 100644 index 0000000..cbd586b --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/constants/Dim.java @@ -0,0 +1,5 @@ +package com.iflytop.gd.hardware.constants; + +public enum Dim { + X, Y, Z +} diff --git a/src/main/java/com/iflytop/gd/system/constants/DistanceUnit.java b/src/main/java/com/iflytop/gd/hardware/constants/DistanceUnit.java similarity index 92% rename from src/main/java/com/iflytop/gd/system/constants/DistanceUnit.java rename to src/main/java/com/iflytop/gd/hardware/constants/DistanceUnit.java index f119210..da0f33d 100644 --- a/src/main/java/com/iflytop/gd/system/constants/DistanceUnit.java +++ b/src/main/java/com/iflytop/gd/hardware/constants/DistanceUnit.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.system.constants; +package com.iflytop.gd.hardware.constants; public enum DistanceUnit { MM, CM; diff --git a/src/main/java/com/iflytop/gd/system/constants/LiquidFillArmMotorIndex.java b/src/main/java/com/iflytop/gd/hardware/constants/LiquidFillArmMotorIndex.java similarity index 59% rename from src/main/java/com/iflytop/gd/system/constants/LiquidFillArmMotorIndex.java rename to src/main/java/com/iflytop/gd/hardware/constants/LiquidFillArmMotorIndex.java index 78ba069..693e189 100644 --- a/src/main/java/com/iflytop/gd/system/constants/LiquidFillArmMotorIndex.java +++ b/src/main/java/com/iflytop/gd/hardware/constants/LiquidFillArmMotorIndex.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.system.constants; +package com.iflytop.gd.hardware.constants; public enum LiquidFillArmMotorIndex { LargeArm, SmallArm diff --git a/src/main/java/com/iflytop/gd/system/constants/RotationDirection.java b/src/main/java/com/iflytop/gd/hardware/constants/RotationDirection.java similarity index 84% rename from src/main/java/com/iflytop/gd/system/constants/RotationDirection.java rename to src/main/java/com/iflytop/gd/hardware/constants/RotationDirection.java index f980e17..27c3c6d 100644 --- a/src/main/java/com/iflytop/gd/system/constants/RotationDirection.java +++ b/src/main/java/com/iflytop/gd/hardware/constants/RotationDirection.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.system.constants; +package com.iflytop.gd.hardware.constants; import lombok.Getter; diff --git a/src/main/java/com/iflytop/gd/system/constants/VelocityUnit.java b/src/main/java/com/iflytop/gd/hardware/constants/VelocityUnit.java similarity index 93% rename from src/main/java/com/iflytop/gd/system/constants/VelocityUnit.java rename to src/main/java/com/iflytop/gd/hardware/constants/VelocityUnit.java index f7919a9..46705f6 100644 --- a/src/main/java/com/iflytop/gd/system/constants/VelocityUnit.java +++ b/src/main/java/com/iflytop/gd/hardware/constants/VelocityUnit.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.system.constants; +package com.iflytop.gd.hardware.constants; /** * 移动速度单位 diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalColdTray.java b/src/main/java/com/iflytop/gd/hardware/device/ColdTray.java similarity index 66% rename from src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalColdTray.java rename to src/main/java/com/iflytop/gd/hardware/device/ColdTray.java index f53c01f..6e2edde 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalColdTray.java +++ b/src/main/java/com/iflytop/gd/hardware/device/ColdTray.java @@ -1,42 +1,33 @@ -package com.iflytop.gd.infrastructure.devices.physical; - -import com.iflytop.gd.system.devices.ColdTray; +package com.iflytop.gd.hardware.device; /** * 物理冷阱 */ -public class PhysicalColdTray implements ColdTray { - @Override +public class ColdTray { public boolean setTemperature(Double temperature) { return false; } - @Override public boolean startRecycle() { return false; } - @Override public boolean stopRecycle() { return false; } - @Override public boolean startHeating() { return false; } - @Override public boolean stopHeating() { return false; } - @Override public boolean startRefrigeration() { return false; } - @Override public boolean stopRefrigeration() { return false; } diff --git a/src/main/java/com/iflytop/gd/hardware/device/Door.java b/src/main/java/com/iflytop/gd/hardware/device/Door.java new file mode 100644 index 0000000..478ae9f --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/device/Door.java @@ -0,0 +1,17 @@ +package com.iflytop.gd.hardware.device; + +/** + * 物理门 + */ + +public class Door { + public void open() { + } + + public void close() { + } + + public void stop() { + } + +} diff --git a/src/main/java/com/iflytop/gd/hardware/device/Fan.java b/src/main/java/com/iflytop/gd/hardware/device/Fan.java new file mode 100644 index 0000000..ca09adf --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/device/Fan.java @@ -0,0 +1,13 @@ +package com.iflytop.gd.hardware.device; + +/** + * 物理风扇 + */ +public class Fan { + public boolean open() { + return false; + } + public boolean close() { + return false; + } +} diff --git a/src/main/java/com/iflytop/gd/hardware/device/HoldingJaw.java b/src/main/java/com/iflytop/gd/hardware/device/HoldingJaw.java new file mode 100644 index 0000000..51f5d11 --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/device/HoldingJaw.java @@ -0,0 +1,22 @@ +package com.iflytop.gd.hardware.device; + +/** + * 物理夹爪 + */ +public class HoldingJaw{ + public void open() { + + } + public void close() { + + } + public void pause() { + + } + public void resume() { + + } + public void setSpeed(int speed) { + + } +} diff --git a/src/main/java/com/iflytop/gd/hardware/device/LiquidFillingArm.java b/src/main/java/com/iflytop/gd/hardware/device/LiquidFillingArm.java new file mode 100644 index 0000000..da0ca00 --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/device/LiquidFillingArm.java @@ -0,0 +1,24 @@ +package com.iflytop.gd.hardware.device; + + +import com.iflytop.gd.hardware.constants.LiquidFillArmMotorIndex; +import com.iflytop.gd.hardware.constants.RotationDirection; +import com.iflytop.gd.hardware.constants.VelocityUnit; +import com.iflytop.gd.app.model.bo.Point3D; + +/** + * 物理液体加注机械臂 + */ +public class LiquidFillingArm { + public void moveTo(Point3D point) { + + } + + public void rotateTo(LiquidFillArmMotorIndex liquidFillArmMotorIndex, Integer angle, RotationDirection direction) { + + } + + public void setRotationSpeed(Integer speed, VelocityUnit speedUnit) { + + } +} diff --git a/src/main/java/com/iflytop/gd/hardware/device/Pump.java b/src/main/java/com/iflytop/gd/hardware/device/Pump.java new file mode 100644 index 0000000..404f12a --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/device/Pump.java @@ -0,0 +1,7 @@ +package com.iflytop.gd.hardware.device; + +/** + * 物理泵 + */ +public class Pump { +} diff --git a/src/main/java/com/iflytop/gd/hardware/device/Relay.java b/src/main/java/com/iflytop/gd/hardware/device/Relay.java new file mode 100644 index 0000000..bd9663a --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/device/Relay.java @@ -0,0 +1,13 @@ +package com.iflytop.gd.hardware.device; + +/** + * 物理继电器 + */ +public class Relay{ + public boolean open() { + return false; + } + public boolean close() { + return false; + } +} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalServoMotor.java b/src/main/java/com/iflytop/gd/hardware/device/ServoMotor.java similarity index 62% rename from src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalServoMotor.java rename to src/main/java/com/iflytop/gd/hardware/device/ServoMotor.java index e3d564f..5235455 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalServoMotor.java +++ b/src/main/java/com/iflytop/gd/hardware/device/ServoMotor.java @@ -1,64 +1,52 @@ -package com.iflytop.gd.infrastructure.devices.physical; +package com.iflytop.gd.hardware.device; -import com.iflytop.gd.infrastructure.drivers.RegIndex; -import com.iflytop.gd.system.devices.ServoMotor; +import com.iflytop.gd.hardware.drivers.RegIndex; /** * 物理伺服电机 */ -public class PhysicalServoMotor implements ServoMotor { - @Override +public class ServoMotor { public void enable() { } - @Override public void disable() { } - @Override public void stop() { } - @Override public Integer getCurrentPosition() { return 0; } - @Override public void moveToZero() { } - @Override public void moveTo(Integer position) { } - @Override public void setMaxVelocity(Integer maxVelocity) { } - @Override public void setMaxTorque(Integer maxTorque) { } - @Override public void setProtectiveTorque(Integer protectiveTorque) { } - @Override public Integer readReg(RegIndex regIndex) { return 0; } - @Override public void writeReg(RegIndex regIndex, Integer value) { } diff --git a/src/main/java/com/iflytop/gd/hardware/device/StepMotor.java b/src/main/java/com/iflytop/gd/hardware/device/StepMotor.java new file mode 100644 index 0000000..59936bd --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/device/StepMotor.java @@ -0,0 +1,118 @@ +package com.iflytop.gd.hardware.device; + +import com.iflytop.gd.hardware.drivers.RegIndex; +import com.iflytop.gd.hardware.constants.DistanceUnit; +import com.iflytop.gd.hardware.constants.RotationDirection; + +import java.util.Map; + +/** + * 物理步进电机实现 + */ +public class StepMotor { + public void easyMoveTo(Integer value, DistanceUnit unit) { + } + + public void easyMoveBy(Integer value, DistanceUnit unit) { + } + + public void easyMoveToZero() { + } + + public void easyMoveToZeroPointQuick() { + + } + + public void enable() { + + } + + public void disable() { + + } + + public void moveForward(RotationDirection direction, Integer distance, DistanceUnit unit) { + + } + + public void moveBackward(RotationDirection direction, Integer distance, DistanceUnit unit) { + + } + + public Integer readPosition() { + return 0; + } + + public Integer readEncoderPosition() { + return 0; + } + + public void stop() { + + } + + public void rotateForward() { + + } + + public void rotateBackward() { + + } + + + public Map readIOState() { + return null; + } + + + public void setReg(RegIndex regIndex, Integer value) { + } + + public Integer readReg(RegIndex regIndex) { + return 0; + } + + public void setMRes(Integer value) { + + } + + public void setIRun(Integer value) { + + } + + public void setIHold(Integer value) { + + } + + public void setStartAndStopVelocity(Integer value) { + + } + + public void setV1(Integer value) { + + } + + public void setA1AndD1(Integer value) { + + } + + public void setAmaxAndDmax(Integer value) { + + } + + public void setDefaultVelocity(Integer value) { + + } + + public void setVelocity(Integer low, Integer mid, Integer high) { + + } + + public void setOneCyclePulse(Integer pause, Integer denominator) { + + } + + public void setDZero(Integer value) { + + } +} diff --git a/src/main/java/com/iflytop/gd/hardware/device/SwitchSensor.java b/src/main/java/com/iflytop/gd/hardware/device/SwitchSensor.java new file mode 100644 index 0000000..dd45d6f --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/device/SwitchSensor.java @@ -0,0 +1,11 @@ +package com.iflytop.gd.hardware.device; + +/** + * 物理传感器 + */ + +public class SwitchSensor { + public boolean isOpen() { + return false; + } +} diff --git a/src/main/java/com/iflytop/gd/hardware/device/TransportationArm.java b/src/main/java/com/iflytop/gd/hardware/device/TransportationArm.java new file mode 100644 index 0000000..c243874 --- /dev/null +++ b/src/main/java/com/iflytop/gd/hardware/device/TransportationArm.java @@ -0,0 +1,27 @@ +package com.iflytop.gd.hardware.device; + +import com.iflytop.gd.hardware.constants.Dim; +import com.iflytop.gd.hardware.constants.DistanceUnit; +import com.iflytop.gd.hardware.constants.VelocityUnit; + +/** + * 物理转移机械臂 + */ + +public class TransportationArm { + public void moveTo(Dim dim, Integer distance, DistanceUnit unit) { + + } + + public void relativelyMove(Dim dim, Integer distance, DistanceUnit unit) { + + } + + public void stop(Dim dim) { + + } + + public void setSpeed(Dim dim, Integer speed, VelocityUnit unit) { + + } +} diff --git a/src/main/java/com/iflytop/gd/infrastructure/drivers/AppErrorCode.java b/src/main/java/com/iflytop/gd/hardware/drivers/AppErrorCode.java similarity index 89% rename from src/main/java/com/iflytop/gd/infrastructure/drivers/AppErrorCode.java rename to src/main/java/com/iflytop/gd/hardware/drivers/AppErrorCode.java index 075c5c0..f500f3f 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/drivers/AppErrorCode.java +++ b/src/main/java/com/iflytop/gd/hardware/drivers/AppErrorCode.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.drivers; +package com.iflytop.gd.hardware.drivers; public enum AppErrorCode { APP_OK(200, "操作成功"), diff --git a/src/main/java/com/iflytop/gd/infrastructure/drivers/CmdId.java b/src/main/java/com/iflytop/gd/hardware/drivers/CmdId.java similarity index 98% rename from src/main/java/com/iflytop/gd/infrastructure/drivers/CmdId.java rename to src/main/java/com/iflytop/gd/hardware/drivers/CmdId.java index d079a65..0e8da24 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/drivers/CmdId.java +++ b/src/main/java/com/iflytop/gd/hardware/drivers/CmdId.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.drivers; +package com.iflytop.gd.hardware.drivers; public enum CmdId { diff --git a/src/main/java/com/iflytop/gd/system/drivers/CommandBus.java b/src/main/java/com/iflytop/gd/hardware/drivers/CommandBus.java similarity index 66% rename from src/main/java/com/iflytop/gd/system/drivers/CommandBus.java rename to src/main/java/com/iflytop/gd/hardware/drivers/CommandBus.java index 19944e9..bbc0c0f 100644 --- a/src/main/java/com/iflytop/gd/system/drivers/CommandBus.java +++ b/src/main/java/com/iflytop/gd/hardware/drivers/CommandBus.java @@ -1,9 +1,8 @@ -package com.iflytop.gd.system.drivers; +package com.iflytop.gd.hardware.drivers; -import com.iflytop.gd.common.exception.AppException; -import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; -import com.iflytop.gd.system.exceptions.HardwareErrorException; -import com.iflytop.gd.system.models.DataPacket; +import com.iflytop.gd.common.exception.CommandExecTimeoutException; +import com.iflytop.gd.common.exception.HardwareErrorException; +import com.iflytop.gd.hardware.model.DataPacket; import java.io.IOException; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/com/iflytop/gd/infrastructure/drivers/ModuleId.java b/src/main/java/com/iflytop/gd/hardware/drivers/ModuleId.java similarity index 98% rename from src/main/java/com/iflytop/gd/infrastructure/drivers/ModuleId.java rename to src/main/java/com/iflytop/gd/hardware/drivers/ModuleId.java index 34add60..01770bd 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/drivers/ModuleId.java +++ b/src/main/java/com/iflytop/gd/hardware/drivers/ModuleId.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.drivers; +package com.iflytop.gd.hardware.drivers; public enum ModuleId { NotSet(0, "未设置"), diff --git a/src/main/java/com/iflytop/gd/infrastructure/drivers/RegIndex.java b/src/main/java/com/iflytop/gd/hardware/drivers/RegIndex.java similarity index 98% rename from src/main/java/com/iflytop/gd/infrastructure/drivers/RegIndex.java rename to src/main/java/com/iflytop/gd/hardware/drivers/RegIndex.java index 169919a..3a1079e 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/drivers/RegIndex.java +++ b/src/main/java/com/iflytop/gd/hardware/drivers/RegIndex.java @@ -1,4 +1,4 @@ -package com.iflytop.gd.infrastructure.drivers; +package com.iflytop.gd.hardware.drivers; /** * @brief 寄存器索引 diff --git a/src/main/java/com/iflytop/gd/infrastructure/drivers/WebSocketCommandBusImpl.java b/src/main/java/com/iflytop/gd/hardware/drivers/WebSocketCommandBusImpl.java similarity index 94% rename from src/main/java/com/iflytop/gd/infrastructure/drivers/WebSocketCommandBusImpl.java rename to src/main/java/com/iflytop/gd/hardware/drivers/WebSocketCommandBusImpl.java index c9a4ea6..4cd9c7f 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/drivers/WebSocketCommandBusImpl.java +++ b/src/main/java/com/iflytop/gd/hardware/drivers/WebSocketCommandBusImpl.java @@ -1,11 +1,10 @@ -package com.iflytop.gd.infrastructure.drivers; +package com.iflytop.gd.hardware.drivers; import cn.hutool.core.util.ObjectUtil; -import com.iflytop.gd.system.drivers.CommandBus; -import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; -import com.iflytop.gd.system.exceptions.HardwareErrorException; -import com.iflytop.gd.system.models.DataPacket; -import com.iflytop.gd.system.utils.ByteArray; +import com.iflytop.gd.common.exception.CommandExecTimeoutException; +import com.iflytop.gd.common.exception.HardwareErrorException; +import com.iflytop.gd.hardware.model.DataPacket; +import com.iflytop.gd.common.utils.ByteArray; import jakarta.annotation.PostConstruct; import jakarta.websocket.*; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/iflytop/gd/system/models/DataPacket.java b/src/main/java/com/iflytop/gd/hardware/model/DataPacket.java similarity index 97% rename from src/main/java/com/iflytop/gd/system/models/DataPacket.java rename to src/main/java/com/iflytop/gd/hardware/model/DataPacket.java index 90a0c3e..7ea85f2 100644 --- a/src/main/java/com/iflytop/gd/system/models/DataPacket.java +++ b/src/main/java/com/iflytop/gd/hardware/model/DataPacket.java @@ -1,6 +1,6 @@ -package com.iflytop.gd.system.models; +package com.iflytop.gd.hardware.model; -import com.iflytop.gd.system.utils.ByteArray; +import com.iflytop.gd.common.utils.ByteArray; import java.nio.ByteBuffer; import java.nio.ByteOrder; diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalDoor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalDoor.java deleted file mode 100644 index a63d026..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalDoor.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.physical; - -import com.iflytop.gd.common.exception.AppException; -import com.iflytop.gd.common.result.ResultCode; -import com.iflytop.gd.infrastructure.devices.virtual.VirtualStepMotor; -import com.iflytop.gd.infrastructure.drivers.ModuleId; -import com.iflytop.gd.system.constants.DistanceUnit; -import com.iflytop.gd.system.devices.Door; -import com.iflytop.gd.system.devices.StepMotor; -import com.iflytop.gd.system.drivers.CommandBus; -import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; -import com.iflytop.gd.system.exceptions.HardwareErrorException; -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Component; - -import java.io.IOException; - -/** - * 物理门 - */ - -public class PhysicalDoor implements Door { - - private final StepMotor doorMotor; - - public PhysicalDoor(CommandBus commandBus) { - this.doorMotor = new VirtualStepMotor(ModuleId.DoorM); - } - - @Override - public void open() { - try { - doorMotor.easyMoveTo(100, DistanceUnit.MM); - } catch (HardwareErrorException e) { - throw new AppException(ResultCode.HARDWARE_ERROR); - } catch (CommandExecTimeoutException e) { - throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); - } catch (IOException | InterruptedException e) { - throw new AppException(ResultCode.SYSTEM_ERROR); - } - } - - - @Override - public void close() { - try { - doorMotor.easyMoveToZero(); - } catch (HardwareErrorException e) { - throw new AppException(ResultCode.HARDWARE_ERROR); - } catch (CommandExecTimeoutException e) { - throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); - } catch (IOException | InterruptedException e) { - throw new AppException(ResultCode.SYSTEM_ERROR); - } - } - - @Override - public void stop() { - try { - doorMotor.stop(); - } catch (HardwareErrorException e) { - throw new AppException(ResultCode.HARDWARE_ERROR); - } catch (CommandExecTimeoutException e) { - throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); - } catch (IOException | InterruptedException e) { - throw new AppException(ResultCode.SYSTEM_ERROR); - } - } - -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalFan.java b/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalFan.java deleted file mode 100644 index 611727b..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalFan.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.physical; - -import com.iflytop.gd.system.devices.Fan; - -/** - * 物理风扇 - */ -public class PhysicalFan implements Fan { - @Override - public boolean open() { - return false; - } - - @Override - public boolean close() { - return false; - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalHoldingJaw.java b/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalHoldingJaw.java deleted file mode 100644 index 34a3a46..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalHoldingJaw.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.physical; - -import com.iflytop.gd.system.devices.HoldingJaw; - -/** - * 物理夹爪 - */ -public class PhysicalHoldingJaw implements HoldingJaw { - @Override - public void open() { - - } - - @Override - public void close() { - - } - - @Override - public void pause() { - - } - - @Override - public void resume() { - - } - - @Override - public void setSpeed(int speed) { - - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalLiquidFillingArm.java b/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalLiquidFillingArm.java deleted file mode 100644 index 15ef345..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalLiquidFillingArm.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.physical; - - -import com.iflytop.gd.infrastructure.drivers.ModuleId; -import com.iflytop.gd.system.constants.LiquidFillArmMotorIndex; -import com.iflytop.gd.system.constants.RotationDirection; -import com.iflytop.gd.system.constants.VelocityUnit; -import com.iflytop.gd.system.devices.LiquidFillingArm; -import com.iflytop.gd.system.devices.StepMotor; -import com.iflytop.gd.system.drivers.CommandBus; -import com.iflytop.gd.system.models.Point3D; - -/** - * 物理液体加注机械臂 - */ -public class PhysicalLiquidFillingArm implements LiquidFillingArm { - private final StepMotor largeArmMotor; - private final StepMotor smallArmMotor; - - public PhysicalLiquidFillingArm(CommandBus commandBus) { - this.largeArmMotor = new PhysicalStepMotor(ModuleId.DualRobotAxis1M, commandBus); - this.smallArmMotor = new PhysicalStepMotor(ModuleId.DualRobotAxis2M, commandBus); - } - - @Override - public void moveTo(Point3D point) { - - } - - @Override - public void rotateTo(LiquidFillArmMotorIndex liquidFillArmMotorIndex, Integer angle, RotationDirection direction) { - - } - - @Override - public void setRotationSpeed(Integer speed, VelocityUnit speedUnit) { - - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalPump.java b/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalPump.java deleted file mode 100644 index 7b065e5..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalPump.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.physical; - -import com.iflytop.gd.system.devices.Pump; - -/** - * 物理泵 - */ -public class PhysicalPump implements Pump { -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalRelay.java b/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalRelay.java deleted file mode 100644 index 658a310..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalRelay.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.physical; - -import com.iflytop.gd.system.devices.Relay; - -/** - * 物理继电器 - */ -public class PhysicalRelay implements Relay { - @Override - public boolean open() { - return false; - } - - @Override - public boolean close() { - return false; - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalStepMotor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalStepMotor.java deleted file mode 100644 index b457c35..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalStepMotor.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.physical; - -import com.iflytop.gd.infrastructure.drivers.CmdId; -import com.iflytop.gd.infrastructure.drivers.ModuleId; -import com.iflytop.gd.infrastructure.drivers.RegIndex; -import com.iflytop.gd.system.constants.DistanceUnit; -import com.iflytop.gd.system.constants.RotationDirection; -import com.iflytop.gd.system.devices.StepMotor; -import com.iflytop.gd.system.drivers.CommandBus; -import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; -import com.iflytop.gd.system.exceptions.HardwareErrorException; -import com.iflytop.gd.system.models.DataPacket; - -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -/** - * 物理步进电机实现 - */ -public class PhysicalStepMotor implements StepMotor { - protected final ModuleId moduleId; - protected final CommandBus commandBus; - protected final Integer DEFAULT_COMMAND_EXEC_TIMEOUT_SECONDS = 10; - - public PhysicalStepMotor(ModuleId moduleId, CommandBus commandBus) { - this.moduleId = moduleId; - this.commandBus = commandBus; - } - - - @Override - public void easyMoveTo(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - DataPacket commandDataPacket = DataPacket.createCommandDataPacket(moduleId.index, CmdId.step_motor_easy_move_to.index, unit.toMM(value)); - commandBus.waitForCommandExec(commandDataPacket, DEFAULT_COMMAND_EXEC_TIMEOUT_SECONDS, TimeUnit.SECONDS); - } - - @Override - public void easyMoveBy(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - DataPacket commandDataPacket = DataPacket.createCommandDataPacket(moduleId.index, CmdId.step_motor_easy_move_by.index, unit.toMM(value)); - commandBus.waitForCommandExec(commandDataPacket, DEFAULT_COMMAND_EXEC_TIMEOUT_SECONDS, TimeUnit.SECONDS); - } - - @Override - public void easyMoveToZero() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - DataPacket commandDataPacket = DataPacket.createCommandDataPacket(moduleId.index, CmdId.step_motor_easy_move_to_zero.index); - commandBus.waitForCommandExec(commandDataPacket, DEFAULT_COMMAND_EXEC_TIMEOUT_SECONDS, TimeUnit.SECONDS); - } - - @Override - public void easyMoveToZeroPointQuick() { - - } - - @Override - public void enable() { - - } - - @Override - public void disable() { - - } - - @Override - public void moveForward(RotationDirection direction, Integer distance, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void moveBackward(RotationDirection direction, Integer distance, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public Integer readPosition() { - return 0; - } - - @Override - public Integer readEncoderPosition() { - return 0; - } - - - @Override - public void stop() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void rotateForward() { - - } - - @Override - public void rotateBackward() { - - } - - - @Override - public Map readIOState() { - return null; - } - - - @Override - public void setReg(RegIndex regIndex, Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - DataPacket dataPacket = DataPacket.createCommandDataPacket(moduleId.index, CmdId.module_set_reg.index, value); - commandBus.waitForCommandExec(dataPacket, DEFAULT_COMMAND_EXEC_TIMEOUT_SECONDS, TimeUnit.SECONDS); - } - - @Override - public Integer readReg(RegIndex regIndex) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - DataPacket commandDataPacket = DataPacket.createCommandDataPacket(moduleId.index, CmdId.module_get_reg.index); - DataPacket ackDataPacket = commandBus.waitForCommandExec(commandDataPacket, DEFAULT_COMMAND_EXEC_TIMEOUT_SECONDS, TimeUnit.SECONDS); - return ackDataPacket.getContentI32(0); - } - - @Override - public void setMRes(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setIRun(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setIHold(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setStartAndStopVelocity(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setV1(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setA1AndD1(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setAmaxAndDmax(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setDefaultVelocity(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setVelocity(Integer low, Integer mid, Integer high) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setOneCyclePulse(Integer pause, Integer denominator) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void setDZero(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalSwitchSensor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalSwitchSensor.java deleted file mode 100644 index 5e67827..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalSwitchSensor.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.physical; - -import com.iflytop.gd.system.devices.SwitchSensor; - -/** - * 物理传感器 - */ - -public class PhysicalSwitchSensor implements SwitchSensor { - @Override - public boolean isOpen() { - return false; - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalTransportationArm.java b/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalTransportationArm.java deleted file mode 100644 index 51dc2c5..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/physical/PhysicalTransportationArm.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.physical; - -import com.iflytop.gd.infrastructure.drivers.ModuleId; -import com.iflytop.gd.system.constants.Dim; -import com.iflytop.gd.system.constants.DistanceUnit; -import com.iflytop.gd.system.constants.VelocityUnit; -import com.iflytop.gd.system.devices.StepMotor; -import com.iflytop.gd.system.devices.TransportationArm; -import com.iflytop.gd.system.drivers.CommandBus; - -/** - * 物理转移机械臂 - */ - -public class PhysicalTransportationArm implements TransportationArm { - - private final StepMotor xDimMotor; - private final StepMotor yDimMotor; - private final StepMotor zDimMotor; - - public PhysicalTransportationArm(CommandBus commandBus) { - this.xDimMotor = new PhysicalStepMotor(ModuleId.HBotXM, commandBus); - this.yDimMotor = new PhysicalStepMotor(ModuleId.HBotYM, commandBus); - this.zDimMotor = new PhysicalStepMotor(ModuleId.HBotZM, commandBus); - } - - @Override - public void moveTo(Dim dim, Integer distance, DistanceUnit unit) { - - } - - @Override - public void relativelyMove(Dim dim, Integer distance, DistanceUnit unit) { - - } - - - @Override - public void stop(Dim dim) { - - } - - @Override - public void setSpeed(Dim dim, Integer speed, VelocityUnit unit) { - - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualColdTray.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualColdTray.java deleted file mode 100644 index f80e756..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualColdTray.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.system.devices.ColdTray; - -/** - * 虚拟冷阱 - */ -public class VirtualColdTray implements ColdTray { - @Override - public boolean setTemperature(Double temperature) { - return false; - } - - @Override - public boolean startRecycle() { - return false; - } - - @Override - public boolean stopRecycle() { - return false; - } - - @Override - public boolean startHeating() { - return false; - } - - @Override - public boolean stopHeating() { - return false; - } - - @Override - public boolean startRefrigeration() { - return false; - } - - @Override - public boolean stopRefrigeration() { - return false; - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualDoor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualDoor.java deleted file mode 100644 index d80acfd..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualDoor.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.system.devices.Door; - -/** - * 虚拟门 - */ - -public class VirtualDoor implements Door { - private boolean isOpen = false; - @Override - public void open() { - this.isOpen = true; - } - - @Override - public void close() { - this.isOpen = false; - } - - @Override - public void stop() { - - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualFan.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualFan.java deleted file mode 100644 index fd8036e..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualFan.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.system.devices.Fan; - -/** - * 虚拟风扇 - */ -public class VirtualFan implements Fan { - @Override - public boolean open() { - return false; - } - - @Override - public boolean close() { - return false; - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualHeater.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualHeater.java deleted file mode 100644 index e0c8ff8..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualHeater.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.system.devices.Heater; -import com.iflytop.gd.system.models.HeaterStatus; - - -/** - * 虚拟加热器 - */ -public class VirtualHeater implements Heater { - private final HeaterStatus heaterStatus = new HeaterStatus(); - - - @Override - public void open() { - this.heaterStatus.setOpen(true); - } - - @Override - public void close() { - this.heaterStatus.setOpen(false); - } - - @Override - public Double getCurrentTemperature() { - return this.heaterStatus.getCurrentTemperature(); - } - - @Override - public Double getTargetTemperature() { - return this.heaterStatus.getTargetTemperature(); - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualHoldingJaw.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualHoldingJaw.java deleted file mode 100644 index a329a67..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualHoldingJaw.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.system.devices.HoldingJaw; - -/** - * 虚拟夹爪 - */ -public class VirtualHoldingJaw implements HoldingJaw { - @Override - public void open() { - - } - - @Override - public void close() { - - } - - @Override - public void pause() { - - } - - @Override - public void resume() { - - } - - @Override - public void setSpeed(int speed) { - - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualLiquidFillingArm.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualLiquidFillingArm.java deleted file mode 100644 index 4480ab7..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualLiquidFillingArm.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.system.constants.LiquidFillArmMotorIndex; -import com.iflytop.gd.system.constants.RotationDirection; -import com.iflytop.gd.system.constants.VelocityUnit; -import com.iflytop.gd.system.devices.LiquidFillingArm; -import com.iflytop.gd.system.models.Point3D; - - -/** - * 虚拟加液机械臂 - */ - -public class VirtualLiquidFillingArm implements LiquidFillingArm { - @Override - public void moveTo(Point3D point) { - } - - @Override - public void rotateTo(LiquidFillArmMotorIndex liquidFillArmMotorIndex, Integer angle, RotationDirection direction) { - } - - @Override - public void setRotationSpeed(Integer speed, VelocityUnit speedUnit) { - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualPump.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualPump.java deleted file mode 100644 index d1bbb0c..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualPump.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.system.devices.Pump; - -/** - * 虚拟泵 - */ -public class VirtualPump implements Pump { -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualRelay.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualRelay.java deleted file mode 100644 index e1b3820..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualRelay.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.system.devices.Relay; - -public class VirtualRelay implements Relay { - @Override - public boolean open() { - return false; - } - - @Override - public boolean close() { - return false; - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualServoMotor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualServoMotor.java deleted file mode 100644 index d5e7f0c..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualServoMotor.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.infrastructure.drivers.RegIndex; -import com.iflytop.gd.system.devices.ServoMotor; -import com.iflytop.gd.system.models.ServoMotorStatus; -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Component; - -import java.util.HashMap; -import java.util.Map; - - -/** - * 虚拟伺服电机 - */ -public class VirtualServoMotor implements ServoMotor { - private final ServoMotorStatus servoMotorStatus = new ServoMotorStatus(); - private final Map registers = new HashMap(); - @Override - public void enable() { - this.servoMotorStatus.setEnabled(true); - } - - @Override - public void disable() { - this.servoMotorStatus.setEnabled(false); - } - - @Override - public void stop() { - this.servoMotorStatus.setStopped(true); - } - - @Override - public Integer getCurrentPosition() { - return this.servoMotorStatus.getCurrentPosition(); - } - - @Override - public void moveToZero() { - this.servoMotorStatus.setCurrentPosition(0); - } - - @Override - public void moveTo(Integer position) { - this.servoMotorStatus.setCurrentPosition(position); - } - - @Override - public void setMaxVelocity(Integer maxVelocity) { - //TODO 等待硬件给出寄存器索引 - } - - @Override - public void setMaxTorque(Integer maxTorque) { - //TODO 等待硬件给出寄存器索引 - } - - @Override - public void setProtectiveTorque(Integer protectiveTorque) { - //TODO 等待硬件给出寄存器索引 - } - - @Override - public Integer readReg(RegIndex regIndex) { - return this.registers.get(regIndex); - } - - @Override - public void writeReg(RegIndex regIndex, Integer value) { - this.registers.put(regIndex, value); - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualStepMotor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualStepMotor.java deleted file mode 100644 index b5a43b0..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualStepMotor.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import cn.hutool.json.JSONUtil; -import com.iflytop.gd.infrastructure.drivers.ModuleId; -import com.iflytop.gd.infrastructure.drivers.RegIndex; -import com.iflytop.gd.system.constants.DistanceUnit; -import com.iflytop.gd.system.constants.RotationDirection; -import com.iflytop.gd.system.devices.StepMotor; -import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; -import com.iflytop.gd.system.exceptions.HardwareErrorException; -import com.iflytop.gd.system.models.StepMotorStatus; -import lombok.extern.slf4j.Slf4j; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -/** - * 虚拟步进电机 - */ -@Slf4j -public class VirtualStepMotor implements StepMotor { - private StepMotorStatus stepMotorStatus = new StepMotorStatus(); - private Map registers = new HashMap(); - private final ModuleId moduleId; - - public VirtualStepMotor(ModuleId moduleId) { - this.moduleId = moduleId; - } - - @Override - public void easyMoveBy(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - int position = this.stepMotorStatus.getCurrentPosition() + unit.toMM(value); - this.stepMotorStatus.setCurrentPosition(position); - this.stepMotorStatus.setStopped(true); - } - - @Override - public void easyMoveTo(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - log.debug("Moving to {}", value); - this.stepMotorStatus.setCurrentPosition(unit.toMM(value)); - this.stepMotorStatus.setZeroPosition(this.stepMotorStatus.getCurrentPosition() == 0); - this.stepMotorStatus.setStopped(true); - log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.stepMotorStatus)); - } - - @Override - public void easyMoveToZero() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - log.debug("Easy move to zero."); - this.stepMotorStatus.setCurrentPosition(0); - this.stepMotorStatus.setZeroPosition(this.stepMotorStatus.getCurrentPosition() == 0); - this.stepMotorStatus.setStopped(true); - log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.stepMotorStatus)); - } - - @Override - public void easyMoveToZeroPointQuick() { - log.debug("Easy move to zero quick."); - this.stepMotorStatus.setCurrentPosition(0); - this.stepMotorStatus.setZeroPosition(this.stepMotorStatus.getCurrentPosition() == 0); - this.stepMotorStatus.setStopped(true); - log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.stepMotorStatus)); - } - - @Override - public void enable() { - log.debug("Enable step motor."); - this.stepMotorStatus.setEnabled(true); - log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.stepMotorStatus)); - } - - @Override - public void disable() { - log.debug("Disable step motor."); - this.stepMotorStatus.setEnabled(false); - log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.stepMotorStatus)); - } - - @Override - public void moveForward(RotationDirection direction, Integer distance, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void moveBackward(RotationDirection direction, Integer distance, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - - } - - @Override - public void stop() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - log.debug("Stop step motor."); - this.stepMotorStatus.setStopped(true); - log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.stepMotorStatus)); - } - - @Override - public void rotateForward() { - - } - - @Override - public void rotateBackward() { - - } - - @Override - public Map readIOState() { - Map ioState = new HashMap<>(); - ioState.put("IO1", true); - ioState.put("IO2", false); - return ioState; - } - - @Override - public Integer readPosition() { - return this.stepMotorStatus.getCurrentPosition(); - } - - @Override - public Integer readEncoderPosition() { - return this.stepMotorStatus.getEncoderPosition(); - } - - @Override - public void setReg(RegIndex regIndex, Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - this.registers.put(regIndex, value); - } - - @Override - public Integer readReg(RegIndex regIndex) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - return this.registers.get(regIndex); - } - - @Override - public void setMRes(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_mres, value); - } - - @Override - public void setIRun(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_irun, value); - } - - @Override - public void setIHold(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_ihold, value); - } - - @Override - public void setStartAndStopVelocity(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_vstart, value); - setReg(RegIndex.kreg_step_motor_vstop, value); - } - - @Override - public void setV1(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_v1, value); - } - - @Override - public void setA1AndD1(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_a1, value); - setReg(RegIndex.kreg_step_motor_d1, value); - } - - @Override - public void setAmaxAndDmax(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_amax, value); - setReg(RegIndex.kreg_step_motor_dmax, value); - } - - @Override - public void setDefaultVelocity(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_default_velocity, value); - } - - @Override - public void setVelocity(Integer low, Integer mid, Integer high) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_low_velocity, low); - setReg(RegIndex.kreg_step_motor_mid_velocity, mid); - setReg(RegIndex.kreg_step_motor_high_velocity, high); - } - - @Override - public void setOneCyclePulse(Integer pause, Integer denominator) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_one_circle_pulse, pause); - setReg(RegIndex.kreg_step_motor_one_circle_pulse_denominator, denominator); - } - - @Override - public void setDZero(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { - setReg(RegIndex.kreg_step_motor_dzero_pos, value); - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualSwitchSensor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualSwitchSensor.java deleted file mode 100644 index bf0886b..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualSwitchSensor.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.system.devices.SwitchSensor; - -/** - * 虚拟传感器 - */ -public class VirtualSwitchSensor implements SwitchSensor { - @Override - public boolean isOpen() { - return false; - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualTransportationArm.java b/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualTransportationArm.java deleted file mode 100644 index 3e7ac18..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/virtual/VirtualTransportationArm.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.iflytop.gd.infrastructure.devices.virtual; - -import com.iflytop.gd.common.exception.AppException; -import com.iflytop.gd.common.result.ResultCode; -import com.iflytop.gd.infrastructure.drivers.ModuleId; -import com.iflytop.gd.system.constants.Dim; -import com.iflytop.gd.system.constants.DistanceUnit; -import com.iflytop.gd.system.constants.VelocityUnit; -import com.iflytop.gd.system.devices.StepMotor; -import com.iflytop.gd.system.devices.TransportationArm; -import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; -import com.iflytop.gd.system.exceptions.HardwareErrorException; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -/** - * 虚拟转移机械臂 - */ -public class VirtualTransportationArm implements TransportationArm { - private final StepMotor xDimMotor; - private final StepMotor yDimMotor; - private final StepMotor zDimMotor; - private final Map stepMotors = new HashMap(); - - public VirtualTransportationArm() { - this.xDimMotor = new VirtualStepMotor(ModuleId.HBotXM); - this.yDimMotor = new VirtualStepMotor(ModuleId.HBotYM); - this.zDimMotor = new VirtualStepMotor(ModuleId.HBotZM); - stepMotors.put(Dim.X, xDimMotor); - stepMotors.put(Dim.Y, yDimMotor); - stepMotors.put(Dim.Z, zDimMotor); - } - - @Override - public void moveTo(Dim dim, Integer distance, DistanceUnit unit) { - try { - stepMotors.get(dim).easyMoveTo(distance, unit); - } catch (HardwareErrorException e) { - throw new AppException(ResultCode.HARDWARE_ERROR); - } catch (CommandExecTimeoutException e) { - throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); - } catch (IOException | InterruptedException e) { - throw new AppException(ResultCode.SYSTEM_ERROR); - } - } - - @Override - public void relativelyMove(Dim dim, Integer distance, DistanceUnit unit) { - try { - stepMotors.get(dim).easyMoveBy(distance, unit); - } catch (HardwareErrorException e) { - throw new AppException(ResultCode.HARDWARE_ERROR); - } catch (CommandExecTimeoutException e) { - throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); - } catch (IOException | InterruptedException e) { - throw new AppException(ResultCode.SYSTEM_ERROR); - } - } - - @Override - public void stop(Dim dim) { - try { - stepMotors.get(dim).stop(); - } catch (HardwareErrorException e) { - throw new AppException(ResultCode.HARDWARE_ERROR); - } catch (CommandExecTimeoutException e) { - throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); - } catch (IOException | InterruptedException e) { - throw new AppException(ResultCode.SYSTEM_ERROR); - } - } - - @Override - public void setSpeed(Dim dim, Integer speed, VelocityUnit unit) { - try { - stepMotors.get(dim).setDefaultVelocity(unit.toMM_PER_SEC(speed)); - } catch (HardwareErrorException e) { - throw new AppException(ResultCode.HARDWARE_ERROR); - } catch (CommandExecTimeoutException e) { - throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); - } catch (IOException | InterruptedException e) { - throw new AppException(ResultCode.SYSTEM_ERROR); - } - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/modules/Device.java b/src/main/java/com/iflytop/gd/infrastructure/modules/Device.java deleted file mode 100644 index a83d0d1..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/modules/Device.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iflytop.gd.infrastructure.modules; - -import com.iflytop.gd.infrastructure.modules.area.*; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -@Component -@RequiredArgsConstructor -public class Device { - /** - * 加热区 - */ - private final HeatArea heatArea; - /** - * 加液区 - */ - private final LiquidArea liquidArea; - /** - * 导轨机械臂 - */ - private final RailArmArea railArmArea; - /** - * 拍子存放区 - */ - private final CapArea capArea; - /** - * 冷阱 - */ - private final ColdTrapArea coldTrapArea; - /** - * 门 - */ - private final DoorArea doorArea; - - -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/modules/WebSocketNotificationPushMgrImpl.java b/src/main/java/com/iflytop/gd/infrastructure/modules/WebSocketNotificationPushMgrImpl.java deleted file mode 100644 index c2b8b22..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/modules/WebSocketNotificationPushMgrImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.iflytop.gd.infrastructure.modules; - -import cn.hutool.json.JSONUtil; -import com.iflytop.gd.common.notification.Notification; -import com.iflytop.gd.system.modules.NotificationPushMgr; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import jakarta.websocket.Session; - -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; - -/** - * 使用Websocket实现通知推送管理 - */ -@Slf4j -@Component -public class WebSocketNotificationPushMgrImpl implements NotificationPushMgr { - - private final Set sessions = new HashSet<>(); - - @Override - public void pushNotification(Notification notification) { - for (Session session : sessions) { - try { - session.getBasicRemote().sendText(JSONUtil.toJsonStr(notification)); - } catch (IOException e) { - log.error("Fail to send notification to session: {}", session.getId(), e); - } - } - } - - /** - * 添加websocket session - * @param session - */ - public void addSession(Session session) { - sessions.add(session); - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/modules/area/CapArea.java b/src/main/java/com/iflytop/gd/infrastructure/modules/area/CapArea.java deleted file mode 100644 index e8062c8..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/modules/area/CapArea.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.iflytop.gd.infrastructure.modules.area; - -import org.springframework.stereotype.Component; - -/** - * 拍子存放区 - */ -@Component -public class CapArea { -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/modules/area/ColdTrapArea.java b/src/main/java/com/iflytop/gd/infrastructure/modules/area/ColdTrapArea.java deleted file mode 100644 index b0b23ca..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/modules/area/ColdTrapArea.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.iflytop.gd.infrastructure.modules.area; - -import org.springframework.stereotype.Component; - -/** - * 冷阱 - */ -@Component -public class ColdTrapArea { -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/modules/area/DoorArea.java b/src/main/java/com/iflytop/gd/infrastructure/modules/area/DoorArea.java deleted file mode 100644 index 0d0c12c..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/modules/area/DoorArea.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.iflytop.gd.infrastructure.modules.area; - -import org.springframework.stereotype.Component; - -/** - * 门 - */ -@Component -public class DoorArea { -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/modules/area/HeatArea.java b/src/main/java/com/iflytop/gd/infrastructure/modules/area/HeatArea.java deleted file mode 100644 index 030a2af..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/modules/area/HeatArea.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iflytop.gd.infrastructure.modules.area; - -import com.iflytop.gd.common.enums.HeatModuleId; -import com.iflytop.gd.infrastructure.modules.model.bo.HeatModule; -import com.iflytop.gd.system.devices.StepMotor; -import jakarta.annotation.PostConstruct; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * 加热区 - */ -@Component -public class HeatArea { - /** - * 加热模块 - */ - private final List heatModuleList = Collections.synchronizedList(new ArrayList<>()); - - @PostConstruct - private void init(){ - for (HeatModuleId moduleId : HeatModuleId.values()) { - HeatModule heatModule = new HeatModule(); - heatModule.setHeatId(moduleId); -// heatModule.setLiftMotor(); - - - heatModuleList.add(heatModule); - System.out.println("模块枚举名: " + moduleId.name() - + ",模块 ID: " + moduleId.getId()); - } - } -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/modules/area/LiquidArea.java b/src/main/java/com/iflytop/gd/infrastructure/modules/area/LiquidArea.java deleted file mode 100644 index 622461a..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/modules/area/LiquidArea.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.iflytop.gd.infrastructure.modules.area; - -import org.springframework.stereotype.Component; - -/** - * 加液区 - */ -@Component -public class LiquidArea { - -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/modules/area/RailArmArea.java b/src/main/java/com/iflytop/gd/infrastructure/modules/area/RailArmArea.java deleted file mode 100644 index 108ece3..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/modules/area/RailArmArea.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.iflytop.gd.infrastructure.modules.area; - -import org.springframework.stereotype.Component; - -/** - * 导轨机械臂 - */ -@Component -public class RailArmArea { - -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/modules/model/bo/HeatModule.java b/src/main/java/com/iflytop/gd/infrastructure/modules/model/bo/HeatModule.java deleted file mode 100644 index 23d7ea4..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/modules/model/bo/HeatModule.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.iflytop.gd.infrastructure.modules.model.bo; - -import com.iflytop.gd.common.enums.HeatModuleId; -import com.iflytop.gd.common.enums.TrayLiftStatus; -import com.iflytop.gd.system.devices.StepMotor; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.Duration; -import java.time.LocalDateTime; - -/** - * 加热区的加热模块 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class HeatModule { - /** - * 加热区ID - */ - private HeatModuleId heatId; - - /** - * 升降电机 - */ - private StepMotor liftMotor; - - /** - * 当前升降状态:抬起(RAISED) 或 降下(LOWERED) - */ - private TrayLiftStatus liftStatus = TrayLiftStatus.DOWN; - - /** - * 是否正在加热 - */ - private boolean heating = false; - - /** - * 目标温度,单位:摄氏度 - */ - private double targetTemperature = 0; - - /** - * 开始加热时间 - */ - private LocalDateTime startHeatingTime; - - /** - * 加热持续时间 - */ - private Duration heatingDuration; - - /** - * 是否存在托盘 - */ - private boolean hasTray = false; - - /** - * 是否存在拍子 - */ - private boolean hasCap = false; - -} diff --git a/src/main/java/com/iflytop/gd/infrastructure/repository/DeviceStrategyFactory.java b/src/main/java/com/iflytop/gd/infrastructure/repository/DeviceStrategyFactory.java deleted file mode 100644 index 4b5c59b..0000000 --- a/src/main/java/com/iflytop/gd/infrastructure/repository/DeviceStrategyFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.iflytop.gd.infrastructure.repository; - -import com.iflytop.gd.system.drivers.CommandBus; -import lombok.RequiredArgsConstructor; -import org.springframework.context.ApplicationContext; -import org.springframework.stereotype.Component; - -import java.util.Map; - -@Component -@RequiredArgsConstructor -public class DeviceStrategyFactory { - private final ApplicationContext ctx; - private final CommandBus commandBus; - - /** - * @param type 接口 Class 对象,如 ColdTray.class - * @param beanName 在 @Component 中定义的名称,如 "coldTrayA" - */ - public T getStrategy(Class type, String beanName) { - Map beans = ctx.getBeansOfType(type); - T strategy = beans.get(beanName); - if (strategy == null) { - throw new IllegalArgumentException("No bean named '" + beanName + "' for type " + type.getSimpleName()); - } - return strategy; - } -} diff --git a/src/main/java/com/iflytop/gd/system/constants/Dim.java b/src/main/java/com/iflytop/gd/system/constants/Dim.java deleted file mode 100644 index 14de525..0000000 --- a/src/main/java/com/iflytop/gd/system/constants/Dim.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.iflytop.gd.system.constants; - -public enum Dim { - X, Y, Z -} diff --git a/src/main/java/com/iflytop/gd/system/constants/SystemMode.java b/src/main/java/com/iflytop/gd/system/constants/SystemMode.java deleted file mode 100644 index c660d67..0000000 --- a/src/main/java/com/iflytop/gd/system/constants/SystemMode.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.iflytop.gd.system.constants; - -/** - * 系统运行模式 - */ -public enum SystemMode { - VIRTUAL, PHYSICAL -} diff --git a/src/main/java/com/iflytop/gd/system/devices/ColdTray.java b/src/main/java/com/iflytop/gd/system/devices/ColdTray.java deleted file mode 100644 index f3f6540..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/ColdTray.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.iflytop.gd.system.devices; - -/** - * 冷阱 - */ -public interface ColdTray { - - /** - * 设置温度 - * @param temperature - * @return - */ - boolean setTemperature(Double temperature); - - /** - * 开启循环 - * @return - */ - boolean startRecycle(); - - - /** - * 关闭循环 - * @return - */ - boolean stopRecycle(); - - - /** - * 开启加热 - * @return - */ - boolean startHeating(); - - - /** - * 关闭加热 - * @return - */ - boolean stopHeating(); - - /** - * 开启制冷 - * @return - */ - boolean startRefrigeration(); - - - /** - * 关闭制冷 - * @return - */ - boolean stopRefrigeration(); -} diff --git a/src/main/java/com/iflytop/gd/system/devices/Door.java b/src/main/java/com/iflytop/gd/system/devices/Door.java deleted file mode 100644 index aa9b14f..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/Door.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.iflytop.gd.system.devices; - -public interface Door { - /** - * 开门 - */ - void open(); - - /** - * 关门 - */ - void close(); - - /** - * 停止 - */ - void stop(); -} diff --git a/src/main/java/com/iflytop/gd/system/devices/Fan.java b/src/main/java/com/iflytop/gd/system/devices/Fan.java deleted file mode 100644 index 94abec9..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/Fan.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.iflytop.gd.system.devices; - -/** - * 风扇 - */ -public interface Fan { - - /** - * 开启风扇 - * @return - */ - boolean open(); - - - /** - * 关闭风扇 - * @return - */ - boolean close(); - -} diff --git a/src/main/java/com/iflytop/gd/system/devices/Heater.java b/src/main/java/com/iflytop/gd/system/devices/Heater.java deleted file mode 100644 index 3effea7..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/Heater.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.iflytop.gd.system.devices; - -/** - * 加热器 - */ -public interface Heater { - - /** - * 打开 - * @return - */ - void open(); - - - /** - * 关闭 - * @return - */ - void close(); - - /** - * 获取当前温度 - * @return - */ - Double getCurrentTemperature(); - - /** - * 获取设定的目标温度 - * @return - */ - Double getTargetTemperature(); -} diff --git a/src/main/java/com/iflytop/gd/system/devices/HoldingJaw.java b/src/main/java/com/iflytop/gd/system/devices/HoldingJaw.java deleted file mode 100644 index ef7380a..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/HoldingJaw.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iflytop.gd.system.devices; - - -/** - * 夹爪 - */ -public interface HoldingJaw { - - /** - * 打开夹爪 - */ - void open(); - - /** - * 关闭夹爪 - */ - void close(); - - /** - * 暂停 - */ - void pause(); - - - /** - * 恢复 - */ - void resume(); - - - /** - * - * @param speed - */ - void setSpeed(int speed); -} diff --git a/src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java b/src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java deleted file mode 100644 index 60dd622..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.iflytop.gd.system.devices; - -import com.iflytop.gd.system.constants.LiquidFillArmMotorIndex; -import com.iflytop.gd.system.constants.RotationDirection; -import com.iflytop.gd.system.constants.VelocityUnit; -import com.iflytop.gd.system.models.Point3D; - - -/** - * 加液机械臂 - */ -public interface LiquidFillingArm { - - /** - * 机械臂移动到指定点 - * @param point 点坐标 - * @return 是否移动完成 - */ - void moveTo(Point3D point); - - /** - * 旋转到指定角度 - * @param liquidFillArmMotorIndex 机械臂电机索引 - * @param angle 角度 - * @param direction 旋转方向 - * @return 是否旋转完成 - */ - void rotateTo(LiquidFillArmMotorIndex liquidFillArmMotorIndex, Integer angle, RotationDirection direction); - - - /** - * 设置旋转速率 - * @param speed 速率值 - * @param speedUnit 速率单位 - * @return 是否设置成功 - */ - void setRotationSpeed(Integer speed, VelocityUnit speedUnit); -} diff --git a/src/main/java/com/iflytop/gd/system/devices/Pump.java b/src/main/java/com/iflytop/gd/system/devices/Pump.java deleted file mode 100644 index 024472c..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/Pump.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.iflytop.gd.system.devices; - -/** - * 泵 - */ -public interface Pump { - -} diff --git a/src/main/java/com/iflytop/gd/system/devices/Relay.java b/src/main/java/com/iflytop/gd/system/devices/Relay.java deleted file mode 100644 index 455033f..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/Relay.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.iflytop.gd.system.devices; - -/** - * 继电器 - */ -public interface Relay { - /** - * 打开继电器 - * @return - */ - boolean open(); - - - /** - * 闭合继电器 - * @return - */ - boolean close(); -} diff --git a/src/main/java/com/iflytop/gd/system/devices/ServoMotor.java b/src/main/java/com/iflytop/gd/system/devices/ServoMotor.java deleted file mode 100644 index 1915a16..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/ServoMotor.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.iflytop.gd.system.devices; - - -import com.iflytop.gd.infrastructure.drivers.RegIndex; - -/** - * 伺服电机 - */ -public interface ServoMotor { - - /** - * 使能 - */ - void enable(); - - /** - * 失能 - */ - void disable(); - - /** - * 停止 - */ - void stop(); - - - /** - * 获取当前位置 - * @return - */ - Integer getCurrentPosition(); - - - /** - * 移动到零点 - */ - void moveToZero(); - - - /** - * 移动到指定位置 - * @param position - */ - void moveTo(Integer position); - - /****************寄存器配置开始*****************/ - - /** - * 设置最大速度 - * @param maxVelocity - */ - void setMaxVelocity(Integer maxVelocity); - - /** - * 设置最大力矩 - * @param maxTorque - */ - void setMaxTorque(Integer maxTorque); - - /** - * 设置保护力矩 - * @param protectiveTorque - */ - void setProtectiveTorque(Integer protectiveTorque); - - - /** - * 读取寄存器值 - * @param regIndex - * @return - */ - Integer readReg(RegIndex regIndex); - - - /** - * 设置寄存器 - * @param regIndex - * @param value - */ - void writeReg(RegIndex regIndex, Integer value); - /****************寄存器配置结束*****************/ -} diff --git a/src/main/java/com/iflytop/gd/system/devices/StepMotor.java b/src/main/java/com/iflytop/gd/system/devices/StepMotor.java deleted file mode 100644 index c1e68ad..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/StepMotor.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.iflytop.gd.system.devices; - -import com.iflytop.gd.infrastructure.drivers.RegIndex; -import com.iflytop.gd.system.constants.DistanceUnit; -import com.iflytop.gd.system.constants.RotationDirection; -import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; -import com.iflytop.gd.system.exceptions.HardwareErrorException; - -import java.io.IOException; -import java.util.Map; - -/** - * 电机驱动类型设备 - */ -public interface StepMotor { - - /** - * 相对距离移动 - * @param value - * @param unit - */ - void easyMoveBy(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - - /** - * 绝对距离移动 - * @param value - * @param unit - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void easyMoveTo(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 归零 - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void easyMoveToZero() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 快速归零 - */ - void easyMoveToZeroPointQuick(); - - /** - * 使能电机 - */ - void enable(); - - /** - * 失能电机 - */ - void disable(); - - - /** - * 正向移动 - * @param direction - * @param distance - * @param unit - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void moveForward(RotationDirection direction, Integer distance, DistanceUnit unit) - throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 反向移动 - * @param direction - * @param distance - * @param unit - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void moveBackward(RotationDirection direction, Integer distance, DistanceUnit unit) - throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 停止电机 - */ - void stop() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 正向旋转 - */ - void rotateForward(); - - /** - * 反向旋转 - */ - void rotateBackward(); - - /** - * 读取IO状态 - * - * @return - */ - Map readIOState(); - - - /** - * 读取当前位置 - * @return - */ - Integer readPosition(); - - /** - * 读取编码器位置 - * @return - */ - Integer readEncoderPosition(); - - - /*************************寄存器相关开始*******************/ - - /** - * 设置模块寄存器值 - * @param regIndex - * @param value - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setReg(RegIndex regIndex, Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - - /** - * 读取模块寄存器值 - * @param regIndex - * @return - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - Integer readReg(RegIndex regIndex) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 设置细分 - */ - void setMRes(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - - /** - * 设置电机电流 - * @param value - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setIRun(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - - /** - * 设置电机电流 - * @param value - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setIHold(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 设置启动速度 - * @param value - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setStartAndStopVelocity(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 设置V1 - * @param value - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setV1(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 设置加速度 - * @param value - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setA1AndD1(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - - /** - * 设置最大加速度 - * @param value - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setAmaxAndDmax(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - - - /** - * 设置默认速度值 - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setDefaultVelocity(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 设置速度 - * @param low - * @param mid - * @param high - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setVelocity(Integer low, Integer mid, Integer high) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - - /** - * 设置转动一圈脉冲数 - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setOneCyclePulse(Integer pause, Integer denominator) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - /** - * 设置DZero - * @param value - * @throws HardwareErrorException - * @throws CommandExecTimeoutException - * @throws IOException - * @throws InterruptedException - */ - void setDZero(Integer value) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; - - - /*************************寄存器相关结束*******************/ -} diff --git a/src/main/java/com/iflytop/gd/system/devices/SwitchSensor.java b/src/main/java/com/iflytop/gd/system/devices/SwitchSensor.java deleted file mode 100644 index 702ee25..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/SwitchSensor.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.iflytop.gd.system.devices; - -public interface SwitchSensor { - boolean isOpen(); -} diff --git a/src/main/java/com/iflytop/gd/system/devices/TransportationArm.java b/src/main/java/com/iflytop/gd/system/devices/TransportationArm.java deleted file mode 100644 index 45c0c45..0000000 --- a/src/main/java/com/iflytop/gd/system/devices/TransportationArm.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.iflytop.gd.system.devices; - -import com.iflytop.gd.system.constants.Dim; -import com.iflytop.gd.system.constants.DistanceUnit; -import com.iflytop.gd.system.constants.VelocityUnit; - -public interface TransportationArm { - - /** - * 机械臂XYZ三个维度移动指定距离 - * @param dim 维度 - * @param distance 距离值 - * @param unit 距离单位 - * @return 是否移动完成 - */ - void moveTo(Dim dim, Integer distance, DistanceUnit unit); - - /** - * 移动到指定点 - * @param unit 距离单位 - * @return 是否移动完成 - */ - void relativelyMove(Dim dim, Integer distance, DistanceUnit unit); - - /** - * 独立停止XYZ三个维度移动 - * @param dim 维度 - * @return 是否执行完成 - */ - void stop(Dim dim); - - /** - * 独立设置XYZ三个轴移动速率 - * @param dim 维度 - * @param speed 速率 - * @param unit 速率单位 - * @return 是否设置完成 - */ - void setSpeed(Dim dim, Integer speed, VelocityUnit unit); -} diff --git a/src/main/java/com/iflytop/gd/system/models/HeaterStatus.java b/src/main/java/com/iflytop/gd/system/models/HeaterStatus.java deleted file mode 100644 index 42c1fda..0000000 --- a/src/main/java/com/iflytop/gd/system/models/HeaterStatus.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.iflytop.gd.system.models; - - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class HeaterStatus { - private Double targetTemperature = 0.0; // 目标温度 - private Double currentTemperature = 0.0; // 当前温度 - private boolean isOpen; -} diff --git a/src/main/java/com/iflytop/gd/system/models/ServoMotorStatus.java b/src/main/java/com/iflytop/gd/system/models/ServoMotorStatus.java deleted file mode 100644 index 2e63103..0000000 --- a/src/main/java/com/iflytop/gd/system/models/ServoMotorStatus.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.iflytop.gd.system.models; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class ServoMotorStatus { - private boolean stopped = false; - private boolean isEnabled = false; - private Integer currentPosition; -} diff --git a/src/main/java/com/iflytop/gd/system/models/StepMotorStatus.java b/src/main/java/com/iflytop/gd/system/models/StepMotorStatus.java deleted file mode 100644 index e1648c2..0000000 --- a/src/main/java/com/iflytop/gd/system/models/StepMotorStatus.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.iflytop.gd.system.models; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class StepMotorStatus { - private boolean stopped = false; - private boolean isEnabled = false; - private Integer currentSpeed; - private Integer currentPosition; - private Integer encoderPosition; - private boolean isZeroPosition = true; - private boolean isLimitPosition = false; -} diff --git a/src/main/java/com/iflytop/gd/system/modules/NotificationPushMgr.java b/src/main/java/com/iflytop/gd/system/modules/NotificationPushMgr.java deleted file mode 100644 index 0b38bac..0000000 --- a/src/main/java/com/iflytop/gd/system/modules/NotificationPushMgr.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.iflytop.gd.system.modules; - -import com.iflytop.gd.common.notification.Notification; - -/** - * 通知管理器 - */ -public interface NotificationPushMgr { - - /** - * 向前端推送通知 - * @param notification 通知实例 - */ - void pushNotification(Notification notification); -} diff --git a/src/main/java/com/iflytop/gd/system/package-info.java b/src/main/java/com/iflytop/gd/system/package-info.java deleted file mode 100644 index 98c4126..0000000 --- a/src/main/java/com/iflytop/gd/system/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.iflytop.gd.system; - - -/** - * 系统层用由设备、模块组成 - */ \ No newline at end of file diff --git a/src/test/java/com/iflytop/gd/infrastructure/drivers/WebSocketCommandBusImplTest.java b/src/test/java/com/iflytop/gd/infrastructure/drivers/WebSocketCommandBusImplTest.java index 36c2f3c..5f50a49 100644 --- a/src/test/java/com/iflytop/gd/infrastructure/drivers/WebSocketCommandBusImplTest.java +++ b/src/test/java/com/iflytop/gd/infrastructure/drivers/WebSocketCommandBusImplTest.java @@ -1,19 +1,17 @@ package com.iflytop.gd.infrastructure.drivers; -import com.iflytop.gd.system.drivers.CommandBus; -import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; -import com.iflytop.gd.system.exceptions.HardwareErrorException; -import com.iflytop.gd.system.models.DataPacket; +import com.iflytop.gd.hardware.drivers.CmdId; +import com.iflytop.gd.hardware.drivers.ModuleId; +import com.iflytop.gd.hardware.drivers.WebSocketCommandBusImpl; +import com.iflytop.gd.common.exception.CommandExecTimeoutException; +import com.iflytop.gd.common.exception.HardwareErrorException; +import com.iflytop.gd.hardware.model.DataPacket; import jakarta.websocket.DeploymentException; import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.TimeUnit; -import static org.junit.jupiter.api.Assertions.*; - class WebSocketCommandBusImplTest { @Test