Want to advertise here? We get over 3 Million hits per year! Contact us today!



Author Topic: Metrologic USB Scanner  (Read 2828 times)

JonBennett

  • Newbie
  • *
  • Posts: 1
  • Post Quality: +0/-0
    • View Profile
    • Email
Metrologic USB Scanner
« on: February 24, 2011, 07:02:01 AM »
I have a Metrologic MS9520 scanner which i am trying to configure for use with POS.NET 1.12.  I have the hardware ID in C:\Program Files\Common Files\microsoft shared\Point Of Service\Control Configurations\Control configurations.xml as follows: -

XML

<PointOfServiceConfig Version="1.0">
<ServiceObject Type="Scanner" Name="MetroRS232Scanner">
  <HardwareID From="HID\VID_0C2E&amp;PID_0200&amp;REV_0100" To="HID_DEVICE_UP:0001_U:0006" />
  <HardwareId From="HID_DEVICE_SYSTEM_KEYBOARD" To="HID_DEVICE_SYSTEM_KEYBOARD" />
  <HardwareId From="HID_DEVICE" To="HID_DEVICE" />
</ServiceObject>
</PointOfServiceConfig>


and my code to open, claim, and enable my scanner is as follows: -

 Private WithEvents _explorer As PosExplorer
    Private _scannerList As DeviceCollection
    Public WithEvents _activeScanner As Scanner
    Public Event DataEvent As DataEventHandler

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        'Method(One)
        Dim count As Integer = Nothing
        Try
            count = 0
            'Open Explorer and Get list of scanner
            _explorer = New PosExplorer()
            '_explorer = New PosDevice()
            _scannerList = _explorer.GetDevices(DeviceType.Scanner)
            'Activate the metrologic scanner
            For Each item As DeviceInfo In _scannerList
                'For Each item As Scanner In _scannerList
                count += 1
                If item.ServiceObjectName = "MetroRS232Scanner" Then ' And (count = 5 Or count = 3 Or count = 4) Then
                    'If item.DeviceName = "MetroRS232Scanner" And (count = 3 Or count = 4) Then
                    'If active scanner is set close it
                    If Not _activeScanner Is Nothing Then
                        _activeScanner.Close()
                        _activeScanner = Nothing
                    End If
                    _activeScanner = DirectCast(_explorer.CreateInstance(item), Scanner)
                    _activeScanner.Open()
                    _activeScanner.Claim(1000)
                    _activeScanner.DeviceEnabled = True
                    _activeScanner.AutoDisable = False
                    _activeScanner.DecodeData = True
                    _activeScanner.DataEventEnabled = True

                    RaiseEvent DataEvent(sender, e)

                    _activeScanner.DeviceEnabled = True

                    'Dim dataEvent As DataEventHandler = PosCommon.GetType().GetEvent("DataEvent")

                    MessageBox.Show(_activeScanner.DeviceEnabled)
                End If
                'End If
            Next


        Catch ex As PosControlException
            MessageBox.Show(ex.ToString)
        Finally
            _explorer = Nothing
        End Try
    End Sub

    Private Sub activeScanner_DataEvent(ByVal sender As Object, ByVal e As DataEventArgs) Handles _activeScanner.DataEvent
        Dim encoder As ASCIIEncoding = New ASCIIEncoding()
        Try
            ' Display the ASCII encoded label text
            Label1.Text = encoder.GetString(_activeScanner.ScanDataLabel)
            ' Display the encoding type
            Label1.Text = _activeScanner.ScanDataType.ToString()
            ' re-enable the data event for subsequent scans
            _activeScanner.DataEventEnabled = True
        Catch ex As PosControlException
            MessageBox.Show(ex.ToString)
        Finally
            encoder = Nothing
        End Try

        Dim sCode As String = System.Text.Encoding.ASCII.GetString(_activeScanner.ScanDataLabel)

    End Sub

    Private Sub activeScanner_ErrorEvent(ByVal sender As Object, ByVal e As DeviceErrorEventArgs)
        Try
            're-enable the data event for subsequent scans
            _activeScanner.DataEventEnabled = True
        Catch ex As PosControlException
        End Try
    End Sub

The code seems run without errors however after the DeviceEnabled is set to true, It seems to ignore this command and leave the property set to false.  And when something is scanned the Dataevent will NOT fire. Do i need to reconfigure the scanner into USB or HID mode? Any one any ideas any help would be greatly appreciated...  

Thanks

POSforum.net POS Help and Advice Forum

Metrologic USB Scanner
« on: February 24, 2011, 07:02:01 AM »

sarasmile

  • Newbie
  • *
  • Posts: 1
  • Post Quality: +0/-0
    • View Profile
Re: Metrologic USB Scanner
« Reply #1 on: June 21, 2011, 04:46:54 PM »
If/when the Metrologic scanners we used started failing or acting up, we would typically recycle them by rescannign all the setup codes manually. Worked 99% of the time. A lot of the time the barcode software was at fault so we would have to remove it then re-add it to the software configuration.

cyat

  • Newbie
  • *
  • Posts: 1
  • Post Quality: +0/-0
    • View Profile
    • Email
Re: Metrologic USB Scanner
« Reply #2 on: June 27, 2011, 06:31:03 PM »
If/when the Metrologic scanners we used started failing or acting up, we would typically recycle them by rescannign all the setup codes manually. Worked 99% of the time. A lot of the time the barcode software was at fault so we would have to remove it then re-add it to the software configuration.
This is exactly what we did to fix our scanners, it works pretty well.