Erweiterungen
This commit is contained in:
1 parent
1a659be3b8
commit
b393c12f89
1 file changed
+14
-15
+14
-15
@@ -187,8 +187,8 @@ class MqttCore {
|
||||
//_rankingMessageReceived(payloadData);
|
||||
break;
|
||||
|
||||
case 'jobs':
|
||||
//_jobMessageReceived(payloadData);
|
||||
case 'job':
|
||||
_jobMessageReceived(messageData);
|
||||
break;
|
||||
|
||||
case 'job_del':
|
||||
@@ -214,6 +214,7 @@ class MqttCore {
|
||||
|
||||
_mqttClient.subscribe(_fromServerTopic + "/session", MqttQos.exactlyOnce);
|
||||
_mqttClient.subscribe(_fromServerTopic + "/status", MqttQos.exactlyOnce);
|
||||
_mqttClient.subscribe(_fromServerTopic + "/job", MqttQos.exactlyOnce);
|
||||
Util.logInfo('subscribed to topic: $_fromServerTopic');
|
||||
|
||||
MessageService().publish<ConnectionStatus>(Constants.messageTopicConnectionStatusChanged, arguments: ConnectionStatus(status: ConnectionStatusEnum.connected));
|
||||
@@ -260,23 +261,21 @@ class MqttCore {
|
||||
}
|
||||
|
||||
void _jobMessageReceived(payloadData) async {
|
||||
for (var foundJobData in payloadData) {
|
||||
Job newJob = Job.fromJson(foundJobData);
|
||||
Job newJob = Job.fromJson(payloadData);
|
||||
|
||||
MyApp.isarInstance.writeTxnSync(() async {
|
||||
MyApp.isarInstance.jobs.putSync(newJob);
|
||||
});
|
||||
MyApp.isarInstance.writeTxnSync(() async {
|
||||
MyApp.isarInstance.jobs.putSync(newJob);
|
||||
});
|
||||
|
||||
if (newJob.state == Constants.stateAssigned) {
|
||||
if (newJob.global) {
|
||||
await Util.playMp3('aaa.mp3');
|
||||
} else {
|
||||
await Util.playMp3('job_received.mp3');
|
||||
}
|
||||
if (newJob.state == Constants.stateAssigned) {
|
||||
if (newJob.global) {
|
||||
await Util.playMp3('aaa.mp3');
|
||||
} else {
|
||||
await Util.playMp3('job_received.mp3');
|
||||
}
|
||||
|
||||
MessageService().publish<JobReceivedMessage>(Constants.messageTopicJobReceived, arguments: JobReceivedMessage(job: newJob));
|
||||
}
|
||||
|
||||
MessageService().publish<JobReceivedMessage>(Constants.messageTopicJobReceived, arguments: JobReceivedMessage(job: newJob));
|
||||
}
|
||||
|
||||
void _jobDeleteReceived(List<dynamic> payloadData) async {
|
||||
|
||||
Reference in new issue
Block a user