def __init__(self,clientSock,stelCom): self.clientSock = clientSock self.stelCom = stelCom self.theQuitCall = quitter.quitter("The Stellarium server") self.theQuitCall.start() try: self.stelReceiver = stellariumReceive(stelCom) self.stelReceiver.start() while self.theQuitCall.alive: self.reportingLoop() self.clientSock.send("0") completion = self.clientSock.recv(1024) if completion != "reportingComplete": print "Error: the iTelRaspberry server did not confirm completion of reporting mode" if self.stelReceiver.hasTarget: self.sendTarget() else: break self.stelReceiver.endThread() self.stelCom.closeConnection() except IOError as e: self.clientSock.send("0") self.stelReceiver.endThread() self.stelCom.closeConnection() print "Sending time failed, check connection %s" % e.message
def evaluationMode(self): theQuitCall = quitter.quitter("The position evaluator") theQuitCall.start() try: self.clientSock.send("report") while theQuitCall.alive: reading = self.clientSock.recv(1024) radecS = reading.split(":") Ra = angles.Angle(r=float(radecS[0])) Dec = angles.Angle(r=float(radecS[1])) Ra.ounit = "degrees" Dec.ounit = "degrees" print "Ra :%s" % Ra print "Dec:%s" % Dec self.clientSock.send("1") self.clientSock.send("0") completion = self.clientSock.recv(1024) if completion != "reportingComplete": print "Error: the iTelRaspberry server did not confirm completion of reporting mode" except IOError as e: print "evaluation mode failed, check connection %s" % e.message