mirror of
https://github.com/meshtastic/python.git
synced 2025-12-26 01:17:51 -05:00
Compare commits
90 Commits
1.3alpha.2
...
2.0.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d12776bb5f | ||
|
|
7829f6afca | ||
|
|
4bd10bc102 | ||
|
|
3821e02f09 | ||
|
|
97689da0b4 | ||
|
|
5c75e74bf9 | ||
|
|
388a46abf4 | ||
|
|
6b89fc81a1 | ||
|
|
c9b5d5d697 | ||
|
|
f16dd0e737 | ||
|
|
5ed19eff73 | ||
|
|
0b3605141d | ||
|
|
f1df14ca92 | ||
|
|
83776ceec5 | ||
|
|
7aff5e9ee5 | ||
|
|
bf6be107d3 | ||
|
|
c24d1fe26b | ||
|
|
61f5468847 | ||
|
|
c713ce04b6 | ||
|
|
fe2b36e04b | ||
|
|
a720916df5 | ||
|
|
b2593e4bb1 | ||
|
|
6e3c759e5c | ||
|
|
a41f33e0bd | ||
|
|
111bf8dcbf | ||
|
|
f18abb2fe6 | ||
|
|
b7093e176a | ||
|
|
cf7d37a454 | ||
|
|
2af431e2eb | ||
|
|
3db64f7988 | ||
|
|
7ef64d4250 | ||
|
|
363aa995a2 | ||
|
|
696fa28e6f | ||
|
|
a908bdfc1c | ||
|
|
81b64ac908 | ||
|
|
d5ccdc826f | ||
|
|
fac4faaae8 | ||
|
|
cfb8769746 | ||
|
|
c1b0e4e8d0 | ||
|
|
5683e31f6b | ||
|
|
7909ad477b | ||
|
|
f94dbf05ef | ||
|
|
a44b769390 | ||
|
|
2a4816a9cd | ||
|
|
674fd92690 | ||
|
|
cc29cab99a | ||
|
|
bf803bb6e9 | ||
|
|
3c80fd0f02 | ||
|
|
616a3ab706 | ||
|
|
8350cc611d | ||
|
|
621feb749d | ||
|
|
f6731a435d | ||
|
|
dcfe5fb558 | ||
|
|
4fa80e9652 | ||
|
|
02851b6237 | ||
|
|
a74ec12445 | ||
|
|
262e921a81 | ||
|
|
0c7b9e10f4 | ||
|
|
ab8b930365 | ||
|
|
4ae49c68aa | ||
|
|
733f22d927 | ||
|
|
791131ea27 | ||
|
|
f17292221c | ||
|
|
b60a438c9d | ||
|
|
3b3a610375 | ||
|
|
38f928bdb7 | ||
|
|
6272e992a4 | ||
|
|
3263fbca28 | ||
|
|
f0e7af389c | ||
|
|
471dfc7a29 | ||
|
|
2a7c21c062 | ||
|
|
03797e3336 | ||
|
|
dc1be12c86 | ||
|
|
4c83a43d64 | ||
|
|
e083cda3d9 | ||
|
|
c0006f888b | ||
|
|
e2d2d3a347 | ||
|
|
3fd50b0e44 | ||
|
|
4b0e3ae923 | ||
|
|
37f10cc0d4 | ||
|
|
998df265e6 | ||
|
|
d852981371 | ||
|
|
afed5bd943 | ||
|
|
97b9041b76 | ||
|
|
2dc14ef466 | ||
|
|
8e69c32a36 | ||
|
|
42b33bea5b | ||
|
|
7fd101cbf8 | ||
|
|
92ee9889b1 | ||
|
|
b6e1610abe |
20
.github/workflows/cleanup_artifacts.yml
vendored
Normal file
20
.github/workflows/cleanup_artifacts.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: Remove old artifacts
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Every day at 1am
|
||||
- cron: '0 1 * * *'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
remove-old-artifacts:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- name: Remove old artifacts
|
||||
uses: c-hive/gha-remove-artifacts@v1
|
||||
with:
|
||||
age: '1 month'
|
||||
skip-tags: true
|
||||
10
.github/workflows/update_protobufs.yml
vendored
10
.github/workflows/update_protobufs.yml
vendored
@@ -15,22 +15,22 @@ jobs:
|
||||
run: |
|
||||
git pull --recurse-submodules
|
||||
git submodule update --remote --recursive
|
||||
|
||||
|
||||
- name: Download nanopb
|
||||
run: |
|
||||
wget https://jpa.kapsi.fi/nanopb/download/nanopb-0.4.6-linux-x86.tar.gz
|
||||
tar xvzf nanopb-0.4.6-linux-x86.tar.gz
|
||||
mv nanopb-0.4.6-linux-x86 nanopb-0.4.6
|
||||
|
||||
|
||||
- name: Re-generate protocol buffers
|
||||
run: |
|
||||
./bin/regen-protos.sh
|
||||
|
||||
./bin/regen-protobufs.sh
|
||||
|
||||
- name: Commit update
|
||||
run: |
|
||||
git config --global user.name 'github-actions'
|
||||
git config --global user.email 'bot@noreply.github.com'
|
||||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
||||
git add proto
|
||||
git add protobufs
|
||||
git add meshtastic
|
||||
git commit -m "Update protobuf submodule" && git push || echo "No changes to commit"
|
||||
|
||||
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
||||
[submodule "proto"]
|
||||
path = proto
|
||||
url = https://github.com/meshtastic/Meshtastic-protobufs.git
|
||||
[submodule "protobufs"]
|
||||
path = protobufs
|
||||
url = http://github.com/meshtastic/protobufs
|
||||
|
||||
4
Makefile
4
Makefile
@@ -26,11 +26,11 @@ lint:
|
||||
slow:
|
||||
pytest -m unit --durations=5
|
||||
|
||||
proto: FORCE
|
||||
protobufs: FORCE
|
||||
git submodule update --init --recursive
|
||||
git pull --rebase
|
||||
git submodule update --remote --merge
|
||||
./bin/regen-protos.sh
|
||||
./bin/regen-protobufs.sh
|
||||
|
||||
# run the coverage report and open results in a browser
|
||||
cov:
|
||||
|
||||
10
README.md
10
README.md
@@ -1,9 +1,9 @@
|
||||
# Meshtastic Python
|
||||
|
||||
[](https://codecov.io/gh/meshtastic/Meshtastic-python)
|
||||
[](https://codecov.io/gh/meshtastic/python)
|
||||

|
||||
[](https://github.com/meshtastic/Meshtastic-python/actions/workflows/ci.yml)
|
||||
[](https://cla-assistant.io/meshtastic/Meshtastic-python)
|
||||
[](https://github.com/meshtastic/python/actions/workflows/ci.yml)
|
||||
[](https://cla-assistant.io/meshtastic/python)
|
||||
[](https://opencollective.com/meshtastic/)
|
||||
[](https://vercel.com?utm_source=meshtastic&utm_campaign=oss)
|
||||
|
||||
@@ -14,12 +14,10 @@ This small library (and example application) provides an easy API for sending an
|
||||
It also provides access to any of the operations/data available in the device user interface or the Android application.
|
||||
Events are delivered using a publish-subscribe model, and you can subscribe to only the message types you are interested in.
|
||||
|
||||
|
||||
**[Getting Started Guide](https://meshtastic.org/docs/software/python/python-installation)**
|
||||
|
||||
**[Documentation/API Reference](https://python.meshtastic.org/)**
|
||||
|
||||
|
||||
## Stats
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
"""Bump the version number"""
|
||||
import re
|
||||
|
||||
version_filename = "setup.py"
|
||||
|
||||
@@ -19,7 +20,9 @@ with open(version_filename, 'w', encoding='utf-8') as f:
|
||||
words = line.split("=")
|
||||
# split the version into parts (by period)
|
||||
v = words[1].split(".")
|
||||
ver = f'{v[0]}.{v[1]}.{int(v[2]) + 1}'
|
||||
build_num = re.findall(r"\d+", v[2])[0]
|
||||
new_build_num = str(int(build_num)+1)
|
||||
ver = f'{v[0]}.{v[1]}.{v[2].replace(build_num, new_build_num)}'.replace('\n', '')
|
||||
f.write(f' version="{ver}",\n')
|
||||
else:
|
||||
f.write(line)
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
./nanopb-0.4.6/generator-bin/protoc -I=proto --python_out meshtastic `ls proto/*.proto`
|
||||
./nanopb-0.4.6/generator-bin/protoc -I=protobufs --python_out meshtastic `ls protobufs/*.proto`
|
||||
|
||||
# workaround for import bug in protoc https://github.com/protocolbuffers/protobuf/issues/1491#issuecomment-690618628
|
||||
|
||||
if [[ $OSTYPE == 'darwin'* ]]; then
|
||||
sed -i '' -E 's/^(import.*_pb2)/from . \1/' meshtastic/*.py
|
||||
# automate the current workaround (may be related to Meshtastic-protobufs issue #27 https://github.com/meshtastic/Meshtastic-protobufs/issues/27)
|
||||
# automate the current workaround (may be related to Meshtastic-protobufs issue #27 https://github.com/meshtastic/protobufs/issues/27)
|
||||
sed -i '' -E "s/^None = 0/globals()['None'] = 0/" meshtastic/mesh_pb2.py
|
||||
else
|
||||
sed -i -e 's/^import.*_pb2/from . \0/' meshtastic/*.py
|
||||
# automate the current workaround (may be related to Meshtastic-protobufs issue #27 https://github.com/meshtastic/Meshtastic-protobufs/issues/27)
|
||||
# automate the current workaround (may be related to Meshtastic-protobufs issue #27 https://github.com/meshtastic/protobufs/issues/27)
|
||||
sed -i -e "s/^None = 0/globals()['None'] = 0/" meshtastic/mesh_pb2.py
|
||||
fi
|
||||
@@ -2,16 +2,42 @@
|
||||
owner: Bob TBeam
|
||||
owner_short: BOB
|
||||
|
||||
channel_url: https://www.meshtastic.org/d/#CgUYAyIBAQ
|
||||
channel_url: https://www.meshtastic.org/e/#CgMSAQESCDgBQANIAVAe
|
||||
|
||||
location:
|
||||
lat: 35.88888
|
||||
lon: -93.88888
|
||||
alt: 304
|
||||
|
||||
user_prefs:
|
||||
region: 1
|
||||
is_always_powered: 'true'
|
||||
screen_on_secs: 31536000
|
||||
wait_bluetooth_secs: 31536000
|
||||
location_share: 'LocEnabled'
|
||||
config:
|
||||
bluetooth:
|
||||
enabled: true
|
||||
fixedPin: 123456
|
||||
device:
|
||||
serialEnabled: true
|
||||
display:
|
||||
screenOnSecs: 600
|
||||
lora:
|
||||
region: US
|
||||
hopLimit: 3
|
||||
txEnabled: true
|
||||
txPower: 30
|
||||
network:
|
||||
ntpServer: 0.pool.ntp.org
|
||||
position:
|
||||
gpsAttemptTime: 900
|
||||
gpsEnabled: true
|
||||
gpsUpdateInterval: 120
|
||||
positionBroadcastSecs: 900
|
||||
positionBroadcastSmartEnabled: true
|
||||
positionFlags: 3
|
||||
power:
|
||||
lsSecs: 300
|
||||
meshSdsTimeoutSecs: 7200
|
||||
minWakeSecs: 10
|
||||
sdsSecs: 4294967295
|
||||
|
||||
module_config:
|
||||
telemetry:
|
||||
deviceUpdateInterval: 900
|
||||
environmentUpdateInterval: 900
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Primary class: SerialInterface
|
||||
Install with pip: "[pip3 install meshtastic](https://pypi.org/project/meshtastic/)"
|
||||
Source code on [github](https://github.com/meshtastic/Meshtastic-python)
|
||||
Source code on [github](https://github.com/meshtastic/python)
|
||||
|
||||
properties of SerialInterface:
|
||||
|
||||
@@ -182,5 +182,6 @@ protocols = {
|
||||
portnums_pb2.PortNum.ADMIN_APP: KnownProtocol("admin", admin_pb2.AdminMessage),
|
||||
portnums_pb2.PortNum.ROUTING_APP: KnownProtocol("routing", mesh_pb2.Routing),
|
||||
portnums_pb2.PortNum.TELEMETRY_APP: KnownProtocol("telemetry", telemetry_pb2.Telemetry),
|
||||
portnums_pb2.PortNum.REMOTE_HARDWARE_APP: KnownProtocol("remotehw", remote_hardware_pb2.HardwareMessage)
|
||||
portnums_pb2.PortNum.REMOTE_HARDWARE_APP: KnownProtocol("remotehw", remote_hardware_pb2.HardwareMessage),
|
||||
portnums_pb2.PortNum.SIMULATOR_APP: KnownProtocol("simulator", mesh_pb2.Compressed)
|
||||
}
|
||||
|
||||
@@ -177,6 +177,7 @@ def setPref(config, comp_name, valStr):
|
||||
def onConnected(interface):
|
||||
"""Callback invoked when we connect to a radio"""
|
||||
closeNow = False # Should we drop the connection after we finish?
|
||||
waitForAckNak = False # Should we wait for an acknowledgment if we send to a remote node?
|
||||
try:
|
||||
our_globals = Globals.getInstance()
|
||||
args = our_globals.get_args()
|
||||
@@ -191,75 +192,79 @@ def onConnected(interface):
|
||||
alt = 0
|
||||
lat = 0.0
|
||||
lon = 0.0
|
||||
# TODO: use getNode(args.dest) to be able to set it for a remote node
|
||||
localConfig = interface.localNode.localConfig
|
||||
if args.setalt:
|
||||
alt = int(args.setalt)
|
||||
localConfig.fixed_position = True
|
||||
localConfig.position.fixed_position = True
|
||||
print(f"Fixing altitude at {alt} meters")
|
||||
if args.setlat:
|
||||
lat = float(args.setlat)
|
||||
localConfig.fixed_position = True
|
||||
localConfig.position.fixed_position = True
|
||||
print(f"Fixing latitude at {lat} degrees")
|
||||
if args.setlon:
|
||||
lon = float(args.setlon)
|
||||
localConfig.fixed_position = True
|
||||
localConfig.position.fixed_position = True
|
||||
print(f"Fixing longitude at {lon} degrees")
|
||||
|
||||
print("Setting device position")
|
||||
# can include lat/long/alt etc: latitude = 37.5, longitude = -122.1
|
||||
interface.sendPosition(lat, lon, alt)
|
||||
interface.localNode.writeConfig()
|
||||
interface.localNode.writeConfig('position')
|
||||
elif not args.no_time:
|
||||
# We normally provide a current time to the mesh when we connect
|
||||
interface.sendPosition()
|
||||
|
||||
if args.set_owner:
|
||||
closeNow = True
|
||||
waitForAckNak = True
|
||||
print(f"Setting device owner to {args.set_owner}")
|
||||
interface.getNode(args.dest).setOwner(args.set_owner)
|
||||
interface.getNode(args.dest, False).setOwner(args.set_owner)
|
||||
|
||||
if args.set_owner_short:
|
||||
closeNow = True
|
||||
waitForAckNak = True
|
||||
print(f"Setting device owner short to {args.set_owner_short}")
|
||||
interface.getNode(args.dest).setOwner(long_name=None, short_name=args.set_owner_short)
|
||||
interface.getNode(args.dest, False).setOwner(long_name=None, short_name=args.set_owner_short)
|
||||
|
||||
# TODO: add to export-config and configure
|
||||
if args.set_canned_message:
|
||||
closeNow = True
|
||||
waitForAckNak = True
|
||||
print(f"Setting canned plugin message to {args.set_canned_message}")
|
||||
interface.getNode(args.dest).set_canned_message(args.set_canned_message)
|
||||
interface.getNode(args.dest, False).set_canned_message(args.set_canned_message)
|
||||
|
||||
if args.pos_fields:
|
||||
# If --pos-fields invoked with args, set position fields
|
||||
closeNow = True
|
||||
localConfig = interface.getNode(args.dest).localConfig
|
||||
positionConfig = interface.getNode(args.dest).localConfig.position
|
||||
allFields = 0
|
||||
|
||||
try:
|
||||
for field in args.pos_fields:
|
||||
v_field = config_pb2.PositionFlags.Value(field)
|
||||
v_field = positionConfig.PositionFlags.Value(field)
|
||||
allFields |= v_field
|
||||
|
||||
except ValueError:
|
||||
print("ERROR: supported position fields are:")
|
||||
print(config_pb2.PositionFlags.keys())
|
||||
print(positionConfig.PositionFlags.keys())
|
||||
print("If no fields are specified, will read and display current value.")
|
||||
|
||||
else:
|
||||
print(f"Setting position fields to {allFields}")
|
||||
setPref(localConfig, 'position_flags', f'{allFields:d}')
|
||||
setPref(positionConfig, 'position_flags', f'{allFields:d}')
|
||||
print("Writing modified preferences to device")
|
||||
interface.getNode(args.dest).writeConfig()
|
||||
interface.getNode(args.dest).writeConfig('position')
|
||||
|
||||
elif args.pos_fields is not None:
|
||||
# If --pos-fields invoked without args, read and display current value
|
||||
closeNow = True
|
||||
localConfig = interface.getNode(args.dest).localConfig
|
||||
positionConfig = interface.getNode(args.dest).localConfig.position
|
||||
|
||||
fieldNames = []
|
||||
for bit in config_pb2.PositionFlags.values():
|
||||
if localConfig.position_flags & bit:
|
||||
fieldNames.append(config_pb2.PositionFlags.Name(bit))
|
||||
for bit in positionConfig.PositionFlags.values():
|
||||
if positionConfig.position_flags & bit:
|
||||
fieldNames.append(positionConfig.PositionFlags.Name(bit))
|
||||
print(' '.join(fieldNames))
|
||||
|
||||
if args.set_ham:
|
||||
@@ -271,15 +276,40 @@ def onConnected(interface):
|
||||
|
||||
if args.reboot:
|
||||
closeNow = True
|
||||
interface.getNode(args.dest).reboot()
|
||||
waitForAckNak = True
|
||||
interface.getNode(args.dest, False).reboot()
|
||||
|
||||
if args.reboot_ota:
|
||||
closeNow = True
|
||||
waitForAckNak = True
|
||||
interface.getNode(args.dest, False).rebootOTA();
|
||||
|
||||
if args.shutdown:
|
||||
closeNow = True
|
||||
interface.getNode(args.dest).shutdown()
|
||||
waitForAckNak = True
|
||||
interface.getNode(args.dest, False).shutdown()
|
||||
|
||||
if args.device_metadata:
|
||||
closeNow = True
|
||||
interface.getNode(args.dest).getMetadata()
|
||||
|
||||
if args.begin_edit:
|
||||
closeNow = True
|
||||
interface.getNode(args.dest, False).beginSettingsTransaction()
|
||||
|
||||
if args.commit_edit:
|
||||
closeNow = True
|
||||
interface.getNode(args.dest, False).commitSettingsTransaction()
|
||||
|
||||
if args.factory_reset:
|
||||
closeNow = True
|
||||
waitForAckNak = True
|
||||
interface.getNode(args.dest, False).factoryReset()
|
||||
|
||||
if args.reset_nodedb:
|
||||
closeNow = True
|
||||
waitForAckNak = True
|
||||
interface.getNode(args.dest, False).resetNodeDb()
|
||||
|
||||
if args.sendtext:
|
||||
closeNow = True
|
||||
@@ -355,23 +385,31 @@ def onConnected(interface):
|
||||
print(f"{node.localConfig.__class__.__name__} and {node.moduleConfig.__class__.__name__} do not have an attribute {pref[0]}.")
|
||||
else:
|
||||
print(f"{node.localConfig.__class__.__name__} and {node.moduleConfig.__class__.__name__} do not have attribute {pref[0]}.")
|
||||
print("Choices are...")
|
||||
printConfig(node.localConfig)
|
||||
printConfig(node.moduleConfig)
|
||||
|
||||
if args.configure:
|
||||
with open(args.configure[0], encoding='utf8') as file:
|
||||
configuration = yaml.safe_load(file)
|
||||
closeNow = True
|
||||
|
||||
interface.getNode(args.dest, False).beginSettingsTransaction()
|
||||
|
||||
if 'owner' in configuration:
|
||||
print(f"Setting device owner to {configuration['owner']}")
|
||||
interface.getNode(args.dest).setOwner(configuration['owner'])
|
||||
waitForAckNak = True
|
||||
interface.getNode(args.dest, False).setOwner(configuration['owner'])
|
||||
|
||||
if 'owner_short' in configuration:
|
||||
print(f"Setting device owner short to {configuration['owner_short']}")
|
||||
interface.getNode(args.dest).setOwner(long_name=None, short_name=configuration['owner_short'])
|
||||
waitForAckNak = True
|
||||
interface.getNode(args.dest, False).setOwner(long_name=None, short_name=configuration['owner_short'])
|
||||
|
||||
if 'ownerShort' in configuration:
|
||||
print(f"Setting device owner short to {configuration['ownerShort']}")
|
||||
interface.getNode(args.dest).setOwner(long_name=None, short_name=configuration['ownerShort'])
|
||||
waitForAckNak = True
|
||||
interface.getNode(args.dest, False).setOwner(long_name=None, short_name=configuration['ownerShort'])
|
||||
|
||||
if 'channel_url' in configuration:
|
||||
print("Setting channel url to", configuration['channel_url'])
|
||||
@@ -389,33 +427,36 @@ def onConnected(interface):
|
||||
|
||||
if 'alt' in configuration['location']:
|
||||
alt = int(configuration['location']['alt'])
|
||||
localConfig.fixed_position = True
|
||||
localConfig.position.fixed_position = True
|
||||
print(f"Fixing altitude at {alt} meters")
|
||||
if 'lat' in configuration['location']:
|
||||
lat = float(configuration['location']['lat'])
|
||||
localConfig.fixed_position = True
|
||||
localConfig.position.fixed_position = True
|
||||
print(f"Fixing latitude at {lat} degrees")
|
||||
if 'lon' in configuration['location']:
|
||||
lon = float(configuration['location']['lon'])
|
||||
localConfig.fixed_position = True
|
||||
localConfig.position.fixed_position = True
|
||||
print(f"Fixing longitude at {lon} degrees")
|
||||
print("Setting device position")
|
||||
interface.sendPosition(lat, lon, alt)
|
||||
interface.localNode.writeConfig()
|
||||
interface.localNode.writeConfig('position')
|
||||
|
||||
if 'user_prefs' in configuration:
|
||||
if 'config' in configuration:
|
||||
localConfig = interface.getNode(args.dest).localConfig
|
||||
for pref in configuration['user_prefs']:
|
||||
setPref(localConfig, pref, str(configuration['user_prefs'][pref]))
|
||||
print("Writing modified preferences to device")
|
||||
interface.getNode(args.dest).writeConfig()
|
||||
for section in configuration['config']:
|
||||
for pref in configuration['config'][section]:
|
||||
setPref(localConfig, f"{section}.{pref}", str(configuration['config'][section][pref]))
|
||||
interface.getNode(args.dest).writeConfig(section)
|
||||
|
||||
if 'module_config' in configuration:
|
||||
moduleConfig = interface.getNode(args.dest).moduleConfig
|
||||
for section in configuration['module_config']:
|
||||
for pref in configuration['module_config'][section]:
|
||||
setPref(moduleConfig, f"{section}.{pref}", str(configuration['module_config'][section][pref]))
|
||||
interface.getNode(args.dest).writeConfig(section)
|
||||
|
||||
if 'userPrefs' in configuration:
|
||||
localConfig = interface.getNode(args.dest).localConfig
|
||||
for pref in configuration['userPrefs']:
|
||||
setPref(localConfig, pref, str(configuration['userPrefs'][pref]))
|
||||
print("Writing modified preferences to device")
|
||||
interface.getNode(args.dest).writeConfig()
|
||||
interface.getNode(args.dest, False).commitSettingsTransaction()
|
||||
print("Writing modified configuration to device")
|
||||
|
||||
if args.export_config:
|
||||
# export the configuration (the opposite of '--configure')
|
||||
@@ -471,25 +512,25 @@ def onConnected(interface):
|
||||
|
||||
# handle the simple radio set commands
|
||||
if args.ch_vlongslow:
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.VLongSlow)
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.VERY_LONG_SLOW)
|
||||
|
||||
if args.ch_longslow:
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.LongSlow)
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.LONG_SLOW)
|
||||
|
||||
if args.ch_longfast:
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.LongFast)
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.LONG_FAST)
|
||||
|
||||
if args.ch_midslow:
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.MidSlow)
|
||||
if args.ch_medslow:
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.MEDIUM_SLOW)
|
||||
|
||||
if args.ch_midfast:
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.MidFast)
|
||||
if args.ch_medfast:
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.MEDIUM_FAST)
|
||||
|
||||
if args.ch_shortslow:
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.ShortSlow)
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.SHORT_SLOW)
|
||||
|
||||
if args.ch_shortfast:
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.ShortFast)
|
||||
setSimpleConfig(config_pb2.Config.LoRaConfig.ModemPreset.SHORT_FAST)
|
||||
|
||||
if args.ch_set or args.ch_enable or args.ch_disable:
|
||||
closeNow = True
|
||||
@@ -559,8 +600,11 @@ def onConnected(interface):
|
||||
print(f"{localConfig.__class__.__name__} and {moduleConfig.__class__.__name__} do not have an attribute {pref[0]}.")
|
||||
else:
|
||||
print(f"{localConfig.__class__.__name__} and {moduleConfig.__class__.__name__} do not have attribute {pref[0]}.")
|
||||
|
||||
print("Completed getting preferences")
|
||||
print("Choices are...")
|
||||
printConfig(localConfig)
|
||||
printConfig(moduleConfig)
|
||||
else:
|
||||
print("Completed getting preferences")
|
||||
|
||||
if args.nodes:
|
||||
closeNow = True
|
||||
@@ -584,6 +628,10 @@ def onConnected(interface):
|
||||
else:
|
||||
tunnel.Tunnel(interface, subnet=args.tunnel_net)
|
||||
|
||||
if args.dest != BROADCAST_ADDR and waitForAckNak:
|
||||
print(f"Waiting for an acknowledgment from remote node (this could take a while)")
|
||||
interface.getNode(args.dest, False).iface.waitForAckNak()
|
||||
|
||||
# if the user didn't ask for serial debugging output, we might want to exit after we've done our operation
|
||||
if (not args.seriallog) and closeNow:
|
||||
interface.close() # after running command then exit
|
||||
@@ -592,6 +640,20 @@ def onConnected(interface):
|
||||
print(f"Aborting due to: {ex}")
|
||||
interface.close() # close the connection now, so that our app exits
|
||||
|
||||
def printConfig(config):
|
||||
objDesc = config.DESCRIPTOR
|
||||
for config_section in objDesc.fields:
|
||||
if config_section.name != "version":
|
||||
config = objDesc.fields_by_name.get(config_section.name)
|
||||
print(f"{config_section.name}:")
|
||||
names = []
|
||||
for field in config.message_type.fields:
|
||||
tmp_name = f'{config_section.name}.{field.name}'
|
||||
if Globals.getInstance().get_camel_case():
|
||||
tmp_name = meshtastic.util.snake_to_camel(tmp_name)
|
||||
names.append(tmp_name)
|
||||
for temp_name in sorted(names):
|
||||
print(f" {temp_name}")
|
||||
|
||||
def onNode(node):
|
||||
"""Callback invoked when the node DB changes"""
|
||||
@@ -637,20 +699,32 @@ def export_config(interface):
|
||||
configObj["channel_url"] = channel_url
|
||||
if lat or lon or alt:
|
||||
configObj["location"] = { "lat": lat, "lon": lon, "alt": alt }
|
||||
preferences = MessageToDict(interface.localNode.localConfig)
|
||||
if preferences:
|
||||
|
||||
config = MessageToDict(interface.localNode.localConfig)
|
||||
if config:
|
||||
# Convert inner keys to correct snake/camelCase
|
||||
prefs = {}
|
||||
for pref in preferences:
|
||||
for pref in config:
|
||||
if Globals.getInstance().get_camel_case():
|
||||
prefs[meshtastic.util.snake_to_camel(pref)] = preferences[pref]
|
||||
prefs[meshtastic.util.snake_to_camel(pref)] = config[pref]
|
||||
else:
|
||||
# TODO: Possibly convert camel to snake?
|
||||
prefs[pref] = preferences[pref]
|
||||
prefs[pref] = config[pref]
|
||||
if Globals.getInstance().get_camel_case():
|
||||
configObj["userPrefs"] = preferences
|
||||
configObj["config"] = config
|
||||
else:
|
||||
configObj["user_prefs"] = preferences
|
||||
configObj["config"] = config
|
||||
|
||||
module_config = MessageToDict(interface.localNode.moduleConfig)
|
||||
if module_config:
|
||||
# Convert inner keys to correct snake/camelCase
|
||||
prefs = {}
|
||||
for pref in module_config:
|
||||
if len(module_config[pref]) > 0:
|
||||
prefs[pref] = module_config[pref]
|
||||
if Globals.getInstance().get_camel_case():
|
||||
configObj["module_config"] = prefs
|
||||
else:
|
||||
configObj["module_config"] = prefs
|
||||
|
||||
config = "# start of Meshtastic configure yaml\n"
|
||||
config += yaml.dump(configObj)
|
||||
@@ -829,10 +903,10 @@ def initParser():
|
||||
"--ch-longfast", help="Change to the long-range and fast channel", action='store_true')
|
||||
|
||||
parser.add_argument(
|
||||
"--ch-midslow", help="Change to the mid-range and slow channel", action='store_true')
|
||||
"--ch-medslow", help="Change to the med-range and slow channel", action='store_true')
|
||||
|
||||
parser.add_argument(
|
||||
"--ch-midfast", help="Change to the mid-range and fast channel", action='store_true')
|
||||
"--ch-medfast", help="Change to the med-range and fast channel", action='store_true')
|
||||
|
||||
parser.add_argument(
|
||||
"--ch-shortslow", help="Change to the short-range and slow channel", action='store_true')
|
||||
@@ -864,11 +938,26 @@ def initParser():
|
||||
parser.add_argument(
|
||||
"--reboot", help="Tell the destination node to reboot", action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
"--reboot-ota", help="Tell the destination node to reboot into factory firmware", action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
"--shutdown", help="Tell the destination node to shutdown", action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
"--device-metadata", help="Get the device metadata from the node", action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
"--begin-edit", help="Tell the node to open a transaction to edit settings", action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
"--commit-edit", help="Tell the node to commit open settings transaction", action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
"--factory-reset", help="Tell the destination node to install the default config", action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
"--reset-nodedb", help="Tell the destination node clear its list of nodes", action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
"--reply", help="Reply to received messages",
|
||||
|
||||
@@ -19,7 +19,7 @@ from . import mesh_pb2 as mesh__pb2
|
||||
from . import module_config_pb2 as module__config__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x61\x64min.proto\x1a\rchannel.proto\x1a\x0c\x63onfig.proto\x1a\x15\x64\x65vice_metadata.proto\x1a\nmesh.proto\x1a\x13module_config.proto\"\xb1\n\n\x0c\x41\x64minMessage\x12\x1a\n\tset_owner\x18\x02 \x01(\x0b\x32\x05.UserH\x00\x12\x1f\n\x0bset_channel\x18\x03 \x01(\x0b\x32\x08.ChannelH\x00\x12\x1d\n\x13get_channel_request\x18\x06 \x01(\rH\x00\x12(\n\x14get_channel_response\x18\x07 \x01(\x0b\x32\x08.ChannelH\x00\x12\x1b\n\x11get_owner_request\x18\x08 \x01(\x08H\x00\x12#\n\x12get_owner_response\x18\t \x01(\x0b\x32\x05.UserH\x00\x12\x36\n\x12get_config_request\x18\n \x01(\x0e\x32\x18.AdminMessage.ConfigTypeH\x00\x12&\n\x13get_config_response\x18\x0b \x01(\x0b\x32\x07.ConfigH\x00\x12\x1d\n\nset_config\x18\x0c \x01(\x0b\x32\x07.ConfigH\x00\x12\x1c\n\x12\x63onfirm_set_config\x18\r \x01(\x08H\x00\x12\x43\n\x19get_module_config_request\x18\x0e \x01(\x0e\x32\x1e.AdminMessage.ModuleConfigTypeH\x00\x12\x33\n\x1aget_module_config_response\x18\x0f \x01(\x0b\x32\r.ModuleConfigH\x00\x12*\n\x11set_module_config\x18\x10 \x01(\x0b\x32\r.ModuleConfigH\x00\x12#\n\x19\x63onfirm_set_module_config\x18\x11 \x01(\x08H\x00\x12!\n\x17get_all_channel_request\x18\x12 \x01(\x08H\x00\x12\x1d\n\x13\x63onfirm_set_channel\x18 \x01(\x08H\x00\x12\x1b\n\x11\x63onfirm_set_radio\x18! \x01(\x08H\x00\x12\x18\n\x0e\x65xit_simulator\x18\" \x01(\x08H\x00\x12\x18\n\x0ereboot_seconds\x18# \x01(\x05H\x00\x12\x34\n*get_canned_message_module_messages_request\x18$ \x01(\x08H\x00\x12\x35\n+get_canned_message_module_messages_response\x18% \x01(\tH\x00\x12,\n\"set_canned_message_module_messages\x18, \x01(\tH\x00\x12\x1a\n\x10shutdown_seconds\x18\x33 \x01(\x05H\x00\x12%\n\x1bget_device_metadata_request\x18\x34 \x01(\rH\x00\x12\x37\n\x1cget_device_metadata_response\x18\x35 \x01(\x0b\x32\x0f.DeviceMetadataH\x00\"\x92\x01\n\nConfigType\x12\x11\n\rDEVICE_CONFIG\x10\x00\x12\x13\n\x0fPOSITION_CONFIG\x10\x01\x12\x10\n\x0cPOWER_CONFIG\x10\x02\x12\x0f\n\x0bWIFI_CONFIG\x10\x03\x12\x12\n\x0e\x44ISPLAY_CONFIG\x10\x04\x12\x0f\n\x0bLORA_CONFIG\x10\x05\x12\x14\n\x10\x42LUETOOTH_CONFIG\x10\x06\"\xa6\x01\n\x10ModuleConfigType\x12\x0f\n\x0bMQTT_CONFIG\x10\x00\x12\x11\n\rSERIAL_CONFIG\x10\x01\x12\x13\n\x0f\x45XTNOTIF_CONFIG\x10\x02\x12\x17\n\x13STOREFORWARD_CONFIG\x10\x03\x12\x14\n\x10RANGETEST_CONFIG\x10\x04\x12\x14\n\x10TELEMETRY_CONFIG\x10\x05\x12\x14\n\x10\x43\x41NNEDMSG_CONFIG\x10\x06\x42\t\n\x07variantBG\n\x13\x63om.geeksville.meshB\x0b\x41\x64minProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x61\x64min.proto\x1a\rchannel.proto\x1a\x0c\x63onfig.proto\x1a\x15\x64\x65vice_metadata.proto\x1a\nmesh.proto\x1a\x13module_config.proto\"\xf6\n\n\x0c\x41\x64minMessage\x12\x1d\n\x13get_channel_request\x18\x01 \x01(\rH\x00\x12(\n\x14get_channel_response\x18\x02 \x01(\x0b\x32\x08.ChannelH\x00\x12\x1b\n\x11get_owner_request\x18\x03 \x01(\x08H\x00\x12#\n\x12get_owner_response\x18\x04 \x01(\x0b\x32\x05.UserH\x00\x12\x36\n\x12get_config_request\x18\x05 \x01(\x0e\x32\x18.AdminMessage.ConfigTypeH\x00\x12&\n\x13get_config_response\x18\x06 \x01(\x0b\x32\x07.ConfigH\x00\x12\x43\n\x19get_module_config_request\x18\x07 \x01(\x0e\x32\x1e.AdminMessage.ModuleConfigTypeH\x00\x12\x33\n\x1aget_module_config_response\x18\x08 \x01(\x0b\x32\r.ModuleConfigH\x00\x12\x34\n*get_canned_message_module_messages_request\x18\n \x01(\x08H\x00\x12\x35\n+get_canned_message_module_messages_response\x18\x0b \x01(\tH\x00\x12%\n\x1bget_device_metadata_request\x18\x0c \x01(\x08H\x00\x12\x37\n\x1cget_device_metadata_response\x18\r \x01(\x0b\x32\x0f.DeviceMetadataH\x00\x12\x1a\n\tset_owner\x18 \x01(\x0b\x32\x05.UserH\x00\x12\x1f\n\x0bset_channel\x18! \x01(\x0b\x32\x08.ChannelH\x00\x12\x1d\n\nset_config\x18\" \x01(\x0b\x32\x07.ConfigH\x00\x12*\n\x11set_module_config\x18# \x01(\x0b\x32\r.ModuleConfigH\x00\x12,\n\"set_canned_message_module_messages\x18$ \x01(\tH\x00\x12\x1d\n\x13\x62\x65gin_edit_settings\x18@ \x01(\x08H\x00\x12\x1e\n\x14\x63ommit_edit_settings\x18\x41 \x01(\x08H\x00\x12\x1d\n\x13\x63onfirm_set_channel\x18\x42 \x01(\x08H\x00\x12\x1b\n\x11\x63onfirm_set_radio\x18\x43 \x01(\x08H\x00\x12\x1c\n\x12reboot_ota_seconds\x18_ \x01(\x05H\x00\x12\x18\n\x0e\x65xit_simulator\x18` \x01(\x08H\x00\x12\x18\n\x0ereboot_seconds\x18\x61 \x01(\x05H\x00\x12\x1a\n\x10shutdown_seconds\x18\x62 \x01(\x05H\x00\x12\x17\n\rfactory_reset\x18\x63 \x01(\x05H\x00\x12\x16\n\x0cnodedb_reset\x18\x64 \x01(\x05H\x00\"\x95\x01\n\nConfigType\x12\x11\n\rDEVICE_CONFIG\x10\x00\x12\x13\n\x0fPOSITION_CONFIG\x10\x01\x12\x10\n\x0cPOWER_CONFIG\x10\x02\x12\x12\n\x0eNETWORK_CONFIG\x10\x03\x12\x12\n\x0e\x44ISPLAY_CONFIG\x10\x04\x12\x0f\n\x0bLORA_CONFIG\x10\x05\x12\x14\n\x10\x42LUETOOTH_CONFIG\x10\x06\"\xb8\x01\n\x10ModuleConfigType\x12\x0f\n\x0bMQTT_CONFIG\x10\x00\x12\x11\n\rSERIAL_CONFIG\x10\x01\x12\x13\n\x0f\x45XTNOTIF_CONFIG\x10\x02\x12\x17\n\x13STOREFORWARD_CONFIG\x10\x03\x12\x14\n\x10RANGETEST_CONFIG\x10\x04\x12\x14\n\x10TELEMETRY_CONFIG\x10\x05\x12\x14\n\x10\x43\x41NNEDMSG_CONFIG\x10\x06\x12\x10\n\x0c\x41UDIO_CONFIG\x10\x07\x42\x11\n\x0fpayload_variantBH\n\x13\x63om.geeksville.meshB\x0b\x41\x64minProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
@@ -36,11 +36,11 @@ _sym_db.RegisterMessage(AdminMessage)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\013AdminProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\013AdminProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_ADMINMESSAGE._serialized_start=101
|
||||
_ADMINMESSAGE._serialized_end=1430
|
||||
_ADMINMESSAGE_CONFIGTYPE._serialized_start=1104
|
||||
_ADMINMESSAGE_CONFIGTYPE._serialized_end=1250
|
||||
_ADMINMESSAGE_MODULECONFIGTYPE._serialized_start=1253
|
||||
_ADMINMESSAGE_MODULECONFIGTYPE._serialized_end=1419
|
||||
_ADMINMESSAGE._serialized_end=1499
|
||||
_ADMINMESSAGE_CONFIGTYPE._serialized_start=1144
|
||||
_ADMINMESSAGE_CONFIGTYPE._serialized_end=1293
|
||||
_ADMINMESSAGE_MODULECONFIGTYPE._serialized_start=1296
|
||||
_ADMINMESSAGE_MODULECONFIGTYPE._serialized_end=1480
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -16,7 +16,7 @@ from . import channel_pb2 as channel__pb2
|
||||
from . import config_pb2 as config__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rapponly.proto\x1a\rchannel.proto\x1a\x0c\x63onfig.proto\"Y\n\nChannelSet\x12\"\n\x08settings\x18\x01 \x03(\x0b\x32\x10.ChannelSettings\x12\'\n\x0blora_config\x18\x02 \x01(\x0b\x32\x12.Config.LoRaConfigBI\n\x13\x63om.geeksville.meshB\rAppOnlyProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rapponly.proto\x1a\rchannel.proto\x1a\x0c\x63onfig.proto\"Y\n\nChannelSet\x12\"\n\x08settings\x18\x01 \x03(\x0b\x32\x10.ChannelSettings\x12\'\n\x0blora_config\x18\x02 \x01(\x0b\x32\x12.Config.LoRaConfigBJ\n\x13\x63om.geeksville.meshB\rAppOnlyProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ _sym_db.RegisterMessage(ChannelSet)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\rAppOnlyProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\rAppOnlyProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_CHANNELSET._serialized_start=46
|
||||
_CHANNELSET._serialized_end=135
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x63\x61nnedmessages.proto\"-\n\x19\x43\x61nnedMessageModuleConfig\x12\x10\n\x08messages\x18\x01 \x01(\tBU\n\x13\x63om.geeksville.meshB\x19\x43\x61nnedMessageConfigProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x63\x61nnedmessages.proto\"-\n\x19\x43\x61nnedMessageModuleConfig\x12\x10\n\x08messages\x18\x01 \x01(\tBV\n\x13\x63om.geeksville.meshB\x19\x43\x61nnedMessageConfigProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ _sym_db.RegisterMessage(CannedMessageModuleConfig)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\031CannedMessageConfigProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\031CannedMessageConfigProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_CANNEDMESSAGEMODULECONFIG._serialized_start=24
|
||||
_CANNEDMESSAGEMODULECONFIG._serialized_end=69
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rchannel.proto\"\x7f\n\x0f\x43hannelSettings\x12\x13\n\x0b\x63hannel_num\x18\t \x01(\r\x12\x0b\n\x03psk\x18\x04 \x01(\x0c\x12\x0c\n\x04name\x18\x05 \x01(\t\x12\n\n\x02id\x18\n \x01(\x07\x12\x16\n\x0euplink_enabled\x18\x10 \x01(\x08\x12\x18\n\x10\x64ownlink_enabled\x18\x11 \x01(\x08\"\x8b\x01\n\x07\x43hannel\x12\r\n\x05index\x18\x01 \x01(\x05\x12\"\n\x08settings\x18\x02 \x01(\x0b\x32\x10.ChannelSettings\x12\x1b\n\x04role\x18\x03 \x01(\x0e\x32\r.Channel.Role\"0\n\x04Role\x12\x0c\n\x08\x44ISABLED\x10\x00\x12\x0b\n\x07PRIMARY\x10\x01\x12\r\n\tSECONDARY\x10\x02\x42I\n\x13\x63om.geeksville.meshB\rChannelProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rchannel.proto\"\x83\x01\n\x0f\x43hannelSettings\x12\x17\n\x0b\x63hannel_num\x18\x01 \x01(\rB\x02\x18\x01\x12\x0b\n\x03psk\x18\x02 \x01(\x0c\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\n\n\x02id\x18\x04 \x01(\x07\x12\x16\n\x0euplink_enabled\x18\x05 \x01(\x08\x12\x18\n\x10\x64ownlink_enabled\x18\x06 \x01(\x08\"\x8b\x01\n\x07\x43hannel\x12\r\n\x05index\x18\x01 \x01(\x05\x12\"\n\x08settings\x18\x02 \x01(\x0b\x32\x10.ChannelSettings\x12\x1b\n\x04role\x18\x03 \x01(\x0e\x32\r.Channel.Role\"0\n\x04Role\x12\x0c\n\x08\x44ISABLED\x10\x00\x12\x0b\n\x07PRIMARY\x10\x01\x12\r\n\tSECONDARY\x10\x02\x42J\n\x13\x63om.geeksville.meshB\rChannelProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
@@ -38,11 +38,13 @@ _sym_db.RegisterMessage(Channel)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\rChannelProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
_CHANNELSETTINGS._serialized_start=17
|
||||
_CHANNELSETTINGS._serialized_end=144
|
||||
_CHANNEL._serialized_start=147
|
||||
_CHANNEL._serialized_end=286
|
||||
_CHANNEL_ROLE._serialized_start=238
|
||||
_CHANNEL_ROLE._serialized_end=286
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\rChannelProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_CHANNELSETTINGS.fields_by_name['channel_num']._options = None
|
||||
_CHANNELSETTINGS.fields_by_name['channel_num']._serialized_options = b'\030\001'
|
||||
_CHANNELSETTINGS._serialized_start=18
|
||||
_CHANNELSETTINGS._serialized_end=149
|
||||
_CHANNEL._serialized_start=152
|
||||
_CHANNEL._serialized_end=291
|
||||
_CHANNEL_ROLE._serialized_start=243
|
||||
_CHANNEL_ROLE._serialized_end=291
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x64\x65vice_metadata.proto\"H\n\x0e\x44\x65viceMetadata\x12\x18\n\x10\x66irmware_version\x18\x01 \x01(\t\x12\x1c\n\x14\x64\x65vice_state_version\x18\x02 \x01(\rBP\n\x13\x63om.geeksville.meshB\x14\x44\x65viceMetadataProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x64\x65vice_metadata.proto\"\x99\x01\n\x0e\x44\x65viceMetadata\x12\x18\n\x10\x66irmware_version\x18\x01 \x01(\t\x12\x1c\n\x14\x64\x65vice_state_version\x18\x02 \x01(\r\x12\x13\n\x0b\x63\x61nShutdown\x18\x03 \x01(\x08\x12\x0f\n\x07hasWifi\x18\x04 \x01(\x08\x12\x14\n\x0chasBluetooth\x18\x05 \x01(\x08\x12\x13\n\x0bhasEthernet\x18\x06 \x01(\x08\x42Q\n\x13\x63om.geeksville.meshB\x14\x44\x65viceMetadataProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ _sym_db.RegisterMessage(DeviceMetadata)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\024DeviceMetadataProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
_DEVICEMETADATA._serialized_start=25
|
||||
_DEVICEMETADATA._serialized_end=97
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\024DeviceMetadataProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_DEVICEMETADATA._serialized_start=26
|
||||
_DEVICEMETADATA._serialized_end=179
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -17,7 +17,7 @@ from . import channel_pb2 as channel__pb2
|
||||
from . import mesh_pb2 as mesh__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x64\x65viceonly.proto\x1a\rchannel.proto\x1a\nmesh.proto\"\xe6\x01\n\x0b\x44\x65viceState\x12\x1c\n\x07my_node\x18\x02 \x01(\x0b\x32\x0b.MyNodeInfo\x12\x14\n\x05owner\x18\x03 \x01(\x0b\x32\x05.User\x12\x1a\n\x07node_db\x18\x04 \x03(\x0b\x32\t.NodeInfo\x12\"\n\rreceive_queue\x18\x05 \x03(\x0b\x32\x0b.MeshPacket\x12\x0f\n\x07version\x18\x08 \x01(\r\x12$\n\x0frx_text_message\x18\x07 \x01(\x0b\x32\x0b.MeshPacket\x12\x0f\n\x07no_save\x18\t \x01(\x08\x12\x15\n\rdid_gps_reset\x18\x0b \x01(\x08J\x04\x08\x0c\x10\r\":\n\x0b\x43hannelFile\x12\x1a\n\x08\x63hannels\x18\x01 \x03(\x0b\x32\x08.Channel\x12\x0f\n\x07version\x18\x02 \x01(\r\"\x84\x01\n\x08OEMStore\x12\x16\n\x0eoem_icon_width\x18\x01 \x01(\r\x12\x17\n\x0foem_icon_height\x18\x02 \x01(\r\x12\x15\n\roem_icon_bits\x18\x03 \x01(\x0c\x12\x1e\n\x08oem_font\x18\x04 \x01(\x0e\x32\x0c.ScreenFonts\x12\x10\n\x08oem_text\x18\x05 \x01(\t*>\n\x0bScreenFonts\x12\x0e\n\nFONT_SMALL\x10\x00\x12\x0f\n\x0b\x46ONT_MEDIUM\x10\x01\x12\x0e\n\nFONT_LARGE\x10\x02\x42\x46\n\x13\x63om.geeksville.meshB\nDeviceOnlyH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x64\x65viceonly.proto\x1a\rchannel.proto\x1a\nmesh.proto\"\xe0\x01\n\x0b\x44\x65viceState\x12\x1c\n\x07my_node\x18\x02 \x01(\x0b\x32\x0b.MyNodeInfo\x12\x14\n\x05owner\x18\x03 \x01(\x0b\x32\x05.User\x12\x1a\n\x07node_db\x18\x04 \x03(\x0b\x32\t.NodeInfo\x12\"\n\rreceive_queue\x18\x05 \x03(\x0b\x32\x0b.MeshPacket\x12\x0f\n\x07version\x18\x08 \x01(\r\x12$\n\x0frx_text_message\x18\x07 \x01(\x0b\x32\x0b.MeshPacket\x12\x0f\n\x07no_save\x18\t \x01(\x08\x12\x15\n\rdid_gps_reset\x18\x0b \x01(\x08\":\n\x0b\x43hannelFile\x12\x1a\n\x08\x63hannels\x18\x01 \x03(\x0b\x32\x08.Channel\x12\x0f\n\x07version\x18\x02 \x01(\r\"\x99\x01\n\x08OEMStore\x12\x16\n\x0eoem_icon_width\x18\x01 \x01(\r\x12\x17\n\x0foem_icon_height\x18\x02 \x01(\r\x12\x15\n\roem_icon_bits\x18\x03 \x01(\x0c\x12\x1e\n\x08oem_font\x18\x04 \x01(\x0e\x32\x0c.ScreenFonts\x12\x10\n\x08oem_text\x18\x05 \x01(\t\x12\x13\n\x0boem_aes_key\x18\x06 \x01(\x0c*>\n\x0bScreenFonts\x12\x0e\n\nFONT_SMALL\x10\x00\x12\x0f\n\x0b\x46ONT_MEDIUM\x10\x01\x12\x0e\n\nFONT_LARGE\x10\x02\x42G\n\x13\x63om.geeksville.meshB\nDeviceOnlyH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
_SCREENFONTS = DESCRIPTOR.enum_types_by_name['ScreenFonts']
|
||||
ScreenFonts = enum_type_wrapper.EnumTypeWrapper(_SCREENFONTS)
|
||||
@@ -53,13 +53,13 @@ _sym_db.RegisterMessage(OEMStore)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\nDeviceOnlyH\003Z!github.com/meshtastic/gomeshproto'
|
||||
_SCREENFONTS._serialized_start=475
|
||||
_SCREENFONTS._serialized_end=537
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\nDeviceOnlyH\003Z\"github.com/meshtastic/go/generated'
|
||||
_SCREENFONTS._serialized_start=490
|
||||
_SCREENFONTS._serialized_end=552
|
||||
_DEVICESTATE._serialized_start=48
|
||||
_DEVICESTATE._serialized_end=278
|
||||
_CHANNELFILE._serialized_start=280
|
||||
_CHANNELFILE._serialized_end=338
|
||||
_OEMSTORE._serialized_start=341
|
||||
_OEMSTORE._serialized_end=473
|
||||
_DEVICESTATE._serialized_end=272
|
||||
_CHANNELFILE._serialized_start=274
|
||||
_CHANNELFILE._serialized_end=332
|
||||
_OEMSTORE._serialized_start=335
|
||||
_OEMSTORE._serialized_end=488
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -16,7 +16,7 @@ from . import config_pb2 as config__pb2
|
||||
from . import module_config_pb2 as module__config__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0flocalonly.proto\x1a\x0c\x63onfig.proto\x1a\x13module_config.proto\"\xaa\x02\n\x0bLocalConfig\x12$\n\x06\x64\x65vice\x18\x01 \x01(\x0b\x32\x14.Config.DeviceConfig\x12(\n\x08position\x18\x02 \x01(\x0b\x32\x16.Config.PositionConfig\x12\"\n\x05power\x18\x03 \x01(\x0b\x32\x13.Config.PowerConfig\x12 \n\x04wifi\x18\x04 \x01(\x0b\x32\x12.Config.WiFiConfig\x12&\n\x07\x64isplay\x18\x05 \x01(\x0b\x32\x15.Config.DisplayConfig\x12 \n\x04lora\x18\x06 \x01(\x0b\x32\x12.Config.LoRaConfig\x12*\n\tbluetooth\x18\x07 \x01(\x0b\x32\x17.Config.BluetoothConfig\x12\x0f\n\x07version\x18\x08 \x01(\r\"\x9a\x03\n\x11LocalModuleConfig\x12&\n\x04mqtt\x18\x01 \x01(\x0b\x32\x18.ModuleConfig.MQTTConfig\x12*\n\x06serial\x18\x02 \x01(\x0b\x32\x1a.ModuleConfig.SerialConfig\x12G\n\x15\x65xternal_notification\x18\x03 \x01(\x0b\x32(.ModuleConfig.ExternalNotificationConfig\x12\x37\n\rstore_forward\x18\x04 \x01(\x0b\x32 .ModuleConfig.StoreForwardConfig\x12\x31\n\nrange_test\x18\x05 \x01(\x0b\x32\x1d.ModuleConfig.RangeTestConfig\x12\x30\n\ttelemetry\x18\x06 \x01(\x0b\x32\x1d.ModuleConfig.TelemetryConfig\x12\x39\n\x0e\x63\x61nned_message\x18\x07 \x01(\x0b\x32!.ModuleConfig.CannedMessageConfig\x12\x0f\n\x07version\x18\x08 \x01(\rBK\n\x13\x63om.geeksville.meshB\x0fLocalOnlyProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0flocalonly.proto\x1a\x0c\x63onfig.proto\x1a\x13module_config.proto\"\xb0\x02\n\x0bLocalConfig\x12$\n\x06\x64\x65vice\x18\x01 \x01(\x0b\x32\x14.Config.DeviceConfig\x12(\n\x08position\x18\x02 \x01(\x0b\x32\x16.Config.PositionConfig\x12\"\n\x05power\x18\x03 \x01(\x0b\x32\x13.Config.PowerConfig\x12&\n\x07network\x18\x04 \x01(\x0b\x32\x15.Config.NetworkConfig\x12&\n\x07\x64isplay\x18\x05 \x01(\x0b\x32\x15.Config.DisplayConfig\x12 \n\x04lora\x18\x06 \x01(\x0b\x32\x12.Config.LoRaConfig\x12*\n\tbluetooth\x18\x07 \x01(\x0b\x32\x17.Config.BluetoothConfig\x12\x0f\n\x07version\x18\x08 \x01(\r\"\xc4\x03\n\x11LocalModuleConfig\x12&\n\x04mqtt\x18\x01 \x01(\x0b\x32\x18.ModuleConfig.MQTTConfig\x12*\n\x06serial\x18\x02 \x01(\x0b\x32\x1a.ModuleConfig.SerialConfig\x12G\n\x15\x65xternal_notification\x18\x03 \x01(\x0b\x32(.ModuleConfig.ExternalNotificationConfig\x12\x37\n\rstore_forward\x18\x04 \x01(\x0b\x32 .ModuleConfig.StoreForwardConfig\x12\x31\n\nrange_test\x18\x05 \x01(\x0b\x32\x1d.ModuleConfig.RangeTestConfig\x12\x30\n\ttelemetry\x18\x06 \x01(\x0b\x32\x1d.ModuleConfig.TelemetryConfig\x12\x39\n\x0e\x63\x61nned_message\x18\x07 \x01(\x0b\x32!.ModuleConfig.CannedMessageConfig\x12(\n\x05\x61udio\x18\t \x01(\x0b\x32\x19.ModuleConfig.AudioConfig\x12\x0f\n\x07version\x18\x08 \x01(\rBL\n\x13\x63om.geeksville.meshB\x0fLocalOnlyProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
@@ -39,9 +39,9 @@ _sym_db.RegisterMessage(LocalModuleConfig)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\017LocalOnlyProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\017LocalOnlyProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_LOCALCONFIG._serialized_start=55
|
||||
_LOCALCONFIG._serialized_end=353
|
||||
_LOCALMODULECONFIG._serialized_start=356
|
||||
_LOCALMODULECONFIG._serialized_end=766
|
||||
_LOCALCONFIG._serialized_end=359
|
||||
_LOCALMODULECONFIG._serialized_start=362
|
||||
_LOCALMODULECONFIG._serialized_end=814
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -18,7 +18,7 @@ from google.protobuf.json_format import MessageToJson
|
||||
|
||||
import meshtastic.node
|
||||
from meshtastic import portnums_pb2, mesh_pb2
|
||||
from meshtastic.util import stripnl, Timeout, our_exit, remove_keys_from_dict, convert_mac_addr
|
||||
from meshtastic.util import stripnl, Timeout, Acknowledgment, our_exit, remove_keys_from_dict, convert_mac_addr
|
||||
from meshtastic.__init__ import LOCAL_ADDR, BROADCAST_NUM, BROADCAST_ADDR, ResponseHandler, publishingThread, OUR_APP_VERSION, protocols
|
||||
|
||||
class MeshInterface:
|
||||
@@ -47,6 +47,7 @@ class MeshInterface:
|
||||
self.responseHandlers = {} # A map from request ID to the handler
|
||||
self.failure = None # If we've encountered a fatal exception it will be kept here
|
||||
self._timeout = Timeout()
|
||||
self._acknowledgment = Acknowledgment()
|
||||
self.heartbeatTimer = None
|
||||
random.seed() # FIXME, we should not clobber the random seedval here, instead tell user they must call it
|
||||
self.currentPacketId = random.randint(0, 0xffffffff)
|
||||
@@ -157,16 +158,18 @@ class MeshInterface:
|
||||
return table
|
||||
|
||||
|
||||
def getNode(self, nodeId):
|
||||
def getNode(self, nodeId, requestConfig=True):
|
||||
"""Return a node object which contains device settings and channel info"""
|
||||
if nodeId in (LOCAL_ADDR, BROADCAST_ADDR):
|
||||
return self.localNode
|
||||
else:
|
||||
n = meshtastic.node.Node(self, nodeId)
|
||||
logging.debug("About to requestConfig")
|
||||
n.requestConfig()
|
||||
if not n.waitForConfig():
|
||||
our_exit("Error: Timed out waiting for node config")
|
||||
# Only request device settings and channel info when necessary
|
||||
if requestConfig:
|
||||
logging.debug("About to requestConfig")
|
||||
n.requestConfig()
|
||||
if not n.waitForConfig():
|
||||
our_exit("Error: Timed out waiting for node config")
|
||||
return n
|
||||
|
||||
def sendText(self, text: AnyStr,
|
||||
@@ -366,6 +369,11 @@ class MeshInterface:
|
||||
if not success:
|
||||
raise Exception("Timed out waiting for interface config")
|
||||
|
||||
def waitForAckNak(self):
|
||||
success = self._timeout.waitForAckNak(self._acknowledgment)
|
||||
if not success:
|
||||
raise Exception("Timed out waiting for an acknowledgment")
|
||||
|
||||
def getMyNodeInfo(self):
|
||||
"""Get info about my node."""
|
||||
if self.myInfo is None:
|
||||
@@ -550,8 +558,8 @@ class MeshInterface:
|
||||
self.localNode.localConfig.position.CopyFrom(fromRadio.config.position)
|
||||
elif fromRadio.config.HasField("power"):
|
||||
self.localNode.localConfig.power.CopyFrom(fromRadio.config.power)
|
||||
elif fromRadio.config.HasField("wifi"):
|
||||
self.localNode.localConfig.wifi.CopyFrom(fromRadio.config.wifi)
|
||||
elif fromRadio.config.HasField("network"):
|
||||
self.localNode.localConfig.network.CopyFrom(fromRadio.config.network)
|
||||
elif fromRadio.config.HasField("display"):
|
||||
self.localNode.localConfig.display.CopyFrom(fromRadio.config.display)
|
||||
elif fromRadio.config.HasField("lora"):
|
||||
@@ -675,7 +683,7 @@ class MeshInterface:
|
||||
# UNKNOWN_APP is the default protobuf portnum value, and therefore if not
|
||||
# set it will not be populated at all to make API usage easier, set
|
||||
# it to prevent confusion
|
||||
if "portnum" not in decoded:
|
||||
if decoded and "portnum" not in decoded:
|
||||
new_portnum = portnums_pb2.PortNum.Name(portnums_pb2.PortNum.UNKNOWN_APP)
|
||||
decoded["portnum"] = new_portnum
|
||||
logging.warning(f"portnum was not in decoded. Setting to:{new_portnum}")
|
||||
@@ -717,7 +725,8 @@ class MeshInterface:
|
||||
# we keep the responseHandler in dict until we get a non ack
|
||||
handler = self.responseHandlers.pop(requestId, None)
|
||||
if handler is not None:
|
||||
handler.callback(asDict)
|
||||
if not isAck or (isAck and handler.__name__ == "onAckNak"):
|
||||
handler.callback(asDict)
|
||||
|
||||
logging.debug(f"Publishing {topic}: packet={stripnl(asDict)} ")
|
||||
publishingThread.queueWork(lambda: pub.sendMessage(
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -14,18 +14,20 @@ _sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13module_config.proto\"\xa8\x11\n\x0cModuleConfig\x12(\n\x04mqtt\x18\x01 \x01(\x0b\x32\x18.ModuleConfig.MQTTConfigH\x00\x12,\n\x06serial\x18\x02 \x01(\x0b\x32\x1a.ModuleConfig.SerialConfigH\x00\x12I\n\x15\x65xternal_notification\x18\x03 \x01(\x0b\x32(.ModuleConfig.ExternalNotificationConfigH\x00\x12\x39\n\rstore_forward\x18\x04 \x01(\x0b\x32 .ModuleConfig.StoreForwardConfigH\x00\x12\x33\n\nrange_test\x18\x05 \x01(\x0b\x32\x1d.ModuleConfig.RangeTestConfigH\x00\x12\x32\n\ttelemetry\x18\x06 \x01(\x0b\x32\x1d.ModuleConfig.TelemetryConfigH\x00\x12;\n\x0e\x63\x61nned_message\x18\x07 \x01(\x0b\x32!.ModuleConfig.CannedMessageConfigH\x00\x1an\n\nMQTTConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x10\n\x08username\x18\x03 \x01(\t\x12\x10\n\x08password\x18\x04 \x01(\t\x12\x1a\n\x12\x65ncryption_enabled\x18\x05 \x01(\x08\x1a\x93\x04\n\x0cSerialConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x0c\n\x04\x65\x63ho\x18\x02 \x01(\x08\x12\x0b\n\x03rxd\x18\x03 \x01(\r\x12\x0b\n\x03txd\x18\x04 \x01(\r\x12\x34\n\x04\x62\x61ud\x18\x05 \x01(\x0e\x32&.ModuleConfig.SerialConfig.Serial_Baud\x12\x0f\n\x07timeout\x18\x06 \x01(\r\x12\x34\n\x04mode\x18\x07 \x01(\x0e\x32&.ModuleConfig.SerialConfig.Serial_Mode\"\x8a\x02\n\x0bSerial_Baud\x12\x10\n\x0c\x42\x41UD_Default\x10\x00\x12\x0c\n\x08\x42\x41UD_110\x10\x01\x12\x0c\n\x08\x42\x41UD_300\x10\x02\x12\x0c\n\x08\x42\x41UD_600\x10\x03\x12\r\n\tBAUD_1200\x10\x04\x12\r\n\tBAUD_2400\x10\x05\x12\r\n\tBAUD_4800\x10\x06\x12\r\n\tBAUD_9600\x10\x07\x12\x0e\n\nBAUD_19200\x10\x08\x12\x0e\n\nBAUD_38400\x10\t\x12\x0e\n\nBAUD_57600\x10\n\x12\x0f\n\x0b\x42\x41UD_115200\x10\x0b\x12\x0f\n\x0b\x42\x41UD_230400\x10\x0c\x12\x0f\n\x0b\x42\x41UD_460800\x10\r\x12\x0f\n\x0b\x42\x41UD_576000\x10\x0e\x12\x0f\n\x0b\x42\x41UD_921600\x10\x0f\"@\n\x0bSerial_Mode\x12\x10\n\x0cMODE_Default\x10\x00\x12\x0f\n\x0bMODE_SIMPLE\x10\x01\x12\x0e\n\nMODE_PROTO\x10\x02\x1a\x8b\x01\n\x1a\x45xternalNotificationConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x11\n\toutput_ms\x18\x02 \x01(\r\x12\x0e\n\x06output\x18\x03 \x01(\r\x12\x0e\n\x06\x61\x63tive\x18\x04 \x01(\x08\x12\x15\n\ralert_message\x18\x05 \x01(\x08\x12\x12\n\nalert_bell\x18\x06 \x01(\x08\x1a\x84\x01\n\x12StoreForwardConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x11\n\theartbeat\x18\x02 \x01(\x08\x12\x0f\n\x07records\x18\x03 \x01(\r\x12\x1a\n\x12history_return_max\x18\x04 \x01(\r\x12\x1d\n\x15history_return_window\x18\x05 \x01(\r\x1a@\n\x0fRangeTestConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x0e\n\x06sender\x18\x02 \x01(\r\x12\x0c\n\x04save\x18\x03 \x01(\x08\x1a\xcb\x01\n\x0fTelemetryConfig\x12\x1e\n\x16\x64\x65vice_update_interval\x18\x01 \x01(\r\x12#\n\x1b\x65nvironment_update_interval\x18\x02 \x01(\r\x12\'\n\x1f\x65nvironment_measurement_enabled\x18\x03 \x01(\x08\x12\"\n\x1a\x65nvironment_screen_enabled\x18\x04 \x01(\x08\x12&\n\x1e\x65nvironment_display_fahrenheit\x18\x07 \x01(\x08\x1a\xd6\x04\n\x13\x43\x61nnedMessageConfig\x12\x17\n\x0frotary1_enabled\x18\x01 \x01(\x08\x12\x19\n\x11inputbroker_pin_a\x18\x02 \x01(\r\x12\x19\n\x11inputbroker_pin_b\x18\x03 \x01(\r\x12\x1d\n\x15inputbroker_pin_press\x18\x04 \x01(\r\x12N\n\x14inputbroker_event_cw\x18\x05 \x01(\x0e\x32\x30.ModuleConfig.CannedMessageConfig.InputEventChar\x12O\n\x15inputbroker_event_ccw\x18\x06 \x01(\x0e\x32\x30.ModuleConfig.CannedMessageConfig.InputEventChar\x12Q\n\x17inputbroker_event_press\x18\x07 \x01(\x0e\x32\x30.ModuleConfig.CannedMessageConfig.InputEventChar\x12\x17\n\x0fupdown1_enabled\x18\x08 \x01(\x08\x12\x0f\n\x07\x65nabled\x18\t \x01(\x08\x12\x1a\n\x12\x61llow_input_source\x18\n \x01(\t\x12\x11\n\tsend_bell\x18\x0b \x01(\x08\"\x83\x01\n\x0eInputEventChar\x12\x0c\n\x08KEY_NONE\x10\x00\x12\n\n\x06KEY_UP\x10\x11\x12\x0c\n\x08KEY_DOWN\x10\x12\x12\x0c\n\x08KEY_LEFT\x10\x13\x12\r\n\tKEY_RIGHT\x10\x14\x12\x0e\n\nKEY_SELECT\x10\n\x12\x0c\n\x08KEY_BACK\x10\x1b\x12\x0e\n\nKEY_CANCEL\x10\x18\x42\x10\n\x0epayloadVariantBN\n\x13\x63om.geeksville.meshB\x12ModuleConfigProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13module_config.proto\"\x90\x14\n\x0cModuleConfig\x12(\n\x04mqtt\x18\x01 \x01(\x0b\x32\x18.ModuleConfig.MQTTConfigH\x00\x12,\n\x06serial\x18\x02 \x01(\x0b\x32\x1a.ModuleConfig.SerialConfigH\x00\x12I\n\x15\x65xternal_notification\x18\x03 \x01(\x0b\x32(.ModuleConfig.ExternalNotificationConfigH\x00\x12\x39\n\rstore_forward\x18\x04 \x01(\x0b\x32 .ModuleConfig.StoreForwardConfigH\x00\x12\x33\n\nrange_test\x18\x05 \x01(\x0b\x32\x1d.ModuleConfig.RangeTestConfigH\x00\x12\x32\n\ttelemetry\x18\x06 \x01(\x0b\x32\x1d.ModuleConfig.TelemetryConfigH\x00\x12;\n\x0e\x63\x61nned_message\x18\x07 \x01(\x0b\x32!.ModuleConfig.CannedMessageConfigH\x00\x12*\n\x05\x61udio\x18\x08 \x01(\x0b\x32\x19.ModuleConfig.AudioConfigH\x00\x1a\x84\x01\n\nMQTTConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x10\n\x08username\x18\x03 \x01(\t\x12\x10\n\x08password\x18\x04 \x01(\t\x12\x1a\n\x12\x65ncryption_enabled\x18\x05 \x01(\x08\x12\x14\n\x0cjson_enabled\x18\x06 \x01(\x08\x1a\xba\x02\n\x0b\x41udioConfig\x12\x16\n\x0e\x63odec2_enabled\x18\x01 \x01(\x08\x12\x10\n\x08mic_chan\x18\x02 \x01(\r\x12\x0f\n\x07\x61mp_pin\x18\x03 \x01(\r\x12\x0f\n\x07ptt_pin\x18\x04 \x01(\r\x12\x35\n\x07\x62itrate\x18\x05 \x01(\x0e\x32$.ModuleConfig.AudioConfig.Audio_Baud\"\xa7\x01\n\nAudio_Baud\x12\x12\n\x0e\x43ODEC2_DEFAULT\x10\x00\x12\x0f\n\x0b\x43ODEC2_3200\x10\x01\x12\x0f\n\x0b\x43ODEC2_2400\x10\x02\x12\x0f\n\x0b\x43ODEC2_1600\x10\x03\x12\x0f\n\x0b\x43ODEC2_1400\x10\x04\x12\x0f\n\x0b\x43ODEC2_1300\x10\x05\x12\x0f\n\x0b\x43ODEC2_1200\x10\x06\x12\x0e\n\nCODEC2_700\x10\x07\x12\x0f\n\x0b\x43ODEC2_700B\x10\x08\x1a\x9b\x04\n\x0cSerialConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x0c\n\x04\x65\x63ho\x18\x02 \x01(\x08\x12\x0b\n\x03rxd\x18\x03 \x01(\r\x12\x0b\n\x03txd\x18\x04 \x01(\r\x12\x34\n\x04\x62\x61ud\x18\x05 \x01(\x0e\x32&.ModuleConfig.SerialConfig.Serial_Baud\x12\x0f\n\x07timeout\x18\x06 \x01(\r\x12\x34\n\x04mode\x18\x07 \x01(\x0e\x32&.ModuleConfig.SerialConfig.Serial_Mode\"\x8a\x02\n\x0bSerial_Baud\x12\x10\n\x0c\x42\x41UD_DEFAULT\x10\x00\x12\x0c\n\x08\x42\x41UD_110\x10\x01\x12\x0c\n\x08\x42\x41UD_300\x10\x02\x12\x0c\n\x08\x42\x41UD_600\x10\x03\x12\r\n\tBAUD_1200\x10\x04\x12\r\n\tBAUD_2400\x10\x05\x12\r\n\tBAUD_4800\x10\x06\x12\r\n\tBAUD_9600\x10\x07\x12\x0e\n\nBAUD_19200\x10\x08\x12\x0e\n\nBAUD_38400\x10\t\x12\x0e\n\nBAUD_57600\x10\n\x12\x0f\n\x0b\x42\x41UD_115200\x10\x0b\x12\x0f\n\x0b\x42\x41UD_230400\x10\x0c\x12\x0f\n\x0b\x42\x41UD_460800\x10\r\x12\x0f\n\x0b\x42\x41UD_576000\x10\x0e\x12\x0f\n\x0b\x42\x41UD_921600\x10\x0f\"H\n\x0bSerial_Mode\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\n\n\x06SIMPLE\x10\x01\x12\t\n\x05PROTO\x10\x02\x12\x0b\n\x07TEXTMSG\x10\x03\x12\x08\n\x04NMEA\x10\x04\x1a\x8b\x01\n\x1a\x45xternalNotificationConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x11\n\toutput_ms\x18\x02 \x01(\r\x12\x0e\n\x06output\x18\x03 \x01(\r\x12\x0e\n\x06\x61\x63tive\x18\x04 \x01(\x08\x12\x15\n\ralert_message\x18\x05 \x01(\x08\x12\x12\n\nalert_bell\x18\x06 \x01(\x08\x1a\x84\x01\n\x12StoreForwardConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x11\n\theartbeat\x18\x02 \x01(\x08\x12\x0f\n\x07records\x18\x03 \x01(\r\x12\x1a\n\x12history_return_max\x18\x04 \x01(\r\x12\x1d\n\x15history_return_window\x18\x05 \x01(\r\x1a@\n\x0fRangeTestConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x0e\n\x06sender\x18\x02 \x01(\r\x12\x0c\n\x04save\x18\x03 \x01(\x08\x1a\xcb\x01\n\x0fTelemetryConfig\x12\x1e\n\x16\x64\x65vice_update_interval\x18\x01 \x01(\r\x12#\n\x1b\x65nvironment_update_interval\x18\x02 \x01(\r\x12\'\n\x1f\x65nvironment_measurement_enabled\x18\x03 \x01(\x08\x12\"\n\x1a\x65nvironment_screen_enabled\x18\x04 \x01(\x08\x12&\n\x1e\x65nvironment_display_fahrenheit\x18\x05 \x01(\x08\x1a\xb5\x04\n\x13\x43\x61nnedMessageConfig\x12\x17\n\x0frotary1_enabled\x18\x01 \x01(\x08\x12\x19\n\x11inputbroker_pin_a\x18\x02 \x01(\r\x12\x19\n\x11inputbroker_pin_b\x18\x03 \x01(\r\x12\x1d\n\x15inputbroker_pin_press\x18\x04 \x01(\r\x12N\n\x14inputbroker_event_cw\x18\x05 \x01(\x0e\x32\x30.ModuleConfig.CannedMessageConfig.InputEventChar\x12O\n\x15inputbroker_event_ccw\x18\x06 \x01(\x0e\x32\x30.ModuleConfig.CannedMessageConfig.InputEventChar\x12Q\n\x17inputbroker_event_press\x18\x07 \x01(\x0e\x32\x30.ModuleConfig.CannedMessageConfig.InputEventChar\x12\x17\n\x0fupdown1_enabled\x18\x08 \x01(\x08\x12\x0f\n\x07\x65nabled\x18\t \x01(\x08\x12\x1a\n\x12\x61llow_input_source\x18\n \x01(\t\x12\x11\n\tsend_bell\x18\x0b \x01(\x08\"c\n\x0eInputEventChar\x12\x08\n\x04NONE\x10\x00\x12\x06\n\x02UP\x10\x11\x12\x08\n\x04\x44OWN\x10\x12\x12\x08\n\x04LEFT\x10\x13\x12\t\n\x05RIGHT\x10\x14\x12\n\n\x06SELECT\x10\n\x12\x08\n\x04\x42\x41\x43K\x10\x1b\x12\n\n\x06\x43\x41NCEL\x10\x18\x42\x11\n\x0fpayload_variantBO\n\x13\x63om.geeksville.meshB\x12ModuleConfigProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
_MODULECONFIG = DESCRIPTOR.message_types_by_name['ModuleConfig']
|
||||
_MODULECONFIG_MQTTCONFIG = _MODULECONFIG.nested_types_by_name['MQTTConfig']
|
||||
_MODULECONFIG_AUDIOCONFIG = _MODULECONFIG.nested_types_by_name['AudioConfig']
|
||||
_MODULECONFIG_SERIALCONFIG = _MODULECONFIG.nested_types_by_name['SerialConfig']
|
||||
_MODULECONFIG_EXTERNALNOTIFICATIONCONFIG = _MODULECONFIG.nested_types_by_name['ExternalNotificationConfig']
|
||||
_MODULECONFIG_STOREFORWARDCONFIG = _MODULECONFIG.nested_types_by_name['StoreForwardConfig']
|
||||
_MODULECONFIG_RANGETESTCONFIG = _MODULECONFIG.nested_types_by_name['RangeTestConfig']
|
||||
_MODULECONFIG_TELEMETRYCONFIG = _MODULECONFIG.nested_types_by_name['TelemetryConfig']
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG = _MODULECONFIG.nested_types_by_name['CannedMessageConfig']
|
||||
_MODULECONFIG_AUDIOCONFIG_AUDIO_BAUD = _MODULECONFIG_AUDIOCONFIG.enum_types_by_name['Audio_Baud']
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_BAUD = _MODULECONFIG_SERIALCONFIG.enum_types_by_name['Serial_Baud']
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_MODE = _MODULECONFIG_SERIALCONFIG.enum_types_by_name['Serial_Mode']
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG_INPUTEVENTCHAR = _MODULECONFIG_CANNEDMESSAGECONFIG.enum_types_by_name['InputEventChar']
|
||||
@@ -38,6 +40,13 @@ ModuleConfig = _reflection.GeneratedProtocolMessageType('ModuleConfig', (_messag
|
||||
})
|
||||
,
|
||||
|
||||
'AudioConfig' : _reflection.GeneratedProtocolMessageType('AudioConfig', (_message.Message,), {
|
||||
'DESCRIPTOR' : _MODULECONFIG_AUDIOCONFIG,
|
||||
'__module__' : 'module_config_pb2'
|
||||
# @@protoc_insertion_point(class_scope:ModuleConfig.AudioConfig)
|
||||
})
|
||||
,
|
||||
|
||||
'SerialConfig' : _reflection.GeneratedProtocolMessageType('SerialConfig', (_message.Message,), {
|
||||
'DESCRIPTOR' : _MODULECONFIG_SERIALCONFIG,
|
||||
'__module__' : 'module_config_pb2'
|
||||
@@ -85,6 +94,7 @@ ModuleConfig = _reflection.GeneratedProtocolMessageType('ModuleConfig', (_messag
|
||||
})
|
||||
_sym_db.RegisterMessage(ModuleConfig)
|
||||
_sym_db.RegisterMessage(ModuleConfig.MQTTConfig)
|
||||
_sym_db.RegisterMessage(ModuleConfig.AudioConfig)
|
||||
_sym_db.RegisterMessage(ModuleConfig.SerialConfig)
|
||||
_sym_db.RegisterMessage(ModuleConfig.ExternalNotificationConfig)
|
||||
_sym_db.RegisterMessage(ModuleConfig.StoreForwardConfig)
|
||||
@@ -95,27 +105,31 @@ _sym_db.RegisterMessage(ModuleConfig.CannedMessageConfig)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\022ModuleConfigProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\022ModuleConfigProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_MODULECONFIG._serialized_start=24
|
||||
_MODULECONFIG._serialized_end=2240
|
||||
_MODULECONFIG_MQTTCONFIG._serialized_start=428
|
||||
_MODULECONFIG_MQTTCONFIG._serialized_end=538
|
||||
_MODULECONFIG_SERIALCONFIG._serialized_start=541
|
||||
_MODULECONFIG_SERIALCONFIG._serialized_end=1072
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_BAUD._serialized_start=740
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_BAUD._serialized_end=1006
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_MODE._serialized_start=1008
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_MODE._serialized_end=1072
|
||||
_MODULECONFIG_EXTERNALNOTIFICATIONCONFIG._serialized_start=1075
|
||||
_MODULECONFIG_EXTERNALNOTIFICATIONCONFIG._serialized_end=1214
|
||||
_MODULECONFIG_STOREFORWARDCONFIG._serialized_start=1217
|
||||
_MODULECONFIG_STOREFORWARDCONFIG._serialized_end=1349
|
||||
_MODULECONFIG_RANGETESTCONFIG._serialized_start=1351
|
||||
_MODULECONFIG_RANGETESTCONFIG._serialized_end=1415
|
||||
_MODULECONFIG_TELEMETRYCONFIG._serialized_start=1418
|
||||
_MODULECONFIG_TELEMETRYCONFIG._serialized_end=1621
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG._serialized_start=1624
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG._serialized_end=2222
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG_INPUTEVENTCHAR._serialized_start=2091
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG_INPUTEVENTCHAR._serialized_end=2222
|
||||
_MODULECONFIG._serialized_end=2600
|
||||
_MODULECONFIG_MQTTCONFIG._serialized_start=473
|
||||
_MODULECONFIG_MQTTCONFIG._serialized_end=605
|
||||
_MODULECONFIG_AUDIOCONFIG._serialized_start=608
|
||||
_MODULECONFIG_AUDIOCONFIG._serialized_end=922
|
||||
_MODULECONFIG_AUDIOCONFIG_AUDIO_BAUD._serialized_start=755
|
||||
_MODULECONFIG_AUDIOCONFIG_AUDIO_BAUD._serialized_end=922
|
||||
_MODULECONFIG_SERIALCONFIG._serialized_start=925
|
||||
_MODULECONFIG_SERIALCONFIG._serialized_end=1464
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_BAUD._serialized_start=1124
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_BAUD._serialized_end=1390
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_MODE._serialized_start=1392
|
||||
_MODULECONFIG_SERIALCONFIG_SERIAL_MODE._serialized_end=1464
|
||||
_MODULECONFIG_EXTERNALNOTIFICATIONCONFIG._serialized_start=1467
|
||||
_MODULECONFIG_EXTERNALNOTIFICATIONCONFIG._serialized_end=1606
|
||||
_MODULECONFIG_STOREFORWARDCONFIG._serialized_start=1609
|
||||
_MODULECONFIG_STOREFORWARDCONFIG._serialized_end=1741
|
||||
_MODULECONFIG_RANGETESTCONFIG._serialized_start=1743
|
||||
_MODULECONFIG_RANGETESTCONFIG._serialized_end=1807
|
||||
_MODULECONFIG_TELEMETRYCONFIG._serialized_start=1810
|
||||
_MODULECONFIG_TELEMETRYCONFIG._serialized_end=2013
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG._serialized_start=2016
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG._serialized_end=2581
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG_INPUTEVENTCHAR._serialized_start=2482
|
||||
_MODULECONFIG_CANNEDMESSAGECONFIG_INPUTEVENTCHAR._serialized_end=2581
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
|
||||
from . import mesh_pb2 as mesh__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nmqtt.proto\x1a\nmesh.proto\"V\n\x0fServiceEnvelope\x12\x1b\n\x06packet\x18\x01 \x01(\x0b\x32\x0b.MeshPacket\x12\x12\n\nchannel_id\x18\x02 \x01(\t\x12\x12\n\ngateway_id\x18\x03 \x01(\tBF\n\x13\x63om.geeksville.meshB\nMQTTProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nmqtt.proto\x1a\nmesh.proto\"V\n\x0fServiceEnvelope\x12\x1b\n\x06packet\x18\x01 \x01(\x0b\x32\x0b.MeshPacket\x12\x12\n\nchannel_id\x18\x02 \x01(\t\x12\x12\n\ngateway_id\x18\x03 \x01(\tBG\n\x13\x63om.geeksville.meshB\nMQTTProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ _sym_db.RegisterMessage(ServiceEnvelope)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\nMQTTProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\nMQTTProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_SERVICEENVELOPE._serialized_start=26
|
||||
_SERVICEENVELOPE._serialized_end=112
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -104,11 +104,11 @@ class Node:
|
||||
logging.debug("Wrote power")
|
||||
time.sleep(0.3)
|
||||
|
||||
if self.localConfig.wifi:
|
||||
if self.localConfig.network:
|
||||
p = admin_pb2.AdminMessage()
|
||||
p.set_config.wifi.CopyFrom(self.localConfig.wifi)
|
||||
p.set_config.network.CopyFrom(self.localConfig.network)
|
||||
self._sendAdmin(p)
|
||||
logging.debug("Wrote wifi")
|
||||
logging.debug("Wrote network")
|
||||
time.sleep(0.3)
|
||||
|
||||
if self.localConfig.display:
|
||||
@@ -181,6 +181,13 @@ class Node:
|
||||
logging.debug("Wrote module: canned_message")
|
||||
time.sleep(0.3)
|
||||
|
||||
if self.moduleConfig.audio:
|
||||
p = admin_pb2.AdminMessage()
|
||||
p.set_module_config.audio.CopyFrom(self.moduleConfig.audio)
|
||||
self._sendAdmin(p)
|
||||
logging.debug("Wrote module: audo")
|
||||
time.sleep(0.3)
|
||||
|
||||
def writeConfig(self, config_name):
|
||||
"""Write the current (edited) localConfig to the device"""
|
||||
if self.localConfig is None:
|
||||
@@ -194,8 +201,8 @@ class Node:
|
||||
p.set_config.position.CopyFrom(self.localConfig.position)
|
||||
elif config_name == 'power':
|
||||
p.set_config.power.CopyFrom(self.localConfig.power)
|
||||
elif config_name == 'wifi':
|
||||
p.set_config.wifi.CopyFrom(self.localConfig.wifi)
|
||||
elif config_name == 'network':
|
||||
p.set_config.network.CopyFrom(self.localConfig.network)
|
||||
elif config_name == 'display':
|
||||
p.set_config.display.CopyFrom(self.localConfig.display)
|
||||
elif config_name == 'lora':
|
||||
@@ -216,6 +223,8 @@ class Node:
|
||||
p.set_module_config.telemetry.CopyFrom(self.moduleConfig.telemetry)
|
||||
elif config_name == 'canned_message':
|
||||
p.set_module_config.canned_message.CopyFrom(self.moduleConfig.canned_message)
|
||||
elif config_name == 'audio':
|
||||
p.set_module_config.audio.CopyFrom(self.moduleConfig.audio)
|
||||
else:
|
||||
our_exit(f"Error: No valid config with name {config_name}")
|
||||
|
||||
@@ -321,7 +330,12 @@ class Node:
|
||||
logging.debug(f'p.set_owner.long_name:{p.set_owner.long_name}:')
|
||||
logging.debug(f'p.set_owner.short_name:{p.set_owner.short_name}:')
|
||||
logging.debug(f'p.set_owner.is_licensed:{p.set_owner.is_licensed}')
|
||||
return self._sendAdmin(p)
|
||||
# If sending to a remote node, wait for ACK/NAK
|
||||
if self == self.iface.localNode:
|
||||
onResponse = None
|
||||
else:
|
||||
onResponse = self.onAckNak
|
||||
return self._sendAdmin(p, onResponse=onResponse)
|
||||
|
||||
def getURL(self, includeAll: bool = True):
|
||||
"""The sharable URL that describes the current channel"""
|
||||
@@ -336,14 +350,14 @@ class Node:
|
||||
some_bytes = channelSet.SerializeToString()
|
||||
s = base64.urlsafe_b64encode(some_bytes).decode('ascii')
|
||||
s = s.replace("=", "").replace("+", "-").replace("/", "_")
|
||||
return f"https://www.meshtastic.org/e/#{s}"
|
||||
return f"https://meshtastic.org/e/#{s}"
|
||||
|
||||
def setURL(self, url):
|
||||
"""Set mesh network URL"""
|
||||
if self.localConfig is None:
|
||||
our_exit("Warning: No Config has been read")
|
||||
|
||||
# URLs are of the form https://www.meshtastic.org/d/#{base64_channel_set}
|
||||
# URLs are of the form https://meshtastic.org/d/#{base64_channel_set}
|
||||
# Split on '/#' to find the base64 encoded channel settings
|
||||
splitURL = url.split("/#")
|
||||
b64 = splitURL[-1]
|
||||
@@ -439,7 +453,12 @@ class Node:
|
||||
p.set_canned_message_module_messages = chunk
|
||||
|
||||
logging.debug(f"Setting canned message '{chunk}' part {i+1}")
|
||||
self._sendAdmin(p)
|
||||
# If sending to a remote node, wait for ACK/NAK
|
||||
if self == self.iface.localNode:
|
||||
onResponse = None
|
||||
else:
|
||||
onResponse = self.onAckNak
|
||||
return self._sendAdmin(p, onResponse=onResponse)
|
||||
|
||||
def exitSimulator(self):
|
||||
"""Tell a simulator node to exit (this message
|
||||
@@ -456,7 +475,51 @@ class Node:
|
||||
p.reboot_seconds = secs
|
||||
logging.info(f"Telling node to reboot in {secs} seconds")
|
||||
|
||||
return self._sendAdmin(p)
|
||||
# If sending to a remote node, wait for ACK/NAK
|
||||
if self == self.iface.localNode:
|
||||
onResponse = None
|
||||
else:
|
||||
onResponse = self.onAckNak
|
||||
return self._sendAdmin(p, onResponse=onResponse)
|
||||
|
||||
def beginSettingsTransaction(self):
|
||||
"""Tell the node to open a transaction to edit settings."""
|
||||
p = admin_pb2.AdminMessage()
|
||||
p.begin_edit_settings = True
|
||||
logging.info(f"Telling open a transaction to edit settings")
|
||||
|
||||
# If sending to a remote node, wait for ACK/NAK
|
||||
if self == self.iface.localNode:
|
||||
onResponse = None
|
||||
else:
|
||||
onResponse = self.onAckNak
|
||||
return self._sendAdmin(p, onResponse=onResponse)
|
||||
|
||||
def commitSettingsTransaction(self):
|
||||
"""Tell the node to commit the open transaction for editing settings."""
|
||||
p = admin_pb2.AdminMessage()
|
||||
p.commit_edit_settings = True
|
||||
logging.info(f"Telling node to commit open transaction for editing settings")
|
||||
|
||||
# If sending to a remote node, wait for ACK/NAK
|
||||
if self == self.iface.localNode:
|
||||
onResponse = None
|
||||
else:
|
||||
onResponse = self.onAckNak
|
||||
return self._sendAdmin(p, onResponse=onResponse)
|
||||
|
||||
def rebootOTA(self, secs: int = 10):
|
||||
"""Tell the node to reboot into factory firmware."""
|
||||
p = admin_pb2.AdminMessage()
|
||||
p.reboot_ota_seconds = secs
|
||||
logging.info(f"Telling node to reboot to OTA in {secs} seconds")
|
||||
|
||||
# If sending to a remote node, wait for ACK/NAK
|
||||
if self == self.iface.localNode:
|
||||
onResponse = None
|
||||
else:
|
||||
onResponse = self.onAckNak
|
||||
return self._sendAdmin(p, onResponse=onResponse)
|
||||
|
||||
def shutdown(self, secs: int = 10):
|
||||
"""Tell the node to shutdown."""
|
||||
@@ -464,7 +527,12 @@ class Node:
|
||||
p.shutdown_seconds = secs
|
||||
logging.info(f"Telling node to shutdown in {secs} seconds")
|
||||
|
||||
return self._sendAdmin(p)
|
||||
# If sending to a remote node, wait for ACK/NAK
|
||||
if self == self.iface.localNode:
|
||||
onResponse = None
|
||||
else:
|
||||
onResponse = self.onAckNak
|
||||
return self._sendAdmin(p, onResponse=onResponse)
|
||||
|
||||
def getMetadata(self, secs: int = 10):
|
||||
"""Tell the node to shutdown."""
|
||||
@@ -474,6 +542,32 @@ class Node:
|
||||
|
||||
return self._sendAdmin(p, wantResponse=True, onResponse=self.onRequestGetMetadata)
|
||||
|
||||
def factoryReset(self):
|
||||
"""Tell the node to factory reset."""
|
||||
p = admin_pb2.AdminMessage()
|
||||
p.factory_reset = True
|
||||
logging.info(f"Telling node to factory reset")
|
||||
|
||||
# If sending to a remote node, wait for ACK/NAK
|
||||
if self == self.iface.localNode:
|
||||
onResponse = None
|
||||
else:
|
||||
onResponse = self.onAckNak
|
||||
return self._sendAdmin(p, onResponse=onResponse)
|
||||
|
||||
def resetNodeDb(self):
|
||||
"""Tell the node to reset its list of nodes."""
|
||||
p = admin_pb2.AdminMessage()
|
||||
p.nodedb_reset = True
|
||||
logging.info(f"Telling node to reset the NodeDB")
|
||||
|
||||
# If sending to a remote node, wait for ACK/NAK
|
||||
if self == self.iface.localNode:
|
||||
onResponse = None
|
||||
else:
|
||||
onResponse = self.onAckNak
|
||||
return self._sendAdmin(p, onResponse=onResponse)
|
||||
|
||||
def _fixupChannels(self):
|
||||
"""Fixup indexes and add disabled channels as needed"""
|
||||
|
||||
@@ -500,6 +594,16 @@ class Node:
|
||||
def onRequestGetMetadata(self, p):
|
||||
"""Handle the response packet for requesting device metadata getMetadata()"""
|
||||
logging.debug(f'onRequestGetMetadata() p:{p}')
|
||||
|
||||
if p["decoded"]["portnum"] == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.ROUTING_APP):
|
||||
if p["decoded"]["routing"]["errorReason"] != "NONE":
|
||||
logging.warning(f'Metadata request failed, error reason: {p["decoded"]["routing"]["errorReason"]}')
|
||||
self._timeout.expireTime = time.time() # Do not wait any longer
|
||||
return # Don't try to parse this routing message
|
||||
logging.debug(f"Retrying metadata request.")
|
||||
self.getMetadata()
|
||||
return
|
||||
|
||||
c = p["decoded"]["admin"]["raw"].get_device_metadata_response
|
||||
self._timeout.reset() # We made foreward progress
|
||||
logging.debug(f"Received metadata {stripnl(c)}")
|
||||
@@ -509,6 +613,19 @@ class Node:
|
||||
def onResponseRequestChannel(self, p):
|
||||
"""Handle the response packet for requesting a channel _requestChannel()"""
|
||||
logging.debug(f'onResponseRequestChannel() p:{p}')
|
||||
|
||||
if p["decoded"]["portnum"] == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.ROUTING_APP):
|
||||
if p["decoded"]["routing"]["errorReason"] != "NONE":
|
||||
logging.warning(f'Channel request failed, error reason: {p["decoded"]["routing"]["errorReason"]}')
|
||||
self._timeout.expireTime = time.time() # Do not wait any longer
|
||||
return # Don't try to parse this routing message
|
||||
lastTried = 0
|
||||
if len(self.partialChannels) > 0:
|
||||
lastTried = self.partialChannels[-1].index
|
||||
logging.debug(f"Retrying previous channel request.")
|
||||
self._requestChannel(lastTried)
|
||||
return
|
||||
|
||||
c = p["decoded"]["admin"]["raw"].get_channel_response
|
||||
self.partialChannels.append(c)
|
||||
self._timeout.reset() # We made foreward progress
|
||||
@@ -533,6 +650,18 @@ class Node:
|
||||
else:
|
||||
self._requestChannel(index + 1)
|
||||
|
||||
def onAckNak(self, p):
|
||||
if p["decoded"]["routing"]["errorReason"] != "NONE":
|
||||
print(f'Received a NAK, error reason: {p["decoded"]["routing"]["errorReason"]}')
|
||||
self.iface._acknowledgment.receivedNak = True
|
||||
else:
|
||||
if int(p["from"]) == self.iface.localNode.nodeNum:
|
||||
print(f'Received an implicit ACK. Packet will likely arrive, but cannot be guaranteed.')
|
||||
self.iface._acknowledgment.receivedImplAck = True
|
||||
else:
|
||||
print(f'Received an ACK.')
|
||||
self.iface._acknowledgment.receivedAck = True
|
||||
|
||||
def _requestChannel(self, channelNum: int):
|
||||
"""Done with initial config messages, now send regular
|
||||
MeshPackets to ask for settings"""
|
||||
@@ -560,10 +689,15 @@ class Node:
|
||||
if adminIndex == 0: # unless a special channel index was used, we want to use the admin index
|
||||
adminIndex = self.iface.localNode._getAdminChannelIndex()
|
||||
logging.debug(f'adminIndex:{adminIndex}')
|
||||
|
||||
|
||||
# don't ask for an Ack if you are getting a Response
|
||||
if wantResponse:
|
||||
wantAck = False
|
||||
else:
|
||||
wantAck = True
|
||||
return self.iface.sendData(p, self.nodeNum,
|
||||
portNum=portnums_pb2.PortNum.ADMIN_APP,
|
||||
wantAck=True,
|
||||
wantAck=wantAck,
|
||||
wantResponse=wantResponse,
|
||||
onResponse=onResponse,
|
||||
channelIndex=adminIndex)
|
||||
|
||||
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eportnums.proto*\xee\x02\n\x07PortNum\x12\x0f\n\x0bUNKNOWN_APP\x10\x00\x12\x14\n\x10TEXT_MESSAGE_APP\x10\x01\x12\x17\n\x13REMOTE_HARDWARE_APP\x10\x02\x12\x10\n\x0cPOSITION_APP\x10\x03\x12\x10\n\x0cNODEINFO_APP\x10\x04\x12\x0f\n\x0bROUTING_APP\x10\x05\x12\r\n\tADMIN_APP\x10\x06\x12\x1f\n\x1bTEXT_MESSAGE_COMPRESSED_APP\x10\x07\x12\x10\n\x0cWAYPOINT_APP\x10\x08\x12\r\n\tREPLY_APP\x10 \x12\x11\n\rIP_TUNNEL_APP\x10!\x12\x0e\n\nSERIAL_APP\x10@\x12\x15\n\x11STORE_FORWARD_APP\x10\x41\x12\x12\n\x0eRANGE_TEST_APP\x10\x42\x12\x11\n\rTELEMETRY_APP\x10\x43\x12\x0b\n\x07ZPS_APP\x10\x44\x12\x10\n\x0bPRIVATE_APP\x10\x80\x02\x12\x13\n\x0e\x41TAK_FORWARDER\x10\x81\x02\x12\x08\n\x03MAX\x10\xff\x03\x42\x44\n\x13\x63om.geeksville.meshB\x08PortnumsH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eportnums.proto*\x90\x03\n\x07PortNum\x12\x0f\n\x0bUNKNOWN_APP\x10\x00\x12\x14\n\x10TEXT_MESSAGE_APP\x10\x01\x12\x17\n\x13REMOTE_HARDWARE_APP\x10\x02\x12\x10\n\x0cPOSITION_APP\x10\x03\x12\x10\n\x0cNODEINFO_APP\x10\x04\x12\x0f\n\x0bROUTING_APP\x10\x05\x12\r\n\tADMIN_APP\x10\x06\x12\x1f\n\x1bTEXT_MESSAGE_COMPRESSED_APP\x10\x07\x12\x10\n\x0cWAYPOINT_APP\x10\x08\x12\r\n\tAUDIO_APP\x10\t\x12\r\n\tREPLY_APP\x10 \x12\x11\n\rIP_TUNNEL_APP\x10!\x12\x0e\n\nSERIAL_APP\x10@\x12\x15\n\x11STORE_FORWARD_APP\x10\x41\x12\x12\n\x0eRANGE_TEST_APP\x10\x42\x12\x11\n\rTELEMETRY_APP\x10\x43\x12\x0b\n\x07ZPS_APP\x10\x44\x12\x11\n\rSIMULATOR_APP\x10\x45\x12\x10\n\x0bPRIVATE_APP\x10\x80\x02\x12\x13\n\x0e\x41TAK_FORWARDER\x10\x81\x02\x12\x08\n\x03MAX\x10\xff\x03\x42\x45\n\x13\x63om.geeksville.meshB\x08PortnumsH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
_PORTNUM = DESCRIPTOR.enum_types_by_name['PortNum']
|
||||
PortNum = enum_type_wrapper.EnumTypeWrapper(_PORTNUM)
|
||||
@@ -28,6 +28,7 @@ ROUTING_APP = 5
|
||||
ADMIN_APP = 6
|
||||
TEXT_MESSAGE_COMPRESSED_APP = 7
|
||||
WAYPOINT_APP = 8
|
||||
AUDIO_APP = 9
|
||||
REPLY_APP = 32
|
||||
IP_TUNNEL_APP = 33
|
||||
SERIAL_APP = 64
|
||||
@@ -35,6 +36,7 @@ STORE_FORWARD_APP = 65
|
||||
RANGE_TEST_APP = 66
|
||||
TELEMETRY_APP = 67
|
||||
ZPS_APP = 68
|
||||
SIMULATOR_APP = 69
|
||||
PRIVATE_APP = 256
|
||||
ATAK_FORWARDER = 257
|
||||
MAX = 511
|
||||
@@ -43,7 +45,7 @@ MAX = 511
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\010PortnumsH\003Z!github.com/meshtastic/gomeshproto'
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\010PortnumsH\003Z\"github.com/meshtastic/go/generated'
|
||||
_PORTNUM._serialized_start=19
|
||||
_PORTNUM._serialized_end=385
|
||||
_PORTNUM._serialized_end=419
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15remote_hardware.proto\"\xca\x01\n\x0fHardwareMessage\x12\"\n\x03typ\x18\x01 \x01(\x0e\x32\x15.HardwareMessage.Type\x12\x11\n\tgpio_mask\x18\x02 \x01(\x04\x12\x12\n\ngpio_value\x18\x03 \x01(\x04\"l\n\x04Type\x12\t\n\x05UNSET\x10\x00\x12\x0f\n\x0bWRITE_GPIOS\x10\x01\x12\x0f\n\x0bWATCH_GPIOS\x10\x02\x12\x11\n\rGPIOS_CHANGED\x10\x03\x12\x0e\n\nREAD_GPIOS\x10\x04\x12\x14\n\x10READ_GPIOS_REPLY\x10\x05\x42J\n\x13\x63om.geeksville.meshB\x0eRemoteHardwareH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15remote_hardware.proto\"\xcb\x01\n\x0fHardwareMessage\x12#\n\x04type\x18\x01 \x01(\x0e\x32\x15.HardwareMessage.Type\x12\x11\n\tgpio_mask\x18\x02 \x01(\x04\x12\x12\n\ngpio_value\x18\x03 \x01(\x04\"l\n\x04Type\x12\t\n\x05UNSET\x10\x00\x12\x0f\n\x0bWRITE_GPIOS\x10\x01\x12\x0f\n\x0bWATCH_GPIOS\x10\x02\x12\x11\n\rGPIOS_CHANGED\x10\x03\x12\x0e\n\nREAD_GPIOS\x10\x04\x12\x14\n\x10READ_GPIOS_REPLY\x10\x05\x42K\n\x13\x63om.geeksville.meshB\x0eRemoteHardwareH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ _sym_db.RegisterMessage(HardwareMessage)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\016RemoteHardwareH\003Z!github.com/meshtastic/gomeshproto'
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\016RemoteHardwareH\003Z\"github.com/meshtastic/go/generated'
|
||||
_HARDWAREMESSAGE._serialized_start=26
|
||||
_HARDWAREMESSAGE._serialized_end=228
|
||||
_HARDWAREMESSAGE_TYPE._serialized_start=120
|
||||
_HARDWAREMESSAGE_TYPE._serialized_end=228
|
||||
_HARDWAREMESSAGE._serialized_end=229
|
||||
_HARDWAREMESSAGE_TYPE._serialized_start=121
|
||||
_HARDWAREMESSAGE_TYPE._serialized_end=229
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12storeforward.proto\"\x8a\x06\n\x0fStoreAndForward\x12,\n\x02rr\x18\x01 \x01(\x0e\x32 .StoreAndForward.RequestResponse\x12*\n\x05stats\x18\x02 \x01(\x0b\x32\x1b.StoreAndForward.Statistics\x12)\n\x07history\x18\x03 \x01(\x0b\x32\x18.StoreAndForward.History\x12-\n\theartbeat\x18\x04 \x01(\x0b\x32\x1a.StoreAndForward.Heartbeat\x1a\xcd\x01\n\nStatistics\x12\x16\n\x0emessages_total\x18\x01 \x01(\r\x12\x16\n\x0emessages_saved\x18\x02 \x01(\r\x12\x14\n\x0cmessages_max\x18\x03 \x01(\r\x12\x0f\n\x07up_time\x18\x04 \x01(\r\x12\x10\n\x08requests\x18\x05 \x01(\r\x12\x18\n\x10requests_history\x18\x06 \x01(\r\x12\x11\n\theartbeat\x18\x07 \x01(\x08\x12\x12\n\nreturn_max\x18\x08 \x01(\r\x12\x15\n\rreturn_window\x18\t \x01(\r\x1aI\n\x07History\x12\x18\n\x10history_messages\x18\x01 \x01(\r\x12\x0e\n\x06window\x18\x02 \x01(\r\x12\x14\n\x0clast_request\x18\x03 \x01(\r\x1a.\n\tHeartbeat\x12\x0e\n\x06period\x18\x01 \x01(\r\x12\x11\n\tsecondary\x18\x02 \x01(\r\"\xf7\x01\n\x0fRequestResponse\x12\t\n\x05UNSET\x10\x00\x12\x10\n\x0cROUTER_ERROR\x10\x01\x12\x14\n\x10ROUTER_HEARTBEAT\x10\x02\x12\x0f\n\x0bROUTER_PING\x10\x03\x12\x0f\n\x0bROUTER_PONG\x10\x04\x12\x0f\n\x0bROUTER_BUSY\x10\x05\x12\x12\n\x0eROUTER_HISTORY\x10\x06\x12\x10\n\x0c\x43LIENT_ERROR\x10\x65\x12\x12\n\x0e\x43LIENT_HISTORY\x10\x66\x12\x10\n\x0c\x43LIENT_STATS\x10g\x12\x0f\n\x0b\x43LIENT_PING\x10h\x12\x0f\n\x0b\x43LIENT_PONG\x10i\x12\x10\n\x0c\x43LIENT_ABORT\x10jBQ\n\x13\x63om.geeksville.meshB\x15StoreAndForwardProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12storeforward.proto\"\x8a\x06\n\x0fStoreAndForward\x12,\n\x02rr\x18\x01 \x01(\x0e\x32 .StoreAndForward.RequestResponse\x12*\n\x05stats\x18\x02 \x01(\x0b\x32\x1b.StoreAndForward.Statistics\x12)\n\x07history\x18\x03 \x01(\x0b\x32\x18.StoreAndForward.History\x12-\n\theartbeat\x18\x04 \x01(\x0b\x32\x1a.StoreAndForward.Heartbeat\x1a\xcd\x01\n\nStatistics\x12\x16\n\x0emessages_total\x18\x01 \x01(\r\x12\x16\n\x0emessages_saved\x18\x02 \x01(\r\x12\x14\n\x0cmessages_max\x18\x03 \x01(\r\x12\x0f\n\x07up_time\x18\x04 \x01(\r\x12\x10\n\x08requests\x18\x05 \x01(\r\x12\x18\n\x10requests_history\x18\x06 \x01(\r\x12\x11\n\theartbeat\x18\x07 \x01(\x08\x12\x12\n\nreturn_max\x18\x08 \x01(\r\x12\x15\n\rreturn_window\x18\t \x01(\r\x1aI\n\x07History\x12\x18\n\x10history_messages\x18\x01 \x01(\r\x12\x0e\n\x06window\x18\x02 \x01(\r\x12\x14\n\x0clast_request\x18\x03 \x01(\r\x1a.\n\tHeartbeat\x12\x0e\n\x06period\x18\x01 \x01(\r\x12\x11\n\tsecondary\x18\x02 \x01(\r\"\xf7\x01\n\x0fRequestResponse\x12\t\n\x05UNSET\x10\x00\x12\x10\n\x0cROUTER_ERROR\x10\x01\x12\x14\n\x10ROUTER_HEARTBEAT\x10\x02\x12\x0f\n\x0bROUTER_PING\x10\x03\x12\x0f\n\x0bROUTER_PONG\x10\x04\x12\x0f\n\x0bROUTER_BUSY\x10\x05\x12\x12\n\x0eROUTER_HISTORY\x10\x06\x12\x10\n\x0c\x43LIENT_ERROR\x10\x65\x12\x12\n\x0e\x43LIENT_HISTORY\x10\x66\x12\x10\n\x0c\x43LIENT_STATS\x10g\x12\x0f\n\x0b\x43LIENT_PING\x10h\x12\x0f\n\x0b\x43LIENT_PONG\x10i\x12\x10\n\x0c\x43LIENT_ABORT\x10jBR\n\x13\x63om.geeksville.meshB\x15StoreAndForwardProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ _sym_db.RegisterMessage(StoreAndForward.Heartbeat)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\025StoreAndForwardProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\025StoreAndForwardProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_STOREANDFORWARD._serialized_start=23
|
||||
_STOREANDFORWARD._serialized_end=801
|
||||
_STOREANDFORWARD_STATISTICS._serialized_start=223
|
||||
|
||||
@@ -15,17 +15,22 @@ _sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0ftelemetry.proto\"i\n\rDeviceMetrics\x12\x15\n\rbattery_level\x18\x01 \x01(\r\x12\x0f\n\x07voltage\x18\x02 \x01(\x02\x12\x1b\n\x13\x63hannel_utilization\x18\x03 \x01(\x02\x12\x13\n\x0b\x61ir_util_tx\x18\x04 \x01(\x02\"\x9b\x01\n\x12\x45nvironmentMetrics\x12\x13\n\x0btemperature\x18\x01 \x01(\x02\x12\x19\n\x11relative_humidity\x18\x02 \x01(\x02\x12\x1b\n\x13\x62\x61rometric_pressure\x18\x03 \x01(\x02\x12\x16\n\x0egas_resistance\x18\x04 \x01(\x02\x12\x0f\n\x07voltage\x18\x05 \x01(\x02\x12\x0f\n\x07\x63urrent\x18\x06 \x01(\x02\"\x82\x01\n\tTelemetry\x12\x0c\n\x04time\x18\x01 \x01(\x07\x12(\n\x0e\x64\x65vice_metrics\x18\x02 \x01(\x0b\x32\x0e.DeviceMetricsH\x00\x12\x32\n\x13\x65nvironment_metrics\x18\x03 \x01(\x0b\x32\x13.EnvironmentMetricsH\x00\x42\t\n\x07variant*j\n\x13TelemetrySensorType\x12\n\n\x06NotSet\x10\x00\x12\n\n\x06\x42ME280\x10\x01\x12\n\n\x06\x42ME680\x10\x02\x12\x0b\n\x07MCP9808\x10\x03\x12\n\n\x06INA260\x10\x04\x12\n\n\x06INA219\x10\x05\x12\n\n\x06\x42MP280\x10\x06\x42K\n\x13\x63om.geeksville.meshB\x0fTelemetryProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0ftelemetry.proto\"i\n\rDeviceMetrics\x12\x15\n\rbattery_level\x18\x01 \x01(\r\x12\x0f\n\x07voltage\x18\x02 \x01(\x02\x12\x1b\n\x13\x63hannel_utilization\x18\x03 \x01(\x02\x12\x13\n\x0b\x61ir_util_tx\x18\x04 \x01(\x02\"\x9b\x01\n\x12\x45nvironmentMetrics\x12\x13\n\x0btemperature\x18\x01 \x01(\x02\x12\x19\n\x11relative_humidity\x18\x02 \x01(\x02\x12\x1b\n\x13\x62\x61rometric_pressure\x18\x03 \x01(\x02\x12\x16\n\x0egas_resistance\x18\x04 \x01(\x02\x12\x0f\n\x07voltage\x18\x05 \x01(\x02\x12\x0f\n\x07\x63urrent\x18\x06 \x01(\x02\"\x82\x01\n\tTelemetry\x12\x0c\n\x04time\x18\x01 \x01(\x07\x12(\n\x0e\x64\x65vice_metrics\x18\x02 \x01(\x0b\x32\x0e.DeviceMetricsH\x00\x12\x32\n\x13\x65nvironment_metrics\x18\x03 \x01(\x0b\x32\x13.EnvironmentMetricsH\x00\x42\t\n\x07variant*\xae\x01\n\x13TelemetrySensorType\x12\x10\n\x0cSENSOR_UNSET\x10\x00\x12\n\n\x06\x42ME280\x10\x01\x12\n\n\x06\x42ME680\x10\x02\x12\x0b\n\x07MCP9808\x10\x03\x12\n\n\x06INA260\x10\x04\x12\n\n\x06INA219\x10\x05\x12\n\n\x06\x42MP280\x10\x06\x12\t\n\x05SHTC3\x10\x07\x12\t\n\x05LPS22\x10\x08\x12\x0b\n\x07QMC6310\x10\t\x12\x0b\n\x07QMI8658\x10\n\x12\x0c\n\x08QMC5883L\x10\x0b\x42L\n\x13\x63om.geeksville.meshB\x0fTelemetryProtosH\x03Z\"github.com/meshtastic/go/generatedb\x06proto3')
|
||||
|
||||
_TELEMETRYSENSORTYPE = DESCRIPTOR.enum_types_by_name['TelemetrySensorType']
|
||||
TelemetrySensorType = enum_type_wrapper.EnumTypeWrapper(_TELEMETRYSENSORTYPE)
|
||||
NotSet = 0
|
||||
SENSOR_UNSET = 0
|
||||
BME280 = 1
|
||||
BME680 = 2
|
||||
MCP9808 = 3
|
||||
INA260 = 4
|
||||
INA219 = 5
|
||||
BMP280 = 6
|
||||
SHTC3 = 7
|
||||
LPS22 = 8
|
||||
QMC6310 = 9
|
||||
QMI8658 = 10
|
||||
QMC5883L = 11
|
||||
|
||||
|
||||
_DEVICEMETRICS = DESCRIPTOR.message_types_by_name['DeviceMetrics']
|
||||
@@ -55,9 +60,9 @@ _sym_db.RegisterMessage(Telemetry)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
|
||||
DESCRIPTOR._options = None
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\017TelemetryProtosH\003Z!github.com/meshtastic/gomeshproto'
|
||||
_TELEMETRYSENSORTYPE._serialized_start=417
|
||||
_TELEMETRYSENSORTYPE._serialized_end=523
|
||||
DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\017TelemetryProtosH\003Z\"github.com/meshtastic/go/generated'
|
||||
_TELEMETRYSENSORTYPE._serialized_start=418
|
||||
_TELEMETRYSENSORTYPE._serialized_end=592
|
||||
_DEVICEMETRICS._serialized_start=19
|
||||
_DEVICEMETRICS._serialized_end=124
|
||||
_ENVIRONMENTMETRICS._serialized_start=127
|
||||
|
||||
@@ -217,24 +217,24 @@ def test_smoke1_set_owner():
|
||||
@pytest.mark.smoke1
|
||||
def test_smoke1_ch_set_modem_config():
|
||||
"""Test --ch-set modem_config"""
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set modem_config MidFast')
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set modem_config MedFast')
|
||||
assert re.search(r'Warning: Need to specify', out, re.MULTILINE)
|
||||
assert return_value == 1
|
||||
# pause for the radio
|
||||
time.sleep(PAUSE_AFTER_COMMAND)
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
||||
assert not re.search(r'MidFast', out, re.MULTILINE)
|
||||
assert not re.search(r'MedFast', out, re.MULTILINE)
|
||||
assert return_value == 0
|
||||
# pause for the radio
|
||||
time.sleep(PAUSE_AFTER_COMMAND)
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set modem_config MidFast --ch-index 0')
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set modem_config MedFast --ch-index 0')
|
||||
assert re.match(r'Connected to radio', out)
|
||||
assert re.search(r'^Set modem_config to MidFast', out, re.MULTILINE)
|
||||
assert re.search(r'^Set modem_config to MedFast', out, re.MULTILINE)
|
||||
assert return_value == 0
|
||||
# pause for the radio
|
||||
time.sleep(PAUSE_AFTER_REBOOT)
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
||||
assert re.search(r'MidFast', out, re.MULTILINE)
|
||||
assert re.search(r'MedFast', out, re.MULTILINE)
|
||||
assert return_value == 0
|
||||
|
||||
|
||||
@@ -247,8 +247,8 @@ def test_smoke1_ch_values():
|
||||
'--ch-vlongslow': '{ "psk": "AQ==" }',
|
||||
'--ch-longslow': 'LongSlow',
|
||||
'--ch-longfast': 'LongFast',
|
||||
'--ch-midslow': 'MidSlow',
|
||||
'--ch-midfast': 'MidFast',
|
||||
'--ch-medslow': 'MedSlow',
|
||||
'--ch-medfast': 'MedFast',
|
||||
'--ch-shortslow': 'ShortSlow',
|
||||
'--ch-shortfast': 'ShortFast'
|
||||
}
|
||||
|
||||
@@ -227,8 +227,8 @@ def test_smokevirt_ch_values():
|
||||
exp = {
|
||||
'--ch-longslow': 'LongSlow',
|
||||
'--ch-longfast': 'LongFast',
|
||||
'--ch-midslow': 'MidSlow',
|
||||
'--ch-midfast': 'MidFast',
|
||||
'--ch-medslow': 'MedSlow',
|
||||
'--ch-medfast': 'MedFast',
|
||||
'--ch-shortslow': 'ShortSlow',
|
||||
'--ch-shortfast': 'ShortFast'
|
||||
}
|
||||
|
||||
@@ -159,6 +159,27 @@ class Timeout:
|
||||
time.sleep(self.sleepInterval)
|
||||
return False
|
||||
|
||||
def waitForAckNak(self, acknowledgment, attrs=('receivedAck', 'receivedNak', 'receivedImplAck')):
|
||||
"""Block until an ACK or NAK has been received. Returns True if ACK or NAK has been received."""
|
||||
self.reset()
|
||||
while time.time() < self.expireTime:
|
||||
if any(map(lambda a: getattr(acknowledgment, a, None), attrs)):
|
||||
acknowledgment.reset()
|
||||
return True
|
||||
time.sleep(self.sleepInterval)
|
||||
return False
|
||||
|
||||
class Acknowledgment:
|
||||
"A class that records which type of acknowledgment was just received, if any."
|
||||
def __init__(self):
|
||||
self.receivedAck = False
|
||||
self.receivedNak = False
|
||||
self.receivedImplAck = False
|
||||
|
||||
def reset(self):
|
||||
self.receivedAck = False
|
||||
self.receivedNak = False
|
||||
self.receivedImplAck = False
|
||||
|
||||
class DeferredExecution():
|
||||
"""A thread that accepts closures to run, and runs them as they are received"""
|
||||
@@ -196,7 +217,7 @@ def support_info():
|
||||
print('')
|
||||
print('If having issues with meshtastic cli or python library')
|
||||
print('or wish to make feature requests, visit:')
|
||||
print('https://github.com/meshtastic/Meshtastic-python/issues')
|
||||
print('https://github.com/meshtastic/python/issues')
|
||||
print('When adding an issue, be sure to include the following info:')
|
||||
print(f' System: {platform.system()}')
|
||||
print(f' Platform: {platform.platform()}')
|
||||
|
||||
1
proto
1
proto
Submodule proto deleted from d8213ad133
1
protobufs
Submodule
1
protobufs
Submodule
Submodule protobufs added at 24874086e3
12
setup.py
12
setup.py
@@ -12,16 +12,16 @@ with open("README.md", "r") as fh:
|
||||
# This call to setup() does all the work
|
||||
setup(
|
||||
name="meshtastic",
|
||||
version="1.3alpha.25",
|
||||
version="2.0.3",
|
||||
description="Python API & client shell for talking to Meshtastic devices",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/meshtastic/Meshtastic-python",
|
||||
author="Kevin Hester",
|
||||
author_email="kevinh@geeksville.com",
|
||||
license="MIT",
|
||||
url="https://github.com/meshtastic/python",
|
||||
author="Meshtastic Developers",
|
||||
author_email="contact@meshtastic.org",
|
||||
license="GPL-3.0-only",
|
||||
classifiers=[
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Development Status :: 4 - Beta",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
readme.txt for single standalone executable zip files that can be
|
||||
downloaded from https://github.com/meshtastic/Meshtastic-python/releases
|
||||
downloaded from https://github.com/meshtastic/python/releases
|
||||
|
||||
If you do not want to install python and/or the python libraries, you can download one of these
|
||||
files to run the Meshtastic command line interface (CLI) as a standalone executable.
|
||||
|
||||
Reference in New Issue
Block a user