Code reference¶
shapelink.shapelink_plugin¶
Receive data in real-time from a Shape-In instance via zmq
-
class
shapelink.shapelink_plugin.
ShapeLinkPlugin
(bind_to='tcp://*:6666', verbose=False)[source]¶ Shape-Link plug-in meta class
- Parameters
-
abstract
handle_event
(event_data: shapelink.shapelink_plugin.EventData) → bool[source]¶ Abstract method to be overridden by plugins implementations
-
handle_messages
()[source]¶ Handle messages from Shape-In
Please don’t override this function. Use
ShapeLinkPlugin.handle_event()
for your customized plugins.
shapelink.util¶
Utility functions
These functions replicate QDataStreams behavior in C++. In PySide2 QDataStream does not accept array type data.
In C++ an array is serialized by writing: 1) Uint32 number of elements 2) type array elements
more significant bytes are written first. (big-endian)
if numpy “to_bytes” is used the native little-endian format appears
-
shapelink.util.
qstream_read_array
(stream: PySide2.QtCore.QDataStream, datatype: numpy.dtype) → numpy.array[source]¶ Read array data from a stream with a specified type
shapelink.shapein_simulator¶
Simulate a Shape-In instance
The communication is based on a simple REQ REP pattern all methods return when the transmission was acknowledged by the peer.
-
class
shapelink.shapein_simulator.
ShapeInSimulator
(destination='tcp://localhost:6666', verbose=False)[source]¶
shapelink.msg_def¶
Definitions for message ids (numeric)
-
shapelink.msg_def.
MSG_ID_EOT
= -10¶ end of transmission
-
shapelink.msg_def.
MSG_ID_EOT_ACK
= -11¶ end of transmission acknowledged
-
shapelink.msg_def.
MSG_ID_REGISTER
= -1¶ registration
-
shapelink.msg_def.
MSG_ID_REGISTER_ACK
= -2¶ registration acknowledged