Skip to content

Commit 2252a9a

Browse files
committed
Add debug output for SNIP.
1 parent f6c6361 commit 2252a9a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

openlcb/snip.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
import logging
3+
from typing import Union
34

45

56
class SNIP:
@@ -112,7 +113,7 @@ def findString(self, n: int) -> int:
112113
# fell out without finding
113114
return 0
114115

115-
def getString(self, first, maxLength) -> str:
116+
def getString(self, first: int, maxLength: int) -> str:
116117
"""Get the string at index `first`
117118
ending with either a null or having maxLength,
118119
whichever comes first.
@@ -129,9 +130,11 @@ def getString(self, first, maxLength) -> str:
129130
if null_i > -1:
130131
terminate_i = min(null_i, terminate_i)
131132
# terminate_i should point at the first zero or exclusive end
133+
print("SNIP getString: \""
134+
+ self.data[first:terminate_i].decode("utf-8") + "\"")
132135
return self.data[first:terminate_i].decode("utf-8")
133136

134-
def addData(self, in_data):
137+
def addData(self, in_data: Union[bytearray, bytes]):
135138
'''Add additional bytes of SNIP data
136139
'''
137140
for i in range(0, len(in_data)):

0 commit comments

Comments
 (0)