DPM Mode Example
What is DPM Mode for iOS? #
Direct Part Marking (DPM) mode is a feature designed to scan barcodes that are directly marked on an item, usually etched or printed onto a surface, instead of printed on a paper label. This mode is particularly useful in industries where items need to be tracked throughout their lifespan. To enable DPM mode, the DataMatrix decoding is enabled and the DPM mode is set to 1. For best results, the decoding speed is set to slow and the barkoder resolution is set to high. A Region of Interest (ROI) is also set to optimize the viewfinder for scanning.
How to enable DPM?#
Enabling via pre-defined template:
private func setDpmMode() {
// In order to perform scanning, config property need to be set before
// If license key is not valid you will receive results with asterisks inside
barkoderView.config = BarkoderConfig(licenseKey: "LICENSE_KEY") { licenseResult in
print("Licensing SDK: \(licenseResult)")
}
if let config = barkoderView.config {
BarkoderHelper.applyConfigSettingsFromTemplate(config, template: .dpm, finished: { updatedConfig in
// Enabling ROI
self.barkoderView.config?.regionOfInterestVisible = true
// Optional ROI for dpm mode if the viewfinder is on fullscreen
let dpmRoiRect = CGRect(x: 35, y: 40, width: 30, height: 14)
try? self.barkoderView.config?.setRegionOfInterest(dpmRoiRect)
})
}
}
Or enable it manually:
private func setDpmMode() {
// In order to perform scanning, config property need to be set before
// If license key is not valid you will receive results with asterisks inside
barkoderView.config = BarkoderConfig(licenseKey: "LICENSE_KEY") { licenseResult in
print("Licensing SDK: \(licenseResult)")
}
// Enabling datamatrix and dpm mode
barkoderView.config?.decoderConfig?.datamatrix.enabled = true
barkoderView.config?.decoderConfig?.datamatrix.dpmMode = 1
// For best result decoding speed should be slow, and barkoder resolution should be high
barkoderView.config?.decoderConfig?.decodingSpeed = DecodingSpeed.init(2)
barkoderView.config?.barkoderResolution = .high
// Setting ROI
let dpmRoiRect = CGRect(x: 35, y: 40, width: 30, height: 14)
try? self.barkoderView.config?.setRegionOfInterest(dpmRoiRect)
}