1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- """
- 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: Forward to frontend in json format
- pass
-
-
- def data_battery(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- # TODO: Forward to frontend in json format
- pass
-
-
- # FrontEnd Channel Reactions
-
- def action_drive(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- # TODO: ROBOT READY CHECK
- client.publish(Topics['ROBOT_ACTION_DRIVE'], message.payload).decode("utf-8")
-
-
- def action_getposition(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- client.publish(Topics['ROBOT_ACTION_GETPOSITION'])
-
-
- def action_getbattery(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- client.publish(Topics['ROBOT_ACTION_GETBATTERY'])
-
-
- def action_getalldata(client: mqtt.Client, userdata, message: mqtt.MQTTMessage):
- # TODO: get data from database
- pass
|