Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: send card information towards CardDisconnected event #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Lando/Cardreader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ internal virtual void OnCardConnected(object sender, WatcherCardEventArgs e)

internal virtual void OnCardDisconnected(object sender, WatcherCardEventArgs e)
{
var card = new ContactlessCard(e.Card);

Logger.TraceEvent(TraceEventType.Verbose, 0, "Cardreader: Save invocation of CardDisconnected");
Logger.Flush();

CardDisconnected.SafeInvoke(this, new CardreaderEventArgs((string)null));
CardDisconnected.SafeInvoke(this, new CardreaderEventArgs(card, e.Card.CardreaderName);
}
}
}
6 changes: 3 additions & 3 deletions src/Lando/Watcher/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private void Watch()

// reset previously connected card and raise the card connected event
ForgotAboutCardreaderHadCard(cardreaderStatus.Name);
RaiseCardDisconnectedEvent();
RaiseCardDisconnectedEvent(currentCard);
}
}
if (newStatuses.Contains(CardreaderStatus.StatusType.CardreaderDisconnected))
Expand Down Expand Up @@ -256,12 +256,12 @@ private void RaiseCardConnectedEvent(Card connectedLowlevelCard)
AsyncOperation.Post(cb, null);
}

private void RaiseCardDisconnectedEvent()
private void RaiseCardDisconnectedEvent(Card connectedLowlevelCard)
{
Logger.TraceEvent(TraceEventType.Verbose, 0, "Raising CardDisconnected event");
Logger.Flush();

SendOrPostCallback cb = state => CardDisconnected(null, new WatcherCardEventArgs());
SendOrPostCallback cb = state => CardDisconnected(null, new WatcherCardEventArgs(connectedLowlevelCard));
AsyncOperation.Post(cb, null);
}

Expand Down