def get_payload(self):
reserved_8 = little_endian(bitstring.pack("8", self.reserved))
transient = little_endian(bitstring.pack("uint:8", self.transient))
color = b"".join(little_endian(bitstring.pack("16", field)) for field in self.color)
period = little_endian(bitstring.pack("uint:32", self.period))
cycles = little_endian(bitstring.pack("float:32", self.cycles))
duty_cycle = little_endian(bitstring.pack("int:16", self.duty_cycle))
waveform = little_endian(bitstring.pack("uint:8", self.waveform))
payload = reserved_8 + transient + color + period + cycles + duty_cycle + waveform
return payload
评论列表
文章目录