Erweiterungen
This commit is contained in:
1 parent
6981cfbf8a
commit
7a681ddcc6
7 files changed
+52
-12
No files matched your search
@@ -4,7 +4,6 @@ import 'dart:math';
|
||||
|
||||
import 'package:archive/archive.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:mqtt_client/mqtt_client.dart';
|
||||
@@ -151,8 +150,12 @@ class MqttCore {
|
||||
|
||||
return true;
|
||||
} catch (ex) {
|
||||
Util.logInfo("send failed!");
|
||||
|
||||
if (enqueueOnError) {
|
||||
_enqueueMessage(topic, text);
|
||||
|
||||
Util.logInfo("message enqueued");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,14 +446,23 @@ class MqttCore {
|
||||
|
||||
var bootstrapResponsePayload = BootstrapResponse.fromJson(jsonDecode(responseText));
|
||||
|
||||
var brokerUriAndPortArray = bootstrapResponsePayload.broker.replaceFirst("mqtt://", "").split(":");
|
||||
_brokerUri = brokerUriAndPortArray[0];
|
||||
_brokerPort = int.parse(brokerUriAndPortArray[1]);
|
||||
_clientId = bootstrapResponsePayload.id;
|
||||
_fromServerTopic = bootstrapResponsePayload.fromServer;
|
||||
_toServerTopic = bootstrapResponsePayload.toServer;
|
||||
var status = bootstrapResponsePayload.status;
|
||||
var message = bootstrapResponsePayload.message;
|
||||
|
||||
_connectToBroker();
|
||||
if (status > 0) {
|
||||
showAlertDialog(MyApp.appNavigatorKey.currentContext!, status == 1 ? "Information" : "Fehler", message);
|
||||
}
|
||||
|
||||
if (status < 2) {
|
||||
var brokerUriAndPortArray = bootstrapResponsePayload.broker.replaceFirst("mqtt://", "").split(":");
|
||||
_brokerUri = brokerUriAndPortArray[0];
|
||||
_brokerPort = int.parse(brokerUriAndPortArray[1]);
|
||||
_clientId = bootstrapResponsePayload.id;
|
||||
_fromServerTopic = bootstrapResponsePayload.fromServer;
|
||||
_toServerTopic = bootstrapResponsePayload.toServer;
|
||||
|
||||
_connectToBroker();
|
||||
}
|
||||
} catch (ex) {
|
||||
Util.logException("bootstrap failed: {$ex}");
|
||||
|
||||
|
||||
Reference in new issue
Block a user