Search in sources :

Example 6 with ZclCommand

use of com.zsmartsystems.zigbee.zcl.ZclCommand in project com.zsmartsystems.zigbee by zsmartsystems.

the class ZigBeeNetworkDiscoverer method commandReceived.

@Override
public void commandReceived(final ZigBeeCommand command) {
    // ZCL command received from remote node. Perform discovery if it is not yet known.
    if (command instanceof ZclCommand) {
        final ZclCommand zclCommand = (ZclCommand) command;
        if (networkManager.getNode(zclCommand.getSourceAddress().getAddress()) == null) {
            // TODO: Protect against group address?
            ZigBeeEndpointAddress address = (ZigBeeEndpointAddress) zclCommand.getSourceAddress();
            startNodeDiscovery(address.getAddress());
        }
    }
    // Node has been announced.
    if (command instanceof DeviceAnnounce) {
        final DeviceAnnounce announce = (DeviceAnnounce) command;
        // startNodeDiscovery(address.getNwkAddrOfInterest());
        addNode(announce.getIeeeAddr(), announce.getNwkAddrOfInterest());
    }
}
Also used : ZigBeeEndpointAddress(com.zsmartsystems.zigbee.ZigBeeEndpointAddress) DeviceAnnounce(com.zsmartsystems.zigbee.zdo.command.DeviceAnnounce) ZclCommand(com.zsmartsystems.zigbee.zcl.ZclCommand)

Aggregations

ZclCommand (com.zsmartsystems.zigbee.zcl.ZclCommand)6 ZigBeeEndpointAddress (com.zsmartsystems.zigbee.ZigBeeEndpointAddress)2 ZclHeader (com.zsmartsystems.zigbee.zcl.ZclHeader)2 Test (org.junit.Test)2 ZigBeeSerializer (com.zsmartsystems.zigbee.serialization.ZigBeeSerializer)1 ZclFieldSerializer (com.zsmartsystems.zigbee.zcl.ZclFieldSerializer)1 AddGroupCommand (com.zsmartsystems.zigbee.zcl.clusters.groups.AddGroupCommand)1 OffCommand (com.zsmartsystems.zigbee.zcl.clusters.onoff.OffCommand)1 ZclCommandType (com.zsmartsystems.zigbee.zcl.protocol.ZclCommandType)1 ZdoCommand (com.zsmartsystems.zigbee.zdo.ZdoCommand)1 BindRequest (com.zsmartsystems.zigbee.zdo.command.BindRequest)1 BindResponse (com.zsmartsystems.zigbee.zdo.command.BindResponse)1 DeviceAnnounce (com.zsmartsystems.zigbee.zdo.command.DeviceAnnounce)1 MatchDescriptorRequest (com.zsmartsystems.zigbee.zdo.command.MatchDescriptorRequest)1 MatchDescriptorResponse (com.zsmartsystems.zigbee.zdo.command.MatchDescriptorResponse)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1