Skip to content

Commit 9a57213

Browse files
committed
[examples] all: Update examples
1 parent 5e30bd3 commit 9a57213

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
__pycache__/
55
*.egg-info/
66
dist/
7+
examples/zbnt

examples/bitstream_loading.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ async def main():
4343

4444
req_dev = devices[req_dev]
4545

46-
print("\n- Connecting to {0} ({1})".format(req_dev["name"], req_dev["address"]))
46+
if not req_dev["local"]:
47+
print("\n- Connecting to {0} ({1})".format(req_dev["name"], req_dev["address"]))
48+
else:
49+
print("\n- Connecting to {0} (PID {1})".format(req_dev["name"], req_dev["pid"]))
4750

48-
client = await ZbntClient.connect(req_dev["address"], req_dev["port"])
51+
client = await ZbntClient.connect(req_dev)
4952

5053
if client == None:
5154
print("Error: Failed to connect to device")

examples/frame_detector.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ async def main():
5858

5959
# Connect to selected device, load a bitstream
6060

61-
print("- Connecting to {0} ({1})".format(req_dev["name"], req_dev["address"]))
61+
if not req_dev["local"]:
62+
print("\n- Connecting to {0} ({1})".format(req_dev["name"], req_dev["address"]))
63+
else:
64+
print("\n- Connecting to {0} (PID {1})".format(req_dev["name"], req_dev["pid"]))
6265

63-
client = await ZbntClient.connect(req_dev["address"], req_dev["port"])
66+
client = await ZbntClient.connect(req_dev)
6467

6568
if client == None:
6669
print("Error: Failed to connect to device")

examples/traffic_generator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ async def main():
5555

5656
# Connect to selected device, load a bitstream
5757

58-
print("\n- Connecting to {0} ({1})".format(req_dev["name"], req_dev["address"]))
58+
if not req_dev["local"]:
59+
print("\n- Connecting to {0} ({1})".format(req_dev["name"], req_dev["address"]))
60+
else:
61+
print("\n- Connecting to {0} (PID {1})".format(req_dev["name"], req_dev["pid"]))
5962

60-
client = await ZbntClient.connect(req_dev["address"], req_dev["port"])
63+
client = await ZbntClient.connect(req_dev)
6164

6265
if client == None:
6366
print("Error: Failed to connect to device")

0 commit comments

Comments
 (0)