Get USB Batch Mode

Applicable Devices : RFD40, RFD90

Overview

Gets the USB batch mode (BATCHMODECONFIG) of the RFID reader, using srfidGetUSBBatchModeConfig.

Details

The SDK has a separate pair of calls for the USB batch mode. They read and set a different setting of the reader from the one on Get Batch Mode and Set Batch Mode, and they use the same SRFID_BATCHMODECONFIG values:

  • SRFID_BATCHMODECONFIG_DISABLE (0x00)
  • SRFID_BATCHMODECONFIG_AUTO (0x01)
  • SRFID_BATCHMODECONFIG_ENABLE (0x02)

Get USB Batch Mode Configuration


- (SRFID_RESULT)getUSBBatchModeConfig:(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 srfidGetUSBBatchModeConfig: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(@"USB batch mode: %@", [self batchModeName:*batchMode]);
        }
        else {
            NSLog(@"The reader did not return a USB 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;
}