Resolved merges... hopefully, could not test on jp
This commit is contained in:
parent
cbc1a9cb8e
commit
8303ceb626
1 changed files with 7 additions and 36 deletions
43
examples/ble_dual_node_echo.py
Normal file → Executable file
43
examples/ble_dual_node_echo.py
Normal file → Executable file
|
|
@ -15,35 +15,16 @@ After cloning the SD card:
|
||||||
1. Change zerodev2 hostname.
|
1. Change zerodev2 hostname.
|
||||||
2. Remove cloned Reticulum transport state on zerodev2.
|
2. Remove cloned Reticulum transport state on zerodev2.
|
||||||
3. Use a unique app identity file per host, or delete the cloned one.
|
3. Use a unique app identity file per host, or delete the cloned one.
|
||||||
<<<<<<< Updated upstream
|
|
||||||
4. Configure BLEInterface on both Pis with central+peripheral enabled.
|
|
||||||
=======
|
|
||||||
4. Choose BLE mode at runtime, or configure BLEInterface in Reticulum:
|
4. Choose BLE mode at runtime, or configure BLEInterface in Reticulum:
|
||||||
--ble-role peripheral # advertise only, accepts incoming BLE connections
|
--ble-role peripheral # advertise only, accepts incoming BLE connections
|
||||||
--ble-role central # scan/connect only
|
--ble-role central # scan/connect only
|
||||||
--ble-role both # scan/connect and advertise
|
--ble-role both # scan/connect and advertise
|
||||||
>>>>>>> Stashed changes
|
|
||||||
5. Run this program on both nodes.
|
5. Run this program on both nodes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
<<<<<<< Updated upstream
|
|
||||||
import os
|
|
||||||
import signal
|
|
||||||
import socket
|
|
||||||
import sys
|
|
||||||
import threading
|
|
||||||
import time
|
|
||||||
|
|
||||||
import RNS
|
|
||||||
|
|
||||||
APP_NAME = "ble_reticulum_poc"
|
|
||||||
APP_ASPECT = "echo"
|
|
||||||
|
|
||||||
running = True
|
|
||||||
active_links = {}
|
|
||||||
active_links_lock = threading.Lock()
|
|
||||||
=======
|
|
||||||
import atexit
|
import atexit
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
@ -63,7 +44,7 @@ running = True
|
||||||
active_links = {}
|
active_links = {}
|
||||||
active_links_lock = threading.Lock()
|
active_links_lock = threading.Lock()
|
||||||
temporary_config_dir = None
|
temporary_config_dir = None
|
||||||
>>>>>>> Stashed changes
|
|
||||||
|
|
||||||
|
|
||||||
def log(msg):
|
def log(msg):
|
||||||
|
|
@ -85,8 +66,7 @@ def default_identity_path(configdir, node_name):
|
||||||
return os.path.join(configdir, f"{APP_NAME}_{node_name}.identity")
|
return os.path.join(configdir, f"{APP_NAME}_{node_name}.identity")
|
||||||
|
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
|
||||||
=======
|
|
||||||
def base_config_dir(configdir):
|
def base_config_dir(configdir):
|
||||||
return os.path.abspath(os.path.expanduser(configdir or "~/.reticulum"))
|
return os.path.abspath(os.path.expanduser(configdir or "~/.reticulum"))
|
||||||
|
|
||||||
|
|
@ -230,7 +210,7 @@ def configure_rns_loglevel(verbosity):
|
||||||
RNS.loglevel(getattr(RNS, levels[verbosity]))
|
RNS.loglevel(getattr(RNS, levels[verbosity]))
|
||||||
|
|
||||||
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
def load_or_create_identity(path):
|
def load_or_create_identity(path):
|
||||||
os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True)
|
os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True)
|
||||||
|
|
||||||
|
|
@ -385,8 +365,7 @@ def parse_args():
|
||||||
parser.add_argument("--announce-interval", type=int, default=30)
|
parser.add_argument("--announce-interval", type=int, default=30)
|
||||||
parser.add_argument("--send-interval", type=int, default=10)
|
parser.add_argument("--send-interval", type=int, default=10)
|
||||||
parser.add_argument("--path-timeout", type=int, default=120)
|
parser.add_argument("--path-timeout", type=int, default=120)
|
||||||
<<<<<<< Updated upstream
|
|
||||||
=======
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--ble-role",
|
"--ble-role",
|
||||||
choices=("central", "peripheral", "both"),
|
choices=("central", "peripheral", "both"),
|
||||||
|
|
@ -412,7 +391,7 @@ def parse_args():
|
||||||
default=None,
|
default=None,
|
||||||
help="Reticulum log verbosity for this run",
|
help="Reticulum log verbosity for this run",
|
||||||
)
|
)
|
||||||
>>>>>>> Stashed changes
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -421,15 +400,7 @@ if __name__ == "__main__":
|
||||||
signal.signal(signal.SIGTERM, stop)
|
signal.signal(signal.SIGTERM, stop)
|
||||||
|
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
<<<<<<< Updated upstream
|
|
||||||
NODE_NAME = args.name or socket.gethostname().split(".")[0]
|
|
||||||
identity_path = args.identity or default_identity_path(args.config, NODE_NAME)
|
|
||||||
|
|
||||||
log(f"Starting node {NODE_NAME}")
|
|
||||||
log(f"Reticulum config: {args.config or '~/.reticulum'}")
|
|
||||||
|
|
||||||
reticulum = RNS.Reticulum(args.config)
|
|
||||||
=======
|
|
||||||
import RNS as rns
|
import RNS as rns
|
||||||
RNS = rns
|
RNS = rns
|
||||||
|
|
||||||
|
|
@ -444,7 +415,7 @@ if __name__ == "__main__":
|
||||||
configure_rns_loglevel(args.verbosity)
|
configure_rns_loglevel(args.verbosity)
|
||||||
|
|
||||||
reticulum = RNS.Reticulum(reticulum_config)
|
reticulum = RNS.Reticulum(reticulum_config)
|
||||||
>>>>>>> Stashed changes
|
|
||||||
identity = load_or_create_identity(identity_path)
|
identity = load_or_create_identity(identity_path)
|
||||||
|
|
||||||
destination = RNS.Destination(
|
destination = RNS.Destination(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue