Skip to content

Commit

Permalink
fix(examples): payload print issue
Browse files Browse the repository at this point in the history
Fixing payload print issue for python27 and improving it for python34.

Making sent and receive print lines consistent so we can compare them
easily.
  • Loading branch information
Ajay Jashnani committed May 24, 2018
1 parent 8505c46 commit f93982c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions nixnet_examples/can_frame_queued_io.py
Expand Up @@ -63,7 +63,8 @@ def main():

frame.payload = payload
output_session.frames.write([frame])
print('Sent frame with ID {} payload: {}'.format(id, payload))
print('Sent frame with ID: {} payload: {}'.format(frame.identifier,
list(frame.payload)))

# Wait 1 s and then read the received values.
# They should be the same as the ones sent.
Expand All @@ -72,8 +73,8 @@ def main():
count = 1
frames = input_session.frames.read(count)
for frame in frames:
print('Received frame: {}'.format(frame))
print(' payload={}'.format(list(six.iterbytes(frame.payload))))
print('Received frame with ID: {} payload: {}'.format(frame.identifier,
list(six.iterbytes(frame.payload))))

i += 1
if max(payload) + i > 0xFF:
Expand Down
7 changes: 4 additions & 3 deletions nixnet_examples/can_frame_stream_io.py
Expand Up @@ -55,7 +55,8 @@ def main():

frame.payload = payload
output_session.frames.write([frame])
print('Sent frame with ID {} payload: {}'.format(id, payload))
print('Sent frame with ID: {} payload: {}'.format(frame.identifier,
list(frame.payload)))

# Wait 1 s and then read the received values.
# They should be the same as the ones sent.
Expand All @@ -64,8 +65,8 @@ def main():
count = 1
frames = input_session.frames.read(count)
for frame in frames:
print('Received frame: {}'.format(frame))
print(' payload={}'.format(list(six.iterbytes(frame.payload))))
print('Received frame with ID: {} payload: {}'.format(frame.identifier,
list(six.iterbytes(frame.payload))))

i += 1
if max(payload) + i > 0xFF:
Expand Down
7 changes: 4 additions & 3 deletions nixnet_examples/lin_frame_stream_io.py
Expand Up @@ -58,7 +58,8 @@ def main():

frame.payload = payload
output_session.frames.write([frame])
print('Sent frame with ID {} payload: {}'.format(id, payload))
print('Sent frame with ID: {} payload: {}'.format(frame.identifier,
list(frame.payload)))

# Wait 1 s and then read the received values.
# They should be the same as the ones sent.
Expand All @@ -67,8 +68,8 @@ def main():
count = 1
frames = input_session.frames.read(count)
for frame in frames:
print('Received frame: {}'.format(frame))
print(' payload={}'.format(list(six.iterbytes(frame.payload))))
print('Received frame with ID: {} payload: {}'.format(frame.identifier,
list(six.iterbytes(frame.payload))))

i += 1
if max(payload) + i > 0xFF:
Expand Down
2 changes: 1 addition & 1 deletion nixnet_examples/programmatic_database_usage.py
Expand Up @@ -58,7 +58,7 @@ def main():

frame.payload = payload
output_session.frames.write([frame])
print('Sent frame with ID %s payload: %s' % (id, payload))
print('Sent frame with ID: {} payload: {}'.format(frame.identifier, list(frame.payload)))
i += 1

with system.System() as my_system:
Expand Down

0 comments on commit f93982c

Please sign in to comment.