- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclHeader
类的一些代码示例,展示了ZclHeader
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZclHeader
类的具体详情如下:
包路径:com.zsmartsystems.zigbee.zcl.ZclHeader
类名称:ZclHeader
[英]Defines the ZigBee Cluster Library (ZCL) Header fields-:
The frame type sub-field specifies if this is a generic command used across the entire profile #ENTIRE_PROFILE_COMMAND, or a command that is specific to a single cluster #CLUSTER_SPECIFIC_COMMAND.
The manufacturer specific sub-field is 1 bit in length and specifies whether this command refers to a manufacturer specific extension to a profile. If this value is set to 1, the manufacturer code field shall be present in the ZCL frame. If this value is set to 0, the manufacturer code field shall not be included in the ZCL frame.
The direction sub-field specifies the client/server direction for this command. If this value is set to 1, the command is being sent from the server side of a cluster to the client side of a cluster. If this value is set to 0, the command is being sent from the client side of a cluster to the server side of a cluster.
The disable default response sub-field is 1 bit in length. If it is set to 0, the Default response command will be returned. If it is set to 1, the Default response command will only be returned if there is an error.
The command identifier field is 8 bits in length and specifies the cluster command being used. If the frame type sub-field of the frame control field is set to 0b00, the command identifier corresponds to one of the non-reserved values of Table 2.9. If the frame type sub-field of the frame control field is set to 0b01, the command identifier corresponds to a cluster specific command. The cluster specific command identifiers can be found in each individual document describing the clusters.
The transaction sequence number field is 8 bits in length and specifies an identification number for the transaction so that a response-style command frame can be related to a request-style command frame. The application object itself shall maintain an 8-bit counter that is copied into this field and incremented by one for each command sent. When a value of 0xff is reached, the next command shall re-start the counter with a value of 0x00. The transaction sequence number field can be used by a controlling device, which may have issued multiple commands, so that it can match the incoming responses to the relevant command.
[中]定义ZigBee群集库(ZCL)头字段-:
*帧控制(1字节)
*制造商代码(2字节)[可选]
*事务序列号(1字节)
*命令ID(1字节)
“帧类型”子字段指定这是在整个配置文件中使用的通用命令#整个_profile_命令,还是特定于单个簇的命令#特定于簇的_命令。
特定于制造商的子字段长度为1位,并指定此命令是否引用配置文件的特定于制造商的扩展。如果该值设置为1,则ZCL框架中应存在制造商代码字段。如果该值设置为0,则ZCL框架中不应包含制造商代码字段。
方向子字段指定此命令的客户端/服务器方向。如果该值设置为1,则该命令将从集群的服务器端发送到集群的客户端。如果该值设置为0,则该命令将从集群的客户端发送到集群的服务器端。
禁用默认响应子字段的长度为1位。如果设置为0,将返回默认响应命令。如果设置为1,则只有在出现错误时才会返回默认响应命令。
命令标识符字段的长度为8位,指定正在使用的集群命令。如果帧控制字段的帧类型子字段设置为0b00,则命令标识符对应于表2.9中的一个非保留值。如果帧控制字段的帧类型子字段设置为0b01,则命令标识符对应于特定于群集的命令。特定于集群的命令标识符可以在描述集群的每个单独文档中找到。
事务序列号字段的长度为8位,并指定事务的标识号,以便响应样式的命令帧可以与请求样式的命令帧相关。应用程序对象本身应保持一个8位计数器,该计数器被复制到该字段中,并为每个发送的命令增加一个计数器。当达到0xff值时,下一个命令应以0x00值重新启动计数器。交易序列号字段可由控制设备使用,控制设备可能已发出多个命令,以便将传入的响应与相关命令相匹配。
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testDeserializeManufacturerSpecific() {
int[] packet = getPacketData("0C 4E 10 99 88");
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
assertEquals(0x88, zclHeader.getCommandId());
assertEquals(ZclFrameType.ENTIRE_PROFILE_COMMAND, zclHeader.getFrameType());
assertEquals(true, zclHeader.isManufacturerSpecific());
assertEquals(false, zclHeader.isDisableDefaultResponse());
assertEquals(0x99, zclHeader.getSequenceNumber());
assertEquals(0x104E, zclHeader.getManufacturerCode());
DefaultSerializer serializer = new DefaultSerializer();
ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
assertTrue(Arrays.equals(packet, zclHeader.serialize(fieldSerializer, new int[] {})));
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
private ZigBeeCommand receiveZclCommand(final ZclFieldDeserializer fieldDeserializer,
final ZigBeeApsFrame apsFrame) {
// Process the ZCL header
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
logger.debug("RX ZCL: {}", zclHeader);
// Get the command type
ZclCommandType commandType = null;
if (zclHeader.getFrameType() == ZclFrameType.ENTIRE_PROFILE_COMMAND) {
commandType = ZclCommandType.getGeneric(zclHeader.getCommandId());
} else {
commandType = ZclCommandType.getCommandType(apsFrame.getCluster(), zclHeader.getCommandId(),
zclHeader.getDirection());
}
if (commandType == null) {
logger.debug("No command type found for {}, cluster={}, command={}, direction={}", zclHeader.getFrameType(),
apsFrame.getCluster(), zclHeader.getCommandId(), zclHeader.getDirection());
return null;
}
ZclCommand command = commandType.instantiateCommand();
if (command == null) {
logger.debug("No command found for {}, cluster={}, command={}", zclHeader.getFrameType(),
apsFrame.getCluster(), zclHeader.getCommandId());
return null;
}
command.setCommandDirection(zclHeader.getDirection());
command.deserialize(fieldDeserializer);
command.setClusterId(apsFrame.getCluster());
command.setTransactionId(zclHeader.getSequenceNumber());
return command;
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
ZclHeader zclHeader = new ZclHeader();
zclHeader.setFrameType(zclCommand.isGenericCommand() ? ZclFrameType.ENTIRE_PROFILE_COMMAND
: ZclFrameType.CLUSTER_SPECIFIC_COMMAND);
zclHeader.setCommandId(zclCommand.getCommandId());
zclHeader.setSequenceNumber(command.getTransactionId());
zclHeader.setDirection(zclCommand.getCommandDirection());
apsFrame.setPayload(zclHeader.serialize(fieldSerializer, fieldSerializer.getPayload()));
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void test() {
int[] packet = getPacketData("09 7B 00 24 00 00 00 00 00");
ZoneStatusChangeNotificationCommand command = new ZoneStatusChangeNotificationCommand();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
command.deserialize(fieldDeserializer);
System.out.println(command);
assertEquals(Integer.valueOf(0x500), command.getClusterId());
assertEquals(Integer.valueOf(36), command.getZoneStatus());
}
代码示例来源: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());
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void deserialize() {
int[] packet = getPacketData("01 12 40 00 00");
OffWithEffectCommand command = new OffWithEffectCommand();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
command.deserialize(fieldDeserializer);
System.out.println(command);
assertEquals(Integer.valueOf(0), command.getEffectIdentifier());
assertEquals(Integer.valueOf(0), command.getEffectVariant());
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testDeserialize() {
int[] packet = getPacketData("11 04 01");
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
assertEquals(1, zclHeader.getCommandId());
assertEquals(ZclFrameType.CLUSTER_SPECIFIC_COMMAND, zclHeader.getFrameType());
assertEquals(false, zclHeader.isManufacturerSpecific());
assertEquals(true, zclHeader.isDisableDefaultResponse());
assertEquals(4, zclHeader.getSequenceNumber());
DefaultSerializer serializer = new DefaultSerializer();
ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
assertTrue(Arrays.equals(packet, zclHeader.serialize(fieldSerializer, new int[] {})));
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void test() {
int[] packet = getPacketData("09 63 01 0D 00 4E 10");
ZoneEnrollRequestCommand command = new ZoneEnrollRequestCommand();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
command.deserialize(fieldDeserializer);
System.out.println(command);
assertEquals(Integer.valueOf(0x500), command.getClusterId());
assertEquals(Integer.valueOf(13), command.getZoneType());
assertEquals(Integer.valueOf(4174), command.getManufacturerCode());
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testDeserialize2() {
int[] packet = getPacketData("08 99 88");
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
assertEquals(0x88, zclHeader.getCommandId());
assertEquals(ZclFrameType.ENTIRE_PROFILE_COMMAND, zclHeader.getFrameType());
assertEquals(false, zclHeader.isManufacturerSpecific());
assertEquals(false, zclHeader.isDisableDefaultResponse());
assertEquals(0x99, zclHeader.getSequenceNumber());
DefaultSerializer serializer = new DefaultSerializer();
ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
assertTrue(Arrays.equals(packet, zclHeader.serialize(fieldSerializer, new int[] {})));
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testStatusOnly() {
int[] packet = getPacketData("18 11 07 00");
ConfigureReportingResponse response = new ConfigureReportingResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
response.deserialize(fieldDeserializer);
System.out.println(response);
assertEquals(ZclStatus.SUCCESS, response.getStatus());
assertNull(response.getRecords());
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void test() {
int[] packet = getPacketData("18 1B 07 00 00 00 00");
ConfigureReportingResponse response = new ConfigureReportingResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
response.deserialize(fieldDeserializer);
System.out.println(response);
assertNull(response.getStatus());
assertEquals(1, response.getRecords().size());
AttributeStatusRecord record = response.getRecords().get(0);
assertEquals(0, record.getAttributeIdentifier());
assertEquals(ZclStatus.SUCCESS, record.getStatus());
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testErrorInvalidDataType() {
int[] packet = getPacketData("08 6C 07 8D 00 00 00");
ConfigureReportingResponse response = new ConfigureReportingResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
System.out.println(zclHeader);
response.deserialize(fieldDeserializer);
System.out.println(response);
assertNull(response.getStatus());
assertEquals(1, response.getRecords().size());
AttributeStatusRecord record = response.getRecords().get(0);
assertEquals(0, record.getAttributeIdentifier());
assertEquals(ZclStatus.INVALID_DATA_TYPE, record.getStatus());
}
}
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeApsFrame类的一些代码示例,展示了ZigBeeApsFrame类的具体用法。这些代码示例主要来源于Github/
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeEndpointAddress类的一些代码示例,展示了ZigBeeEndpointAddress类的具体用法。这些代码
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeChannel类的一些代码示例,展示了ZigBeeChannel类的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeNetworkManager类的一些代码示例,展示了ZigBeeNetworkManager类的具体用法。这些代码示例
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeEndpoint类的一些代码示例,展示了ZigBeeEndpoint类的具体用法。这些代码示例主要来源于Github/
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeNode类的一些代码示例,展示了ZigBeeNode类的具体用法。这些代码示例主要来源于Github/Stackove
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeProfileType类的一些代码示例,展示了ZigBeeProfileType类的具体用法。这些代码示例主要来源于G
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeAddress类的一些代码示例,展示了ZigBeeAddress类的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeGroupAddress类的一些代码示例,展示了ZigBeeGroupAddress类的具体用法。这些代码示例主要来源
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeCommand类的一些代码示例,展示了ZigBeeCommand类的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeNetworkNodeListener类的一些代码示例,展示了ZigBeeNetworkNodeListener类的具
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeBroadcastDestination类的一些代码示例,展示了ZigBeeBroadcastDestination类
本文整理了Java中com.zsmartsystems.zigbee.ZigBeeStackType类的一些代码示例,展示了ZigBeeStackType类的具体用法。这些代码示例主要来源于Githu
本文整理了Java中com.zsmartsystems.zigbee.security.ZigBeeKey类的一些代码示例,展示了ZigBeeKey类的具体用法。这些代码示例主要来源于Github/S
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclStatus类的一些代码示例,展示了ZclStatus类的具体用法。这些代码示例主要来源于Github/Stacko
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute类的一些代码示例,展示了ZclAttribute类的具体用法。这些代码示例主要来源于Github/
本文整理了Java中com.zsmartsystems.zigbee.transport.ZigBeeTransportTransmit类的一些代码示例,展示了ZigBeeTransportTrans
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclCluster类的一些代码示例,展示了ZclCluster类的具体用法。这些代码示例主要来源于Github/Stac
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclTransactionMatcher类的一些代码示例,展示了ZclTransactionMatcher类的具体用法。
本文整理了Java中com.zsmartsystems.zigbee.dao.ZigBeeNodeDao类的一些代码示例,展示了ZigBeeNodeDao类的具体用法。这些代码示例主要来源于Githu
我是一名优秀的程序员,十分优秀!