mirror of
https://github.com/meshtastic/python.git
synced 2026-01-03 21:37:57 -05:00
Compare commits
18 Commits
1.3alpha.9
...
1.3alpha.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b78276e49a | ||
|
|
bd4d309d89 | ||
|
|
804c09b6c5 | ||
|
|
92202807f7 | ||
|
|
0c92460163 | ||
|
|
8bb570d222 | ||
|
|
f1abce9eff | ||
|
|
1fc46a3c02 | ||
|
|
1d45adfb27 | ||
|
|
8365ad5d1b | ||
|
|
00346ea441 | ||
|
|
ae70d34dd6 | ||
|
|
e0ef62d1b3 | ||
|
|
02e8467fdd | ||
|
|
48e7f8c755 | ||
|
|
19b607b3f2 | ||
|
|
1d827ab2bf | ||
|
|
7af886cf07 |
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -42,14 +42,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pytest --cov=meshtastic --cov-report=xml
|
pytest --cov=meshtastic --cov-report=xml
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
file: ./coverage.xml
|
files: ./coverage.xml
|
||||||
flags: unittests
|
flags: unittests
|
||||||
name: codecov-umbrella
|
name: codecov-umbrella
|
||||||
yml: ./codecov.yml
|
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
verbose: true
|
||||||
validate:
|
validate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -6,6 +6,10 @@ test:
|
|||||||
virt:
|
virt:
|
||||||
pytest -m smokevirt
|
pytest -m smokevirt
|
||||||
|
|
||||||
|
# run the smoke1 test (after doing a factory reset and unplugging/replugging in device)
|
||||||
|
smoke1:
|
||||||
|
pytest -m smoke1 -s -vv
|
||||||
|
|
||||||
# local install
|
# local install
|
||||||
install:
|
install:
|
||||||
pip install .
|
pip install .
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||

|

|
||||||
[](https://codecov.io/gh/meshtastic/Meshtastic-python)
|
[](https://codecov.io/gh/meshtastic/Meshtastic-python)
|
||||||

|

|
||||||
|
[](https://cla-assistant.io/meshtastic/Meshtastic-python)
|
||||||
|
|
||||||
A python client for using [Meshtastic](https://www.meshtastic.org) devices. This small library (and example application) provides an easy API for sending and receiving messages over mesh radios. 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.
|
A python client for using [Meshtastic](https://www.meshtastic.org) devices. This small library (and example application) provides an easy API for sending and receiving messages over mesh radios. 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.
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -298,7 +298,7 @@ class Node:
|
|||||||
if "decoded" in p:
|
if "decoded" in p:
|
||||||
if "admin" in p["decoded"]:
|
if "admin" in p["decoded"]:
|
||||||
if "raw" in p["decoded"]["admin"]:
|
if "raw" in p["decoded"]["admin"]:
|
||||||
self.cannedPluginMessagePart1 = p["decoded"]["admin"]["raw"].get_canned_message_plugin_part1_response
|
self.cannedPluginMessagePart1 = p["decoded"]["admin"]["raw"].get_canned_message_module_part1_response
|
||||||
logging.debug(f'self.cannedPluginMessagePart1:{self.cannedPluginMessagePart1}')
|
logging.debug(f'self.cannedPluginMessagePart1:{self.cannedPluginMessagePart1}')
|
||||||
self.gotResponse = True
|
self.gotResponse = True
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ class Node:
|
|||||||
if "decoded" in p:
|
if "decoded" in p:
|
||||||
if "admin" in p["decoded"]:
|
if "admin" in p["decoded"]:
|
||||||
if "raw" in p["decoded"]["admin"]:
|
if "raw" in p["decoded"]["admin"]:
|
||||||
self.cannedPluginMessagePart2 = p["decoded"]["admin"]["raw"].get_canned_message_plugin_part2_response
|
self.cannedPluginMessagePart2 = p["decoded"]["admin"]["raw"].get_canned_message_module_part2_response
|
||||||
logging.debug(f'self.cannedPluginMessagePart2:{self.cannedPluginMessagePart2}')
|
logging.debug(f'self.cannedPluginMessagePart2:{self.cannedPluginMessagePart2}')
|
||||||
self.gotResponse = True
|
self.gotResponse = True
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ class Node:
|
|||||||
if "decoded" in p:
|
if "decoded" in p:
|
||||||
if "admin" in p["decoded"]:
|
if "admin" in p["decoded"]:
|
||||||
if "raw" in p["decoded"]["admin"]:
|
if "raw" in p["decoded"]["admin"]:
|
||||||
self.cannedPluginMessagePart3 = p["decoded"]["admin"]["raw"].get_canned_message_plugin_part3_response
|
self.cannedPluginMessagePart3 = p["decoded"]["admin"]["raw"].get_canned_message_module_part3_response
|
||||||
logging.debug(f'self.cannedPluginMessagePart3:{self.cannedPluginMessagePart3}')
|
logging.debug(f'self.cannedPluginMessagePart3:{self.cannedPluginMessagePart3}')
|
||||||
self.gotResponse = True
|
self.gotResponse = True
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ class Node:
|
|||||||
if "decoded" in p:
|
if "decoded" in p:
|
||||||
if "admin" in p["decoded"]:
|
if "admin" in p["decoded"]:
|
||||||
if "raw" in p["decoded"]["admin"]:
|
if "raw" in p["decoded"]["admin"]:
|
||||||
self.cannedPluginMessagePart4 = p["decoded"]["admin"]["raw"].get_canned_message_plugin_part4_response
|
self.cannedPluginMessagePart4 = p["decoded"]["admin"]["raw"].get_canned_message_module_part4_response
|
||||||
logging.debug(f'self.cannedPluginMessagePart4:{self.cannedPluginMessagePart4}')
|
logging.debug(f'self.cannedPluginMessagePart4:{self.cannedPluginMessagePart4}')
|
||||||
self.gotResponse = True
|
self.gotResponse = True
|
||||||
|
|
||||||
@@ -356,28 +356,28 @@ class Node:
|
|||||||
if not self.cannedPluginMessage:
|
if not self.cannedPluginMessage:
|
||||||
|
|
||||||
p1 = admin_pb2.AdminMessage()
|
p1 = admin_pb2.AdminMessage()
|
||||||
p1.get_canned_message_plugin_part1_request = True
|
p1.get_canned_message_module_part1_request = True
|
||||||
self.gotResponse = False
|
self.gotResponse = False
|
||||||
self._sendAdmin(p1, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart1)
|
self._sendAdmin(p1, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart1)
|
||||||
while self.gotResponse is False:
|
while self.gotResponse is False:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
p2 = admin_pb2.AdminMessage()
|
p2 = admin_pb2.AdminMessage()
|
||||||
p2.get_canned_message_plugin_part2_request = True
|
p2.get_canned_message_module_part2_request = True
|
||||||
self.gotResponse = False
|
self.gotResponse = False
|
||||||
self._sendAdmin(p2, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart2)
|
self._sendAdmin(p2, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart2)
|
||||||
while self.gotResponse is False:
|
while self.gotResponse is False:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
p3 = admin_pb2.AdminMessage()
|
p3 = admin_pb2.AdminMessage()
|
||||||
p3.get_canned_message_plugin_part3_request = True
|
p3.get_canned_message_module_part3_request = True
|
||||||
self.gotResponse = False
|
self.gotResponse = False
|
||||||
self._sendAdmin(p3, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart3)
|
self._sendAdmin(p3, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart3)
|
||||||
while self.gotResponse is False:
|
while self.gotResponse is False:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
p4 = admin_pb2.AdminMessage()
|
p4 = admin_pb2.AdminMessage()
|
||||||
p4.get_canned_message_plugin_part4_request = True
|
p4.get_canned_message_module_part4_request = True
|
||||||
self.gotResponse = False
|
self.gotResponse = False
|
||||||
self._sendAdmin(p4, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart4)
|
self._sendAdmin(p4, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart4)
|
||||||
while self.gotResponse is False:
|
while self.gotResponse is False:
|
||||||
@@ -425,13 +425,13 @@ class Node:
|
|||||||
|
|
||||||
# TODO: should be a way to improve this
|
# TODO: should be a way to improve this
|
||||||
if i == 0:
|
if i == 0:
|
||||||
p.set_canned_message_plugin_part1 = chunk
|
p.set_canned_message_module_part1 = chunk
|
||||||
elif i == 1:
|
elif i == 1:
|
||||||
p.set_canned_message_plugin_part2 = chunk
|
p.set_canned_message_module_part2 = chunk
|
||||||
elif i == 2:
|
elif i == 2:
|
||||||
p.set_canned_message_plugin_part3 = chunk
|
p.set_canned_message_module_part3 = chunk
|
||||||
elif i == 3:
|
elif i == 3:
|
||||||
p.set_canned_message_plugin_part4 = chunk
|
p.set_canned_message_module_part4 = chunk
|
||||||
|
|
||||||
logging.debug(f"Setting canned message '{chunk}' part {i+1}")
|
logging.debug(f"Setting canned message '{chunk}' part {i+1}")
|
||||||
self._sendAdmin(p)
|
self._sendAdmin(p)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -73,6 +73,10 @@ rak4631_5005 = SupportedDevice(name="RAK 4631 5005", version="", for_firmware="r
|
|||||||
device_class="nrf52",
|
device_class="nrf52",
|
||||||
baseport_on_linux="ttyACM", baseport_on_mac="cu.usbmodem",
|
baseport_on_linux="ttyACM", baseport_on_mac="cu.usbmodem",
|
||||||
usb_vendor_id_in_hex="239a", usb_product_id_in_hex="0029")
|
usb_vendor_id_in_hex="239a", usb_product_id_in_hex="0029")
|
||||||
|
rak4631_5005_epaper = SupportedDevice(name="RAK 4631 5005 14000 epaper", version="", for_firmware="rak4631_5005_epaper",
|
||||||
|
device_class="nrf52",
|
||||||
|
baseport_on_linux="ttyACM", baseport_on_mac="cu.usbmodem",
|
||||||
|
usb_vendor_id_in_hex="239a", usb_product_id_in_hex="0029")
|
||||||
# Note: The 19003 reports same product id as 5005 in boot mode
|
# Note: The 19003 reports same product id as 5005 in boot mode
|
||||||
rak4631_19003 = SupportedDevice(name="RAK 4631 19003", version="", for_firmware="rak4631_19003",
|
rak4631_19003 = SupportedDevice(name="RAK 4631 19003", version="", for_firmware="rak4631_19003",
|
||||||
device_class="nrf52",
|
device_class="nrf52",
|
||||||
@@ -82,5 +86,5 @@ rak4631_19003 = SupportedDevice(name="RAK 4631 19003", version="", for_firmware=
|
|||||||
supported_devices = [tbeam_v0_7, tbeam_v1_1, tbeam_M8N, tbeam_M8N_SX1262,
|
supported_devices = [tbeam_v0_7, tbeam_v1_1, tbeam_M8N, tbeam_M8N_SX1262,
|
||||||
tlora_v1, tlora_v1_3, tlora_v2, tlora_v2_1_1_6,
|
tlora_v1, tlora_v1_3, tlora_v2, tlora_v2_1_1_6,
|
||||||
heltec_v1, heltec_v2_0, heltec_v2_1,
|
heltec_v1, heltec_v2_0, heltec_v2_1,
|
||||||
meshtastic_diy_v1, techo_1, rak4631_5005, rak4631_19003,
|
meshtastic_diy_v1, techo_1, rak4631_5005, rak4631_5005_epaper, rak4631_19003,
|
||||||
rak11200]
|
rak11200]
|
||||||
|
|||||||
@@ -170,20 +170,6 @@ def test_smoke1_port():
|
|||||||
assert return_value == 0
|
assert return_value == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smoke1
|
|
||||||
def test_smoke1_set_is_router_true():
|
|
||||||
"""Test --set is_router true"""
|
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --set is_router true')
|
|
||||||
assert re.match(r'Connected to radio', out)
|
|
||||||
assert re.search(r'^Set is_router to true', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
# pause for the radio
|
|
||||||
time.sleep(PAUSE_AFTER_COMMAND)
|
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --get is_router')
|
|
||||||
assert re.search(r'^is_router: True', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smoke1
|
@pytest.mark.smoke1
|
||||||
def test_smoke1_set_location_info():
|
def test_smoke1_set_location_info():
|
||||||
"""Test --setlat, --setlon and --setalt """
|
"""Test --setlat, --setlon and --setalt """
|
||||||
@@ -202,20 +188,6 @@ def test_smoke1_set_location_info():
|
|||||||
assert return_value == 0
|
assert return_value == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smoke1
|
|
||||||
def test_smoke1_set_is_router_false():
|
|
||||||
"""Test --set is_router false"""
|
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --set is_router false')
|
|
||||||
assert re.match(r'Connected to radio', out)
|
|
||||||
assert re.search(r'^Set is_router to false', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
# pause for the radio
|
|
||||||
time.sleep(PAUSE_AFTER_COMMAND)
|
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --get is_router')
|
|
||||||
assert re.search(r'^is_router: False', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smoke1
|
@pytest.mark.smoke1
|
||||||
def test_smoke1_set_owner():
|
def test_smoke1_set_owner():
|
||||||
"""Test --set-owner name"""
|
"""Test --set-owner name"""
|
||||||
@@ -262,19 +234,43 @@ def test_smoke1_set_team():
|
|||||||
assert return_value == 0
|
assert return_value == 0
|
||||||
|
|
||||||
|
|
||||||
|
@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')
|
||||||
|
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 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')
|
||||||
|
assert re.match(r'Connected to radio', out)
|
||||||
|
assert re.search(r'^Set modem_config to MidFast', 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 return_value == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smoke1
|
@pytest.mark.smoke1
|
||||||
def test_smoke1_ch_values():
|
def test_smoke1_ch_values():
|
||||||
"""Test --ch-longslow, --ch-longfast, --ch-mediumslow, --ch-mediumsfast,
|
"""Test --ch-vlongslow --ch-longslow, --ch-longfast, --ch-mediumslow, --ch-mediumsfast,
|
||||||
--ch-shortslow, and --ch-shortfast arguments
|
--ch-shortslow, and --ch-shortfast arguments
|
||||||
"""
|
"""
|
||||||
exp = {
|
exp = {
|
||||||
'--ch-longslow': 'Bw125Cr48Sf4096',
|
'--ch-vlongslow': '{ "psk": "AQ==" }',
|
||||||
'--ch-longfast': 'Bw31_25Cr48Sf512',
|
'--ch-longslow': 'LongSlow',
|
||||||
'--ch-mediumslow': 'Bw250Cr46Sf2048',
|
'--ch-longfast': 'LongFast',
|
||||||
'--ch-mediumfast': 'Bw250Cr47Sf1024',
|
'--ch-midslow': 'MidSlow',
|
||||||
# for some reason, this value does not show any modemConfig
|
'--ch-midfast': 'MidFast',
|
||||||
'--ch-shortslow': '{ "psk',
|
'--ch-shortslow': 'ShortSlow',
|
||||||
'--ch-shortfast': 'Bw500Cr45Sf128'
|
'--ch-shortfast': 'ShortFast'
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, val in exp.items():
|
for key, val in exp.items():
|
||||||
@@ -578,30 +574,6 @@ def test_smoke1_ensure_ch_del_third_of_three_channels():
|
|||||||
time.sleep(PAUSE_AFTER_COMMAND)
|
time.sleep(PAUSE_AFTER_COMMAND)
|
||||||
|
|
||||||
|
|
||||||
@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 Bw31_25Cr48Sf512')
|
|
||||||
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'Bw31_25Cr48Sf512', 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 Bw31_25Cr48Sf512 --ch-index 0')
|
|
||||||
assert re.match(r'Connected to radio', out)
|
|
||||||
assert re.search(r'^Set modem_config to Bw31_25Cr48Sf512', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
# pause for the radio
|
|
||||||
time.sleep(PAUSE_AFTER_COMMAND)
|
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
||||||
assert re.search(r'Bw31_25Cr48Sf512', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smoke1
|
@pytest.mark.smoke1
|
||||||
def test_smoke1_seturl_default():
|
def test_smoke1_seturl_default():
|
||||||
"""Test --seturl with default value"""
|
"""Test --seturl with default value"""
|
||||||
|
|||||||
@@ -175,20 +175,6 @@ def test_smokevirt_port():
|
|||||||
assert len(ports) == 0
|
assert len(ports) == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smokevirt
|
|
||||||
def test_smokevirt_set_is_router_true():
|
|
||||||
"""Test --set is_router true"""
|
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --host localhost --set is_router true')
|
|
||||||
assert re.match(r'Connected to radio', out)
|
|
||||||
assert re.search(r'^Set is_router to true', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
# pause for the radio
|
|
||||||
time.sleep(PAUSE_AFTER_COMMAND)
|
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --host localhost --get is_router')
|
|
||||||
assert re.search(r'^is_router: True', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smokevirt
|
@pytest.mark.smokevirt
|
||||||
def test_smokevirt_set_location_info():
|
def test_smokevirt_set_location_info():
|
||||||
"""Test --setlat, --setlon and --setalt """
|
"""Test --setlat, --setlon and --setalt """
|
||||||
@@ -207,20 +193,6 @@ def test_smokevirt_set_location_info():
|
|||||||
assert return_value == 0
|
assert return_value == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smokevirt
|
|
||||||
def test_smokevirt_set_is_router_false():
|
|
||||||
"""Test --set is_router false"""
|
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --host localhost --set is_router false')
|
|
||||||
assert re.match(r'Connected to radio', out)
|
|
||||||
assert re.search(r'^Set is_router to false', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
# pause for the radio
|
|
||||||
time.sleep(PAUSE_AFTER_COMMAND)
|
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --host localhost --get is_router')
|
|
||||||
assert re.search(r'^is_router: False', out, re.MULTILINE)
|
|
||||||
assert return_value == 0
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.smokevirt
|
@pytest.mark.smokevirt
|
||||||
def test_smokevirt_set_owner():
|
def test_smokevirt_set_owner():
|
||||||
"""Test --set-owner name"""
|
"""Test --set-owner name"""
|
||||||
@@ -273,12 +245,12 @@ def test_smokevirt_ch_values():
|
|||||||
--ch-shortslow, and --ch-shortfast arguments
|
--ch-shortslow, and --ch-shortfast arguments
|
||||||
"""
|
"""
|
||||||
exp = {
|
exp = {
|
||||||
'--ch-longslow': 'Bw125Cr48Sf4096',
|
'--ch-longslow': 'LongSlow',
|
||||||
'--ch-longfast': 'Bw31_25Cr48Sf512',
|
'--ch-longfast': 'LongFast',
|
||||||
'--ch-mediumslow': 'Bw250Cr46Sf2048',
|
'--ch-midslow': 'MidSlow',
|
||||||
'--ch-mediumfast': 'Bw250Cr47Sf1024',
|
'--ch-midfast': 'MidFast',
|
||||||
'--ch-shortslow': '{ "psk',
|
'--ch-shortslow': 'ShortSlow',
|
||||||
'--ch-shortfast': 'Bw500Cr45Sf128'
|
'--ch-shortfast': 'ShortFast'
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, val in exp.items():
|
for key, val in exp.items():
|
||||||
@@ -611,14 +583,14 @@ def test_smokevirt_ch_set_modem_config():
|
|||||||
assert return_value == 0
|
assert return_value == 0
|
||||||
# pause for the radio
|
# pause for the radio
|
||||||
time.sleep(PAUSE_AFTER_COMMAND)
|
time.sleep(PAUSE_AFTER_COMMAND)
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --host localhost --ch-set modem_config Bw31_25Cr48Sf512 --ch-index 0')
|
return_value, out = subprocess.getstatusoutput('meshtastic --host localhost --ch-set modem_config MidSlow --ch-index 0')
|
||||||
assert re.match(r'Connected to radio', out)
|
assert re.match(r'Connected to radio', out)
|
||||||
assert re.search(r'^Set modem_config to Bw31_25Cr48Sf512', out, re.MULTILINE)
|
assert re.search(r'^Set modem_config to MidSlow', out, re.MULTILINE)
|
||||||
assert return_value == 0
|
assert return_value == 0
|
||||||
# pause for the radio
|
# pause for the radio
|
||||||
time.sleep(PAUSE_AFTER_COMMAND)
|
time.sleep(PAUSE_AFTER_COMMAND)
|
||||||
return_value, out = subprocess.getstatusoutput('meshtastic --host localhost --info')
|
return_value, out = subprocess.getstatusoutput('meshtastic --host localhost --info')
|
||||||
assert re.search(r'Bw31_25Cr48Sf512', out, re.MULTILINE)
|
assert re.search(r'MidSlow', out, re.MULTILINE)
|
||||||
assert return_value == 0
|
assert return_value == 0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ def camel_to_snake(a_string):
|
|||||||
|
|
||||||
|
|
||||||
def detect_supported_devices():
|
def detect_supported_devices():
|
||||||
"""detect supported devices"""
|
"""detect supported devices based on vendor id"""
|
||||||
system = platform.system()
|
system = platform.system()
|
||||||
#print(f'system:{system}')
|
#print(f'system:{system}')
|
||||||
|
|
||||||
@@ -285,19 +285,8 @@ def detect_supported_devices():
|
|||||||
if re.search(search, lsusb_output, re.MULTILINE):
|
if re.search(search, lsusb_output, re.MULTILINE):
|
||||||
#print(f'Found vendor id that matches')
|
#print(f'Found vendor id that matches')
|
||||||
devices = get_devices_with_vendor_id(vid)
|
devices = get_devices_with_vendor_id(vid)
|
||||||
# check device id
|
|
||||||
for device in devices:
|
for device in devices:
|
||||||
#print(f'device:{device} device.usb_product_id_in_hex:{device.usb_product_id_in_hex}')
|
possible_devices.add(device)
|
||||||
if device.usb_product_id_in_hex:
|
|
||||||
search = f' {vid}:{device.usb_product_id_in_hex} '
|
|
||||||
#print(f'search:"{search}"')
|
|
||||||
if re.search(search, lsusb_output, re.MULTILINE):
|
|
||||||
# concatenate the devices with vendor id to possibles
|
|
||||||
possible_devices.add(device)
|
|
||||||
else:
|
|
||||||
# if there is a supported device witout a product id, then it
|
|
||||||
# might be a match... so, concatenate
|
|
||||||
possible_devices.add(device)
|
|
||||||
|
|
||||||
elif system == "Windows":
|
elif system == "Windows":
|
||||||
# if windows, run Get-PnpDevice
|
# if windows, run Get-PnpDevice
|
||||||
@@ -313,22 +302,8 @@ def detect_supported_devices():
|
|||||||
if re.search(search, sp_output, re.MULTILINE):
|
if re.search(search, sp_output, re.MULTILINE):
|
||||||
#print(f'Found vendor id that matches')
|
#print(f'Found vendor id that matches')
|
||||||
devices = get_devices_with_vendor_id(vid)
|
devices = get_devices_with_vendor_id(vid)
|
||||||
# check device id
|
|
||||||
for device in devices:
|
for device in devices:
|
||||||
#print(f'device:{device} device.usb_product_id_in_hex:{device.usb_product_id_in_hex}')
|
possible_devices.add(device)
|
||||||
if device.usb_product_id_in_hex:
|
|
||||||
search = f'DeviceID.*{vid.upper()}&PID_{device.usb_product_id_in_hex.upper()}'
|
|
||||||
#print(f'search:"{search}"')
|
|
||||||
if re.search(search, sp_output, re.MULTILINE):
|
|
||||||
# concatenate the devices with vendor id to possibles
|
|
||||||
possible_devices.add(device)
|
|
||||||
# do a check to see if there is a Windows driver issue
|
|
||||||
if detect_windows_needs_driver(device, False):
|
|
||||||
print("WARNING: Need to install driver.")
|
|
||||||
else:
|
|
||||||
# if there is a supported device witout a product id, then it
|
|
||||||
# might be a match... so, concatenate
|
|
||||||
possible_devices.add(device)
|
|
||||||
|
|
||||||
elif system == "Darwin":
|
elif system == "Darwin":
|
||||||
# run: system_profiler SPUSBDataType
|
# run: system_profiler SPUSBDataType
|
||||||
@@ -343,19 +318,8 @@ def detect_supported_devices():
|
|||||||
if re.search(search, sp_output, re.MULTILINE):
|
if re.search(search, sp_output, re.MULTILINE):
|
||||||
#print(f'Found vendor id that matches')
|
#print(f'Found vendor id that matches')
|
||||||
devices = get_devices_with_vendor_id(vid)
|
devices = get_devices_with_vendor_id(vid)
|
||||||
# check device id
|
|
||||||
for device in devices:
|
for device in devices:
|
||||||
#print(f'device:{device} device.usb_product_id_in_hex:{device.usb_product_id_in_hex}')
|
possible_devices.add(device)
|
||||||
if device.usb_product_id_in_hex:
|
|
||||||
search = f'Product ID: 0x{device.usb_product_id_in_hex}'
|
|
||||||
#print(f'search:"{search}"')
|
|
||||||
if re.search(search, sp_output, re.MULTILINE):
|
|
||||||
# concatenate the devices with vendor id to possibles
|
|
||||||
possible_devices.add(device)
|
|
||||||
else:
|
|
||||||
# if there is a supported device witout a product id, then it
|
|
||||||
# might be a match... so, concatenate
|
|
||||||
possible_devices.add(device)
|
|
||||||
return possible_devices
|
return possible_devices
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
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="1.3alpha.8",
|
version="1.3alpha.11",
|
||||||
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