use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeNodeTest method getNeighborTable.
private NeighborTable getNeighborTable(int[] packet) {
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
NeighborTable neighbor = new NeighborTable();
neighbor.deserialize(deserializer);
return neighbor;
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclHeaderTest method testDeserialize2.
@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[] {})));
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class ConfigureReportingResponseTest method testErrorInvalidDataType.
@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());
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class NetworkAddressResponseTest method testReceive.
@Test
public void testReceive() {
int[] packet = getPacketData("00 00 43 1D A5 00 AA 3E B0 7C 74 3B");
NetworkAddressResponse addressResponse = new NetworkAddressResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
addressResponse.deserialize(fieldDeserializer);
System.out.println(addressResponse);
assertEquals(new IeeeAddress("7CB03EAA00A51D43"), addressResponse.getIeeeAddrRemoteDev());
assertEquals(0x8000, (int) addressResponse.getClusterId());
assertEquals(ZdoStatus.SUCCESS, addressResponse.getStatus());
}
use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.
the class PowerDescriptorResponseTest method testReceive.
@Test
public void testReceive() {
int[] packet = getPacketData("00 00 00 00 10 C1");
PowerDescriptorResponse descriptorResponse = new PowerDescriptorResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
descriptorResponse.deserialize(fieldDeserializer);
System.out.println(descriptorResponse);
PowerDescriptor powerDescriptor = descriptorResponse.getPowerDescriptor();
assertEquals(ZdoStatus.SUCCESS, descriptorResponse.getStatus());
assertEquals(PowerLevelType.FULL, powerDescriptor.getPowerLevel());
assertEquals(CurrentPowerModeType.RECEIVER_ON_IDLE, powerDescriptor.getCurrentPowerMode());
assertEquals(PowerSourceType.MAINS, powerDescriptor.getCurrentPowerSource());
}
Aggregations