Hi, its me again, sorry for disturbing anyone who viewing my question but i would like to ask may i know how can i achieve the initalize funcion by using enum?currently when my coding running, i would be able to get make the device initialize, but it was done by calling the function from the API. so what would i like to let the device read the the commander in hex which i write in enum and make it execute that specific command only but i got no clue on how to use it due everytime i set the bMode as the enum i set, it just execute the function which call from api and not mine. The code of currently i write would be as below
These would be the code which i write in c++
and this would be the code which i had write in vb6 form
below would be the document for this initialize function
F3_Initialize Resetcardreader
LONG
WINAPI
F3_Initialize
(INREADERHANDLEhReader,
INBYTEbMode,
INBOOLfEnableCounter,
OUTPSTRpszRevBuff,
INOUTPDWORDpcbRevLength
);
Parameter:
hReaderQuote F3_Connect return handle value.
bModeResetmodel, availablevalue:
INIT_RETURN_TO_FRONT Resetandmovecardtoexitport
INIT_CAPTURE_TO_BOX Resetandreclaimcard
INIT_WITHOUT_Movement Resetbutcardnoaction
EnableCounter on/offthecollectcardcounterfunction
pszRevBuff return firmware versioninfo
pcbRevLength provideÂpbVerBuffÂparameterdatalength(bytenumber),andreceivereaderreturndata.
ReturnValue: Return 0 is success,other number are error.
so according to this document, what im currenly doing is correct, the parameter i pass in also is correct due it would return 0 which means sucess, but the issue is for the bMode Part, after i set the bMode in the enum, it execute the bMode which is default instead of the bMode which i had set and return the initialize failed to me while it is doing initialize. So may i know like any document or any method which i can follow to properly use that enum function to let the device execute the bMode which i had set?
Thank you.
These would be the code which i write in c++
Code:
--------------------------------------------------------------------------------------------------
Initialization For The Device
*/
MTKF32X3_API_API long __stdcall MTK_InitializeDevice(BYTE bMode,BOOL fEnableCounter,PSTR pszRevBuff,PDWORD pcbRevLength,sRespData *Data)
{
long lngResult, lngRtn;
char strMsg[512];
memset((void*)strMsg, '\0', sizeof(strMsg));
try {
lngResult = F3_Initialize(g_Reader,bMode,fEnableCounter,pszRevBuff,pcbRevLength);
if(pcbRevLength == F3_S_SUCCESS) {
lngRtn = 0;
sprintf_s(strMsg, "Initialize sucess ");
} else {
lngRtn = -1;
sprintf_s(strMsg, "Initialize failed");
}
Data->ErrCode = (long)lngResult;
Data->Message = SysAllocStringByteLen(strMsg, strlen(strMsg));
modcommon_library WriteLog(strMsg);
return lngRtn;
}
catch (exception& e)
{
sprintf_s(strMsg, "Exception@MTKF32X2_Initialize: %s", e.what());
modcommon_library WriteError(strMsg);
return -1;
}
}
Code:
Code:
'------------------------------------------Initialize Function--------------------------------------------------------
Private Sub btnResetCardtoFront_Click()
Dim lngRtn As Long
Dim lngResult As Long
Dim bMode As Byte
Dim fEnableCounter As Boolean
Dim pszRevBuff As String
Dim pcbRevLength As Long
bMode = InitializeMoveCardHoldFrontParameter
lngResult = MTK_InitializeDevice(bMode, True, pszRevBuff, pcbRevLength, sResp)
If lngResult = 0 Then
lngRtn = 0
Debug.Print "Initialize and moved card to front sucess "
Else
lngRtn = -1
MsgBox "Initialize failed"
Unload Me: Exit Sub
End If
End Sub
and this is the code which i write in the module file in vb6
Option Explicit
Type sRespData
ErrCode As Long
Message As String
End Type
Type sCRSTATUS
bLaneStatus As Byte
bCardBoxStatus As Byte
fCaptureBoxFull As Boolean
End Type
Enum eCommandTag
InitializeCommand = &H30
ReaderStatusInquiryCommand = &H31
CardMovementCommand = &H32
CardEntrySettingCommand = &H33
CPUCardOperationCommand = &H51
DispenserOperationCommand = &H76
End Enum
Enum eParameterTag
'initialize
InitializeMoveCardHoldFrontParameter = &H30
InitializeMoveCardToErrorParameter = &H31
InitializeNoMoveParameter = &H33
'reader and sensor status
InquireCurrentReaderStatusParameter = &H30
InquireReaderSensorStatusParameter = &H31
'move card
MoveCardFrontAndHoldParameter = &H30
MoveCardToICPositionParameter = &H31
MoveCardToRFPositionParameter = &H32
MoveCardToErrorBoxParameter = &H33
EjectCardOutReaderParameter = &H39
'enable and disable front entry of CR
AllowCardFrontEntryParameter = &H30
ForbidCardFrontEntryParameter = &H31
CPUColdResetParameter = &H30
CPUPowerDownParameter = &H31
CPUStatusInquiry = &H32
T0CPUCardAPDUTransmissionParameter = &H33
T0CPUCardAPDUTransmission1Parameter = &H34
CPUCardWarmResetParameter = &H38
AutodetectT01AndAPDUtransmissionParamter = &H39
CheckRearDispenseStatusParamter = &H31
MoveCardFromHopperToReaderParamter = &H42
End Enum
Public sResp As sRespData
Public Const MTKF32X3_SUCCESS = 0
Public Declare Function MTK_InitializeDevice Lib "MTKF32X3_API.dll" (bMode As Byte, fEnableCounter As Long, pszRevBuff As String, pcbRevLength As Long, ByRef RespData As sRespData) As Long
Quote:
F3_Initialize Resetcardreader
LONG
WINAPI
F3_Initialize
(INREADERHANDLEhReader,
INBYTEbMode,
INBOOLfEnableCounter,
OUTPSTRpszRevBuff,
INOUTPDWORDpcbRevLength
);
Parameter:
hReaderQuote F3_Connect return handle value.
bModeResetmodel, availablevalue:
INIT_RETURN_TO_FRONT Resetandmovecardtoexitport
INIT_CAPTURE_TO_BOX Resetandreclaimcard
INIT_WITHOUT_Movement Resetbutcardnoaction
EnableCounter on/offthecollectcardcounterfunction
pszRevBuff return firmware versioninfo
pcbRevLength provideÂpbVerBuffÂparameterdatalength(bytenumber),andreceivereaderreturndata.
ReturnValue: Return 0 is success,other number are error.
Thank you.