SocketMobile / singleentryswift-ios

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

ScanApiSDK-10 - ISktScanDecodedData getSize() returns size +1 #2

Closed schnabler closed 7 years ago

schnabler commented 7 years ago

When trying to get a the length of a decodedData-object in onDecodedDataResult(_ result: Int, device: DeviceInfo!, decodedData: ISktScanDecodedData!) of ScanApiHelperDelegate, the length returned in always the length of my scanned code + 1.

// Scanning code "12345" etc. with n characters.
guard result == ESKT_NOERROR else { return }
guard let rawData = decodedData.getData() else { return }
let rawDataSize = decodedData.getSize()
//rawDataSize is n + 1 (6) for given example, when 5 is expected. 

Is this a bug in the SDK? Thanks.

ScanApiSDK-10 Swift 3.0

Eric-Glaenzer commented 7 years ago

@schnabler : you must have a suffix (post-amble) appended to your decoded data. The suffix is stored in the scanner, most of the time it's a carriage return. Using the scanner with the SDK there is not really a use of having a suffix configured in the scanner. You can change this suffix by using the Postamble API from ScanAPI SDK or by using the ScannerSettings app.

schnabler commented 7 years ago

@Eric-Glaenzer: Thanks a lot, that helped. Are you planning to make the source code of the ScannerSettings app available for registered developers? This would help tremendously with understanding how to set up the scanner. Thanks.

EricGlaenzer commented 7 years ago

Sorry for my very late reply. Good suggestion. Definitively something I would like us to do... It was available as Sample app in the very early version of the SDK, we decided to take it off from the SDK because of the amount of code and API calls which really didn't help a developer who wants just to get the decoded data into an app.