Blame view

src/core/pyros_django/devices/CameraVIS.py 1.12 KB
bb0fbab1   haribo   Fini de mettre la...
1
from common.models import *
605b65e5   Jeremy   Update simulators
2
import abc
bb0fbab1   haribo   Fini de mettre la...
3
4
from .Device import DeviceController

e8e6f017   Jeremy   Reworked devices ...
5
6
7
8
'''
    Device controller for VISCamera.
    This class must implement set, get and do functions (DeviceController is an abstract)
'''
bb0fbab1   haribo   Fini de mettre la...
9
class VISCameraController(DeviceController):
bb0fbab1   haribo   Fini de mettre la...
10
11
12

    def __init__(self):
        super().__init__("CameraVIS")
e8e6f017   Jeremy   Reworked devices ...
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

    def park(self):
c72eb17a   Jeremy   Update celery task
32
33
34
35
36
        return 0

    def open_shutter(self):
        self.do("OPEN SHUTTER")
        return 0
d3faf327   Quentin Durand   Command control D...
37
38
39
40

    def send_command(self, command):
        self.sendMessage(command)
        return self.blockAndReadMessage()