How to Use the SDK

Adding the SDK

Select “Add Other…”

Use the file browser to select the SDK framework files.

Add AsReaderDockSDK.framework and AsReaderBLESDK.framework

Add these two framework files to your project.

After Adding

Confirm that the frameworks have been properly added to the project’s linked libraries list.

Add AsReader Protocols

Add the following protocols to the Supported external accessory protocols entry in your plist file.

  • ASX - 510R, 520R: jp.co.asx.asreader.barcode

  • ASR - 010D, 020D, 022D, M24D: jp.co.asx.asreader.6dongle.barcode

  • ASX - 300R, ASX - 301R: jp.co.asx.asreader.rfid

  • ASR - 030D, ASR - 031D: jp.co.asx.asreader.6dongle.rfid

  • ASR - 0230D, ASR - 0240D: jp.co.asx.asreader.0230D, jp.co.asx.asreader.0240D

  • ASR-M30S: jp.co.asx.asreader.slim

For example:

Using the SDK in Your Class

Import the header file in the class where you use the SDK.

#import "AsReaderDevice.h"

Notes

  • To use Dock SDK4, your code must support C++. Either change your .m file that references SDK header files to .mm, or import the libc++ library to build successfully.

  • When sending commands continuously, make sure to wait for the response of the previous command before sending the next one. Sending commands before receiving a response may cause unexpected behavior.

Using the SDK

Creating and Initializing AsReaderRFIDDevice (Singleton Pattern)

AsReaderRFIDDevice *asReaderRFIDDevice = [AsReaderRFIDDevice sharedInstance];

Setting Delegates

[AsReaderRFIDDevice sharedInstance].delegateDevice = self;
[AsReaderRFIDDevice sharedInstance].delegateRFID = self;

Receiving Device Connection State

- (void)plugged:(BOOL)plug {
    if (plug) {
        AsReaderInfo *info = [AsReaderInfo sharedInstance];
        if (!info.isEnginePowerAlwaysOn) {
            // ASR-030D requires power-on
            [[AsReaderRFIDDevice sharedInstance] setReaderPower:YES
                beep:YES
                vibration:YES
                batteryGaugeLed:YES
                barcodeAimer:YES
                barcodePowerOnBeep:YES
                mode:1];
        } else {
            // ASR-M30, ASR-M24D do not require power-on
        }
    }
}

Powering On the AsReader Device

[[AsReaderRFIDDevice sharedInstance] setReaderPower:YES
    beep:YES
    vibration:YES
    batteryGaugeLed:YES
    barcodeAimer:YES
    barcodePowerOnBeep:YES
    mode:1];

Receiving Device Power State

- (void)readerConnected:(int)status {
    if (status == 0xFF) {
        // Power on successful
    } else {
        // Power on failed or already off
    }
}

Starting Scan

[[AsReaderRFIDDevice sharedInstance] startScan:0
    readUntilInSec:0
    repeatCycle:0];

Starting RFID Tag Scan (with RSSI)

[[AsReaderRFIDDevice sharedInstance] startReadTagsAndRssiWithTagNum:0
    maxTime:0
    repeatCycle:0];

Receiving Scan Start Status

- (void)startedReadScan:(int)status {
    if (status == 0x00) {
        // Scan started successfully
    } else {
        // Failed to start scan
    }
}

Stopping RFID Tag Scan

[[AsReaderRFIDDevice sharedInstance] stopScan];

Receiving Scan Stop Status

- (void)stopReadScan:(int)status {
    if (status == 0x00) {
        // Scan stopped successfully
    } else {
        // Failed to stop scan
    }
}

Receiving Tag Data with RSSI

- (void)pcEpcRssiReceived:(NSData *)pcEpc rssi:(int)rssi {
    // pcEpc: PCEPC data of the tag
    // rssi: RSSI value of the tag
}