1
0

设备mqtt收发数据

This commit is contained in:
2025-07-30 17:13:57 +08:00
parent ac353b1078
commit a119ccc8d6
13 changed files with 238 additions and 115 deletions

View File

@ -1,78 +0,0 @@
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,76 @@
package com.fuyuanshen.global.mqtt.constants;
/**
* 设备命令类型常量
* Device Command Type Constants
*/
public class LightingCommandTypeConstants {
/**
* 灯光模式 (Light Mode)
*/
public static final String LIGHT_MODE = "Light_1";
/**
* 人员信息 (Personnel Information)
*/
public static final String PERSONNEL_INFO = "Light_2";
/**
* 开机LOGO (Boot Logo)
*/
public static final String BOOT_LOGO = "Light_3";
/**
* 激光灯 (Laser Light)
*/
public static final String LASER_LIGHT = "Light_4";
/**
* 主灯亮度 (Main Light Brightness)
*/
public static final String MAIN_LIGHT_BRIGHTNESS = "Light_5";
/**
* 定位数据 (Location Data)
*/
public static final String LOCATION_DATA = "Light_11";
/**
* 主动上报设备数据 (Active Reporting Device Data)
*/
public static final String ACTIVE_REPORTING_DEVICE_DATA = "Light_12";
/**
* 获取命令类型描述
*
* @param commandType 命令类型
* @return 命令类型描述
*/
public static String getCommandTypeDescription(String commandType) {
return switch (commandType) {
case LIGHT_MODE -> "灯光模式 (Light Mode)";
case PERSONNEL_INFO -> "人员信息 (Personnel Information)";
case BOOT_LOGO -> "开机LOGO (Boot Logo)";
case LASER_LIGHT -> "激光灯 (Laser Light)";
case MAIN_LIGHT_BRIGHTNESS -> "主灯亮度 (Main Light Brightness)";
case LOCATION_DATA -> "定位数据 (Location Data)";
default -> "未知命令类型 (Unknown Command Type)";
};
}
/**
* 检查是否为有效命令类型
*
* @param commandType 命令类型
* @return 是否有效
*/
public static boolean isValidCommandType(String commandType) {
return commandType.equals(LIGHT_MODE) ||
commandType.equals(PERSONNEL_INFO) ||
commandType.equals(BOOT_LOGO) ||
commandType.equals(LASER_LIGHT) ||
commandType.equals(MAIN_LIGHT_BRIGHTNESS) ||
commandType.equals(LOCATION_DATA);
}
}