Knowing Supported Regions

Applicable Devices : RFD40, RFD90, RFD8500

Overview

Retrieves the list of regions supported by an active RFID reader and the details of a region, using srfidGetSupportedRegions and srfidGetRegionInfo.

Details

The RFID reader could be configured to operate in various countries. The SDK provides an ability to retrieve the list of regions supported by a particular active RFID reader. The list of supported regions could be retrieved via srfidGetSupportedRegions API function as demonstrated in the following example.


-(void)getSupportRegion {
    /* allocate object for storage of region information */
    NSMutableArray *regions = [[NSMutableArray alloc] init];
    /* an object for storage of error response received from RFID reader */
    NSString *error_response = nil;

    /* retrieve supported regions */
    SRFID_RESULT result = [apiInstance srfidGetSupportedRegions:readerID aSupportedRegions:&regions aStatusMessage:&error_response];
    if (SRFID_RESULT_SUCCESS == result) {
        /* print supported regions information */
        NSLog(@"Number of supported regions: %lu\n", (unsigned long)[regions count]);
        for (srfidRegionInfo *info in regions)
        {
            NSLog(@"Region [%@] is supported: %@\n", [info getRegionName],  [info getRegionCode]);
        }
    }
    else if (SRFID_RESULT_RESPONSE_ERROR == result)
    {
        NSLog(@"Error response from RFID reader: %@\n", error_response);
    }
    else if (SRFID_RESULT_RESPONSE_TIMEOUT == result)
    {
        NSLog(@"Timeout occurs during communication with RFID reader\n");
    }
    else if (SRFID_RESULT_READER_NOT_AVAILABLE == result)
    {
        NSLog(@"RFID reader with id = %d is not available\n", readerID);
    }
    else
    {
        NSLog(@"Request failed\n");
    }

}

As the RFID reader could be configured to operate on particular radio channels in some countries the SDK provides an ability to retrieve the detailed information regarding one of regions supported by a particular active RFID reader. The detailed information includes a set of channels supported in the region and allowance of hopping configuration. This information could be retrieved via srfidGetRegionInfo API function as demonstrated in the following example.


-(void)getSupportChannelListForGivenRegion {

    /* allocate object for storage of supported channels information */
    NSMutableArray *channels = [[NSMutableArray alloc] init];
    BOOL hopping = NO;
    /* an object for storage of error response received from RFID reader */
    NSString *error_response = nil;
    /* retrieve detailed information about region specified by "USA" region code */
    SRFID_RESULT result = [apiInstance srfidGetRegionInfo:readerID aRegionCode:@"USA" aSupportedChannels:&channels aHoppingConfigurable:&hopping aStatusMessage:&error_response];

    if (SRFID_RESULT_SUCCESS == result) {
        /* print retrieved detailed information */
        NSLog(@"Hopping configuration is: %@\n", ((YES == hopping) ? @"supported" : @"NOT supported"));
        for (NSString *str_channel in channels)
        {
            NSLog(@"Supported channel: %@\n", str_channel);
        }
    }
    else if (SRFID_RESULT_RESPONSE_ERROR == result)
    {
      NSLog(@"Error response from RFID reader: %@\n", error_response);
    }
    else if (SRFID_RESULT_RESPONSE_TIMEOUT == result)
    {
      NSLog(@"Timeout occurs during communication with RFID reader\n");
    }
    else if (SRFID_RESULT_READER_NOT_AVAILABLE == result)
    {
     NSLog(@"RFID reader with id = %d is not available\n", readerID);
    }
    else
    {
      NSLog(@"Request failed\n");
    }

}