@Test public void testGetEvent() { int[] data = getPacketData( "00 1A 91 00 17 88 01 02 13 65 36 F7 7B 02 01 00 01 01 04 41 18 7C 01 21 00 00 20 C8 C4"); XBeeEvent frame = XBeeEventFactory.getXBeeFrame(data); assertTrue(frame instanceof XBeeReceivePacketExplicitEvent); System.out.println(frame); XBeeReceivePacketExplicitEvent event = (XBeeReceivePacketExplicitEvent) frame; assertEquals(Integer.valueOf(1), event.getClusterId()); assertEquals(Integer.valueOf(1), event.getDestinationEndpoint()); assertEquals(Integer.valueOf(63355), event.getNetworkAddress()); assertEquals(Integer.valueOf(0x104), event.getProfileId()); }
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);  }