mirror of
https://github.com/meshtastic/python.git
synced 2026-05-19 14:01:09 -04:00
Updated docs for mt py
This commit is contained in:
@@ -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 = {
|
||||
</dd>
|
||||
<dt><code class="name"><a title="meshtastic.test" href="test.html">meshtastic.test</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
<div class="desc"><p>Testing</p></div>
|
||||
</dd>
|
||||
<dt><code class="name"><a title="meshtastic.tunnel" href="tunnel.html">meshtastic.tunnel</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
<div class="desc"><p>Code for IP tunnel over a mesh …</p></div>
|
||||
</dd>
|
||||
<dt><code class="name"><a title="meshtastic.util" href="util.html">meshtastic.util</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
<div class="desc"><p>Utility functions.</p></div>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
@@ -1312,7 +1317,11 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
<li><code><b><a title="meshtastic.MeshInterface" href="#meshtastic.MeshInterface">MeshInterface</a></b></code>:
|
||||
<ul class="hlist">
|
||||
<li><code><a title="meshtastic.MeshInterface.close" href="#meshtastic.MeshInterface.close">close</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.getLongName" href="#meshtastic.MeshInterface.getLongName">getLongName</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.getMyNodeInfo" href="#meshtastic.MeshInterface.getMyNodeInfo">getMyNodeInfo</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.getMyUser" href="#meshtastic.MeshInterface.getMyUser">getMyUser</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.getNode" href="#meshtastic.MeshInterface.getNode">getNode</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.getShortName" href="#meshtastic.MeshInterface.getShortName">getShortName</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.sendData" href="#meshtastic.MeshInterface.sendData">sendData</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.sendPosition" href="#meshtastic.MeshInterface.sendPosition">sendPosition</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.sendText" href="#meshtastic.MeshInterface.sendText">sendText</a></code></li>
|
||||
@@ -1530,7 +1539,7 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
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,
|
||||
@@ -1546,7 +1555,8 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
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.
|
||||
"""
|
||||
@@ -1584,13 +1594,13 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
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:
|
||||
@@ -1611,7 +1621,7 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
"""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.
|
||||
"""
|
||||
|
||||
@@ -1660,23 +1670,27 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
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)
|
||||
@@ -1988,12 +2002,13 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
<span>def <span class="ident">getLongName</span></span>(<span>self)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
<div class="desc"><p>Get long name</p></div>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def getLongName(self):
|
||||
"""Get long name"""
|
||||
user = self.getMyUser()
|
||||
if user is not None:
|
||||
return user.get('longName', None)
|
||||
@@ -2004,12 +2019,13 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
<span>def <span class="ident">getMyNodeInfo</span></span>(<span>self)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
<div class="desc"><p>Get info about my node.</p></div>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def getMyNodeInfo(self):
|
||||
"""Get info about my node."""
|
||||
if self.myInfo is None:
|
||||
return None
|
||||
return self.nodesByNum.get(self.myInfo.my_node_num)</code></pre>
|
||||
@@ -2019,12 +2035,13 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
<span>def <span class="ident">getMyUser</span></span>(<span>self)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
<div class="desc"><p>Get user</p></div>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def getMyUser(self):
|
||||
"""Get user"""
|
||||
nodeInfo = self.getMyNodeInfo()
|
||||
if nodeInfo is not None:
|
||||
return nodeInfo.get('user')
|
||||
@@ -2056,12 +2073,13 @@ noProto – If True, don't try to run our protocol on the link - just be a d
|
||||
<span>def <span class="ident">getShortName</span></span>(<span>self)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
<div class="desc"><p>Get short name</p></div>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">def getShortName(self):
|
||||
"""Get short name"""
|
||||
user = self.getMyUser()
|
||||
if user is not None:
|
||||
return user.get('shortName', None)
|
||||
@@ -2079,7 +2097,8 @@ destinationId {nodeId or nodeNum} – where to send this message (default: {
|
||||
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)</p>
|
||||
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)</p>
|
||||
<p>Returns the sent packet. The id field will be populated in this packet and can be used to track future message acks/naks.</p></div>
|
||||
<details class="source">
|
||||
<summary>
|
||||
@@ -2099,7 +2118,8 @@ onResponse – A closure of the form funct(packet), that will be called when
|
||||
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.
|
||||
"""
|
||||
@@ -2151,13 +2171,13 @@ the local position.</p>
|
||||
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:
|
||||
@@ -2213,7 +2233,7 @@ wantResponse – True if you want the service on the other side to send an a
|
||||
wantResponse=wantResponse,
|
||||
hopLimit=hopLimit,
|
||||
onResponse=onResponse,
|
||||
channelIndex=channelIndex);</code></pre>
|
||||
channelIndex=channelIndex)</code></pre>
|
||||
</details>
|
||||
</dd>
|
||||
<dt id="meshtastic.MeshInterface.showInfo"><code class="name flex">
|
||||
@@ -2394,7 +2414,7 @@ debugOut {stream} – If a stream is provided, any debug serial output from
|
||||
|
||||
# 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).
|
||||
@@ -2404,30 +2424,30 @@ debugOut {stream} – If a stream is provided, any debug serial output from
|
||||
|
||||
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();</code></pre>
|
||||
return platform.system() != 'Linux' or self._isWsl1()</code></pre>
|
||||
</details>
|
||||
<h3>Ancestors</h3>
|
||||
<ul class="hlist">
|
||||
@@ -2440,7 +2460,11 @@ debugOut {stream} – If a stream is provided, any debug serial output from
|
||||
<ul class="hlist">
|
||||
<li><code><a title="meshtastic.StreamInterface.close" href="#meshtastic.StreamInterface.close">close</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.connect" href="#meshtastic.StreamInterface.connect">connect</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getLongName" href="#meshtastic.MeshInterface.getLongName">getLongName</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getMyNodeInfo" href="#meshtastic.MeshInterface.getMyNodeInfo">getMyNodeInfo</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getMyUser" href="#meshtastic.MeshInterface.getMyUser">getMyUser</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getNode" href="#meshtastic.MeshInterface.getNode">getNode</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getShortName" href="#meshtastic.MeshInterface.getShortName">getShortName</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.sendData" href="#meshtastic.MeshInterface.sendData">sendData</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.sendPosition" href="#meshtastic.MeshInterface.sendPosition">sendPosition</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.sendText" href="#meshtastic.MeshInterface.sendText">sendText</a></code></li>
|
||||
@@ -2457,7 +2481,7 @@ debugOut {stream} – If a stream is provided, any debug serial output from
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"><p>Interface class for meshtastic devices over a stream link (serial, TCP, etc)</p>
|
||||
<p>Constructor, opens a connection to self.stream </p>
|
||||
<p>Constructor, opens a connection to self.stream</p>
|
||||
<p>Keyword Arguments:
|
||||
devPath {string} – A filepath to a device, i.e. /dev/ttyUSB0 (default: {None})
|
||||
debugOut {stream} – If a stream is provided, any debug serial output from the device will be emitted to that stream. (default: {None})</p>
|
||||
@@ -2476,7 +2500,7 @@ debugOut {stream} – If a stream is provided, any debug serial output from
|
||||
"""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})
|
||||
@@ -2692,7 +2716,11 @@ start the reading thread later.</p></div>
|
||||
<ul class="hlist">
|
||||
<li><code><b><a title="meshtastic.MeshInterface" href="#meshtastic.MeshInterface">MeshInterface</a></b></code>:
|
||||
<ul class="hlist">
|
||||
<li><code><a title="meshtastic.MeshInterface.getLongName" href="#meshtastic.MeshInterface.getLongName">getLongName</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.getMyNodeInfo" href="#meshtastic.MeshInterface.getMyNodeInfo">getMyNodeInfo</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.getMyUser" href="#meshtastic.MeshInterface.getMyUser">getMyUser</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.getNode" href="#meshtastic.MeshInterface.getNode">getNode</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.getShortName" href="#meshtastic.MeshInterface.getShortName">getShortName</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.sendData" href="#meshtastic.MeshInterface.sendData">sendData</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.sendPosition" href="#meshtastic.MeshInterface.sendPosition">sendPosition</a></code></li>
|
||||
<li><code><a title="meshtastic.MeshInterface.sendText" href="#meshtastic.MeshInterface.sendText">sendText</a></code></li>
|
||||
@@ -2772,7 +2800,11 @@ hostname {string} – Hostname/IP address of the device to connect to</p></d
|
||||
<ul class="hlist">
|
||||
<li><code><a title="meshtastic.StreamInterface.close" href="#meshtastic.StreamInterface.close">close</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.connect" href="#meshtastic.StreamInterface.connect">connect</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getLongName" href="#meshtastic.MeshInterface.getLongName">getLongName</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getMyNodeInfo" href="#meshtastic.MeshInterface.getMyNodeInfo">getMyNodeInfo</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getMyUser" href="#meshtastic.MeshInterface.getMyUser">getMyUser</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getNode" href="#meshtastic.MeshInterface.getNode">getNode</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.getShortName" href="#meshtastic.MeshInterface.getShortName">getShortName</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.sendData" href="#meshtastic.MeshInterface.sendData">sendData</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.sendPosition" href="#meshtastic.MeshInterface.sendPosition">sendPosition</a></code></li>
|
||||
<li><code><a title="meshtastic.StreamInterface.sendText" href="#meshtastic.MeshInterface.sendText">sendText</a></code></li>
|
||||
|
||||
Reference in New Issue
Block a user