mirror of
https://github.com/meshtastic/python.git
synced 2026-01-03 05:17:55 -05:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c65a60d22d | ||
|
|
3a6475dc9d | ||
|
|
6f91479605 | ||
|
|
bbebddea78 | ||
|
|
45be828183 | ||
|
|
e0753d4745 | ||
|
|
21f2e185f2 | ||
|
|
4bfedf6aa9 | ||
|
|
193c3faca5 | ||
|
|
1f47c225b3 | ||
|
|
1b372fca8d |
File diff suppressed because one or more lines are too long
@@ -615,6 +615,10 @@ class MeshInterface:
|
|||||||
self.localNode.moduleConfig.telemetry.CopyFrom(fromRadio.moduleConfig.telemetry)
|
self.localNode.moduleConfig.telemetry.CopyFrom(fromRadio.moduleConfig.telemetry)
|
||||||
elif fromRadio.moduleConfig.HasField("canned_message"):
|
elif fromRadio.moduleConfig.HasField("canned_message"):
|
||||||
self.localNode.moduleConfig.canned_message.CopyFrom(fromRadio.moduleConfig.canned_message)
|
self.localNode.moduleConfig.canned_message.CopyFrom(fromRadio.moduleConfig.canned_message)
|
||||||
|
elif fromRadio.moduleConfig.HasField("audio"):
|
||||||
|
self.localNode.moduleConfig.audio.CopyFrom(fromRadio.moduleConfig.audio)
|
||||||
|
elif fromRadio.moduleConfig.HasField("remote_hardware"):
|
||||||
|
self.localNode.moduleConfig.remote_hardware.CopyFrom(fromRadio.moduleConfig.remote_hardware)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.debug("Unexpected FromRadio payload")
|
logging.debug("Unexpected FromRadio payload")
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -83,19 +83,19 @@ class Node:
|
|||||||
if "getConfigResponse" in adminMessage:
|
if "getConfigResponse" in adminMessage:
|
||||||
resp = adminMessage["getConfigResponse"]
|
resp = adminMessage["getConfigResponse"]
|
||||||
field = list(resp.keys())[0]
|
field = list(resp.keys())[0]
|
||||||
config_type = self.localConfig.DESCRIPTOR.fields_by_name.get(field)
|
config_type = self.localConfig.DESCRIPTOR.fields_by_name.get(camel_to_snake(field))
|
||||||
config_values = getattr(self.localConfig, config_type.name)
|
config_values = getattr(self.localConfig, config_type.name)
|
||||||
elif "getModuleConfigResponse" in adminMessage:
|
elif "getModuleConfigResponse" in adminMessage:
|
||||||
resp = adminMessage["getModuleConfigResponse"]
|
resp = adminMessage["getModuleConfigResponse"]
|
||||||
field = list(resp.keys())[0]
|
field = list(resp.keys())[0]
|
||||||
config_type = self.moduleConfig.DESCRIPTOR.fields_by_name.get(field)
|
config_type = self.moduleConfig.DESCRIPTOR.fields_by_name.get(camel_to_snake(field))
|
||||||
config_values = getattr(self.moduleConfig, config_type.name)
|
config_values = getattr(self.moduleConfig, config_type.name)
|
||||||
else:
|
else:
|
||||||
print("Did not receive a valid response. Make sure to have a shared channel named 'admin'.")
|
print("Did not receive a valid response. Make sure to have a shared channel named 'admin'.")
|
||||||
return
|
return
|
||||||
for key, value in resp[field].items():
|
for key, value in resp[field].items():
|
||||||
setattr(config_values, camel_to_snake(key), value)
|
setattr(config_values, camel_to_snake(key), value)
|
||||||
print(f"{str(field)}:\n{str(config_values)}")
|
print(f"{str(camel_to_snake(field))}:\n{str(config_values)}")
|
||||||
|
|
||||||
def requestConfig(self, configType):
|
def requestConfig(self, configType):
|
||||||
if self == self.iface.localNode:
|
if self == self.iface.localNode:
|
||||||
@@ -233,7 +233,14 @@ class Node:
|
|||||||
p = admin_pb2.AdminMessage()
|
p = admin_pb2.AdminMessage()
|
||||||
p.set_module_config.audio.CopyFrom(self.moduleConfig.audio)
|
p.set_module_config.audio.CopyFrom(self.moduleConfig.audio)
|
||||||
self._sendAdmin(p)
|
self._sendAdmin(p)
|
||||||
logging.debug("Wrote module: audo")
|
logging.debug("Wrote module: audio")
|
||||||
|
time.sleep(0.3)
|
||||||
|
|
||||||
|
if self.moduleConfig.remote_hardware:
|
||||||
|
p = admin_pb2.AdminMessage()
|
||||||
|
p.set_module_config.remote_hardware.CopyFrom(self.moduleConfig.remote_hardware)
|
||||||
|
self._sendAdmin(p)
|
||||||
|
logging.debug("Wrote module: remote_hardware")
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
|
|
||||||
def writeConfig(self, config_name):
|
def writeConfig(self, config_name):
|
||||||
@@ -273,6 +280,8 @@ class Node:
|
|||||||
p.set_module_config.canned_message.CopyFrom(self.moduleConfig.canned_message)
|
p.set_module_config.canned_message.CopyFrom(self.moduleConfig.canned_message)
|
||||||
elif config_name == 'audio':
|
elif config_name == 'audio':
|
||||||
p.set_module_config.audio.CopyFrom(self.moduleConfig.audio)
|
p.set_module_config.audio.CopyFrom(self.moduleConfig.audio)
|
||||||
|
elif config_name == 'remote_hardware':
|
||||||
|
p.set_module_config.remote_hardware.CopyFrom(self.moduleConfig.remote_hardware)
|
||||||
else:
|
else:
|
||||||
our_exit(f"Error: No valid config with name {config_name}")
|
our_exit(f"Error: No valid config with name {config_name}")
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ def test_RemoteHardwareClient():
|
|||||||
def test_onGPIOreceive(capsys):
|
def test_onGPIOreceive(capsys):
|
||||||
"""Test onGPIOreceive"""
|
"""Test onGPIOreceive"""
|
||||||
iface = MagicMock(autospec=SerialInterface)
|
iface = MagicMock(autospec=SerialInterface)
|
||||||
packet = {'decoded': {'remotehw': {'typ': 'foo', 'gpioValue': '4096' }}}
|
packet = {'decoded': {'remotehw': {'type': 'foo', 'gpioValue': '4096' }}}
|
||||||
onGPIOreceive(packet, iface)
|
onGPIOreceive(packet, iface)
|
||||||
out, err = capsys.readouterr()
|
out, err = capsys.readouterr()
|
||||||
assert re.search(r'Received RemoteHardware', out)
|
assert re.search(r'Received RemoteHardware', out)
|
||||||
|
|||||||
Submodule protobufs updated: e3e22cdee6...ef83ba1d91
2
setup.py
2
setup.py
@@ -12,7 +12,7 @@ with open("README.md", "r") as fh:
|
|||||||
# This call to setup() does all the work
|
# This call to setup() does all the work
|
||||||
setup(
|
setup(
|
||||||
name="meshtastic",
|
name="meshtastic",
|
||||||
version="2.1.0",
|
version="2.1.3",
|
||||||
description="Python API & client shell for talking to Meshtastic devices",
|
description="Python API & client shell for talking to Meshtastic devices",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
|||||||
Reference in New Issue
Block a user