Skip to content

Commit

Permalink
Merge pull request #27 from Wiznet/issue#26
Browse files Browse the repository at this point in the history
issue#26
  • Loading branch information
Rena Kim authored Jul 14, 2021
2 parents 6394289 + 000907c commit 01067a8
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 82 deletions.
20 changes: 9 additions & 11 deletions WIZMSGHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


def timeout_func():
# print('timeout')
# print('timeout')
global exitflag
exitflag = 1

Expand Down Expand Up @@ -112,7 +112,7 @@ def makecommands(self):
print('[ERROR] makecommands() encode param:',
cmd[0], cmd[1], e)
self.size += len(cmd[1])
if not "\r\n" in cmd[1]:
if "\r\n" not in cmd[1]:
self.msg[self.size:] = str.encode("\r\n")
self.size += 2

Expand Down Expand Up @@ -182,14 +182,14 @@ def run(self):
if sock == self.sock.sock:
data = self.sock.recvfrom()

#! check if data reduplication
# check if data reduplication
if data in self.rcv_list:
replylists = []
else:
self.rcv_list.append(data) # received data backup
# replylists = data.splitlines()
replylists = data.split(b"\r\n")

print('replylists', replylists)
self.getreply = replylists

Expand All @@ -216,15 +216,14 @@ def run(self):
elif self.opcode == OP_FWUP:
for i in range(0, len(replylists)):
if b'MA' in replylists[i][:2]:
dest_mac = self.dest_mac
reply_mac = replylists[i][2:]
pass
# self.isvalid = True
else:
self.isvalid = False
# sys.stdout.write("%r\r\n" % replylists[i][:2])
if b'FW' in replylists[i][:2]:
# sys.stdout.write('self.isvalid == True\r\n')
param = replylists[i][2:].split(b':')
# param = replylists[i][2:].split(b':')
self.reply = replylists[i][2:]
elif self.opcode == OP_SETCOMMAND:
for i in range(0, len(replylists)):
Expand Down Expand Up @@ -302,7 +301,7 @@ def makecommands(self):
else:
self.msg[self.size:] = str.encode(cmd[1])
self.size += len(cmd[1])
if not "\r\n" in cmd[1]:
if "\r\n" not in cmd[1]:
self.msg[self.size:] = str.encode("\r\n")
self.size += 2

Expand All @@ -322,8 +321,7 @@ def run(self):
except Exception as e:
print(e)

replylists = None

# replylists = None
checknum = 0

while True:
Expand All @@ -340,7 +338,7 @@ def run(self):
data = self.sock.recvfrom()
self.rcv_list.append(data) # 수신 데이터 저장
# replylists = data.splitlines()
replylists = data.split(b"\r\n")
# replylists = data.split(b"\r\n")
# print('replylists', replylists)

checknum += 1
Expand Down
Loading

0 comments on commit 01067a8

Please sign in to comment.