snap
index
/home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap_v0.1/snap.py

pyRepRap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
 
pyRepRap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with pyRepRap.  If not, see <http://www.gnu.org/licenses/>.

 
Modules
       
serial

 
Classes
       
SNAPChecksum
SNAPPacket

 
class SNAPChecksum
    #class for checksum calculator
 
  Methods defined here:
__init__(self)
addData(self, data)
getResult(self)

 
class SNAPPacket
    #class for snap packet
 
  Methods defined here:
__init__(self, serial, DAB, SAB, ACK, NAK, dataBytes)
addByte(self, byte)
#manually add a byte to packet (unused)
check(self)
#calculate checksum, compare to value in recieved packet
decode(self)
#convert table self.bytes (raw data packet) into individual packet properties
encode(self)
#convert individual packet properties into table self.bytes (raw data packet)
getReply(self)
# get a modules reply packet (not ack)
printPacket(self)
#print packet info to console
send(self)
#user send function, sends packet and awaits and checks acknoledgement.
sendBytes(self)
#actual sending of data packet (self.bytes)

 
Functions
       
breakHDB1(HDB1)
breakHDB2(HDB2)
getPacket(ser)
#wait for a packet on serial - note : packets addressed to something other than 0 get recieved if you try sending to a non existant pcb (looped round). should we delete or pass on? (they cause errors right now in getpacket)
getPacketLen(buffer)
#this is done again in full decode, but needed here so num bytes to expect is known.
makeHDB1(NDB)
#create HDB1
makeHDB2(ACK, NAK)
#create HDB2

 
Data
        localAddress = 0
messageTimeout = 0.29999999999999999
offset_hdb1 = 2
offset_payload = 5
printFailedPackets = False
printIncomingPackets = False
printOutgoingPackets = False
retries = 3