Index: Miscellaneous/DG_Firmware_Simulator.py =================================================================== diff -u -raf4e78cc8f334d92a29ce7aa2b89c15a2cca8064 -rf2b88894a458d9e03a9cb005af02ef16fd5e6f32 --- Miscellaneous/DG_Firmware_Simulator.py (.../DG_Firmware_Simulator.py) (revision af4e78cc8f334d92a29ce7aa2b89c15a2cca8064) +++ Miscellaneous/DG_Firmware_Simulator.py (.../DG_Firmware_Simulator.py) (revision f2b88894a458d9e03a9cb005af02ef16fd5e6f32) @@ -1,49 +1,39 @@ -from DialityCoreCanProtocol import DialityCanMessenger -from DialityCoreCanProtocol import DialityPacket +from DialityCoreCanProtocol import * from time import sleep +dialin_messenger = DialinCanMessenger() - - -diality_messenger = DialityCanMessenger() - - # Building response message -response_req_id = 0x03 -response_packet = DialityPacket.buildPacket(response_req_id, [1, 2]) -# Building Sync response message -sync_req_id = 0x05 -sync_packet = DialityPacket.buildPacket(sync_req_id, [0x06, 0x02]) +response_msg = DialinMessage.buildMessage(channel_id=DialinChannels.dg_to_hd_ch_id, + message_id=0x7000, + payload=[1]) -# Building Sync message -sync_req_id = 0x05 -sync_packet_2 = DialityPacket.buildPacket(sync_req_id, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) +# Building Publication message +publication_msg = DialinMessage.buildMessage(channel_id=DialinChannels.dg_sync_broadcast_ch_id, + message_id=0x7100, + payload=[1, 2, 3, 4, 5]) - -channel_id = 0x01 - print("") -print("o -> response") -print(". -> Sync") +print("o -> response to fill command") +print(". -> publication message") print("") -def respondToCommand(packet): - - diality_messenger.send(channel_id, response_packet) +def respondToCommand(message): + dialin_messenger.send(response_msg) print("o", end='', flush=True) # Register response command for the DG -diality_messenger.registerSyncFunction(channel_id, response_req_id, respondToCommand) -diality_messenger.start() +dialin_messenger.registerReceivingPublicationFunction(channel_id=DialinChannels.hd_to_dg_ch_id, + message_id=0x7000, + function=respondToCommand) +dialin_messenger.start() # This is the main loop while True: - - diality_messenger.send(channel_id, sync_packet_2) + dialin_messenger.send(publication_msg) print(".", end='', flush=True) - sleep(1)