Antenna Configuration

Applicable Devices : RFD40, RFD90, RFD8500

Overview

Gets and sets the antenna settings of an active RFID reader, using srfidGetAntennaConfiguration and srfidSetAntennaConfiguration.

Details

Following antenna related settings could be configured via the SDK:

  • Output power level (in 0.1 dBm units)
  • Index of selected link profile (RF mode)
  • Application of pre-filters (select records)
  • Tari (Type-A reference interval)

Tari value shall be set in accordance with the selected link profile, i.e. tari value shall be in the interval between minimal and maximal tari values specified by the selected link profile. If step size is supported by the selected link profile, the tari value must be a multiple of step size. Antenna settings could be retrieved and set via srfidGetAntennaConfiguration and srfidSetAntennaConfiguration API function accordingly. Following examples demonstrate retrieving current antenna settings and setting of antenna configuration with minimal output power and one of supported link profiles.

Get Antenna Configuration

The getAntennaConfig method retrieves the current antenna settings and prints them.


-(void)getAntennaConfig
{
    /* allocate object for storage of antenna settings */
    srfidAntennaConfiguration *antenna_cfg = [[srfidAntennaConfiguration alloc] init];

    /* an object for storage of error response received from RFID reader */
    NSString *error_response = nil;
    /* retrieve antenna configuration */
    SRFID_RESULT result = [apiInstance srfidGetAntennaConfiguration:readerID aAntennaConfiguration:&antenna_cfg aStatusMessage:&error_response];

    if (SRFID_RESULT_SUCCESS == result) {
    /* antenna configuration received */
        NSLog(@"Antenna power level: %1.1f\n", [antenna_cfg getPower]/10.0);
        NSLog(@"Antenna RF mode index: %d\n", [antenna_cfg getLinkProfileIdx]);
        NSLog(@"Antenna tari: %d\n", [antenna_cfg getTari]);
        NSLog(@"Antenna pre-filters application: %@", ((NO == [antenna_cfg getDoSelect]) ? @"NO" : @"YES"));
    }
    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");
    }
}

Set Antenna Configuration

The setAntennaConfig method sets the output power to the reader's minimum and selects one of the supported link profiles.


-(void)setAntennaConfig {

    /* allocate object for storage of antenna settings */
    srfidAntennaConfiguration *antenna_cfg = [[srfidAntennaConfiguration alloc] init];
    /* an object for storage of error response received from RFID reader */
    NSString *error_response = nil;
    /* RF mode index to be set */
    int link_profile_idx = 0;
    /* tari to be set */
    int tari = 0;
    /* 20.0 dBm power level to be set */
    int power = 200;

    /* allocate object for storage of link profiles information */
    NSMutableArray *profiles = [[NSMutableArray alloc] init];
    /* retrieve supported link profiles */
    SRFID_RESULT result  = [apiInstance srfidGetSupportedLinkProfiles:readerID aLinkProfilesList:&profiles aStatusMessage:&error_response];

    if (SRFID_RESULT_SUCCESS == result)
    {

        if (0 < [profiles count])
        {
            srfidLinkProfile *profile = (srfidLinkProfile*)[profiles lastObject];
            link_profile_idx = [profile getRFModeIndex];
            tari = [profile getMaxTari];
        }

    }

    /* allocate object for storage of capabilities information */
    srfidReaderCapabilitiesInfo *capabilities = [[srfidReaderCapabilitiesInfo alloc] init];

    /* retrieve capabilities information */
    result = [apiInstance srfidGetReaderCapabilitiesInfo:readerID aReaderCapabilitiesInfo:&capabilities aStatusMessage:&error_response];
    if (SRFID_RESULT_SUCCESS == result)
    {
        power = [capabilities getMinPower];
    }

    /* prepare an object with desired antenna parameters */
    antenna_cfg = [[srfidAntennaConfiguration alloc] init];
    [antenna_cfg setLinkProfileIdx:link_profile_idx];
    [antenna_cfg setPower:power];
    [antenna_cfg setTari:tari];
    [antenna_cfg setDoSelect:NO];
    error_response = nil;
    /* set antenna configuration */
    result = [apiInstance srfidSetAntennaConfiguration:readerID aAntennaConfiguration:antenna_cfg aStatusMessage:&error_response];

    if (SRFID_RESULT_SUCCESS == result)
    {
      /* antenna configuration applied successfully */
      NSLog(@"Antenna configuration has been set\n");
    }
    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");
    }

}