use of com.zsmartsystems.zigbee.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclClusterTest method getClusterName.
@Test
public void getClusterName() {
createNetworkManager();
ZigBeeNode node = new ZigBeeNode(networkManager, new IeeeAddress());
node.setNetworkAddress(1234);
ZigBeeEndpoint device = new ZigBeeEndpoint(networkManager, node, 5);
ZclCluster cluster = new ZclLevelControlCluster(networkManager, device);
assertEquals("Level Control", cluster.getClusterName());
}
use of com.zsmartsystems.zigbee.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclClusterTest method getClusterId.
@Test
public void getClusterId() {
createNetworkManager();
ZigBeeNode node = new ZigBeeNode(networkManager, new IeeeAddress());
node.setNetworkAddress(1234);
ZigBeeEndpoint device = new ZigBeeEndpoint(networkManager, node, 5);
ZclCluster cluster = new ZclOnOffCluster(networkManager, device);
assertEquals(Integer.valueOf(6), cluster.getClusterId());
}
use of com.zsmartsystems.zigbee.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclClusterTest method setReporting.
@Test
public void setReporting() {
createNetworkManager();
ZigBeeNode node = new ZigBeeNode(networkManager, new IeeeAddress());
node.setNetworkAddress(1234);
ZigBeeEndpoint device = new ZigBeeEndpoint(networkManager, node, 5);
ZclCluster cluster = new ZclOnOffCluster(networkManager, device);
ZclAttribute attribute = cluster.getAttribute(0);
cluster.setReporting(attribute, 22, 33);
assertEquals(1, commandCapture.getAllValues().size());
ZigBeeCommand command = commandCapture.getValue();
assertNotNull(command);
System.out.println(command);
assertTrue(command instanceof ConfigureReportingCommand);
ConfigureReportingCommand cfgCommand = (ConfigureReportingCommand) command;
assertEquals(1, cfgCommand.getRecords().size());
AttributeReportingConfigurationRecord record = cfgCommand.getRecords().get(0);
assertEquals(0, record.getAttributeIdentifier());
assertEquals(0, record.getDirection());
}
use of com.zsmartsystems.zigbee.IeeeAddress 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.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class NeighborTableTest method getNeighborTable.
private NeighborTable getNeighborTable(Integer networkAddress, String ieeeAddressString, Integer lqi) {
NeighborTable neighbor = new NeighborTable();
try {
IeeeAddress ieeeAddress = new IeeeAddress(ieeeAddressString);
Field fieldNetworkAddress = NeighborTable.class.getDeclaredField("networkAddress");
fieldNetworkAddress.setAccessible(true);
fieldNetworkAddress.set(neighbor, networkAddress);
Field fieldExtendedAddress = NeighborTable.class.getDeclaredField("extendedAddress");
fieldExtendedAddress.setAccessible(true);
fieldExtendedAddress.set(neighbor, ieeeAddress);
Field fieldLqi = NeighborTable.class.getDeclaredField("lqi");
fieldLqi.setAccessible(true);
fieldLqi.set(neighbor, lqi);
} catch (IllegalAccessException | IllegalArgumentException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
return neighbor;
}
Aggregations