aiopjlink2 1.0.6__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.
- aiopjlink2-1.0.6/LICENSE +22 -0
- aiopjlink2-1.0.6/PKG-INFO +104 -0
- aiopjlink2-1.0.6/README.md +88 -0
- aiopjlink2-1.0.6/aiopjlink/__init__.py +1 -0
- aiopjlink2-1.0.6/aiopjlink/projector.py +760 -0
- aiopjlink2-1.0.6/pyproject.toml +60 -0
- aiopjlink2-1.0.6/test/__init__.py +0 -0
- aiopjlink2-1.0.6/test/test_projector.py +1293 -0
aiopjlink2-1.0.6/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Hardy & Ellis Inventions LTD
|
|
4
|
+
Copyright (c) 2026 Jonas Tjart
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: aiopjlink2
|
|
3
|
+
Version: 1.0.6
|
|
4
|
+
Summary: Asyncio PJLink library (Class 1 and Class 2)
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: projector,pjlink,asyncio
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Classifier: Framework :: AsyncIO
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Project-URL: Bug Tracker, https://github.com/jtjart/aiopjlink/issues
|
|
13
|
+
Project-URL: Repository, https://github.com/jtjart/aiopjlink
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
<div align="center">
|
|
17
|
+
|
|
18
|
+
# aiopjlink2
|
|
19
|
+
|
|
20
|
+
A modern Python asyncio PJLink library (Class I and Class II).
|
|
21
|
+
This is a fork from HEInventions/aiopjlink and Kwull/aiopjlink.
|
|
22
|
+
|
|
23
|
+
[](https://pypi.org/project/aiopjlink2)
|
|
24
|
+

|
|
25
|
+

|
|
26
|
+
|
|
27
|
+

|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
## What is PJLink?
|
|
33
|
+
|
|
34
|
+
Most projectors that have RJ45 ports on the back can be controlled via [PJLink](https://pjlink.jbmia.or.jp/english/).
|
|
35
|
+
|
|
36
|
+
PJLink is a communication protocol and unified standard for operating and controlling data projectors via `TCP/IP`, regardless of manufacturer.
|
|
37
|
+
|
|
38
|
+
PJLink consists of [Class 1](https://pjlink.jbmia.or.jp/english/data/5-1_PJLink_eng_20131210.pdf) commands and queries, as well as [Class 2](https://pjlink.jbmia.or.jp/english/data_cl2/PJLink_5-1.pdf) notifications and extensions.
|
|
39
|
+
|
|
40
|
+
* Class 1 is the most common type of PJLink, and is used for basic commands such as power on/off, input selection, and adjusting volume.
|
|
41
|
+
* Class 2 is an extended version of the protocol that supports additional commands such as opening and closing the projector's lens cover, and is typically used by more sophisticated devices.
|
|
42
|
+
|
|
43
|
+
## What is aiopjlink?
|
|
44
|
+
|
|
45
|
+
A Python library that uses [asyncio](https://docs.python.org/3/library/asyncio.html) to talk to one or more projectors connected to a network using the PJLink protocol.
|
|
46
|
+
|
|
47
|
+
The main difference from the HEInventions/aiopjlink implementation is that in aiopjlink-kw, each PJLink command is executed over a new TCP/IP connection, including authentication if required. This approach was taken due to the specific PJLink implementation used by AWOL projectors.
|
|
48
|
+
The additional changes made by aiopjlink2 is the exclusion of the test folder from the package that is published to PyPI. Additionally the context manager has been removed from PJLink because it brings no benefit anymore now, that each command is executed over a new connection.
|
|
49
|
+
|
|
50
|
+
It has these advantages:
|
|
51
|
+
|
|
52
|
+
* ✅ Clean modern asyncio API
|
|
53
|
+
* ✅ High level API abstraction (eg. `lamp.hours`)
|
|
54
|
+
* ✅ Pure Python 3 implementation (no dependencies)
|
|
55
|
+
* ✅ Full suite of test cases
|
|
56
|
+
* ❌ Context managers for keeping track of connections and resources
|
|
57
|
+
* ✅ High quality error handling
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
Each command sent to a projector is creating a new connection. The projector can be initialized with a `PJLink` instance. Once this is created, you access the different functions through a high level API (e.g. `conn.power.turn_off()`, `conn.lamps.hours()`, `conn.errors.query()`, etc).
|
|
63
|
+
|
|
64
|
+
For example, create a `PJLink` instance of the projector and issue commands:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
link = PJLink(address="192.168.1.120", password="secretpassword")
|
|
68
|
+
|
|
69
|
+
# Turn on the projector.
|
|
70
|
+
await link.power.turn_on()
|
|
71
|
+
|
|
72
|
+
# Wait a few seconds, then print out all the error information.
|
|
73
|
+
await asyncio.sleep(5)
|
|
74
|
+
print("errors = ", await link.errors.query())
|
|
75
|
+
|
|
76
|
+
# Then wait a few seconds, then turn the projector off.
|
|
77
|
+
await asyncio.sleep(5)
|
|
78
|
+
await link.power.turn_off()
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
We use the [PDM package manager](https://pdm.fming.dev/latest/).
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pdm install --dev # install all deps required to run and test the code
|
|
87
|
+
|
|
88
|
+
pdm run lint # check code quality
|
|
89
|
+
pdm run test # check all test cases run OK
|
|
90
|
+
|
|
91
|
+
pdm publish # Publish the project to PyPI
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Other notes:
|
|
95
|
+
* There are more "pdm scripts" in the `.toml` file.
|
|
96
|
+
* Set the env variable `AIOPJLINK_PRINT_DEBUG_COMMS` to print debug comms to the console.
|
|
97
|
+
|
|
98
|
+
## Roadmap
|
|
99
|
+
|
|
100
|
+
Pull requests with test cases are welcome. There are still some things to finish, including:
|
|
101
|
+
|
|
102
|
+
* [ ] Search Protocol (§3.2)
|
|
103
|
+
* [ ] Status Notification Prototol (§3.3)
|
|
104
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# aiopjlink2
|
|
4
|
+
|
|
5
|
+
A modern Python asyncio PJLink library (Class I and Class II).
|
|
6
|
+
This is a fork from HEInventions/aiopjlink and Kwull/aiopjlink.
|
|
7
|
+
|
|
8
|
+
[](https://pypi.org/project/aiopjlink2)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+
|
|
12
|
+

|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
## What is PJLink?
|
|
18
|
+
|
|
19
|
+
Most projectors that have RJ45 ports on the back can be controlled via [PJLink](https://pjlink.jbmia.or.jp/english/).
|
|
20
|
+
|
|
21
|
+
PJLink is a communication protocol and unified standard for operating and controlling data projectors via `TCP/IP`, regardless of manufacturer.
|
|
22
|
+
|
|
23
|
+
PJLink consists of [Class 1](https://pjlink.jbmia.or.jp/english/data/5-1_PJLink_eng_20131210.pdf) commands and queries, as well as [Class 2](https://pjlink.jbmia.or.jp/english/data_cl2/PJLink_5-1.pdf) notifications and extensions.
|
|
24
|
+
|
|
25
|
+
* Class 1 is the most common type of PJLink, and is used for basic commands such as power on/off, input selection, and adjusting volume.
|
|
26
|
+
* Class 2 is an extended version of the protocol that supports additional commands such as opening and closing the projector's lens cover, and is typically used by more sophisticated devices.
|
|
27
|
+
|
|
28
|
+
## What is aiopjlink?
|
|
29
|
+
|
|
30
|
+
A Python library that uses [asyncio](https://docs.python.org/3/library/asyncio.html) to talk to one or more projectors connected to a network using the PJLink protocol.
|
|
31
|
+
|
|
32
|
+
The main difference from the HEInventions/aiopjlink implementation is that in aiopjlink-kw, each PJLink command is executed over a new TCP/IP connection, including authentication if required. This approach was taken due to the specific PJLink implementation used by AWOL projectors.
|
|
33
|
+
The additional changes made by aiopjlink2 is the exclusion of the test folder from the package that is published to PyPI. Additionally the context manager has been removed from PJLink because it brings no benefit anymore now, that each command is executed over a new connection.
|
|
34
|
+
|
|
35
|
+
It has these advantages:
|
|
36
|
+
|
|
37
|
+
* ✅ Clean modern asyncio API
|
|
38
|
+
* ✅ High level API abstraction (eg. `lamp.hours`)
|
|
39
|
+
* ✅ Pure Python 3 implementation (no dependencies)
|
|
40
|
+
* ✅ Full suite of test cases
|
|
41
|
+
* ❌ Context managers for keeping track of connections and resources
|
|
42
|
+
* ✅ High quality error handling
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
Each command sent to a projector is creating a new connection. The projector can be initialized with a `PJLink` instance. Once this is created, you access the different functions through a high level API (e.g. `conn.power.turn_off()`, `conn.lamps.hours()`, `conn.errors.query()`, etc).
|
|
48
|
+
|
|
49
|
+
For example, create a `PJLink` instance of the projector and issue commands:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
link = PJLink(address="192.168.1.120", password="secretpassword")
|
|
53
|
+
|
|
54
|
+
# Turn on the projector.
|
|
55
|
+
await link.power.turn_on()
|
|
56
|
+
|
|
57
|
+
# Wait a few seconds, then print out all the error information.
|
|
58
|
+
await asyncio.sleep(5)
|
|
59
|
+
print("errors = ", await link.errors.query())
|
|
60
|
+
|
|
61
|
+
# Then wait a few seconds, then turn the projector off.
|
|
62
|
+
await asyncio.sleep(5)
|
|
63
|
+
await link.power.turn_off()
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
We use the [PDM package manager](https://pdm.fming.dev/latest/).
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pdm install --dev # install all deps required to run and test the code
|
|
72
|
+
|
|
73
|
+
pdm run lint # check code quality
|
|
74
|
+
pdm run test # check all test cases run OK
|
|
75
|
+
|
|
76
|
+
pdm publish # Publish the project to PyPI
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Other notes:
|
|
80
|
+
* There are more "pdm scripts" in the `.toml` file.
|
|
81
|
+
* Set the env variable `AIOPJLINK_PRINT_DEBUG_COMMS` to print debug comms to the console.
|
|
82
|
+
|
|
83
|
+
## Roadmap
|
|
84
|
+
|
|
85
|
+
Pull requests with test cases are welcome. There are still some things to finish, including:
|
|
86
|
+
|
|
87
|
+
* [ ] Search Protocol (§3.2)
|
|
88
|
+
* [ ] Status Notification Prototol (§3.3)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from aiopjlink.projector import * # noqa
|