by kok joek hoa » Mon May 21, 2012 1:21 pm
Dear Antonio,
Can you help to find out what is wrong with this code :
the error is statement : extern "C" {
Regards,
kok
////------------------------------------------------------------------------------------------------------------
#include "Fwce.ch"
#include "dll.ch"
#include "Struct.ch"
//catatan kode uid
// 7 6 5 4 3 2 1 0
// EO Manufacture ---------- serial number -------------
//
// kode manufacture
// 02H = ST MICROELECTRONICS "ST LRI64/LRI512"
// 04H = PHILLIPS SEMICONDUCTORS "I.CODE SLI/SL2"
// 05H = INFINEONS TECHNOLOGIES AG "Infineon My-D"
// 07H = TEXAS INSTRUMENT "Tag-It HFI"
// 16H = EM MICROELECTRONIC-MARIN SA
#define OBTN_POWER_ON 1
static nconnection
static nclose_connection
function RFID_MAIN()
local ownd
local obtn :=array(10)
nconnection := 1
nclose_connection :=1
DEFINE window ownd title 'RFID 15693'
@ 10,10 BUTTON "Connect" SIZE 90,30 OF OWND PIXEL UPDATE action fun_Connect_reader()
@ 10,130 BUTTON "Disconnect" size 90,30 OF OWND PIXEL UPDATE action fun_close_Connect_reader( )
@ 50,10 BUTTON "Open RF" SIZE 90,30 OF OWND PIXEL UPDATE action fun_openrf()
@ 50,130 BUTTON "Close RF" SIZE 90,30 OF OWND PIXEL UPDATE action fun_closerf()
ACTIVATE dialog ownd
ModulePowerOff( )
return nil
static function fun_power_on()
if ModulePowerOn()==0
msginfo('Power on sukses')
else
msgalert('Power on gagal')
endif
return nil
static function fun_Connect_reader()
fun_power_on()
if ConnectReader() == 0
msginfo('Koneksi Sukses')
fun_reader_information()
nconnection := 0
else
msgalert('Koneksi Gagal')
nconnection := 1
return nil
endif
return nil
static function fun_close_Connect_reader()
if DisConnectReader() == 0
nclose_connection := 0
else
msgalert('Tutup Koneksi Gagal')
nclose_connection := 1
endif
return nil
static function fun_openrf()
MSGINFO('NILAI OPEN RF')
MSGINFO(nAddressPort:nValue)
if openRf(nAddressPort:nValue )==0
msginfo('Open Rf Sukses')
else
msginfo('Open Rf Gagal')
endif
return nil
static function fun_closerf()
if closeRf( )==0
msginfo('Close Rf sukses')
else
msginfo('Close Rf Gagal')
endif
return nil
static function fun_reader_information()
public nAddressPort
public VersionInfo
public ReaderType
public TrType
public InventoryScanTime
STRUCT nAddressPort
MEMBER nValue AS BYTE
ENDSTRUCT
STRUCT VersionInfo
MEMBER Versionnumber AS BYTE
MEMBER Versionnumber1 AS BYTE
ENDSTRUCT
STRUCT ReaderType
MEMBER typereader AS BYTE
ENDSTRUCT
STRUCT TrType
MEMBER Type1 AS BYTE
MEMBER Type2 AS BYTE
ENDSTRUCT
STRUCT InventoryScanTime
MEMBER nValue AS BYTE
ENDSTRUCT
nAddressPort:nValue :=0xff
ReaderType:typereader :=0
InventoryScanTime:nValue :=0
msginfo(nAddressPort:nValue)
MSGINFO( GetReaderInfo ( nAddressPort:cbuffer ,;
VersionInfo:cbuffer ,;
ReaderType:cbuffer ,;
TrType:cbuffer ,;
InventoryScanTime:cbuffer ;
) ;
)
msginfo(nAddressPort:nValue)
msginfo(VersionInfo:Versionnumber)
msginfo(VersionInfo:Versionnumber1)
msginfo( ReaderType:typereader )
//se
//msginfo('info gagal')
//dif
return nil
DLL STATIC FUNCTION ModulePowerOn( ) AS LONG PASCAL FROM "ModulePowerOn" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION ModulePowerOff( ) AS LONG PASCAL FROM "ModulePowerOn" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION ConnectReader( ) AS LONG PASCAL FROM "ConnectReader" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION DisConnectReader( ) AS LONG PASCAL FROM "DisConnectReader" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION OpenRf( ComAdr AS LPSTR) AS LONG PASCAL FROM "OpenRf" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION CloseRf(ComAdr AS LPSTR) AS LONG PASCAL FROM "CloseRf" LIB "RR3WinCe.dll"
/* DLL STATIC FUNCTION GetReaderInfo( @ComAdr AS LPSTR ,;
@VersionInfo AS LPSTR ,;
@ReaderType AS LPSTR ,;
@TrType AS LPSTR ,;
@InventoryScanTime AS LPSTR ;
) AS LONG PASCAL FROM "GetReaderInfo" LIB "RR3WinCe.dll" */
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
extern "C" {
LONG GetReaderInfo( LPSTR ,LPSTR ,LPSTR ,LPSTR ,LPSTR ) ;
}
HB_FUNC(GETREADERINFO)
{
hb_retnl(GetReaderInfo(hb_parc(1),hb_parc(2),hb_parc(3),hb_parc(4),hb_parc(5))) ;
}
#pragma ENDDUMP