Index: DialityCoreCanProtocol.py =================================================================== diff -u -r51197ba092f454f59d3e9da522c1806020a31e6e -r4a04642902b240b68710677ed9c745d78f338ef6 --- DialityCoreCanProtocol.py (.../DialityCoreCanProtocol.py) (revision 51197ba092f454f59d3e9da522c1806020a31e6e) +++ DialityCoreCanProtocol.py (.../DialityCoreCanProtocol.py) (revision 4a04642902b240b68710677ed9c745d78f338ef6) @@ -150,7 +150,7 @@ if channel_id not in self.__longPacketsBuilders.keys(): # if we don't have a builder. Create it! - self.__longPacketsBuilders[channel_id] = LongDialityPacketBuilder(can_data) + self.__longPacketsBuilders[channel_id] = __LongDialityPacketBuilder(can_data) self.__dialityPacket = None else: # this is the continuation of a long packet. A builder must have been created @@ -302,7 +302,7 @@ def padPacketWithZeros(packet): """ returns a packet padded with zeros that guarantees that the packet is a multiple of 8 bytes. - :param packet: packet that may or may not be multiple of zeros + :param packet: packet that may or may not be multiple of 8 bytes :return: packet that is 8-byte multiple @@ -355,6 +355,14 @@ test_print_received_packet(packet, sync=True) +def test_print_sending_dg_board(channel_id, packet): + print("Sending to board: ", packet, " in channel: ", channel_id) + + +def test_print_sending_dg_sim(channel_id, packet): + print("Sending to DG simulator: ", packet, " in channel", channel_id, end=" ---> ") + + if __name__ == "__main__": test_messenger = DialityCanMessenger() test_channel_id = 0x100 @@ -368,29 +376,30 @@ test_dg_simulator_sync_req_id = 0x05 test_dg_simulator_req_id = 0x03 - test_messenger.registerSyncFunction(test_dg_simulator_received_channel_id, test_dg_simulator_sync_req_id, test_function_for_sync) + test_messenger.registerSyncFunction(test_dg_simulator_received_channel_id, test_dg_simulator_sync_req_id, + test_function_for_sync) test_messenger.start() test_packet = DialityPacket.buildPacket(0x100, [1]) test_dg_packet = DialityPacket.buildPacket(test_dg_simulator_req_id, []) sleep(3.0) - print("Sending to board: ", test_packet, " in channel: ", test_channel_id) + test_print_sending_dg_board(test_channel_id, test_packet) test_response = test_messenger.send(test_channel_id, test_packet) test_print_to_screen(test_response) sleep(3.0) - print("Sending to board: ", test_packet, " in channel: ", test_channel_id) + test_print_sending_dg_board(test_channel_id, test_packet) test_response = test_messenger.send(test_channel_id, test_packet) test_print_to_screen(test_response) sleep(3.0) - print("Sending to DG simulator: ", test_dg_packet, " in channel", test_dg_simulator_received_channel_id, end=" ---> ") + test_print_sending_dg_sim(test_dg_simulator_received_channel_id, test_dg_packet) test_response = test_messenger.send(test_dg_simulator_received_channel_id, test_dg_packet) test_print_to_screen(test_response) sleep(3.0) - print("Sending to DG simulator: ", test_dg_packet, " in channel", test_dg_simulator_received_channel_id, end=" ---> ") + test_print_sending_dg_sim(test_dg_simulator_received_channel_id, test_dg_packet) test_response = test_messenger.send(test_dg_simulator_received_channel_id, test_dg_packet) - test_print_to_screen(test_response) \ No newline at end of file + test_print_to_screen(test_response)