NurApiStartInventoryEx(NurApiInventoryExParams, NurApiInventoryExFilter) Method

Start extended inventory streaming command with multiple select filters.

Definition

Namespace: NurApiDotNet
Assembly: NordicID.NurApi.Net (in NordicID.NurApi.Net.dll) Version: 4.0.0
C#
public void StartInventoryEx(
	NurApiInventoryExParams param,
	NurApiInventoryExFilter[] filters
)

Parameters

param  NurApiInventoryExParams
Reference to inventory parameters.
filters  NurApiInventoryExFilter
Array of select filters or null.

Example

C#
hNur.InventoryStreamEvent += new EventHandler<NurApi.InventoryStreamEventArgs>(hNur_InventoryStreamEvent);
The example below shows how to use this function in order to start the Monza FastID inventory.

The FastID inventory is a type of inventory in which the tag returns both the EPC and TID at once:

C#
void StartFastIDInventoryEx(NurApi hNur, bool longerSelection)
{
    byte[] fastIdMask;
    int maskBitLength;
    uint selAddress;

    if (longerSelection == false)
    {
        // The shorter selection mask for TID.
        fastIdMask = new byte[] { 0xA0, 0x06, 0x80 };
        maskBitLength = 16;
        selAddress = 6;
    }
    else
    {
        // The longer selection mask for TID.
        fastIdMask = new byte[] { 0xE2, 0x80, 0x1A };
        maskBitLength = 22;
        selAddress = 0;
    }

    // Set up some basic inventory parameters.
    NurApi.InventoryExParams param = new NurApi.InventoryExParams();
    param.Q = 5;                     // For example
    param.rounds = 2;                 // For example
    param.session = 1;                 // Session S1
    param.inventoryTarget = 0;         // A
    param.inventorySelState = 1;    // Inventoried S1

    // Set up the filter used with FastID.
    NurApi.InventoryExFilter[] filt = new NurApi.InventoryExFilter[1];
    filt[0].action = NurApi.FACTION_0; // Assert SL or inventoried -> A
    filt[0].address = selAddress;     // The selection mask's bit address.
    filt[0].bank = NurApi.BANK_TID;    // Bank to apply the selection to
    filt[0].maskBitLength = maskBitLength;    // Selection mask's bit length
    // Allocate mask buffer. Length is constant; API uses only needed bits stated by 'maskBitLength'.
    filt[0].maskData = new byte[NurApi.MAX_SELMASK];    
    Buffer.BlockCopy(fastIdMask, 0, filt[0].maskData, 0, fastIdMask.Length);    // Copy mask bytes.
    filt[0].target = 1;        // Inventoried S1

    // Can throw NurApiException, this needs to be in 'try-catch'.
    hNur.StartInventoryEx(ref param, filt);
}

See Also