Overview
Gets the batch mode (BATCHMODECONFIG) of the RFID reader, using srfidGetBatchModeConfig.
Details
Batch mode is a setting of the reader. When it is on, the reader keeps the tags it reads in a batch, which you can request with Get Tags in Batch Mode and clear with Purge Tag. Use srfidGetBatchModeConfig to read the current setting.
The batch mode is a value of the SRFID_BATCHMODECONFIG type, which the SDK defines. The values are:
SRFID_BATCHMODECONFIG_DISABLE(0x00)SRFID_BATCHMODECONFIG_AUTO(0x01)SRFID_BATCHMODECONFIG_ENABLE(0x02)
The reader has a separate batch mode setting for USB, with its own pair of calls: see Get USB Batch Mode and Set USB Batch Mode.
Batch Mode Name
This method turns a batch mode value into text for the log. The Set Batch Mode and USB Batch Mode pages use it as well.
- (NSString *)batchModeName:(SRFID_BATCHMODECONFIG)batchMode
{
switch (batchMode) {
case SRFID_BATCHMODECONFIG_DISABLE: return @"Disable";
case SRFID_BATCHMODECONFIG_AUTO: return @"Auto";
case SRFID_BATCHMODECONFIG_ENABLE: return @"Enable";
default: return @"unknown";
}
}
Get Batch Mode Configuration
- (SRFID_RESULT)getBatchModeConfig:(SRFID_BATCHMODECONFIG *)batchMode statusMessage:(NSString **)statusMessage
{
/* Start with a value that is not a valid batch mode. If the reader answers without a value,
the value stays invalid and the method reports a failure. */
*batchMode = (SRFID_BATCHMODECONFIG)0xFF;
SRFID_RESULT result = SRFID_RESULT_FAILURE;
for (int i = 0; i < 2; i++)
{
result = [apiInstance srfidGetBatchModeConfig:readerID aBatchModeConfig:batchMode aStatusMessage:statusMessage];
if ((result != SRFID_RESULT_RESPONSE_TIMEOUT) && (result != SRFID_RESULT_FAILURE)) {
break;
}
}
if (result == SRFID_RESULT_SUCCESS)
{
if (*batchMode == SRFID_BATCHMODECONFIG_DISABLE || *batchMode == SRFID_BATCHMODECONFIG_AUTO || *batchMode == SRFID_BATCHMODECONFIG_ENABLE) {
NSLog(@"Batch mode: %@", [self batchModeName:*batchMode]);
}
else {
NSLog(@"The reader did not return a batch mode value");
result = SRFID_RESULT_FAILURE;
}
}
else if (result == SRFID_RESULT_RESPONSE_ERROR)
{
NSLog(@"Response error: %@", (statusMessage != NULL && *statusMessage != nil) ? *statusMessage : @"");
}
else
{
NSLog(@"Timeout or failure");
}
return result;
}