Tag Locationing

Applicable Devices : RFD40, RFD90, RFD8500

Overview

Locates a tag, using srfidStartTagLocationing and srfidStopTagLocationing.

Details

The SDK provides an ability to perform tag locationing operation. The srfidStartTagLocationing API function is used to request performing of tag locationing operation. Aborting of tag locationing operation is requested via srfidStopTagLocationing API function. The actual operation is started and stopped based on configured start and stop triggers parameters. The SDK informs the application about starting and stopping of the actual operation via delivery of asynchronous notifications if the application has subscribed for events of this type. During an on-going operation the SDK will deliver asynchronous notifications to inform the application about current tag proximity value (as a percentage).

The following examples demonstrate performing of tag locationing operation and receiving the proximity value.

Start and Stop Tag Locationing

The tagLocationing method subscribes to proximity and operation status events, starts locationing for one tag and requests an abort after 1 minute.


-(void)tagLocationing{

    /* subscribe for tag locationing related events */
    [apiInstance srfidSubsribeForEvents:SRFID_EVENT_MASK_PROXIMITY];
    /* subscribe for operation start/stop related events */
    [apiInstance srfidSubsribeForEvents:SRFID_EVENT_MASK_STATUS];
    /* identifier of one of active RFID readers is supposed to be stored in readerID variable */
    /* id of tag to be located */
    NSString *tag_id = @"E28011B0A506007D3DD17A34";
    /* an object for storage of error response received from RFID reader */
    NSString *error_response = nil;
    SRFID_RESULT result = [apiInstance srfidStartTagLocationing:readerID aTagEpcId:tag_id aStatusMessage:&error_response];
    if (SRFID_RESULT_SUCCESS == result) {
        NSLog(@"Request succeed\n");
        /* request abort of an operation after 1 minute */
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(60 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [apiInstance srfidStopTagLocationing:self->readerID aStatusMessage:nil];
        });
    }
    else if (SRFID_RESULT_RESPONSE_ERROR == result) {
        NSLog(@"Error response from RFID reader: %@\n", error_response);
    }
    else {
        NSLog(@"Request failed\n");
    }
}

Proximity Event

The SDK calls srfidEventProximityNotify: with the current proximity value of the tag, as a percentage.


- (void)srfidEventProximityNotify:(int)readerID aProximityPercent:(int)proximityPercent {
    NSLog(@"Tag proximity: %d%%", proximityPercent);
}