SDK Manual 2015-11-13
Add ExternalAccessory.framework to project
Add following identifiers to Supported external accessory protocols in plist.
Import RcpBarcodeApi.h
#import "RcpBarcodeApi.h"
Implement RcpBarcodeDelegate
@interface AsReaderViewController ()<RcpBarcodeDelegate,RcpRfidDelegate>
Initialize RcpBarcodeApi
- (RcpBarcodeApi *)rcp{
static dispatch_once_t pred = 0;
__strong static id _sharedObject = nil;
dispatch_once(&pred,^{
_sharedObject = [[RcpBarcodeApi alloc] init];
_rcp = _sharedObject;
_rcp.delegate = self;
});
return _sharedObject;
}
- (void)pluggedBarcode:(BOOL)plug{
if(plug){
if([self.rcp isOpened]){
dispatch_async(dispatch_get_main_queue(),^{
_statusLabel.text = @"Plugged";
[self.rcp open];
[self.rcp setReaderPowerOnWithBeep:false setVibration:true setIllumination:true];
});
}
}else{
dispatch_async(dispatch_get_main_queue(),^{
_statusLabel.text = @"Unplugged";
[self.rcp setReaderPower:NO];
[self.rcp close];
});
}
}
- (id)init
Initialize API class.
None
initialized API object.
- (BOOL)open
open connection to AsReader.
None
- (void)pluggedBarcode:(BOOL)plug
Called when connection state with AsReader changes
None
- (BOOL)isOpened
Receive connection state with AsReader
None
- (BOOL) setReaderPower :(BOOL)on;
Switch Power of AsReader.
Yes : ON
No : OFF
YES : success
NO : failure
- (void)readerConnected:(uint8_t)status
Please don't call other api methods until this method is called.
None
- (void)pluggedBarcode:(BOOL)plug{
if(plug){
if([self.rcp isOpened]){
dispatch_async(dispatch_get_main_queue(),^{
[self.rcp open];
[self.rcp setReaderPower:YES];
});
}
}else{
dispatch_async(dispatch_get_main_queue(),^{
[self.rcp setReaderPower:NO];
[self.rcp close];
});
}
}
- (void)readerConnected:(uint8_t)status
{
dispatch_async(dispatch_get_main_queue(),
^{
switch (status)
{
case 0xff:
{
[self.rcp setBeep:0x01 setVibration:0x01 setIllumination:0x01];
}
break;
case 0x00:
break;
}
});
}
In case of ASX-510R,ASX-520R
There is no response of setReaderPower.
Please call other api methods after 0.5 seconds or more when this method was called.
- (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)startReadBarcodes:(uint8_t)mtnu mtime:(uint8_t)mtime repeatCycle:(uint16_t)repeatCycle
AsReader starts reading barcodes.
- (void)barcodeReceived:(NSData *)barcode
Get read barcode value
barcode value (NSData)
None
- (void)barcodeReceived:(NSData *)barcode{
dispatch_async(dispatch_get_main_queue(), ^{
NSString *value = [[NSString alloc]initWithData:barcode encoding:NSShiftJISStringEncoding];
[self addText:value];
});
}
- (void)barcodeStringReceived:(NSString *)barcode
Get read barcode value
barcode value (NSString)
None
- (void)barcodeStringReceived:(NSString *)barcode{
dispatch_async(dispatch_get_main_queue(), ^{
[self addText:barcode];
});
}
- (BOOL)stopReadBarcodes
stop reading barcodes
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,viberation,illumination