From 1bf6e76e31383aef77e42943fc2caf350cf7e096 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Mon, 06 Apr 2026 13:35:05 +0200
Subject: [PATCH] fix: resume message reload, direct session writes, MQTT trace pipe to server

---
 lib/services/mqtt_service.dart |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/lib/services/mqtt_service.dart b/lib/services/mqtt_service.dart
index 618a00e..ba6056e 100644
--- a/lib/services/mqtt_service.dart
+++ b/lib/services/mqtt_service.dart
@@ -11,6 +11,7 @@
 import 'package:path_provider/path_provider.dart' as pp;
 import 'package:mqtt_client/mqtt_client.dart';
 import 'package:mqtt_client/mqtt_server_client.dart';
+import 'package:typed_data/typed_data.dart';
 import 'package:shared_preferences/shared_preferences.dart';
 import 'package:uuid/uuid.dart';
 
@@ -665,6 +666,15 @@
   /// Current timestamp in milliseconds.
   int _now() => DateTime.now().millisecondsSinceEpoch;
 
+  /// Publish raw bytes to a topic. Used by TraceService for log streaming.
+  void publishRaw(String topic, Uint8Buffer payload, MqttQos qos) {
+    final client = _client;
+    if (client == null || client.connectionStatus?.state != MqttConnectionState.connected) return;
+    try {
+      client.publishMessage(topic, qos, payload);
+    } catch (_) {}
+  }
+
   /// Publish a JSON payload to an MQTT topic.
   void _publish(String topic, Map<String, dynamic> payload, MqttQos qos) {
     final client = _client;

--
Gitblit v1.3.1