How to know if paylink's interface is enabled?

Support for the Milan Intelligent interface, sold by Money Controls as the Paylink USB unit and for the earlier PCI card version.

Moderators: aardvark, davebush, Admin

Post Reply
dotnetguy
Posts: 17
Joined: Wed Nov 30, 2016 2:56 pm

How to know if paylink's interface is enabled?

Post by dotnetguy »

Here is my code

Code: Select all

static void Main(string[] args)
{
    var open = AESImhei.OpenMHE();
    if (open != 0)
    {
        throw new IOException($"OpenMHE returned {open}.");
    }

    AESImhei.EnableInterface();

    var initialValue = AESImhei.CurrentValue();
    var latestValue = initialValue;

    while(latestValue == initialValue)
    {
        latestValue = AESImhei.CurrentValue();
    }

    Console.WriteLine(latestValue - initialValue);

    AESImhei.DisableInterface();
}
When I run your Demo.exe I can use attached hardware (insert money, dispense money, etc.). Demo.exe hasn't failed so far,but code snippet above has.

It seems that sometimes AESImhei.EnableInterface() does not succeed. Here's how I can reproduce (altough not always, but enough to consider these steps viable):
1) Hardware is setup, Standard.cfg is correct, paylink.exe is running.
2) Run Main(). Money is accepted and amount is printed out to console. Program exits.
3) Run Demo.exe. Everything seems to work. Close that program after some seconds.
4) Run Main(). Paylink won't accept any money, but CurrentValue can be read. Terminate program, because CurrentValue is not going to be updated.
5) Run Main() again. Everything seems to work.

Paylink.log

Code: Select all

Driver Thread Started

10:24:15.001 PC: Driver start up
10:24:15.141 USB: Device 0 not available
10:24:15.141 USB: Unit 1, ID: 0x0403 0xde50
10:24:15.141     Description: Genoa USB Hub
10:24:15.141       Serial No: AE000001
10:24:15.156            Type: Revision 4 (USB Powered)
10:24:15.159         Latency: 16
10:24:15.249 Config: Start of download
10:24:15.335 Config: Checked, OK
10:24:15.335 Config: Paylink Checked OK against file "Standard.cfg"
10:24:15.335 Exec: USB task took 68 msec
10:24:15.338 PC: Memory Reset - new protocol
10:24:15.454 DP: ccCoin acceptor 2020103 at ba0 and 3 coins setup
10:24:15.549 DP: CCNet acceptor 120b0e01 at cb0 and 4 coins setup
10:24:15.670 DP: Bill to bill Cassette Hopper S/N 999999, Address 1, Value 500 at df4 setup
10:24:15.712 DP: SCH2-NOENCRYPT Hopper S/N 580328, Address 6, Value 200 at e48 setup
10:24:15.749 DP: SCH2-NOENCRYPT Hopper S/N 580563, Address 3, Value 100 at ea0 setup
10:24:15.786 DP: SCH2-NOENCRYPT Hopper S/N 580376, Address 4, Value 50 at ef8 setup
10:24:15.827 DP: SCH2-NOENCRYPT Hopper S/N 590087, Address 5, Value -1 at f50 setup
10:24:15.868 DP: SCH2-NOENCRYPT Hopper S/N 588208, Address 7, Value -1 at fa8 setup
10:24:15.914 DP: SCH2-NOENCRYPT Hopper S/N 588302, Address 8, Value -1 at 1000 setup
10:24:16.094 DP: Interface memory set up
10:24:16.094 Exec: DP task took 740 msec
10:24:39.832 cctalk:       0 < 00
10:24:39.832 cctalk:      63 > 02
10:24:39.832 cctalk:      22 < 00
10:24:39.832 cctalk:      63 > 05
10:24:39.832 cctalk: Timeout (90) for 217 to ccHopper @ 5
10:24:39.832 ccHopper@5: No response to message
10:24:39.880 ccHopper@5: Re-Identifying hopper
10:24:39.976 ccHopper@5: 2, Empty
10:24:40.049 ccHopper@5: Hopper count 1844 OK
10:24:40.049 DP: SCH2-NOENCRYPT Hopper S/N 590087, Address 5, Value -1 at f50  updated
10:24:41.966 02:17


//Main() is started.
10:24:49.354 
10:24:49.354 Ver 004.001.012.071-526 Oct 25 2016 11:13:54
10:24:49.354 DP: Application active
10:24:49.354 DP: Interface memory recovery
10:24:49.354 ccCoin: Enable
10:24:49.354 DP: ccCoin Status to 0
10:24:49.354 CCNet: Enable
10:24:49.354 DP: CCNet Status to 0
10:24:49.354 CCNet: Enabling Acceptor
10:24:49.354 ccCoin: Enable all coins
10:24:49.354 ccCoin: enables to 0004
10:24:49.354 DP: Resending Events
10:24:49.354 DP: Event 0003
10:24:49.354 DP: Turn off barcodes
10:24:49.354 CCNet: inhibits to ff ff f1
10:24:49.402 CCNet: Status 14

//5EUR note is inserted.
10:25:19.078 CCNet: Status 15
10:25:19.078 DP: CCNet Status to 20
10:25:20.328 CCNet: Status 80
10:25:20.328 CCNet: Note 1 (EUR500) in Escrow
10:25:20.361 CCNet: Stack Escrow Note
10:25:20.409 CCNet: Status 17
10:25:21.184 CCNet: Status 81
10:25:21.184 CCNet: Note 1 (EUR500) Stacked to 1
10:25:21.184 DP:     Coin 1: saved
10:25:21.202 CCNet: Status 14
10:25:21.242 DP: CCNet Status to 0
10:25:21.242 
10:25:21.242 DP: System closedown received
10:25:21.242 DP:  No more updates
10:25:21.242 
10:25:21.242 DP: Application has gone away
10:25:21.242 ccCoin: Disable
10:25:21.242 DP: ccCoin Status to 4
10:25:21.242 CCNet: Disable
10:25:21.242 DP: CCNet Status to 4
10:25:21.242 
10:25:21.242 ccCoin: Inhibit all coins
10:25:21.242 CCNet: Disabling acceptor
10:25:21.530 CCNet: Disabling acceptor
10:25:21.577 CCNet: Status 19
//Main() has exited.

10:25:39.838 cctalk:       0 < 00
10:25:39.838 cctalk:      63 > 02
10:25:39.838 cctalk:      22 < 00
10:25:39.838 cctalk:      73 > 03
10:25:39.838 cctalk: Timeout (90) for 217 to ccHopper @ 3
10:25:39.838 ccHopper@3: No response to message
10:25:39.887 ccHopper@3: Re-Identifying hopper
10:25:40.030 ccHopper@3: Hopper count 330 OK
10:25:40.055 DP: SCH2-NOENCRYPT Hopper S/N 580563, Address 3, Value 100 at ea0  updated
10:25:41.699 02:18
10:26:24.739 cctalk:       0 < 00
10:26:24.739 cctalk:       3 > 06
10:26:24.739 cctalk:      14 < 00
10:26:24.739 cctalk:       3 > 06
10:26:24.739 cctalk: Timeout (90) for 166 to ccHopper @ 6
10:26:24.739 ccHopper@6: No response to message
10:26:24.759 ccHopper@6: Re-Identifying hopper
10:26:24.901 ccHopper@6: Hopper count 371 OK
10:26:24.923 DP: SCH2-NOENCRYPT Hopper S/N 580328, Address 6, Value 200 at e48  updated
10:26:41.432 02:19

//Demo.exe is started.
10:26:53.950 
10:26:53.950 Ver 004.001.012.071-526 Oct 25 2016 11:13:54
10:26:53.950 DP: Application active
10:26:53.950 DP: Interface memory recovery
10:26:53.950 ccCoin: Enable
10:26:53.950 DP: ccCoin Status to 0
10:26:53.950 CCNet: Enable
10:26:53.950 DP: CCNet Status to 0
10:26:53.950 CCNet: Enabling Acceptor
10:26:53.950 DP: Resending Events
10:26:53.950 DP: Event 0001
10:26:53.950 DP: Turn off barcodes
10:26:53.950 ccCoin: Enable all coins
10:26:53.950 ccCoin: enables to 0004
10:26:53.950 CCNet: inhibits to ff ff f1
10:26:54.253 CCNet: Enabling Acceptor
10:26:54.271 CCNet: inhibits to ff ff f1
10:26:54.333 CCNet: Status 14
10:26:54.436 DP: Event 0002
10:26:54.581 DP: Event 0000e0 for Acceptor 0
10:26:54.687 DP: Event 000120 for Acceptor 1
10:26:54.797 DP: Event 0000a0 for Dispenser 0
10:26:54.902 DP: Event 000060 for Dispenser 1
10:26:55.027 DP: Event 000060 for Dispenser 2
10:26:55.122 DP: Event 000060 for Dispenser 3
10:26:55.231 DP: Event 000060 for Dispenser 4
10:26:55.341 DP: Event 000060 for Dispenser 5
10:26:55.448 DP: Event 000060 for Dispenser 6
10:26:55.560 DP: Event 0003
10:26:55.669 DP: Event 0002
10:26:55.784 DP: Event 0000e0 for Acceptor 0
10:26:55.893 DP: Event 000120 for Acceptor 1
10:26:55.997 DP: Event 0000a0 for Dispenser 0
10:26:56.115 DP: Event 000060 for Dispenser 1
10:26:56.218 DP: Event 000060 for Dispenser 2
10:26:56.335 DP: Event 000060 for Dispenser 3
10:26:56.436 DP: Event 000060 for Dispenser 4
10:26:56.546 DP: Event 000060 for Dispenser 5
10:26:56.655 DP: Event 000060 for Dispenser 6
10:26:57.371 
10:26:57.371 DP: System closedown received
10:26:57.371 DP:  No more updates
10:26:57.371 
10:26:57.371 DP: Application has gone away
10:26:57.371 ccCoin: Disable
10:26:57.371 DP: ccCoin Status to 4
10:26:57.371 CCNet: Disable
10:26:57.371 DP: CCNet Status to 4
10:26:57.371 
10:26:57.371 ccCoin: Inhibit all coins
10:26:57.371 CCNet: Disabling acceptor
10:26:57.435 CCNet: Status 19
//Demo.exe is closed.

//Main() is started.
10:27:02.932 
10:27:02.932 Ver 004.001.012.071-526 Oct 25 2016 11:13:54
10:27:02.932 DP: Application active
10:27:02.932 DP: Interface memory recovery
10:27:02.932 ccCoin: Enable
10:27:02.932 DP: ccCoin Status to 0
10:27:02.932 CCNet: Enable
10:27:02.932 DP: CCNet Status to 0
10:27:02.932 ccCoin: Enable all coins
10:27:02.932 ccCoin: enables to 0004
10:27:02.932 CCNet: Enabling Acceptor
10:27:02.932 DP: Resending Events
10:27:02.932 DP: Application Watchdog triggered
10:27:02.932 ccCoin: Disable
10:27:02.932 DP: ccCoin Status to 4
10:27:02.932 CCNet: Disable
10:27:02.932 DP: CCNet Status to 4
10:27:02.955 DP: Event 0003
10:27:02.955 DP: Turn off barcodes
10:27:02.955 Exec: DP task took 30 msec
10:27:02.955 ccCoin: Inhibit all coins


//Main() is terminated, because CurrentValue has not been updated.
10:27:27.049 
10:27:27.049 DP: System closedown received
10:27:27.049 DP:  No more updates
10:27:27.049 
10:27:27.049 DP: Application has gone away
10:27:27.049 
10:27:41.160 02:20


//Main() is started again.
10:27:44.147 
10:27:44.147 Ver 004.001.012.071-526 Oct 25 2016 11:13:54
10:27:44.147 DP: Application active
10:27:44.147 DP: Interface memory recovery
10:27:44.147 ccCoin: Enable
10:27:44.147 DP: ccCoin Status to 0
10:27:44.147 CCNet: Enable
10:27:44.147 DP: CCNet Status to 0
10:27:44.147 CCNet: inhibits to ff ff f1
10:27:44.147 DP: Resending Events
10:27:44.147 DP: Event 0002
10:27:44.147 DP: Turn off barcodes
10:27:44.223 ccCoin: Enable all coins
10:27:44.223 ccCoin: enables to 0004
10:27:44.433 CCNet: Enabling Acceptor
10:27:44.462 CCNet: inhibits to ff ff f1
10:27:44.510 CCNet: Status 14

//5EUR note is inserted.
10:28:00.388 CCNet: Status 15
10:28:00.388 DP: CCNet Status to 20
10:28:01.390 CCNet: Status 80
10:28:01.390 CCNet: Note 1 (EUR500) in Escrow
10:28:01.422 CCNet: Stack Escrow Note
10:28:01.471 CCNet: Status 17
10:28:02.247 CCNet: Status 81
10:28:02.247 CCNet: Note 1 (EUR500) Stacked to 1
10:28:02.247 DP:     Coin 1: saved
10:28:02.278 CCNet: Status 14
10:28:02.278 DP: CCNet Status to 0

//Main exits.
10:28:02.316 
10:28:02.316 DP: System closedown received
10:28:02.316 DP:  No more updates
10:28:02.316 
10:28:02.316 DP: Application has gone away
10:28:02.316 ccCoin: Disable
10:28:02.316 DP: ccCoin Status to 4
10:28:02.316 CCNet: Disable
10:28:02.316 DP: CCNet Status to 4
10:28:02.316 
10:28:02.316 ccCoin: Inhibit all coins
10:28:02.316 CCNet: Disabling acceptor
10:28:02.587 CCNet: Disabling acceptor
10:28:02.652 CCNet: Status 19
Is this expected behaviour?

In this situation I'd like to have way to validate if interface is enabled. Is it possible?
davebush
Posts: 490
Joined: Fri Oct 22, 2004 12:20 pm

Re: How to know if paylink's interface is enabled?

Post by davebush »

Hi,

The key line in your diagnostics is:
10:27:02.932 DP: Application Watchdog triggered
This application watchdog is controlled by CheckOperation() which is used by the Demo program - and which is only checked while Paylink is running, i.e. the DLL is loaded and EnableInterface() has been called.

Checking the Demo program code, is appears that the application watchdog is only turned off by pressing the Exit button, not by closing the program with Alt-F4 or the X.

It appears that the acceptors were actively disabled after your program enabled everything because the watchdog that had been being run by Demo expired.

If you re-run your tests and use the Exit button, I expect that you will not see any problem.
Aardvark software developer. Please put all communication on the problem through the board for the benefit of others.
dotnetguy
Posts: 17
Joined: Wed Nov 30, 2016 2:56 pm

Re: How to know if paylink's interface is enabled?

Post by dotnetguy »

Indeed. Using "Exit button" vs closing window or alt+F4 made a difference.
It's something to keep in mind when using CheckOperation(). Thanks.
davebush
Posts: 490
Joined: Fri Oct 22, 2004 12:20 pm

Re: How to know if paylink's interface is enabled?

Post by davebush »

Good to hear it.
Aardvark software developer. Please put all communication on the problem through the board for the benefit of others.
Post Reply