handleDebugMessage method
处理调试消息
Implementation
void handleDebugMessage(Map<String, dynamic> payload) {
try {
var debugMessage = DebugMessage.fromJson(payload);
if (debugMessage.event == MessageAction.debug) {
debugCallbackMessage.value = DebugCallbackMessage(
event: MessageEvent.debugCallback,
debugId: debugMessage.debugId,
debugColor: debugMessage.debugColor,
);
// TODO: 通知调试界面
debugColor.value = hexToColor(debugMessage.debugColor);
debugColor.refresh();
var message = jsonEncode(debugCallbackMessage.value!.toJson());
client.publish(
'${deviceType.value}/${MessageAction.debugCallback}/${deviceId.value}',
message,
);
}
} catch (e, st) {
log("[handleDebugMessage] 消息处理失败", error: e, stackTrace: st);
}
}