?? mdlubr.bas
字號:
Public Function UBR_FinishProcess(ByRef objCom As MSComm, ByRef objTimer As Timer) As Boolean
Dim tmpBuf(0 To 31) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("6")
tmpBuf(2) = Asc("0")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H0
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 8, 0, 0)
If nRet > 0 Then
If Reply(11) = &H31 Then
bRet = True
End If
End If
UBR_FinishProcess = bRet
End Function
Public Function UBR_ResetDevice(ByRef objCom As MSComm, ByRef objTimer As Timer) As Boolean
Dim tmpBuf(0 To 31) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("7")
tmpBuf(2) = Asc("0")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H0
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 8, 0, 0)
If nRet > 0 Then
If Reply(11) = &H31 Then
bRet = True
End If
End If
UBR_ResetDevice = bRet
End Function
Public Function UBR_LEDOnOff(ByRef objCom As MSComm, ByRef objTimer As Timer, Optional Is_LED_On As Boolean = True) As Boolean
Dim tmpBuf(0 To 31) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("A")
tmpBuf(2) = Asc("2")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H4
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
tmpBuf(8) = IIf(Is_LED_On, &H1, &H0)
tmpBuf(9) = &H0
tmpBuf(10) = &H0
tmpBuf(11) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 12, 0, 0)
If nRet > 0 Then
If Reply(11) = &H31 Then
bRet = True
End If
End If
UBR_LEDOnOff = bRet
End Function
Public Function UBR_GetEquipmentStatus(ByRef objCom As MSComm, ByRef objTimer As Timer) As Boolean
Dim tmpBuf(0 To 31) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("5")
tmpBuf(2) = Asc("0")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H4
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
'tmpBuf(8) = IIf(Is_LED_On, &H1, &H0)
tmpBuf(9) = &H0
tmpBuf(10) = &H0
tmpBuf(11) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 12, 0, 0)
If nRet > 0 Then
If Reply(11) = &H31 Then
bRet = True
End If
End If
UBR_GetEquipmentStatus = bRet
End Function
Public Function UBR_CreateSession(ByRef objCom As MSComm, ByRef objTimer As Timer) As Boolean
Dim i As Integer
Dim tmpBuf(0 To 8216) As Byte
Dim byteFile(0 To 8208) As Byte
Dim byteSend(0 To 2048) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
Open "GMUBRSesCreate020000.dat" For Binary Access Read As #1 Len = 8208
While Not EOF(1) 'And intSizeCounter < FileSize
Get #1, , byteFile
Wend
Close #1
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("0")
tmpBuf(2) = Asc("2")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H10
tmpBuf(5) = &H20
tmpBuf(6) = &H0
tmpBuf(7) = &H0
For i = 0 To 8207
tmpBuf(8 + i) = byteFile(i)
Next
cntrSeqNo = 0
Do
For i = 0 To (IIf(cntrSeqNo < 4, 2048, 24) - 1)
byteSend(i) = tmpBuf(i + (cntrSeqNo * 2048))
Next
nRet = SendCommand(objCom, objTimer, byteSend, IIf(cntrSeqNo < 4, 2048, 24), IIf(cntrSeqNo < 4, 1, 0), cntrSeqNo)
If nRet > 0 Then
cntrSeqNo = cntrSeqNo + 1
Else
'MsgBox "Error on SeqNo = " & cntrSeqNo
Call Send_EOT(objCom)
Exit Do
End If
Loop While (cntrSeqNo <= 4)
If nRet > 0 Then
bRet = True
End If
UBR_CreateSession = bRet
End Function
Public Function UBR_CloseSession(ByRef objCom As MSComm, ByRef objTimer As Timer) As Boolean
Dim tmpBuf(0 To 31) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("0")
tmpBuf(2) = Asc("4")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H0
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 8, 0, 0)
If nRet > 0 Then
If Reply(11) = &H31 Then
bRet = True
End If
End If
UBR_CloseSession = bRet
End Function
Public Function UBR_LoadInternalTemplate(ByRef objCom As MSComm, ByRef objTimer As Timer) As Boolean
Dim tmpBuf(0 To 31) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("3")
tmpBuf(2) = Asc("5")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H0
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 8, 0, 0)
If nRet > 0 Then
bRet = True
End If
UBR_LoadInternalTemplate = bRet
End Function
Public Function UBR_EnrollmentStart(ByRef objCom As MSComm, ByRef objTimer As Timer) As Boolean
Dim tmpBuf(0 To 31) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("1")
tmpBuf(2) = Asc("4")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H10
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
tmpBuf(8) = &HFF
tmpBuf(9) = &HFF
tmpBuf(10) = &HFF
tmpBuf(11) = &HFF
tmpBuf(12) = &HFF
tmpBuf(13) = &HFF
tmpBuf(14) = &HFF
tmpBuf(15) = &HFF
tmpBuf(16) = &H2
tmpBuf(17) = &H0
tmpBuf(18) = &H0
tmpBuf(19) = &H0
tmpBuf(20) = &H0
tmpBuf(21) = &H0
tmpBuf(22) = &H0
tmpBuf(23) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 24, 0, 0)
If nRet > 0 Then
bRet = True
End If
UBR_EnrollmentStart = bRet
End Function
Public Function UBR_EnrollmentGetResult(ByRef objCom As MSComm, ByRef objTimer As Timer, ByRef byteTemplate() As Byte) As Long
Dim i As Integer
Dim tmpBuf(0 To 31) As Byte
Dim nRet As Long
Dim lRet As Long
lRet = 0
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("1")
tmpBuf(2) = Asc("4")
tmpBuf(3) = Asc("1")
tmpBuf(4) = &H0
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 8, 0, 0)
If nRet > 0 Then
nRet = Reply(12) + (Reply(13) * 256) + (Reply(14) * 256 * 256) + (Reply(15) * 256 * 256 * 256)
If Reply(11) = &H31 And nRet = 400 Then
lRet = &H31
For i = 0 To (400 - 1)
byteTemplate(i) = Reply(16 + i)
Next
Else
lRet = Reply(11)
End If
End If
UBR_EnrollmentGetResult = lRet
End Function
Public Function UBR_StoreTemplate2Buffer(ByRef objCom As MSComm, ByRef objTimer As Timer, ByVal nIndex As Integer, ByRef byteTemplate() As Byte) As Boolean
Dim i As Integer
Dim tmpBuf(0 To 532) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("1")
tmpBuf(2) = Asc("1")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H94
tmpBuf(5) = &H1
tmpBuf(6) = &H0
tmpBuf(7) = &H0
tmpBuf(8) = nIndex
tmpBuf(9) = &H0
tmpBuf(10) = &H0
tmpBuf(11) = &H0
For i = 0 To (400 - 1)
tmpBuf(12 + i) = byteTemplate(i)
Next
nRet = SendCommand(objCom, objTimer, tmpBuf, 412, 0, 0)
If nRet > 0 Then
bRet = True
End If
UBR_StoreTemplate2Buffer = bRet
End Function
Public Function UBR_SelectOptimumTemplate(ByRef objCom As MSComm, ByRef objTimer As Timer) As Integer
Dim tmpBuf(0 To 532) As Byte
Dim nRet As Long
Dim bRet As Integer
bRet = -1
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("1")
tmpBuf(2) = Asc("2")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H4
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
tmpBuf(8) = &H3
tmpBuf(9) = &H0
tmpBuf(10) = &H0
tmpBuf(11) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 12, 0, 0)
If nRet > 0 Then
bRet = Reply(16)
End If
UBR_SelectOptimumTemplate = bRet
End Function
Public Function UBR_EraseTemplateObject(ByRef objCom As MSComm, ByRef objTimer As Timer) As Boolean
Dim tmpBuf(0 To 532) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
tmpBuf(1) = Asc("1")
tmpBuf(2) = Asc("3")
tmpBuf(3) = Asc("0")
tmpBuf(4) = &H0
tmpBuf(5) = &H0
tmpBuf(6) = &H0
tmpBuf(7) = &H0
nRet = SendCommand(objCom, objTimer, tmpBuf, 8, 0, 0)
If nRet > 0 Then
bRet = True
End If
UBR_EraseTemplateObject = bRet
End Function
Public Function UBR_EraseTemplateFlashROM(ByRef objCom As MSComm, ByRef objTimer As Timer) As Boolean
Dim tmpBuf(0 To 532) As Byte
Dim nRet As Long
Dim bRet As Boolean
bRet = False
tmpBuf(0) = Asc("U")
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -