# Python: module reprap.snap

reprap.snap | index /usr/lib/python2.5/site-packages/reprap/snap.py

`This module is an implementation of the SNAP communications protocol and is used for
communications between the PC host and the RepRap machine.`

Modules

``

exceptions | serial | threading | time

Classes

``

Packet
threading.Thread(threading._Verbose)
  PacketReceiver

class Packet
`` | `SNAP packet class`

Methods defined here:

__init__(self, DAB=None, SAB=None, ACK=None, NAK=None, dataBytes=None)
  `Create SNAP packet`

checkReply(self, expectedBytes, expectedCommand)

getReply(self)

printPacket(self, status)
  `Print contents of packet to screen`

send(self)
  `Send SNAP packet over serial conneciton (automatically encodes)`

class PacketReceiver(threading.Thread)
`` | `Thread for recieving packets. Passes on irrelivent packets and buffers those intended for host`

Method resolution order:
  PacketReceiver
  threading.Thread
  threading._Verbose
  __builtin__.object

Methods defined here:

__init__(self)

clearPackets(self)

getPacket(self)

run(self)
  `Main receiver loop. Do not call this function, call PacketReceiver.start() to start the function in a new thread`

terminate(self)
  `Terminate reciver thread`

Methods inherited from threading.Thread:

__repr__(self)

getName(self)

isAlive(self)

isDaemon(self)

join(self, timeout=None)

setDaemon(self, daemonic)

setName(self, name)

start(self)

Data descriptors inherited from threading._Verbose:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Functions

``

closeSerial()
  `Close serial port for SNAP RepRap communications`

openSerial(port=0, rate=19200, tout=60)
  `Open serial port for SNAP RepRap communications`

Data
`` |  | HDB1_OFFSET = 2 PAYLOAD_OFFSET = 5 Receiver = None SYNC_BYTE = 84 __author__ = 'Stefan Blanke (greenarrow) (greenarrow@users.sourceforge.net)' __licence__ = '\npyRepRap is free software: you can redistribute...ap. If not, see <http://www.gnu.org/licenses/>.\n' __license__ = 'GPL 3.0' localAddress = 0 printIncoming = False printOutgoing = False serialPort = None

Author
`` |  | Stefan Blanke (greenarrow) (greenarrow@users.sourceforge.net)