@Test public void testGetResponse2() { int[] data = getPacketData("00 05 88 10 4F 49 02 CD"); XBeeResponse frame = XBeeResponseFactory.getXBeeFrame(data); assertTrue(frame instanceof XBeePanIdResponse); System.out.println(frame); XBeePanIdResponse event = (XBeePanIdResponse) frame; assertEquals(CommandStatus.INVALID_COMMAND, event.getCommandStatus()); }
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);  }