def __init__(self, filedir="./rdfiles/"):
     RDLaser.getServer()
     self.filedir = filedir
     self.responses = {
         "da00057e": u"\xda\x01\x05\x7e\x06\x28\x41\x4a\x10",
         "da000b12": u"\xda\x01\x0b\x12\x0f\x11\x64\x00\x00",
     }
     pass
 def send(self, addr, data):
     scr = RDLaser.scramblestr(data)
     if self.debug:
         if data[:3] == u"\xe8\x01\x00":
             uns = str(ord(data[3])) + " - " + data[4:-1]
         else:
             uns = data.encode("HEX")
         print u"\x1B[32m> " + addr + ": " + (
             scr.encode("hex")) + u"\x1B[0m  -  " + uns
     RDLaser.getServer().sendto(scr, (addr, RDLaser.CLIENT_PORT))
 def recv(self):
     data, addr = RDLaser.getServer().recvfrom(RDLaser.BUF_SIZE)
     if data[:2] != RDLaser.checksum(data[2:])[:2]:
         print data[0:2].encode("HEX")
         if self.debug:
             print(u"\x1B[31mCHECKSUM MISMATCH\x1B[0m")
         return ("", addr)
     data = RDLaser.descramblestr(data[2:])
     if self.debug:
         print(u"\x1B[34m< " + addr[0] + ": " +
               RDLaser.scramblestr(data).encode("HEX") + u"\x1B[0m  -  " +
               data.encode("HEX"))
     self.send(addr[0], '\xcc')  #send ACK
     return (data, addr)