コード例 #1
0
ファイル: thermeq3.py プロジェクト: Dubdubz/thermeq3
 def process_msg(self):
     """
     Process message queue
     :return: nothing
     """
     cw_msg = bridge.rcw("msg")
     while len(self.var.msgQ) > 0:
         logmsg.update("Message queue=" + str(self.var.msgQ), 'D')
         while not str(bridge.get(cw_msg)) == "":
             time.sleep(self.setup.timeout)
             tosend = self.var.msgQ.pop()
             logmsg.update("Sending message [" + str(tosend) + "]", 'D')
             if tosend == "E":
                 self.var.error = True
                 self.var.err2Clear = True
             elif tosend == "C":
                 self.var.err2Clear = False
                 self.var.err2LastStatus = True
                 logmsg.update("Clearing error LED", 'D')
             elif tosend == "R":
                 bridge.save(self.setup.bridgefile)
             if self.setup.target == "yun":
                 bridge.put(cw_msg, tosend)
             elif self.setup.target == "rpi":
                 if tosend == "H":
                     # action.do(True)
                     pass
                 elif tosend == "S":
                     # action.do(False)
                     pass
コード例 #2
0
ファイル: thermeq3.py プロジェクト: Dubdubz/thermeq3
 def _getcmd(self):
     cmd_cw = bridge.rcw("cmd")
     localcmd = bridge.get(cmd_cw)
     if localcmd is None:
         return ""
     elif len(localcmd) > 0:
         bridge.put(cmd_cw, "")
     return localcmd
コード例 #3
0
ファイル: thermeq3.py プロジェクト: Dubdubz/thermeq3
 def _literal_process(self):
     for k, v in bridge.cw.iteritems():
         if v[2]:
             tmp = bridge.get(k)
             codeword = v[0]
             setvalue = v[1]
             try:
                 lit_result = literal_eval(tmp)
             except Exception:
                 logmsg.update("Bridge error codeword [" + str(codeword) + "] value [" + str(setvalue) + "]", 'D')
             else:
                 if codeword == bridge.rcw("ht"):
                     self.var.ht = lit_result
                 elif codeword == bridge.rcw("ign"):
                     self.eq3.ignored_valves = lit_result
コード例 #4
0
 def process_msg(self):
     """
     Process message queue
     :return: nothing
     """
     while len(self.var.msgQ) > 0:
         logmsg.update("Message queue: " + str(self.var.msgQ), 'D')
         wait_cycle = False
         if support.is_yun():
             # this is waiting routine to ensure that msg queue is processed by 32u4 part
             tmp_br = bridge.get("msg")
             if not support.is_empty(tmp_br):
                 time.sleep(self.setup.timeout)
                 wait_cycle = True
         if not wait_cycle:
             to_send = self.var.msgQ.pop()
             logmsg.update("Sending message [" + str(to_send) + "]", 'D')
             # if we are going to reset, save bridge file
             if to_send == "R":
                 bridge.save(self.setup.bridge_file)
             if support.is_yun():
                 # signal to 32u4 that we have something to process
                 bridge.put("msg", to_send)
             elif support.is_rpi():
                 if to_send == "H":
                     # TBI RPI
                     # uncomment line below for RPi
                     # action.do(True)
                     pass
                 elif to_send == "S":
                     # TBI RPI
                     # uncomment line below for RPi
                     # action.do(False)
                     pass
             elif support.is_win():
                 # insert windows code here
                 # print "nt"
                 logmsg.update("Processing message on Windows: " +
                               str(to_send))
コード例 #5
0
ファイル: thermeq3.py プロジェクト: autopower/thermeq3
 def process_msg(self):
     """
     Process message queue
     :return: nothing
     """
     while len(self.var.msgQ) > 0:
         logmsg.update("Message queue: " + str(self.var.msgQ), 'D')
         wait_cycle = False
         if support.is_yun():
             # this is waiting routine to ensure that msg queue is processed by 32u4 part
             tmp_br = bridge.get("msg")
             if not support.is_empty(tmp_br):
                 time.sleep(self.setup.timeout)
                 wait_cycle = True
         if not wait_cycle:
             to_send = self.var.msgQ.pop()
             logmsg.update("Sending message [" + str(to_send) + "]", 'D')
             # if we are going to reset, save bridge file
             if to_send == "R":
                 bridge.save(self.setup.bridge_file)
             if support.is_yun():
                 # signal to 32u4 that we have something to process
                 bridge.put("msg", to_send)
             elif support.is_rpi():
                 if to_send == "H":
                     # TBI RPI
                     # uncomment line below for RPi
                     # action.do(True)
                     pass
                 elif to_send == "S":
                     # TBI RPI
                     # uncomment line below for RPi
                     # action.do(False)
                     pass
             elif support.is_win():
                 # insert windows code here
                 # print "nt"
                 logmsg.update("Processing message on Windows: " + str(to_send))