mirror of
https://github.com/meshtastic/python.git
synced 2026-01-02 04:47:54 -05:00
add --qr to show qr code
This commit is contained in:
@@ -6,6 +6,7 @@ import logging
|
||||
import sys
|
||||
from pubsub import pub
|
||||
import google.protobuf.json_format
|
||||
import pyqrcode
|
||||
|
||||
"""The command line arguments"""
|
||||
args = None
|
||||
@@ -131,6 +132,12 @@ def onConnected(interface):
|
||||
print("Nodes in mesh:")
|
||||
for n in interface.nodes.values():
|
||||
print(n)
|
||||
|
||||
if args.qr:
|
||||
closeNow = True
|
||||
print(f"Channel URL {interface.channelURL}")
|
||||
url = pyqrcode.create(interface.channelURL)
|
||||
print(url.terminal())
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
|
||||
@@ -168,6 +175,9 @@ def main():
|
||||
parser.add_argument("--info", help="Read and display the radio config information",
|
||||
action="store_true")
|
||||
|
||||
parser.add_argument("--qr", help="Display the QR code that corresponds to the current channel",
|
||||
action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
"--set", help="Set a numeric preferences field", nargs=2, action='append')
|
||||
|
||||
@@ -206,7 +216,7 @@ def main():
|
||||
args = parser.parse_args()
|
||||
logging.basicConfig(level=logging.DEBUG if args.debug else logging.INFO)
|
||||
|
||||
if (not args.seriallog) and (args.info or args.set or args.setstr or args.setchan or args.sendtext):
|
||||
if (not args.seriallog) and (args.info or args.set or args.setstr or args.setchan or args.sendtext or args.qr):
|
||||
args.seriallog = "none" # assume no debug output in this case
|
||||
|
||||
if args.test:
|
||||
|
||||
4
setup.py
4
setup.py
@@ -10,7 +10,7 @@ with open("README.md", "r") as fh:
|
||||
# This call to setup() does all the work
|
||||
setup(
|
||||
name="meshtastic",
|
||||
version="1.0.6",
|
||||
version="1.0.7",
|
||||
description="Python API & client shell for talking to Meshtastic devices",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
@@ -26,7 +26,7 @@ setup(
|
||||
packages=["meshtastic"],
|
||||
include_package_data=True,
|
||||
install_requires=["pyserial>=3.4", "protobuf>=3.6.1",
|
||||
"pypubsub>=4.0.3", "dotmap>=1.3.14", "pexpect>=4.6.0",
|
||||
"pypubsub>=4.0.3", "dotmap>=1.3.14", "pexpect>=4.6.0", "PyQRCode>=1.2.1"
|
||||
"pygatt>=4.0.5"],
|
||||
python_requires='>=3.4',
|
||||
entry_points={
|
||||
|
||||
Reference in New Issue
Block a user