@Test public void testGetResponse1() { int[] data = getPacketData("00 07 8B 8F F7 7B 00 00 40 33"); XBeeResponse frame = XBeeResponseFactory.getXBeeFrame(data); assertTrue(frame instanceof XBeeTransmitStatusResponse); System.out.println(frame); XBeeTransmitStatusResponse event = (XBeeTransmitStatusResponse) frame; assertEquals(Integer.valueOf(143), event.getFrameId()); assertEquals(Integer.valueOf(0), event.getTransmitRetryCount()); assertEquals(DeliveryStatus.SUCCESS, event.getDeliveryStatus()); assertEquals(DiscoveryStatus.EXTENDED_TIMEOUT_DISCOVERY, event.getDiscoveryStatus()); }
public static XBeeResponse getXBeeFrame(int[] data) { Class<?> xbeeClass = null; if (data[2] == 0x88) { xbeeClass = atCommands.get((data[4] << 8) + data[5]); } if (xbeeClass == null) { xbeeClass = events.get(data[2]); } if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeResponse xbeeFrame = (XBeeResponse) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeResponse", e); } return null; }
XBeeResponseFactory { public static XBeeResponse getXBeeFrame(int[] data) { Class<?> xbeeClass = null; if (data[2] == 0x88) { xbeeClass = atCommands.get((data[4] << 8) + data[5]); } if (xbeeClass == null) { xbeeClass = events.get(data[2]); } if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeResponse xbeeFrame = (XBeeResponse) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeResponse", e); } return null; } }
XBeeResponseFactory { public static XBeeResponse getXBeeFrame(int[] data) { Class<?> xbeeClass = null; if (data[2] == 0x88) { xbeeClass = atCommands.get((data[4] << 8) + data[5]); } if (xbeeClass == null) { xbeeClass = events.get(data[2]); } if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeResponse xbeeFrame = (XBeeResponse) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeResponse", e); } return null; }  }
XBeeResponseFactory { public static XBeeResponse getXBeeFrame(int[] data) { Class<?> xbeeClass = null; if (data[2] == 0x88) { xbeeClass = atCommands.get((data[4] << 8) + data[5]); } if (xbeeClass == null) { xbeeClass = events.get(data[2]); } if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeResponse xbeeFrame = (XBeeResponse) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeResponse", e); } return null; }  static XBeeResponse getXBeeFrame(int[] data); }
XBeeResponseFactory { public static XBeeResponse getXBeeFrame(int[] data) { Class<?> xbeeClass = null; if (data[2] == 0x88) { xbeeClass = atCommands.get((data[4] << 8) + data[5]); } if (xbeeClass == null) { xbeeClass = events.get(data[2]); } if (xbeeClass == null) { return null; } Constructor<?> ctor; try { ctor = xbeeClass.getConstructor(); XBeeResponse xbeeFrame = (XBeeResponse) ctor.newInstance(); xbeeFrame.deserialize(data); return xbeeFrame; } catch (Exception e) { logger.debug("Error creating instance of XBeeResponse", e); } return null; }  static XBeeResponse getXBeeFrame(int[] data);  }