This commit is contained in:
2026-04-17 10:32:57 +08:00
parent 572ad1205f
commit 17c52c978c
691 changed files with 72342 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
package com.maibu.dto;
import lombok.Data;
import java.util.Date;
@Data
public class DeviceRunningStatus {
private String deviceId;
private String voltage; //电压
private String leftTargetSpeed; // 左轮目标速度
private String rightTargetSpeed;// 右轮目标速度
private String leftMeasureSpeed;// 左轮测量速度
private String rightMeasureSpeed;// 右轮测量速度
private String leftCurrent;// 左轮电流
private String rightCurrent;// 右轮电流
private String leftMotorTemp;// 左轮温度
private String rightMotorTemp;// 右轮温度
private String chipTemp;//芯片温度
private String yaw;//偏航角
private String pitch;//仰俯角
private String roll;//翻滚角
private String satelliteCnt;//跟踪的卫星数
private String qual;//定位质量
private String headingStatus;//航向角状态
private String latitude;//纬度
private String longitude;//经度
private Date time;
private String cuttingSpeed;//割刀速度
private String controlMode;//控制模式
private String battery;//电池电量
private String workingArea;//作业面积
private String obstacleSign;//障碍物标志位
private Date createTime;
}

View File

@@ -0,0 +1,10 @@
package com.maibu.dto;
import lombok.Data;
@Data
public class DeviceStatusDetail {
private String name;
private String value;
private String unit;
}

View File

@@ -0,0 +1,97 @@
package com.maibu.dto;
import lombok.Data;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@Data
public class LawnMoverProtocolEntity {
public LawnMoverProtocolEntity() {
Header1 = (byte) 0xAB;
Header2 = (byte) 0xAA;
CommandType = 0x00;
LeftWheelSpeed = 0x0000;
RightWheelSpeed = 0x0000;
ChassisLiftFlag = 0x00;
MowerSpeedFlag = 0x00;
IgnitionFlag = 0x00;
EmergencyStopFlag = 0x00;
Crc16 = 0x0000;
EndFlag1 = (byte) 0xAA;
EndFlag2 = (byte) 0xAB;
}
@Override
public String toString() {
return "LawnMoverProtocolEntity{" +
"Header1=" + Header1 +
", Header2=" + Header2 +
", CommandType=" + CommandType +
", LeftWheelSpeed=" + LeftWheelSpeed +
", RightWheelSpeed=" + RightWheelSpeed +
", ChassisLiftFlag=" + ChassisLiftFlag +
", MowerSpeedFlag=" + MowerSpeedFlag +
", IgnitionFlag=" + IgnitionFlag +
", EmergencyStopFlag=" + EmergencyStopFlag +
", Crc16=" + Crc16 +
", EndFlag1=" + EndFlag1 +
", EndFlag2=" + EndFlag2 +
'}';
}
public byte[] toBytes() {
ByteBuffer buffer = ByteBuffer.allocate(15);
buffer.order(ByteOrder.LITTLE_ENDIAN); // 根据协议决定字节序
buffer.put(Header1);
buffer.put(Header2);
buffer.put(CommandType);
buffer.putShort(LeftWheelSpeed);
buffer.putShort(RightWheelSpeed);
buffer.put(ChassisLiftFlag);
buffer.put(MowerSpeedFlag);
buffer.put(IgnitionFlag);
buffer.put(EmergencyStopFlag);
buffer.putShort(Crc16); // 如果要计算真实 CRC16 可在此插入计算逻辑
buffer.put(EndFlag1);
buffer.put(EndFlag2);
return buffer.array();
}
public static String printBytesToHex(byte[] bytes) {
StringBuilder sb = new StringBuilder(bytes.length * 3);
for (byte b : bytes) {
sb.append(String.format("%02X ", b));
}
return sb.toString().trim();
}
// 包头起始字节1
private byte Header1;
// 包头起始字节2
private byte Header2;
// 指令类型
private byte CommandType;
// 左轮速度:16位有符号
private short LeftWheelSpeed;
// 右轮速度:16位有符号
private short RightWheelSpeed;
// 底盘升降标志位
private byte ChassisLiftFlag;
// 割刀速度标志位
private byte MowerSpeedFlag;
// 点火标志位
private byte IgnitionFlag;
// 保留位
private byte EmergencyStopFlag;
// Crc校验
private short Crc16;
// 包尾字节1
private byte EndFlag1;
// 包尾字节2
private byte EndFlag2;
}

View File

@@ -0,0 +1,15 @@
package com.maibu.dto;
public enum MesType {
AUTH, //登录连接权限web->be
deviceInfo, //设备状态 be->web
path,//路径下发 web->be
have_logged_in,//消息
device_status_changed,//上下线状态变化
device_error_push, //错误推送
heartbeat,
remoteControl,
detectionReport,//障碍物消息
switchPermission,//切换控制申请
switchResult;//切换结果
}

View File

@@ -0,0 +1,26 @@
package com.maibu.dto;
import lombok.Data;
@Data
public class NettySwitchDeviceDTO {
/**
* 主机名
*/
private String platform;
/**
* 设备id
*/
private String deviceId;
/**
* 设备别名
*/
private String deviceAlias;
/**
* 用户名
*/
private String userId;
}

View File

@@ -0,0 +1,9 @@
package com.maibu.dto;
import lombok.Data;
@Data
public class ObstacleMessageDTO {
private String data;
private MesType type;
}

View File

@@ -0,0 +1,14 @@
package com.maibu.dto;
import lombok.Data;
import java.util.List;
@Data
public class RemoteData {
private List<Double> axes;
private List<Boolean> buttons;
private Boolean connected;
}

View File

@@ -0,0 +1,10 @@
package com.maibu.dto;
import lombok.Data;
@Data
public class ResultDTO {
private Object code;
private String msg;
private Object data;
}

View File

@@ -0,0 +1,12 @@
package com.maibu.dto;
import lombok.Data;
@Data
public class WebAuthResponseDTO {
private String userName;
private String deviceId;
private String platform;
private Boolean isAuth;
private MesType type;
}

View File

@@ -0,0 +1,10 @@
package com.maibu.dto;
import lombok.Data;
@Data
public class WebHasLoginDTO {
private MesType type;
private String userName;
private String token;
}

View File

@@ -0,0 +1,14 @@
package com.maibu.dto;
import lombok.Data;
@Data
public class WebMessageBaseDTO {
private MesType type;
private String userName;
private String deviceId;
private String token;
private String message;
private RemoteData remoteData;
private Boolean switchResult;
}

View File

@@ -0,0 +1,13 @@
package com.maibu.dto;
import lombok.Data;
@Data
public class WebOlineStatusMessageDTO {
private String deviceId;
private Integer onlineStatus;
private Integer hasError;
private String errorCode;
private String description;
private MesType type;
}

View File

@@ -0,0 +1,11 @@
package com.maibu.dto;
import lombok.Data;
import java.util.List;
@Data
public class WebStatusMessageDTO {
private List<DeviceStatusDetail> data;
private MesType type;
}

View File

@@ -0,0 +1,9 @@
package com.maibu.dto;
import lombok.Data;
@Data
public class WebSwitchControlResponseDTO {
private DeviceRespondDTO respond;
private MesType type;
}