logo

SDK Manual for RFID

ASX-300R

ASX-301R

ASR-030D

ASR-031D

SDK Manual 2016-01-18      

Introduction of SDK

Add Framework

Add ExternalAccessory.framework to project

Add AsReader SDK

TARGET -> Build phases -> Link Binary With Libraries

framework ### Select “Add Other”

add_other

Select "libAreteUart.a" in downloaded SDK files

Add following files to project

Add AsReader protocol

Add following identifiers to Supported external accessory protocols in plist

protocols

Play AsReader

        - (RcpRfidApi *)rcpRfid{
            static dispatch_once_t pred = 0;
            __strong static id _sharedObject = nil;
            
            dispatch_once(&pred,^{
                _sharedObject = [[RcpRfidApi alloc] init];
                _rcpRfid = _sharedObject;
                _rcpRfid.delegate = self;
                [_rcpRfid open];
            });
            return _sharedObject;
        }
- (void)pluggedRfid:(BOOL)plug{
    plugged = plug;
    
    if(plug){
        if([self.rcpRfid isOpened]){
            dispatch_async(dispatch_get_main_queue(),^{
                _statusLabel.text = @"Plugged";
                [self.rcpRfid setReaderPower:YES];
            });
        }
    }else{
        dispatch_async(dispatch_get_main_queue(),^{
            _statusLabel.text = @"Unplugged";
            [self.rcpRfid setReaderPower:NO];
            [self.rcpRfid close];
        });
    }
}

API Methods

◆Initialize

Method

- (id)init

Description

Initialize API class

Parameters

None

Return value

initialized API object

◆Connection process

Method

- (BOOL)open

Description

open connection to AsReader

Parameters

None

Return value

◆Receive a change of connection state with AsReader

Method

- (void)pluggedRfid:(BOOL)plug

Description

called when connection state with AsReader changes

Parameters

Return value

None

◆Receive connection state with AsReader

Method

- (BOOL)isOpened

Description

receive connection state with AsReader

Parameters

None

Return value

◆AsReader Power (1)

Request

Method

- (BOOL) setReaderPower :(BOOL)on

Description

send command to switch Power of AsReader

Parameters

Yes : ON No : OFF

Return value

YES : success
NO : failure

Response(in case of 300R, 301R)

Method

- (void)readerConnected

Description

Called when AsReader turnes on.
Please don't call other api methods until this method is called.

Parameters

None

Return value

None

Response(in case of 030D)

Method

- (void)readerConnected:(uint8_t)status

Description

Please don't call other api methods until this method is called.

Parameters

Return value

None

Example

//300R, 301R
- (void)readerConnected{
    [self readerConnected:0xff];
}

//030D, 031D
- (void)readerConnected:(uint8_t)status
{
    NSLog(@"readerConnected\n");
    
    dispatch_async(dispatch_get_main_queue(),
                   ^{
                       switch (status)
                       {
                           case 0xff:
                           {
                               self.olStatus.text = @"Connected\n";
                               [self.olSwitch setEnabled:YES];
                               
                               NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
                               BOOL beep = [defaults boolForKey:@"beep"];
                               BOOL Vibration = [defaults boolForKey:@"viberation"];
                               
                               [self.rcp setBeep:(uint8_t)beep setVibration:(uint8_t)Vibration setIllumination:(uint8_t)0x00];
                           }
                               break;
                            case 0x00:
                               break;
                       }
                   });
}

◆AsReader Power (2)

Request

Method

- (void)setReaderPowerOnWithBeep:(uint8_t)beepOn setVibration:(uint8_t)vibrationOn setIllumination:(uint8_t)illuminationOn

Description

  1. Set power of AsReader
  2. Set beep,vibration,illumination

※Please call this method when you want to call above setting continuously.

Parameters

Return value

None

Response

Method

- (void)readerConnected:(uint8_t)status

Description

Please don't call other api methods until this method is called.

Parameters

Return value

None

◆Start automatic reading tags operation

(Request)

Method

(BOOL)startReadTags:(uint8_t)mtnu mtime:(uint8_t)mtime repeatCycle:(uint16_t)repeatCycle

Description

Start reading tags.
Parameters show the condition of the reading stop.

Parameters

Return value

Example

- (IBAction)btnRead:(UIBarButtonItem *)sender{

    if(![self.rcp isOpened])
        return;

    int stopTagCount = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"stopTagCount"];
    int stopTime = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"stopTime"];
    int stopCycle = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"stopCycle"];
    
    [self.rcp startReadTags:stopTagCount mtime:stopTime repeatCycle:stopCycle];
}

(Response)

Method

- (void)startedReadTags:(uint8_t)status

Parameters

Return value

None

Example

- (void)startedReadTags:(uint8_t)status;
{
    switch (status)
    {
        case 0x00:
        {
            NSLog(@"Read Tags Started\n");
            dispatch_async(dispatch_get_main_queue(),
            ^{
                self.olBtnRead.enabled = NO;
            });
        }
            break;
        case 0x1F:
        {
            NSLog(@"Read Tags Completed\n");
            dispatch_async(dispatch_get_main_queue(),
            ^{
                self.olBtnRead.enabled = YES;
            });
        }
            break;
        default:
            break;
    }
}

◆Called when stop reading tags

Method

- (void)stoppedReadTags:(uint8_t)statusCode

Description

Called when stop reading tags

Parameters

Return value

None

Example

- (void)stoppedReadTags:(uint8_t)statusCode{
    
    if (statusCode == 0x00) {
        dispatch_async(dispatch_get_main_queue(), ^{
            self.olBtnRead.enabled = YES;
        });
    }
}

◆Receive EPC Block (PC + EPC)

Method

- (void)pcEpcReceived:(NSData *)pcEpc

Description

Receive EPC Block(PC + EPC)

Parameters

PC + EPC

Return value

None

Example

- (void)pcEpcReceived:(NSData*)pcEpc{
    
    dispatch_async(dispatch_get_main_queue(),^{        

        NSMutableString* tag = [[NSMutableString alloc] init];
        unsigned char* ptr= (unsigned char*) [pcEpc bytes];
        for(int i = 0; i < pcEpc.length; i++)
            [tag appendFormat:@"%02X", *ptr++ & 0xFF ];            
        
        NSLog(@"PC+EPC:%@",tag);
    });
}

◆Receive EPC

Method

- (void)epcReceived:(NSData *)epc

Description

Receive EPC

Parameters

EPC

Return value

None

Example

- (void)epcReceived:(NSData *)epc{
    dispatch_async(dispatch_get_main_queue(),^{        
        NSMutableString* tag = [[NSMutableString alloc] init];
        unsigned char* ptr= (unsigned char*) [epc bytes];
        
        for(int i = 0; i < epc.length; i++)
            [tag appendFormat:@"%02X", *ptr++ & 0xFF ];
        
        [self addText:tag];
    });
}

◆Start automatic reading tags operation(RSSI)

(Request)

Method

- (BOOL)startReadTagsWithRssi:(uint8_t)mtnu mtime:(uint8_t)mtime repeatCycle:(uint16_t)repeatCycle

Description

Start reading tags with RSSI. Parameters show the condition of the reading stop.

Parameters

Return value

Example

- (IBAction)btnRead:(UIBarButtonItem *)sender{
    if(![self.rcp isOpened])
        return;

    int stopTagCount = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"stopTagCount"];
    int stopTime = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"stopTime"];
    int stopCycle = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"stopCycle"];
    BOOL rssiOn = [[NSUserDefaults standardUserDefaults] boolForKey:@"tagRssi"];
    
    if(!rssiOn){
        [self.rcp startReadTags:stopTagCount mtime:stopTime repeatCycle:stopCycle];
    }else{
        [self.rcp startReadTagsWithRssi:stopTagCount mtime:stopTime repeatCycle:stopCycle];
    }
}

(Response)

Method

In case of ASR-030D
- (void)startedReadTagsWithRssi:(uint8_t)statusCode

In case of ASX-300R
- (void)startedReadTags:(uint8_t)status

Parameters

Return value

None

◆Receive EPC Block(PC + EPC) with RSSI

Method

- (void)pcEpcRssiReceived:(NSData *)pcEpc rssi:(int8_t)rssi

Description

Receive EPC Block(PC + EPC) with RSSI

Parameters

pxEpc rssi
PC + EPC RSSI (dBm)

Return value

なし

Example

- (void)pcEpcRssiReceived:(NSData*)pcEpc rssi:(int8_t)rssi
    
    dispatch_async(dispatch_get_main_queue(),^{        

        NSMutableString* tag = [[NSMutableString alloc] init];
        unsigned char* ptr= (unsigned char*) [pcEpc bytes];
        for(int i = 0; i < pcEpc.length; i++)
            [tag appendFormat:@"%02X", *ptr++ & 0xFF ];            
        
        NSLog(@"PC+EPC:%@ RSSI:%@",tag),[NSNumber numberWithInt:(rssi)];
    });
}

◆ Receive EPC with RSSI

Method

- (void)epcReceived:(NSData *)epc rssi:(int8_t)rssi;

Description

Receive EPC with RSSI

Parameters

epc rssi
EPC RSSI (dBm)

Return value

None

Example

- (void)epcReceived:(NSData *)epc rssi:(int8_t)rssi{
    
    dispatch_async(dispatch_get_main_queue(),^{
        NSMutableString* tag = [[NSMutableString alloc] init];
        unsigned char* ptr= (unsigned char*) [epc bytes];
        
        for(int i = 0; i < epc.length; i++)
            [tag appendFormat:@"%02X", *ptr++ & 0xFF ];
        
        [self addText:[NSString stringWithFormat:@"%@::%@",[NSNumber numberWithInt:(rssi)],tag]];
    });
}

◆Start an automatic tag read operation(TID)

Method

- (BOOL)startReadTagsWithTid:(uint8_t)mtnu mtime:(uint8_t)mtime repeatCycle:(uint16_t)repeatCycle

Description

Start reading tags with TID. Parameters show the condition of the reading stop.

Parameters

Return value

◆Receive EPC with TID

Method

- (void)epcReceived:(NSData *)epc rssi:(int8_t)rssi

Description

Receive EPC with TID

Parameters

epc tid
EPC TID

Return value

None

Example

- (void)epcReceived:(NSData *)epc tid:(NSData *)tid
{
     dispatch_async(dispatch_get_main_queue(), ^{
         NSMutableString* tag = [[NSMutableString alloc] init];
         unsigned char* ptr= (unsigned char*) [epc bytes];

         NSMutableString* tidStr = [[NSMutableString alloc] init];
         unsigned char* tidPtr= (unsigned char*) [tid bytes];
         
         for(int i = 0; i < epc.length; i++)
             [tag appendFormat:@"%02X", *ptr++ & 0xFF ];
         
         for(int i = 0; i < tid.length; i++)
             [tidStr appendFormat:@"%02X", *tidPtr++ & 0xFF ];
         
         NSLog(@"%@",tidStr);
     });
}

◆Stop automatic reading tags operation

Method

- (BOOL)stopReadTags

Description

Stop automatic reading tags operation

Parameters

None

Return value

Example

- (IBAction)btnStop:(UIBarButtonItem *)sender {    
       
    if(![self.rcp isOpened])
        return;

    [self.rcp stopReadTags];
}

◆Receive reader information

(Request)

Method

- (BOOL)getReaderInfo:(uint8_t)infoType

Description

Receive basic information from the reader

Parameters

Return value

(Response)

Method

- (void)readerInfoReceived:(NSData *)data

Description

Receive basic information from the reader.

Parameters

(in case of 300R, 301R)

1Byte 1Byte 1Byte 2Byte 2Byte 2Byte 1Byte 1Byte 1Byte 1Byte 2Byte 2Byte 2Byte
0XB0 Beep 0 On Time Off Time Sence Time Lbt Rf Lebel Fh Enable Lbt Enable cw Enable Power PowerMin PowerMax

(in case of 030D, 031D)

1Byte 1Byte 1Byte 2Byte 2Byte 2Byte 1Byte 1Byte 1Byte 1Byte 2Byte 2Byte 2Byte 2Byte 1Byte 1Byte 1Byte 1Byte
0XB0 Region Channel On Time Off Time Sence Time Lbt Rf Lebel Fh Enable Lbt Enable cw Enable Power PowerMin PowerMax rx_blf rx_mode rx_dr session Beep

Return value

None

◆Receive current Region

(Request)

Method

- (BOOL)getRegion

Description

Receive the current region.

Parameters

None

Return value

YES : success
NO : failre

(Response)

Method

- (void)regionReceived:(uint8_t)region

Parameters

List of region code follows below.

Korea US Europe Japan China1 China2
0x11 0x21 0x31 0x41 0x51 0x52

Return value

None

◆Set Region

(Request)

Method

- (BOOL)setRegion:(uint8_t)region

Description

Set the current region

Parameters

List of region code follows below.

Korea US Europe Japan China1 China2
0x11 0x21 0x31 0x41 0x51 0x52

Return value

YES : success
NO : failure

(Response)

Method

- (void)didSetRegionReceived:(uint8_t)statusCode

Parameters

0x00 : 成功

Return value

None

◆Receive ‘Select’ parameters

(Request)

Method

- (BOOL)getSelectParam

Description

Receive ‘Select’ parameters

Parameters

None

Return value

YES : success
NO : failure

(Response)

Method

- (void)selectParamReceived:(NSData *)selParam

Parameters

Target(3Bit) Action (3-bit) Memory Bank (2-bit)
S0 (000), S1 (001), S2 (010), S3 (011), SL (100) Refer to ISO18000-6C. 00 RFU, 01 EPC, 10 TID, 11 User
Pointer (32-bit) Length (8-bit) Truncate (1-bit) Reserve (7-bit) Mask (0~255 bits)
Starting mask address mask length Enable (1) and Disable (0) Reserved Mask value

Return value

None

◆Set ‘Select’ parameters

(Request)

Method

- (BOOL)setSelectParam:(uint8_t)target action:(uint8_t)action memoryBank:(uint8_t)memoryBank pointer:(uint32_t)pointer length:(uint8_t)length truncate:(uint8_t)truncate mask:(NSData *)mask;

Description

Set ‘Select’ parameters

Parameters

Target(3Bit) Action (3-bit) Memory Bank (2-bit)
S0 (000), S1 (001), S2 (010), S3 (011), SL (100) Refer to ISO18000-6C. 00 RFU, 01 EPC, 10 TID, 11 User
Pointer (32-bit) Length (8-bit) Truncate (1-bit) Reserve (7-bit) Mask (0~255 bits)
Starting mask address mask length Enable (1) and Disable (0) Reserved Mask value

Return value

YES : success
NO : failure

(Response)

Method

- (void)didSetSelParamReceived:(uint8_t)statusCode

Parameters

success : 0x00

Return value

None

◆Receive current RF Channel

(Request)

Method

- (BOOL)getChannel

Description

Receive current RF Channel

Parameters

None

Return value

YES : success
NO : failure

(Response)

Method

- (void)channelReceived:(uint8_t)channel channelOffset:(uint8_t)channelOffset

Parameters

channel channelOffset
Channel Number Channel number offset for miller subcarrier

Return value

None

◆Set current RF Channel

(Request)

Method

- (BOOL)setChannel:(uint8_t)channel channelOffset:(uint8_t)channelOffset

Description

Set current RF Channel

Parameters

channel channelOffset
Channel Number Channel number offset for miller subcarrier

Return value

YES : success
NO : failure

(Response)

Method

- (void)didSetChParamReceived:(uint8_t)statusCode

Parameters

success : 0x00

Return value

None

◆Receive FH and LBT Parameters

(Request)

Method

- (BOOL)getFhLbtParam

Description

Receive FH and LBT ParametersGet FH and LBT Parameters.

Parameters

None

Return value

YES : success
NO : failure

(Response)

Method

- (void)fhLbtReceived:(NSData *)fhLb

Parameters

RT (16-bit) IT (16-bit) CST (16-bit)
Read Time (1 = 1ms) Idle Time (1 = 1ms) Carrier Sense Time (1 = 1ms)
RFL (16-bit) FH (8-bit)
Target RF power level (-dBm x 10) enable (0x01) / disable (0x00)
LBT (8-bit) CW (8-bit)
enable (0x01) / disable (0x00) enable (0x01) / disable (0x00)

Return value

None

◆Set FH and LBT Parameters

(Request)

Method

- (BOOL)setFhLbtParam:(uint16_t)readTime idleTime:(uint16_t)idleTime carrierSenseTime:(uint16_t) carrierSenseTime rfLevel:(uint16_t)rfLevel frequencyHopping:(uint8_t)frequencyHopping listenBeforeTalk:(uint8_t)listenBeforeTalk continuousWave:(uint8_t)continuousWave;

Description

Set FH and LBT Parameters

Parameters

RT (16-bit) IT (16-bit) CST (16-bit)
Read Time (1 = 1ms) Idle Time (1 = 1ms) Carrier Sense Time (1 = 1ms)
RFL (16-bit) FH (8-bit)
Target RF power level (-dBm x 10) enable (0x01) / disable (0x00)
LBT (8-bit) CW (8-bit)
enable (0x01) / disable (0x00) enable (0x01) / disable (0x00)

Return value

YES : success
NO : failure

(Response)

Method

- (void)didSetFhLbtReceived:(uint8_t)statusCode

Parameters

success: 0x00

Return value

None

◆Receive Tx Power Level

(Request)

Method

- (BOOL)getOutputPowerLevel

Description

Receive Tx Power Level

Parameters

None

Return value

(Response)

Method

- (void)txPowerLevelReceived:(NSData*)power

Parameters

16-bit 16-bit 16-bit
Current Tx Power Min Tx Power Max Tx Power

Return value

None

Example

- (void)txPowerLevelReceived:(NSData*)power{
    dispatch_async(dispatch_get_main_queue(), ^{
        
        Byte *b = (Byte*)[power bytes];
        
        power1 = (b[0] << 8) | b[1];
        powerMin = (b[2] << 8) | b[3];
        powerMax = (b[4] << 8) | b[5];
        
        self.olPowerLevel.text = [NSString stringWithFormat:@"%02.1f", (float)power1/10];        
    });
}

◆Set Tx power level.

(Request)

Method

- (BOOL)setOutputPowerLevel:(uint16_t)power

Description

Set Tx power level

Parameters

Tx Power(16bit)

Return value

(Response)

Method

- (void)didSetOutputPowerLevel:(uint8_t)status

Parameters

success : 0x00

Return value

None

◆Read tag data from specified memory bank

(Request)

Method

- (BOOL)readFromTagMemory:(uint32_t)accessPassword epc:(NSData*)epc memoryBank:(uint8_t)memoryBank startAddress:(uint16_t)startAddress dataLength:(uint16_t)dataLength

Description

Read tag data from specified memory bank

Parameters

Return value

YES : success
NO : failure

(Response)

Method

- (void)tagMemoryReceived:(NSData *)data

Parameters

tag data

Return value

None

◆Write tag data to specified memory bank

(Request)

Method

- (BOOL)writeToTagMemory:(uint32_t)accessPassword epc:(NSData*)epc memoryBank:(uint8_t)memoryBank startAddress:(uint16_t)startAddress dataToWrite:(NSData*)dataToWrite

Description

Write tag data to specified memory bank

Parameters

Return value

YES : success
NO : failure

(Response)

Method

- (void)writedReceived:(uint8_t)statusCode

Parameters

success (0x00)

Return value

None

◆Kill Tag

(Request)

Method

- (BOOL)killTag:(uint32_t)killPassword epc:(NSData*)epc

Description

Kill tag

Parameters

Return value

YES : success
NO : failure

(Response)

Method

- (void)killedReceived:(uint8_t)statusCode

Parameters

success (0x00)

Return value

None

◆Lock Tag

(Request)

Method

- (BOOL)lockTagMemory:(uint32_t)accessPassword epc:(NSData*)epc lockData:(uint32_t)lockData

Description

Lock tag

Parameters

Return value

YES :success NO : failure

(Response)

Method

- (void)lockedReceived:(uint8_t)statusCode

Parameters

success (0x00)

Return value

None

◆Receive Frequency Hopping Table

(Request)

Method

- (BOOL)getFreqHoppingTable

Description

Receive Frequency Hopping Table

Parameters

None

Return value

YES : success
NO : failure

(Response)

Method

- (void)hoppingTableReceived:(NSData *)table

Parameters

Return value

None

◆Set Frequency Hopping Table

(Request)

Method

- (BOOL)setFreqHoppingTable:(uint8_t)tableSize channels:(NSData*)channels

Description

Set Frequency Hopping Table

Parameters

Return value

YES : success
NO : failure

(Response)

Method

- (void)didSetHoppintTbleReceived:(uint8_t)statusCode

Parameters

success : 0x00

Return value

None

◆Receive RSSI

(Request)

Method

- (BOOL)getRssi

Description

Receive RSSI level

Parameters

None

Return value

YES : success
NO : failure

(Response)

Method

- (void)rssiReceived:(uint16_t)rssi

Parameters

rssi: (-dBm x 10, decimal value) 

Return value

None

◆Receive battery level

Method

- (void)batteryChargeReceived:(int)battery

Description

Receive battery level

Parameters



◆Set beep, vibration

Method

- (BOOL)setBeep:(uint8_t)beepOn setVibration:(uint8_t)vibrationOn setIllumination:(uint8_t)illuminationOn

Description

Set beep,vibration

Parameters

◆Receive Session

(Request)

Method

- (BOOL)getSession

Description

Receive session.

Parameters

None

Return value

YES : success
NO : failure

(Response)

Method

- (void)sessionReceived:(uint8_t)session

Parameters

Session (8-bit): S0(0x00), S1(0x01), S2(0x02), S3(0x03) 

Return value

None

◆Set Session

(Request)

Method

- (BOOL)setSession:(uint8_t)session

Description

Set session

Parameters

Session (8-bit): S0(0x00), S1(0x01), S2(0x02), S3(0x03)

Return value

YES : success
NO : failure

(Response)

Method

- (void)didSetSession:(uint8_t)statusCode

Parameters

success : 0x00 

Return value

None

◆Receive Anti-Collision Mode

(Request)

Method

- (BOOL)getAnticollision

Description

Receive Anti-Collision Algorithm

Parameters

None

Return value

YES : success
NO : failure

(Response)

Method

- (void)anticolParamReceived:(uint8_t)mode start:(uint8_t)start max:(uint8_t)max max:(uint8_t)min

Parameters

◆Set Anti-Collision Mode

in case of ASX-300R, 301R

Method

- (BOOL)setAnticollision:(uint8_t)mode

Description

Set Anti-collision algorithm

Parameters

mode3

mode4

mode5

mode6

in case of ASR-030D, 031D

Method

- (BOOL)setAnticollision:(uint8_t)mode qStart:(uint8_t)qStart qMax:(uint8_t)qMax qMin:(uint8_t)qMin

Description

Set Anti-collision algorithm

Parameters

mode
qStart(8-bit) : Q Start
qMax(8-bit) : Q Max
qMin(8-bit) : Q Min

◆Receive Anti-Collision Mode

Request

Method

- (BOOL)getAnticollision

Description

Receive Anti-Collision Algorithm

Parameters

None

Return value

YES : success
NO : failure

Response(in case of ASR-030D, 031D)

Method

- (void)anticolParamReceived:(uint8_t)mode start:(uint8_t)start max:(uint8_t)max max:(uint8_t)min

Parameters

Return value

None

Response(in case of ASX-300R, 301R)

Method

- (BOOL)setAnticollision:(uint8_t)mode;

Parameters

◆Update Registry

(Request)

Method

- (BOOL)updateRegistry

Description

Set Registry Update function

(Excluding some settings like setBeep...)

Parameters

None

Return value

(Response)

Method

- (void)updatedRegistry:(uint8_t)statusCode

Parameters

success : 0x00

Return value

None

◆Received error code

in case of 300R, 301R

Method

- (void)errReceived:(uint8_t)errCode

Description

Receive error code

Parameters

Error codes (8-bit)

Return value

None

in case of 030D, 031D

Method

- (void)errDetailReceived:(NSData *)errCode

Description

Receive error code

Parameters

8-bit 8-bit 8-bit
Error Code Command Code Sub Error Code

Error code (8-bit)

Sub Error code (8-bit)

Return value

None