self._printer in plugins now allows direct access to the transport object (serial instance in most cases)
This commit is contained in:
parent
7438ba1eea
commit
258b824ff8
2 changed files with 18 additions and 0 deletions
|
|
@ -213,6 +213,21 @@ class Printer():
|
|||
self._printerProfileManager.deselect()
|
||||
eventManager().fire(Events.DISCONNECTED)
|
||||
|
||||
def getTransport(self):
|
||||
"""
|
||||
Returns the communication layer's transport object, if a connection is currently established.
|
||||
|
||||
Note that this doesn't have to necessarily be a :class:`serial.Serial` instance, it might also be something
|
||||
different, so take care to do instance checks before attempting to access any properties or methods.
|
||||
|
||||
:return: the communication layer's transport object
|
||||
"""
|
||||
|
||||
if self._comm is None:
|
||||
return None
|
||||
|
||||
return self._comm.getTransport()
|
||||
|
||||
def command(self, command):
|
||||
"""
|
||||
Sends a single gcode command to the printer.
|
||||
|
|
|
|||
|
|
@ -340,6 +340,9 @@ class MachineCom(object):
|
|||
def getConnection(self):
|
||||
return self._port, self._baudrate
|
||||
|
||||
def getTransport(self):
|
||||
return self._serial
|
||||
|
||||
##~~ external interface
|
||||
|
||||
def close(self, isError = False):
|
||||
|
|
|
|||
Loading…
Reference in a new issue