This event is triggered when the device writes a card.
ID of the user to be written into a card
Result of writing user information into a card. 0: Success. Other values: Failure.
Size of the data to be written into a card
//Create Standalone SDK class dynamicly. zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass(); //the boolean value identifies whether the device is connected int iMachineNumber = 1; private void Connect_OnWriteCard(string sIp = "10.0.0.44", int iPort = 4370, int iMachineNumber = 1) { //the boolean value identifies whether the device is connected bool bIsConnected = false; //the serial number of the device.After connecting the device ,this value will be changed. int idwErrorCode = 0; bIsConnected = axCZKEM1.Connect_Net(sIp, iPort); if (bIsConnected == true) { iMachineNumber = 1;//In fact,when you are using the tcp/ip communication,this parameter will be ignored,that is any integer will all right.Here we use 1. axCZKEM1.RegEvent(iMachineNumber, 65535);//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all) this.axCZKEM1.OnWriteCard += new zkemkeeper._IZKEMEvents_OnWriteCardEventHandler(axCZKEM1_OnWriteCard); } else { axCZKEM1.GetLastError(ref idwErrorCode); MessageBox.Show("Unable to connect the device,ErrorCode=" + idwErrorCode.ToString(), "Error"); } } private void axCZKEM1_OnWriteCard(int iEnrollNumber, int iActionResult, int iLength) { MessageBox.Show("RTEvent OnWriteCard Has been Triggered..."); if (iActionResult == 0) { MessageBox.Show("...Write Mifare Card OK"); MessageBox.Show("...EnrollNumber=" + iEnrollNumber.ToString()); MessageBox.Show("...TmpLength=" + iLength.ToString()); } else { MessageBox.Show("...Write Failed"); } } private void Disconnect_OnWriteCard() { axCZKEM1.Disconnect(); this.axCZKEM1.OnWriteCard -= new zkemkeeper._IZKEMEvents_OnWriteCardEventHandler(axCZKEM1_OnWriteCard); }
'Create Standalone SDK class dynamicly. Dim axCZKEM1 As New zkemkeeper.CZKEM Private Sub Connect_OnWriteCard(sIp As String, iPort As Integer, iMachineNumber As Integer) axCZKEM1.Connect_Net(sIp, iPort) 'the boolean value identifies whether the device Is connected Dim bIsConnected As Boolean = False 'the serial number of the device.After connecting the device ,this value will be changed. Dim idwErrorCode As Integer = 0 bIsConnected = axCZKEM1.Connect_Net(sIp, iPort) If bIsConnected = True Then iMachineNumber = 1 'In fact,when you are using the tcp/ip communication,this parameter will be ignored,that is any integer will all right.Here we use 1. axCZKEM1.RegEvent(iMachineNumber, 65535) 'Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all) AddHandler axCZKEM1.OnWriteCard, AddressOf AxCZKEM1_OnWriteCard Else axCZKEM1.GetLastError(idwErrorCode) MsgBox("Unable to connect the device,ErrorCode=" & idwErrorCode, MsgBoxStyle.Exclamation, "Error") End If End Sub Private Sub AxCZKEM1_OnWriteCard(ByVal iEnrollNumber As Integer, ByVal iActionResult As Integer, ByVal iLength As Integer) MsgBox("RTEvent OnWriteCard Has been Triggered...") If iActionResult = 0 Then MsgBox("...Write Mifare Card OK" & "...EnrollNumber=" & iEnrollNumber.ToString() & "...TmpLength=" & iLength.ToString()) Else MsgBox("...Write Failed") End If End Sub Private Sub Disconnect_OnWriteCard() 'Create Standalone SDK class dynamicly. Dim axCZKEM1 As New zkemkeeper.CZKEM axCZKEM1.Disconnect() RemoveHandler axCZKEM1.OnWriteCard, AddressOf AxCZKEM1_OnWriteCard End Sub