Download Print this page

Socket ScanAPI Reference Manual page 23

Advertisement

Socket ScanAPI Reference
Objective C source code:
-(IBAction)btnClicked:(id)sender{
id<ISktScanObject>
scanObj=[SktClassFactory
[[scanObj Property] setID:kSktScanPropIdTriggerDevice];
[[scanObj Property]setType:kSktScanPropTypeByte];
[[scanObj Property]setByte:kSktScanTriggerStart];
[_rootViewController
AddPropertyToSet:scanObj];
[_rootViewController
SendFirstPropertyToSet];
}
// timer handler for consuming ScanObject from ScanAPI
// if ScanAPI is not initialized this handler does nothing
-(void)onTimer{
if(_scanApiInitialized==true){
SKTRESULT
result=[_scanapi WaitForScanObject:_scanObjectReceived
if
(SKTSUCCESS(result)) {
if
(result!=ESKT_WAITTIMEOUT) {
[self
HandleScanObject:_scanObjectReceived];
[_scanapi
ReleaseScanObject:_scanObjectReceived];
}
}
}
}
-(void) HandleScanObject:(id<ISktScanObject>)scanobject{
switch
([[scanobject Msg] MsgID]) {
case
kSktScanMsgIdDeviceArrival:
[self
HandleDeviceArrival:scanobject];
break;
case
kSktScanMsgIdDeviceRemoval:
[self
HandleDeviceRemoval:scanobject];
break;
case
kSktScanMsgGetComplete:
[self
DoGetComplete:scanobject];
break;
case
kSktScanMsgSetComplete:
[self
DoSetComplete:scanobject];
break;
case
kSktScanMsgIdTerminate:
[_scanapi
break;
case
kSktScanMsgEvent:
[self
HandleEvent:scanobject];
break;
default:
break;
}
}
-(void) DoGetComplete:(id<ISktScanObject>)scanObject{
SKTRESULT
result=ESKT_NOERROR;
if
(scanObject!=nil) {
© 2013 Socket Mobile, Inc.
createScanObject];
Close];
TimeOut:0];
23/152

Advertisement

loading
Need help?

Need help?

Do you have a question about the ScanAPI and is the answer not in the manual?

Subscribe to Our Youtube Channel