Subscribing to Events - PyramidTechnologies/netPyramid-RS-232 GitHub Wiki

Events and Interesting Things

If you've followed this tutorial from the beginning, you should have code that enables the bill validator and allows for all valid notes to accept... but you are not seeing any events!

Events subscription is simple. Select which event(s) you are interested in from the available events as listed in our documentation and add a handler. A quick overview of the important events:

  • OnCredit - Raised when the acceptor has stacked a note which means credit is safe to issue
  • OnError - Raised when an error state is encountered. See the documentation for Errors for explanation of each error.

`

// Using previous code in previous wiki page
... 

// Configure events and state (All optional) - see StateAndEvents_Sample.cs
validator.OnEvent += validator_OnEvent;
validator.OnStateChanged += validator_OnStateChanged;
validator.OnError += validator_OnError;
validator.OnCashboxAttached += validator_CashboxAttached;

// Required if you are in escrow mode - see CreditAndEscrow_Sample.cs
validator.OnEscrow += validator_OnEscrow;

// Technically optional but you probably want this event - see CreditAndEscrow_Sample.cs
validator.OnCredit += validator_OnCredit;

...

`