SDK Manual 2016-01-18
Add ExternalAccessory.framework to project
### Select “Add Other”
Add following identifiers to Supported external accessory protocols in plist
Import RcpRfidApi.h
#import "RcpRfidApi.h"
Implement RcpRfidDelegate
@interface AsReaderViewController ()<RcpBarcodeDelegate,RcpRfidDelegate>
Initialize RcpRfidApi
- (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];
});
}
}
- (id)init
Initialize API class
None
initialized API object
- (BOOL)open
open connection to AsReader
None
- (void)pluggedRfid:(BOOL)plug
called when connection state with AsReader changes
None
- (BOOL)isOpened
receive connection state with AsReader
None
- (BOOL) setReaderPower :(BOOL)on
send command to switch Power of AsReader
Yes : ON No : OFF
YES : success
NO : failure
- (void)readerConnected
Called when AsReader turnes on.
Please don't call other api methods until this method is called.
None
None
- (void)readerConnected:(uint8_t)status
Please don't call other api methods until this method is called.
None
//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;
}
});
}
- (void)setReaderPowerOnWithBeep:(uint8_t)beepOn
setVibration:(uint8_t)vibrationOn
setIllumination:(uint8_t)illuminationOn
※Please call this method when you want to call above setting continuously.
None
- (void)readerConnected:(uint8_t)status
Please don't call other api methods until this method is called.
None
(BOOL)startReadTags:(uint8_t)mtnu mtime:(uint8_t)mtime repeatCycle:(uint16_t)repeatCycle
Start reading tags.
Parameters show the condition of the reading stop.
- (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];
}
- (void)startedReadTags:(uint8_t)status
None
- (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;
}
}
- (void)stoppedReadTags:(uint8_t)statusCode
Called when stop reading tags
None
- (void)stoppedReadTags:(uint8_t)statusCode{
if (statusCode == 0x00) {
dispatch_async(dispatch_get_main_queue(), ^{
self.olBtnRead.enabled = YES;
});
}
}
- (void)pcEpcReceived:(NSData *)pcEpc
Receive EPC Block(PC + EPC)
PC + EPC
None
- (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);
});
}
- (void)epcReceived:(NSData *)epc
Receive EPC
EPC
None
- (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];
});
}
- (BOOL)startReadTagsWithRssi:(uint8_t)mtnu mtime:(uint8_t)mtime repeatCycle:(uint16_t)repeatCycle
Start reading tags with RSSI. Parameters show the condition of the reading stop.
- (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];
}
}
In case of ASR-030D
- (void)startedReadTagsWithRssi:(uint8_t)statusCode
In case of ASX-300R
- (void)startedReadTags:(uint8_t)status
None
- (void)pcEpcRssiReceived:(NSData *)pcEpc rssi:(int8_t)rssi
Receive EPC Block(PC + EPC) with RSSI
pxEpc | rssi |
---|---|
PC + EPC | RSSI (dBm) |
なし
- (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)];
});
}
- (void)epcReceived:(NSData *)epc rssi:(int8_t)rssi;
Receive EPC with RSSI
epc | rssi |
---|---|
EPC | RSSI (dBm) |
None
- (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]];
});
}
- (BOOL)startReadTagsWithTid:(uint8_t)mtnu mtime:(uint8_t)mtime repeatCycle:(uint16_t)repeatCycle
Start reading tags with TID. Parameters show the condition of the reading stop.
- (void)epcReceived:(NSData *)epc rssi:(int8_t)rssi
Receive EPC with TID
epc | tid |
---|---|
EPC | TID |
None
- (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);
});
}
- (BOOL)stopReadTags
Stop automatic reading tags operation
None
- (IBAction)btnStop:(UIBarButtonItem *)sender {
if(![self.rcp isOpened])
return;
[self.rcp stopReadTags];
}
- (BOOL)getReaderInfo:(uint8_t)infoType
Receive basic information from the reader
- (void)readerInfoReceived:(NSData *)data
Receive basic information from the reader.
(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 |
None
- (BOOL)getRegion
Receive the current region.
None
YES : success
NO : failre
- (void)regionReceived:(uint8_t)region
List of region code follows below.
Korea | US | Europe | Japan | China1 | China2 |
---|---|---|---|---|---|
0x11 | 0x21 | 0x31 | 0x41 | 0x51 | 0x52 |
None
- (BOOL)setRegion:(uint8_t)region
Set the current region
List of region code follows below.
Korea | US | Europe | Japan | China1 | China2 |
---|---|---|---|---|---|
0x11 | 0x21 | 0x31 | 0x41 | 0x51 | 0x52 |
YES : success
NO : failure
- (void)didSetRegionReceived:(uint8_t)statusCode
0x00 : 成功
None
- (BOOL)getSelectParam
Receive ‘Select’ parameters
None
YES : success
NO : failure
- (void)selectParamReceived:(NSData *)selParam
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 |
None
- (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;
Set ‘Select’ 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 |
YES : success
NO : failure
- (void)didSetSelParamReceived:(uint8_t)statusCode
success : 0x00
None
- (BOOL)getChannel
Receive current RF Channel
None
YES : success
NO : failure
- (void)channelReceived:(uint8_t)channel channelOffset:(uint8_t)channelOffset
channel | channelOffset |
---|---|
Channel Number | Channel number offset for miller subcarrier |
None
- (BOOL)setChannel:(uint8_t)channel channelOffset:(uint8_t)channelOffset
Set current RF Channel
channel | channelOffset |
---|---|
Channel Number | Channel number offset for miller subcarrier |
YES : success
NO : failure
- (void)didSetChParamReceived:(uint8_t)statusCode
success : 0x00
None
- (BOOL)getFhLbtParam
Receive FH and LBT ParametersGet FH and LBT Parameters.
None
YES : success
NO : failure
- (void)fhLbtReceived:(NSData *)fhLb
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) |
None
- (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;
Set FH and LBT 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) |
YES : success
NO : failure
- (void)didSetFhLbtReceived:(uint8_t)statusCode
success: 0x00
None
- (BOOL)getOutputPowerLevel
Receive Tx Power Level
None
- (void)txPowerLevelReceived:(NSData*)power
16-bit | 16-bit | 16-bit |
---|---|---|
Current Tx Power | Min Tx Power | Max Tx Power |
None
- (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];
});
}
- (BOOL)setOutputPowerLevel:(uint16_t)power
Set Tx power level
Tx Power(16bit)
- (void)didSetOutputPowerLevel:(uint8_t)status
success : 0x00
None
- (BOOL)readFromTagMemory:(uint32_t)accessPassword epc:(NSData*)epc memoryBank:(uint8_t)memoryBank startAddress:(uint16_t)startAddress dataLength:(uint16_t)dataLength
Read tag data from specified memory bank
YES : success
NO : failure
- (void)tagMemoryReceived:(NSData *)data
tag data
None
- (BOOL)writeToTagMemory:(uint32_t)accessPassword epc:(NSData*)epc memoryBank:(uint8_t)memoryBank startAddress:(uint16_t)startAddress dataToWrite:(NSData*)dataToWrite
Write tag data to specified memory bank
YES : success
NO : failure
- (void)writedReceived:(uint8_t)statusCode
success (0x00)
None
- (BOOL)killTag:(uint32_t)killPassword epc:(NSData*)epc
Kill tag
YES : success
NO : failure
- (void)killedReceived:(uint8_t)statusCode
success (0x00)
None
- (BOOL)lockTagMemory:(uint32_t)accessPassword epc:(NSData*)epc
lockData:(uint32_t)lockData
Lock tag
YES :success NO : failure
- (void)lockedReceived:(uint8_t)statusCode
success (0x00)
None
- (BOOL)getFreqHoppingTable
Receive Frequency Hopping Table
None
YES : success
NO : failure
- (void)hoppingTableReceived:(NSData *)table
None
- (BOOL)setFreqHoppingTable:(uint8_t)tableSize channels:(NSData*)channels
Set Frequency Hopping Table
YES : success
NO : failure
- (void)didSetHoppintTbleReceived:(uint8_t)statusCode
success : 0x00
None
- (BOOL)getRssi
Receive RSSI level
None
YES : success
NO : failure
- (void)rssiReceived:(uint16_t)rssi
rssi: (-dBm x 10, decimal value) 
None
- (void)batteryChargeReceived:(int)battery
Receive battery level
battery level(%)

- (BOOL)setBeep:(uint8_t)beepOn setVibration:(uint8_t)vibrationOn setIllumination:(uint8_t)illuminationOn
Set beep,vibration
- (BOOL)getSession
Receive session.
None
YES : success
NO : failure
- (void)sessionReceived:(uint8_t)session
Session (8-bit): S0(0x00), S1(0x01), S2(0x02), S3(0x03) 
None
- (BOOL)setSession:(uint8_t)session
Set session
Session (8-bit): S0(0x00), S1(0x01), S2(0x02), S3(0x03)
YES : success
NO : failure
- (void)didSetSession:(uint8_t)statusCode
success : 0x00 
None
- (BOOL)getAnticollision
Receive Anti-Collision Algorithm
None
YES : success
NO : failure
- (void)anticolParamReceived:(uint8_t)mode start:(uint8_t)start max:(uint8_t)max max:(uint8_t)min
- (BOOL)setAnticollision:(uint8_t)mode
Set Anti-collision algorithm
0x02 : nti-Collision Mode 2
0x03 : Anti-Collision Mode 3
- (BOOL)setAnticollision:(uint8_t)mode qStart:(uint8_t)qStart qMax:(uint8_t)qMax qMin:(uint8_t)qMin
Set Anti-collision algorithm
0x00 : fixed Q
0x01 : dynamic
- (BOOL)getAnticollision
Receive Anti-Collision Algorithm
None
YES : success
NO : failure
- (void)anticolParamReceived:(uint8_t)mode start:(uint8_t)start max:(uint8_t)max max:(uint8_t)min
None
- (BOOL)setAnticollision:(uint8_t)mode;
- (BOOL)updateRegistry
Set Registry Update function
(Excluding some settings like setBeep...)
None
- (void)updatedRegistry:(uint8_t)statusCode
success : 0x00
None
- (void)errReceived:(uint8_t)errCode
Receive error code
Error codes (8-bit)
None
- (void)errDetailReceived:(NSData *)errCode
Receive error code
8-bit | 8-bit | 8-bit |
---|---|---|
Error Code | Command Code | Sub Error Code |
Error code (8-bit)
Sub Error code (8-bit)
None