Overview
Locates several tags at once, using srfidStartMultiTagsLocationing and srfidStopMultiTagsLocationing.
Details
Multi tag locationing looks for several tags at the same time. Give the SDK a list of tag IDs, each with an RSSI limit in dBm, and the reader reports a tag only when its signal is stronger than its limit. For example, with a limit of -40 dBm a tag at -45 dBm is not reported.
Each tag ID must be the tag's EPC as a hexadecimal string, for example one read by an inventory. Subscribe to SRFID_EVENT_MASK_MULTI_PROXIMITY to receive the results; without the subscription the SDK never calls srfidEventMultiProximityNotify:.
Keep the srfidReportConfig object in an instance variable or property, and create it before you add the tags. The SDK keeps using it after the start method returns, so a local variable is not enough.
Start Multi Tag Locationing
The startMultiTagLocationing method subscribes to multi proximity events, adds three tags with an RSSI limit of -40 dBm each and starts the operation.
// In your view controller (instance variable)
srfidReportConfig *multipleTagsReportConfig;
/// Start multi tag locationing
-(void)startMultiTagLocationing {
// Receive the results in srfidEventMultiProximityNotify:
[apiInstance srfidSubsribeForEvents:SRFID_EVENT_MASK_MULTI_PROXIMITY];
NSString *error_response = nil;
multipleTagsReportConfig = [[srfidReportConfig alloc] init];
// EPCs of the tags to look for, as hexadecimal strings
NSString *tag_id_1 = @"E28011B0A506007D3DD17A37";
NSString *tag_id_2 = @"E28011B0A506007D3DD17A36";
NSString *tag_id_3 = @"E28011B0A506007D3DD17A35";
[multipleTagsReportConfig addItem:tag_id_1 aRSSIValueLimit:-(40)];
[multipleTagsReportConfig addItem:tag_id_2 aRSSIValueLimit:-(40)];
[multipleTagsReportConfig addItem:tag_id_3 aRSSIValueLimit:-(40)];
SRFID_RESULT result = [apiInstance srfidStartMultiTagsLocationing:readerID aReportConfig:multipleTagsReportConfig aAccessConfig:nil aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
NSLog(@"Request succeed\n");
}else{
NSLog(@"Request failed\n");
}
}
Stop Multi Tag Locationing
The stopMultiTagLocationing method stops the operation.
/// Stop multi tag locationing
-(void)stopMultiTagLocationing{
NSString *error_response = nil;
SRFID_RESULT result = [apiInstance srfidStopMultiTagsLocationing:readerID aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
NSLog(@"Request succeed\n");
}else{
NSLog(@"Request failed\n");
}
}
The SDK calls this delegate method each time a listed tag is reported:
- (void)srfidEventMultiProximityNotify:(int)readerID aTagData:(srfidTagData *)tagData {
NSLog(@"Multi proximity: tag %@", [tagData getTagId]);
}