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 TargetCornerSerde:
# Message definition md5sum. See photon_packet.adoc for details
MESSAGE_VERSION = "16f6ac0dedc8eaccb951f4895d9e18b6"
MESSAGE_FORMAT = "float64 x;float64 y;"
@staticmethod
def pack(value: "TargetCorner") -> "Packet":
ret = Packet()
# x is of intrinsic type float64
ret.encodeDouble(value.x)
# y is of intrinsic type float64
ret.encodeDouble(value.y)
return ret
@staticmethod
def unpack(packet: "Packet") -> "TargetCorner":
ret = TargetCorner()