fix db updates

This commit is contained in:
geeksville
2020-05-12 18:16:35 -07:00
parent 0f6f791d14
commit 6d3c34878b
3 changed files with 27 additions and 10 deletions

8
.vscode/launch.json vendored
View File

@@ -19,6 +19,14 @@
"module": "meshtastic",
"justMyCode": true,
"args": ["--debug", "--info"]
},
{
"name": "meshtastic shell",
"type": "python",
"request": "launch",
"module": "meshtastic",
"justMyCode": true,
"args": ["--debug", "--seriallog", "stdout"]
}
]
}

13
TODO.md
View File

@@ -3,15 +3,13 @@
## Bluetooth support
(Alpha level feature)
This library supports connecting to Meshtastic devices over either USB (serial) or Bluetooth. Before connecting to the device you must [pair](https://docs.ubuntu.com/core/en/stacks/bluetooth/bluez/docs/reference/pairing/outbound.html) your PC with it.
We use the pip3 install "pygatt[GATTTOOL]"
- This library supports connecting to Meshtastic devices over either USB (serial) or Bluetooth. Before connecting to the device you must [pair](https://docs.ubuntu.com/core/en/stacks/bluetooth/bluez/docs/reference/pairing/outbound.html) your PC with it.
- We use the pip3 install "pygatt[GATTTOOL]"
- ./bin/run.sh --debug --ble --device 24:62:AB:DD:DF:3A
## Before beta
- ./bin/run.sh --debug --ble --device 24:62:AB:DD:DF:3A
- update nodedb as nodes change
- radioConfig - getter/setter syntax: https://www.python-course.eu/python3_properties.php
- let user change radio params via commandline options
- document properties/fields
- include more examples: textchat.py, replymessage.py all as one little demo
- have device side StreamAPI client prevent radio sleep
@@ -42,3 +40,6 @@ We use the pip3 install "pygatt[GATTTOOL]"
- DONE have device send a special packet at boot so the serial client can detect if it rebooted
- DONE add fromId and toId to received messages dictionaries
- make command line options for displaying/changing config
- update nodedb as nodes change
- radioConfig - getter/setter syntax: https://www.python-course.eu/python3_properties.php
- let user change radio params via commandline options

View File

@@ -211,7 +211,7 @@ class MeshInterface:
return BROADCAST_ADDR
try:
return self._nodesByNum[num].user.id
return self._nodesByNum[num]["user"]["id"]
except:
logging.error("Node not found for fromId")
return None
@@ -235,11 +235,17 @@ class MeshInterface:
topic = None
if meshPacket.decoded.HasField("position"):
topic = "meshtastic.receive.position"
self._fixupPosition(asDict["payload"]["position"])
# FIXME, update node DB as needed
p = asDict["decoded"]["position"]
self._fixupPosition(p)
# update node DB as needed
self._nodesByNum[asDict["from"]]["position"] = p
if meshPacket.decoded.HasField("user"):
topic = "meshtastic.receive.user"
# FIXME, update node DB as needed
u = asDict["decoded"]["user"]
# update node DB as needed
self._nodesByNum[asDict["from"]]["user"] = u
if meshPacket.decoded.HasField("data"):
topic = "meshtastic.receive.data"
# For text messages, we go ahead and decode the text to ascii for our users
@@ -257,6 +263,8 @@ FROMNUM_UUID = "ed9da18c-a800-4f66-a670-aa7547e34453"
class BLEInterface(MeshInterface):
"""A not quite ready - FIXME - BLE interface to devices"""
def __init__(self, address, debugOut=None):
self.address = address
self.adapter = pygatt.GATTToolBackend() # BGAPIBackend()