@Test public void testReceiveAfterRestart() throws Exception { List<EspRadioTelegram> expectedTelegrams = new ArrayList<EspRadioTelegram>(); expectedTelegrams.add(new Esp2RPSTelegram(senderID, (byte)0x11, (byte)0x22)); expectedTelegrams.add(new Esp21BSTelegram(senderID, (byte)0x33, (byte)0x44)); expectedTelegrams.add(new Esp24BSTelegram( senderID, new byte[] {(byte)0xFF, 0x01, 0x02, 0x03}, (byte)0x55) ); for(EspRadioTelegram telegram : expectedTelegrams) { byte[] telegramBytes = ((EspPacket) telegram).asByteArray(); mockPort.addDataToReturn( setPacketType(Esp2PacketHeader.PacketType.RRT_UNKNOWN, telegramBytes) ); } RadioListener listener = new RadioListener(2, expectedTelegrams.size()); processor.setProcessorListener(listener); processor.start(); List<EspRadioTelegram> receivedTelegrams = listener.waitForRadioTelegrams(); processor.stop(); Assert.assertNotNull(receivedTelegrams); Assert.assertEquals(expectedTelegrams.size(), receivedTelegrams.size()); for(EspRadioTelegram telegram : expectedTelegrams) { byte[] telegramBytes = ((EspPacket) telegram).asByteArray(); mockPort.addDataToReturn( setPacketType(Esp2PacketHeader.PacketType.RRT_UNKNOWN, telegramBytes) ); } listener = new RadioListener(2, expectedTelegrams.size()); processor.setProcessorListener(listener); processor.start(); receivedTelegrams = listener.waitForRadioTelegrams(); processor.stop(); Assert.assertNotNull(receivedTelegrams); Assert.assertEquals(expectedTelegrams.size(), receivedTelegrams.size()); }
public void setProcessorListener(Esp2ProcessorListener listener) { this.listener = listener; }
Esp2Processor extends AbstractEspProcessor<Esp2Packet> { public void setProcessorListener(Esp2ProcessorListener listener) { this.listener = listener; } }
Esp2Processor extends AbstractEspProcessor<Esp2Packet> { public void setProcessorListener(Esp2ProcessorListener listener) { this.listener = listener; } Esp2Processor(Esp2ComPortAdapter port); }
Esp2Processor extends AbstractEspProcessor<Esp2Packet> { public void setProcessorListener(Esp2ProcessorListener listener) { this.listener = listener; } Esp2Processor(Esp2ComPortAdapter port); void setProcessorListener(Esp2ProcessorListener listener); }
Esp2Processor extends AbstractEspProcessor<Esp2Packet> { public void setProcessorListener(Esp2ProcessorListener listener) { this.listener = listener; } Esp2Processor(Esp2ComPortAdapter port); void setProcessorListener(Esp2ProcessorListener listener); static final long ESP2_RESPONSE_TIMEOUT; }