@@ -0,0 +1,2585 @@
+/****************************************************************************%0A * Copyright (C) 2018 ecsec GmbH.%0A * All rights reserved.%0A * Contact: ecsec GmbH (info@ecsec.de)%0A * %0A * This file is part of the Open eCard App.%0A * %0A * GNU General Public License Usage%0A * This file may be used under the terms of the GNU General Public%0A * License version 3.0 as published by the Free Software Foundation%0A * and appearing in the file LICENSE.GPL included in the packaging of%0A * this file. Please review the following information to ensure the%0A * GNU General Public License version 3.0 requirements will be met:%0A * http://www.gnu.org/copyleft/gpl.html.%0A * %0A * Other Usage%0A * Alternatively, this file may be used in accordance with the terms%0A * and conditions contained in a signed written agreement between%0A * you and ecsec GmbH.%0A * %0A ***************************************************************************/%0A%0Apackage org.openecard.plugins.pinplugin.gui;%0A%0Aimport iso.std.iso_iec._24727.tech.schema.ConnectionHandleType;%0Aimport java.math.BigInteger;%0Aimport javax.annotation.Nonnull;%0Aimport org.openecard.common.event.EventType;%0Aimport org.openecard.common.event.IfdEventObject;%0Aimport org.openecard.common.interfaces.EventFilter;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A/**%0A *%0A * @author Sebastian Schuberth%0A */%0Apublic class CardRemovedFilter implements EventFilter %7B%0A%0A    private static final Logger LOG = LoggerFactory.getLogger(CardRemovedFilter.class);%0A%0A    private final String ifdName;%0A    private final BigInteger slotIdx;%0A%0A    public CardRemovedFilter(@Nonnull String ifdName, @Nonnull BigInteger slotIdx) %7B%0A%09this.ifdName = ifdName;%0A%09this.slotIdx = slotIdx;%0A    %7D%0A%0A    @Override%0A    public boolean matches(EventType t, Object o) %7B%0A%09LOG.debug(%22Received event.%22);%0A%09if (t.equals(EventType.CARD_REMOVED)) %7B%0A%09    LOG.debug(%22Received CARD_REMOVED event.%22);%0A%09    ConnectionHandleType conHandle = null;%0A%09    boolean reset = false;%0A%09    if (o instanceof IfdEventObject) %7B%0A%09%09conHandle = ((IfdEventObject) o).getHandle();%0A%09%09reset = ((IfdEventObject) o).cardWasReset();%0A%09    %7D else if (o instanceof ConnectionHandleType) %7B%0A%09%09conHandle = (ConnectionHandleType) o;%0A%09    %7D%0A%09    %0A%09    if(reset)%7B%0A%09%09LOG.info(%22Card was reset -%3E ignore%22);%0A%09    %7D else %7B%0A%09%09if (conHandle != null && ifdName.equals(conHandle.getIFDName()) && slotIdx.equals(conHandle.getSlotIndex())) %7B%0A%09%09    LOG.info(%22Card removed during processing of PIN Management GUI.%22);%0A%09%09    return true;%0A%09%09%7D else %7B%0A%09%09    LOG.debug(%22An unrelated card has been removed.%22);%0A%09%09    return false;%0A%09%09%7D%0A%09    %7D%0A%09%7D%0A%0A%09return false;%0A    %7D%0A%0A%7D%0A

Add filter for card removed event