Overview
Gets and sets the singulation control settings of an active RFID reader, using srfidGetSingulationConfiguration and srfidSetSingulationConfiguration.
Details
Following singulation control settings could be configured via the SDK:
- Session: session number to use for inventory operation
- Tag population: an estimate of the tag population in view of the RF field of the antenna
- Select (SL Flag)
- Target (inventory state)
Singulation control settings could be retrieved and set via srfidGetSingulationConfiguration and srfidSetSingulationConfiguration API functions accordingly, as demonstrated in the following examples.
Get Singulation Configuration
The getSingulationConfig method retrieves the current singulation settings and prints them.
-(void)getSingulationConfig {
/* allocate object for storage of singulation settings */
srfidSingulationConfig *singulation_cfg = [[srfidSingulationConfig alloc] init];
/* an object for storage of error response received from RFID reader */
NSString *error_response = nil;
/* retrieve singulation configuration */
SRFID_RESULT result = [apiInstance srfidGetSingulationConfiguration:readerID aSingulationConfig:&singulation_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* singulation configuration received */
NSLog(@"Tag population: %d\n", [singulation_cfg getTagPopulation]);
SRFID_SLFLAG slflag = [singulation_cfg getSLFlag];
switch (slflag)
{
case SRFID_SLFLAG_ASSERTED:
NSLog(@"SL flag: ASSERTED\n");
break;
case SRFID_SLFLAG_DEASSERTED:
NSLog(@"SL flag: DEASSERTED\n");
break;
case SRFID_SLFLAG_ALL:
NSLog(@"SL flag: ALL\n");
break;
}
SRFID_SESSION session = [singulation_cfg getSession];
switch (session)
{
case SRFID_SESSION_S1:
NSLog(@"Session: S1\n");
break;
case SRFID_SESSION_S2:
NSLog(@"Session: S2\n");
break;
case SRFID_SESSION_S3:
NSLog(@"Session: S3\n");
break;
case SRFID_SESSION_S0:
NSLog(@"Session: S0\n");
break;
}
SRFID_INVENTORYSTATE state = [singulation_cfg getInventoryState];
switch (state) {
case SRFID_INVENTORYSTATE_A:
NSLog(@"Inventory State: State A\n");
break;
case SRFID_INVENTORYSTATE_B:
NSLog(@"Inventory State: State B\n");
break;
case SRFID_INVENTORYSTATE_AB_FLIP:
NSLog(@"Inventory State: AB flip\n");
break;
}
}
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 Singulation Configuration
The setSingulationConfig method applies new singulation settings: tag population 30, session S0, SL flag asserted and inventory state A.
-(void)setSingulationConfig {
/* allocate object for storage of singulation settings */
srfidSingulationConfig *singulation_cfg = [[srfidSingulationConfig alloc] init];
/* an object for storage of error response received from RFID reader */
NSString *error_response = nil;
/* prepare the singulation configuration to be set */
[singulation_cfg setTagPopulation:30];
[singulation_cfg setSession:SRFID_SESSION_S0];
[singulation_cfg setSlFlag:SRFID_SLFLAG_ASSERTED];
[singulation_cfg setInventoryState:SRFID_INVENTORYSTATE_A];
error_response = nil;
/* set updated singulation configuration */
SRFID_RESULT result = [apiInstance srfidSetSingulationConfiguration:readerID aSingulationConfig:singulation_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result)
{
/* singulation configuration applied successfully */
NSLog(@"Singulation 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");
}
}