0

I am developing application which will read credit card no without generating keystrokes for same in POS for .net. I can enable device but when I swipe a card MSR_Dataevent is not firing.

EDIT: I have done below code:

myMSR = myExplorer.CreateInstance(MsrDevice)
myMSR.Open()
myMSR.Claim(60000)
myMSR.AutoDisable = True
myMSR.DecodeData = True
myMSR.TransmitSentinels = False
myMSR.DataEventEnabled = True
myMSR.DeviceEnabled = True
RemoveHandler myMSR.DataEvent, AddressOf myMSR_DataEvent
AddHandler myMSR.DataEvent, AddressOf myMSR_DataEvent
AddHandler myMSR.ErrorEvent, AddressOf myMSR_ErrorEvent
2
  • Did you install the correct Service Objects for your device (sorry, haven't used it in 6 years - forget if this is a requirement), and did you configure your Service Objects to run for that specific port? Seems you might need to do some things with PosDM or WMI - msdn.microsoft.com/en-US/library/… - I'm pretty sure the serial port isn't plug-and-play. If you're on Windows 7 you might need to elevate, too... Nov 19, 2011 at 15:26
  • I don't know if you are still needing any help but I could probably help you out if you are. Mar 29, 2012 at 21:40

3 Answers 3

0

Make sure you are calling device.Open(), device.Claim(), and also setting the DataEventEnabled property to true.

        With Me.msrDevice
            .Open()
            .Claim(5000)

            .AutoDisable = True
            .DecodeData = True
            .TransmitSentinels = False
            .DataEventEnabled = True
            .DeviceEnabled = True

            AddHandler .DataEvent, AddressOf MSR_DataEvent
            AddHandler .ErrorEvent, AddressOf MSR_ErrorEvent
        End With
0
0

At the end of your event handler myMSR_DataEvent set

myMSR.DataEventEnabled = True

I noticed that stepping through my DataEvent function it will be set to false, and this did the trick.

0

Hey Jaynesh I was working through a similar problem and came across this entry, hopefully you've sorted it out by now, but what worked for us when we had a similar issue was the following (please forgive the following is C# not VB.NET):

var deviceInfo = this.PosExplorer.GetDevice(DeviceType.Scanner, deviceLogicalName);
this.device = (Scanner)this.PosExplorer.CreateInstance(deviceInfo);
this.device.Open();
this.device.Claim(1000);
this.device.DeviceEnabled = true;
this.device.DataEventEnabled = true;
this.device.DecodeData = true;
this.device.DataEvent += this.DeviceScanEvent;
this.device.ErrorEvent += this.DeviceErrorEvent;

Of course the MSR was configured properly (as a Scanner) in the POS.NET Service Object configuration for the machine and the Logical Name you specified for the device is being passed into this code in the "deviceLogicalName" variable in the code sample.

We cast the MSR as a Scanner POS.NET Service Object type and that worked for us as the MSR swipe event is just a "scan", this also allowed us to make a generic base class that had a lot of the common functionality for both the scanners and MSR's being used in our app.

I hope it helps you, or gives the next guy another thing to try!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.