-
Notifications
You must be signed in to change notification settings - Fork 0
/
class_pyindi_client.py
56 lines (45 loc) · 2.08 KB
/
class_pyindi_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# for logging
import sys
import time
import logging
# import the PyIndi module
import PyIndi
# The IndiClient class which inherits from the module PyIndi.BaseClient class
# Note that all INDI constants are accessible from the module as PyIndi.CONSTANTNAME
class IndiClient(PyIndi.BaseClient):
def __init__(self):
super(IndiClient, self).__init__()
self.logger = logging.getLogger("IndiClient")
self.logger.info("creating an instance of IndiClient")
def newDevice(self, d):
"""Emmited when a new device is created from INDI server."""
self.logger.info(f"new device {d.getDeviceName()}")
def removeDevice(self, d):
"""Emmited when a device is deleted from INDI server."""
self.logger.info(f"remove device {d.getDeviceName()}")
def newProperty(self, p):
"""Emmited when a new property is created for an INDI driver."""
self.logger.info(
f"new property {p.getName()} as {p.getTypeAsString()} for device {p.getDeviceName()}"
)
def updateProperty(self, p):
"""Emmited when a new property value arrives from INDI server."""
self.logger.info(
f"update property {p.getName()} as {p.getTypeAsString()} for device {p.getDeviceName()}"
)
def removeProperty(self, p):
"""Emmited when a property is deleted for an INDI driver."""
self.logger.info(
f"remove property {p.getName()} as {p.getTypeAsString()} for device {p.getDeviceName()}"
)
def newMessage(self, d, m):
"""Emmited when a new message arrives from INDI server."""
self.logger.info(f"new Message {d.messageQueue(m)}")
def serverConnected(self):
"""Emmited when the server is connected."""
self.logger.info(f"Server connected ({self.getHost()}:{self.getPort()})")
def serverDisconnected(self, code):
"""Emmited when the server gets disconnected."""
self.logger.info(
f"Server disconnected (exit code = {code},{self.getHost()}:{self.getPort()})"
)