Newer
Older
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''REST API for Rotator related operations'''
# Third-party modules
from flask import request
from .baseresource import ResourceDev
'''Field derotator position.'''
def get(self):
'''Retrieve the field derotator position.'''
res = {
"response": self.dev.position,
"error": self.dev.error,
}
return res
# @api.route("/rotator/movement")
class RotatorMovement(ResourceDev):
'''Manage the field derotator position.'''
def get(self):
'''Check if the field derotator is moving.'''
res = {
"response": self.dev.is_moving,
"error": self.dev.error,
}
return res
def post(self):
'''Set the field derotator to a new position.'''
"response": self.dev.position,
"error": self.dev.error,
'''Manage the connection to ASCOM.'''
def get(self):
'''Check if the rotator is connected.'''
res = {
"response": self.dev.connection,
"error": self.dev.error,
}
return res
def put(self):
'''Connect or disconnect the rotator.'''
self.dev.connection = connection
res = {
"response": self.dev.connection,
"error": self.dev.error,
}
return res