FindIt Tutorial

RFID SDK for Android 2.0.5.214

Applicable Devices : Handheld Readers

Overview

This Tutorial provides a walk-through of the steps to perform FindIt operation using RFID3 API

Create The Project

  • Start by creating a new project in Android Studio. For help, see the Android Studio tutorial.
  • Refer Hello RFID to prepare basic setup to work with RFID Reader and then follow this guide
  • Refer to FindIt Example as a reference of how to use this feature in an application

Details

FindIt features are supported only on hand-held readers. It consists of two phases, Confirm and Isolate.

Confirm

This phase runs a specialized inventory. Given a hexadecimal mask and an example target, it identifies all tags in the field of view of the reader’s antenna that match the target EPC using the mask.

Setting it up

Decide what bits of the target EPC are important for finding matching tags and build the mask accordingly.

Performing Confirm operation

If the mask is known, Confirm can be started as follows


    String targetEpc = "3030401E1981E716D1417AA3";
    String targetMask = "00FF00FF00FF00FF00FF00FF";

    try {
        reader.Config.setRFIDProfile("FASTEST_READ");
        reader.Actions.TagConfirm.perform(targetEpc, targetMask);
    } catch (InvalidUsageException e) {
        e.printStackTrace();
    } catch (final OperationFailureException e) {
        e.printStackTrace();
    }  


If the mask is not known, Confirm uses a default mask for GTIN encoded tags "FFFFFFFFFFFFFFC000000000".


    String targetEpc = "3030401E1981E716D1417AA3";

    try {
        reader.Config.setRFIDProfile("FASTEST_READ");
        reader.Actions.TagConfirm.perform(targetEpc);
    } catch (InvalidUsageException e) {
        e.printStackTrace();
    } catch (final OperationFailureException e) {
        e.printStackTrace();
    }  


Grab the results

The result is a list of tags matching the target tag and mask. When data event callback is enabled, info can be fetched from event data.


    public void eventReadNotify(RfidReadEvents rfidReadEvents) {
        
        final TagData[] myTags = reader.Actions.getConfirmedTags(100);
        if (myTags != null) {
            for (TagData tagData : myTags) {
                if (tagData != null) {
                    Log(tagData.getTagID());
                }
            }
        }
    }


Isolate

This phase runs specific locationing for a given target tag. It reports the estimated direction in vertical and horizontal rotations (pitch & yaw) and a notation value.

How to use

To use Isolate, the user should stand in one location and slowly swing the device like a metal detector.

Performing Isolate operation

An application context must be supplied to allow the SDK to use the IMU for direction calculations.


    String targetEpc = "3030401E1981E716D1417AA3";

    try {
        reader.Config.setRFIDProfile("FASTEST_READ");
        reader.Actions.TagIsolate.perform(context, targetEpc);
    } catch (InvalidUsageException e) {
        e.printStackTrace();
    } catch (final OperationFailureException e) {
        e.printStackTrace();
    }  


Grab the results

The result is a TagIsolateInfo object. When data event callback is enabled, info can be fetched.


    public void eventReadNotify(RfidReadEvents rfidReadEvents) {
        
        TagIsolateInfo info = reader.Actions.getTagIsolateInfo();
        if (info != null) {
            TagData tagData = info.getTagData();
            float pitch = info.getPitch();
            float yaw = info.getYaw();
            float notation = info.getNotation();

            Log(tagData.getTagId() + ": found with angles " + pitch + " , " + yaw + " and relative distance " + notation);
        }
    }


Closer look

  • TagIsolateInfo.getPitch() gives an angle value in the range [-π/2,π/2] representing the relative pitch angle difference between the device and target tag
  • TagIsolateInfo.getYaw() gives an angle value in the range [-π,π] representing the relative yaw angle difference between the device and target tag
  • TagIsolateInfo.getNotation() gives relative distance value from 0% to 100%, with 0 meaning the tag is very far and 100 meaning the tag is very close

UI Library

There is the option to use a UI library with custom views that support the Confirm and Isolate phases.

View XML

An example of how to add a FindIt view to your layout XML.


    <com.zebra.finditservice.IsolateView
        android:id="@+id/isolate_view"
        android:layout_width="240dp"
        android:layout_height="360dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent" />


Use View in Activity

An example of how to start and stop Confirm or Isolate through the custom View in a Fragment or Activity.


    public static final String LIST_ARG = "target_epcs";
    private ArrayList targetTags;
    private IsolateView isolate;

    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        targetTags = getArguments().getStringArrayList(LIST_ARG);
        isolate = getActivity().findViewById(R.id.isolate_view);
    }

    @Override
    public void onResume() {
        super.onResume();

        // Start Isolate phase
        isolate.startIsolate(targetTags.get(targetTagIndex));
    }

    @Override
    public void onPause() {
        // Stop Isolate phase
        isolate.stopIsolate();

        super.onPause();
    }


Library Info