gravity-controller-operator 2.0.2__py3-none-any.whl → 2.0.3__py3-none-any.whl

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.
@@ -11,9 +11,13 @@ class SoftStateMixin:
11
11
  map_keys_amount = 0
12
12
  starts_with = 0
13
13
 
14
- def __init__(self):
14
+ def __init__(self, map_keys_amount=None, starts_with=None, spec_addr=None):
15
+ self.map_keys_amount = map_keys_amount if map_keys_amount is not None else getattr(self.__class__, 'map_keys_amount', 0)
16
+ self.starts_with = starts_with if starts_with is not None else getattr(self.__class__, 'starts_with', 0)
17
+ self.spec_addr = spec_addr if spec_addr is not None else getattr(self.__class__, 'spec_addr', {})
15
18
  self.state = self._init_state()
16
19
 
20
+
17
21
  def _init_state(self):
18
22
  points = {}
19
23
  for i in range(self.map_keys_amount):
@@ -58,8 +62,8 @@ class RelayPhysInterface(BasePhysInterface):
58
62
  pass
59
63
 
60
64
  class DIInterface(SoftStateMixin, BasePhysInterface):
61
- def __init__(self):
62
- super().__init__()
65
+ def __init__(self, map_keys_amount=None, starts_with=None, spec_addr=None):
66
+ super().__init__(map_keys_amount, starts_with, spec_addr)
63
67
  self.update_from_device()
64
68
 
65
69
  def update_from_device(self):
@@ -69,8 +73,8 @@ class DIInterface(SoftStateMixin, BasePhysInterface):
69
73
 
70
74
 
71
75
  class RelayInterface(SoftStateMixin, RelayPhysInterface):
72
- def __init__(self):
73
- super().__init__()
76
+ def __init__(self, map_keys_amount=None, starts_with=None, spec_addr=None):
77
+ super().__init__(map_keys_amount, starts_with, spec_addr)
74
78
  self.update_from_device()
75
79
 
76
80
  def update_from_device(self):
@@ -1,115 +1,124 @@
1
- Metadata-Version: 2.1
2
- Name: gravity_controller_operator
3
- Version: 2.0.2
4
- Summary: SDK предоставляющий универсальный интерфейс для работы со многими промышленными контроллерами ввода-вывода (количество расширяемо)
5
- Author: PunchyArchy
6
- Author-email: ksmdrmvscthny@gmail.com
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: Operating System :: OS Independent
9
- Requires-Python: >=3.7
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: pyModbusTCP
13
- Requires-Dist: pymodbus ==3.6.9
14
-
15
- # Gravity Controller Operator
16
-
17
- Модуль для унифицированной работы с промышленными контроллерами (реле, дискретные входы и т.д.). Позволяет взаимодействовать с различными устройствами через единый интерфейс.
18
-
19
- ---
20
-
21
- ## 🚀 Поддерживаемые контроллеры
22
-
23
- - **EmulatorController** — заглушка для тестов
24
- - **ARMK210Controller** — Modbus TCP
25
- - **WBMR6LV** — Modbus RTU
26
- - **NetPing2Controller** — HTTP API
27
- - **Sigur** — доступ через TCP (СКУД)
28
- - **MoxaE1214** — REST API (vdn.dac.v1)
29
-
30
- ---
31
-
32
- ## 🧩 Архитектура
33
-
34
- ### 🧠 Интерфейсы:
35
-
36
- - `DIInterface`: чтение дискретных входов
37
- - `RelayInterface`: чтение/управление релейными выходами
38
- - `ControllerInterface`: объединяет оба
39
-
40
- Все интерфейсы наследуют `SoftStateMixin`, в котором реализовано хранение состояния точек (`state`, `changed`, `addr`).
41
-
42
- ### 🛠 Контроллер
43
- Каждый контроллер реализует:
44
- ```python
45
- self.interface = ControllerInterface(di_interface=..., relay_interface=...)
46
- ```
47
-
48
- ### 🧪 Обёртки:
49
-
50
- - `ControllerOperator` — отвечает за автоматическое обновление, mutex-безопасность и удобный API
51
- - `ControllerCreator` — фабрика создания контроллеров по имени модели (см. `controller_factory.py`)
52
-
53
- ---
54
-
55
- ## 🧪 Как использовать
56
-
57
- ```python
58
- from gravity_controller_operator.controllers.moxa import MoxaE1214
59
- from gravity_controller_operator.controller_operator import ControllerOperator
60
-
61
- moxa = MoxaE1214("192.168.60.103")
62
- operator = ControllerOperator(moxa)
63
-
64
- print(operator.get_points())
65
- operator.change_relay_state(0, 1) # включить реле 0
66
- ```
67
-
68
- ---
69
-
70
- ## 🔬 Тестирование
71
-
72
- Установка:
73
- ```bash
74
- pip install pytest
75
- ```
76
-
77
- Запуск:
78
- ```bash
79
- pytest gravity_controller_operator/tests/
80
- ```
81
-
82
- ---
83
-
84
- ## 📦 Добавление нового контроллера
85
-
86
- 1. Реализуй `YourControllerDI` и `YourControllerRelay`, наследуя `DIInterface`, `RelayInterface`
87
- 2. Создай `YourController`, в котором:
88
- ```python
89
- self.interface = ControllerInterface(di_interface=..., relay_interface=...)
90
- ```
91
- 3. Добавь контроллер в `AVAILABLE_CONTROLLERS` в `controller_factory.py`
92
-
93
- ---
94
-
95
- ## 📁 Структура
96
-
97
- ```
98
- controllers_super.py # Базовые интерфейсы
99
- controllers/ # Реализации контроллеров
100
- controller_operator.py # Обёртка ControllerOperator ✅
101
- controller_factory.py # AVAILABLE_CONTROLLERS + фабрика ✅
102
- exceptions.py # Кастомные исключения ✅
103
- tests/ # Тесты
104
- README.md
105
- ```
106
-
107
- ---
108
-
109
- ## 🤝 Контакты
110
-
111
- - 📧 Email: ksmdrmvstchny@gmail.com
112
- - 💬 Telegram: [@PunchyArchy](https://t.me/PunchyArchy)
113
- - 📞 Phone: +7 996 294-75-95
114
-
115
- Проект поддерживается Артуром (PunchyArchy, Qodex)
1
+ Metadata-Version: 2.4
2
+ Name: gravity_controller_operator
3
+ Version: 2.0.3
4
+ Summary: SDK предоставляющий универсальный интерфейс для работы со многими промышленными контроллерами ввода-вывода (количество расширяемо)
5
+ Author: PunchyArchy
6
+ Author-email: ksmdrmvscthny@gmail.com
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.7
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: pyModbusTCP
13
+ Requires-Dist: pymodbus==3.6.9
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: license-file
20
+ Dynamic: requires-dist
21
+ Dynamic: requires-python
22
+ Dynamic: summary
23
+
24
+ # Gravity Controller Operator
25
+
26
+ Модуль для унифицированной работы с промышленными контроллерами (реле, дискретные входы и т.д.). Позволяет взаимодействовать с различными устройствами через единый интерфейс.
27
+
28
+ ---
29
+
30
+ ## 🚀 Поддерживаемые контроллеры
31
+
32
+ - **EmulatorController** — заглушка для тестов
33
+ - **ARMK210Controller** — Modbus TCP
34
+ - **WBMR6LV** — Modbus RTU
35
+ - **NetPing2Controller** — HTTP API
36
+ - **Sigur** — доступ через TCP (СКУД)
37
+ - **MoxaE1214** — REST API (vdn.dac.v1)
38
+
39
+ ---
40
+
41
+ ## 🧩 Архитектура
42
+
43
+ ### 🧠 Интерфейсы:
44
+
45
+ - `DIInterface`: чтение дискретных входов
46
+ - `RelayInterface`: чтение/управление релейными выходами
47
+ - `ControllerInterface`: объединяет оба
48
+
49
+ Все интерфейсы наследуют `SoftStateMixin`, в котором реализовано хранение состояния точек (`state`, `changed`, `addr`).
50
+
51
+ ### 🛠 Контроллер
52
+ Каждый контроллер реализует:
53
+ ```python
54
+ self.interface = ControllerInterface(di_interface=..., relay_interface=...)
55
+ ```
56
+
57
+ ### 🧪 Обёртки:
58
+
59
+ - `ControllerOperator` — отвечает за автоматическое обновление, mutex-безопасность и удобный API
60
+ - `ControllerCreator` — фабрика создания контроллеров по имени модели (см. `controller_factory.py`)
61
+
62
+ ---
63
+
64
+ ## 🧪 Как использовать
65
+
66
+ ```python
67
+ from gravity_controller_operator.controllers.moxa import MoxaE1214
68
+ from gravity_controller_operator.controller_operator import ControllerOperator
69
+
70
+ moxa = MoxaE1214("192.168.60.103")
71
+ operator = ControllerOperator(moxa)
72
+
73
+ print(operator.get_points())
74
+ operator.change_relay_state(0, 1) # включить реле 0
75
+ ```
76
+
77
+ ---
78
+
79
+ ## 🔬 Тестирование
80
+
81
+ Установка:
82
+ ```bash
83
+ pip install pytest
84
+ ```
85
+
86
+ Запуск:
87
+ ```bash
88
+ pytest gravity_controller_operator/tests/
89
+ ```
90
+
91
+ ---
92
+
93
+ ## 📦 Добавление нового контроллера
94
+
95
+ 1. Реализуй `YourControllerDI` и `YourControllerRelay`, наследуя `DIInterface`, `RelayInterface`
96
+ 2. Создай `YourController`, в котором:
97
+ ```python
98
+ self.interface = ControllerInterface(di_interface=..., relay_interface=...)
99
+ ```
100
+ 3. Добавь контроллер в `AVAILABLE_CONTROLLERS` в `controller_factory.py`
101
+
102
+ ---
103
+
104
+ ## 📁 Структура
105
+
106
+ ```
107
+ controllers_super.py # Базовые интерфейсы
108
+ controllers/ # Реализации контроллеров
109
+ controller_operator.py # Обёртка ControllerOperator ✅
110
+ controller_factory.py # AVAILABLE_CONTROLLERS + фабрика ✅
111
+ exceptions.py # Кастомные исключения ✅
112
+ tests/ # Тесты
113
+ README.md
114
+ ```
115
+
116
+ ---
117
+
118
+ ## 🤝 Контакты
119
+
120
+ - 📧 Email: ksmdrmvstchny@gmail.com
121
+ - 💬 Telegram: [@PunchyArchy](https://t.me/PunchyArchy)
122
+ - 📞 Phone: +7 996 294-75-95
123
+
124
+ Проект поддерживается Артуром (PunchyArchy, Qodex)
@@ -1,6 +1,6 @@
1
1
  gravity_controller_operator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  gravity_controller_operator/controller_factory.py,sha256=QQHym-fPhWCBCOFUp7MHrecjXcRy9dXVnUbg6LvwvDo,1111
3
- gravity_controller_operator/controllers_super.py,sha256=7jwczltFeaLGsuP-9aFUZdbAo-NafyvinDxotO9MJ5I,3612
3
+ gravity_controller_operator/controllers_super.py,sha256=ITcJhxZRAu4dMLyHthAOxuMntb4VQIdq7VMTAJV5h-k,4211
4
4
  gravity_controller_operator/exceptions.py,sha256=tAuviQbnrZh_T5E31RBeEnagwbvdi7x23uQJ8v4XRtM,647
5
5
  gravity_controller_operator/main.py,sha256=_7qdTj4bHwUR4YsRScSr5eSEcMoxOqBHNfnxNY8D2J0,1492
6
6
  gravity_controller_operator/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -15,8 +15,8 @@ gravity_controller_operator/controllers/tests/test_moxa_controller.py,sha256=RKw
15
15
  gravity_controller_operator/docs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  gravity_controller_operator/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  gravity_controller_operator/tests/main_tests.py,sha256=BkgWDKUXVmK4WIYY_5CAHazYmqkKumYPtfbnyxcm_UU,575
18
- gravity_controller_operator-2.0.2.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
19
- gravity_controller_operator-2.0.2.dist-info/METADATA,sha256=egn0C3_hdAbLo3O1aWSwGzX5XKx7aQEMT16RExOJAes,4040
20
- gravity_controller_operator-2.0.2.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
21
- gravity_controller_operator-2.0.2.dist-info/top_level.txt,sha256=krapbz1cEDGquDJf0DnoTbnybUwi7J_8OgoIumEc0OM,28
22
- gravity_controller_operator-2.0.2.dist-info/RECORD,,
18
+ gravity_controller_operator-2.0.3.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
19
+ gravity_controller_operator-2.0.3.dist-info/METADATA,sha256=2urs5ogvHwUcuIsbT6W75eiH3GHewZTWNFA0l6W19wU,4124
20
+ gravity_controller_operator-2.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ gravity_controller_operator-2.0.3.dist-info/top_level.txt,sha256=krapbz1cEDGquDJf0DnoTbnybUwi7J_8OgoIumEc0OM,28
22
+ gravity_controller_operator-2.0.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.3.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5