@Test public void testBootloaderEvent() { int[] data = getPacketData("00 16 A0 00 13 A2 00 41 62 F6 1A 00 00 01 40 00 00 00 00 00 00 00 FF FF B8"); XBeeEvent frame = XBeeEventFactory.getXBeeFrame(data); assertTrue(frame instanceof XBeeOtaFirmwareUpdateStatusEvent); System.out.println(frame); XBeeOtaFirmwareUpdateStatusEvent event = (XBeeOtaFirmwareUpdateStatusEvent) frame; assertEquals(Integer.valueOf(0), event.getBlockNumber()); assertEquals(new IeeeAddress("0013A2004162F61A"), event.getIeeeAddress()); assertEquals(Integer.valueOf(0), event.getNetworkAddress()); }
public static XBeeEvent getXBeeFrame(int[] data) { Class<?> xbeeClass = events.get(data[2]); if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeEvent xbeeFrame = (XBeeEvent) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeEvent", e); } return null; }
XBeeEventFactory { public static XBeeEvent getXBeeFrame(int[] data) { Class<?> xbeeClass = events.get(data[2]); if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeEvent xbeeFrame = (XBeeEvent) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeEvent", e); } return null; } }
XBeeEventFactory { public static XBeeEvent getXBeeFrame(int[] data) { Class<?> xbeeClass = events.get(data[2]); if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeEvent xbeeFrame = (XBeeEvent) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeEvent", e); } return null; }  }
XBeeEventFactory { public static XBeeEvent getXBeeFrame(int[] data) { Class<?> xbeeClass = events.get(data[2]); if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeEvent xbeeFrame = (XBeeEvent) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeEvent", e); } return null; }  static XBeeEvent getXBeeFrame(int[] data); }
XBeeEventFactory { public static XBeeEvent getXBeeFrame(int[] data) { Class<?> xbeeClass = events.get(data[2]); if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeEvent xbeeFrame = (XBeeEvent) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeEvent", e); } return null; }  static XBeeEvent getXBeeFrame(int[] data);  }