linknlink 0.2.2__tar.gz → 0.2.3__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.
- {linknlink-0.2.2 → linknlink-0.2.3}/PKG-INFO +1 -1
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink/remote.py +8 -8
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink.egg-info/PKG-INFO +1 -1
- {linknlink-0.2.2 → linknlink-0.2.3}/setup.py +1 -1
- {linknlink-0.2.2 → linknlink-0.2.3}/LICENSE +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/README.md +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink/__init__.py +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink/const.py +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink/device.py +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink/exceptions.py +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink/protocol.py +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink/sensor.py +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink.egg-info/SOURCES.txt +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink.egg-info/dependency_links.txt +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink.egg-info/not-zip-safe +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink.egg-info/requires.txt +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/linknlink.egg-info/top_level.txt +0 -0
- {linknlink-0.2.2 → linknlink-0.2.3}/setup.cfg +0 -0
|
@@ -22,7 +22,10 @@ class ehub(Device):
|
|
|
22
22
|
# sensor function
|
|
23
23
|
def _send(self, command: int, data: bytes = b"") -> bytes:
|
|
24
24
|
"""Send a packet to the device."""
|
|
25
|
-
|
|
25
|
+
if 20000 <= self.devtype <= 29999:
|
|
26
|
+
packet = struct.pack("<HI", len(data) + 4, command) + data
|
|
27
|
+
else:
|
|
28
|
+
packet = struct.pack("<I", command) + data
|
|
26
29
|
resp = self.send_packet(0x6A, packet)
|
|
27
30
|
e.check_error(resp[0x22:0x24])
|
|
28
31
|
payload = self.decrypt(resp[0x38:])
|
|
@@ -95,7 +98,10 @@ class eremote(Device):
|
|
|
95
98
|
|
|
96
99
|
def _send(self, command: int, data: bytes = b"") -> bytes:
|
|
97
100
|
"""Send a packet to the device."""
|
|
98
|
-
|
|
101
|
+
if 20000 <= self.devtype <= 29999:
|
|
102
|
+
packet = struct.pack("<HI", len(data) + 4, command) + data
|
|
103
|
+
else:
|
|
104
|
+
packet = struct.pack("<I", command) + data
|
|
99
105
|
resp = self.send_packet(0x6A, packet)
|
|
100
106
|
e.check_error(resp[0x22:0x24])
|
|
101
107
|
payload = self.decrypt(resp[0x38:])
|
|
@@ -133,8 +139,6 @@ class eremote(Device):
|
|
|
133
139
|
while True:
|
|
134
140
|
# 接收数据
|
|
135
141
|
data, client_address = udp_server_socket.recvfrom(1024)
|
|
136
|
-
print(f"收到来自 {client_address} 的消息:{data.decode('utf-8')}")
|
|
137
|
-
|
|
138
142
|
if self.cb:
|
|
139
143
|
try:
|
|
140
144
|
data_dict = json.loads(data.decode('utf-8'))
|
|
@@ -153,16 +157,12 @@ class eremote(Device):
|
|
|
153
157
|
"""Send a packet to the device."""
|
|
154
158
|
while True:
|
|
155
159
|
data = (("""{"port":%s, "timeout":60}""") % (self.Port)).encode('utf-8')
|
|
156
|
-
print(data)
|
|
157
|
-
print(len(data) + 4)
|
|
158
160
|
packet = struct.pack("<I", 20000) + data
|
|
159
161
|
# packet = struct.pack("<HI", len(data) + 4, 20000) + data
|
|
160
|
-
print(packet.hex())
|
|
161
162
|
try:
|
|
162
163
|
resp = self.send_packet(0x6A, packet)
|
|
163
164
|
except Exception as e:
|
|
164
165
|
print(e)
|
|
165
|
-
print(resp.hex())
|
|
166
166
|
time.sleep(60)
|
|
167
167
|
|
|
168
168
|
def getalldev(self) -> dict:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|