generate packing for python messages (#1535)

Generate packet serialization in Python, too.
This commit is contained in:
Lucien Morey
2024-11-10 05:08:45 +11:00
committed by GitHub
parent 1d8d934a8a
commit 14fcc5d485
11 changed files with 263 additions and 7 deletions

View File

@@ -21,14 +21,25 @@
###############################################################################
from ..targeting import *
from ..packet import Packet
class MultiTargetPNPResultSerde:
# Message definition md5sum. See photon_packet.adoc for details
MESSAGE_VERSION = "541096947e9f3ca2d3f425ff7b04aa7b"
MESSAGE_FORMAT = "PnpResult:ae4d655c0a3104d88df4f5db144c1e86 estimatedPose;int16 fiducialIDsUsed[?];"
@staticmethod
def pack(value: "MultiTargetPNPResult") -> "Packet":
ret = Packet()
# estimatedPose is of non-intrinsic type PnpResult
ret.encodeBytes(PnpResult.photonStruct.pack(value.estimatedPose).getData())
# fiducialIDsUsed is a custom VLA!
ret.encodeShortList(value.fiducialIDsUsed)
return ret
@staticmethod
def unpack(packet: "Packet") -> "MultiTargetPNPResult":
ret = MultiTargetPNPResult()