use of com.zsmartsystems.zigbee.dongle.telegesis.internal.protocol.TelegesisNetworkLeftEvent in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeDongleTelegesis method telegesisEventReceived.
@Override
public void telegesisEventReceived(TelegesisEvent event) {
if (event instanceof TelegesisReceiveMessageEvent) {
TelegesisReceiveMessageEvent rxMessage = (TelegesisReceiveMessageEvent) event;
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
// apsFrame.setApsCounter(emberApsFrame.getSequence());
apsFrame.setCluster(rxMessage.getClusterId());
apsFrame.setDestinationEndpoint(rxMessage.getDestinationEp());
apsFrame.setProfile(rxMessage.getProfileId());
apsFrame.setSourceEndpoint(rxMessage.getSourceEp());
apsFrame.setSourceAddress(rxMessage.getNetworkAddress());
apsFrame.setPayload(rxMessage.getMessageData());
zigbeeTransportReceive.receiveCommand(apsFrame);
return;
}
// Handle devices joining and leaving
if (event instanceof TelegesisDeviceJoinedNetworkEvent) {
TelegesisDeviceJoinedNetworkEvent deviceJoinedEvent = (TelegesisDeviceJoinedNetworkEvent) event;
zigbeeTransportReceive.nodeStatusUpdate(ZigBeeNodeStatus.UNSECURED_JOIN, deviceJoinedEvent.getNetworkAddress(), deviceJoinedEvent.getIeeeAddress());
return;
}
if (event instanceof TelegesisDeviceLeftNetworkEvent) {
TelegesisDeviceLeftNetworkEvent deviceLeftEvent = (TelegesisDeviceLeftNetworkEvent) event;
zigbeeTransportReceive.nodeStatusUpdate(ZigBeeNodeStatus.DEVICE_LEFT, deviceLeftEvent.getNetworkAddress(), deviceLeftEvent.getIeeeAddress());
return;
}
// Handle link changes and notify framework or just reset link with dongle?
if (event instanceof TelegesisNetworkLeftEvent | event instanceof TelegesisNetworkLostEvent) {
zigbeeTransportReceive.setNetworkState(ZigBeeTransportState.OFFLINE);
return;
}
if (event instanceof TelegesisNetworkJoinedEvent) {
zigbeeTransportReceive.setNetworkState(ZigBeeTransportState.ONLINE);
return;
}
logger.debug("Unhandled Telegesis Frame: {}", event.toString());
}
Aggregations