Page 4 of 4
Re: DLL
Posted: Fri May 25, 2012 11:27 am
by kok joek hoa
Dear Antonio,
Yes, return value is array , but I cannot read.
Here the reference of GetreaderInfo :
Function Description :This function is used to get reader-related information such as reader address, firmware version , available protocol type ,and inventoryScanTime.
Usage :Int GetReaderInfo ( unsigned char *address, unsigned char *pOUcharVerion , unsigened char *pOUcharModel , unsigned char *pOUcharSupProtocol ,unsigned char *pOUcharInventoryScanTime )
Parameter :Address : Input/Output . Pointed to the address of the reader.
pOUcharVerion : output. Pointed to 2 byte firmware version information. The first byte is version number and the second byte is sub-version number.
pOUcharModel : output. Pointed to ther reader type byte.
pOUcharSupProtocol : output. Pointed to 2 byte supported protocol Information.
pOUcharInventoryScanTime : output. Point to the time limit for iso 15693’s inventory command.
Return :Zero value returned when successful ,
the GetreaderInfo must return value Zero when succsesfulthis is sample of c sharp :
Code: Select all | Expand
private void btnConnect_Click(object sender, EventArgs e)
{
readerAddr = 0xFF;
byte[] verion = new byte[2];
byte model = 0;
byte[] supProtocol = new byte[2];
byte inventoryScanTime = 0;
int result = 0x30;
result = RWDev.ConnectReader();
if (result == OK)
{
RWDev.GetReaderInfo(ref readerAddr, verion, ref model, supProtocol, ref inventoryScanTime);
MessageBox.Show("ConnectReader success.", "Communication");
btnConnect.Enabled = false;
btnDisconnect.Enabled = true;
}
else
{
MessageBox.Show("ConnectReader failed.", "Communication");
btnConnect.Enabled = true;
btnDisconnect.Enabled = false;
}
}
regards,
kok
Re: DLL
Posted: Fri May 25, 2012 11:45 am
by Antonio Linares
Kok,
If you comment out the hb_reta() and hb_stor...() calls and do a hb_retnl( <the function call> ) what value do you get from PRG level ?
A zero would mean success
Re: DLL
Posted: Fri May 25, 2012 12:35 pm
by kok joek hoa
Dear Antonio,
with below code, I can receive zero from Getrfidinfo, but I cannot receivce the value that pass by refrence .
Code: Select all | Expand
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
LONG GetReaderInfo( LPWSTR ,LPWSTR ,LPWSTR ,LPWSTR ,LPWSTR ) ;
LPWSTR AnsiToWide( LPSTR );
LPSTR WideToAnsi( LPWSTR );
HB_FUNC( GETREADERINFO )
{
LPWSTR ComAdr = AnsiToWide( (char *) hb_parc( 1 ) );
LPWSTR VersionInfo = AnsiToWide( (char *) hb_parc( 2 ) );
LPWSTR ReaderType = AnsiToWide( (char *) hb_parc( 3 ) );
LPWSTR TrType = AnsiToWide( (char *) hb_parc( 4 ) );
LPWSTR InventoryScanTime = AnsiToWide( (char *) hb_parc( 5 ) );
hb_retnl( GetReaderInfo( ComAdr, VersionInfo, ReaderType, TrType, InventoryScanTime ) );
hb_xfree( ComAdr );
hb_xfree( VersionInfo );
hb_xfree( ReaderType );
hb_xfree( TrType );
hb_xfree( InventoryScanTime );
}
#pragma ENDDUMP
regards,
kok
Re: DLL
Posted: Sat May 26, 2012 10:35 am
by Antonio Linares
Kok,
Remember to use @ with the supplied parameters:
local nAddressPort_cbuffer := nAddressPort:cbuffer
local VersionInfo_cbuffer := VersionInfo:cbuffer
local ReaderType_cbuffer := ReaderType:cbuffer
local TrType_cbuffer := TrType:cbuffer
local InventoryScanTime_cbuffer := InventoryScanTime:cbuffer
GetReaderInfo ( @nAddressPort_cbuffer, @VersionInfo_cbuffer, @ReaderType_cbuffer, @TrType_cbuffer, @InventoryScanTime_cbuffer )
nAddressPort:cbuffer = nAddressPort_cbuffer
VersionInfo:cbuffer = VersionInfo_cbuffer
ReaderType:cbuffer = ReaderType_cbuffer
TrType:cbuffer = TrType_cbuffer
InventoryScanTime:cbuffer = InventoryScanTime_cbuffer
Re: DLL
Posted: Sat May 26, 2012 11:49 am
by kok joek hoa
Dear Antonio,
still does'n work .
regards,
Kok
Re: DLL
Posted: Sat May 26, 2012 12:46 pm
by Antonio Linares
Are variables empty ?
Re: DLL
Posted: Sat May 26, 2012 1:32 pm
by kok joek hoa
Dear Antonio,
Yes, variabel still empty.
I have changed a bit of your code as below and could return the value , but i don't know the value is true or not .
Code: Select all | Expand
#include "Fwce.ch"
#include "dll.ch"
#include "Struct.ch"
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)
msginfo(rfid_openRf(nAddressPort:nvalue ))
if rfid_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()
local nAddressPort_cbuffer
local VersionInfo_cbuffer
local ReaderType_cbuffer
local TrType_cbuffer
local InventoryScanTime_cbuffer
LOCAL AARRAY :={}
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
nAddressPort_cbuffer := nAddressPort:cbuffer
VersionInfo_cbuffer := VersionInfo:cbuffer
ReaderType_cbuffer := ReaderType:cbuffer
TrType_cbuffer := TrType:cbuffer
InventoryScanTime_cbuffer := InventoryScanTime:cbuffer
msginfo(nAddressPort:nValue)
RFID_GetReaderInfo ( @nAddressPort_cbuffer ,;
@VersionInfo_cbuffer ,;
@ReaderType_cbuffer ,;
@TrType_cbuffer ,;
@InventoryScanTime_cbuffer ;
)
nAddressPort:cbuffer := nAddressPort_cbuffer
VersionInfo:cbuffer := VersionInfo_cbuffer
ReaderType:cbuffer := ReaderType_cbuffer
TrType:cbuffer := TrType_cbuffer
InventoryScanTime:cbuffer := InventoryScanTime_cbuffer
msginfo(nAddressPort:nValue)
msginfo(VersionInfo:Versionnumber)
msginfo(VersionInfo:Versionnumber1)
msginfo( ReaderType:typereader )
msginfo(TrType:type1)
msginfo(TrType:type2)
msginfo(InventoryScanTime:nValue)
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>
LONG GetReaderInfo( LPWSTR ,LPWSTR ,LPWSTR ,LPWSTR ,LPWSTR ) ;
LPWSTR AnsiToWide( LPSTR );
LPSTR WideToAnsi( LPWSTR );
HB_FUNC( RFID_GETREADERINFO )
{
LPWSTR ComAdr = AnsiToWide( (char *) hb_parc( 1 ) );
LPWSTR VersionInfo = AnsiToWide( (char *) hb_parc( 2 ) );
LPWSTR ReaderType = AnsiToWide( (char *) hb_parc( 3 ) );
LPWSTR TrType = AnsiToWide( (char *) hb_parc( 4 ) );
LPWSTR InventoryScanTime = AnsiToWide( (char *) hb_parc( 5 ) );
LPSTR p1, p2, p3, p4, p5;
GetReaderInfo( ComAdr, VersionInfo, ReaderType, TrType, InventoryScanTime ) ;
p1 = WideToAnsi( ComAdr );
p2 = WideToAnsi( VersionInfo );
p3 = WideToAnsi( ReaderType );
p4 = WideToAnsi( TrType );
p5 = WideToAnsi( InventoryScanTime );
hb_reta( 5 );
hb_storc( p1, 1 );
hb_storc( p2, 2 );
hb_storc( p3, 3 );
hb_storc( p4, 4 );
hb_storc( p5, 5 );
hb_xfree( ComAdr );
hb_xfree( VersionInfo );
hb_xfree( ReaderType );
hb_xfree( TrType );
hb_xfree( InventoryScanTime );
hb_xfree( p1 );
hb_xfree( p2 );
hb_xfree( p3 );
hb_xfree( p4 );
hb_xfree( p5 );
}
#pragma ENDDUMP
//------------------------open rf
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
LONG OpenRF( CHAR ) ;
LPWSTR AnsiToWide( LPSTR );
LPSTR WideToAnsi( LPWSTR );
HB_FUNC( RFID_OPENRF )
{
//LPWSTR ComAdr = AnsiToWide( (char *) hb_parc( 1 ) );
hb_retnl( OpenRF( hb_parc( 1 )) ) ;
//hb_xfree( ComAdr );
}
#pragma ENDDUMP
regards,
kok
Re: DLL
Posted: Sat May 26, 2012 2:55 pm
by kok joek hoa
Dear Antonio,
Thank you for your Help, Now the program can control RFID HandHeld Reader ISO 15693.
Regards,
Kok
Code: Select all | Expand
#include "Fwce.ch"
#include "dll.ch"
#include "Struct.ch"
static nconnection
static nclose_connection
function RFID_MAIN()
local ownd
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()
@ 90,10 BUTTON "Change to ISO15693" SIZE 150,30 OF OWND PIXEL UPDATE action fun_change_to_iso15693()
@ 90,10 BUTTON "Change to ISO15693" SIZE 150,30 OF OWND PIXEL UPDATE action fun_change_to_iso15693()
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()
if rfid_openRf(nAddressPort:nvalue )==0
msginfo('Open Rf Sukses')
else
msginfo('Open Rf Gagal')
endif
return nil
static function fun_closerf()
if RFID_CLOSERF ( nAddressPort:nvalue )==0
msginfo('Close Rf sukses')
else
msginfo('Close Rf Gagal')
endif
return nil
static function fun_change_to_iso15693()
if RFID_CHANGETO15693 ( nAddressPort:nvalue )==0
msginfo('ISO 15693')
else
msginfo('unchange ISO')
endif
return nil
static function fun_reader_information()
local nAddressPort_cbuffer
local VersionInfo_cbuffer
local ReaderType_cbuffer
local TrType_cbuffer
local InventoryScanTime_cbuffer
LOCAL AARRAY :={}
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
nAddressPort_cbuffer := nAddressPort:cbuffer
VersionInfo_cbuffer := VersionInfo:cbuffer
ReaderType_cbuffer := ReaderType:cbuffer
TrType_cbuffer := TrType:cbuffer
InventoryScanTime_cbuffer := InventoryScanTime:cbuffer
msginfo(nAddressPort:nValue)
RFID_GetReaderInfo ( @nAddressPort_cbuffer ,;
@VersionInfo_cbuffer ,;
@ReaderType_cbuffer ,;
@TrType_cbuffer ,;
@InventoryScanTime_cbuffer ;
)
nAddressPort:cbuffer := nAddressPort_cbuffer
VersionInfo:cbuffer := VersionInfo_cbuffer
ReaderType:cbuffer := ReaderType_cbuffer
TrType:cbuffer := TrType_cbuffer
InventoryScanTime:cbuffer := InventoryScanTime_cbuffer
msginfo(nAddressPort:nValue)
msginfo(VersionInfo:Versionnumber)
msginfo(VersionInfo:Versionnumber1)
msginfo( ReaderType:typereader )
msginfo(TrType:type1)
msginfo(TrType:type2)
msginfo(InventoryScanTime:nValue)
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>
LONG GetReaderInfo( LPWSTR ,LPWSTR ,LPWSTR ,LPWSTR ,LPWSTR ) ;
LPWSTR AnsiToWide( LPSTR );
LPSTR WideToAnsi( LPWSTR );
HB_FUNC( RFID_GETREADERINFO )
{
LPWSTR ComAdr = AnsiToWide( (char *) hb_parc( 1 ) );
LPWSTR VersionInfo = AnsiToWide( (char *) hb_parc( 2 ) );
LPWSTR ReaderType = AnsiToWide( (char *) hb_parc( 3 ) );
LPWSTR TrType = AnsiToWide( (char *) hb_parc( 4 ) );
LPWSTR InventoryScanTime = AnsiToWide( (char *) hb_parc( 5 ) );
LPSTR p1, p2, p3, p4, p5;
GetReaderInfo( ComAdr, VersionInfo, ReaderType, TrType, InventoryScanTime ) ;
p1 = WideToAnsi( ComAdr );
p2 = WideToAnsi( VersionInfo );
p3 = WideToAnsi( ReaderType );
p4 = WideToAnsi( TrType );
p5 = WideToAnsi( InventoryScanTime );
hb_reta( 5 );
hb_storc( p1, 1 );
hb_storc( p2, 2 );
hb_storc( p3, 3 );
hb_storc( p4, 4 );
hb_storc( p5, 5 );
hb_xfree( ComAdr );
hb_xfree( VersionInfo );
hb_xfree( ReaderType );
hb_xfree( TrType );
hb_xfree( InventoryScanTime );
hb_xfree( p1 );
hb_xfree( p2 );
hb_xfree( p3 );
hb_xfree( p4 );
hb_xfree( p5 );
}
#pragma ENDDUMP
//------------------------open rf
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
LONG OpenRF( LPARAM) ;
HB_FUNC( RFID_OPENRF )
{
hb_retnl( OpenRF((DWORD)hb_parc( 1 ) ) ) ;
}
#pragma ENDDUMP
//------------------------closeRf rf
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
LONG CloseRF( LPARAM) ;
HB_FUNC( RFID_CLOSERF )
{
hb_retnl( CloseRF((DWORD)hb_parc( 1 ) ) ) ;
}
#pragma ENDDUMP
//------------------------change to iso 15693
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
LONG ChangeTo15693( LPARAM) ;
HB_FUNC( RFID_CHANGETO15693 )
{
hb_retnl( ChangeTo15693((DWORD)hb_parc( 1 ) ) ) ;
}
#pragma ENDDUMP
Re: DLL
Posted: Sat May 26, 2012 4:45 pm
by Antonio Linares
Very good
Re: DLL
Posted: Mon May 28, 2012 3:53 am
by cllow208
Hi Kok,
I would like to test on your RFID function, but i found the following error on linking.. Kindly help.
Thanks & best regards,
CL Low
谀哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪目
?FiveWin for Pocket PC - February 2010 Harbour development power 耻
?(c) FiveTech Software, 1993-2010 for Microsoft Windows Pocket PC 驰
滥哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪馁?
哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌?
Compiling...
rfid.c
rfid.obj : error LNK2019: unresolved external symbol GetReaderInfo referenced in function HB_FUN_RFID_GETREADERINFO
rfid.obj : error LNK2019: unresolved external symbol OpenRF referenced in function HB_FUN_RFID_OPENRF
rfid.obj : error LNK2019: unresolved external symbol CloseRF referenced in function HB_FUN_RFID_CLOSERF
rfid.obj : error LNK2019: unresolved external symbol ChangeTo15693 referenced in function HB_FUN_RFID_CHANGETO15693
rfid.exe : fatal error LNK1120: 4 unresolved externals
* Linking errors *
Re: DLL
Posted: Mon May 28, 2012 5:09 am
by kok joek hoa
Dear cllow208,
You need rr3wince.dll and rr3wince.lib.
give me your email, I will send it to you.
regards,
kok
Re: DLL
Posted: Mon May 28, 2012 6:40 am
by cllow208
Hi Kok,
My email is
lcl64@live.co.ukThanks for your help.
Thanks & Best regards,
CL Low
Re: DLL
Posted: Mon May 28, 2012 7:18 am
by kok joek hoa
Dear CL Low,
Please see your email.
I send you 3 files ( RR3wince.dll ,RR3wince.lib and rfid156.prg ).
Handheld that I used = RR3306 , samsung ARM 920T
Regards,
Kok
Re: DLL
Posted: Tue May 29, 2012 6:29 am
by cllow208
Hi Kok,
Thanks for your help..
Unfortunately it can't run on my machine PDA CI360 with RFID(HF,13.56M,Protocol iso14443A), with error message: "The file 'rfid' cannot opened. Either it is not signed with a trusted certificate, or one of its component cannot be found. If the problem persists, try installing or restoring this file."
If you come to know some codes for Protocol iso14443A, kindly let me know...
Thanks again for your help.
Best regards,
CL Low
Re: DLL
Posted: Tue May 29, 2012 10:35 am
by kok joek hoa
Hi CL low,
sometime different device needs different library.
you must use library/SDK that come from with your device.
regards,
kok