Commit 5a8ea715 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix handling of TM coming from msgQ

parent a1abb80e
......@@ -233,7 +233,7 @@ class asn1Editor(QTreeView):
self.backend = None
self.plottedIdxs = []
self.log = logging
self.pendingTM = None
self.pendingTM = False
# item is the ASN.1 node in Pyside format from datamodel.py
self.item = None
# List of classes that have an "update" method (user custom widgets)
......@@ -595,7 +595,6 @@ class asn1Editor(QTreeView):
def tmToEditor(self, emit_msc=True):
''' Check validity of a TM and update the viewer with the value '''
self.log.debug("Entering tmToEditor")
self.updateVariable()
# Send value to the MSC recorder
name = self.item['id']
......@@ -604,33 +603,26 @@ class asn1Editor(QTreeView):
if emit_msc:
self.msc.emit('in', msg)
self.new_tm.emit()
self.log.debug("Leaving tmToEditor")
def ProcessTM(self, rawMsg):
''' Decode a TM received from the msgQ (not UDP)
and update the model '''
self.log.debug("Entering ProcessTM")
#native_tm = self.backend.decode_TM(rawMsg)
self.asn1Instance.SetData(rawMsg)
#pythonVar = self.backend.fromASN1ToPyside(self.asn1Instance)
self.tmToEditor()
for each in self.tm_clients:
each.update(self.asn1Instance)
self.log.debug("Leaving ProcessTM")
@Slot()
def receivedTM(self):
''' TM received from another thread (polling queue) '''
if self.pendingTM:
self.ProcessTM(self.pendingTM)
self.pendingTM = None
self.log.debug("Got TM from MsgQ")
self.tmToEditor()
# Send TM to user custom widgets
for each in self.tm_clients:
each.update(self.asn1Instance)
self.pendingTM = False
def ProcessUDPTM(self, uperMsg):
''' Decode an uPER-encoded TM (e.g. received from UDP sockets)
and update the model '''
native_tm = self.backend.decode_uPER(uperMsg)
pythonVar = self.backend.fromASN1ToPyside(native_tm)
self.tmToEditor(pythonVar)
self.log.error('DEPRECATED - UDP channel not supported anymore')
return
#native_tm = self.backend.decode_uPER(uperMsg)
#pythonVar = self.backend.fromASN1ToPyside(native_tm)
#self.tmToEditor(pythonVar)
def saveTC(self):
''' Encode the data using GSER (ASN.1 Value Notation) and save it
......
......@@ -108,7 +108,6 @@ class MsgQ_Poller(QThread):
"Retrying...".format(Qname=self.Qname))
time.sleep(1)
bufferSize = GetMsgQueueBufferSize(self._msgQueue)
#pDataFromMQ = new_byte_SWIG_PTR(bufferSize)
pDataFromMQ = create_string_buffer(bufferSize).raw
while not self._bDie:
messageReceivedType = RetrieveMessageFromQueue(
......@@ -117,8 +116,10 @@ class MsgQ_Poller(QThread):
time.sleep(0.005)
continue
self.log.debug('MsgQ poller: received message')
# Copy the message into the ASN.1 type instance of the editor
g_tmPool[messageReceivedType].asn1Instance.SetData(pDataFromMQ)
g_tmPool[messageReceivedType].pendingTM = True
# use a signal to inform the TM editor of the received TM
g_tmPool[messageReceivedType].pendingTM = pDataFromMQ
self.tm.emit()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment