⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdlubr.bas

📁 Test program for Hitachi Finger Vein
💻 BAS
📖 第 1 页 / 共 3 页
字号:
    tmpBuf(1) = Asc("3")
    tmpBuf(2) = Asc("9")
    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_EraseTemplateFlashROM = bRet
End Function

Public Function UBR_EraseTemplateSDRAM(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("3")
    tmpBuf(2) = Asc("A")
    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_EraseTemplateSDRAM = bRet
End Function

Public Function UBR_SimilarityCheckStart(ByRef objCom As MSComm, ByRef objTimer As Timer, 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("3")
    tmpBuf(2) = Asc("1")
    tmpBuf(3) = Asc("0")
    
    tmpBuf(4) = &H98
    tmpBuf(5) = &H1
    tmpBuf(6) = &H0
    tmpBuf(7) = &H0
    
    tmpBuf(8) = &H0
    tmpBuf(9) = &H0
    tmpBuf(10) = &H0
    tmpBuf(11) = &H0
    
    For i = 1 To 400
        tmpBuf(11 + i) = byteTemplate(i - 1)
    Next
    
    tmpBuf(412) = &HFF
    tmpBuf(413) = &HFF
    tmpBuf(414) = &HFF
    tmpBuf(415) = &HFF
    
    nRet = SendCommand(objCom, objTimer, tmpBuf, 416, 0, 0)
    If nRet > 0 Then
        bRet = True
    End If
    
    UBR_SimilarityCheckStart = bRet
End Function

Public Function UBR_SimilarityCheckResult(ByRef objCom As MSComm, ByRef objTimer As Timer) As Long
    Dim tmpBuf(0 To 532) As Byte
    Dim nRet As Long
    Dim lRet As Long
    
    lRet = 0
            
    tmpBuf(0) = Asc("U")
    tmpBuf(1) = Asc("3")
    tmpBuf(2) = Asc("1")
    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
        lRet = Reply(11)
    End If
    
    UBR_SimilarityCheckResult = lRet
End Function

Public Function UBR_Save2RAMStart(ByRef objCom As MSComm, ByRef objTimer As Timer, ByVal szUserID As String, ByRef bytePattern() As Byte) As Long
    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("3")
    tmpBuf(2) = Asc("2")
    tmpBuf(3) = Asc("0")
    
    tmpBuf(4) = &H0
    tmpBuf(5) = &H2
    tmpBuf(6) = &H0
    tmpBuf(7) = &H0
    
    'Store template (400 bytes , start at 408)
    For i = 0 To (400 - 1)
        tmpBuf(8 + i) = bytePattern(i)
    Next
    
    'Store S/N (Driver AP) (16 bytes , start at 425)
    For i = 0 To (16 - 1)
        tmpBuf(425 + i) = &H0
    Next
    
    'Store user information (64 bytes , start at 442)
    For i = 0 To (64 - 1)
        If i < 16 Then
            tmpBuf(442 + i) = Asc(Mid$(szUserID, i + 1, 1))
        ElseIf i = 16 Then
            tmpBuf(442 + i) = &H1
        Else
            tmpBuf(442 + i) = Asc(" ")
        End If
    Next
    
    'Store reserved byte (16 bytes , start at 507)
    For i = 0 To (16 - 1)
        tmpBuf(507 + i) = &H0
    Next
    
    nRet = SendCommand(objCom, objTimer, tmpBuf, 520, 0, 0)
    If nRet > 0 Then
        nRet = Reply(11)
    Else
        nRet = 0
    End If
    
    UBR_Save2RAMStart = nRet
End Function

Public Function UBR_Save2RAMResult(ByRef objCom As MSComm, ByRef objTimer As Timer) As Long
    Dim tmpBuf(0 To 532) As Byte
    Dim nRet As Long
    Dim lRet As Long
    
    lRet = 0
            
    tmpBuf(0) = Asc("U")
    tmpBuf(1) = Asc("3")
    tmpBuf(2) = Asc("6")
    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
        lRet = Reply(11)
    End If
    
    UBR_Save2RAMResult = lRet
End Function

Public Function UBR_Authentication_1ToN_Internal_Start(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("3")
    tmpBuf(2) = Asc("0")
    tmpBuf(3) = Asc("0")
    
    '--- Length of Addition Information (AI)
    tmpBuf(4) = &H10            '16 bytes
    tmpBuf(5) = &H0
    tmpBuf(6) = &H0
    tmpBuf(7) = &H0

    '--- (AI) Authentication Time-out (in 500 ms) (4 bytes)
    tmpBuf(8) = &HC
    tmpBuf(9) = &H0
    tmpBuf(10) = &H0
    tmpBuf(11) = &H0

    '--- (AI) Engine Loop Time-out (4 bytes)
    tmpBuf(12) = &H3
    tmpBuf(13) = &H0
    tmpBuf(14) = &H0
    tmpBuf(15) = &H0

    '--- (AI) Security Level of Authentication (Precision) (4 bytes) --> 0=HIGHEST , 1=HIGH , 2=MIDDLE , 3=LOW
    tmpBuf(16) = &H2
    tmpBuf(17) = &H0
    tmpBuf(18) = &H0
    tmpBuf(19) = &H0

    '--- (AI) Number of template in SDRAM to be deployed (FFFFFFFF=all) (4 bytes)
    tmpBuf(20) = &HFF
    tmpBuf(21) = &HFF
    tmpBuf(22) = &HFF
    tmpBuf(23) = &HFF
    
    nRet = SendCommand(objCom, objTimer, tmpBuf, 24, 0, 0)
    If nRet > 0 Then
        bRet = True
    End If
    
    UBR_Authentication_1ToN_Internal_Start = bRet
End Function

Public Function UBR_Authentication_1ToN_Internal_Result(ByRef objCom As MSComm, ByRef objTimer As Timer) As Long
    Dim tmpBuf(0 To 532) As Byte
    Dim nRet As Long
    Dim lRet As Long
    
    lRet = 0
            
    tmpBuf(0) = Asc("U")
    tmpBuf(1) = Asc("3")
    tmpBuf(2) = Asc("0")
    tmpBuf(3) = Asc("1")
    
    '--- Length of Addition Information (AI)
    tmpBuf(4) = &H0            '0 bytes
    tmpBuf(5) = &H0
    tmpBuf(6) = &H0
    tmpBuf(7) = &H0

    nRet = SendCommand(objCom, objTimer, tmpBuf, 8, 0, 0)
    If nRet > 0 Then
        lRet = Reply(11)
    End If
    
    UBR_Authentication_1ToN_Internal_Result = lRet
End Function

Public Function UBR_Download_SetExternalTemplate(ByRef objCom As MSComm, ByRef objTimer As Timer, ByVal nIndex As Integer, ByRef bytePattern() As Byte) As Long
    ' This function is purposely to download the external template(s), maximum is 10 templates,
    ' to be used for a '1 to N External Template Authentication'
    Dim i As Integer
    Dim tmpBuf(0 To 532) As Byte
    Dim nRet As Long
    Dim lRet As Long
    
    lRet = 0
            
    tmpBuf(0) = Asc("U")
    tmpBuf(1) = Asc("2")
    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
        
    'Store template (400 bytes , start at 12)
    For i = 0 To (400 - 1)
        tmpBuf(12 + i) = bytePattern(i)
    Next
    
    nRet = SendCommand(objCom, objTimer, tmpBuf, 412, 0, 0)
    If nRet > 0 Then
        lRet = Reply(11)
        'Debug.Print lRet & " - " & Chr(Reply(11))
    End If
    
    UBR_Download_SetExternalTemplate = lRet
End Function

Public Function UBR_Authentication_1ToN_External_Start(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("2")
    tmpBuf(2) = Asc("2")
    tmpBuf(3) = Asc("0")
    
    '--- Length of Addition Information (AI)
    tmpBuf(4) = &H10            '16 bytes
    tmpBuf(5) = &H0
    tmpBuf(6) = &H0
    tmpBuf(7) = &H0

    '--- (AI) Number of External Template intended for authentication (4 bytes)
    tmpBuf(8) = &H3
    tmpBuf(9) = &H0
    tmpBuf(10) = &H0
    tmpBuf(11) = &H0

    '--- (AI) Authentication Time-out (in 500 ms) (4 bytes)
    tmpBuf(12) = &HA
    tmpBuf(13) = &H0
    tmpBuf(14) = &H0
    tmpBuf(15) = &H0

    '--- (AI) Engine Loop Time-out (4 bytes)
    tmpBuf(16) = &H0
    tmpBuf(17) = &H0
    tmpBuf(18) = &H0
    tmpBuf(19) = &H0

    '--- (AI) Security Level of Authentication (Precision) (4 bytes) --> 0=HIGHEST , 1=HIGH , 2=MIDDLE , 3=LOW
    tmpBuf(20) = &H3
    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_Authentication_1ToN_External_Start = bRet
End Function

Public Function UBR_Authentication_1ToN_External_Result(ByRef objCom As MSComm, ByRef objTimer As Timer) As Long
    Dim tmpBuf(0 To 532) As Byte
    Dim nRet As Long
    Dim lRet As Long
    
    lRet = 0
            
    tmpBuf(0) = Asc("U")
    tmpBuf(1) = Asc("2")
    tmpBuf(2) = Asc("2")
    tmpBuf(3) = Asc("1")
    
    '--- Length of Addition Information (AI)
    tmpBuf(4) = &H0            '0 bytes
    tmpBuf(5) = &H0
    tmpBuf(6) = &H0
    tmpBuf(7) = &H0

    nRet = SendCommand(objCom, objTimer, tmpBuf, 8, 0, 0)
    If nRet > 0 Then
        lRet = Reply(11)
    End If
    
    UBR_Authentication_1ToN_External_Result = lRet
End Function

Public Function UBR_Erase_SetExternalTemplate(ByRef objCom As MSComm, ByRef objTimer As Timer) As Long
    Dim tmpBuf(0 To 532) As Byte
    Dim nRet As Long
    Dim lRet As Long
    
    lRet = 0
            
    tmpBuf(0) = Asc("U")
    tmpBuf(1) = Asc("2")
    tmpBuf(2) = Asc("3")
    tmpBuf(3) = Asc("0")
    
    '--- Length of Addition Information (AI)
    tmpBuf(4) = &H0            '0 bytes
    tmpBuf(5) = &H0
    tmpBuf(6) = &H0
    tmpBuf(7) = &H0

    nRet = SendCommand(objCom, objTimer, tmpBuf, 8, 0, 0)
    If nRet > 0 Then
        lRet = Reply(11)
    End If
    
    UBR_Erase_SetExternalTemplate = lRet
End Function


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -