|
|
|
|
|
|
|
|
|
|
|
|
|
|
This file contains all functions, which handle the different cases. |
|
|
This file contains all functions, which handle the different cases. |
|
|
Every function should return json format with the wanted data from the database |
|
|
Every function should return json format with the wanted data from the database |
|
|
""" |
|
|
|
|
|
|
|
|
""" |
|
|
|
|
|
import paho.mqtt.client as mqtt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def data_handler(client: mqtt.Client, message) -> dict: |
|
|
|
|
|
""" |
|
|
|
|
|
main entrypoint for a message handling method |
|
|
|
|
|
:param client: |
|
|
|
|
|
:param message: |
|
|
|
|
|
:return: |
|
|
|
|
|
""" |
|
|
|
|
|
if message.topic.startwith('BackEnd'): |
|
|
|
|
|
|
|
|
|
|
|
if message.topic == "BackEnd/Action/All": |
|
|
|
|
|
action_all(client, message) |
|
|
|
|
|
elif message.topic == "BackEnd/Action/GetPosition": |
|
|
|
|
|
action_get_position(client, message) |
|
|
|
|
|
elif message.topic == "BackEnd/Action/GetBattery": |
|
|
|
|
|
action_get_battery(client, message) |
|
|
|
|
|
elif message.topic == "BackEnd/Action/GetAllData": |
|
|
|
|
|
action_get_all_data(client, message) |
|
|
|
|
|
|
|
|
|
|
|
elif message.topic.startwith('Robot'): |
|
|
|
|
|
|
|
|
|
|
|
if message.topic == "Robot/Data/SensorData": |
|
|
|
|
|
data_sensordata(client, message) |
|
|
|
|
|
elif message.topic == "Robot/Data/Position": |
|
|
|
|
|
data_position(client, message) |
|
|
|
|
|
elif message.topic == "Robot/Data/Battery": |
|
|
|
|
|
data_battery(client, message) |
|
|
|
|
|
elif message.topic == "Robot/Data/Picture": |
|
|
|
|
|
data_picture(client, message) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# START ACTION FUNCTION DEFINITIONS |
|
|
|
|
|
|
|
|
|
|
|
def action_all(client, message): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def action_get_position(client, message): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def action_get_battery(client, message): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def action_get_all_data(client, message): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# END ACTION FUNCTION DEFINITIONS |
|
|
|
|
|
|
|
|
|
|
|
# START ROBOT FUNCTION DEFINITIONS |
|
|
|
|
|
|
|
|
|
|
|
def data_sensordata(client, message): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def data_position(client, message): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def data_battery(client, message): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def data_picture(client, message): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
# END ROBOT FUNCTION DEFINITIONS |