msgproto: Support sending empty strings from create_message()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-05-04 12:39:49 -04:00
parent 9c52ad4310
commit 838da992e8
1 changed files with 3 additions and 1 deletions

View File

@ -251,13 +251,15 @@ class MessageParser:
out.append(MESSAGE_SYNC)
return ''.join(out)
def _parse_buffer(self, value):
if not value:
return []
tval = int(value, 16)
out = []
for i in range(len(value) // 2):
out.append(tval & 0xff)
tval >>= 8
out.reverse()
return ''.join([chr(i) for i in out])
return out
def lookup_command(self, msgformat):
parts = msgformat.strip().split()
msgname = parts[0]