|
|
|
|
|
|
|
|
console.error('Error:', err); |
|
|
console.error('Error:', err); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// this.mqttService.subscribeToTopic("BACKEND/DATA/POSITION").subscribe(data => { |
|
|
|
|
|
// if (typeof data !== "object") { |
|
|
|
|
|
// const payload = JSON.parse(data) as Position; |
|
|
|
|
|
// this.mqttSetDataService.setRobotPosition(payload); |
|
|
|
|
|
// } |
|
|
|
|
|
// }, err => { |
|
|
|
|
|
// this.dialog.open(ErrorDialogComponent, { |
|
|
|
|
|
// data: err, |
|
|
|
|
|
// width: '400px', |
|
|
|
|
|
// }); |
|
|
|
|
|
// console.error('Error:', err); |
|
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
|
|
this.mqttService.subscribeToTopic("BACKEND/DATA/BATTERY").subscribe(data => { |
|
|
this.mqttService.subscribeToTopic("BACKEND/DATA/BATTERY").subscribe(data => { |
|
|
if (typeof data !== "object") { |
|
|
if (typeof data !== "object") { |
|
|
const payload = JSON.parse(data) as RobotBattery; |
|
|
const payload = JSON.parse(data) as RobotBattery; |
|
|
|
|
|
|
|
|
console.error('Error:', err); |
|
|
console.error('Error:', err); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// this.mqttService.subscribeToTopic("BACKEND/DATA/PICTURE").subscribe(data => { |
|
|
|
|
|
// if (typeof data !== "object") { |
|
|
|
|
|
// const payload = JSON.parse(data) as Plant; |
|
|
|
|
|
// this.mqttSetDataService.setDataPlant(payload); |
|
|
|
|
|
// } |
|
|
|
|
|
// }, err => { |
|
|
|
|
|
// console.error('Error:', err); |
|
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
|
|
//Request to get ALL DATA every 10sec!! |
|
|
|
|
|
// this.timerSubscription = timer(0, 10000).pipe( |
|
|
|
|
|
// map(() => { |
|
|
|
|
|
// this.mqttService.publishToTopic('BACKEND/ACTION/GETALLDATA'); |
|
|
|
|
|
// }) |
|
|
|
|
|
// ).subscribe(); |
|
|
|
|
|
|
|
|
|
|
|
//Publish to the Topic to recieve the first Data |
|
|
//Publish to the Topic to recieve the first Data |
|
|
this.publishToPLANTCOUNT(); |
|
|
this.publishToPLANTCOUNT(); |
|
|
this.publishToGETBATTERY(); |
|
|
this.publishToGETBATTERY(); |
|
|
|
|
|
|
|
|
publishToGETALLDATA() { |
|
|
publishToGETALLDATA() { |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/GETALLDATA', JSON.stringify(this.storeService.getAllPlantNames())); |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/GETALLDATA', JSON.stringify(this.storeService.getAllPlantNames())); |
|
|
} |
|
|
} |
|
|
publishToDRIVE() { |
|
|
|
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/DRIVE'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
publishToGETBATTERY() { |
|
|
publishToGETBATTERY() { |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/GETBATTERY'); |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/GETBATTERY'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
publishToROBOTREADY() { |
|
|
publishToROBOTREADY() { |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/ROBOTREADY'); |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/ROBOTREADY'); |
|
|
} |
|
|
} |
|
|
publishToGETPOSITION() { |
|
|
|
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/GETPOSITION'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
publishToNEWPLANT(plant: Plant) { |
|
|
publishToNEWPLANT(plant: Plant) { |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/NEWPLANT', JSON.stringify(plant)); |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/NEWPLANT', JSON.stringify(plant)); |
|
|
|
|
|
|
|
|
publishToPLANTCOUNT() { |
|
|
publishToPLANTCOUNT() { |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/PLANTCOUNT'); |
|
|
this.mqttService.publishToTopic('BACKEND/ACTION/PLANTCOUNT'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* publishToINPUT wird die Spracheingabe übermittelt, die dann mit |
|
|
* publishToINPUT wird die Spracheingabe übermittelt, die dann mit |
|
|
* mehreren if else anweisungen einen Request an das Backend sendet und |
|
|
* mehreren if else anweisungen einen Request an das Backend sendet und |