Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
222c849f
Commit
222c849f
authored
Aug 03, 2017
by
Maxime Perrotin
Browse files
Fix buffers with ctypes properly
parent
90bbd93e
Changes
1
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/Scenario.py
View file @
222c849f
...
...
@@ -185,19 +185,23 @@ class PollerThread(QThread):
print
'Failed to open message queue '
+
self
.
q_name
return
-
1
buffer_size
=
GetMsgQueueBufferSize
(
msg_q
)
# Configure a buffer to read data from the queue
buff
=
ctypes
.
create_string_buffer
(
buffer_size
)
while
True
:
if
self
.
stop_requested
:
return
0
p_data_from_mq
=
ctypes
.
create_string_buffer
(
buffer_size
).
raw
# Create an actual buffer and get the pointer
# (accessing .raw is doing Python magic)
raw
=
buff
.
raw
msg_received_type
=
RetrieveMessageFromQueue
(
msg_q
,
buffer_size
,
p_data_from_mq
)
raw
)
if
msg_received_type
==
-
1
:
time
.
sleep
(
0.01
)
continue
else
:
for
slot
in
self
.
slots
:
slot
.
put
((
msg_received_type
,
p_data_from_mq
))
slot
.
put
((
msg_received_type
,
raw
))
def
stop
(
self
):
''' Request the poller to stop '''
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment