Barcode

Overview

This chapter explains how to operate the barcode reader function using AsReaderBarcodeDevice.
You can connect to the device, start and stop reading, and receive reading results.

Supported Devices

ASX-510R, ASX-520R, ASR-010D, ASR-020D,
ASR-022D, ASR-0230D, ASR-0231D, ASR-0240D,
ASR-M24D, ASR-025S

Used Classes and Protocols

List of Used Classes and Protocols

Name

Type

Description

AsReaderBarcodeDevice

Class

Main class for controlling the barcode reader

AsreaderBarcodeDeviceDelegate

Protocol

Delegate used to receive reading results and others

Initialization and Connection

AsReaderBarcodeDevice *device = [AsReaderBarcodeDevice sharedInstance];
device.delegateDevice = self;
  • delegateBarcode: Set this to receive barcode reading events.

Start and Stop Reading

[device startScan:0 readUntilInSec:0];   // Start reading
[device stopScan];                       // Stop reading

Receiving Reading Results

- (void)receivedBarcodeData:(NSData *)data {
    NSLog(@"Read barcode: %@", data);
}

Implement this as a method of the AsreaderBarcodeDeviceDelegate protocol.