Blame view

src/core/pyros_django/devices/Dome.py 1.01 KB
cfc9d09c   Jeremy   Added dome simula...
1
2
3
4
5
6
7
8
9
10
11
from common.models import *
import abc
from .Device import DeviceController

'''
    Device controller for Telescope.
    This class must implement set, get and do functions (DeviceController is an abstract)
'''
class DomeController(DeviceController):

    def __init__(self):
678838ed   Jeremy   Weather ans insid...
12
        super().__init__("Dome")
cfc9d09c   Jeremy   Added dome simula...
13
14
15
16
17
18
19
20
21
22
23
24
25

    def get(self, command: str, *args):
        message = "GET " + command + " " + " ".join([str(arg) for arg in args])
        self.sendMessage(message)
        return (self.blockAndReadMessage())

    def set(self, command: str, *args):
        message = "SET " + command + " " + " ".join([str(arg) for arg in args])
        return (self.sendMessage(message))

    def do(self, command: str, *args):
        message = "DO " + command + " " + " ".join([str(arg) for arg in args])
        return (self.sendMessage(message))
ce470283   Jeremy   Plc simulator fin...
26
27
28
29

    def getStatus(self):
        self.get("STATUS")
        return "OK"
678838ed   Jeremy   Weather ans insid...
30
31
32
33
34
35
36
37

    def close(self):
        self.do("CLOSE")
        return 0

    def open(self):
        self.do("OPEN")
        return 0