use of com.zsmartsystems.zigbee.transport.ZigBeePort in project com.zsmartsystems.zigbee by zsmartsystems.
the class TelegesisFirmwareUpdateHandlerTest method getTransferResponse.
private int getTransferResponse(String packet) {
ByteArrayInputStream stream = new ByteArrayInputStream(packet.getBytes());
ZigBeePort port = new TestPort(stream);
TelegesisFirmwareUpdateHandler firmwareHandler = new TelegesisFirmwareUpdateHandler(null, null, port, null);
Method privateMethod;
try {
privateMethod = TelegesisFirmwareUpdateHandler.class.getDeclaredMethod("getTransferResponse");
privateMethod.setAccessible(true);
return (int) privateMethod.invoke(firmwareHandler);
} catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
return 0;
}
use of com.zsmartsystems.zigbee.transport.ZigBeePort in project com.zsmartsystems.zigbee by zsmartsystems.
the class AshFrameHandlerTest method getPacket.
private int[] getPacket(int[] data) {
AshFrameHandler frameHandler = new AshFrameHandler(null);
byte[] bytedata = new byte[data.length];
int cnt = 0;
for (int value : data) {
bytedata[cnt++] = (byte) value;
}
ByteArrayInputStream stream = new ByteArrayInputStream(bytedata);
ZigBeePort port = new TestPort(stream, null);
Method privateMethod;
try {
Field field = frameHandler.getClass().getDeclaredField("port");
field.setAccessible(true);
field.set(frameHandler, port);
privateMethod = AshFrameHandler.class.getDeclaredMethod("getPacket");
privateMethod.setAccessible(true);
return (int[]) privateMethod.invoke(frameHandler);
} catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException | NoSuchFieldException e) {
e.printStackTrace();
}
return null;
}
use of com.zsmartsystems.zigbee.transport.ZigBeePort in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberFirmwareUpdateHandlerTest method getTransferResponse.
private int getTransferResponse(String packet) {
ByteArrayInputStream stream = new ByteArrayInputStream(packet.getBytes());
ZigBeePort port = new TestPort(stream);
EmberFirmwareUpdateHandler firmwareHandler = new EmberFirmwareUpdateHandler(null, null, port, null);
Method privateMethod;
try {
privateMethod = EmberFirmwareUpdateHandler.class.getDeclaredMethod("getTransferResponse");
privateMethod.setAccessible(true);
return (int) privateMethod.invoke(firmwareHandler);
} catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
return 0;
}
use of com.zsmartsystems.zigbee.transport.ZigBeePort in project com.zsmartsystems.zigbee by zsmartsystems.
the class XBeeFrameHandlerTest method getPacket.
private int[] getPacket(String packet) {
String[] split = packet.split(" ");
byte[] response = new byte[split.length];
int cnt = 0;
for (String val : split) {
response[cnt++] = (byte) Integer.parseInt(val, 16);
}
XBeeFrameHandler frameHandler = new XBeeFrameHandler();
ByteArrayInputStream stream = new ByteArrayInputStream(response);
ZigBeePort port = new TestPort(stream, null);
Method privateMethod;
try {
Field field = frameHandler.getClass().getDeclaredField("serialPort");
field.setAccessible(true);
field.set(frameHandler, port);
privateMethod = XBeeFrameHandler.class.getDeclaredMethod("getPacket");
privateMethod.setAccessible(true);
return (int[]) privateMethod.invoke(frameHandler);
} catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException | NoSuchFieldException e) {
e.printStackTrace();
}
return null;
}
Aggregations