Commit 9f65de3b authored by TASTE User's avatar TASTE User
Browse files

Update peekpoke code

parent 5608bd76
#!/usr/bin/env python #!/usr/bin/env python2
import sys, os, re, threading, time, signal import sys, os, re, threading, time, signal, ctypes
sys.path.append(".") sys.path.append(".")
#from PythonAccess import *
import DV import DV
import dataview_uniq_asn import dataview_uniq_asn
import PythonAccess as PA import PythonController
PA = PythonController.PythonAccess
sizePerType = { sizePerType = {
DV.int_32:4, DV.int_32:4,
...@@ -80,14 +80,15 @@ class Poll_taste_probe_console(threading.Thread): ...@@ -80,14 +80,15 @@ class Poll_taste_probe_console(threading.Thread):
while True: while True:
inform("Attempting to open msgQ %s", self.msgQname) inform("Attempting to open msgQ %s", self.msgQname)
self._msgQueue = PA.OpenMsgQueueForReading(self.msgQname) self._msgQueue = PA.OpenMsgQueueForReading(self.msgQname)
if (self._msgQueue != -1): break if (self._msgQueue != -1):
break
print "Communication channel over", self.msgQname, "not established yet...\n" print "Communication channel over", self.msgQname, "not established yet...\n"
time.sleep(1) time.sleep(1)
if self._bDie: if self._bDie:
return return
# Then, now that msgQ is opened, start polling: # Then, now that msgQ is opened, start polling:
bufferSize = PA.GetMsgQueueBufferSize(self._msgQueue) bufferSize = PA.GetMsgQueueBufferSize(self._msgQueue)
self._pMem = DV.new_byte_SWIG_PTR(bufferSize) self._pMem = ctypes.create_string_buffer(bufferSize).raw
while not self._bDie: while not self._bDie:
inform("Polling Q") inform("Polling Q")
self.messageReceivedType = PA.RetrieveMessageFromQueue(self._msgQueue, bufferSize, self._pMem) self.messageReceivedType = PA.RetrieveMessageFromQueue(self._msgQueue, bufferSize, self._pMem)
......
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