|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- """
- created by caliskan at 19.04.2023
-
- This file contains all functions, which handle the different cases.
- Every function should return json format with the wanted data from the database
- """
- import paho.mqtt.client as mqtt
- from plantdatabase import PlantDataBase
- from software.defines import Topics
-
-
- # Robot Channel Reactions
-
- def data_sensordata(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- print("message received")
- # TODO: Store data in database
- pass
-
-
- def data_position(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- # TODO: Publish as json
- pass
-
-
- def data_battery(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- # TODO: Publish as json
- pass
-
-
- # FrontEnd Channel Reactions
-
- def action_drive(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- client.publish('Robot/Action/Drive', message.payload).decode("utf-8")
-
-
- def action_getposition(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- client.publish('Robot/Action/GetPosition')
-
-
- def action_getbattery(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- client.publish(Topics.drive)
-
-
- def action_getalldata(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- # TODO: get data from database
- pass
|