gravity-controller-operator 2.2.2__py3-none-any.whl → 2.2.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.
@@ -1,4 +1,5 @@
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
5
  from _thread import allocate_lock
@@ -9,8 +10,8 @@ class SigurBase:
9
10
  def __init__(self, sock):
10
11
  self.sock = sock
11
12
  self.mutex = allocate_lock()
12
- self.login()
13
- self.subscribe_ce()
13
+ #self.login()
14
+ #self.subscribe_ce()
14
15
 
15
16
  def login(self, login="Administrator", password=""):
16
17
  return self._send_command(f'"LOGIN" 1.8 "{login}" "{password}"')
@@ -29,6 +30,12 @@ class SigurBase:
29
30
  return response
30
31
  self.mutex.release()
31
32
 
33
+ def get_response(self):
34
+ time.sleep(0.15)
35
+ self.mutex.acquire()
36
+ response = self.sock.recv(1024)
37
+ self.mutex.release()
38
+ return responses
32
39
 
33
40
  class SigurDI(DIInterface, SigurBase):
34
41
  map_keys_amount = 5
@@ -41,14 +48,7 @@ class SigurDI(DIInterface, SigurBase):
41
48
  def get_phys_dict(self):
42
49
  result = {}
43
50
  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
51
+ result[point] = 0
52
52
  return result
53
53
 
54
54
 
@@ -63,14 +63,7 @@ class SigurRelay(RelayInterface, SigurBase):
63
63
  def get_phys_dict(self):
64
64
  result = {}
65
65
  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
66
+ result[point] = 0
74
67
  return result
75
68
 
76
69
  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.3
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=BAhu86MZn9siToudGHPOnSIiuEnjYdXk2xaF5J_9648,2475
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.3.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
19
+ gravity_controller_operator-2.2.3.dist-info/METADATA,sha256=7JdMgLSFqVBGpZ5N21At31JI7fhHVCv2nVK00tFB2zI,4124
20
+ gravity_controller_operator-2.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ gravity_controller_operator-2.2.3.dist-info/top_level.txt,sha256=krapbz1cEDGquDJf0DnoTbnybUwi7J_8OgoIumEc0OM,28
22
+ gravity_controller_operator-2.2.3.dist-info/RECORD,,