Fisheye: Tag 46668f272b283cb860ecaaf33a0465c9e55345b1 refers to a dead (removed) revision in file `leahi_dialin/ui/TD_Messaging.py'. Fisheye: No comparison available. Pass `N' to diff? Index: leahi_dialin/ui/td_messaging.py =================================================================== diff -u --- leahi_dialin/ui/td_messaging.py (revision 0) +++ leahi_dialin/ui/td_messaging.py (revision 46668f272b283cb860ecaaf33a0465c9e55345b1) @@ -0,0 +1,54 @@ +#!/bin/python3 + +from dialin.ui.utils import singleton_threadsafe +from dialin.utils import conversions +from dialin.protocols import CAN +from dialin.common import msg_ids + + +@singleton_threadsafe +class TD_Messaging(): + + def __init__(self): + + self.can_enabled: bool=False + self.can_Channel: str = "can0" + + class fakeLogger(): + def __init__(self): + pass + + def error(a1, a2): + pass + + def info(a1, a2): + pass + + self.can_interface = CAN.DenaliCanMessenger(can_interface=self.can_Channel, logger=fakeLogger() ) + self.can_interface.start() + + if self.can_interface is not None: + self.can_enabled = True + + + def cmd_send_hd_operation_mode(self, op_mode: int, sub_mode: int = 0): + """ + Broadcasts the current HD operation mode + @param op_mode: hd operation mode + @param sub_mode: hd operation sub-mode + @return: None + """ + + if not self.can_enabled: + raise ValueError("CAN Interface is not enabled") + + + payload = conversions.integer_to_bytearray(op_mode ) + payload += conversions.integer_to_bytearray(sub_mode) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_sync_broadcast_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_OP_MODE_DATA.value, + payload=payload) + + self.can_interface.send(message, 0)