本文整理了Java中com.zsmartsystems.zigbee.dongle.cc2531.network.packet.ZToolPacket.getPacket()
方法的一些代码示例,展示了ZToolPacket.getPacket()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZToolPacket.getPacket()
方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.dongle.cc2531.network.packet.ZToolPacket
类名称:ZToolPacket
方法名:getPacket
[英]Gets a hex dump of the packet data
[中]获取数据包数据的十六进制转储
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Send packet to dongle.
*
* @param packet the packet
* @throws IOException if IO exception occurs while sending packet
*/
@Override
public void sendPacket(final ZToolPacket packet) throws IOException {
logger.debug("-> {} ({}) ", packet.getClass().getSimpleName(), packet);
final int[] pck = packet.getPacket();
sendRaw(pck);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(packet.getPacket()[7] + (packet.getPacket()[8] << 8));
apsFrame.setDestinationAddress(packet.getPacket()[11] + (packet.getPacket()[12] << 8));
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setApsCounter(packet.getPacket()[10]);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 12, packet.getPacket().length - 1));
return apsFrame;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.ACTIVE_ENDPOINTS_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.MANAGEMENT_ROUTING_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.MANAGEMENT_LEAVE_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.SIMPLE_DESCRIPTOR_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.MANAGEMENT_LQI_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.DEVICE_ANNOUNCE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.POWER_DESCRIPTOR_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.NODE_DESCRIPTOR_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.IEEE_ADDRESS_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[13] + (packet.getPacket()[14] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
int temp[] = Arrays.copyOfRange(packet.getPacket(), 3, packet.getPacket().length - 1);
int a = temp[12];
temp[12] = temp[13];
temp[13] = a;
temp[0] = 0;
apsFrame.setPayload(temp);
return apsFrame;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Handle parsed packet.
*
* @param packet the packet
*/
@Override
public void handlePacket(final ZToolPacket packet) {
final DoubleByte cmdId = packet.getCMD();
switch (cmdId.getMsb() & 0xE0) {
// Received incoming message which can be either message from dongle or remote device.
case 0x40:
logger.debug("<-- {} ({})", packet.getClass().getSimpleName(), ByteUtils.toBase16(packet.getPacket()));
notifyAsynchronousCommand(packet);
break;
// Received synchronous command response.
case 0x60:
logger.debug("<- {} ({})", packet.getClass().getSimpleName(), ByteUtils.toBase16(packet.getPacket()));
notifySynchronousCommand(packet);
break;
default:
logger.error("Received unknown packet. {}", packet.getClass().getSimpleName());
break;
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
ZToolPacket packet = argumentPacket.getAllValues().get(0);
assertTrue(Arrays.equals(new int[] { 254, 6, 38, 5, 132, 0x04, 0x00, 0x08, 0x00, 0x00, 173 },
packet.getPacket()));
packet = argumentPacket.getAllValues().get(1);
assertTrue(Arrays.equals(new int[] { 254, 6, 38, 5, 132, 0x04, 0x00, 0x08, 0x00, 0x00, 173 },
packet.getPacket()));
packet = argumentPacket.getAllValues().get(2);
assertTrue(Arrays.equals(new int[] { 254, 6, 38, 5, 132, 0x04, 0x00, 0x08, 0x00, 0x00, 173 },
packet.getPacket()));
packet = argumentPacket.getAllValues().get(3);
assertTrue(Arrays.equals(new int[] { 254, 6, 38, 5, 132, 0x04, 0x00, 0xf8, 0x00, 0x00, 0x5D },
packet.getPacket()));
packet.getPacket()));
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
内容来源于网络,如有侵权,请联系作者删除!