use of com.zsmartsystems.zigbee.zcl.protocol.ZclClusterType in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeEndpoint method getClusterClass.
private ZclCluster getClusterClass(int clusterId) {
ZclClusterType clusterType = ZclClusterType.getValueById(clusterId);
if (clusterType == null) {
// Unsupported cluster
logger.debug("{}: Unsupported cluster {}", getEndpointAddress(), clusterId);
return null;
}
// Create a cluster class
ZclCluster cluster = null;
Constructor<? extends ZclCluster> constructor;
// try {
try {
constructor = clusterType.getClusterClass().getConstructor(ZigBeeNetworkManager.class, ZigBeeEndpoint.class);
cluster = constructor.newInstance(networkManager, this);
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
logger.debug("{}: Error instantiating cluster {}", getEndpointAddress(), clusterType);
return null;
}
return cluster;
}
Aggregations