feat(iot-gateway): JT808 新增 instruction_config 服务并修正 TTS 标志

1. 新增 instruction_config 服务
   - 用于下发服务指令配置(如 #2014*SET*TTS0:...#)
   - 使用 0x01 标志位(静默执行),设备解析后不发声
   - 通过文本信息下发 (0x8300) 发送

2. 修正 TTS 服务默认标志
   - 默认 tts_flag 从 4 改为 0x08(普通通知)
   - 日志输出改为十六进制格式 (0x08, 0x09)

JT808 播报标志规范:
- 0x01: 静默执行(配置指令)
- 0x08: TTS 普通通知
- 0x09: TTS 紧急通知

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
lzh
2026-01-22 09:58:01 +08:00
parent a4cfbbcba1
commit b1ecc7786b

View File

@@ -443,12 +443,20 @@ public class IotJt808DeviceMessageCodec implements IotDeviceMessageCodec {
case "TTS" -> {
// 语音播报服务 -> JT808 文本信息下发 (0x8300)
String ttsText = (String) serviceParams.getOrDefault("tts_text", "");
int ttsFlag = ((Number) serviceParams.getOrDefault("tts_flag", 4)).intValue(); // 默认 4-TTS 播读
log.info("[encodeServiceInvoke][TTS 语音播报] phone={}, flag={}, text={}", phone, ttsFlag, ttsText);
int ttsFlag = ((Number) serviceParams.getOrDefault("tts_flag", 0x08)).intValue();
log.info("[encodeServiceInvoke][TTS 语音播报] phone={}, flag=0x{}, text={}",
phone, Integer.toHexString(ttsFlag), ttsText);
yield encoder.encodeTextInfoDown(phone, (byte) ttsFlag, ttsText, flowId);
}
case "instruction_config" -> {
// 服务指令配置 -> JT808 文本信息下发 (0x8300), 静默执行
// 异步调用,设备收到后解析指令,修改参数,回复 0x0001但不发声
String config = (String) serviceParams.getOrDefault("config", "");
log.info("[encodeServiceInvoke][服务指令配置] phone={}, config={}", phone, config);
yield encoder.encodeTextInfoDown(phone, (byte) 0x01, config, flowId);
}
case "locationQuery" -> {
// 位置查询服务 -> JT808 位置信息查询 (0x8201)
log.info("[encodeServiceInvoke][位置查询] phone={}", phone);