Id003Driver 1.0.6
dotnet add package Id003Driver --version 1.0.6
NuGet\Install-Package Id003Driver -Version 1.0.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Id003Driver" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Id003Driver --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Id003Driver, 1.0.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Id003Driver as a Cake Addin #addin nuget:?package=Id003Driver&version=1.0.6 // Install Id003Driver as a Cake Tool #tool nuget:?package=Id003Driver&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Source: https://github.com/max7019/Id003-.Net-driver
An example of using the driver
Driver initialization
_driver = new Id003();
Get device info
var operationTask = _driver.GetModelId();
operationTask.Wait(_defaultInvocationTimeout);
if (!operationTask.IsCompleted)
throw new InvalidOperationException("Error while identification info setting: Timeout.");
if (operationTask.Result.Item1 != Error.NoError)
throw new InvalidOperationException($"Error while identification info setting: {operationTask.Result.Item1}.");
if (operationTask.Result.Item2.IsNullOrWhiteSpace())
throw new InvalidOperationException("Error while identification info setting: IncorrectInfo.");
DeviceIdValue = operationTask.Result.Item2;
Denomination table initialization
_driver
.SetDenominationTable(
_denominationTable
.Select(
entry => new Denomination(
Convert.ToDouble(entry.Info.Denomination),
entry.Info.CurrencyCode))
.ToList())
.Wait(_defaultInvocationTimeout);
Event handlers attaching
_driver.EscrowStatusDetected += OnDriverEscrowStatusDetected;
_driver.StackedStatusDetected += OnDriverStackedStatusDetected;
_driver.ReturningStatusDetected += OnDriverReturningStatusDetected;
_driver.VendValidStatusDetected += OnDriverVendValidStatusDetected;
_driver.StackerOpenStatusDetected += OnDriverStackerOpenStatusDetected;
_driver.StackerOpenStatusCleared += OnDriverStackerOpenStatusCleared;
_driver.FailureStatusDetected += OnDriverFailureStatusDetected;
_driver.FailureStatusCleared += OnDriverFailureStatusCleared;
_driver.JamInAcceptorStatusDetected += OnDriverJamInAcceptorStatusDetected;
_driver.JamInAcceptorStatusCleared += OnDriverJamInAcceptorStatusCleared;
_driver.JamInStackerStatusDetected += OnDriverJamInStackerStatusDetected;
_driver.JamInStackerStatusCleared += OnDriverJamInStackerStatusCleared;
_driver.StackerFullStatusDetected += OnDriverStackerFullStatusDetected;
_driver.StackerFullStatusCleared += OnDriverStackerFullStatusCleared;
_driver.PowerUpStatusDetected += OnDriverPowerUpStatusDetected;
_driver.PowerUpWithBillInAcceptorStatusDetected += OnDriverPowerUpWithBillInAcceptorStatusDetected;
_driver.PowerUpWithBillInStackerStatusDetected += OnDriverPowerUpWithBillInStackerStatusDetected;
_driver.PauseStatusDetected += OnDriverPauseStatusDetected;
_driver.PauseStatusCleared += OnDriverPauseStatusCleared;
_driver.InitializeStatusDetected += OnDriverInitializeStatusDetected;
_driver.InitializeStatusCleared += OnDriverInitializeStatusCleared;
_driver.CheatedStatusDetected += OnDriverCheatedStatusDetected;
_driver.CheatedStatusCleared += OnDriverCheatedStatusCleared;
_driver.CommunicationErrorStatusDetected += OnDriverCommunicationErrorStatusDetected;
_driver.CommunicationErrorStatusCleared += OnDriverCommunicationErrorStatusCleared;
Start pooling after initialization
_driver.StartPolling(TimeSpan.FromMilliseconds(100.0)).Wait(_defaultInvocationTimeout);
_driver.Reset().Wait(_defaultInvocationTimeout);
Escrow handler example
private void OnDriverEscrowStatusDetected(object sender, DenominationEventArgs denominationEventArgs)
{
Logger.Debug("Escrow status detected.");
DenominationInfo denominationInfo;
List<CashAcceptorDenominationEntry> denominationTable;
lock (StateLock)
{
_currentBill = denominationEventArgs.Denomination != null
? new DenominationInfo(
DenominationType.Bill,
denominationEventArgs.Denomination.Currency,
Convert.ToDecimal(denominationEventArgs.Denomination.Value))
: null;
denominationInfo = _currentBill;
denominationTable = _denominationTable;
}
if (denominationInfo == null || denominationTable == null)
{
RejectBill();
return;
}
var denominationEntry =
denominationTable.FirstOrDefault(
entry =>
denominationInfo.Equals(entry.Info));
if (denominationEntry == null)
{
RejectBill();
return;
}
Logger.DebugFormat(
"{0} {1} available.",
denominationEntry.Info.Denomination,
denominationEntry.Info.CurrencyCode);
var cashMovingArgs =
new CashAvailableEventArgs(denominationEntry.Info);
FireCashAvailable(cashMovingArgs);
if (cashMovingArgs.IsProceed)
AcceptBill();
else
RejectBill();
}
Denominations accepting
var operationTask = _driver.SetEnabledDenominations(billEnables);
operationTask.Wait(_defaultInvocationTimeout);
const string message = "Error while denominations accepting";
if (!operationTask.IsCompleted)
throw new InvalidOperationException($"{message}: Timeout.");
if (operationTask.Result != Error.NoError)
throw new InvalidOperationException($"{message}: {operationTask.Result}.");
Add bill to stacker after escrow
_driver.Stack1()
Return bill after escrow
_driver.Return()
Driver error status handling example
private void OnDriverFailureStatusDetected(object sender, DeviceErrorEventArgs deviceErrorEventArgs)
{
Logger.Debug($"{Status.Failure} state: {deviceErrorEventArgs.DeviceError}.");
SetStateError(
DeviceErrors.SystemError,
CashDeviceErrors.GetDescription(DeviceErrors.SystemError),
true);
}
Driver normal state handling example
private void OnDriverFailureStatusCleared(object sender, DeviceErrorEventArgs deviceErrorEventArgs)
{
SetStateOk();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
native | native is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.6 | 1,247 | 4/25/2018 |