POS for .net MSR DATA EVENT is not fired when I swipe a card
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
RemoveHandl开发者_高级运维er myMSR.DataEvent, AddressOf myMSR_DataEvent
AddHandler myMSR.DataEvent, AddressOf myMSR_DataEvent
AddHandler myMSR.ErrorEvent, AddressOf myMSR_ErrorEvent
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
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.
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!
精彩评论