1
0
Fork 0
A REST-API built with Flask and Python. Its main purpose is to receive the readings from the light meters welding booths in the Ritherdon factory and make them available for consumption by the relay-controllers in the gallery.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

37 lines
1.3 KiB

from services import post_services, get_services
'''
API Functions
======================================================================
These functions are what are exposed/referenced in the swagger.yml
file -- they are essentially wrapper functions. The main work is done
in the files in the /services/ folder.
These functions are acting as very light controllers essentially.
'''
def post_a_reading(light_meter, the_reading):
return post_services.add_latest_reading(light_meter, the_reading)
def post_a_status_change(device, the_status_change):
return post_services.log_status_change(device, the_status_change)
def get_latest(light_meter):
return get_services.get_latest_reading(light_meter)
def get_all_readings(light_meter):
return get_services.get_all_readings_from_table(light_meter)
def get_all_readings_for_every_meter():
return get_services.get_all_readings_from_database()
def get_latest_device_status(device):
return get_services.get_latest_status(device)
def get_all_status_log(device):
return get_services.get_all_status_logs_from_table(device)
def get_all_status_logs_for_every_device():
return get_services.get_all_status_changes_from_database()
def get_current_status_for_all_devices():
return get_services.get_latest_status_for_all_devices()