Skip to content

Commit 69371ae

Browse files
authored
Add byte type parsing to DB_Row API + set parsing case insensitive (#315)
1 parent 22013d8 commit 69371ae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

snap7/util.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,9 @@ def get_value(self, byte_index: Union[str, int], type_: str) -> Union[ValueError
10701070

10711071
bytearray_ = self.get_bytearray()
10721072

1073+
# set parsing non case-sensitive
1074+
type_ = type_.upper()
1075+
10731076
if type_ == 'BOOL':
10741077
byte_index, bool_index = str(byte_index).split('.')
10751078
return get_bool(bytearray_, self.get_offset(byte_index),
@@ -1102,6 +1105,9 @@ def get_value(self, byte_index: Union[str, int], type_: str) -> Union[ValueError
11021105
elif type_ == 'WORD':
11031106
return get_word(bytearray_, byte_index)
11041107

1108+
elif type_ == 'BYTE':
1109+
return get_byte(bytearray_, byte_index)
1110+
11051111
elif type_ == 'S5TIME':
11061112
data_s5time = get_s5time(bytearray_, byte_index)
11071113
return data_s5time

0 commit comments

Comments
 (0)