Skip to content

Commit

Permalink
Changed the things that were not accepted in the review
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon Hosch committed Apr 17, 2024
1 parent 4de9fd6 commit a9021e8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion samples/python/pubsub/binary/binary_rec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ project(binary_rec)

find_package(eCAL REQUIRED)

set(PROJECT_GROUP minimal)
set(PROJECT_GROUP binary)

if(ECAL_INCLUDE_PY_SAMPLES)
if(WIN32)
Expand Down
6 changes: 3 additions & 3 deletions samples/python/pubsub/binary/binary_rec/binary_rec.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ========================= eCAL LICENSE =================================
# ========================= eCAL LICENSE =================================
#
# Copyright (C) 2016 - 2019 Continental Corporation
#
Expand Down Expand Up @@ -26,7 +26,7 @@ def main():
print("eCAL {} ({})\n".format(ecal_core.getversion(), ecal_core.getdate()))

# initialize eCAL API
ecal_core.initialize(sys.argv, "py_byte_rec")
ecal_core.initialize(sys.argv, "py_binary_rec")

# set process state
ecal_core.set_process_state(1, 1, "I feel good")
Expand All @@ -38,7 +38,7 @@ def main():
while ecal_core.ok():
ret, msg, time = sub.receive(500)
if ret > 0:
print("Received: {} ms {}".format(time, msg))
print("Received: {} ms {}".format(time, bytes.fromhex(msg.decode("utf-8"))))
else:
print("Subscriber timeout ..")

Expand Down
2 changes: 1 addition & 1 deletion samples/python/pubsub/binary/binary_rec_cb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ project(binary_rec_cb)

find_package(eCAL REQUIRED)

set(PROJECT_GROUP minimal)
set(PROJECT_GROUP binary)

if(ECAL_INCLUDE_PY_SAMPLES)
if(WIN32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# eCAL receive callback
def callback(topic_name, msg, time):
print("Received: {} ms {}".format(time, msg))
print("Received: {} ms {}".format(time, bytes.fromhex(msg.decode("utf-8"))))

def main():
# print eCAL version and date
Expand Down
2 changes: 1 addition & 1 deletion samples/python/pubsub/binary/binary_snd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ project(binary_snd)

find_package(eCAL REQUIRED)

set(PROJECT_GROUP minimal)
set(PROJECT_GROUP binary)

if(ECAL_INCLUDE_PY_SAMPLES)
if(WIN32)
Expand Down
11 changes: 7 additions & 4 deletions samples/python/pubsub/binary/binary_snd/binary_snd.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ def main():
print("eCAL {} ({})\n".format(ecal_core.getversion(), ecal_core.getdate()))

# initialize eCAL API
ecal_core.initialize(sys.argv, "py_byte_snd")
ecal_core.initialize(sys.argv, "py_binary_snd")

# set process state
ecal_core.set_process_state(1, 1, "I feel good")

# create publisher
pub = BinaryPublisher("Hello")
msg = b"Hello from eCAL"
msg_fox = b"4120717569636b2062726f776e20666f7820"

# send messages
staticmsg = msg
msg_count = 0
while ecal_core.ok():
msg_count += 1
hex_ascii = bytes(''.join([hex(ord(digit))[2:] for digit in str(msg_count)]), "utf-8")
msg = msg_fox + hex_ascii
pub.send(msg)
msg = staticmsg + random.randbytes(6)
print("Sent: ", msg)
time.sleep(0.01)

# finalize eCAL API
Expand Down

0 comments on commit a9021e8

Please sign in to comment.