use of com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeEvent in project com.zsmartsystems.zigbee by zsmartsystems.
the class XBeeEventFactoryTest method testGetEvent.
@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());
}
use of com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeEvent in project com.zsmartsystems.zigbee by zsmartsystems.
the class XBeeEventFactory method getXBeeFrame.
public static XBeeEvent getXBeeFrame(int[] data) {
Class<?> xbeeClass = events.get(data[2]);
// No handler found
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;
}
use of com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeEvent in project com.zsmartsystems.zigbee by zsmartsystems.
the class XBeeEventFactoryTest method testBootloaderEvent.
@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());
}
Aggregations