Erweiterungen
This commit is contained in:
1 parent
7015d83fd1
commit
6981cfbf8a
4 files changed
+56
-39
No files matched your search
@@ -140,11 +140,7 @@ class MqttCore {
|
||||
bool _publishText(String topic, String text, MqttQos qos, {bool enqueueOnError = true}) {
|
||||
try {
|
||||
var buffer = Uint8Buffer();
|
||||
if (kDebugMode) {
|
||||
buffer.addAll(const Utf8Encoder().convert(text));
|
||||
} else {
|
||||
buffer.addAll(GZipEncoder().encode(const Utf8Encoder().convert(text)) as Iterable<int>);
|
||||
}
|
||||
buffer.addAll(GZipEncoder().encode(const Utf8Encoder().convert(text)) as Iterable<int>);
|
||||
|
||||
var messageTopic = "$_toServerTopic$_clientId/$topic";
|
||||
|
||||
@@ -178,12 +174,7 @@ class MqttCore {
|
||||
Util.logInfo('message received\ntopic: $topic\n');
|
||||
Util.logInfo("size in bytes: ${message.payload.message.length.toString()}");
|
||||
|
||||
String payload;
|
||||
if (kDebugMode) {
|
||||
payload = utf8.decode(message.payload.message);
|
||||
} else {
|
||||
payload = utf8.decode(GZipDecoder().decodeBytes(message.payload.message));
|
||||
}
|
||||
var payload = utf8.decode(GZipDecoder().decodeBytes(message.payload.message));
|
||||
|
||||
Util.logInfo('$topic\nmessage: $payload');
|
||||
|
||||
@@ -453,8 +444,8 @@ class MqttCore {
|
||||
var bootstrapResponsePayload = BootstrapResponse.fromJson(jsonDecode(responseText));
|
||||
|
||||
var brokerUriAndPortArray = bootstrapResponsePayload.broker.replaceFirst("mqtt://", "").split(":");
|
||||
_brokerUri = "192.168.180.27"; //brokerUriAndPortArray[0];
|
||||
_brokerPort = 1883; //int.parse(brokerUriAndPortArray[1]);
|
||||
_brokerUri = brokerUriAndPortArray[0];
|
||||
_brokerPort = int.parse(brokerUriAndPortArray[1]);
|
||||
_clientId = bootstrapResponsePayload.id;
|
||||
_fromServerTopic = bootstrapResponsePayload.fromServer;
|
||||
_toServerTopic = bootstrapResponsePayload.toServer;
|
||||
|
||||
Reference in new issue
Block a user