diff --git a/docs/meshtastic/index.html b/docs/meshtastic/index.html index 198c333..293bb0f 100644 --- a/docs/meshtastic/index.html +++ b/docs/meshtastic/index.html @@ -135,13 +135,15 @@ START2 = 0xc3 HEADER_LEN = 4 MAX_TO_FROM_RADIO_SIZE = 512 -BROADCAST_ADDR = "all" # A special ID that means broadcast -BROADCAST_NUM = 255 +BROADCAST_ADDR = "^all" # A special ID that means broadcast + +# if using 8 bit nodenums this will be shortend on the target +BROADCAST_NUM = 0xffffffff MY_CONFIG_ID = 42 """The numeric buildnumber (shared with android apps) specifying the level of device code we are guaranteed to understand""" -OUR_APP_VERSION = 167 +OUR_APP_VERSION = 172 class MeshInterface: @@ -154,12 +156,13 @@ class MeshInterface: debugOut """ - def __init__(self, debugOut=None): + def __init__(self, debugOut=None, noProto=False): """Constructor""" self.debugOut = debugOut self.nodes = None # FIXME self.isConnected = False - self._startConfig() + if not noProto: + self._startConfig() def sendText(self, text, destinationId=BROADCAST_ADDR, wantAck=False, wantResponse=False): """Send a utf8 string to some other node, if the node has a display it will also be shown on the device. @@ -190,7 +193,7 @@ class MeshInterface: if isinstance(destinationId, int): nodeNum = destinationId elif destinationId == BROADCAST_ADDR: - nodeNum = 255 + nodeNum = BROADCAST_NUM else: nodeNum = self.nodes[destinationId].num @@ -385,7 +388,7 @@ class BLEInterface(MeshInterface): class StreamInterface(MeshInterface): """Interface class for meshtastic devices over a stream link (serial, TCP, etc)""" - def __init__(self, devPath=None, debugOut=None): + def __init__(self, devPath=None, debugOut=None, noProto=False): """Constructor, opens a connection to a specified serial port, or if unspecified try to find one Meshtastic device by probing @@ -416,7 +419,7 @@ class StreamInterface(MeshInterface): devPath, 921600, exclusive=True, timeout=0.5) self._rxThread = threading.Thread(target=self.__reader, args=()) self._rxThread.start() - MeshInterface.__init__(self, debugOut=debugOut) + MeshInterface.__init__(self, debugOut=debugOut, noProto=noProto) def _sendToRadio(self, toRadio): """Send a ToRadio protobuf to the device""" @@ -603,7 +606,7 @@ class StreamInterface(MeshInterface):
class MeshInterface -(debugOut=None) +(debugOut=None, noProto=False)

Interface class for meshtastic devices

@@ -626,12 +629,13 @@ debugOut

debugOut """ - def __init__(self, debugOut=None): + def __init__(self, debugOut=None, noProto=False): """Constructor""" self.debugOut = debugOut self.nodes = None # FIXME self.isConnected = False - self._startConfig() + if not noProto: + self._startConfig() def sendText(self, text, destinationId=BROADCAST_ADDR, wantAck=False, wantResponse=False): """Send a utf8 string to some other node, if the node has a display it will also be shown on the device. @@ -662,7 +666,7 @@ debugOut

if isinstance(destinationId, int): nodeNum = destinationId elif destinationId == BROADCAST_ADDR: - nodeNum = 255 + nodeNum = BROADCAST_NUM else: nodeNum = self.nodes[destinationId].num @@ -817,7 +821,7 @@ debugOut

Methods

-def sendData(self, byteData, destinationId='all', dataType=0, wantAck=False, wantResponse=False) +def sendData(self, byteData, destinationId='^all', dataType=0, wantAck=False, wantResponse=False)

Send a data packet to some other node

@@ -835,7 +839,7 @@ debugOut

-def sendPacket(self, meshPacket, destinationId='all', wantAck=False) +def sendPacket(self, meshPacket, destinationId='^all', wantAck=False)

Send a MeshPacket to the specified node (or if unspecified, broadcast). @@ -853,7 +857,7 @@ You probably don't want this - use sendData instead.

if isinstance(destinationId, int): nodeNum = destinationId elif destinationId == BROADCAST_ADDR: - nodeNum = 255 + nodeNum = BROADCAST_NUM else: nodeNum = self.nodes[destinationId].num @@ -864,7 +868,7 @@ You probably don't want this - use sendData instead.

-def sendText(self, text, destinationId='all', wantAck=False, wantResponse=False) +def sendText(self, text, destinationId='^all', wantAck=False, wantResponse=False)

Send a utf8 string to some other node, if the node has a display it will also be shown on the device.

@@ -912,7 +916,7 @@ destinationId {nodeId or nodeNum} – where to send this message (default: {
class StreamInterface -(devPath=None, debugOut=None) +(devPath=None, debugOut=None, noProto=False)

Interface class for meshtastic devices over a stream link (serial, TCP, etc)

@@ -935,7 +939,7 @@ debugOut {stream} – If a stream is provided, any debug serial output from
class StreamInterface(MeshInterface):
     """Interface class for meshtastic devices over a stream link (serial, TCP, etc)"""
 
-    def __init__(self, devPath=None, debugOut=None):
+    def __init__(self, devPath=None, debugOut=None, noProto=False):
         """Constructor, opens a connection to a specified serial port, or if unspecified try to
         find one Meshtastic device by probing
 
@@ -966,7 +970,7 @@ debugOut {stream} – If a stream is provided, any debug serial output from
             devPath, 921600, exclusive=True, timeout=0.5)
         self._rxThread = threading.Thread(target=self.__reader, args=())
         self._rxThread.start()
-        MeshInterface.__init__(self, debugOut=debugOut)
+        MeshInterface.__init__(self, debugOut=debugOut, noProto=noProto)
 
     def _sendToRadio(self, toRadio):
         """Send a ToRadio protobuf to the device"""
diff --git a/docs/meshtastic/test.html b/docs/meshtastic/test.html
index 27a1b8f..e146550 100644
--- a/docs/meshtastic/test.html
+++ b/docs/meshtastic/test.html
@@ -26,7 +26,7 @@
 
 
import logging
 from . import util
-from . import StreamInterface
+from . import StreamInterface, BROADCAST_NUM
 from pubsub import pub
 import time
 import sys
@@ -81,7 +81,7 @@ def testSend(fromInterface, toInterface, isBroadcast=False):
     fromNode = fromInterface.myInfo.my_node_num
 
     if isBroadcast:
-        toNode = 255
+        toNode = BROADCAST_NUM
     else:
         toNode = toInterface.myInfo.my_node_num
 
@@ -315,7 +315,7 @@ toInterface {[type]} – [description]

fromNode = fromInterface.myInfo.my_node_num if isBroadcast: - toNode = 255 + toNode = BROADCAST_NUM else: toNode = toInterface.myInfo.my_node_num diff --git a/setup.py b/setup.py index 32ac4be..de2b151 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ with open("README.md", "r") as fh: # This call to setup() does all the work setup( name="meshtastic", - version="0.6.7", + version="0.7.2", description="Python API & client shell for talking to Meshtastic devices", long_description=long_description, long_description_content_type="text/markdown",