I have tried a lot of solutions but I still cannot read the CoinCount Value (always 0) when I call ReadDispenserDetails.
On the Paylink are connected :
-> Dispensers :
A Hopper ( 2€)
A global Euro ( 4 dispenser tubes : 0.50€, 0.20€, 0.10€; 0.05€ ).
-> Acceptors :
A Lumina ans an acceptor SR3
The problem is with dispensers.
Here are the Results :
--------------------------------------------------------------------------------------
Driver Log AESWDriver.exe in starting (before calls to readDispenserDetails) :
11:46:02.28 Opening Genoa USB unit...
11:46:02.61 OK, ID: 0x0403 0xde50
11:46:02.61 Description: Genoa USB Hub
11:46:02.61 Manufacturer: Aardvark (AE)
11:46:03.11 Memory Reset
11:46:03.26 Memory Resynchronise
11:46:03.26 /N 0, Address 8, Value 20 at 12cc setup
11:46:03.26 DP: Hopper S/N 0, Address 8, Value 10 at 12fc setup
11:46:03.26 DP: Hopper S/N 0, Address 8, Value 5 at 132c setup
11:46:03.26 DP: Interface memory set up
11:46:03.26 Exec: DP App. task took 132 msec
11:46:03.26 USB:PC has updated basic area @ 100!!!
11:46:03.40 Update @100, 37=>0
11:46:03.40 Update @104, 37=>0
11:46:03.40 USB unit re-synch complete
11:46:03.40 129c setup
11:46:03.40 DP: Hopper S/N 0, Address 8, Value 20 at 12cc setup
11:46:03.40 DP: Hopper S/N 0, Address 8, Value 10 at 12fc setup
11:46:03.40 DP: Hopper S/N 0, Address 8, Value 5 at 132c setup
11:46:03.40 DP: Interface memory set up
11:46:03.40 Exec: DP App. task took 135 msec
11:46:03.41 8144 bytes memory free
--------------------------------------------------------------------------------------
Results obtained with the SDK demo.exe program ( Dispensers form )
Value : 200
Adress : 9
Coins paid : 962
Contents (CoinCount) : Low
Status : empty
Value : 50
Adress : 8
Coins paid : 133
Contents (CoinCount) : 5
Status : Idle OK
Value : 20
Adress : 8
Coins paid : 3
Contents (CoinCount) : 18
Status : Idle OK
Value : 10
Adress : 8
Coins paid : 6
Contents (CoinCount) : 38
Status : Idle OK
Value : 5
Adress : 8
Coins paid : 2
Contents (CoinCount) : 28
Status : Idle OK
These values are OK.
--------------------------------------------------------------------------------------
Results obtained in .net project using spies in Visual C# :
DispenserDetails {MONETIQUE.Classes.Dispenser} MONETIQUE.Classes.Dispenser
_inhibit 0 uint
CoinCount 0 uint
CoinCountStatus COIN_NONE MONETIQUE.Classes.Dispenser.CoinStatus
Count 962 uint
Currency 0 uint
Inhibit false bool
InterfaceNumber 2 uint
Status 4294967295 uint
Unit 16908545 uint
UnitAddress 9 uint
Value 200 uint
DispenserDetails {MONETIQUE.Classes.Dispenser} MONETIQUE.Classes.Dispenser
_inhibit 0 uint
CoinCount 0 uint
CoinCountStatus COIN_NONE MONETIQUE.Classes.Dispenser.CoinStatus
Count 133 uint
Currency 0 uint
Inhibit false bool
InterfaceNumber 9 uint
Status 1 uint
Unit 17367040 uint
UnitAddress 8 uint
Value 50 uint
DispenserDetails {MONETIQUE.Classes.Dispenser} MONETIQUE.Classes.Dispenser
_inhibit 0 uint
CoinCount 0 uint
CoinCountStatus COIN_NONE MONETIQUE.Classes.Dispenser.CoinStatus
Count 3 uint
Currency 0 uint
Inhibit false bool
InterfaceNumber 9 uint
Status 1 uint
Unit 17367040 uint
UnitAddress 8 uint
Value 20 uint
DispenserDetails {MONETIQUE.Classes.Dispenser} MONETIQUE.Classes.Dispenser
_inhibit 0 uint
CoinCount 0 uint
CoinCountStatus COIN_NONE MONETIQUE.Classes.Dispenser.CoinStatus
Count 6 uint
Currency 0 uint
Inhibit false bool
InterfaceNumber 9 uint
Status 1 uint
Unit 17367040 uint
UnitAddress 8 uint
Value 10 uint
DispenserDetails {MONETIQUE.Classes.Dispenser} MONETIQUE.Classes.Dispenser
_inhibit 0 uint
CoinCount 0 uint
CoinCountStatus COIN_NONE MONETIQUE.Classes.Dispenser.CoinStatus
Count 2 uint
Currency 0 uint
Inhibit false bool
InterfaceNumber 9 uint
Status 1 uint
Unit 17367040 uint
UnitAddress 8 uint
Value 5 uint
You can see that Currency and CoinCount values in .net code are always 0.
Here is my .net Code :
I have followed your advices
Code: Select all
----------------------------------------------------------------------
Class MONETIQUE.Classes.Dispenser :
----------------------------------------------------------------------
[ StructLayout( LayoutKind.Sequential, CharSet=CharSet.Auto )]
public class Dispenser
{
public enum CoinStatus
{
// Coin Count Status Values
COIN_NONE = 0,// No dispenser coin reporting
COIN_LOW = 1,// Less than the low sensor level
COIN_MID = 2,// Above low sensor but below high
COIN_HIGH = 3,// High sensor level reported
ACCURATE = -1,// Coin Count reported by Dispenser
ACCURATE_FULL = -2 // Coin Count As reported by Dispenser, is over limit.
}
public System.UInt32 Unit;// Specification of this unit
public System.UInt32 Status;// AcceptorStatuses - zero if device OK. This takes the same values As PayStatus()
public System.UInt32 InterfaceNumber;// The bus / connection
public System.UInt32 UnitAddress;// For addressable units
public System.UInt32 Value;// The value of the coins in this dispensor
public System.UInt32 Count;// Number dispensed since interface commissioned
private System.UInt32 _inhibit;
public System.UInt32 Currency;// Currency code reported by an intelligent acceptor
public System.UInt32 CoinCount;// The number of coins in the dispenser
public CoinStatus CoinCountStatus;// Flags Relating to Coin Count (See above)
public bool Inhibit
{
get
{
return (_inhibit != 0);
}
set
{
_inhibit = Convert.ToUInt32(value);
}
}
}
--------------------------------------------------------------------------------------
In my Program I do :
--------------------------------------------------------------------------------------
I have tested my last import dll code :
Code: Select all
[DllImport("aesimhei.dll", CharSet = CharSet.Auto, EntryPoint = "ReadDispenserDetails")]
public static extern System.Boolean ReadDispenserDetails(System.Int32 Number, MONETIQUE.Classes.Dispenser myDispenser);
and your code import dll code that I found in another post : (
http://www.aardvark.eu.com/downloads/so ... %20Net.zip )
Code: Select all
[DllImport("aesimhei.dll", EntryPoint="_ReadDispenserDetails@8")]
public static extern System.Int32 ReadDispenserDetails(System.Int32 Number, [In]MONETIQUE.Classes.Dispenser Snapshot);
so I call the ReadDispenserDetails method :
Code: Select all
// Test to read all dispensers connected to paylink
public void test_read_dispensers()
{
System.Int32 openRes = OpenMHE();
MONETIQUE.Classes.Dispenser DispenserDetails = new MONETIQUE.Classes.Dispenser();
System.Int32 DispenserNo = new System.Int32();
for (DispenserNo = 0; ReadDispenserDetails(DispenserNo, DispenserDetails); ++DispenserNo)
{
MessageBox.Show("Read dispenser " + Convert.ToString(DispenserNo) );
}
}
-----------------------------------------------------------------------------------------
Finally, I tried to use your .net dll generated by your .net project
So I add your .net dll Aesimhei.dll in my project references
and used this method to test values :
Code: Select all
public void testDLLDispensers()
{
System.Int32 OpenStatus = OpenMHE();
System.Int32 ReadResult ;
Aardvark.MHE.Dispenser o_disp = new Aardvark.MHE.Dispenser();
Aardvark.MHE manager = new Aardvark.MHE();
ReadResult = Aardvark.Imhei.ReadDispenserDetails(0, o_disp);
ReadResult = Aardvark.Imhei.ReadDispenserDetails(1, o_disp);
ReadResult = Aardvark.Imhei.ReadDispenserDetails(2, o_disp);
ReadResult = Aardvark.Imhei.ReadDispenserDetails(3, o_disp);
ReadResult = Aardvark.Imhei.ReadDispenserDetails(4, o_disp);
ReadResult = Aardvark.Imhei.ReadDispenserDetails(5, o_disp);
}
I obtain the same results : CoinCount and Currency have the value 0.
---------------------------------------------------------------------------
I give you the MilaDiag result (for instance) :
I have installed the last firmware and result is the same.
AES Intelligent Money Handling Equipment Interface
OS Version 5.1
Checking Driver File:
Checking DLL:
Found at: C:\WINDOWS\system32\AesIMHEI.dll
Timestamp : Tue Mar 07 17:15:00 2006
Version 1,3,2,2
Checking Device Access:
AES Intelligent Money Handling Equpiment:
Interface 6, code version 04010a06
Can't test memory as an application is running
Device Checked - OK
Checking Application access through DLL:
Open successful
Firmware Release Type: Full
Firmware Code Version: 1.10.6
Dispensers on the system are:
Dispenser 0: MCL Serial Compact Hopper
Coin Value 200, Number Paid 962,
Inhibit 0, Currency 0, Address 9
Dispenser 1: Unknown
Coin Value 50, Number Paid 133,
Inhibit 0, Currency 0, Address 8
Dispenser 2: Unknown
Coin Value 20, Number Paid 3,
Inhibit 0, Currency 0, Address 8
Dispenser 3: Unknown
Coin Value 10, Number Paid 6,
Inhibit 0, Currency 0, Address 8
Dispenser 4: Unknown
Coin Value 5, Number Paid 2,
Inhibit 0, Currency 0, Address 8
I don't understand why others values are ok but not CoinCount values.
When you run your code, do you have correct values in CoinCount attribute ?
Thanks for your reply.