Skip to content

Commit f2a86b5

Browse files
committed
ProtocolResult data also stores name and r/w, fixed crash with methods
1 parent b895f71 commit f2a86b5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

ProtocolResult.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ def __init__(self, response_line, data=None):
1717
self.ordinal = 0
1818
self.message = 'Ok'
1919

20+
name = response_line[response_line.index(' ') + 1:]
21+
type = response_line[response_line.index('_')+1:response_line.index(' ')]
22+
if '=' in name:
23+
value = name[name.index('=')+1:]
24+
name = name[:name.index('=')]
25+
else:
26+
value = None
27+
writable = response_line.startswith('PW_')
28+
2029
self.data = {
21-
'type': response_line[response_line.index('_')+1:response_line.index(' ')],
22-
'value': response_line[response_line.index('=')+1:]
30+
'name': name,
31+
'type': type,
32+
'value': value,
33+
'writable': writable
2334
}
2435
else:
2536
raise ValueError('Invalid response line: %s' % response_line)

0 commit comments

Comments
 (0)