indipyclient 0.6.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- indipyclient-0.6.9/LICENSE +21 -0
- indipyclient-0.6.9/PKG-INFO +91 -0
- indipyclient-0.6.9/README.md +75 -0
- indipyclient-0.6.9/indipyclient/__init__.py +9 -0
- indipyclient-0.6.9/indipyclient/__main__.py +126 -0
- indipyclient-0.6.9/indipyclient/console/__init__.py +1 -0
- indipyclient-0.6.9/indipyclient/console/choosevectorscreen.py +1316 -0
- indipyclient-0.6.9/indipyclient/console/consoleclient.py +369 -0
- indipyclient-0.6.9/indipyclient/console/devicesscreen.py +546 -0
- indipyclient-0.6.9/indipyclient/console/memberscreen.py +182 -0
- indipyclient-0.6.9/indipyclient/console/vectorscreen.py +1492 -0
- indipyclient-0.6.9/indipyclient/console/widgets.py +1434 -0
- indipyclient-0.6.9/indipyclient/console/windows.py +636 -0
- indipyclient-0.6.9/indipyclient/events.py +681 -0
- indipyclient-0.6.9/indipyclient/ipyclient.py +1221 -0
- indipyclient-0.6.9/indipyclient/propertymembers.py +530 -0
- indipyclient-0.6.9/indipyclient/propertyvectors.py +888 -0
- indipyclient-0.6.9/indipyclient/queclient.py +205 -0
- indipyclient-0.6.9/pyproject.toml +21 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023,2024 Bernard Czenkusz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: indipyclient
|
|
3
|
+
Version: 0.6.9
|
|
4
|
+
Summary: Pure python package, providing a terminal client and a set of classes which can be used to create scripts or clients to control remote instruments using the INDI protocol.
|
|
5
|
+
Keywords: indi,client,astronomy,instrument
|
|
6
|
+
Author-email: Bernard Czenkusz <bernie@skipole.co.uk>
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
|
|
13
|
+
Project-URL: Documentation, https://indipyclient.readthedocs.io
|
|
14
|
+
Project-URL: Source, https://github.com/bernie-skipole/indipyclient
|
|
15
|
+
|
|
16
|
+
# indipyclient
|
|
17
|
+
|
|
18
|
+
You may have Python programs implementing some form of data collection or control and wish to remotely operate such an instrument.
|
|
19
|
+
|
|
20
|
+
An associated package 'indipydriver' can be used to take your data, organise it into a data structure defined by the INDI protocol, and serve it on a port.
|
|
21
|
+
|
|
22
|
+
This indipyclient package provides a terminal client, which connects to the port, allowing you to view and control your instrument from a terminal session.
|
|
23
|
+
|
|
24
|
+
It can be installed from Pypi with:
|
|
25
|
+
|
|
26
|
+
pip install indipyclient
|
|
27
|
+
|
|
28
|
+
indipydriver and indipyclient communicate with the INDI protocol.
|
|
29
|
+
|
|
30
|
+
INDI - Instrument Neutral Distributed Interface.
|
|
31
|
+
|
|
32
|
+
See https://en.wikipedia.org/wiki/Instrument_Neutral_Distributed_Interface
|
|
33
|
+
|
|
34
|
+
The indipyclient terminal client can be started from the command line, and can also be imported if required, in which case it provides a set of classes which can be used to create scripts to control the remote instrument.
|
|
35
|
+
|
|
36
|
+
The client can be run with
|
|
37
|
+
|
|
38
|
+
indipyclient [options]
|
|
39
|
+
|
|
40
|
+
or with
|
|
41
|
+
|
|
42
|
+
python3 -m indipyclient [options]
|
|
43
|
+
|
|
44
|
+
The package help is:
|
|
45
|
+
|
|
46
|
+
usage: indipyclient [options]
|
|
47
|
+
|
|
48
|
+
Terminal client to communicate to an INDI service.
|
|
49
|
+
|
|
50
|
+
options:
|
|
51
|
+
-h, --help show this help message and exit
|
|
52
|
+
-p PORT, --port PORT Port of the INDI server (default 7624).
|
|
53
|
+
--host HOST Hostname/IP of the INDI server (default localhost).
|
|
54
|
+
-b BLOBS, --blobs BLOBS Optional folder where BLOB's will be saved.
|
|
55
|
+
--loglevel LOGLEVEL Enables logging, value 1, 2, 3 or 4.
|
|
56
|
+
--logfile LOGFILE File where logs will be saved
|
|
57
|
+
--version show program's version number and exit
|
|
58
|
+
|
|
59
|
+
The BLOB's folder can also be set from within the session.
|
|
60
|
+
Setting loglevel and logfile should only be used for brief
|
|
61
|
+
diagnostic purposes, the logfile could grow very big.
|
|
62
|
+
loglevel:1 Information and error messages only, no exception trace.
|
|
63
|
+
The following levels enable exception traces in the logs
|
|
64
|
+
loglevel:2 As 1 plus xml vector tags without members or contents,
|
|
65
|
+
loglevel:3 As 1 plus xml vectors and members - but not BLOB contents,
|
|
66
|
+
loglevel:4 As 1 plus xml vectors and all contents
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
A typical session would look like:
|
|
70
|
+
|
|
71
|
+

|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
The INDI protocol defines the format of the data sent, such as light, number, text, switch or BLOB (Binary Large Object). The client is general purpose, taking the format of switches, numbers etc., from the protocol.
|
|
75
|
+
|
|
76
|
+
INDI is often used with astronomical instruments, but is a general purpose protocol which can be used for any instrument control.
|
|
77
|
+
|
|
78
|
+
Further documentation is available at:
|
|
79
|
+
|
|
80
|
+
https://indipyclient.readthedocs.io
|
|
81
|
+
|
|
82
|
+
The package can be installed from:
|
|
83
|
+
|
|
84
|
+
https://pypi.org/project/indipyclient
|
|
85
|
+
|
|
86
|
+
and indipydriver is available at:
|
|
87
|
+
|
|
88
|
+
https://pypi.org/project/indipydriver
|
|
89
|
+
|
|
90
|
+
https://github.com/bernie-skipole/indipydriver
|
|
91
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# indipyclient
|
|
2
|
+
|
|
3
|
+
You may have Python programs implementing some form of data collection or control and wish to remotely operate such an instrument.
|
|
4
|
+
|
|
5
|
+
An associated package 'indipydriver' can be used to take your data, organise it into a data structure defined by the INDI protocol, and serve it on a port.
|
|
6
|
+
|
|
7
|
+
This indipyclient package provides a terminal client, which connects to the port, allowing you to view and control your instrument from a terminal session.
|
|
8
|
+
|
|
9
|
+
It can be installed from Pypi with:
|
|
10
|
+
|
|
11
|
+
pip install indipyclient
|
|
12
|
+
|
|
13
|
+
indipydriver and indipyclient communicate with the INDI protocol.
|
|
14
|
+
|
|
15
|
+
INDI - Instrument Neutral Distributed Interface.
|
|
16
|
+
|
|
17
|
+
See https://en.wikipedia.org/wiki/Instrument_Neutral_Distributed_Interface
|
|
18
|
+
|
|
19
|
+
The indipyclient terminal client can be started from the command line, and can also be imported if required, in which case it provides a set of classes which can be used to create scripts to control the remote instrument.
|
|
20
|
+
|
|
21
|
+
The client can be run with
|
|
22
|
+
|
|
23
|
+
indipyclient [options]
|
|
24
|
+
|
|
25
|
+
or with
|
|
26
|
+
|
|
27
|
+
python3 -m indipyclient [options]
|
|
28
|
+
|
|
29
|
+
The package help is:
|
|
30
|
+
|
|
31
|
+
usage: indipyclient [options]
|
|
32
|
+
|
|
33
|
+
Terminal client to communicate to an INDI service.
|
|
34
|
+
|
|
35
|
+
options:
|
|
36
|
+
-h, --help show this help message and exit
|
|
37
|
+
-p PORT, --port PORT Port of the INDI server (default 7624).
|
|
38
|
+
--host HOST Hostname/IP of the INDI server (default localhost).
|
|
39
|
+
-b BLOBS, --blobs BLOBS Optional folder where BLOB's will be saved.
|
|
40
|
+
--loglevel LOGLEVEL Enables logging, value 1, 2, 3 or 4.
|
|
41
|
+
--logfile LOGFILE File where logs will be saved
|
|
42
|
+
--version show program's version number and exit
|
|
43
|
+
|
|
44
|
+
The BLOB's folder can also be set from within the session.
|
|
45
|
+
Setting loglevel and logfile should only be used for brief
|
|
46
|
+
diagnostic purposes, the logfile could grow very big.
|
|
47
|
+
loglevel:1 Information and error messages only, no exception trace.
|
|
48
|
+
The following levels enable exception traces in the logs
|
|
49
|
+
loglevel:2 As 1 plus xml vector tags without members or contents,
|
|
50
|
+
loglevel:3 As 1 plus xml vectors and members - but not BLOB contents,
|
|
51
|
+
loglevel:4 As 1 plus xml vectors and all contents
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
A typical session would look like:
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
The INDI protocol defines the format of the data sent, such as light, number, text, switch or BLOB (Binary Large Object). The client is general purpose, taking the format of switches, numbers etc., from the protocol.
|
|
60
|
+
|
|
61
|
+
INDI is often used with astronomical instruments, but is a general purpose protocol which can be used for any instrument control.
|
|
62
|
+
|
|
63
|
+
Further documentation is available at:
|
|
64
|
+
|
|
65
|
+
https://indipyclient.readthedocs.io
|
|
66
|
+
|
|
67
|
+
The package can be installed from:
|
|
68
|
+
|
|
69
|
+
https://pypi.org/project/indipyclient
|
|
70
|
+
|
|
71
|
+
and indipydriver is available at:
|
|
72
|
+
|
|
73
|
+
https://pypi.org/project/indipydriver
|
|
74
|
+
|
|
75
|
+
https://github.com/bernie-skipole/indipydriver
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from .ipyclient import IPyClient
|
|
4
|
+
from .events import (delProperty, defSwitchVector, defTextVector, defNumberVector, defLightVector, defBLOBVector,
|
|
5
|
+
setSwitchVector, setTextVector, setNumberVector, setLightVector, setBLOBVector, Message, VectorTimeOut)
|
|
6
|
+
|
|
7
|
+
from .propertymembers import getfloat
|
|
8
|
+
|
|
9
|
+
version = "0.6.9"
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
|
|
2
|
+
"""Creates a terminal client
|
|
3
|
+
|
|
4
|
+
Try
|
|
5
|
+
|
|
6
|
+
python3 -m indipyclient --help
|
|
7
|
+
|
|
8
|
+
For a description of options
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
import sys, argparse, asyncio, pathlib, logging
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger()
|
|
15
|
+
|
|
16
|
+
# logger is the root logger, with level and handler set here
|
|
17
|
+
# by the arguments given. If no logging option is given, it
|
|
18
|
+
# has a NullHandler() added
|
|
19
|
+
|
|
20
|
+
from . import version
|
|
21
|
+
|
|
22
|
+
from .console import ConsoleClient
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def setlogging(client, level, logfile):
|
|
26
|
+
"""Sets the logging level and logfile, returns the level on success, None on failure.
|
|
27
|
+
level should be an integer, one of 1, 2, 3 or 4."""
|
|
28
|
+
|
|
29
|
+
# loglevel:1 Information and error messages only
|
|
30
|
+
# loglevel:2 log vector tags without members or contents
|
|
31
|
+
# loglevel:3 log vectors and members - but not BLOB contents
|
|
32
|
+
# loglevel:4 log vectors and all contents
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
if not level in (1, 2, 3, 4):
|
|
36
|
+
return
|
|
37
|
+
logfile = pathlib.Path(logfile).expanduser().resolve()
|
|
38
|
+
|
|
39
|
+
if level == 4:
|
|
40
|
+
logger.setLevel(logging.DEBUG)
|
|
41
|
+
client.debug_verbosity(3)
|
|
42
|
+
elif level == 3:
|
|
43
|
+
logger.setLevel(logging.DEBUG)
|
|
44
|
+
client.debug_verbosity(2)
|
|
45
|
+
elif level == 2:
|
|
46
|
+
logger.setLevel(logging.DEBUG)
|
|
47
|
+
client.debug_verbosity(1)
|
|
48
|
+
elif level == 1:
|
|
49
|
+
logger.setLevel(logging.INFO)
|
|
50
|
+
client.debug_verbosity(0)
|
|
51
|
+
# If logging debug not enabled, reduce traceback info
|
|
52
|
+
sys.tracebacklimit = 0
|
|
53
|
+
|
|
54
|
+
fh = logging.FileHandler(logfile)
|
|
55
|
+
logger.addHandler(fh)
|
|
56
|
+
except Exception:
|
|
57
|
+
return
|
|
58
|
+
return level
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def main():
|
|
62
|
+
"""The commandline entry point to run the terminal client."""
|
|
63
|
+
|
|
64
|
+
parser = argparse.ArgumentParser(usage="indipyclient [options]",
|
|
65
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
66
|
+
description="Terminal client to communicate to an INDI service.",
|
|
67
|
+
epilog="""The BLOB's folder can also be set from within the session.
|
|
68
|
+
Setting loglevel and logfile should only be used for brief
|
|
69
|
+
diagnostic purposes, the logfile could grow very big.
|
|
70
|
+
loglevel:1 Information and error messages only, no exception trace.
|
|
71
|
+
The following levels enable exception traces in the logs
|
|
72
|
+
loglevel:2 As 1 plus xml vector tags without members or contents,
|
|
73
|
+
loglevel:3 As 1 plus xml vectors and members - but not BLOB contents,
|
|
74
|
+
loglevel:4 As 1 plus xml vectors and all contents
|
|
75
|
+
""")
|
|
76
|
+
parser.add_argument("-p", "--port", type=int, default=7624, help="Port of the INDI server (default 7624).")
|
|
77
|
+
parser.add_argument("--host", default="localhost", help="Hostname/IP of the INDI server (default localhost).")
|
|
78
|
+
parser.add_argument("-b", "--blobs", help="Optional folder where BLOB's will be saved.")
|
|
79
|
+
parser.add_argument("--loglevel", help="Enables logging, value 1, 2, 3 or 4.")
|
|
80
|
+
parser.add_argument("--logfile", help="File where logs will be saved")
|
|
81
|
+
|
|
82
|
+
parser.add_argument("--version", action="version", version=version)
|
|
83
|
+
args = parser.parse_args()
|
|
84
|
+
|
|
85
|
+
if args.blobs:
|
|
86
|
+
try:
|
|
87
|
+
blobfolder = pathlib.Path(args.blobs).expanduser().resolve()
|
|
88
|
+
except Exception:
|
|
89
|
+
print("Error: If given, the BLOB's folder should be an existing directory")
|
|
90
|
+
return 1
|
|
91
|
+
else:
|
|
92
|
+
if not blobfolder.is_dir():
|
|
93
|
+
print("Error: If given, the BLOB's folder should be an existing directory")
|
|
94
|
+
return 1
|
|
95
|
+
else:
|
|
96
|
+
blobfolder = None
|
|
97
|
+
|
|
98
|
+
if args.loglevel:
|
|
99
|
+
if args.loglevel not in ("1", "2", "3", "4"):
|
|
100
|
+
print("Error: If given, the loglevel should be 1, 2, 3 or 4")
|
|
101
|
+
return 1
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
client = ConsoleClient(indihost=args.host, indiport=args.port, blobfolder=blobfolder)
|
|
105
|
+
|
|
106
|
+
if args.loglevel and args.logfile:
|
|
107
|
+
loglevel = int(args.loglevel)
|
|
108
|
+
level = setlogging(client, loglevel, args.logfile)
|
|
109
|
+
if level != loglevel:
|
|
110
|
+
print("Error: Failed to set logging")
|
|
111
|
+
return 1
|
|
112
|
+
else:
|
|
113
|
+
logger.addHandler(logging.NullHandler())
|
|
114
|
+
|
|
115
|
+
try:
|
|
116
|
+
# Starts the client, creates the console screens
|
|
117
|
+
asyncio.run(client.asyncrun())
|
|
118
|
+
finally:
|
|
119
|
+
# clear curses setup
|
|
120
|
+
client.console_reset()
|
|
121
|
+
|
|
122
|
+
return 0
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
if __name__ == "__main__":
|
|
126
|
+
sys.exit(main())
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .consoleclient import ConsoleClient
|