diff --git a/docs/meshtastic/admin_pb2.html b/docs/meshtastic/admin_pb2.html index 4e48e0b..20b1262 100644 --- a/docs/meshtastic/admin_pb2.html +++ b/docs/meshtastic/admin_pb2.html @@ -39,9 +39,9 @@ from google.protobuf import symbol_database as _symbol_database _sym_db = _symbol_database.Default() +from . import channel_pb2 as channel__pb2 from . import mesh_pb2 as mesh__pb2 from . import radioconfig_pb2 as radioconfig__pb2 -from . import channel_pb2 as channel__pb2 DESCRIPTOR = _descriptor.FileDescriptor( @@ -49,9 +49,9 @@ DESCRIPTOR = _descriptor.FileDescriptor( package='', syntax='proto3', serialized_options=b'\n\023com.geeksville.meshB\013AdminProtosH\003Z!github.com/meshtastic/gomeshproto', - serialized_pb=b'\n\x0b\x61\x64min.proto\x1a\nmesh.proto\x1a\x11radioconfig.proto\x1a\rchannel.proto\"\xfb\x02\n\x0c\x41\x64minMessage\x12!\n\tset_radio\x18\x01 \x01(\x0b\x32\x0c.RadioConfigH\x00\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\x1b\n\x11get_radio_request\x18\x04 \x01(\x08H\x00\x12*\n\x12get_radio_response\x18\x05 \x01(\x0b\x32\x0c.RadioConfigH\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\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\x42\t\n\x07variantBG\n\x13\x63om.geeksville.meshB\x0b\x41\x64minProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3' + serialized_pb=b'\n\x0b\x61\x64min.proto\x1a\rchannel.proto\x1a\nmesh.proto\x1a\x11radioconfig.proto\"\xfb\x02\n\x0c\x41\x64minMessage\x12!\n\tset_radio\x18\x01 \x01(\x0b\x32\x0c.RadioConfigH\x00\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\x1b\n\x11get_radio_request\x18\x04 \x01(\x08H\x00\x12*\n\x12get_radio_response\x18\x05 \x01(\x0b\x32\x0c.RadioConfigH\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\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\x42\t\n\x07variantBG\n\x13\x63om.geeksville.meshB\x0b\x41\x64minProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3' , - dependencies=[mesh__pb2.DESCRIPTOR,radioconfig__pb2.DESCRIPTOR,channel__pb2.DESCRIPTOR,]) + dependencies=[channel__pb2.DESCRIPTOR,mesh__pb2.DESCRIPTOR,radioconfig__pb2.DESCRIPTOR,]) diff --git a/docs/meshtastic/channel_pb2.html b/docs/meshtastic/channel_pb2.html index 7bc29a1..f717c6d 100644 --- a/docs/meshtastic/channel_pb2.html +++ b/docs/meshtastic/channel_pb2.html @@ -46,7 +46,7 @@ DESCRIPTOR = _descriptor.FileDescriptor( package='', syntax='proto3', serialized_options=b'\n\023com.geeksville.meshB\rChannelProtosH\003Z!github.com/meshtastic/gomeshproto', - serialized_pb=b'\n\rchannel.proto\"\xe6\x02\n\x0f\x43hannelSettings\x12\x10\n\x08tx_power\x18\x01 \x01(\x05\x12\x32\n\x0cmodem_config\x18\x03 \x01(\x0e\x32\x1c.ChannelSettings.ModemConfig\x12\x11\n\tbandwidth\x18\x06 \x01(\r\x12\x15\n\rspread_factor\x18\x07 \x01(\r\x12\x13\n\x0b\x63oding_rate\x18\x08 \x01(\r\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\"`\n\x0bModemConfig\x12\x12\n\x0e\x42w125Cr45Sf128\x10\x00\x12\x12\n\x0e\x42w500Cr45Sf128\x10\x01\x12\x14\n\x10\x42w31_25Cr48Sf512\x10\x02\x12\x13\n\x0f\x42w125Cr48Sf4096\x10\x03\"\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' + serialized_pb=b'\n\rchannel.proto\"\x91\x03\n\x0f\x43hannelSettings\x12\x10\n\x08tx_power\x18\x01 \x01(\x05\x12\x32\n\x0cmodem_config\x18\x03 \x01(\x0e\x32\x1c.ChannelSettings.ModemConfig\x12\x11\n\tbandwidth\x18\x06 \x01(\r\x12\x15\n\rspread_factor\x18\x07 \x01(\r\x12\x13\n\x0b\x63oding_rate\x18\x08 \x01(\r\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\"\x8a\x01\n\x0bModemConfig\x12\x12\n\x0e\x42w125Cr45Sf128\x10\x00\x12\x12\n\x0e\x42w500Cr45Sf128\x10\x01\x12\x14\n\x10\x42w31_25Cr48Sf512\x10\x02\x12\x13\n\x0f\x42w125Cr48Sf4096\x10\x03\x12\x13\n\x0f\x42w250Cr46Sf2048\x10\x04\x12\x13\n\x0f\x42w250Cr47Sf1024\x10\x05\"\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' ) @@ -73,11 +73,19 @@ _CHANNELSETTINGS_MODEMCONFIG = _descriptor.EnumDescriptor( name='Bw125Cr48Sf4096', index=3, number=3, serialized_options=None, type=None), + _descriptor.EnumValueDescriptor( + name='Bw250Cr46Sf2048', index=4, number=4, + serialized_options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Bw250Cr47Sf1024', index=5, number=5, + serialized_options=None, + type=None), ], containing_type=None, serialized_options=None, - serialized_start=280, - serialized_end=376, + serialized_start=281, + serialized_end=419, ) _sym_db.RegisterEnumDescriptor(_CHANNELSETTINGS_MODEMCONFIG) @@ -102,8 +110,8 @@ _CHANNEL_ROLE = _descriptor.EnumDescriptor( ], containing_type=None, serialized_options=None, - serialized_start=470, - serialized_end=518, + serialized_start=513, + serialized_end=561, ) _sym_db.RegisterEnumDescriptor(_CHANNEL_ROLE) @@ -206,7 +214,7 @@ _CHANNELSETTINGS = _descriptor.Descriptor( oneofs=[ ], serialized_start=18, - serialized_end=376, + serialized_end=419, ) @@ -251,8 +259,8 @@ _CHANNEL = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=379, - serialized_end=518, + serialized_start=422, + serialized_end=561, ) _CHANNELSETTINGS.fields_by_name['modem_config'].enum_type = _CHANNELSETTINGS_MODEMCONFIG @@ -915,6 +923,14 @@ shown below.

+
var Bw250Cr46Sf2048
+
+
+
+
var Bw250Cr47Sf1024
+
+
+
var Bw31_25Cr48Sf512
@@ -1667,6 +1683,8 @@ and propagates this to our listener iff this was a state change.

  • BANDWIDTH_FIELD_NUMBER
  • Bw125Cr45Sf128
  • Bw125Cr48Sf4096
  • +
  • Bw250Cr46Sf2048
  • +
  • Bw250Cr47Sf1024
  • Bw31_25Cr48Sf512
  • Bw500Cr45Sf128
  • ByteSize
  • diff --git a/docs/meshtastic/deviceonly_pb2.html b/docs/meshtastic/deviceonly_pb2.html index 09d7afc..6b4df19 100644 --- a/docs/meshtastic/deviceonly_pb2.html +++ b/docs/meshtastic/deviceonly_pb2.html @@ -39,8 +39,8 @@ from google.protobuf import symbol_database as _symbol_database _sym_db = _symbol_database.Default() -from . import mesh_pb2 as mesh__pb2 from . import channel_pb2 as channel__pb2 +from . import mesh_pb2 as mesh__pb2 from . import radioconfig_pb2 as radioconfig__pb2 @@ -49,9 +49,9 @@ DESCRIPTOR = _descriptor.FileDescriptor( package='', syntax='proto3', serialized_options=b'\n\023com.geeksville.meshB\nDeviceOnlyH\003Z!github.com/meshtastic/gomeshproto', - serialized_pb=b'\n\x10\x64\x65viceonly.proto\x1a\nmesh.proto\x1a\rchannel.proto\x1a\x11radioconfig.proto\"\x80\x01\n\x11LegacyRadioConfig\x12\x39\n\x0bpreferences\x18\x01 \x01(\x0b\x32$.LegacyRadioConfig.LegacyPreferences\x1a\x30\n\x11LegacyPreferences\x12\x1b\n\x06region\x18\x0f \x01(\x0e\x32\x0b.RegionCode\"\x8f\x02\n\x0b\x44\x65viceState\x12\'\n\x0blegacyRadio\x18\x01 \x01(\x0b\x32\x12.LegacyRadioConfig\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.ChannelBF\n\x13\x63om.geeksville.meshB\nDeviceOnlyH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3' + serialized_pb=b'\n\x10\x64\x65viceonly.proto\x1a\rchannel.proto\x1a\nmesh.proto\x1a\x11radioconfig.proto\"\x80\x01\n\x11LegacyRadioConfig\x12\x39\n\x0bpreferences\x18\x01 \x01(\x0b\x32$.LegacyRadioConfig.LegacyPreferences\x1a\x30\n\x11LegacyPreferences\x12\x1b\n\x06region\x18\x0f \x01(\x0e\x32\x0b.RegionCode\"\x8f\x02\n\x0b\x44\x65viceState\x12\'\n\x0blegacyRadio\x18\x01 \x01(\x0b\x32\x12.LegacyRadioConfig\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.ChannelBF\n\x13\x63om.geeksville.meshB\nDeviceOnlyH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3' , - dependencies=[mesh__pb2.DESCRIPTOR,channel__pb2.DESCRIPTOR,radioconfig__pb2.DESCRIPTOR,]) + dependencies=[channel__pb2.DESCRIPTOR,mesh__pb2.DESCRIPTOR,radioconfig__pb2.DESCRIPTOR,]) diff --git a/docs/meshtastic/index.html b/docs/meshtastic/index.html index 800f161..b32c90d 100644 --- a/docs/meshtastic/index.html +++ b/docs/meshtastic/index.html @@ -115,10 +115,10 @@ type of packet, you should subscribe to the full topic name. If you want to see - meshtastic.receive.data.portnum(packet) (where portnum is an integer or well known PortNum enum) - meshtastic.node.updated(node = NodeInfo) - published when a node in the DB changes (appears, location changed, username changed, etc...) -We receive position, user, or data packets from the mesh. You probably only care about meshtastic.receive.data. The first argument for -that publish will be the packet. Text or binary data packets (from sendData or sendText) will both arrive this way. If you print packet -you'll see the fields in the dictionary. decoded.data.payload will contain the raw bytes that were sent. If the packet was sent with -sendText, decoded.data.text will **also** be populated with the decoded string. For ASCII these two strings will be the same, but for +We receive position, user, or data packets from the mesh. You probably only care about meshtastic.receive.data. The first argument for +that publish will be the packet. Text or binary data packets (from sendData or sendText) will both arrive this way. If you print packet +you'll see the fields in the dictionary. decoded.data.payload will contain the raw bytes that were sent. If the packet was sent with +sendText, decoded.data.text will **also** be populated with the decoded string. For ASCII these two strings will be the same, but for unicode scripts they can be different. # Example Usage @@ -142,30 +142,30 @@ interface = meshtastic.SerialInterface() """ -import pygatt -import google.protobuf.json_format -import serial -import threading +import base64 import logging -import sys +import os +import platform import random +import socket +import sys +import stat +import threading import traceback import time -import base64 -import platform -import socket +from datetime import datetime +from typing import * +import serial import timeago -import os -import stat -from . import mesh_pb2, portnums_pb2, apponly_pb2, admin_pb2, environmental_measurement_pb2, remote_hardware_pb2, channel_pb2, radioconfig_pb2, util -from .util import fixme, catchAndIgnore, stripnl, DeferredExecution, Timeout -from .node import Node +import google.protobuf.json_format +import pygatt from pubsub import pub from dotmap import DotMap -from datetime import datetime from tabulate import tabulate -from typing import * from google.protobuf.json_format import MessageToJson +from .util import fixme, catchAndIgnore, stripnl, DeferredExecution, Timeout +from .node import Node +from . import mesh_pb2, portnums_pb2, apponly_pb2, admin_pb2, environmental_measurement_pb2, remote_hardware_pb2, channel_pb2, radioconfig_pb2, util START1 = 0x94 START2 = 0xc3 @@ -359,7 +359,7 @@ class MeshInterface: wantResponse=wantResponse, hopLimit=hopLimit, onResponse=onResponse, - channelIndex=channelIndex); + channelIndex=channelIndex) def sendData(self, data, destinationId=BROADCAST_ADDR, portNum=portnums_pb2.PortNum.PRIVATE_APP, wantAck=False, @@ -375,7 +375,8 @@ class MeshInterface: portNum -- the application portnum (similar to IP port numbers) of the destination, see portnums.proto for a list wantAck -- True if you want the message sent in a reliable manner (with retries and ack/nak provided for delivery) wantResponse -- True if you want the service on the other side to send an application layer response - onResponse -- A closure of the form funct(packet), that will be called when a response packet arrives (or the transaction is NAKed due to non receipt) + onResponse -- A closure of the form funct(packet), that will be called when a response packet arrives + (or the transaction is NAKed due to non receipt) Returns the sent packet. The id field will be populated in this packet and can be used to track future message acks/naks. """ @@ -413,13 +414,13 @@ class MeshInterface: Returns the sent packet. The id field will be populated in this packet and can be used to track future message acks/naks. """ p = mesh_pb2.Position() - if(latitude != 0.0): + if latitude != 0.0: p.latitude_i = int(latitude / 1e-7) - if(longitude != 0.0): + if longitude != 0.0: p.longitude_i = int(longitude / 1e-7) - if(altitude != 0): + if altitude != 0: p.altitude = int(altitude) if timeSec == 0: @@ -440,7 +441,7 @@ class MeshInterface: """Send a MeshPacket to the specified node (or if unspecified, broadcast). You probably don't want this - use sendData instead. - Returns the sent packet. The id field will be populated in this packet and + Returns the sent packet. The id field will be populated in this packet and can be used to track future message acks/naks. """ @@ -489,23 +490,27 @@ class MeshInterface: raise Exception("Timed out waiting for interface config") def getMyNodeInfo(self): + """Get info about my node.""" if self.myInfo is None: return None return self.nodesByNum.get(self.myInfo.my_node_num) def getMyUser(self): + """Get user""" nodeInfo = self.getMyNodeInfo() if nodeInfo is not None: return nodeInfo.get('user') return None def getLongName(self): + """Get long name""" user = self.getMyUser() if user is not None: return user.get('longName', None) return None def getShortName(self): + """Get short name""" user = self.getMyUser() if user is not None: return user.get('shortName', None) @@ -839,7 +844,7 @@ class StreamInterface(MeshInterface): """Interface class for meshtastic devices over a stream link (serial, TCP, etc)""" def __init__(self, debugOut=None, noProto=False, connectNow=True): - """Constructor, opens a connection to self.stream + """Constructor, opens a connection to self.stream Keyword Arguments: devPath {string} -- A filepath to a device, i.e. /dev/ttyUSB0 (default: {None}) @@ -1019,7 +1024,7 @@ class SerialInterface(StreamInterface): # rts=False Needed to prevent TBEAMs resetting on OSX, because rts is connected to reset self.stream.port = devPath - + # HACK: If the platform driving the serial port is unable to leave the RTS pin in high-impedance # mode, set RTS to false so that the device platform won't be reset spuriously. # Linux does this properly, so don't apply this hack on Linux (because it makes the reset button not work). @@ -1029,30 +1034,30 @@ class SerialInterface(StreamInterface): StreamInterface.__init__( self, debugOut=debugOut, noProto=noProto, connectNow=connectNow) - + """true if platform driving the serial port is Windows Subsystem for Linux 1.""" def _isWsl1(self): - # WSL1 identifies itself as Linux, but has a special char device at /dev/lxss for use with session control, - # e.g. /init. We should treat WSL1 as Windows for the RTS-driving hack because the underlying platfrom + # WSL1 identifies itself as Linux, but has a special char device at /dev/lxss for use with session control, + # e.g. /init. We should treat WSL1 as Windows for the RTS-driving hack because the underlying platfrom # serial driver for the CP21xx still exhibits the buggy behavior. - # WSL2 is not covered here, as it does not (as of 2021-May-25) support the appropriate functionality to + # WSL2 is not covered here, as it does not (as of 2021-May-25) support the appropriate functionality to # share or pass-through serial ports. try: # Claims to be Linux, but has /dev/lxss; must be WSL 1 - return platform.system() == 'Linux' and stat.S_ISCHR(os.stat('/dev/lxss').st_mode); + return platform.system() == 'Linux' and stat.S_ISCHR(os.stat('/dev/lxss').st_mode) except: # Couldn't stat /dev/lxss special device; not WSL1 - return False; - + return False + def _hostPlatformAlwaysDrivesUartRts(self): # OS-X/Windows seems to have a bug in its CP21xx serial drivers. It ignores that we asked for no RTSCTS # control and will always drive RTS either high or low (rather than letting the CP102 leave # it as an open-collector floating pin). - # TODO: When WSL2 supports USB passthrough, this will get messier. If/when WSL2 gets virtual serial - # ports that "share" the Windows serial port (and thus the Windows drivers), this code will need to be + # TODO: When WSL2 supports USB passthrough, this will get messier. If/when WSL2 gets virtual serial + # ports that "share" the Windows serial port (and thus the Windows drivers), this code will need to be # updated to reflect that as well -- or if T-Beams get made with an alternate USB to UART bridge that has # a less buggy driver. - return platform.system() != 'Linux' or self._isWsl1(); + return platform.system() != 'Linux' or self._isWsl1() class TCPInterface(StreamInterface): """Interface class for meshtastic devices over a TCP link""" @@ -1217,15 +1222,15 @@ protocols = {
    meshtastic.test
    -
    +

    Testing

    meshtastic.tunnel
    -
    +

    Code for IP tunnel over a mesh …

    meshtastic.util
    -
    +

    Utility functions.

    @@ -1312,7 +1317,11 @@ noProto – If True, don't try to run our protocol on the link - just be a d
  • MeshInterface: