本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclHeader.setCommandId()
方法的一些代码示例,展示了ZclHeader.setCommandId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZclHeader.setCommandId()
方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.zcl.ZclHeader
类名称:ZclHeader
方法名:setCommandId
暂无
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
zclHeader.setFrameType(zclCommand.isGenericCommand() ? ZclFrameType.ENTIRE_PROFILE_COMMAND
: ZclFrameType.CLUSTER_SPECIFIC_COMMAND);
zclHeader.setCommandId(zclCommand.getCommandId());
zclHeader.setSequenceNumber(command.getTransactionId());
zclHeader.setDirection(zclCommand.getCommandDirection());
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testReceiveZclCommand() {
ZigBeeNetworkManager networkManager = mockZigBeeNetworkManager();
networkManager.setSerializer(DefaultSerializer.class, DefaultDeserializer.class);
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setSourceAddress(1234);
apsFrame.setDestinationAddress(0);
apsFrame.setApsCounter(1);
apsFrame.setCluster(6);
apsFrame.setDestinationEndpoint(2);
apsFrame.setProfile(0x104);
apsFrame.setSourceEndpoint(5);
ZclHeader zclHeader = new ZclHeader();
zclHeader.setCommandId(0);
zclHeader.setFrameType(ZclFrameType.ENTIRE_PROFILE_COMMAND);
zclHeader.setSequenceNumber(1);
DefaultSerializer serializer = new DefaultSerializer();
ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
apsFrame.setPayload(zclHeader.serialize(fieldSerializer, new int[] {}));
networkManager.receiveCommand(apsFrame);
Awaitility.await().until(() -> commandListenerUpdated());
ReadAttributesCommand response = (ReadAttributesCommand) commandListenerCapture.get(0);
assertEquals(6, (int) response.getClusterId());
assertEquals(0, (int) response.getCommandId());
assertEquals(1, (int) response.getTransactionId());
assertEquals(new ZigBeeEndpointAddress(1234, 5), response.getSourceAddress());
}
内容来源于网络,如有侵权,请联系作者删除!