本文整理了Java中com.zsmartsystems.zigbee.serialization.ZigBeeSerializer
类的一些代码示例,展示了ZigBeeSerializer
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZigBeeSerializer
类的具体详情如下:
包路径:com.zsmartsystems.zigbee.serialization.ZigBeeSerializer
类名称:ZigBeeSerializer
[英]The interface for serialization of a ZCL frame to array of integers
[中]将ZCL帧序列化为整数数组的接口
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Gets payload.
*
* @return the payload
*/
public int[] getPayload() {
return serializer.getPayload();
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(value, ZclDataType.UNSIGNED_16_BIT_INTEGER);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testSendEndpoint2() {
MatchDescriptorResponse matchResponse = new MatchDescriptorResponse();
matchResponse.setStatus(ZdoStatus.SUCCESS);
List<Integer> matchList = new ArrayList<Integer>();
matchList.add(1);
matchList.add(2);
matchResponse.setMatchList(matchList);
matchResponse.setDestinationAddress(new ZigBeeEndpointAddress(1234, 5));
matchResponse.setNwkAddrOfInterest(1234);
System.out.println(matchResponse);
ZigBeeSerializer serializer = new DefaultSerializer();
ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
matchResponse.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("00 00 D2 04 02 01 02"), serializer.getPayload()));
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(neighborAddress, ZclDataType.IEEE_ADDRESS);
serializer.appendZigBeeType((short) coordinate1, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType((short) coordinate2, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType((short) coordinate3, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType((byte) rssi, ZclDataType.UNSIGNED_8_BIT_INTEGER);
serializer.appendZigBeeType((byte) measurementCount, ZclDataType.UNSIGNED_8_BIT_INTEGER);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testSendEndpoint1() {
MatchDescriptorResponse matchResponse = new MatchDescriptorResponse();
matchResponse.setStatus(ZdoStatus.SUCCESS);
List<Integer> matchList = new ArrayList<Integer>();
matchList.add(1);
matchResponse.setMatchList(matchList);
matchResponse.setDestinationAddress(new ZigBeeEndpointAddress(1234, 5));
matchResponse.setNwkAddrOfInterest(1234);
System.out.println(matchResponse);
ZigBeeSerializer serializer = new DefaultSerializer();
ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
matchResponse.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("00 00 D2 04 01 01"), serializer.getPayload()));
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(status, ZclDataType.UNSIGNED_8_BIT_INTEGER);
if (status == ZclStatus.SUCCESS) {
serializer.appendZigBeeType(direction, ZclDataType.BOOLEAN);
serializer.appendZigBeeType(attributeIdentifier, ZclDataType.UNSIGNED_16_BIT_INTEGER);
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
command.setPayloadType(0);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("00 48"), serializer.getPayload()));
command.setPayloadType(1);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("01 48 0C 11"), serializer.getPayload()));
command.setPayloadType(1);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("01 48 0C 11"), serializer.getPayload()));
command.setPayloadType(2);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("02 48 0C 11 06 00"), serializer.getPayload()));
command.setPayloadType(3);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("03 48 0C 11 06 00 07 03 02 01"), serializer.getPayload()));
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(status, ZclDataType.UNSIGNED_8_BIT_INTEGER);
serializer.appendZigBeeType(attributeIdentifier, ZclDataType.UNSIGNED_16_BIT_INTEGER);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(identifier, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType(dataType, ZclDataType.UNSIGNED_8_BIT_INTEGER);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(srcAddr, ZclDataType.IEEE_ADDRESS);
serializer.appendZigBeeType(srcEndpoint, ZclDataType.UNSIGNED_8_BIT_INTEGER);
serializer.appendZigBeeType(clusterId, ZclDataType.CLUSTERID);
serializer.appendZigBeeType(dstAddrMode, ZclDataType.UNSIGNED_8_BIT_INTEGER);
if (dstAddrMode == 1) {
serializer.appendZigBeeType(dstGroupAddr, ZclDataType.UNSIGNED_16_BIT_INTEGER);
} else if (dstAddrMode == 3) {
serializer.appendZigBeeType(dstAddr, ZclDataType.IEEE_ADDRESS);
serializer.appendZigBeeType(dstNodeEndpoint, ZclDataType.UNSIGNED_8_BIT_INTEGER);
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(clusterId, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType(data, ZclDataType.UNSIGNED_8_BIT_INTEGER_ARRAY);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(attributeIdentifier, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType(attributeDataType, ZclDataType.UNSIGNED_8_BIT_INTEGER);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(direction, ZclDataType.UNSIGNED_8_BIT_INTEGER);
serializer.appendZigBeeType(attributeIdentifier, ZclDataType.UNSIGNED_16_BIT_INTEGER);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(value, ZclDataType.UNSIGNED_8_BIT_INTEGER);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType((short) attributeIdentifier, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType(status, ZclDataType.ZCL_STATUS);
serializer.appendZigBeeType((byte) attributeDataType.getId(), ZclDataType.UNSIGNED_8_BIT_INTEGER);
serializer.appendZigBeeType(attributeValue, attributeDataType);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(attributeIdentifier, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType(attributeDataType.getId(), ZclDataType.UNSIGNED_8_BIT_INTEGER);
serializer.appendZigBeeType(attributeValue, attributeDataType);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(attributeIdentifier, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType(attributeDataType.getId(), ZclDataType.UNSIGNED_8_BIT_INTEGER);
serializer.appendZigBeeType(attributeValue, attributeDataType);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void serialize(final ZigBeeSerializer serializer) {
serializer.appendZigBeeType(direction, ZclDataType.UNSIGNED_8_BIT_INTEGER);
serializer.appendZigBeeType(attributeIdentifier, ZclDataType.UNSIGNED_16_BIT_INTEGER);
if (direction == 1) {
// If direction is set to 0x01, then the timeout period field is included in the payload,
// and the attribute data type field, the minimum reporting interval field, the
// maximum reporting interval field and the reportable change field are omitted. The
// record is sent to a cluster client (or server) to configure how it should expect
// reports from a server (or client) of the same cluster.
serializer.appendZigBeeType(timeoutPeriod, ZclDataType.UNSIGNED_16_BIT_INTEGER);
} else {
// If direction is set to 0x00, then the attribute data type field, the minimum
// reporting interval field, the maximum reporting interval field and the reportable
// change field are included in the payload, and the timeout period field is omitted.
// The record is sent to a cluster server (or client) to configure how it sends reports to
// a client (or server) of the same cluster.
serializer.appendZigBeeType(attributeDataType.getId(), ZclDataType.UNSIGNED_8_BIT_INTEGER);
serializer.appendZigBeeType(minimumReportingInterval, ZclDataType.UNSIGNED_16_BIT_INTEGER);
serializer.appendZigBeeType(maximumReportingInterval, ZclDataType.UNSIGNED_16_BIT_INTEGER);
// The reportable change field shall contain the minimum change to the attribute that
// will result in a report being issued. This field is of variable length. For attributes
// with 'analog' data typethe field has the same data type as the attribute. The sign (if any) of the
// reportable change field is ignored. For attributes of 'discrete' data type this field is omitted.
if (attributeDataType.isAnalog()) {
serializer.appendZigBeeType(reportableChange, attributeDataType);
}
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Serializes field value.
*
* @param value the field value
* @param dataType the data type
*/
public void serialize(final Object value, final ZclDataType dataType) {
if (ZclListItemField.class.isAssignableFrom(dataType.getDataClass())) {
final List<ZclListItemField> list = (List<ZclListItemField>) value;
for (final ZclListItemField item : list) {
item.serialize(serializer);
}
return;
}
serializer.appendZigBeeType(value, dataType);
}
内容来源于网络,如有侵权,请联系作者删除!