Search in sources :

Example 1 with ZToolPacketStream

use of com.zsmartsystems.zigbee.dongle.cc2531.network.packet.ZToolPacketStream in project com.zsmartsystems.zigbee by zsmartsystems.

the class Cc2351TestPacket method getPacket.

protected ZToolPacket getPacket(String stringData) {
    int[] packet = getPacketData(stringData);
    byte[] byteArray = new byte[packet.length - 1];
    for (int c = 1; c < packet.length; c++) {
        byteArray[c - 1] = (byte) packet[c];
    }
    ByteArrayInputStream stream = new ByteArrayInputStream(byteArray);
    ZigBeePort port = new TestPort(stream, null);
    try {
        ZToolPacket ztoolPacket = new ZToolPacketStream(port).parsePacket();
        assertFalse(ztoolPacket.isError());
        return ztoolPacket;
    } catch (IOException e) {
        return null;
    }
}
Also used : ZToolPacket(com.zsmartsystems.zigbee.dongle.cc2531.network.packet.ZToolPacket) ZToolPacketStream(com.zsmartsystems.zigbee.dongle.cc2531.network.packet.ZToolPacketStream) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException) ZigBeePort(com.zsmartsystems.zigbee.transport.ZigBeePort)

Aggregations

ZToolPacket (com.zsmartsystems.zigbee.dongle.cc2531.network.packet.ZToolPacket)1 ZToolPacketStream (com.zsmartsystems.zigbee.dongle.cc2531.network.packet.ZToolPacketStream)1 ZigBeePort (com.zsmartsystems.zigbee.transport.ZigBeePort)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1