Skip to content
Snippets Groups Projects
Commit 0a192694 authored by Christopher Stawarz's avatar Christopher Stawarz
Browse files

Handle TTL event body in event_listener.py

parent b1aa82b0
Branches
Tags
No related merge requests found
......@@ -22,6 +22,10 @@ def unpacker(format, *fields):
def unpack(data):
values = s.unpack(data[:s.size])
if (len(values) == 1) and (not fields):
assert len(data) == s.size
return values[0], ''
assert len(values) <= len(fields)
return (OrderedDict(izip(fields, chain(values, repeat(None)))),
data[s.size:])
......@@ -36,6 +40,9 @@ unpack_standard = unpacker('3BxB',
)
unpack_ttl = unpacker('<Q')
unpack_spike = unpacker('<2q2x5H3B2fH',
'timestamp',
'timestamp_software',
......@@ -79,6 +86,7 @@ def run(hostname='localhost', port=5557):
header, body = unpack_standard(body)
if etype == TTL:
word, body = unpack_ttl(body)
print('%g: TTL: Channel %d: %s' %
(timestamp_seconds,
header['event_channel'] + 1,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment