| | |
| | | package com.zy.acs.common.domain.protocol; |
| | | package com.example.agvcontroller.protocol; |
| | | |
| | | import com.zy.acs.common.utils.Utils; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import com.example.agvcontroller.action.AgvCompleteType; |
| | | import com.example.agvcontroller.action.CommonConstant; |
| | | import com.example.agvcontroller.socket.RadixTools; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | * 动作命令包 |
| | | * Created by vincent on 2023/3/21 |
| | | */ |
| | | @Data |
| | | public class AGV_02_DOWN implements IMessageBody, Serializable { |
| | | |
| | | private static final long serialVersionUID = 1664188062202647371L; |
| | |
| | | public byte[] writeToBytes() { |
| | | String serialNo = Utils.zeroFill(this.serialNo, 16); |
| | | byte[] serialNoBytes = Utils.reverse(serialNo.getBytes()); |
| | | byte cmdCodeByte = (byte) this.getCmdCode(); |
| | | byte valByte = (byte) this.getVal(); |
| | | //byte cmdCodeByte = (byte) this.getCmdCode(); |
| | | byte cmdCodeByte = (byte) 1; |
| | | //byte valByte = (byte) this.getVal(); |
| | | byte valByte = (byte) 1; |
| | | |
| | | byte[] cmdBodyBytes = commandBody.writeToBytes(); |
| | | |
| | |
| | | |
| | | @Override |
| | | public void readFromBytes(byte[] messageBodyBytes) { |
| | | try { |
| | | this.serialNo = new String(Utils.sliceWithReverse(messageBodyBytes, 0, 16)); |
| | | |
| | | this.cmdCode = Utils.slice(messageBodyBytes, 16, 1)[0]; |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | |
| | | // 流水号 - 16 |
| | |
| | | // 动作参数 |
| | | private ICommandBody commandBody; |
| | | |
| | | public String getSerialNo() { |
| | | return serialNo; |
| | | } |
| | | |
| | | public void setSerialNo(String serialNo) { |
| | | this.serialNo = serialNo; |
| | | } |
| | | |
| | | public int getCmdCode() { |
| | | return cmdCode; |
| | | } |
| | | |
| | | public void setCmdCode(int cmdCode) { |
| | | this.cmdCode = cmdCode; |
| | | } |
| | | |
| | | public int getVal() { |
| | | return val; |
| | | } |
| | | |
| | | public void setVal(int val) { |
| | | this.val = val; |
| | | } |
| | | |
| | | public ICommandBody getCommandBody() { |
| | | return commandBody; |
| | | } |
| | | |
| | | public void setCommandBody(ICommandBody commandBody) { |
| | | this.commandBody = commandBody; |
| | | } |
| | | } |