Newer
Older
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''REST API for Focuser related operations'''
# Third-party modules
from flask import request
from .baseresource import ResourceDev
'''Secondary mirror position.'''
def get(self):
'''Retrieve the secondary mirror position.'''
res = {
"response": self.dev.position,
"error": self.dev.error,
}
return res
# @api.route("/focuser/movement")
class FocuserMovement(ResourceDev):
'''Manage the secondary mirror position.'''
def get(self):
'''Check if the secondary mirror is moving.'''
res = {
"response": self.dev.is_moving,
"error": self.dev.error,
}
return res
def put(self):
'''Update the secondary mirror position.'''
"response": self.dev.position,
"error": self.dev.error,
}
return res
# def delete(self):
# '''Stop the movement.'''
# return
'''Manage the connection to ASCOM.'''
def get(self):
'''Check if the focuser is connected.'''
res = {
"response": self.dev.connection,
"error": self.dev.error,
}
return res
def put(self):
'''Connect or disconnect the focuser.'''
self.dev.connection = connection
res = {
"response": self.dev.connection,
"error": self.dev.error,
}
return res