1
0

设备mqtt收发数据

This commit is contained in:
2025-07-30 08:50:44 +08:00
parent 2b2edf096d
commit ac353b1078
21 changed files with 679 additions and 105 deletions

View File

@ -0,0 +1,78 @@
package com.fuyuanshen.global.mqtt.constants;
/**
* 设备命令类型常量
* Device Command Type Constants
*/
public class DeviceCommandTypeConstants {
/**
* 灯光模式 (Light Mode)
*/
public static final int LIGHT_MODE = 1;
/**
* 人员信息 (Personnel Information)
*/
public static final int PERSONNEL_INFO = 2;
/**
* 开机LOGO (Boot Logo)
*/
public static final int BOOT_LOGO = 3;
/**
* 激光灯 (Laser Light)
*/
public static final int LASER_LIGHT = 4;
/**
* 主灯亮度 (Main Light Brightness)
*/
public static final int MAIN_LIGHT_BRIGHTNESS = 5;
/**
* 定位数据 (Location Data)
*/
public static final int LOCATION_DATA = 11;
/**
* 获取命令类型描述
*
* @param commandType 命令类型
* @return 命令类型描述
*/
public static String getCommandTypeDescription(int commandType) {
switch (commandType) {
case LIGHT_MODE:
return "灯光模式 (Light Mode)";
case PERSONNEL_INFO:
return "人员信息 (Personnel Information)";
case BOOT_LOGO:
return "开机LOGO (Boot Logo)";
case LASER_LIGHT:
return "激光灯 (Laser Light)";
case MAIN_LIGHT_BRIGHTNESS:
return "主灯亮度 (Main Light Brightness)";
case LOCATION_DATA:
return "定位数据 (Location Data)";
default:
return "未知命令类型 (Unknown Command Type)";
}
}
/**
* 检查是否为有效命令类型
*
* @param commandType 命令类型
* @return 是否有效
*/
public static boolean isValidCommandType(int commandType) {
return commandType == LIGHT_MODE ||
commandType == PERSONNEL_INFO ||
commandType == BOOT_LOGO ||
commandType == LASER_LIGHT ||
commandType == MAIN_LIGHT_BRIGHTNESS ||
commandType == LOCATION_DATA;
}
}

View File

@ -0,0 +1,16 @@
package com.fuyuanshen.global.mqtt.constants;
public interface MqttConstants {
/**
* 全局发布消息的key
*/
String GLOBAL_PUB_KEY = "B/";
/**
* 全局订阅消息的key
*/
String GLOBAL_SUB_KEY = "A/";
}