|
|
@ -1,11 +1,709 @@ |
|
|
|
package com.iflytop.colortitration.app.common.command; |
|
|
|
|
|
|
|
|
|
|
|
import com.iflytop.colortitration.common.command.DeviceCommandParams; |
|
|
|
import com.iflytop.colortitration.common.enums.command.Action; |
|
|
|
import com.iflytop.colortitration.common.enums.command.Device; |
|
|
|
import com.iflytop.colortitration.common.enums.command.MotorDirection; |
|
|
|
import com.iflytop.colortitration.common.enums.command.TricolorLightColor; |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成给设备发送的指令 |
|
|
|
*/ |
|
|
|
public class DeviceCommandGenerator { |
|
|
|
// =========================================== 三色灯 ==================================================== |
|
|
|
|
|
|
|
/** |
|
|
|
* 三色灯开启 |
|
|
|
* |
|
|
|
* @param color red | green | blue |
|
|
|
*/ |
|
|
|
public static DeviceCommand tricolorLightOpen(TricolorLightColor color) { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setColor(color); |
|
|
|
return controlCmd(Device.TRICOLOR_LIGHT, Action.OPEN, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 三色灯关闭 |
|
|
|
*/ |
|
|
|
public static DeviceCommand tricolorLightClose() { |
|
|
|
return controlCmd(Device.TRICOLOR_LIGHT, Action.CLOSE, null); |
|
|
|
} |
|
|
|
// =========================================== 加热棒 ==================================================== |
|
|
|
|
|
|
|
/** |
|
|
|
* 加热棒 1 获取参数 |
|
|
|
*/ |
|
|
|
public static DeviceCommand heatRod01Get() { |
|
|
|
return controlCmd(Device.HEAT_ROD_1, Action.GET, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 加热棒 1 打开 |
|
|
|
*/ |
|
|
|
public static DeviceCommand heatRod01Open(Double temperature) { |
|
|
|
return controlCmd(Device.HEAT_ROD_1, Action.OPEN, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 加热棒 1 关闭 |
|
|
|
*/ |
|
|
|
public static DeviceCommand heatRod01Close() { |
|
|
|
return controlCmd(Device.HEAT_ROD_1, Action.CLOSE, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 加热棒 2 获取参数 |
|
|
|
*/ |
|
|
|
public static DeviceCommand heatRod02Get() { |
|
|
|
return controlCmd(Device.HEAT_ROD_2, Action.GET, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 加热棒 2 打开 |
|
|
|
*/ |
|
|
|
public static DeviceCommand heatRod02Open(Double temperature) { |
|
|
|
return controlCmd(Device.HEAT_ROD_1, Action.OPEN, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 加热棒 2 关闭 |
|
|
|
*/ |
|
|
|
public static DeviceCommand heatRod02Close() { |
|
|
|
return controlCmd(Device.HEAT_ROD_1, Action.CLOSE, null); |
|
|
|
} |
|
|
|
|
|
|
|
// =========================================== 夹爪 ==================================================== |
|
|
|
|
|
|
|
/** |
|
|
|
* 夹爪移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand clawMove(Double position) { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setPosition(position); |
|
|
|
return controlMotorCmd(Device.CLAW, Action.MOVE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 夹爪停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand clawStop() { |
|
|
|
return controlMotorCmd(Device.CLAW, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
// =========================================== 搅拌电机 ==================================================== |
|
|
|
|
|
|
|
/** |
|
|
|
* 搅拌电机 1 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stirMotor01ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return controlMotorCmd(Device.STIR_MOTOR_1, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 搅拌电机 1 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stirMotor01BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return controlMotorCmd(Device.STIR_MOTOR_1, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 搅拌电机 1 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stirMotor01Stop() { |
|
|
|
return controlMotorCmd(Device.STIR_MOTOR_1, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 搅拌电机 2 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stirMotor02ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return controlMotorCmd(Device.STIR_MOTOR_2, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 搅拌电机 2 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stirMotor02BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return controlMotorCmd(Device.STIR_MOTOR_2, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 搅拌电机 2 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stirMotor02Stop() { |
|
|
|
return controlMotorCmd(Device.STIR_MOTOR_2, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// =========================================== 步进泵 ==================================================== |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 1 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump01ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.STEP_PUMP_1, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 1 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump01BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.STEP_PUMP_1, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 1 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump01MoveBy() { |
|
|
|
return setInfoCmd(Device.STEP_PUMP_1, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 1 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump01Stop() { |
|
|
|
return setInfoCmd(Device.STEP_PUMP_1, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 2 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump02ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.STEP_PUMP_2, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 2 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump02BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.STEP_PUMP_2, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 2 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump02MoveBy() { |
|
|
|
return setInfoCmd(Device.STEP_PUMP_2, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 2 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump02Stop() { |
|
|
|
return setInfoCmd(Device.STEP_PUMP_2, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 3 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump03ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.STEP_PUMP_3, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 3 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump03BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.STEP_PUMP_3, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 3 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump03MoveBy() { |
|
|
|
return setInfoCmd(Device.STEP_PUMP_3, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 步进泵 3 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand stepPump03Stop() { |
|
|
|
return setInfoCmd(Device.STEP_PUMP_3, Action.STOP, null); |
|
|
|
} |
|
|
|
// =========================================== 无刷泵 ==================================================== |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 1 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump01ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_1, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 1 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump01BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_1, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 1 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump01MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_1, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 1 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump01Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_1, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 2 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump02ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_2, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 2 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump02BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_2, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 2 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump02MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_2, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 2 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump02Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_2, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 3 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump03ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_3, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 3 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump03BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_3, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 3 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump03MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_3, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 3 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump03Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_3, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 4 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump04ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_4, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 4 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump04BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_4, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 4 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump04MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_4, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 4 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump4Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_4, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 5 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump05ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_5, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 5 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump05BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_5, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 5 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump05MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_5, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 5 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump05Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_5, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 6 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump06ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_6, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 6 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump06BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_6, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 6 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump06MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_6, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 6 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump06Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_6, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 7 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump07ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_7, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 7 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump07BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_7, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 7 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump07MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_7, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 7 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump07Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_7, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 8 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump08ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_8, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 8 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump08BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_8, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 8 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump08MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_8, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 8 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump08Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_8, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 9 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump09ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_9, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 9 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump09BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_9, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 9 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump09MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_9, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 9 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump09Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_9, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 10 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump10ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_10, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 10 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump10BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_10, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 10 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump10MoveBy() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_10, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 无刷泵 10 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand brushlessPump10Stop() { |
|
|
|
return setInfoCmd(Device.BRUSHLESS_PUMP_10, Action.STOP, null); |
|
|
|
} |
|
|
|
// =========================================== 陶瓷泵 ==================================================== |
|
|
|
|
|
|
|
/** |
|
|
|
* 陶瓷泵 1 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand ceramicPump01ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.CERAMIC_PUMP_1, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 陶瓷泵 1 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand ceramicPump01BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.CERAMIC_PUMP_1, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 陶瓷泵 1 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand ceramicPump01MoveBy() { |
|
|
|
return setInfoCmd(Device.CERAMIC_PUMP_1, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 陶瓷泵 1 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand ceramicPump01Stop() { |
|
|
|
return setInfoCmd(Device.CERAMIC_PUMP_1, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 陶瓷泵 2 正向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand ceramicPump02ForwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.forward); |
|
|
|
return setInfoCmd(Device.CERAMIC_PUMP_2, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 陶瓷泵 2 反向旋转 |
|
|
|
*/ |
|
|
|
public static DeviceCommand ceramicPump02BackwardRotate() { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setDirection(MotorDirection.backward); |
|
|
|
return setInfoCmd(Device.CERAMIC_PUMP_2, Action.ROTATE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 陶瓷泵 1 相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand ceramicPump02MoveBy() { |
|
|
|
return setInfoCmd(Device.CERAMIC_PUMP_2, Action.MOVE_BY, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 陶瓷泵 2 停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand ceramicPump02Stop() { |
|
|
|
return setInfoCmd(Device.CERAMIC_PUMP_2, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
// =========================================== Z 轴升降电机 ==================================================== |
|
|
|
|
|
|
|
/** |
|
|
|
* z轴移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand zMove(Double position) { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setPosition(position); |
|
|
|
return controlMotorCmd(Device.Z_MOTOR, Action.MOVE, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* z轴相对移动 |
|
|
|
*/ |
|
|
|
public static DeviceCommand zMoveBy(Double position) { |
|
|
|
DeviceCommandParams params = new DeviceCommandParams(); |
|
|
|
params.setPosition(position); |
|
|
|
return controlMotorCmd(Device.Z_MOTOR, Action.MOVE_BY, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* z轴回原点 |
|
|
|
*/ |
|
|
|
public static DeviceCommand zOrigin() { |
|
|
|
return controlMotorCmd(Device.Z_MOTOR, Action.ORIGIN, null); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* z轴停止 |
|
|
|
*/ |
|
|
|
public static DeviceCommand zStop() { |
|
|
|
return controlMotorCmd(Device.Z_MOTOR, Action.STOP, null); |
|
|
|
} |
|
|
|
|
|
|
|
//===========================================PRIVATE==================================================================== |
|
|
|
|
|
|
|
/** |
|
|
|
* 控制设备电机指令 |
|
|
|
*/ |
|
|
|
private static DeviceCommand controlMotorCmd(Device device, Action action, DeviceCommandParams params) { |
|
|
|
return deviceCmd("controlMotorCmd", device, action, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置参数指令 |
|
|
|
*/ |
|
|
|
private static DeviceCommand setInfoCmd(Device device, Action action, DeviceCommandParams params) { |
|
|
|
return deviceCmd("setInfoCmd", device, action, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取参数指令 |
|
|
|
*/ |
|
|
|
private static DeviceCommand getInfoCmd(Device device) { |
|
|
|
return deviceCmd("getInfoCmd", device, Action.GET, null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 设备控制指令 |
|
|
|
*/ |
|
|
|
private static DeviceCommand controlCmd(Device device, Action action, DeviceCommandParams params) { |
|
|
|
return deviceCmd("controlCmd", device, action, params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设备指令包装 |
|
|
|
*/ |
|
|
|
private static DeviceCommand deviceCmd(String code, Device device, Action action, DeviceCommandParams params) { |
|
|
|
DeviceCommand deviceCommand = new DeviceCommand(); |
|
|
|
deviceCommand.setCmdCode(code); |
|
|
|
deviceCommand.setDevice(device); |
|
|
|
deviceCommand.setAction(action); |
|
|
|
deviceCommand.setParam(params); |
|
|
|
return deviceCommand; |
|
|
|
} |
|
|
|
} |