def broadcastFrame(self, frame): """ Broadcast a new frame (as JSON) - possible bottleneck """ self.broadcastMessageText( simpleDictionaryToJSON({ b"t": frame.time, b"i": frame.identifier, b"e": frame.isExtended, b"r": frame.isRTR, b"l": frame.DLC, b"d": bytes_hex(frame.data), }))
# Fichier de débogage from utility import bytes_hex print(bytes_hex(b"\x00\x20\x7f\xff")) print(bytes_hex)
def __str__(self): info = (self.identifier, self.isRTR, self.DLC, bytes_hex(self.data)) if self.isExtended: return "CANFrame(identifier=0x%.8X <29-bit>, isRTR=%u, DLC=%u, data=%s)" % info else: return "CANFrame(identifier=0x%.3X <11-bit>, isRTR=%u, DLC=%u, data=%s)" % info