예제 #1
0
    def updateThread(self):
        """ Seperate update thread """

        while True:
            if self._cmd_queue:
                cmd = self._cmd_queue.pop()
                if cmd == "settime":
                    # TODO: Send time change over network
                    local_time = self._current_time
                    UDPListenerService.do_ping(UDPListenerService.DAYTIME_PORT, "settime " + str(local_time))

                elif cmd == "write_settings":

                    # Write settings
                    self._daytime.write_configuration()
                    UDPListenerService.do_ping(UDPListenerService.DAYTIME_PORT, "loadconf")

                else:
                    print("Unkown cmd:", cmd)

            time.sleep(0.2)
예제 #2
0
 def update_thread(self):
     while True:
         if len(self._update_queue) > 0:
             item = self._update_queue.pop()
             UDPListenerService.ping_thread(UDPListenerService.CONFIG_PORT, item)
         time.sleep(0.3)