3 Replies - 130 Views - Last Post: 28 November 2017 - 05:06 AM Rate Topic: -----

#1 KC10513  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 13-October 17

Register custom event for multiple device: Windows service

Posted 28 November 2017 - 01:30 AM

Hi Good people,

I have 2 biometric readers (can have more) that i connect to and would like to register some events to it.

Exemple:
1) Device 1
IPv4 : 192.168.11.1
Port : 4370

2) Device 2
IPv4 : 192.168.11.3
Port : 4370

I have event like Onfinger, OnAttTransactionEx etc.... that i would like to register to the device and raise when the user scan his finger.

so when my win service start i would like to call function like this"

 Public Sub BiometricEvents()

       'Loop through an object that contains all the device 
       'for each device i want to create a new thread that will manage it connection
       'and do the registration of the event.

       'This is what is tried so far but am only able to register the event into one device

        'Dim t1 As System.Threading.Thread
        'For Each Reader As PDConnect.clsBiometricReader In _reader
        '    t1 = New Threading.Thread((AddressOf RegisterbiometricEvent))
        '    t1.IsBackground = True
        '    t1.Start(Reader)
        'Next
        'For Each Reader As PDConnect.clsBiometricReader In _reader
        '    Threading.ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf RegisterbiometricEvent), Reader)
        'Next
    End Sub


'This part is the actual connection and registration of the event.
Public Sub RegisterbiometricEvent(ByVal state As Object)

        'For Each Reader As PDConnect.clsBiometricReader In _reader
            'Dim bioreader As New PDConnect.clsBiometricReader(DataFunctions)
            'bioreader = CType(state, PDConnect.clsBiometricReader)
            If CtrlBioComm.Connect_Net(bioreader .IPv4, bioreader .Port) = True Then
                If CtrlBioComm.RegEvent(bioreader .BiometricReaderID, 65535) = True Then
                    AddHandler CtrlBioComm.OnFinger, AddressOf CtrlBioComm_OnFinger
                    AddHandler CtrlBioComm.OnVerify, AddressOf CtrlBioComm_OnVerify
                    AddHandler CtrlBioComm.OnAttTransactionEx, AddressOf CtrlBioComm_OnAttTransactionEx
                End If
            End If
        'Next
    End Sub


'This an exemple of the function that will be raised when the event occur.
 Private Sub CtrlBioComm_OnAttTransactionEx(ByVal UserID As String, ByVal IsInValid As Integer, ByVal AttState As Integer, ByVal VerifyMethod As Integer,ByVal Year As Integer, ByVal Month As Integer, ByVal Day As Integer, ByVal Hour As Integer, ByVal Minute As Integer, ByVal Second As Integer, ByVal WorkCode As Integer)

        'CM : This event will be triggered if the user passes the verification 
        Dim file As System.IO.StreamWriter
        file = My.Computer.FileSystem.OpenTextFileWriter("c:\test.txt", True)
        If Not UserID = "" Then file.WriteLine(UserID.ToString)
        file.Close()

    End Sub



Please note, most of this codes are links to my project(including the zkemkeeper dlls), so am just putting it out there so my helper can see what am trying to do and what i have tried
(so testing this might won't work)
I hope i do make sense and find some help.

Is This A Good Question/Topic? 0
  • +

Replies To: Register custom event for multiple device: Windows service

#2 maceysoftware  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 350
  • View blog
  • Posts: 1,508
  • Joined: 07-September 13

Re: Register custom event for multiple device: Windows service

Posted 28 November 2017 - 02:30 AM

Whats the issue?

All you have stated is what you want to do, so whats not working?
Was This Post Helpful? 0
  • +
  • -

#3 KC10513  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 13-October 17

Re: Register custom event for multiple device: Windows service

Posted 28 November 2017 - 04:38 AM

Thank you but i have just managed to got it working
my issue was that, i wasn't able to get register the event to multiple Device, but it was a silly mistake
my device collection was not getting all the device correctly(wrong DB syntax).
Was This Post Helpful? 0
  • +
  • -

#4 maceysoftware  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 350
  • View blog
  • Posts: 1,508
  • Joined: 07-September 13

Re: Register custom event for multiple device: Windows service

Posted 28 November 2017 - 05:06 AM

Glad you got it working.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1