use of com.zsmartsystems.zigbee.zcl.ZclFieldSerializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ConfigureReportingCommandTest method testSingle.
@Test
public void testSingle() {
int[] packet = getPacketData("00 00 00 10 01 00 58 02");
AttributeReportingConfigurationRecord record = new AttributeReportingConfigurationRecord();
record.setAttributeIdentifier(0);
record.setAttributeDataType(ZclDataType.BOOLEAN);
record.setDirection(0);
record.setTimeoutPeriod(0);
record.setMinimumReportingInterval(1);
record.setMaximumReportingInterval(600);
ConfigureReportingCommand command = new ConfigureReportingCommand();
command.setClusterId(6);
command.setDestinationAddress(new ZigBeeEndpointAddress(31084, 18));
command.setRecords(Arrays.asList(record));
command.setTransactionId(23);
System.out.println(command);
DefaultSerializer serializer = new DefaultSerializer();
ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(packet, serializer.getPayload()));
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldSerializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class MatchDescriptorResponseTest method testSendEndpoint2.
@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()));
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldSerializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class MatchDescriptorResponseTest method testSendEndpoint1.
@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()));
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldSerializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ReadAttributesCommandTest method testSingle.
@Test
public void testSingle() {
int[] packet = getPacketData("04 00");
ReadAttributesCommand command = new ReadAttributesCommand();
command.setClusterId(0);
command.setDestinationAddress(new ZigBeeEndpointAddress(57337, 3));
command.setIdentifiers(Arrays.asList(4));
command.setTransactionId(1);
DefaultSerializer serializer = new DefaultSerializer();
ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(packet, serializer.getPayload()));
}
use of com.zsmartsystems.zigbee.zcl.ZclFieldSerializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ImageNotifyCommandTest method testSend.
@Test
public void testSend() {
ImageNotifyCommand command = new ImageNotifyCommand();
command.setSourceAddress(new ZigBeeEndpointAddress(0, 1));
command.setDestinationAddress(new ZigBeeEndpointAddress(57337, 3));
command.setImageType(6);
command.setQueryJitter(72);
command.setManufacturerCode(4364);
command.setNewFileVersion(16909063);
System.out.println(command);
ZigBeeSerializer serializer = new DefaultSerializer();
ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
command.setPayloadType(0);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("00 48"), serializer.getPayload()));
serializer = new DefaultSerializer();
fieldSerializer = new ZclFieldSerializer(serializer);
command.setPayloadType(1);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("01 48 0C 11"), serializer.getPayload()));
serializer = new DefaultSerializer();
fieldSerializer = new ZclFieldSerializer(serializer);
command.setPayloadType(1);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("01 48 0C 11"), serializer.getPayload()));
serializer = new DefaultSerializer();
fieldSerializer = new ZclFieldSerializer(serializer);
command.setPayloadType(2);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("02 48 0C 11 06 00"), serializer.getPayload()));
serializer = new DefaultSerializer();
fieldSerializer = new ZclFieldSerializer(serializer);
command.setPayloadType(3);
command.serialize(fieldSerializer);
assertTrue(Arrays.equals(getPacketData("03 48 0C 11 06 00 07 03 02 01"), serializer.getPayload()));
}
Aggregations