How to Program Apex 7000 Cash Acceptor in Asp.Net Core 3.1

Programming Apex 7000 Cash Acceptor in Asp.Net Core 3.1 Notes

  1. Make sure that you enable asp.net 3.5 or 3.2 in Windows Additional Feature under add more programs
  2. Pyramid C# Library on github is not compatible with DotNet Core 3.1, therefore you will need to download netstand Library from Nuget Packages
    - Netstandard Library allows you to interface Asp.net Standard Library API's with Current Asp.Net Core 3.1 Project.
  3. Make sure that Com Ports are enabled on your programming Laptop, if you just bought the Laptop, Com Ports are disabled by default.
    - Com Ports allows Devices to communicate via Serial Ports.

    How to Enable Com Ports on Windows 10

    open device manager

    click on action

    add legacy hardware

    click on next

    search for and install the hardware automatically(Recommended)

    next

    it will detect that com port and next

    double click com port

    next

    next and finish

    now you will be able to see that com port... :)

    4. If you managed to connect to Apex 7000 Bill Acceptor Machine through C# Code, you will have to make sure that all the events are firing. E.g. 

       - Acceptor_OnCashboxAttached(object s, EventArgs e)
       - Acceptor_OnCredit(object sender,CreditArgs e) #This is the function that will implement logic when the user pays 1 or 5 dollar bills. It will tell you what money was put in.
    - These Event Functions should be public and not private, (these events should be implemented in a Controller that inherits a Controller or ControllerBase or else, you will have a hard time registering those events since the Cash Acceptor communicates with the Controller, therefore, events should be in the Controller and not just a class.
    [Edited]: Disregard the above point that states the events should be in the Controller, this is not the case. The events can be in any class depending on your programming paradigm or architecture.

Stages to Connect to Apex 7000 Cash Acceptor Machine

Dependencies
- PyramidNETRS232 Nuget Package

  1. The Cash Acceptor Class should have the following properties:
      - public PyramidAcceptor Validator {get; set;}
      - public int BillCount {get; set;}
       - private readonly string _port; #This is the port the CashAcceptor code will communicate with the Cash Acceptor Device
      - private readonly RS232Config _config; # This will be populated by code provided you have installed PyramidNetRS232 Nuget Library
  2. The class should be responsible for initializing the connection to the Apex 7000 device and making sure the connection is established before moving on with business logic.

 

Errors:

  1. You might get an error that says the Encoding provided is no longer supported by Windows. When this error happens you must reregister the encoding
       System.Text.EncodingProvider ppp = System.Text.CodePagesEncodingProvider.Instance;
       Encoding.RegisterProvider(ppp);
       //Then you can Connect to the CashAcceptoer
       Validator.Connect();
  2. You might get an error that says:

    FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version="4.0.2.0" the system cannot find the file specified.
    -Solution: Make sure you include:
    PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0"
    PackageReferece Incluse ="System.Management" Version="4.7.0"
  3. [Set Backs] When developing using C# code, keep in mind that you might explicitly specify a COM PORT in your CashAcceptor.cs class. This came after a day of troubleshooting why the application could not work in the production environment hence functions well on the developer machine.

    -
    Instead of leaving for the Pyramid Cash Acceptor library to scan the COM Ports to find what channel the Cash Acceptor is listening on. Explicitly pass in the COM9 or COM6 as a Com port application should communicate with the Cash Acceptor Device. Of course, you can pass in any COM Port as long as that COM Port is where the Cash Acceptor is listening on.

    How to Shut Down the Apex 7000 Cash Acceptor as Quickly as Possible

  4. When working with Cash Acceptors, a developer would need to shut down the Cash acceptor as soon when the user inserts the last bill of the Total Amount charged.

    - In making sure this happens. Make sure that you don't send another command to the Serial Bus (COM Port) trying to communicate with the Cash Acceptor. In doing so, I have noticed that, when you attempt several times to shut down the Cash Acceptor Machine, the longer it takes to shut down. This is because, when the Cash acceptor receives a command from the Master to shut down or pause, it receives another command to Shutdown or pause, leading to stopping processing the first Command and staying active to process the latest command.

    - So, If you want the Cash Acceptor to shut down as soon as possible, send only one command to disconnect or pause accepting. This way the Cash Acceptor processes that command waits a few seconds and then shuts down or pauses. If you send several commands thinking that it will process all of them then shuts down as quickly as possible, this might not be the case.

Edit this Article
aspnet core pyramid bill acceptor how to program pyramid cash acceptor Technology published
Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

Your Session is Ending
Login to Continue

© 2021 - ErnesTech - Privacy