prepared meterbus decoding
This commit is contained in:
33
MeterBusDecoder.py
Normal file
33
MeterBusDecoder.py
Normal file
@ -0,0 +1,33 @@
|
||||
'''
|
||||
Created on 09.06.2015
|
||||
|
||||
@author: wn
|
||||
'''
|
||||
|
||||
|
||||
import threading
|
||||
from logger import Logger
|
||||
import Queue
|
||||
|
||||
|
||||
|
||||
|
||||
class MeterBusDecoder(threading.Thread):
|
||||
def __init__(self, inQueue, outQueue):
|
||||
threading.Thread.__init__(self)
|
||||
self.inQueue = inQueue
|
||||
self.outQueue = outQueue
|
||||
self.setDaemon(True)
|
||||
|
||||
def run(self):
|
||||
while True:
|
||||
msg = None
|
||||
try:
|
||||
msg = self.inQueue.get()
|
||||
|
||||
Logger.log("MeterBusDecoder is doing something with %s" % msg)
|
||||
|
||||
self.outQueue.put_nowait(msg)
|
||||
except Queue.Full:
|
||||
Logger.log("MeterBusDecoder queue overrun, drop result of %s" % str(msg))
|
||||
|
Reference in New Issue
Block a user