Italian [B4J] libreria in C, C++ utilizzabile in B4J ??

MARCO C.

Active Member
Licensed User
Buongiorno,
dovrei utilizzare una dispositivo da collegare al pc tramite la porta USB . Per il suo utilizzo vengono fornite delle librerie , da quello che mi pare di capire, utilizzabili con il
linguaggio C, C++ .
Secondo voi esiste qualche "barbatrucco" affinché possa utilizzare questo dispositivo anche tramite B4J ??
Di seguito alcune indicazioni presente nel manuale per il programmatore
Grazie in anticipo

9.1 Purpose of Document
This document describes the software interface to the AES Intelligent Money Handling Equipment
Interface (IMHEI) as seen by a software engineer writing in either the C or C++ programming
languages on the PC.

9.2 Intended Audience
The intended audience of this document is the software engineers who will be writing software on the
PC that will communicate with the IMHEI card itself or will read the monetary information or diagnostic
information provided by the card.

9.3 Document Layout
The document itself is split into a number of sections. Within each section, there are three sections.
• Operational Overview.
Where the way in which this area is intended to work is explained.
• Function Definitions.
Where you will find exact details on each function call.
• Usage Details.
This gives details on exactly how the IMHEI system operates


10. Getting Started
10.1 Installation

The Genoa / PayLink unit is a standard USB 1.1 peripheral. Installation of the OS driver is as with any
USB peripheral, when the unit is detected the user is prompted to insert the installation CD. This CD
will install the low level drivers, which may be removed using the standard “Add or Remove Programs”
facility for the “AES Genoa USB Drivers” entry.
In addition, two other steps need to be undertaken, at present manually:
• The interface AESIMHEI.DLL needs to be copied from the installation CD to Windows\System32
• The High Level driver program needs to be copied from the installation CD to a convenient folder,
and an entry made in the Startup folder to run this at system boot.
The IMHEI card is a standard PCI interface card which has the normal Windows Plug ’n’ Play
automatic installation facilities.
When an interface card is detected in a PC the user is prompted to insert the installation CD. This CD
will configure the system to use the card and copy into the system directories the two elements of the
interface:
• The device driver: AESIMHEI.SYS
• The interface: AESIMHEI.DLL.


10.4 OpenSpecificMHE
10.41,1 Synopsis

This call is made by the PC application software to open or to switch to one of the multiple “Money
Handling Equipment” Interfaces installed on the PC.
Details on how a system works with multiple PayLinks are given in a later section.

long OpenSpecificMHE (char SerialNo[8]);

10.41,2 Parameters
None

10.41,3 Return Value
If the Open call succeeds then the value zero is returned.
In the event of a failure the same standard windows error codes are returned as for OpenMHE.

10.41,4 Remarks
1. Every PayLink requires a unique instance of the USB driver program to be running. If there is
no driver for the PayLink whose Serial Number is quoted, then the function returns 31
(ERROR_GEN_FAILURE).
2. As the default serial number for PayLink unit is “AE000001”, the OpenMHE call is equivalent
to the call OpenSpecficMHE("AE000001")
3. This call may be issued repeatedly with no ill effects. Each call will serve to swap all the other
calls in this document to the specified unit.


nella sezione esempi

10.13 Getting Started Code Examples
The following code fragments are intended to provide clear examples of how the calls to the IMHEI are
designed to be used:
Each function will provide the central processing for a small command line demonstration program.

10.131 CURRENCY ACCEPT

C++:
void AcceptCurrencyExample(int NoOfChanges)
{
long LastCurrencyValue ;
long NewCurrencyValue ;
long OpenStatus = OpenMHE() ;
if (OpenStatus != 0)
{
printf("IMHEI open failed - %ld\n", OpenStatus) ;
}
else
{
// Then the open call was successful
// Currency acceptance is currently disabled
LastCurrencyValue = CurrentValue() ;
printf("Initial currency accepted = %ld pence\n",
LastCurrencyValue) ;
EnableInterface() ;
printf("Processing %d change events\n", NoOfChanges) ;
while (NoOfChanges > 0)
{
Sleep(100) ;
NewCurrencyValue = CurrentValue() ;
if (NewCurrencyValue != LastCurrencyValue)
{
// More money has arrived (we do not care where from)
printf("The user has just inserted %ld pence\n",
NewCurrencyValue - LastCurrencyValue) ;
LastCurrencyValue = NewCurrencyValue ;
--NoOfChanges ;
}
}
}
}

10.133 INDICATOR EXAMPLE

C++:
void AcceptCurrencyExample(int NoOfChanges)
{
long LastCurrencyValue ;
long NewCurrencyValue ;
long OpenStatus = OpenMHE() ;
if (OpenStatus != 0)
{
printf("IMHEI open failed - %ld\n", OpenStatus) ;
}
else
{
// Then the open call was successful
// Currency acceptance is currently disabled
LastCurrencyValue = CurrentValue() ;
printf("Initial currency accepted = %ld pence\n",
LastCurrencyValue) ;
EnableInterface() ;
printf("Processing %d change events\n", NoOfChanges) ;
while (NoOfChanges > 0)
{
Sleep(100) ;
NewCurrencyValue = CurrentValue() ;
if (NewCurrencyValue != LastCurrencyValue)
{
// More money has arrived (we do not care where from)
printf("The user has just inserted %ld pence\n",
NewCurrencyValue - LastCurrencyValue) ;
LastCurrencyValue = NewCurrencyValue ;
--NoOfChanges ;
}
}
}
}
 

Star-Dust

Expert
Licensed User
Longtime User
Aiuto ... :rolleyes:
"
Not directly. You need to implement a Java wrapper that uses JNI to access the C code.
"
Che vuol dire ...
È necessario implementare un wrapper Java che utilizza JNI per accedere al codice C.
Che dovresti creare un avvolgimento della libreria, questa libreria in java può accedere al codice in C utilizzando JNI. Semplice no?
 

Star-Dust

Expert
Licensed User
Longtime User
Vedi questo tutorial

Chiedi a @tigrot, ha realizzato qualcosa del genere
 
Top