SocketMobile / singleentryswift-ios

Sample code for ScanAPI SDK using Swift
Other
7 stars 1 forks source link

After scanning getting \r on each barcode scan #10

Closed patelnirav48 closed 6 years ago

patelnirav48 commented 6 years ago

Why i getting \r at the end of decoded string? what to do for that to avoid?

EricGlaenzer commented 6 years ago

You can configure the scanner to remove the suffix. There is an API for that or a simple command barcode. This suffix configuration can be done once as it is persistent in the scanner. ScannerSettings app could also configure this setting.

patelnirav48 commented 6 years ago

@EricGlaenzer

I have configured scanner sdk singleentryswift-ios Once i scan it i am getting \r at the end of scanned barcode in output of delegate method.

didReceiveDecodedData(_ decodedData: SKTCaptureDecodedData?, fromDevice device: CaptureHelperDevice, withResult result:SKTResult) { var strBarcodeNumber = decodedData?.stringFromDecodedData()! }

EricGlaenzer commented 6 years ago

Yes it is probably because the scanner suffix(postamble) is configured to \r. You can remove this suffix by using either a command barcode (available in the documentation that can be downloaded from our website: https://www.socketmobile.com/support/downloads ) or by using ScannerSettings app or by using the SDK API setPostamble. This is a one time setting. Now if the suffix is set to nothing and you're still getting a \r, that means it might be in the barcode (that is very unlikely though).

patelnirav48 commented 6 years ago

@EricGlaenzer Thanks for your help. It's works.