-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add --no-multicast-scouting flag to examples
- Loading branch information
1 parent
ce22b76
commit f9213ea
Showing
21 changed files
with
153 additions
and
855 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .common import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import argparse | ||
import json | ||
|
||
import zenoh | ||
|
||
|
||
def add_config_arguments(parser: argparse.ArgumentParser): | ||
parser.add_argument( | ||
"--mode", | ||
"-m", | ||
dest="mode", | ||
choices=["peer", "client"], | ||
type=str, | ||
help="The zenoh session mode.", | ||
) | ||
parser.add_argument( | ||
"--connect", | ||
"-e", | ||
dest="connect", | ||
metavar="ENDPOINT", | ||
action="append", | ||
type=str, | ||
help="Endpoints to connect to.", | ||
) | ||
parser.add_argument( | ||
"--listen", | ||
"-l", | ||
dest="listen", | ||
metavar="ENDPOINT", | ||
action="append", | ||
type=str, | ||
help="Endpoints to listen on.", | ||
) | ||
parser.add_argument( | ||
"--config", | ||
"-c", | ||
dest="config", | ||
metavar="FILE", | ||
type=str, | ||
help="A configuration file.", | ||
) | ||
parser.add_argument( | ||
"--no-multicast-scouting", | ||
dest="no_multicast_scouting", | ||
default=False, | ||
action="store_true", | ||
help="Disable multicast scouting.", | ||
) | ||
|
||
|
||
def get_config_from_args(args) -> zenoh.Config: | ||
conf = ( | ||
zenoh.Config.from_file(args.config) | ||
if args.config is not None | ||
else zenoh.Config() | ||
) | ||
if args.mode is not None: | ||
conf.insert_json5("mode", json.dumps(args.mode)) | ||
if args.connect is not None: | ||
conf.insert_json5("connect/endpoints", json.dumps(args.connect)) | ||
if args.listen is not None: | ||
conf.insert_json5("listen/endpoints", json.dumps(args.listen)) | ||
if args.no_multicast_scouting is not None: | ||
conf.insert_json5("scouting/multicast/enabled", json.dumps(False)) | ||
|
||
return conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.