gravity-controller-operator 2.2.2__py3-none-any.whl → 2.2.4__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.
@@ -1,34 +1,12 @@
1
1
  import time
2
+ from http.client import responses
2
3
 
3
4
  from gravity_controller_operator.controllers_super import DIInterface, RelayInterface, ControllerInterface
4
- from _thread import allocate_lock
5
- from socket import socket
6
5
 
7
6
 
8
7
  class SigurBase:
9
8
  def __init__(self, sock):
10
- self.sock = sock
11
- self.mutex = allocate_lock()
12
- self.login()
13
- self.subscribe_ce()
14
-
15
- def login(self, login="Administrator", password=""):
16
- return self._send_command(f'"LOGIN" 1.8 "{login}" "{password}"')
17
-
18
- def subscribe_ce(self):
19
- return self._send_command(f'"SUBSCRIBE" CE')
20
-
21
- def _send_command(self, command, get_response=True):
22
- time.sleep(0.15)
23
- self.mutex.acquire()
24
- command = f'{command}\r\n'
25
- self.sock.send(command.encode("utf-8"))
26
- if get_response:
27
- response = self.sock.recv(1024)
28
- self.mutex.release()
29
- return response
30
- self.mutex.release()
31
-
9
+ self.sock = None
32
10
 
33
11
  class SigurDI(DIInterface, SigurBase):
34
12
  map_keys_amount = 5
@@ -41,14 +19,7 @@ class SigurDI(DIInterface, SigurBase):
41
19
  def get_phys_dict(self):
42
20
  result = {}
43
21
  for point in range(self.starts_with, self.starts_with + self.map_keys_amount):
44
- while True:
45
- raw = self._send_command(f'"GETAPINFO" {point}')
46
- response = raw.decode()
47
- if "OK" in response:
48
- continue
49
- break
50
- status = response.split(" ")[-2]
51
- result[point] = 0 if status in ("ONLINE_UNLOCKED", "ONLINE_NORMAL") else 1
22
+ result[point] = 0
52
23
  return result
53
24
 
54
25
 
@@ -63,14 +34,7 @@ class SigurRelay(RelayInterface, SigurBase):
63
34
  def get_phys_dict(self):
64
35
  result = {}
65
36
  for point in range(self.starts_with, self.starts_with + self.map_keys_amount):
66
- while True:
67
- raw = self._send_command(f'"GETAPINFO" {point}')
68
- response = raw.decode()
69
- if "OK" in response:
70
- continue
71
- break
72
- status = response.split(" ")[-2]
73
- result[point] = 0 if status in ("ONLINE_UNLOCKED", "ONLINE_NORMAL") else 1
37
+ result[point] = 0
74
38
  return result
75
39
 
76
40
  def change_phys_relay_state(self, addr, state: bool):
@@ -81,7 +81,7 @@ class RelayInterface(SoftStateMixin, RelayPhysInterface):
81
81
  for addr, value in values.items():
82
82
  self.update_state(addr, value, mark_time=False)
83
83
 
84
- def change_relay_stated(self, logical_ch: int, state: bool):
84
+ def change_relay_state(self, logical_ch: int, state: bool):
85
85
  self.update_state(logical_ch, state)
86
86
  phys_addr = self.spec_addr.get(logical_ch, logical_ch)
87
87
  return self.change_phys_relay_state(phys_addr, state)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gravity_controller_operator
3
- Version: 2.2.2
3
+ Version: 2.2.4
4
4
  Summary: SDK предоставляющий универсальный интерфейс для работы со многими промышленными контроллерами ввода-вывода (количество расширяемо)
5
5
  Author: PunchyArchy
6
6
  Author-email: ksmdrmvscthny@gmail.com
@@ -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=9GkJRDDGLkbl9aOBnIolLWOv6qCdQk837NtjE0JzLUY,3786
3
+ gravity_controller_operator/controllers_super.py,sha256=xn_66lJbyT9CQ-mMVy_QkUYEPc3nPoiI9zBuIo_yFzk,3785
4
4
  gravity_controller_operator/exceptions.py,sha256=tAuviQbnrZh_T5E31RBeEnagwbvdi7x23uQJ8v4XRtM,647
5
5
  gravity_controller_operator/main.py,sha256=2xp4cM0zzgxUW0otXrDNVTk93ftYKeGmBW7KbwoJYRk,1584
6
6
  gravity_controller_operator/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,15 +8,15 @@ gravity_controller_operator/controllers/arm_k210.py,sha256=qlpQoqoLfZddTVJ-Dzdvk
8
8
  gravity_controller_operator/controllers/emulator_contr.py,sha256=SGZBzUeCXDwWXHcYdMDvErwIj1L81ycnObHvCjB86Sk,943
9
9
  gravity_controller_operator/controllers/moxa.py,sha256=OGvEB6ggDi1NZh7OOEfjxVUTKC-opi0hIcAKTJJAMi0,2407
10
10
  gravity_controller_operator/controllers/netping_relay.py,sha256=0cpioEQbZ19BApAPJT2fXWTKDEB9zf2GU9OUfbBGkAY,2572
11
- gravity_controller_operator/controllers/sigur.py,sha256=30T35U_pHK4j6jywO4ABuvALVVIys1_6t1Ie4AlF2so,2908
11
+ gravity_controller_operator/controllers/sigur.py,sha256=nljHk1nRu1ijJPp_ApwGPNucdR_z4AWxMJeeIHF6nTk,1554
12
12
  gravity_controller_operator/controllers/wb_mr6lv.py,sha256=qDmb71t7KXX_w8nhguUpEoMgkPOZcoVs83We5kTgFfk,2358
13
13
  gravity_controller_operator/controllers/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  gravity_controller_operator/controllers/tests/test_moxa_controller.py,sha256=RKwpE4WI6QylPD6qGrse6iv6X8ybzf45oTHHTjlCLXA,1068
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.2.2.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
19
- gravity_controller_operator-2.2.2.dist-info/METADATA,sha256=J1NATp-3719MgB7dct3sBP5y8suwYKOO8cA8yvK9w34,4124
20
- gravity_controller_operator-2.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- gravity_controller_operator-2.2.2.dist-info/top_level.txt,sha256=krapbz1cEDGquDJf0DnoTbnybUwi7J_8OgoIumEc0OM,28
22
- gravity_controller_operator-2.2.2.dist-info/RECORD,,
18
+ gravity_controller_operator-2.2.4.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
19
+ gravity_controller_operator-2.2.4.dist-info/METADATA,sha256=YhROoX40gBs1UIzqhijUF4pk_yE12mbT1OIv6Vn5KmA,4124
20
+ gravity_controller_operator-2.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ gravity_controller_operator-2.2.4.dist-info/top_level.txt,sha256=krapbz1cEDGquDJf0DnoTbnybUwi7J_8OgoIumEc0OM,28
22
+ gravity_controller_operator-2.2.4.dist-info/RECORD,,