diff --git a/Apex7000_BillValidator/ApexValidator.cs b/Apex7000_BillValidator/ApexValidator.cs
index 86db775..5f5e07e 100644
--- a/Apex7000_BillValidator/ApexValidator.cs
+++ b/Apex7000_BillValidator/ApexValidator.cs
@@ -49,6 +49,20 @@ public partial class ApexValidator : IDisposable
// Time at which escrow starts
private DateTime escrowStart = DateTime.MinValue;
+ ///
+ /// Slave's last state
+ ///
+ public States PreviousState { get; private set; }
+
+ ///
+ /// Slave's last events
+ ///
+ public Events PreviousEvents { get; private set; }
+
+ ///
+ /// Returns true if the communication thread is running normally
+ ///
+ public bool IsRunning { get; private set; }
#endregion
///
@@ -77,7 +91,7 @@ public static List GetAvailablePorts()
public void Close()
{
// This will kill the comms loop
- config.IsRunning = false;
+ IsRunning = false;
if(port != null)
port.Disconnect();
@@ -173,7 +187,7 @@ private void Reconnect()
private void startRS232Loop()
{
- if (config.IsRunning)
+ if (IsRunning)
{
log.Error("Already running RS-232 Comm loop... Exiting now...");
return;
@@ -184,10 +198,10 @@ private void startRS232Loop()
Thread speakThread = new Thread((fn) =>
{
- config.IsRunning = true;
+ IsRunning = true;
// Set toggle flag so we can kill this loop
- while (config.IsRunning)
+ while (IsRunning)
{
if (resetRequested)
@@ -265,7 +279,7 @@ private void speakToSlave()
// Translate raw bytes into friendly enums
var slaveMessage = SlaveCodex.ToSlaveMessage(resp);
- config.PreviousState = SlaveCodex.GetState(slaveMessage);
+ PreviousState = SlaveCodex.GetState(slaveMessage);
// Raise a state changed notice for clients
@@ -303,11 +317,11 @@ private void speakToSlave()
// Mask away rest of message to see if a note is in escrow. If this is the first
// escrow message, start the escrow timeout clock
- if(!NoteIsEscrowed && config.PreviousState == States.Escrowed)
+ if(!NoteIsEscrowed && PreviousState == States.Escrowed)
{
escrowStart = DateTime.MinValue;
}
- NoteIsEscrowed = (config.PreviousState == States.Escrowed);
+ NoteIsEscrowed = (PreviousState == States.Escrowed);
// Credit bits are 3-5 of data byte 3
var value = SlaveCodex.GetCredit(slaveMessage);
@@ -321,7 +335,7 @@ private void speakToSlave()
// sent by the slave. If the previous event was stacked or returned, we
// must clear the escrow command to completely release the note from
// escrow state.
- switch(config.PreviousEvents)
+ switch(PreviousEvents)
{
case Events.Stacked:
NotifyCredit(Credit);
@@ -337,7 +351,7 @@ private void speakToSlave()
}
// Update the events aster the check for check so as to not lose a credit message
- config.PreviousEvents = currentEvents;
+ PreviousEvents = currentEvents;
}
diff --git a/Apex7000_BillValidator/RS232Config.cs b/Apex7000_BillValidator/RS232Config.cs
index 467a43a..264359d 100644
--- a/Apex7000_BillValidator/RS232Config.cs
+++ b/Apex7000_BillValidator/RS232Config.cs
@@ -80,21 +80,6 @@ public int PollRate
/// Default value is false
public bool IsEscrowMode { get; set; }
- ///
- /// Slave's last state
- ///
- public States PreviousState { get; internal set; }
-
- ///
- /// Slave's last events
- ///
- public Events PreviousEvents { get; internal set; }
-
- ///
- /// Returns true if the communication thread is running normally
- ///
- public bool IsRunning { get; internal set; }
-
///
/// Gets or sets the timeout for escrow mode. By default, we wait indefinately but
/// you may configure this to a non-zero value to enable escrow timeouts. This has the effect
diff --git a/Apex7000_BillValidator_Test/UsageAndRegistration_Sample.cs b/Apex7000_BillValidator_Test/UsageAndRegistration_Sample.cs
index 4463906..871c6fe 100644
--- a/Apex7000_BillValidator_Test/UsageAndRegistration_Sample.cs
+++ b/Apex7000_BillValidator_Test/UsageAndRegistration_Sample.cs
@@ -62,7 +62,7 @@ private void btnConnect_Click(object sender, RoutedEventArgs e)
validator.OnCashboxAttached += validator_CashboxAttached;
// Required if you are in escrow mode - see CreditAndEscrow_Sample.cs
- validator.OnEscrowed += validator_OnEscrow;
+ validator.OnEscrow += validator_OnEscrow;
// Technically optional but you probably want this event - see CreditAndEscrow_Sample.cs
validator.OnCredit += validator_OnCredit;