Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Imports System.Data.SqlClient
Public Class Form1
Dim j As Short
Dim port, baud As Integer
Dim buf(200) As Byte
Dim b1 As Byte
Dim s1 As String
Dim counttags As Short
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Private Sub ssss()
Dim j As Short
Dim buf1(200) As Byte
Dim b1 As Byte
Dim s1 As String
Dim i As Integer
i = rf_request(0, &H52S, j)
i = rf_anticoll(0, 4, buf1(0), b1)
s1 = ""
For i = 0 To b1 - 1
s1 = s1 & VB.Right("00" & Hex(buf1(i)), 2)
Next i
TextBox2.Text = s1
i = rf_select(0, buf1(0), 4, b1)
'Dim T1 As Integer
Dim E1, E2, E3, E4, E5 As String
E1 = Mid(TextBox2.Text, 7, 2)
E2 = Mid(TextBox2.Text, 5, 2)
E3 = Mid(TextBox2.Text, 3, 2)
E4 = Mid(TextBox2.Text, 1, 2)
E5 = E1 & E2 & E3 & E4
TextBox2.Text = E5
'For T1 = 1 To 4
'E1 = E1 & Mid(TextBox2.Text, T1 + 1)
'Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
Dim j As Short
Dim buf1(200) As Byte
Dim b1 As Byte
Dim s1 As String
i = rf_request(0, &H52S, j)
'If (i <> 0) Then
' lb_info.Caption = "Request Fail!"
' Exit Sub
'End If
'Anticollision
i = rf_anticoll(0, 4, buf1(0), b1)
'If (i <> 0) Then
' lb_info.Caption = "Anticollision Fail!"
' Exit Sub
'End If
s1 = ""
For i = 0 To b1 - 1
s1 = s1 & VB.Right("00" & Hex(buf1(i)), 2)
Next i
TextBox2.Text = s1
'Select card
i = rf_select(0, buf1(0), 4, b1)
'If (i <> 0) Then
' lb_info.Caption = "Select card fail!"
' Exit Sub
'Else
' lb_info.Caption = "Select card succeed!"
'End If
End Sub
Private Sub open1()
Dim flag As Object
Dim port, i, baud As Integer
Dim buf1(200) As Byte
port = 3
baud = CInt(9600)
i = rf_init_com(port, baud)
If (i <> 0) Then
MsgBox("Open Port Fail!")
Exit Sub
Else
flag = True
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim i, m As Integer
Dim buf1(200) As Byte
Dim buf2(200) As Byte
Dim s1 As String
Dim b2, b1, b3 As Byte
TextBox1.Text = ""
' s1 = "FFFFFFFFFFFF"
ssss()
For i = 0 To 5
buf1(i) = Val("&H" & Mid(s1, i * 2 + 1, 2))
Next i
m = (1 * 4) + 1
b1 = &H60S
b3 = CByte(m)
' Call Authentication()
i = rf_M1_read(0, b3, buf2(0), b2)
If (i <> 0) Then
Exit Sub
End If
s1 = ""
For i = 0 To b2 - 1
s1 = s1 & VB.Right("00" & Hex(buf2(i)), 2)
Next i
TextBox1.Text = s1.Substring(0, 8)
End Sub
End Class