Zebra RFD8500, RFD8500i Developer Guide

Page 1

RFD8500/i RFID DEVELOPER GUIDE

Page 2
Page 3
RFD8500/i RFID
DEVELOPER GUIDE
MN002222A04
Revision A
December 2016
Page 4
ii RFD8500/i RFID Developer Guide
No part of this publication may be reproduced or used in any form, or by any electrical or mechanical means, without permission in writing from Zebra. This includes electronic or mechanical means, such as photo copying, recording, or information storage and retrieval systems. The material in this manual is subject to change without notice.
The software is provided strictly on an “as is” basis. All software, including firmware, furnished to the user is on a licensed basis. Zebra grants to the user a non-transferable and non-exclusive license to use each software or firmware program delivered hereunder (licensed program) . Except as n oted below, such licen se may not b e assigned, sublicensed, or otherwise tran sfe rr e d by th e user without prior written consent of Zebra. No right to copy a licensed program in whole or in part is granted, except as permitted under copyright law. The user shall not modify , merge, or incorporate any for m or portion of a licensed program with other pro gram material, create a derivative work from a licensed program , or us e a li censed program in a network without written permission from Zebra. The user agrees to maintain Zebra’s copyright notice on the licensed programs delivered hereunder , and to include the same on any au thorized copies it m akes, in whole or in part. The user agrees not to decompile, disassemble, decode, or reverse engineer any licensed program delivered to the user or any portion thereof.
Zebra reserves the right to make changes to any software or product to improve reliability, function, or design. Zebra does not assume any product liability arising out of, or in connection with, the application or use of any product, circuit, or application described herein.
No license is granted, either expressly or by implication, estoppel, or otherwise under any Zebra Technologies Corporation, intellectual property rights. An implied license only exists for equipment, circuits, and su bsystems contained in Zebra products.

Warranty

For the complete Zebra hardware product warranty statement, go to:
http://www.zebra.com/warranty

Revision History

Changes to the original manual are listed below:
Change Date Description
-01 Rev A 10/2015 Initial Release
-02 Rev A 3/2016 Software Maintenance Updates
-03 Rev A 9/2016 Updates for the standard RFD8500 (for Rev C software) and RFD8500i; changed
-04 Rev A 12/2016 Updates for Rev D software.
.
references of ’DUT’ to RFD8500.
Page 5

TABLE OF CONTENTS

Warranty ......................................................................................................................................... ii
Revision History.............................................................................................................................. ii
About This Guide
Introduction..................................................................................................................................... ix
Chapter Descriptions ...................................................................................................................... ix
Related Documents ........................................................................................................................ x
Notational Conventions................................................................................................................... xi
Service Information......................................................................................................................... xi
Chapter 1: RFD8500 DEVICE OVERVIEW
Introduction .................................................................................................................................... 1-1
System Requirements .................................................................................................................... 1-1
Setting up the Device ..................................................................................................................... 1-1
Resetting the Device ...................................................................................................................... 1-2
Enabling Bluetooth® (BT) .............................................................................................................. 1-2
Using Bluetooth on the RFD8500 ............................................................................................ 1-2
Pairing with Bluetooth .............................................................................................................. 1-3
Pairing with Android Devices ............................................................................................. 1-3
Pairing with a Personal Computer ...................................................................................... 1-3
Pairing with an iOS Device ................................................................................................. 1-4
Pairing using S/N Bar Code ............................................................................................... 1-5
Using a PC Based Terminal Over ZETI with the RFD8500 ........................................................... 1-5
Chapter 2: GETTING STARTED with the ZEBRA RFID APPLICATION
and SETTING UP the RFID SDK for iOS XCODE PROJECT
Introduction .................................................................................................................................... 2-1
Using the Zebra RFID Application for iOS with iOS Devices ......................................................... 2-1
Setting up an XCode Project for SDK-based iOS Applications ...................................................... 2-2
Page 6
iv RFD8500/i RFID Developer Guide
Chapter 3: ZEBRA RFID SDK for iOS
Introduction .................................................................................................................................... 3-1
RFID SDK Basics .......................................................................................................................... 3-1
Receiving Asynchronous Notifications from the SDK .............................................................. 3-2
Connectivity Management ............................................................................................................. 3-2
Knowing the Reader Related Information ...................................................................................... 3-5
Knowing the Software Version ................................................................................................. 3-5
Knowing the Reader Capabilities ............................................................................................. 3-6
Knowing Supported Regions ................................................................................................... 3-8
Knowing Supported Link Profiles ............................................................................................. 3-10
Knowing Battery Status ............................................................................................................ 3-11
Configuring the Reader .................................................................................................................. 3-11
Antenna Configuration ............................................................................................................. 3-12
Singulation Configuration ......................................................................................................... 3-14
Trigger Configuration ............................................................................................................... 3-16
Tag Report Configuration ......................................................................................................... 3-19
Regulatory Configuration ......................................................................................................... 3-20
Pre-filters Configuration ........................................................................................................... 3-22
Beeper Configuration ............................................................................................................... 3-25
Managing Configuration ........................................................................................................... 3-26
Performing Operations ................................................................................................................... 3-27
Rapid Read .............................................................................................................................. 3-27
Inventory .................................................................................................................................. 3-29
Inventory with Pre-filters .......................................................................................................... 3-32
Tag Locationing ....................................................................................................................... 3-33
Access Operations ................................................................................................................... 3-34
Access Criteria ................................................................................................................... 3-36
Timeout Value .................................................................................................................... 3-36
srfidSetUniqueTagReportConfiguration ................................................................................... 3-36
srfidGetUniqueTagReportConfiguration ................................................................................... 3-37
srfidAuthenticate ...................................................................................................................... 3-37
srfidUntraceable ....................................................................................................................... 3-37
srfidReadBuffer ........................................................................................................................ 3-37
srfidSetCryptoSuite .................................................................................................................. 3-37
srfidStopOperation ................................................................................................................... 3-37
Chapter 4: GETTING STARTED WITH THE ZEBRA RFID MOBILE APPLICATION
and RFID API3 SDK for ANDROID
Introduction .................................................................................................................................... 4-1
Installing Android Studio ................................................................................................................ 4-1
Importing the Zebra RFID Mobile Application Project .................................................................... 4-2
Building and Running a Project ..................................................................................................... 4-4
RFID API3 Android SDK ................................................................................................................ 4-7
Creating an Android Project ..................................................................................................... 4-7
Page 7
Table of Contents v
Chapter 5: ZEBRA RFID SDK for Android
Introduction .................................................................................................................................... 5-1
Basics ...................................................................................................................................... 5-1
Connection Management ............................................................................................................... 5-2
Connect to an RFID Reader .................................................................................................... 5-2
Special Connection Handling Cases .................................................................................. 5-2
Disconnect ............................................................................................................................... 5-4
Reconnect ................................................................................................................................ 5-4
Knowing the Reader Capabilities ................................................................................................... 5-4
General Capabilities ................................................................................................................. 5-4
Gen2 Capabilities ..................................................................................................................... 5-4
Regulatory Capabilities ............................................................................................................ 5-5
UHF Band Capabilities ............................................................................................................. 5-5
Reader Identification ................................................................................................................ 5-5
Configuring the Reader .................................................................................................................. 5-6
RF Mode .................................................................................................................................. 5-6
Antenna Specific Configuration ................................................................................................ 5-6
Antenna Configuration ....................................................................................................... 5-6
Singulation Control ............................................................................................................. 5-7
Tag Report Configuration ......................................................................................................... 5-8
Regulatory Configuration ......................................................................................................... 5-8
Beeper Configuration ............................................................................................................... 5-9
Dynamic Power Management Configuration ........................................................................... 5-9
Saving Configuration ................................................................................................................ 5-9
Managing Events ........................................................................................................................... 5-10
Device Status Related Events ................................................................................................. 5-12
Basic Operations ............................................................................................................................ 5-12
Tag Storage Settings ............................................................................................................... 5-12
Simple Inventory (Continuous) ........................................................................................... 5-13
Simple Access Operations - On Single Tag ....................................................................... 5-13
Read ................................................................................................................................... 5-13
Write, Block-Write .............................................................................................................. 5-14
Lock .................................................................................................................................... 5-14
Kill ...................................................................................................................................... 5-15
Block-Erase ........................................................................................................................ 5-15
Block-Permalock ................................................................................................................ 5-15
Access Operations on Specific Memory Field of Single Tag ............................................. 5-16
Advanced Operations .................................................................................................................... 5-16
Using Pre-Filters ...................................................................................................................... 5-16
Introduction .............................................................................................................................. 5-16
Singulation ......................................................................................................................... 5-16
Sessions and Inventoried Flags ......................................................................................... 5-16
Selected Flag ..................................................................................................................... 5-17
State-Aware Singulation ..................................................................................................... 5-17
Applying Pre-Filters ............................................................................................................ 5-17
Add Pre-filters .................................................................................................................... 5-17
Using Triggers .......................................................................................................................... 5-19
Inventory .................................................................................................................................. 5-21
Inventory with Triggers ....................................................................................................... 5-21
Access ..................................................................................................................................... 5-22
Using Access-Filters .......................................................................................................... 5-22
Page 8
vi RFD8500/i RFID Developer Guide
Access Operation on Multiple Tags ................................................................................... 5-22
Using Access Sequence .......................................................................................................... 5-25
Gen2v2 Operations .................................................................................................................. 5-26
authenticate ............................................................................................................................. 5-26
untraceable ........................................................................................................................ 5-28
Tag Locationing ............................................................................................................................. 5-29
Exceptions ..................................................................................................................................... 5-30
Exception Handling .................................................................................................................. 5-30
Chapter 6: ZEBRA RFID MOBILE APPLICATION for WINDOWS PHONE
Introduction .................................................................................................................................... 6-1
Installing and Understanding the UWP .......................................................................................... 6-1
Creating a Sample Application ...................................................................................................... 6-2
BluetoothRfcommChat Sample Application ................................................................................... 6-4
Downloading UWP Sample Applications ....................................................................................... 6-5
Chapter 7: ZETI PROGRAMMING GUIDE
ZETI Prerequisites ...................................................................................................... ................... 7-1
ZETI Format ................................................................................................................................... 7-2
General Flow. ................................................................................................................................ 7-4
Getting the Reader Capabilities ..................................................................................................... 7-5
Configuring the Reader .................................................................................................................. 7-5
Antenna Configuration ............................................................................................................. 7-5
Report Configuration ................................................................................................................ 7-6
Beeper Configuration ............................................................................................................... 7-6
Simple Inventory and Abort ........................................................................................................... 7-7
Handling Tags, Events and Start/Stop Notifications ...................................................................... 7-7
Simple Access Operation (Read, Write, Lock, Kill) ........................................................................ 7-8
Advanced Operations .................................................................................................................... 7-10
Using Pre-Filters ...................................................................................................................... 7-10
Using Start and Stop Triggers .................................................................................................. 7-11
Access with Access Criteria ..................................................................................................... 7-13
Access Sequence .................................................................................................................... 7-13
NXP Gen2V2 Features ............................................................................................................ 7-14
Tag Locationing ............................................................................................................................. 7-15
Batch Mode and getTags, PurgeTags ........................................................................................... 7-16
Management and Configuration .................................................................................................... 7-17
Setting and Getting Region Configuration ............................................................................... 7-17
SaveConfig Including resetTodefaults ..................................................................................... 7-17
Connection with Password ....................................................................................................... 7-17
ASCII Protocol Configuration ................................................................................................... 7-18
GetVersion ............................................................................................................................... 7-19
Battery and Device Information ................................................................................................ 7-19
Appendix A: ZETI REFERENCE
ZETI Interface Command Reference ............................................................................................. A-1
Possible Errors Reported Back for ZETI Commands .................................................................... A-45
Generic Errors Applicable to ZETI Commands .............................................................................. A-56
Radio Protocol Specific Errors Returned For An Operation .......................................................... A-57
Command Specific Errors for Different ZETI Commands .............................................................. A-58
Page 9
Table of Contents vii
Appendix B: COMMANDS and ATTRIBUTE REFERENCES
Appendix C: NFC BASED CONNECTION to RFD8500i USING the ANDROID APPLICATION DEVELOP­ER
General Application NFC Implementation for RFD8500i ............................................................... C-1
EMDK Usage for NFC Functionality .............................................................................................. C-2
Initialization .............................................................................................................................. C-2
Connecting on Receiving the NFC Intent ................................................................................. C-3
Setting up Foreground Dispatchers ......................................................................................... C-5
Disabling/Enabling NFC ........................................................................................................... C-5
Page 10
viii RFD8500/i RFID Developer Guide
Page 11

ABOUT THIS GUIDE

Introduction

The RFD8500 RFID Developer Guide provides installation and programming information for the Software
Developer Kit (SDK) that allows RFID application development for Android and iOS devices.

Chapter Descriptions

This guide includes the following topics:
Chapter 1, RFD8500 DEVICE OVERVIEW provides an overview of the RDF8500 device including system
requirements, device setup, enabling Bluetooth, pairing information, using the Zebra RFID Mobile application for Android, using the Zebra RFID application for iOS, and using a PC Based Terminal Over ZETI with the RFD8500.
Chapter 2, GETTING STARTED with the ZEBRA RFID APPLICATION and SETTING UP the RFID SDK for iOS XCODE PROJECT provides instructions to import and run the Zebra RFID Mobile Application code and
to set up a new XCode project to work with the Zebra RFID SDK for iOS.
Chapter 3, ZEBRA RFID SDK for iOS provides detailed information about how to develop iOS applications
using the Zebra RFID SDK for iOS.
Chapter 4, GETTING STARTED WITH THE ZEBRA RFID MOBILE APPLICATION and RFID API3 SDK for ANDROID provides instruction for importing Zebra RFID Mobile Application and setting up new Android
application project using the Zebra RFID SDK for Android.
Chapter 5, ZEBRA RFID SDK for Android provides detailed information about how to use various
functionality of SDK from basic to advance to develop Android application using the Zebra RFID SDK for Android.
Chapter 6, ZEBRA RFID MOBILE APPLICATION for WINDOWS PHONE provides information to setup a
development environment for the Windows 10 Universal Windows Platform (UWP) to wo rk with the RFD8500 over Bluetooth.
Chapter 7, ZETI PROGRAMMING GUIDE provides information for developing applications using the ZETI
interface directly.
Appendix A, ZETI REFERENCE provides a ZETI Interface Command Reference table.
Appendix B, COMMANDS and ATTRIBUTE REFERENCES includes commands and attributes.
Page 12
x RFD8500/i RFID Developer Guide

Related Documents

Zebra Scanner SDK for Android Developer Guide, p/n MN002223Axx.
Zebra Scanner SDK for iOS Developer Guide, p/n MN001834Axx.
Java Class Reference Guide - This guide is in HTML format located under the javadoc directory in the RFID SDK for Android distribution package.
Zebra RFID SDK for iOS API document (Zebra_Bluetooth_RFID_iOS_SDK_API.pdf) - This document is packaged with Zebra_RFID_SDK_1.0.*.pkg an d is located und er \Zebra Technologies\RFID SDK\doc\ at the package installation path.
RFD8500 User Guide, p/n MN002065Axx.
RFD8500i User Guide, p/n MN-002761-XX.
RFD8500 Quick Start Guide, p/n MN002225Axx.
RFD8500i Quick Start Guide, p/n MN-002760-XX
RFD8500 Regulatory Guide, p/n MN002062Axx.
RFD8500i Regulatory Guide, p/n MN-002856-xx.
CRDUNIV-RFD8500-1R Three Slot Universal Charge Only Cradle Regulatory Guide, p/n MN002224 Axx.
RFD8500 Bluetooth Pairing Using S/N Barcode White Paper, available at: www.zebra.com/support.
Zebra RFD8500 Attribute Data Dictionary, available at: www.zebra.com/support.
Zebra Scanner SDK Attribute Data Dictionary. p/n 72E-149786-XX.
For the latest version of this guide and all guides, go to: www.zebra.com/support
.
Page 13

Notational Conventions

This document uses the following conventions:
The prefix SRFID is used to reference Zebra RFID SDK for iOS APIs via Bluetooth.
The abbreviation for Bluetooth is BT.
The acronym ZETI is an acronym for Zebra Easy Text Interface.
Italics are used to highlight chapters, sections, screen names, and field names in this and related documents
bullets (•) indicate:
Action items
Lists of alternatives
Lists of required steps that are not necessarily sequential
Sequential lists (e.g., those that describe step-by-step procedures) appear as numbered lists.
NOTE This symbol indicates something of special interest or importance to the reader. Failure to read the note
will not result in physical harm to the reader, equipment or data.
ABOUT THIS GUIDE xi
CAUTION This symbol indicates that if this information is ignored, the possibility of data or material damage may
occur.
WARNING! This symbol indicates that if this information is ignored the possibility that serious personal

Service Information

If you have a problem using the equipment, contact your facility's technical or systems support. If there is a problem with the equipment, they will contact the Zebra Technologies Global Customer Support Center at:
http://www.zebra.com/support.
When contacting Zebra support, please have the following information available:
Product name
Version number Zebra responds to calls by e-mail, telephone or fax within the time limits set forth in support agreements. If your problem cannot be solved by Zebra support, you may need to return your equipment for servicing and
will be given specific directions. Zebra is not responsible for any damages incurred during shipment if the approved shipping container is not used. Shipping the units improperly can possibly void the warranty.
injury may occur.
If you purchased your business product from a Zebra business partner, contact that business partner for support.
Page 14
xii RFD8500/i RFID Developer Guide
Page 15

Chapter 1 RFD8500 DEVICE OVERVIEW

Introduction

This chapter provides an overview of the RDF8500 device including system requirements, device setup, enabling Bluetooth, pairing information, using the Zebra RFID Mobile application for Android, using the Zebra RFID application for iOS, and using a PC Based Terminal Over ZETI with the RFD8500.

System Requirements

Developer Computers: Windows 7/64-bit, MacBook Pro with at least 8 Gb of memory.
Android: Android Studio (1.0 or later), and Android API Level 19 or later. The recommended Android
device version is KitKat 4.4.x.
iOS: iOS SDK 7.0 or later; XCode version 6.0 or later. The recommended iOS version is 8.0 or later.
Recommended devices: iPod Touch (5th generation), and iPhone 6.

Setting up the Device

To setup the device:
1. Fully charge the RFD8500 battery by using a USB cable connected to a PC or charger. It is recommen ded
to use a USB power adapter rated at 1.2A
When the RFD8500 is fully charged the power LED stops blinking and the unit goes into to Off Mode.
IMPORTANT The RFD8500 can not fully boot up if the battery level is low.
2. Disconnect the USB cable and reset the unit by pressing the Power button (if the unit is on, press Power
for 3 seconds to turn it off, and press again to turn it on).
3. Enable Bluetooth
4. To avoid the device moving into low power mode, reconnect the USB cable.
®
.
. See Enabling Bluetooth® (BT).
Page 16
1 - 2 RFD8500/i RFID Developer Guide

Resetting the Device

To reset the RFD8500, press the Power button for 3 seconds.
To reset to factory default procedures, press the Power and Bluetooth buttons simultaneously for 3 seconds.

Enabling Bluetooth® (BT)

Using Bluetooth on the RFD8500

The RFD8500 supports a dual SPP port - SSI and RFID serial ports with Android devices.
The custom UUIDs listed below are exposed for SSI and RFID to be used from the Android device.
SSI Custom UUID - 39f8fbf4-dc42-86c6-d163-79a0dcc58858
RFID Custom UUID - 2ad8a392-0e49-e52c-a6d2-60834c012263
Standard SPP UUID - 00001101-0000-1000-8000-00805F9B34FB.
BT profiles: SPP, HID, and MFi modes.
The RFD8500 supports MFi mode (iAP framework) to connect to iOS devices.
RFID functions are supported using the new ZETI protocol (see Appendix A, ZETI REFERENCE). For iOS devices, SDKs, and the Zebra RFID application for iOS are provided using ZETI in MFI mode. For Android devices only the Zebra RFID Mobile application for Android is provided using ZETI in BT SPP mode. The SDK for Android and Zebra RFID Mobile with API showcasing the use of the SDK is also supported.
Bar code functions are supported using the Simple Serial Interface (SSI) protocol for scanners. For iOS devices, SDKs and the Zebra Scanner Control for iOS application are provided, and it works in MFI mode. For Android devices, an SDK and two Zebra RFID Mobile applications are provided. One of the demo applications uses the ZETI in BT SPP mode, and the other uses the Android APIs. See Related
Documents on page x for information on the scanner developer guides.
Page 17
RFD8500 DEVICE OVERVIEW 1 - 3

Pairing with Bluetooth

Prior to pairing, note the following to identify the device:
Device S/N is printed on the device sticker on the back of the antenna as well as below the battery.
NOTE The RFD8500 requires a physical trigger press for BT pairing to complete. The paring request
is visible when a blue BT LED blinks on the RFD8500.
Pairing with Android Devices
1. Go to Settings > Bluetooth > Search for devices.
2. If the BT LED is not blinking, press the BT button for 1 second to make th e RFD8500 di scoverable ( the BT
LED starts blinking when in discoverable mode). When the device appears in the list tap the device name.
3. When the BT LED starts to blink rapidly, press the RFD8500 trigger within 25 seconds to accept the pairing
request.
Figure 1-1
Pairing with an Android Device
Pairing with a Personal Computer
1. If the BT LED is not blinking, press the BT button for 1 second to make th e RFD8500 di scoverable ( the BT
LED starts blinking when in discoverable mode). From the Start menu, select Device and Printers. Select
Add a device.
2. Select the device and click Next. When the BT LED starts blinking rapidly press the trigger within 25
seconds to acknowledge pairing.
Figure 1-2
Adding a Device to Pair
Page 18
1 - 4 RFD8500/i RFID Developer Guide
3. Click Close to complete the pairing process.
Figure 1-3
4. When the device is successfully paired, right click to check its properties. Select the Services tab and
Adding a Device to Pair
record the assigned COM port number for SPP.
Figure 1-4
Checking Device Properties
Pairing with an iOS Device
See Pairing with Android Devices on pa ge 1-3 for the pairing process. The iOS process is similar to the Android pairing process.
Page 19
Pairing using S/N Bar Code
The RFD8500 can be paired with a host that can scan the bar code printed at the bottom of the RFD8500 antenna.
An Android de mo applica tion, sample code , and a white paper ( see Relate d Documents on p age x) descr ibing this Bluetooth pairing process can be obtained by sending a request to Zebra support.
The procedure generally entails the following, in this order:
1. Run the Android demo application.
2. Press the RFD8500 Bluetooth button to start Bluetooth discovery mode.
3. Scan the RFD8500 S/N bar code at the bottom of the RFD8500 antenna.
4. Press the RFD8500 trigger to complete the pairin g pr oc ess.

Using a PC Based Terminal Over ZETI with the RFD8500

5. Open the PC based terminal application.
RFD8500 DEVICE OVERVIEW 1 - 5
6. Connect to the COM port identified in Checking Device Properties on page 1-4.
7. Run the cn command to connect with the RFD8500.
8. Run the gv command to get version related information.
NOTE The region must be set before proceeding to the RFID operation region.
9. Run the in command to read the tags.
10. Run the a command to abort the operation.
Figure 1-5
Commands
Page 20
1 - 6 RFD8500/i RFID Developer Guide
Page 21
Chapter 2 GETTING STARTED with the
ZEBRA RFID APPLICATION and SETTING UP the RFID SDK for iOS XCODE PROJECT

Introduction

This chapter provides step-by-step instructions to import and run the Zebra RFID Mobile Application code and to set up a new XCode project to work with the Zebra RFID SDK for iOS.

Using the Zebra RFID Application for iOS with iOS Devices

The iOS application must be compiled from sources to be deployed to your iOS devices. Recommendations:
iOS version is 8.0 or later.
Devices - iPod Touch (5th generation); iPhone 6. Use XCode to open the RFIDDemoApp project (RFIDDemoApp.xcodeproj). From XCode select iPhone6 as
the target device and build the project.
Figure 2-1
Successful Build Screen
Page 22
2 - 2 RFD8500/i RFID Developer Guide

Setting up an XCode Project for SDK-based iOS Applications

To set up a new XCode project to work with the Zebra RFID SDK for iOS:
1. In XCode IDE, click Single View Application to create a new iOS Application project.
Figure 2-2
2. Click Next.
3. Choose the options for the project.
Choosing Project Template
Figure 2-3
Choosing Project Options
Page 23
GETTING STARTED with the ZEBRA RFID APPLICATION and SETTING UP the RFID SDK for iOS XCODE PROJECT 2 - 3
4. Copy the symbolrfid-sdk folder with static library and headers from the Zebra RFID SDK for iOS installation
directory to the root folder of your XCode project.
NOTE Symbolic link can also be used instead of copying.
Figure 2-4
5. Configure your XCode project to support the com.zebra.rfd8x00_easytext external accessory
Copying Folder to Project
communication protocol by including the UISupportedExternalAccessoryProtocols key in your application's Info.plist file, or via the [Info] tab of your project settings.
Figure 2-5
Configure the Supported External Accessory Protocols
Page 24
2 - 4 RFD8500/i RFID Developer Guide
6. If your application is able to communicate with BT RFID readers in a background mode, configure your
XCode project to declare the background modes your application supp orts by including the UIBackgroundModes key in your application's Info.plist file, or via the [Info] tab of your project settings.
Figure 2-6
7. Configure your application to link with the default iOS frameworks listed below that are required for
Configure the Required Background Modes
utilization of the Zebra RFID SDK for iOS via [Link Binary With Libraries] section of the [Build Phases] tab of your project settings.
- ExternalAccessory.framework
- CoreBluetooth.framework
Figure 2-7
Configure the Linked Libraries
Page 25
GETTING STARTED with the ZEBRA RFID APPLICATION and SETTING UP the RFID SDK for iOS XCODE PROJECT 2 - 5
8. Configure your XCode project to make Zebra RFID SDK for iOS headers available through the
$(SRCROOT)/symbolrfid-sdk/include/ value of the [User Header Search Paths] option in the [Search Paths] section of the [Build Settings] tab of your project settings.
Figure 2-8
9. Configure your application to link with the Zebra RFID SDK for iOS static library through the [Link Binary
Configure the User Header Search Paths
With Libraries] section of the [Build Phases] tab of your project settings.
Figure 2-9
Link Application to the Zebra RFID SDK for iOS Static Library
Page 26
2 - 6 RFD8500/i RFID Developer Guide
Figure 2-10
Select the Static Library - libsymbolrfid-sdk.a
Figure 2-11
Selected Library in the List of Linked Libraries
Page 27

Chapter 3 ZEBRA RFID SDK for iOS

Introduction

This chapter provides detailed information about how to develop iOS applications using the Zebra RFID SDK for iOS.
The Zebra RFID SDK for iOS allows an application to communicate with RFID readers that support the ASCII protocol interface and are connected to an iOS device wirelessly via Bluetooth.
The Zebra RFID SDK for iOS provides the API that can be used by external applications to manage connections of remote RFID readers, and to control connected RFID readers.

RFID SDK Basics

NOTE Detailed API documentation can be found in Zebra_Bluetooth_RFID_iOS_SDK_API.pdf distributed with
the Zebra RFID SDK for iOS (see Related Documents on page x.)
The Zebra RFID SDK for iOS is intended for interaction with RFID readers connected to an iOS device via Bluetooth wireless interface. The SDK provided an ability to manage RFID readers' connections, performing various operations with connected RFID readers, configuring connected RFID readers and knowing other information related to connected RFID readers.
The Zebra RFID SDK for iOS consists of a static library that is supposed to be linked with an external iOS application and a set of necessary header files. Step -by-step instructions for configur ing XCode project to enable utilization of Zebra RFID SDK for iOS are provided in Getting Started document.
All available API functions are defined by srfidISdkApi Objective C protocol. A single shared instance of an API object that implements srfidISdkApi protocol can be obtained via createRfidSdkApiInstance method of srfidSdkFactory class.
/* variable to store single shared instance of API object */ id <srfidISdkApi> apiInstance; /* receiving single shared instance of API object */ apiInstance = [srfidSdkFactory createRfidSdkApiInstance]; /* getting SDK version string */ NSString *sdk_version = [apiInstance srfidGetSdkVersion]; NSLog(@"Zebra SDK version: %@\n", sdk_version);
Page 28
3 - 2 RFD8500/i RFID Developer Guide

Receiving Asynchronous Notifications from the SDK

The SDK supports a set of asynchronous notifications to inform the application about RFID reader related events (e.g., reception of tag data, starting of radio operation, etc.) and connectivity related events (e.g., appearance of RFID reader). All supported callbacks are defined by srfidISdkApiDelegate Objective C protocol.
In order to receive asynchronous notification s from the SDK the application performs the following steps.
1. Create an object that implements srfidISdkApiDelegateProtocol.
/* definition of class that implements srfidISdkApiDelegate protocol */ @interface EventReceiver : NSObject <srfidISdkApiDelegate> {
/* variables */
/* methods definition */
Register the created object as notification receiver via srfidSetDelegate API function.
2.
/* registration of callback interface with SDK */ EventReceiver *eventListener = [[EventReceiver alloc] init]; apiInstance srfidSetDelegate:eventListener];
Subscribe for asynchronous event of specific ty pes via srfidSubscribeForEvents API function.
3.
/* subscribe for tag data and operation status related events */ [apiInstance srfidSubsribeForEvents:(SRFID_EVENT_MASK_READ | SRFID_EVENT_MASK_STATUS)]; /* subscribe for battery and hand-held trigger related events */ [apiInstance srfidSubsribeForEvents:(SRFID_EVENT_MASK_BATTERY | SRFID_EVENT_MASK_TRIGGER)];
If a specific object is registered as a notification receiver the SDK calls the corresponding method of the registered object when a specific event occurs if the application is subscribed for events of this type. The SDK may deliver asynchronous events on a main thre ad or on on e of SDK helpe r th re ad s so the ob ject t hat implements srfidISdkApiDelegate protocol is thread-safe.

Connectivity Management

The Zebra RFID SDK for iOS is designed to support interaction with RFID readers operating in either BT MFi or BT LE mode. The SDK is intentionally configured to enable communication with a specific type of RFID readers via srfidSetOperationalMode API function. If operating mode of the SDK is not configured the SDK remains disabled and is not able to communicate with RFID readers in neither BT MFi nor BT LE modes.
Following example demonstrates enabling interaction with RFID readers in BT MFi mode.
/* configuring SDK to communicate with RFID readers in BT MFi mode */ [apiInstance srfidSetOperationalMode:SRFID_OPMODE_MFI];
The following terms are introduced to distinguish RFID readers that are seen by the SDK via OS API and RFID readers with which the SDK established a logical communication session and is able to interact. An RFID reader is called available if it is already connected to the iOS device via Bluetooth. The RFID reader is seen by the SDK and the SDK can establish a logical communication session to interact with the RFID reader. If a logical communication session is established with an already connected (via Bluetooth) RFID reader, the RFID reader is called active.
The SDK maintains internal lists of active and available RFID readers. The following example demonstrates reception of lists of active and available RFID readers from the SDK.
(continued on next page)
Page 29
ZEBRA RFID SDK for iOS 3 - 3
/* allocate an array for storage of list of available RFID readers */ NSMutableArray *available_readers = [[NSMutableArray alloc] init];
/* allocate an array for storage of list of active RFID readers */ NSMutableArray *active_readers = [[NSMutableArray alloc] init];
/* retrieve a list of available readers */ [apiInstance srfidGetAvailableReadersList:&available_readers];
/* retrieve a list of active readers */ [apiInstance srfidGetActiveReadersList:&active_readers];
/* merge active and available readers to a single list */ NSMutableArray *readers = [[NSMutableArray alloc] init]; [readers addObjectsFromArray:active_readers]; [readers addObjectsFromArray:available_readers]; [active_readers release]; [available_readers release];
for (srfidReaderInfo *info in readers) {
/* print the information about RFID reader represented by srfidReaderInfo object */
NSLog(@"RFID reader is %@: ID = %d name = %@\n", (([info isActive] == YES) ? @"active" : @"available"), [info getReaderID], [info getReaderName]); }
[readers release];
The SDK supports automatic detection of appearance and disap pearance of available RFID reader s. When the Available readers detection option is enabled the SDK updates its internal list of available RFID readers and delivers a corresponding asynchronous notification once it detects connection or disconnection of a specific RFID reader to the iOS device via Bluetooth . If the option is disabled the SDK updates its internal list of available RFID readers only when it is requested by an application via srfidGetAvailableReadersList API function. Following example demonstrates enabling of automatic detection and processing of corresponding asynchronous notifications.
/* subscribe for connectivity related events */ [apiInstance srfidSubsribeForEvents:(SRFID_EVENT_READER_APPEARANCE | SRFID_EVENT_READER_DISAPPEARANCE)]; /* configuring SDK to detect appearance and disappearance of available RFID readers */ [apiInstance srfidEnableAvailableReadersDetection:YES];
/* EventReceiver class: partial implementation */ @implementation EventReceiver ...
-(void)srfidEventReaderAppeared:(srfidReaderInfo*)availableReader {
/* print the information about RFID reader represented by srfidReaderInfo object */
NSLog(@"RFID reader has appeared: ID = %d name = %@\n", [availableReader getReaderID], [availableReader getReaderName]); }
-(void)srfidEventReaderDisappeared:(int)readerID { NSLog(@"RFID reader has disappeared: ID = %d\n", readerID); } ... @end
Page 30
3 - 4 RFD8500/i RFID Developer Guide
To enable interaction with a specific available RFID reader the application shall establish a logical communication session via srfidEstablishCommunicationSession API function. The SDK will deliver a corresponding asynchronous notification once the logical communication session is established if the application has subscribed for events of this type. To perform various operations wit h a specific active RFID reader the application shall also establish an ASCII protocol leve l connection via srfidEstablishAsciiConne ction API function. Without an established ASCII protocol level connection most of API functions will fail with a SRFID_RESULT_ASCII_CONNECTION_REQUIRED error code. The interaction with a specific active RFID reader can be terminated by the application via srfidTerminateCommunicationSession API function. When the existing logical communication session is terminated either per application request or due to Bluetooth disconnection the SDK will deliver a corresponding asynchronous notification if the application has subscribed for events of this type. The example on the following page demonstrates establishment of a logical communication session with one of available RFID readers, termination of an existing logical communication session with one of active RFID readers and processing of logical communication session related asynchronous events.
/* subscribe for connectivity related events */ [apiInstance srfidSubsribeForEvents:(SRFID_EVENT_SESSION_ESTABLISHMENT | SRFID_EVENT_SESSION_TERMINATION)];
/* allocate an array for storage of list of available RFID readers */ NSMutableArray *available_readers = [[NSMutableArray alloc] init]; /* retrieve a list of available readers */ [apiInstance srfidGetAvailableReadersList:&available_readers]; if (0 < [available_readers count]) {
/* at least one available RFID reader exists */ srfidReaderInfo *reader = (srfidReaderInfo*)[available_readers objectAtIndex:0]; /* establish logical communication session */
[apiInstance srfidEstablishCommunicationSession:[reader getReaderID]]; } [available_readers release]; /* allocate an array for storage of list of active RFID readers */ NSMutableArray *active_readers = [[NSMutableArray alloc] init]; /* retrieve a list of active readers */ [apiInstance srfidGetActiveReadersList:&active_readers]; if (0 < [active_readers count]) {
/* at least one active RFID reader exists */
srfidReaderInfo *reader = (srfidReaderInfo*)[active_readers objectAtIndex:0];
/* terminate logical communication session */
[apiInstance srfidTerminateCommunicationSession:[reader getReaderID]]; } [active_readers release];
/* EventReceiver class: partial implementation */ @implementation EventReceiver ...
-(void)srfidEventCommunicationSessionEstablished:(srfidReaderInfo*)activeReader { /* print the information about RFID reader represented by srfidReaderInfo object */ NSLog(@"RFID reader has connected: ID = %d name = %@\n", [activeReader getReaderID], [activeReader getReaderName]);
(continued on next page)
Page 31
ZEBRA RFID SDK for iOS 3 - 5
/* establish an ASCII protocol level connection */ NSString *password = @"ascii password"; SRFID_RESULT result = [apiInstance srfidEstablishAsciiConnection:[reader getReaderID] aPassword:password]; if (SRFID_RESULT_SUCCESS == result) { NSLog(@"ASCII connection has been established\n"); } else if (SRFID_RESULT_WRONG_ASCII_PASSWORD == result) { NSLog(@"Incorrect ASCII connection password\n"); } else { NSLog(@"Failed to establish ASCII connection\n"); } }
-(void)srfidEventCommunicationSessionTerminated:(int)readerID { NSLog(@"RFID reader has disconnected: ID = %d\n", readerID);
} ... @end
The SDK supports Automatic communication session reestablishment option. When the option is enabled the SDK automatically establishes a logical communication session with the last active RFID reader that had unexpectedly disappeared once the RFID reader is recognized as available. If the Available readers detection option is enabled the RFID reader is recognized as available automatically when it becomes connected via Bluetooth. Otherwise, the SDK adds the RFID reader to the list of available RFID readers only during discovery procedure requested by the application via srfidGetAvailableReadersList API. The option has no effect if the application has intentionally terminate a communication session with the active RFID reader via srfidTerminateCommunicationSession API function. The Automatic communication session reestablishment option is configured via the srfidEnableAutomaticSessionReestablishment API function.
/* enable automatic communication session reestablishment */ [apiInstance srfidEnableAutomaticSessionReestablishment:YES];

Knowing the Reader Related Information

Knowing the Software Version

The SDK provides an ability to retrieve information about software versions of various components of a specific active RFID reader. Software version related information could be retrieved via srfidGetReaderVersionInfo API function as demonstrated in the following example.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */ /* allocate object for storage of version related information */ srfidReaderVersionInfo *version_info = [[srfidReaderVersionInfo alloc] init];
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil;
(continued on next page)
Page 32
3 - 6 RFD8500/i RFID Developer Guide
/* retrieve version related information */ SRFID_RESULT result = [apiInstance srfidGetReaderVersionInfo:m_ReaderId aReaderVersionInfo:&version_info aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* print the received version related information */ NSLog(@"Device version: %@\n", [version_info getDeviceVersion]); NSLog(@"NGE version: %@\n", [version_info getNGEVersion]);
NSLog(@"Bluetooth version: %@\n", [version_info getBluetoothVersion]); } 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", m_ReaderId); } else {
NSLog(@"Request failed\n"); }
[version_info release];

Knowing the Reader Capabilities

The SDK provides an ability to retrieve the capabilities (or read-only properties) of a specific active RFID reader.
The reader capabilities include the following:
Serial number
Model name
Manufacturer
Manufacturing date.
Device name
ASCII protocol version
Number of select records (pre-filters)
Minimal and maximal antenna power levels (in 0.1 dBm units)
Step for configuration of antenna power level (in 0.1 dBm units)
Version of air protocol
Bluetooth address
Maximal number of operations to be combined in a sequence.
Page 33
ZEBRA RFID SDK for iOS 3 - 7
The reader capabilities could be retrieved via srfidGetReaderCapabilitiesInfo API function as demonstrated in the following example.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* allocate object for storage of capabilities information */ srfidReaderCapabilitiesInfo *capabilities = [[srfidReaderCapabilitiesInfo alloc] init];
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil;
/* retrieve capabilities information */ SRFID_RESULT result = [apiInstance srfidGetReaderCapabilitiesInfo:m_ReaderId aReaderCapabilitiesInfo:&capabilities aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* print the received capabilities related information */
NSLog(@"Serial number: %@\n", [capabilities getSerialNumber]); NSLog(@"Model: %@\n", [capabilities getModel]); NSLog(@"Manufacturer: %@\n", [capabilities getManufacturer]); NSLog(@"Manufacturing date: %@\n", [capabilities getManufacturingDate]); NSLog(@"Scanner name: %@\n", [capabilities getScannerName]); NSLog(@"Ascii version: %@\n", [capabilities getAsciiVersion]); NSLog(@"Air version: %@\n", [capabilities getAirProtocolVersion]); NSLog(@"Bluetooth address: %@\n", [capabilities getBDAddress]); NSLog(@"Select filters number: %d\n", [capabilities getSelectFilterNum]); NSLog(@"Max access sequence: %d\n", [capabilities getMaxAccessSequence]); NSLog(@"Power level: min = %d; max = %d; step = %d\n", [capabilities
getMinPower], [capabilities getMaxPower], [capabilities getPowerStep]); } 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", m_ReaderId); } else {
NSLog(@"Request failed\n"); }
[capabilities release];
Page 34
3 - 8 RFD8500/i RFID Developer Guide

Knowing Supported Regions

The RFID reader could be configured to operate in a various countries. The SDK provides an ability to retrieve the list of regions supported by a specific active RFID reader.
The list of supported regions co uld be retrieved via srfidGetSupportedRegions API function as demonstrated in the following example.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* allocate object for storage of region information */ NSMutableArray *regions = [[NSMutableArray alloc] init]; /* an object for storage of error response received from RFID reader */ NSString *error_response = nil; /* retrieve supported regions */ SRFID_RESULT result = [apiInstance srfidGetSupportedRegions:m_ReaderId aSupportedRegions:®ions aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* print supported regions information */ NSLog(@"Number of supported regions: %d\n", [regions count]); for (srfidRegionInfo *info in regions) {
NSLog(@"Regions [%@] is supported: %@\n", [info getRegionName], [info
getRegionCode]);
} } 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", m_ReaderId); } else {
NSLog(@"Request failed\n"); } [regions release];
As the RFID reader could be configured to operate on a specific radio channels in some of countries the SDK provides an ability to retrieve the detailed information regarding one of regions supported by a specific active RFID reader. The detailed information includes a set of channel supported in the region and allowance of hopping configuration.
Page 35
ZEBRA RFID SDK for iOS 3 - 9
This information could be retrieved via srfidGetRegionInfo API function as demonstrated in the following example.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* allocate object for storage of supported channels information */ NSMutableArray *channels = [[NSMutableArray alloc] init]; BOOL hopping = NO; /* an object for storage of error response received from RFID reader */ NSString *error_response = nil; /* retrieve detailed information about region specified by "USA" region code */ SRFID_RESULT result = [apiInstance srfidGetRegionInfo:m_ReaderId aRegionCode:@"USA" aSupportedChannels:&channels aHoppingConfigurable:&hopping aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* print retrieved detailed information */ NSLog(@"Hopping configuration is: %@\n", ((YES == hopping) ? @"supported" :
@"NOT supported"));
for (NSString *str_channel in channels) {
NSLog(@"Supported channel: %@\n", str_channel);
} } 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", m_ReaderId); } else {
NSLog(@"Request failed\n"); }
[channels release];
Page 36
3 - 10 RFD8500/i RFID Developer Guide

Knowing Supported Link Profiles

An antenna of the RFID reader could be configured to operate in various RF modes (link profiles ). The SDK provides an ability to retrieved the list of link profiles (RF modes) supported by a specific active RFID reader.
The list of supported link profiles could be retrieved via srfidGetSupportedLinkProfiles API function as demonstrated in the following example.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* allocate object for storage of link profiles information */ NSMutableArray *profiles = [[NSMutableArray alloc] init]; /* an object for storage of error response received from RFID reader */ NSString *error_response = nil;
/* retrieve supported link profiles */ SRFID_RESULT result = [apiInstance srfidGetSupportedLinkProfiles:m_ReaderId aLinkProfilesList:&profiles aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* print retrieved information about supported link profiles */ NSLog(@"Number of supported link profiles: %d\n", [profiles count]); for (srfidLinkProfile *profile_info in profiles) {
NSLog(@"RF mode index: %d\n", [profile_info getRFModeIndex]); NSLog(@"BDR: %d\n", [profile_info getBDR]); NSLog(@"PIE: %d\n", [profile_info getPIE]); NSLog(@"Tari: min = %d; max = %d; step = %d\n", [profile_info
getMinTari], [profile_info getMaxTari], [profile_info getStepTari]);
NSLog(@"EPCHAGT&CConformance: %@\n", ((NO == [profile_info
getEPCHAGTCConformance]) ? @"NO" : @"YES"));
NSLog(@"Divide Ratio: %@\n", [profile_info getDivideRatioString]); NSLog(@"FLM: %@\n", [profile_info getForwardLinkModulationString]); NSLog(@"M: %@\n", [profile_info getModulationString]); NSLog(@"Spectral Mask indicator: %@\n", [profile_info
getSpectralMaskIndicatorString]);
} } 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", m_ReaderId); } else {
NSLog(@"Request failed\n"); }
[profiles release];
Page 37
ZEBRA RFID SDK for iOS 3 - 11

Knowing Battery Status

A specific active RFID reader could send an asynchronous notification regarding battery status. The SDK informs the application about received asynchronous battery status event if the application has subscribed for events of this type. The SDK also provides an ability to cause a specific active RFID reader to immediately send information about current battery status.
The following example demonstrates both requesting and processing of asynchronous battery status related notifications.
/* subscribe for battery related events */ [apiInstance srfidSubsribeForEvents:SRFID_EVENT_MASK_BATTERY];
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* cause RFID reader to generate asynchronous battery status notification */ SRFID_RESULT result = [apiInstance srfidRequestBatteryStatus:m_ReaderId]; if (SRFID_RESULT_SUCCESS == result) {
NSLog(@"Request succeed\n"); } else {
NSLog(@"Request failed\n"); } /* EventReceiver class: partial implementation */ @implementation EventReceiver ...
- (void)srfidEventBatteryNotity:(int)readerID aBatteryEvent:(srfidBatteryEvent*)batteryEvent {
/* print the received information regarding battery status */
NSLog(@"Battery status event received from RFID reader with ID = %d\n", readerID);
NSLog(@"Battery level: %d\n", [batteryEvent getPowerLevel]);
NSLog(@"Charging: %@\n", ((NO == [batteryEvent getIsCharging]) ? @"NO" : @"YES"));
NSLog(@"Event cause: %@\n", [batteryEvent getEventCause]); } ... @end

Configuring the Reader

The Zebra RFID SDK for iOS API supports managing of various RFID reader parameters including:
Antenna parameters
Singulation parameters
Start and stop triggers parameters
Tag report par am e te rs
Regulatory parameters
Pre-filters
Beeper.
Page 38
3 - 12 RFD8500/i RFID Developer Guide

Antenna Configuration

The following antenna related settings could be configured via the SDK:
Output power level (in 0.1 dBm units)
Index of selected link profile (RF mode)
Application of pre-filters (select records)
Tari (Type-A reference interval).
Tari value is set in accordance with the selected link profile, (i.e., tari value is in the interval be tw ee n min i m al and maximal tari values specified by the selected link profile). If step size is supported by the selected link profile, the tari value must be a multiple of step size. Antenna settings could be retrieved and set via srfidGetAntennaConfiguration and srfidSetAntennaConfiguration API function accordingly.
Following example demonstrates retrieving current antenna settings and setting of antenna configuration with minimal output power and one of supported link profiles.
/* allocate an array for storage of list of active RFID readers */ NSMutableArray *active_readers = [[NSMutableArray alloc] init]; /* retrieve a list of active readers */ [apiInstance srfidGetActiveReadersList:&active_readers];
if (0 < [active_readers count]) {
/* at least one active RFID reader exists */ srfidReaderInfo *reader = (srfidReaderInfo*)[active_readers objectAtIndex:0]; int reader_id = [reader getReaderID];
/* allocate object for storage of antenna settings */ srfidAntennaConfiguration *antenna_cfg = [[srfidAntennaConfiguration alloc]
init];
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil; /* retrieve antenna configuration */ SRFID_RESULT result = [apiInstance srfidGetAntennaConfiguration:reader_id
aAntennaConfiguration:&antenna_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) { /* antenna configuration received */
NSLog(@"Antenna power level: %1.1f\n", [antenna_cfg getPower]/10.0); NSLog(@"Antenna RF mode index: %d\n", [antenna_cfg getLinkProfileIdx]); NSLog(@"Antenna tari: %d\n", [antenna_cfg getTari]); NSLog(@"Antenna pre-filters application: %@", ((NO == [antenna_cfg
getDoSelect]) ? @"NO" : @"YES"));
} 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", m_ReaderId); } else {
(continued on next page)
Page 39
NSLog(@"Request failed\n");
}
[antenna_cfg release]; error_response = nil;
/* RF mode index to be set */ int link_profile_idx = 0; /* tari to be set */ int tari = 0; /* 20.0 dbm power level to be set */ int power = 200;
/* allocate object for storage of link profiles information */ NSMutableArray *profiles = [[NSMutableArray alloc] init];
/* retrieve supported link profiles */ result = [apiInstance srfidGetSupportedLinkProfiles:reader_id
aLinkProfilesList:&profiles aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
if (0 < [profiles count]) {
srfidLinkProfile *profile = (srfidLinkProfile*)[profiles lastObject]; link_profile_idx = [profile getRFModeIndex]; tari = [profile getMaxTari];
}
}
ZEBRA RFID SDK for iOS 3 - 13
[profiles release];
/* allocate object for storage of capabilities information */ srfidReaderCapabilitiesInfo *capabilities = [[srfidReaderCapabilitiesInfo alloc]
init];
/* retrieve capabilities information */ result = [apiInstance srfidGetReaderCapabilitiesInfo:reader_id
aReaderCapabilitiesInfo:&capabilities aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
power = [capabilities getMinPower];
}
[capabilities release];
/* prepare an object with desired antenna parameters */ antenna_cfg = [[srfidAntennaConfiguration alloc] init]; [antenna_cfg setLinkProfileIdx:link_profile_idx]; [antenna_cfg setPower:power]; [antenna_cfg setTari:tari]; [antenna_cfg setDoSelect:NO];
error_response = nil; /* set antenna configuration */ result = [apiInstance srfidSetAntennaConfiguration:reader_id
aAntennaConfiguration:antenna_cfg aStatusMessage:&error_response];
[antenna_cfg release];
(continued on next page)
Page 40
3 - 14 RFD8500/i RFID Developer Guide
if (SRFID_RESULT_SUCCESS == result) {
/* antenna configuration applied successfully */
NSLog(@"Antenna 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", m_ReaderId); } else {
NSLog(@"Request failed\n"); }
} else {
NSLog(@"No active RFID readers\n");
} [active_readers release];

Singulation Configuration

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 accordingly srfidGetSingulationConfiguration and srfidSetSingulationConfiguration API functions as demonstrated in the following example.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* 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:m_ReaderId aSingulationConfig:&singulation_cfg aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* singulation configuration received */ NSLog(@"Tag population: %d\n", [singulation_cfg getTagPopulation]);
(continued on next page)
Page 41
ZEBRA RFID SDK for iOS 3 - 15
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; } /* change the received singulation configuration */ [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 */ result = [apiInstance srfidSetSingulationConfiguration:m_ReaderId
aSingulationConfig:singulation_cfg aStatusMessage:&error_response];
(continued on next page)
Page 42
3 - 16 RFD8500/i RFID Developer Guide
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", m_ReaderId); } else {
NSLog(@"Request failed\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", m_ReaderId);
} else {
NSLog(@"Request failed\n");
}
[singulation_cfg release];

Trigger Configuration

The SDK provides an ability to configure start and stop trigger parameters. Start trigger parameters include the following:
Start of an operation based on a physical trigger.
Trigger type (press/release) of a physical trigger.
Delay (in milliseconds) of start of operation.
Repeat monitoring for start trigger after stop of operation.
Start trigger configuration could be retrieved and set via srfidGetStartTriggerConfiguration and srfidSetStartTriggerConfiguration API functions accordingly.
Stop trigger parameters include the following:
Stop of an operation based on a physical trigger.
Trigger type (press/release) of a physical trigger.
Stop of an operation based on a specified number of tags inventoried.
Stop of an operation based on a specified timeout (in milliseconds).
Stop of an operation based on a specified number of inventory rounds completed.
Stop of an operation based on a specified number of access rounds completed.
Page 43
ZEBRA RFID SDK for iOS 3 - 17
Stop trigger settings could be retrieved and set via accordingly srfidGetStopTriggerConfiguration and srfidSetStopTriggerConfiguration API functions.
The following example demonstrates retrieval of current start and stop trigger parameters as we ll as configuring new start and stop triggers parameters.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* allocate object for storage of start trigger settings */ srfidStartTriggerConfig *start_trigger_cfg = [[srfidStartTriggerConfig alloc] init];
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil;
/* retrieve start trigger parameters */ SRFID_RESULT result = [apiInstance srfidGetStartTriggerConfiguration:m_ReaderId aStartTriggeConfig:&start_trigger_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* start trigger configuration received */ NSLog(@"Start trigger: start on physical trigger = %@\n", ((YES == [start_trigger_cfg
getStartOnHandheldTrigger]) ? @"YES" : @"NO"));
NSLog(@"Start trigger: physical trigger type = %@\n", ((SRFID_TRIGGERTYPE_PRESS == [start_trigger_cfg getTriggerType]) ? @"PRESSED" : @"RELEASED"));
NSLog(@"Start trigger: delay = %d ms\n", [start_trigger_cfg getStartDelay]);
NSLog(@"Start trigger: repeat monitoring = %@\n", ((NO == [start_trigger_cfg getRepeatMonitoring]) ? @"NO" : @"YES")); } else {
NSLog(@"Failed to receive start trigger parameters\n"); }
/* configure start trigger parameters */ /* start on physical trigger */ [start_trigger_cfg setStartOnHandheldTrigger:YES]; /* start on physical trigger press */ [start_trigger_cfg setTriggerType:SRFID_TRIGGERTYPE_PRESS]; /* repeat monitoring for start trigger conditions after operation stop */ [start_trigger_cfg setRepeatMonitoring:YES]; [start_trigger_cfg setStartDelay:0]; /* set start trigger parameters */ result = [apiInstance srfidSetStartTriggerConfiguration:m_ReaderId aStartTriggeConfig:start_trigger_cfg aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* start trigger configuration applied */
NSLog(@"Start trigger configuration has been set\n"); } else {
NSLog(@"Failed to set start trigger parameters\n"); } [start_trigger_cfg release];
/* allocate object for storage of start trigger settings */ srfidStopTriggerConfig *stop_trigger_cfg = [[srfidStopTriggerConfig alloc] init];
(continued on next page)
Page 44
3 - 18 RFD8500/i RFID Developer Guide
/* retrieve stop trigger parameters */ result = [apiInstance srfidGetStopTriggerConfiguration:m_ReaderId aStopTriggeConfig:&stop_trigger_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* stop trigger configuration received */ NSLog(@"Stop trigger: start on physical trigger = %@\n", ((YES ==
[stop_trigger_cfg getStopOnHandheldTrigger]) ? @"YES" : @"NO"));
NSLog(@"Stop trigger: physical trigger type = %@\n", ((SRFID_TRIGGERTYPE_PRESS == [stop_trigger_cfg getTriggerType]) ? @"PRESSED" : @"RELEASED"));
if (YES == [stop_trigger_cfg getStopOnTagCount]) {
NSLog(@"Stop trigger: stop on %d number of tags received\n",
[stop_trigger_cfg getStopTagCount]);
} if (YES == [stop_trigger_cfg getStopOnTimeout]) {
NSLog(@"Stop trigger: stop on %d ms timeout\n", [stop_trigger_cfg
getStopTimeout]);
}
if (YES == [stop_trigger_cfg getStopOnInventoryCount]) {
NSLog(@"Stop trigger: stop on %d inventory rounds\n", [stop_trigger_cfg
getStopInventoryCount]);
} if (YES == [stop_trigger_cfg getStopOnAccessCount]) {
NSLog(@"Stop trigger: stop on %d access rounds\n", [stop_trigger_cfg
getStopAccessCount]);
} } else {
NSLog(@"Failed to receive stop trigger parameters\n"); } /* configure stop trigger parameters: stop on physical trigger release or after 5 sec timeout or after 10 tags inventoried */ /* start on physical trigger */ [stop_trigger_cfg setStopOnHandheldTrigger:YES]; [stop_trigger_cfg setTriggerType:SRFID_TRIGGERTYPE_RELEASE]; [stop_trigger_cfg setStopOnTimeout:YES]; [stop_trigger_cfg setStopTimout:(5*1000)]; [stop_trigger_cfg setStopOnTagCount:YES]; [stop_trigger_cfg setStopTagCount:10]; [stop_trigger_cfg setStopOnInventoryCount:NO]; [stop_trigger_cfg setStopOnAccessCount:NO];
/* set stop trigger parameters */ result = [apiInstance srfidSetStopTriggerConfiguration:m_ReaderId aStopTriggeConfig:stop_trigger_cfg aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* stop trigger configuration applied */
NSLog(@"Stop trigger configuration has been set\n"); } else {
NSLog(@"Failed to set stop trigger parameters\n"); } [stop_trigger_cfg release];
Page 45
ZEBRA RFID SDK for iOS 3 - 19

Tag Report Configuration

The SDK provides an ability to configure a set of fields to be reported in a response to an operation by a specific active RFID reader.
Supported fields that might be reported include the following:
First and last seen times
PC value
RSSI value
Phase value
Channel index
Tag seen count .
Tag report parameters could be managed via srfidSetReportConfiguration and srfidGetReportConfiguration API functions as demonstrated in the following ex am pl e.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* allocate object for storage of tag report settings */ srfidTagReportConfig *report_cfg = [[srfidTagReportConfig alloc] init];
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil;
/* retrieve tag report parameters */ SRFID_RESULT result = [apiInstance srfidGetTagReportConfiguration:m_ReaderId aTagReportConfig:&report_cfg aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* tag report configuration received */ NSLog(@"PC field: %@\n", ((NO == [report_cfg getIncPC]) ? @"off" : @"on")); NSLog(@"Phase field: %@\n", ((NO == [report_cfg getIncPhase]) ? @"off" :
@"on"));
NSLog(@"Channel index field: %@\n", ((NO == [report_cfg getIncChannelIdx]) ?
@"off" : @"on"));
NSLog(@"RSSI field: %@\n", ((NO == [report_cfg getIncRSSI]) ? @"off" :
@"on"));
NSLog(@"Tag seen count field: %@\n", ((NO == [report_cfg getIncTagSeenCount])
? @"off" : @"on"));
NSLog(@"First seen time field: %@\n", ((NO == [report_cfg getIncFirstSeenTime]) ?
@"off" : @"on"));
NSLog(@"Last seen time field: %@\n", ((NO == [report_cfg getIncLastSeenTime]) ? @"off" : @"on")); } else {
NSLog(@"Failed to receive tag report parameters\n"); }
/* configure tag report parameters to include only RSSI field */ [report_cfg setIncRSSI:YES]; [report_cfg setIncPC:NO]; [report_cfg setIncPhase:NO]; [report_cfg setIncChannelIdx:NO]; [report_cfg setIncTagSeenCount:NO]; [report_cfg setIncFirstSeenTime:NO]; [report_cfg setIncLastSeenTime:NO];
(continued on next page)
Page 46
3 - 20 RFD8500/i RFID Developer Guide
/* set tag report parameters */ result = [apiInstance srfidSetTagReportConfiguration:m_ReaderId aTagReportConfig:report_cfg aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* tag report configuration applied */
NSLog(@"Tag report configuration has been set\n"); } else {
NSLog(@"Failed to set tag report parameters\n"); } [report_cfg release];

Regulatory Configuration

The SDK supports managing of regulatory related parameters of a specific active RFID reader. Regulatory configuration includes the following:
Code of selected region
Hopping
Set of enabled channels. A set of enabled channe ls includes only such channels that are supported in the selected region. If hopping
configuration is not allowed for the selected regions a set of enabled channels is not specified. Regulatory parameters could be retrieved and set via srfidGetRegulatoryConfig and srfidSetRegulatoryConfig
API functions accordingly. The following example demonstrates retrieving of current regulatory settin gs an d configuring the RFID reader to operate in one of supported regions.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* allocate object for storage of regulatory settings */ srfidRegulatoryConfig *regulatory_cfg = [[srfidRegulatoryConfig alloc] init];
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil;
/* retrieve regulatory parameters */ SRFID_RESULT result = [apiInstance srfidGetRegulatoryConfig:m_ReaderId aRegulatoryConfig:®ulatory_cfg aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* regulatory configuration received */
if (NSOrderedSame == [[regulatory_cfg getRegionCode] caseInsensitiveCompare:@"NA"]) {
NSLog(@"Regulatory: region is NOT set\n"); } else {
NSLog(@"Region code: %@\n", [regulatory_cfg getRegionCode]);
SRFID_HOPPINGCONFIG hopping_cfg = [regulatory_cfg getHoppingConfig];
NSLog(@"Hopping is %@\n", ((SRFID_HOPPINGCONFIG_DISABLED == hopping_cfg)
? @"off" : @"on"));
NSArray *channels = [regulatory_cfg getEnabledChannelsList];
for (NSString *str in channels) {
NSLog(@"Enabled channel: %@\n", str);
} }
} else {
(continued on next page)
Page 47
ZEBRA RFID SDK for iOS 3 - 21
NSLog(@"Failed to receive regulatory parameters\n");
}
[regulatory_cfg release];
/* code of region to be set as current one */ NSString *region_code = @"USA"; /* an array of enabled channels to be set */ NSMutableArray *enabled_channels = [[NSMutableArray alloc] init]; /* a hopping to be set */ SRFID_HOPPINGCONFIG hopping_on = SRFID_HOPPINGCONFIG_DISABLED;
/* allocate object for storage of region information */ NSMutableArray *regions = [[NSMutableArray alloc] init];
/* retrieve supported regions */ result = [apiInstance srfidGetSupportedRegions:m_ReaderId aSupportedRegions:®ions aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* supported regions information received */ /* select the last supported regions to be set as current one */
region_code = [NSString stringWithFormat:@"%@", [(srfidRegionInfo*)[regions lastObject] getRegionCode]]; }
[regions release]; /* allocate object for storage of supported channels information */ NSMutableArray *supported_channels = [[NSMutableArray alloc] init]; BOOL hopping_configurable = NO;
/* retrieve detailed information about region specified by region code */ result = [apiInstance srfidGetRegionInfo:m_ReaderId aRegionCode:region_code aSupportedChannels:&supported_channels aHoppingConfigurable:&hopping_configurable aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* region information received */
if (YES == hopping_configurable) {
/* region supports hopping */ /* enable first and last channels from the set of supported channels */ [enabled_channels addObject:[supported_channels firstObject]]; [enabled_channels addObject:[supported_channels lastObject]]; /* enable hopping */
hopping_on = SRFID_HOPPINGCONFIG_ENABLED; } else {
/* region does not support hopping */
/* request to not configure hopping */
hopping_on = SRFID_HOPPINGCONFIG_DEFAULT; }
}
(continued on next page)
Page 48
3 - 22 RFD8500/i RFID Developer Guide
[supported_channels release]; error_response = nil;
/* configure regulatory parameters to be set */ regulatory_cfg = [[srfidRegulatoryConfig alloc] init]; [regulatory_cfg setRegionCode:region_code]; [regulatory_cfg setEnabledChannelsList:enabled_channels]; [regulatory_cfg setHoppingConfig:hopping_on];
/* set regulatory parameters */ result = [apiInstance srfidSetRegulatoryConfig:m_ReaderId aRegulatoryConfig:regulatory_cfg aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* regulatory configuration applied */
NSLog(@"Tag report configuration has been set\n"); } else if (SRFID_RESULT_RESPONSE_ERROR == result) {
NSLog(@"Error response from RFID reader: %@\n", error_response); } else { NSLog(@"Failed to set regulatory parameters\n"); } [enabled_channels release]; [regulatory_cfg release];

Pre-filters Configuration

Pre-filters are same as the select command of C1G2 spec ification . The SDK supports pr e-filters configuration of a specific active RFID reader. When pre -filters are configured, they could be applied prior to inventory operations.
Following parameters could be configured for each pre -filter:
Target (Session S0, Session S1, Session S2, Se ssion S3, Select Flag)
Action
Memory bank (EPC, TID, USER)
Mask start position (in words): indicates start position from beginning of memory bank from were match
pattern is checked
Match pattern. Configured pre-filters could be retrieved from a specific active RFID reader via srfidGetPreFilters API function.
The srfidSetPreFilters API function is used to configure a new set of pre -filters. The following example demonstrates pre-filters management supported by the SDK.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* allocate object for storage of pre filters */ NSMutableArray *prefilters = [[NSMutableArray alloc] init]; /* an object for storage of error response received from RFID reader */ NSString *error_response = nil; /* retrieve pre-filters */ SRFID_RESULT result = [apiInstance srfidGetPreFilters:m_ReaderId aPreFilters:&prefilters aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* pre-filters received */
NSLog(@"Number of pre-filters: %d\n", [prefilters count]);
(continued on next page)
Page 49
ZEBRA RFID SDK for iOS 3 - 23
for (srfidPreFilter *filter in prefilters) {
NSLog(@"Match pattern: %@\n", [filter getMatchPattern]); NSLog(@"Mask start position: %d words\n", [filter getMaskStartPos]);
SRFID_SELECTACTION action = [filter getAction]; switch (action) {
case SRFID_SELECTACTION_INV_A2BB2A_NOT_INV_A OR NEG_SL_NOT_ASRT_SL:
NSLog(@"Action: INV A2BB2A NOT INV A OR NEG SL NOT ASRT SL\n"); break;
case SRFID_SELECTACTION_INV_AOR_ASRT_SL:
NSLog(@"Action: INV A OR ASRT SL\n"); break;
case SRFID_SELECTACTION_INV_A_NOT_INV_BOR_ASRT_SL_NOT_DSRT_SL:
NSLog(@"Action: INV A NOT INV B OR ASRT SL NOT DSRT SL\n"); break;
case SRFID_SELECTACTION_INV_BOR_DSRT_SL:
NSLog(@"Action: INV B OR DSRT SL\n"); break;
case SRFID_SELECTACTION_INV_B_NOT_INV_AOR_DSRT_SL_NOT_ASRT_SL:
NSLog(@"Action: INV B NOT INV A OR DSRT SL NOT ASRT SL\n"); break;
case SRFID_SELECTACTION_NOT_INV_A2BB2AOR_NOT_NEG_SL:
NSLog(@"Action: NOT INV A2BB2A OR NOT NEG SL\n"); break;
case SRFID_SELECTACTION_NOT_INV_AOR_NOT_ASRT_SL:
NSLog(@"Action: NOT INV A OR NOT ASRT SL\n"); break;
case SRFID_SELECTACTION_NOT_INV_BOR_NOT_DSRT_SL:
NSLog(@"Action: NOT INV B OR NOT DSRT SL\n");
break; } SRFID_SELECTTARGET target = [filter getTarget]; switch (target) {
case SRFID_SELECTTARGET_S0:
NSLog(@"Target: Session SO\n");
break;
case SRFID_SELECTTARGET_S1:
NSLog(@"Target: Session S1\n"); break;
case SRFID_SELECTTARGET_S2:
NSLog(@"Target: Session S2\n"); break;
case SRFID_SELECTTARGET_S3:
NSLog(@"Target: Session S3\n");
break;
case SRFID_SELECTTARGET_SL:
NSLog(@"Target: Select Flag\n");
break; }
(continued on next page)
Page 50
3 - 24 RFD8500/i RFID Developer Guide
SRFID_MEMORYBANK bank = [filter getMemoryBank]; switch (bank) {
case SRFID_MEMORYBANK_EPC:
NSLog(@"Memory Bank: EPC\n"); break;
case SRFID_MEMORYBANK_RESV:
NSLog(@"Memory Bank: RESV\n"); break;
case SRFID_MEMORYBANK_TID:
NSLog(@"Memory Bank: TID\n"); break;
case SRFID_MEMORYBANK_USER:
NSLog(@"Memory Bank: USER\n"); break;
}
}
}
else {
NSLog(@"Failed to receive pre-filters\n"); } [prefilters removeAllObjects]; /* create one pre-filter */ srfidPreFilter *filter = [[srfidPreFilter alloc] init]; [filter setMatchPattern:@"N20122014R1010364989126V"]; [filter setMaskStartPos:2]; [filter setMemoryBank:SRFID_MEMORYBANK_EPC]; [filter setAction:SRFID_SELECTACTION_INV_AOR [filter setTarget:SRFID_SELECTTARGET_SL]; [prefilters addObject:filter]; [filter release]; error_response = nil; ASRT_SL]; /* set pre-filters */
result = [apiInstance srfidSetPreFilters:m_ReaderId aPreFilters:prefilters aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* pre-filters have been set */
NSLog(@"Pre-filters has been set\n"); } else if (SRFID_RESULT_RESPONSE_ERROR == result) {
NSLog(@"Error response from RFID reader: %@\n", error_response); } else {
NSLog(@"Failed to set tag report parameters\n"); } [prefilters release];
Page 51
ZEBRA RFID SDK for iOS 3 - 25

Beeper Configuration

The SDK provides an ability to configure a beeper of a specific active RFID reader. The beeper could be configured to one of predefined volumes (low, medium, high) or be disabled. Retrieving and setting of beeper configuration is performed via srfidSetBeeperConfig and srfidGetBeeperConfig API fun ctions as demonstrated in the following example.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* object for beeper configuration */ SRFID_BEEPERCONFIG beeper_cfg; /* an object for storage of error response received from RFID reader */ NSString *error_response = nil; /* retrieve beeper configuration */ SRFID_RESULT result = [apiInstance srfidGetBeeperConfig:m_ReaderId aBeeperConfig:&beeper_cfg aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* beeper configuration received */ switch (beeper_cfg) {
case SRFID_BEEPERCONFIG_HIGH:
NSLog(@"Beeper: high volume\n"); break;
case SRFID_BEEPERCONFIG_LOW:
NSLog(@"Beeper: low volume\n"); break;
case SRFID_BEEPERCONFIG_MEDIUM:
NSLog(@"Beeper: medium volume\n"); break;
case SRFID_BEEPERCONFIG_QUIET:
NSLog(@"Beeper: disabled\n"); break;
} } else {
NSLog(@"Failed to receive beeper parameters\n");
}
error_response = nil;
/* disable beeper */ result = [apiInstance srfidSetBeeperConfig:m_ReaderId aBeeperConfig:SRFID_BEEPERCONFIG_QUIET aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
/* beeper configuration applied */
NSLog(@"Beeper configuration has been set\n"); } else if (SRFID_RESULT_RESPONSE_ERROR == result) { NSLog(@"Error response from RFID reader: %@\n", error_response); } else {
NSLog(@"Failed to set beeper configuration\n"); }
Page 52
3 - 26 RFD8500/i RFID Developer Guide

Managing Configuration

Various parameter of a specific RFID reader configured via SDK are lost after next power down. The SDK provides an ability to store and restore a persistent configuration of RFID reader. The srfidSaveReaderConfiguration API function could be used to either make current configuration persistent over power down and power up cycles or store current configuration to custom defaults area. The configuration stored to custom defaults area could be restored via srfidResto reRead erConfiguration API function. The same API function is used to restore the factory defined configuration.
The following example demonstrates utilization of mentioned API functions.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil; /* cause the RFID reader to make current configuration persistent */ SRFID_RESULT result = [apiInstance srfidSaveReaderConfiguration:m_ReaderId aSaveCustomDefaults:NO aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
NSLog(@"Current configuration became persistent\n"); } else {
NSLog(@"Request failed\n"); } /* cause the RFID reader to save current configuration in custom defaults area */ result = [apiInstance srfidSaveReaderConfiguration:m_ReaderId aSaveCustomDefaults:YES aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result) {
NSLog(@"Current configuration stored in custom defaults\n"); } else {
NSLog(@"Request failed\n"); } /* cause the RFID reader to restore configuration from custom defaults */ result = [apiInstance srfidRestoreReaderConfiguration:m_ReaderId aRestoreFactoryDefaults:NO aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS != result) { NSLog(@"Request failed\n"); }
/* cause the RFID reader to restore factory defined configuration*/ result = [apiInstance srfidRestoreReaderConfiguration:m_ReaderId aRestoreFactoryDefaults:YES aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS != result) {
NSLog(@"Request failed\n"); }
Page 53

Performing Operations

The Zebra RFID SDK for iOS API enables performing various radio operations with a specific active RFID reader.

Rapid Read

Rapid read operation is a simple inventory operation wi thout performing a read from a specific memory bank. The srfidStartRapidRead API function is used to request performing of rapid read operation. Aborting of rapid
read operation is requested via srfidStopRapidRead API function. When performing of rapid read operation is requested the actual operation will be started once conditions specified by start trigger parameters are met. The on-going operation will be stopped in accordance with configured stop trigger parameters. If repeat monitoring option is ena bled in start trigger configuration the actual operation will be started again after it has stopped once conditions of start trigger configuration are met. On starting and stoppi n g of the actual op er ation the SDK will deliver asynchronous notifications to the application if the application has subscribed for events of this type.
The SDK will deliver asynchronous notifications to inform the application about tag data received from the RFID reader during the on-going operation if the application has subscribe d for events of this type. Fields to be reported during asynchronous tag data related notification are configured via reportConfig parameter of srfidStartRapidRead API function.
ZEBRA RFID SDK for iOS 3 - 27
The following example demonstrates performing of rapid r ead operation that starts and stops immediately after requested operation performing and aborting.
/* subscribe for tag data related events */ [apiInstance srfidSubsribeForEvents:SRFID_EVENT_MASK_READ]; /* 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 m_ReaderId variable */
/* allocate object for start trigger settings */ srfidStartTriggerConfig *start_trigger_cfg = [[srfidStartTriggerConfig alloc] init]; /* allocate object for stop trigger settings */ srfidStopTriggerConfig *stop_trigger_cfg = [[srfidStopTriggerConfig alloc] init]; /* allocate object for report parameters of rapid read operation */ srfidReportConfig *report_cfg = [[srfidReportConfig alloc] init];
/* allocate object for access parameters of rapid read operation */ srfidAccessConfig *access_cfg = [[srfidAccessConfig alloc] init];
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil;
do {
/* configure start and stop triggers parameters to start and stop actual
operation immediately on a corresponding response */
[start_trigger_cfg setStartOnHandheldTrigger:NO]; [start_trigger_cfg setStartDelay:0]; [start_trigger_cfg setRepeatMonitoring:NO];
(continued on next page)
Page 54
3 - 28 RFD8500/i RFID Developer Guide
[stop_trigger_cfg setStopOnHandheldTrigger:NO];
[stop_trigger_cfg setStopOnTimeout:NO];
[stop_trigger_cfg setStopOnTagCount:NO];
[stop_trigger_cfg setStopOnInventoryCount:NO];
[stop_trigger_cfg setStopOnAccessCount:NO];
/* set start trigger parameters */
SRFID_RESULT result = [apiInstance srfidSetStartTriggerConfiguration:m_ReaderId aStartTriggeConfig:start_trigger_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* start trigger configuration applied */
NSLog(@"Start trigger configuration has been set\n"); } else {
NSLog(@"Failed to set start trigger parameters\n");
break; }
/* set stop trigger parameters */ result = [apiInstance srfidSetStopTriggerConfiguration:m_ReaderId
aStopTriggeConfig:stop_trigger_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* stop trigger configuration applied */
NSLog(@"Stop trigger configuration has been set\n"); } else {
NSLog(@"Failed to set stop trigger parameters\n"); break; }
/* start and stop triggers have been configured */ error_response = nil;
/* configure report parameters to report RSSI, Channel Index, Phase and PC fields */
[report_cfg setIncPC:YES];
[report_cfg setIncPhase:YES];
[report_cfg setIncChannelIndex:YES];
[report_cfg setIncRSSI:YES];
[report_cfg setIncTagSeenCount:NO];
[report_cfg setIncFirstSeenTime:NO];
[report_cfg setIncLastSeenTime:NO];
/* configure access parameters to perform the operation with 27.0 dbm antenna
power level without application of pre-filters */
[access_cfg setPower:270];
[access_cfg setDoSelect:NO];
/* request performing of rapid read operation */ result = [apiInstance srfidStartRapidRead:m_ReaderId aReportConfig:report_cfg
aAccessConfig:access_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
NSLog(@"Request succeed\n");
(continued on next page)
Page 55
ZEBRA RFID SDK for iOS 3 - 29
/* stop an operation after 1 minute */ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(60 *
NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[apiInstance srfidStopRapidRead:m_ReaderId aStatusMessage:nil];
}); } else if (SRFID_RESULT_RESPONSE_ERROR == result) {
NSLog(@"Error response from RFID reader: %@\n", error_response); } else {
NSLog(@ÒRequest failed\nÓ); }
} while (0); [start_trigger_cfg release]; [stop_trigger_cfg release]; [access_cfg release]; [report_cfg release]; /* EventReceiver class: partial implementation */ @implementation EventReceiver ...
- (void)srfidEventReadNotify:(int)readerID aTagData:(srfidTagData*)tagData { /* print the received tag data */ NSLog(@"Tag data received from RFID reader with ID = %d\n", readerID); NSLog(@"Tag id: %@\n", [tagData getTagId]); }
- (void)srfidEventStatusNotify:(int)readerID aEvent:(SRFID_EVENT_STATUS)event { NSLog(@"Radio operation has %@\n", ((SRFID_EVENT_STATUS_OPERATION_START == event) ? @"started" : @"stopped")); } ... @end

Inventory

Inventory is an advanced inventory operation being performed simultaneously with reading from a specific memory bank.
Inventory operation is performed similarly to the rapid read operation described above. Thus performing and aborting of the inventory operation is requested through srfidStartInventory and srfidStopInventory API functions accordingly. After request of o peration performing the actual operation will be started in accordance with the configured start trigger parameters and will be stopped once conditions specified by stop trigger parameters are met. After the operation has stopped it might be started again if it is not aborted and repeat monitoring option is enabled in start trigger configuration. The SDK informs the application about starting and stopping of the actual notification trough corresponding asynchronous notifications.
The SDK will deliver asynchronous notifications to inform the application about tag data received from the RFID reader during the on-going operation if the application has subscribed fo r events of this type. Field s to be reported during asynchronous tag data related notification are configured via reportConfig parameter of srfidStartInventory API function.
The following example demonstrates performing of a continuous inventory operation with reading from EPC memory bank that starts on a press of a physical trigger and stops on a release of a physical trigger or after a 25 second timeout.
(continued on next page)
Page 56
3 - 30 RFD8500/i RFID Developer Guide
/* subscribe for tag data related events */ [apiInstance srfidSubsribeForEvents:SRFID_EVENT_MASK_READ]; /* 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 m_ReaderId variable */
/* allocate object for start trigger settings */ srfidStartTriggerConfig *start_trigger_cfg = [[srfidStartTriggerConfig alloc] init]; /* allocate object for stop trigger settings */ srfidStopTriggerConfig *stop_trigger_cfg = [[srfidStopTriggerConfig alloc] init];
/* allocate object for report parameters of inventory operation */ srfidReportConfig *report_cfg = [[srfidReportConfig alloc] init];
/* allocate object for access parameters of inventory operation */ srfidAccessConfig *access_cfg = [[srfidAccessConfig alloc] init];
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil;
do {
/* configure start triggers parameters to start on physical trigger press */ [start_trigger_cfg setStartOnHandheldTrigger:YES]; [start_trigger_cfg setTriggerType:SRFID_TRIGGERTYPE_PRESS]; [start_trigger_cfg setStartDelay:0]; [start_trigger_cfg setRepeatMonitoring:YES]; /* configure stop triggers parameters to stop on physical trigger release or on 25 sec
timeout*/
[stop_trigger_cfg setStopOnHandheldTrigger:YES]; [stop_trigger_cfg setTriggerType:SRFID_TRIGGERTYPE_RELEASE]; [stop_trigger_cfg setStopOnTimeout:YES]; [stop_trigger_cfg setStopTimout:(25*1000)]; [stop_trigger_cfg setStopOnTagCount:NO]; [stop_trigger_cfg setStopOnInventoryCount:NO]; [stop_trigger_cfg setStopOnAccessCount:NO];
/* set start trigger parameters */
SRFID_RESULT result = [apiInstance srfidSetStartTriggerConfiguration:m_ReaderId aStartTriggeConfig:start_trigger_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* start trigger configuration applied */
NSLog(@"Start trigger configuration has been set\n"); } else {
NSLog(@"Failed to set start trigger parameters\n");
break; }
/* set stop trigger parameters */ result = [apiInstance srfidSetStopTriggerConfiguration:m_ReaderId
aStopTriggeConfig:stop_trigger_cfg aStatusMessage:&error_response];
if (SRFID_RESULT_SUCCESS == result) {
/* stop trigger configuration applied */
NSLog(@"Stop trigger configuration has been set\n"); }
(continued on next page)
Page 57
ZEBRA RFID SDK for iOS 3 - 31
else {
NSLog(@"Failed to set stop trigger parameters\n"); break;
}
/* start and stop triggers have been configured */
error_response = nil;
/* configure report parameters to report RSSI and Channel Index fields */ [report_cfg setIncPC:NO]; [report_cfg setIncPhase:NO]; [report_cfg setIncChannelIndex:YES]; [report_cfg setIncRSSI:YES]; [report_cfg setIncTagSeenCount:NO]; [report_cfg setIncFirstSeenTime:NO]; [report_cfg setIncLastSeenTime:NO];
/* configure access parameters to perform the operation with 27.0 dbm antenna power
level without application of pre-filters */
[access_cfg setPower:270]; [access_cfg setDoSelect:NO];
/* request performing of inventory operation with reading from EPC memory bank */
result = [apiInstance srfidStartInventory:m_ReaderId aMemoryBank:SRFID_MEMORYBANK_EPC aReportConfig:report_cfg aAccessConfig:access_cfg 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 srfidStopInventory:m_ReaderId aStatusMessage:nil];
}); } else if (SRFID_RESULT_RESPONSE_ERROR == result) {
NSLog(@"Error response from RFID reader: %@\n", error_response); } else {
NSLog(@"Request failed\n"); }
} while (0); [start_trigger_cfg release]; [stop_trigger_cfg release]; [access_cfg release]; [report_cfg release]; /* EventReceiver class: partial implementation */ @implementation EventReceiver ...
- (void)srfidEventStatusNotify:(int)readerID aEvent:(SRFID_EVENT_STATUS)event { NSLog(@"Radio operation has %@\n", ((SRFID_EVENT_STATUS_OPERATION_START ==
event) ? @"started" : @"stopped")); }
- (void)srfidEventReadNotify:(int)readerID aTagData:(srfidTagData*)tagData {
(continued on next page)
Page 58
3 - 32 RFD8500/i RFID Developer Guide
/* print the received tag data */ NSLog(@"Tag data received from RFID reader with ID = %d\n", readerID); NSLog(@"Tag id: %@\n", [tagData getTagId]); SRFID_MEMORYBANK bank = [tagData getMemoryBank]; if (SRFID_MEMORYBANK_NONE != bank) {
NSString *str_bank = @""; switch (bank) {
case SRFID_MEMORYBANK_EPC:
str_bank = @"EPC"; break;
case SRFID_MEMORYBANK_TID:
str_bank = @"TID"; break;
case SRFID_MEMORYBANK_USER:
str_bank = @"USER"; break;
case SRFID_MEMORYBANK_RESV:
str_bank = @"RESV";
break; } NSLog(@"%@ memory bank data: %@\n", str_bank, [tagData getMemoryBankData]);
} } ... @end

Inventory with Pre-filters

If pre-filters are configured they might be applied during performing of inventory operation. Application of pre-filters is enabled via accessConfig parameter of srfidStartInventory and srfidStartRapidRead API functions. Excepting enablement of pre-filters application in accessConfig parameter inventory with pre-filters is performed similarly to a typical inventory operation described above. The following example demonstrates enabling application of configured pre-filters during inventory operation.
/* allocate object for report parameters of inventory operation */ srfidReportConfig *report_cfg = [[srfidReportConfig alloc] init]; /* allocate object for access parameters of inventory operation */ srfidAccessConfig *access_cfg = [[srfidAccessConfig alloc] init]; /* an object for storage of error response received from RFID reader */ NSString *error_response = nil; /* configure report parameters to report RSSI field */ [report_cfg setIncPC:NO]; [report_cfg setIncPhase:NO]; [report_cfg setIncChannelIndex:NO]; [report_cfg setIncRSSI:YES]; [report_cfg setIncTagSeenCount:NO]; [report_cfg setIncFirstSeenTime:NO]; [report_cfg setIncLastSeenTime:NO];
/* configure access parameters to perform the operation with 27.0 dbm antenna power level */
[access_cfg setPower:270]; /* enable application of configured pre-filters */ [access_cfg setDoSelect:YES]; /* request performing of inventory operation with reading from EPC memory bank */ SRFID_RESULT result = [apiInstance srfidStartInventory:m_ReaderId aMemoryBank:SRFID_MEMORYBANK_EPC aReportConfig:report_cfg aAccessConfig:access_cfg aStatusMessage:&error_response];
(continued on next page)
Page 59
ZEBRA RFID SDK for iOS 3 - 33
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 srfidStopInventory:m_ReaderId aStatusMessage:nil];
}); } else if (SRFID_RESULT_RESPONSE_ERROR == result) {
NSLog(@"Error response from RFID reader: %@\n", error_response); } else {
NSLog(@"Request failed\n"); } [access_cfg release]; [report_cfg release];

Tag Locationing

The SDK provides an ability to perform tag locationing operation. T he srfidStartTagLocationing API function is used to request performing of tag locationing operation. Aborting of tag locationing operation is requested via srfidStopT agLocationing 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 subscriber 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 (in percents).
The following example demonstrates performing of tag locationing operation.
/* 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 m_ReaderId variable */
/* id of tag to be located */ NSString *tag_id = @"V6219894630101R41022102N";
/* an object for storage of error response received from RFID reader */ NSString *error_response = nil;
SRFID_RESULT result = [apiInstance srfidStartTagLocationing:m_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:m_ReaderId aStatusMessage:nil];
}); } else if (SRFID_RESULT_RESPONSE_ERROR == result) {
NSLog(@"Error response from RFID reader: %@\n", error_response); } else {
NSLog(@"Request failed\n"); }
(continued on next page)
Page 60
3 - 34 RFD8500/i RFID Developer Guide
/* EventReceiver class: partial implementation */ @implementation EventReceiver ...
- (void)srfidEventStatusNotify:(int)readerID aEvent:(SRFID_EVENT_STATUS)event { NSLog(@"Radio operation has %@\n", ((SRFID_EVENT_STATUS_OPERATION_START == event) ? @"started" : @"stopped")); }
- (void)srfidEventProximityNotify:(int)readerID aProximityPersent:(int)proximityPersent { NSLog(@"Tag proximity notification from RFID reader with ID = %d\n",
readerID);
NSLog(@"Tag proximity: %d percents\n", proximityPersent);
} ... @end
As shown in the following example, TagLocationing allows you to provide a mask to specify the contiguous bit pattern in the EPC ID that should be used to match the ta g.
NSString *statusMessage; NSString *testTagEpcId = @"111122223333444455556666"; NSString *tagMask = @"FFFFFFFF" SRFID_RESULT result = [sdkInstance srfidStartTagLocationing:m_rfidHelper.m_activeReaderI d aTagEpcId:testTagEpcId aTagEpcMask:tagMask aStatusMessage:&statusMessage];

Access Operations

The SDK supports performing of read, write, lock, kill, block erase, and block perma lock access operations on a specific tag. Access operations are performed via srfidReadTag, srfidWriteTag, srfidLockTag, srfiKillTag, srfidBlockErase, and srfidBlockPermaLock API functions accordingly . There a re two versions of each API. On e version targets the tag to access by using the Tag ID in the EPC Memory Bank, and the other targets the tag to access by filtering on criteria in other memory banks. The mentioned API functions are performed synchronously; the corresponding operation is started imme diately and is stopp ed once tag data is repor ted by RFID reader or after a 5 second timeout.
NOTE DPO (Dynamic Power Optimization) should be disabled before any access operation using the
srfidSetDpoConfiguration API.
There are also async versions of the access operation APIs. The following async versions can be used to perform access operations without the application getting blocked for completion of the same.
srfidReadTagAsync
srfidWriteTagAsync
srfidLockTagAsync
srfidKillTagAsync
srfidBlockPermaLockAsync
srfidBlockEraseAsync
Page 61
ZEBRA RFID SDK for iOS 3 - 35
The following example demonstrates performing of read and write access operations on one of the tags being inventoried.
/* identifier of one of active RFID readers is supposed to be stored in m_ReaderId variable */
/* allocate object for storing results of access operation */ srfidTagData *access_result = [[srfidTagData alloc] init]; /* id of tag to be read */ NSString *tag_id = @"36420124102N012610R98V91"; /* an object for storage of error response received from RFID reader */ NSString *error_response = nil; /* request to read 8 words from EPC memory bank of tag specified by tag _id */ SRFID_RESULT result = [apiInstance srfidReadTag:m_ReaderId aTagID:tag_id aAccessTagData:&access_result aMemoryBank:SRFID_MEMORYBANK_EPC aOffset:0 aLength:8 aPassword:0x00 aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result)
{ NSLog(@"Request succeed\n"); /* check result code of access operation */ if (NO == [access_result getOperationSucceed]) {
NSLog(@"Read operation has failed with error: %@\n", [access_result getOperationStatus]);
}
else {
NSLog(@"Memory bank data: %@", [access_result getMemoryBankData]);
} } 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 occurred\n"); } else {
NSLog(@"Request failed\n");
}
[access_result release]; access_result = [[srfidTagData alloc] init]; error_response = nil; /* data to be written */ NSString *data = @"N20122014R1010364989126V"; /* request to write a data to a EPC memory bank of tag specified by tag_id */ result = [apiInstance srfidWriteTag:m_ReaderId aTagID:tag_id aAccessTagData:&access_resul t aMemoryBank:SRFID_MEMORYBANK_EPC aOffset:0 aData:data aPassword:0x00 aDoBlockWrite:NO aStatusMessage:&error_response]; if (SRFID_RESULT_SUCCESS == result)
{ NSLog(@"Request succeed\n");
/* check result code of access operation */
if (NO == [access_result getOperationSucceed]) {
NSLog(@"Write operation has failed with error: %@\n", [access_result
getOperationStatus]);
}
}
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 occurred\n");
}
else {
NSLog(@"Request failed\n");
}
[access_result release];
Page 62
3 - 36 RFD8500/i RFID Developer Guide
Access Criteria
Access Criteria can be used with Access Operatio ns to target tag(s) by filtering on data in the specified memory bank. An srfidAccessCriteria object can be created and used with the access function APIs described in the previous section. The srfidAccessCriteria parameter identifies the tag on which the access command needs to be carried out by the SDK. The following example demonstrate s how to create a srfidAccessCriteria object and set the information for Tag Filter 1. Tag Filter 2 is not used in this example. The TID memory bank is set as the memory bank to access and the hard-coded tag seria l number 01767C20 is used as th e data pattern to filter.
// initialize access criteria srfidAccessCriteria *accessCriteria = [[srfidAccessCriteria alloc] init];
// setup tag filter 1 srfidTagFilter *tagFilter1 = [[[srfidTagFilter alloc] init] autorelease]; [tagFilter1 setFilterMaskBank:SRFID_MEMORYBANK_TID]; [tagFilter1 setFilterData:@"01767C20"]; [tagFilter1 setFilterDoMatch:YES]; [tagFilter1 setFilterMask:@"FFFFFFFF"]; [tagFilter1 setFilterMaskStartPos:2]; [tagFilter1 setFilterMatchLength:2];
// set tag filter 1 [accessCriteria setTagFilter1:tagFilter1];
The srfidAccessCriteria created above can be provided as input to any of the available Access Operation APIs.
Timeout Value
The SDK provides the srfidSetAccessCommandOperationWaitTimeout API to set the access command operation wait timeout value (in milliseconds) for a particular RFID reader. If this command is not used to set the timeout value for the reader, a default value of 5000 milliseconds is used . The timeout value set by this API applies to all access functions (srfidReadTa g, srfidWriteTag, srfidKillTag, srfidLockTag, srfidBlockErase, and srfidBlockPermaLock). The timeout value is not persistent between sessions.
The following example demonstrates how to use the API to set the access command operation wait timeout for a particular reader:
// Specify the ID of the reader. int activeReaderId = 1;
// Set the access command operation wait timeout value to 3000 milliseconds. [m_RfidSdkApi srfidSetAccessCommandOperationWaitTimeout:activeReaderId aTimeoutMs:3000];

srfidSetUniqueTagReportConfiguration

srfidUniqueTagsReport* setUniqueTag = [[srfidUniqueTagsReport alloc]init]; [setUniqueTag setUniqueTagsReportEnabled:true];
NSString *statusMessage = nil;
SRFID_RESULT result = [sdkInstance srfidSetUniqueTagReportConfiguration:readerId aUtrConfiguration:setUniqueTag aStatusMessage:&statusMessage];
if (SRFID_RESULT_SUCCESS == result) { NSLog(@"Set Unique Tag Reporting succeeded\n"); } else { NSLog(@"Request failed\n"); }
Page 63
ZEBRA RFID SDK for iOS 3 - 37

srfidGetUniqueTagReportConfiguration

srfidUniqueTagsReport* __autoreleasing getUniqueTag = [[srfidUniqueTagsReport alloc]init];
NSString *statusMessage = nil; SRFID_RESULT result = [sdkInstance srfidGetUniqueTagReportConfiguration:readerId aUtrConfiguration:&getUniqueTag aStatusMessage:&statusMessage];

srfidAuthenticate

NSString *status = [[NSString alloc]init]; SRFID_RESULT result = [sdkInstance srfidAuthenticate:readerId aAccessCriteria:nil aAccessConfig:accessConfig aPassword:1 aMsgLength:96 aMsgData:@"000096564402375796C69664" aRespLength:128 aCsi:0 aDoSendRes:true aDoIncresplen:true aStatusMessage:&status];

srfidUntraceable

srfidUntraceableConfig *untraceConfig = [[srfidUntraceableConfig alloc]init]; NSString *status = [[NSString alloc]init]; [untraceConfig setShowEpc:true]; [untraceConfig setEpcLen:2]; [untraceConfig setShowUser:false]; SRFID_RESULT result = [sdkInstance srfidUntraceable:readerId aAccessCriteria:nil aAccessConfig:nil
aPassword:01 aUntraceableConfig:untraceConfig aStatusMessage:&status];

srfidReadBuffer

NSString *status = [[NSString alloc]init];
SRFID_RESULT result = [sdkInstance srfidReadBuffer:readerId aAccessCriteria:nil aAccessConfig:nil aPassword:1 aWordPtr:0 aBitCount:16 aStatusMessage:&status];

srfidSetCryptoSuite

NSString *status = [[NSString alloc]init];
SRFID_RESULT result = [sdkInstance srfidSetCryptoSuite:readerId aAccessCriteria:nil aAccessConfig:nil aPassword:01 aKeyId:1 aIChallenge:@"96564402375796C69664" aIncCustom:true aProfile:2 aOffset:2 aBlockCount:1 aProtMode:1 aStatusMessage:&status];

srfidStopOperation

NSString *statusMessage = [[NSString alloc]init];
SRFID_RESULT result = [sdkInstance srfidStopOperation:readerId aStatusMessage:&statusMessage];
Page 64
3 - 38 RFD8500/i RFID Developer Guide
Page 65
Chapter 4 GETTING STARTED WITH THE
ZEBRA RFID MOBILE APPLICATION and RFID API3 SDK for ANDROID

Introduction

This provides step-by-step instructions to import and run Zebra RFID Mobile Application code and instructions to import the RFID API3 SDK module to build an application to work with the RFD8500.

Installing Android Studio

To install Android Studio go to http://developer.android.com/sdk/index.html and click DOWNLOAD ANDROID STUDIO 2.1.
Required packages for building source:
The project uses the following configurations.
Minimum SDK Version - v19 (Android 4.4.2 KitKat)
Target SDK Version - v19 (Android 4.4.2 KitKat)
Gradle Version - v1 (2.2.1)
Java Version - Java7
Though the latest SDK tools packaged with Android Studio are acceptable, you can use the SDK manager to download the required Android SDK packages (Menu Tools > Android > SDK Manag er).
Page 66
4 - 2 RFD8500/i RFID Developer Guide

Importing the Zebra RFID Mobile Application Project

To import the Demo Application Project:
1. Open Andr oid Studio. The following screen displays.
Figure 4-1
2. Click Import project to set language and the SDK tool path.
Android Studio Main Screen
Page 67
GETTING STARTED WITH THE ZEBRA RFID MOBILE APPLICATION and RFID API3 SDK for ANDROID 4 - 3
3. Select RFID Reader X (Demo application folder).
Figure 4-2
4. Android Studio automatically synchronizes the SDK path if required.
Figure 4-3
Project Folder
Syncing Android SDKs
Page 68
4 - 4 RFD8500/i RFID Developer Guide

Building and Running a Project

To build and run a project:
1. Android Studio may start downloading required Gra dle /SDK packages first. Define proxy information in
Android Studio and gradle.properties as required and then Android Studio starts building the project.
Figure 4-4
2. If prompted with a Language Level Changed dialog box, click Yes.
Building the Project
Figure 4-5
Language Level Changed Dialog Box
Page 69
GETTING STARTED WITH THE ZEBRA RFID MOBILE APPLICATION and RFID API3 SDK for ANDROID 4 - 5
3. After completion of a successful compilation, run the application using the run app button. Android studio
prompts for the deployment target. Install the built application on the target device by choosing a running device from the connected device list.
Figure 4-6
Choose Device
Page 70
4 - 6 RFD8500/i RFID Developer Guide
4. The screen in Figure 4-7 shows the captured image of th e de mo app lica tion r un ning on an Android device.
Figure 4-7
Demo Application
Page 71
GETTING STARTED WITH THE ZEBRA RFID MOBILE APPLICATION and RFID API3 SDK for ANDROID 4 - 7

RFID API3 Android SDK

RFID API3 SDK for Android is provided in 'aar' package format. Copy the 'RFIDAPI3Library' folder to a local path.

Creating an Android Project

To create an Android Project:
1. Select File > New > New Project to create a new Android project and follow the on screen steps in the
Android Studio New Project wizard.
Figure 4-8
Create New Project
Page 72
4 - 8 RFD8500/i RFID Developer Guide
2. Navigate to File > New > Import Module to import the RFID API3 module.
Figure 4-9
3. Browse the RFIDAPI3Library folder. (After source directory selection the module name displays as
RFIDAPI3Library.)
Import RFID API3 Module
Figure 4-10
New Module
Page 73
GETTING STARTED WITH THE ZEBRA RFID MOBILE APPLICATION and RFID API3 SDK for ANDROID 4 - 9
4. Add the module under dependencies in the application gradle file as shown in Figure 4-11.
Figure 4-11
5. Now the application is ready to import the com.zebra.rfid.api3.* package/class.
Application Gradle Modification for Module
Figure 4-12
Application MainAcitivity.java with Imported RFID API3 Package
Page 74
4 - 10 RFD8500/i RFID Developer Guide
Page 75

Chapter 5 ZEBRA RFID SDK for Android

Introduction

This chapter provides detailed information about how to u se various functionality of SDK from basic to advance to develop An droid application using the Zebra RFID SDK for Android.
The Zebra RFID SDK for Android allows applications to communicate with RFID readers that support the Zebra Easy Text interface and are connected to an Android device wirelessly via Bluetooth.
The Zebra RFID SDK for Android provides the API that can be used by external applications to manage connections of remote RFID readers, and to control connected RFID readers.

Basics

NOTE Detailed API documentation can be found in Java Class Reference Guide distributed with the Zebra RFID
SDK for Android (see Related Documents on page x.)
The Zebra RFID SDK for Android provides the ability to manage RFID readers’ connections, perform various operations with connected RFID readers, configure connected RFID readers and knowin g other information related to connected RFID readers.
Zebra RFID Android SDK con sists of a static android library in ‘a ar’ format that is supposed to b e linked with an external Android a pplication. Ste p-by-step instructions for co nfiguring the Android application project to enable utilization of Zebra RFID Android SDK are provided in Chapter 4, GETTING STARTED WITH THE ZEBRA
RFID MOBILE APPLICATION and RFID API3 SDK for ANDROID.
All available APIs are defined under the com.zebra.rfid.api 3 package. RFIDRea der is the root Java class in the SDK. The application uses a single instance of an RFIDReader object to interact with a particular reader.
Use available readers and the RFIDReader object to register for events, connect with readers, and after successful connection, perform required operations such as inventory, access and locate.
It is recommended that all API calls should be made using Android ‘AsyncTask’ so that operations are performed in the background thread keeping the UI thread free.
If the API call fails, the API throws an exception. The application should call all APIs in try-catch block for handling exceptions.
Page 76
5 - 2 RFD8500/i RFID Developer Guide

Connection Management

Connect to an RFID Reader

Connection is the first step to talk to an RFID reader . Importing package is the first step to use any API. Import the package as shown below.
import com.mot.rfid.api3.*;
The Readers class instance gives a list of all available/paired RFID readers with an Android device. Readers list is in the form of ReaderDevice class.
ArrayList<ReaderDevice> availableRFIDReaderList =
readers.GetAvailableRFIDReaderList();
ReaderDevice readerDevice = availableRFIDReaderList.get(0);
ReaderDevice class includes instance of RFIDReader class; which is root class to interface and performing all operations with RFID reader.
RFIDReader rfidReader = readerDevice.getRFIDReader();
There are two ways to connect with the reader; either using RFIDReader class instance returned by above method or instantiating RFIDReader with Bluetooth name of the RFID reader.
// Establish connection to the RFID Reader rfidReader.connect();
In addition, the application can implement Readers.RFIDReaderEventHandler in the following way to get notified for RFID reader getting BT paired (added) / unpaired (removal).
public class MainActivity extends ActionBarActivity implements
Readers.RFIDReaderEventHandler {
@Override public void RFIDReaderAppeared(ReaderDevice device) {
// handle reader addition
}
@Override public void RFIDReaderDisappeared(ReaderDevice device) {
// handle reader removal
}
}
Special Connection Handling Cases
In a normal scenario, the reader connects fine, but the following are the cases which req uire special handling at the time of connection.
The following example shows connection is handled under try-catch block and operationfailure exception is thrown by connection API is stored and used for further analysis.
private OperationFailureException ex; try { // Establish connection to the RFID Reader rfidReader.connect(); } catch (InvalidUsageException e) { e.printStackTrace(); } catch (OperationFailureException e) { e.printStackTrace(); ex = e; }
Page 77
ZEBRA RFID SDK for Android 5 - 3
Region Is Not Configured
If the region is not configured then exception gives RFID_READER_REGION_NOT_CONFIGURED result; Then caller gets supported regions and chooses operation regulatory region fr om list. Set r eg ion with r equire d
configurations.
if (ex.getResults() == RFIDResults.RFID_READER_REGION_NOT_CONFIGURED) {
// Get and Set regulatory configuration settings
// RegulatoryConfig regulatoryConfig = rfidReader.Config.getRegulatoryConfig();
// RegionInfo regionInfo = rfidReader.ReaderCapabilities.SupportedRegions.getRegionInfo(1);
// regulatoryConfig.setRegion(regionInfo.getRegionCode());
// rfidReader.Config.setRegulatoryConfig(regulatoryConfig);
}
Reader Requires BT Password
If the Bluetooth connection password is configured for connection, direct call to connection results exception pointing that BT password is required.
Set password in RFIDReader instance and then call connect again.
if (ex.getResults() == RFIDResults.RFID_CONNECTION_PASSWORD_ERROR) { // get password showPasswordDialog(); rfidReader.setPassword(password); rfidReader.connect(); }
Reader Is Running In Batch Mode
If the reader is configured for auto or batch mode is enabled then reader keeps performing the inventory operation even it is not connected to Android device.
At that time, if connection is made to the particular RFID reader, then connection API throws the following exception, then application should stop the operation as required by usage
if (ex.getResults() == RFIDResults.RFID_BATCHMODE_IN_PROGRESS) { // handle batch mode related stuff }
NOTE As the batch operation runs on the reader, reader related information cannot be retrieved by SDK
autonomously. It is the application responsibility to retrieve/update reader related information using the following API
once the BATCH operation is stopped before any other use.
rfidReader.PostConnectReaderUpdate();
Page 78
5 - 4 RFD8500/i RFID Developer Guide

Disconnect

When the application is done with the connection and with the operations on the RFID reader, it calls following API to close the connection and to release and clean up the resources.
// Disconnects reader and performs clean-up rfidReader.disconnect();

Reconnect

In case of abrupt disconnection from the reader side mainly because Bluetooth connectivity is challenged in out of range scenarios, the application can use the following API to reconnect with reader.
The application can try retries by periodically calling the reconnect API for finite number of times.
rfidReader.reconnect();
NOTE In case of reconnection with the reader, it is advisable to retrieve the configuration again, and registration
of events, etc. It is also possible that the reader may have gone to batch mode if the reader was configured for same.

Knowing the Reader Capabilities

The capabilities (or Read-Only properties) of the reader can be known using the ReaderCapabilites class. The reader capabilities include the following:

General Capabilities

Firmware Version - property.
Model Name.
Number of antennas supported.
Tag Event Reporting Supported - Indicates the reader’s ability to report tag visibility state changes (New Tag, Tag Invisible, or Tag Visibility Changed).
RSSI Filter Supported - Indicates the reader’s ability to report tags based on the signal strength of the back-scattered signal from the tag.
NXP Commands Supported - Indicates whether the reader supports NXP commands like Change EAS,set Quiet, Reset Quiet,Calibrate.
Tag LocationingSupported - Indicates the reader’s ability to locate a tag.
DutyCycleValues - List of DutyCycle percentages supported by the reader.

Gen2 Capabilities

Block Erase - supported
Block Write - supported
State Aware Singulation - supported
Maximum Number of Operation in Access Sequence
Maximum Pre-filters allowable per antenna
RF Modes.
Page 79
ZEBRA RFID SDK for Android 5 - 5

Regulatory Capabilities

Country Code
Communication Standard

UHF Band Capabilities

Transmit Power table.
Hopping enabled.
Frequency Hop table (If hopping is enabled, this table has the frequency information.).
Fixed Frequency table (If hopping is not enabled, this table contains the frequency list used by the
reader. The one-based position of a frequency in this list is its channel index.).

Reader Identification

Reader ID and Reader ID Type (the reader identification can be MAC or EPC).
// Get Reader capabilities System.out.println("\nReader ID: " + reader.ReaderCapabilities.ReaderID.getID()); System.out.println("\nModelName: " + reader.ReaderCapabilities.getModelName()); System.out.println("\nCommunication Standard: " + reader.ReaderCapabilities.getCommunicationStandard().toString()); System.out.println("\nCountry Code: " + reader.ReaderCapabilities.getCountryCode()); System.out.println("\nFirwareVersion: " + reader.ReaderCapabilities.getFirwareVersion()); System.out.println("\nRSSI Filter: " + reader.ReaderCapabilities.isRSSIFilterSupported()); System.out.println("\nTag Event Reporting: " + reader.ReaderCapabilities.isTagEventReportingSupported()); System.out.println("\nTag Locating Reporting: " + reader.ReaderCapabilities.isTagLocationingSupported()); System.out.println("\nNXP Command Support: " + reader.ReaderCapabilities.isNXPCommandSupported()); System.out.println("\nBlockEraseSupport: " + reader.ReaderCapabilities.isBlockEraseSupported()); System.out.println("\nBlockWriteSupport: " + reader.ReaderCapabilities.isBlockWriteSupported()); System.out.println("\nBlockPermalockSupport: " + reader.ReaderCapabilities.isBlockPermalockSupported()); System.out.println("\nRecommisionSupport: " + reader.ReaderCapabilities.isRecommisionSupported()); System.out.println("\nWriteWMISupport: " + reader.ReaderCapabilities.isWriteUMISupported()); System.out.println("\nRadioPowerControlSupport: " + reader.ReaderCapabilities.isRadioPowerControlSupported()); System.out.println("\nHoppingEnabled: " + reader.ReaderCapabilities.isHoppingEnabled()); System.out.println("\nStateAwareSingulationCapable: " + reader.ReaderCapabilities.isTagInventoryStateAwareSingulationSupported()); System.out.println("\nUTCClockCapable: " + reader.ReaderCapabilities.isUTCClockSupported()); System.out.println("\nNumOperationsInAccessSequence: " + reader.ReaderCapabilities.getMaxNumOperationsInAccessSequence()); System.out.println("\nNumPreFilters: " + reader.ReaderCapabilities.getMaxNumPreFilters()); System.out.println("\nNumAntennaSupported: " + reader.ReaderCapabilities.getNumAntennaSupported()); System.out.println("\nNumGPIPorts: " + reader.ReaderCapabilities.getNumGPIPorts()); System.out.println("\nNumGPIPorts: " + reader.ReaderCapabilities.getNumGPOPorts());
Page 80
5 - 6 RFD8500/i RFID Developer Guide

Configuring the Reader

RF Mode

The reader has one or more sets of C1G2 RF Mode th at the re ader is capab le of ope ratin g. The sup ported RF mode can be retrieved from the RF Mode table using the ReaderCapabilities class.
The API getRFModeTableInfo in reader capabilities.RFModes gets the RF Mode table from the reader. The
getLinkedProfiles function described below populates the RFModeTable into an ArrayList.
// The rfModeTable is populated by the getRFModeTableInfo function
public RFModeTable rfModeTable = reader.ReaderCapabilities.RFModes.getRFModeTableInfo(0);
// The linked profiles are added to an Arraylist
private void getLinkedProfiles(ArrayList<String> linkedProfiles) {
RFModeTableEntry rfModeTableEntry = null;
for (int i = 0; i < rfModeTable.length(); i++) {
rfModeTableEntry = rfModeTable.getRFModeTableEntryInfo(i);
linkedProfiles.add(rfModeTableEntry.getBdrValue() + " " + rfModeTableEntry.getModulation() + " " + rfModeTableEntry.getPieValue() + " " +
fModeTableEntry.getMaxTariValue() + " " + rfModeTableEntry.getMaxTariValue() + " " + rfModeTableEntry.getStepTariValue());
} }

Antenna Specific Configuration

The config class contains the Anten nas object. The individual antenna can be accessed and configured using the index.
Antenna Configuration
The Antenna Properties is used to set the antenna configuration to individual antenna or all the antennas. The antenna configuration (SetAntennaConfig function) is comprised of Antenna ID, Receive Sensitivity
Index, Transmit Power Index, and Transmit Frequency Index. These indexes are refers to the Receive Sensitivity table, Transmit Power table, Frequency Hop table, or Fixed Frequency table, respectively. These tables are available in Reader capabilities. getAntennaConfig function gets the antenna configuration for the given antenna ID.
Page 81
ZEBRA RFID SDK for Android 5 - 7
RF Configuration
The function setAntennaRfConfig is added to configure antenna RF configuration to individual antenna. This function is similar to setAntennaConfig but includes additional parameters specific pertaining to antenna.
The configuration includes Receive Sensitivity Index, Tr ansmit Pow er Index, Transmit Frequency Index, and RF Mode Table Index. These indexes are refers to the Receive Sensitivity table, Transmit Power table, Frequency Hop table, Fixed Frequency table, or RF Mode table, respectively. These tables are available in Reader capabilities. Also, includes tari, transmit port, receive port and Antenna Stop trigger condition. The stop condition can be ‘n’ number of attempts, duration based. The function getAntennaRfConfig gets the antenna RF configuration for the given antenna ID.
Antennas.AntennaRfConfig antennaRfConfig = reader.Config.Antennas.getAntennaRfConfig(1);
antennaRfConfig.setrfModeTableIndex(4);
antennaRfConfig.setTari(270);
antennaRfConfig.setTransmitPowerIndex(7);
reader.Config.Antennas.setAntennaRfConfig(1,antennaRfConfig);
Singulation Control
The function getSingulationControl retrieves the current settings of the singulation control from the reader for the given Antenna ID.
To set the singulation control settings, the setSingulationControl method is used. The following settings can be configured:
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.
Tag Transit Time: An estimate of the time a tag typically remains in the RF field.
State Aware Singulation Action: The action includes the Inventory state and SL flag. The action can be
used if only the reader supports this capability. The ReaderCapabilities class helps to determine whether
state-aware singulation is supported or not.
// Get Singulation Control for the antenna 1
Antennas.SingulationControl singulationControl;
singulationControl = reader.Config.Antennas.getSingulationControl(1);
// Set Singulation Control for the antenna 1
Antennas.SingulationControl singulationControl;
singulationControl.setSession(SESSION.SESSION_S0);
singulationControl.setTagPopulation((short) 30);
singulationControl.Action.setSLFlag(SL_FLAG.SL_ALL);
singulationControl.Action.setInventoryState(INVENTORY_STATE.INVENTORY_STATE_A);
reader.Config.Antennas.setSingulationControl(1, singulationControl);
Page 82
5 - 8 RFD8500/i RFID Developer Guide

Tag Report Configuration

The SDK provides an ability to configure a set of fields to be reported in a response to an operation by a specific active RFID reader.
Supported fields that might be reported include the following:
First seen time
Last seen time
PC value
RSSI value
Phase value
Channel index
Tag seen count .
The function getTagStorageSettings retrieves the tag report parameters from the reader for the given Antenna ID.
To set the Tag report parameters, the setTagStorageSettings method is used. The following settings can be configured:
// Get tag storage settings from the reader TagStorageSettings tagStorageSettings = reader.Config.getTagStorageSettings();
// set tag storage settings on the reader with all fields tagStorageSettings.setTagFields(TAG_FIELD.ALL_TAG_FIELDS); reader.Config.setTagStorageSettings(tagStorageSettings);

Regulatory Configuration

The SDK supports managing of regulatory related parameters of a specific active RFID reader. Regulatory configuration includes the following:
Code of selected region.
Hopping.
Set of enabled channels.
A set of enabled channe ls includes only such channels that are supported in the selected region. If hopping configuration is not allowed for the selected regions, a set of enabled channels is not specified.
Regulatory parameters could be retrie ve d an d se t via getRegulatoryConfig and
setRegulatoryConfig API functions accordingly. The region information is retrieved using getRegionInfo API. The following example demonstrates retrieving of current regulatory settings and
configuring the RFID reader to operate in one of supported regions.
// Get and Set regulatory configuration settings RegulatoryConfig regulatoryConfig = reader.Config.getRegulatoryConfig(); RegionInfo regionInfo = reader.ReaderCapabilities.SupportedRegions.getRegionInfo(1); regulatoryConfig.setRegion(regionInfo.getRegionCode()); regulatoryConfig.setIsHoppingOn(regionInfo.isHoppingConfigurable()); regulatoryConfig.setEnabledChannels(regionInfo.getSupportedChannels()); reader.Config.setRegulatoryConfig(regulatoryConfig);
Page 83
ZEBRA RFID SDK for Android 5 - 9

Beeper Configuration

The SDK provides an ability to configure a beeper of a specific active RFID reader. The beeper could be configured to one of predefined volumes (low, medium, high) or be disabled. Retrieving and setting of beeper configuration is performed via getBeeperVolume and setBeeperVolume API functions as demonstrated in the following example.
// get Beeper volume settings
BEEPER_VOLUME beeperVolume = reader.Config.getBeeperVolume();
// Set Beeper volume settings
reader.Config.setBeeperVolume(BEEPER_VOLUME.HIGH_BEEP);

Dynamic Power Management Configuration

The SDK provides a way to configure the reader to operate in dynamic power mode . The dynamic power state can be switched to be either on or off.
// set Dynamic power state on
reader.Config.setDPOState(DYNAMIC_POWER_OPTIMIZATION.ENABLE);
// set Dynamic power state off
reader.Config.setDPOState(DYNAMIC_POWER_OPTIMIZATION.DISABLE);

Saving Configuration

V arious parameters of a specific RFID reader configured via SDK are lost after the next power down. The SDK provides an ability to save a persistent configuration of RFID reader. The saveConfig API function can be used to make the current configuration persistent over power down and power up cycles. The following example demonstrates utilization of mentioned API functions.
// Saving the configuration
reader.Config.saveConfig();
Page 84
5 - 10 RFD8500/i RFID Developer Guide

Managing Events

The Application can register for one or more events so as to be notified of the same when it occurs. There are basically two main events.
eventReadNotify: Notifies whenever read tag event occurs with read tag data as argument. By default, the event comes with tag data. If not required, we can disable using function setAttachTagDataWithReadEvent.
eventStatusNotify: Notifies whenever status event occurs with status event data as argument.
Table 5-1
GPI_EVENT Not supported in Android RFID SDK. BUFFER_FULL_WARNING_EVENT When the internal buffers are 90% full, this event is signaled. ANTENNA_EVENT Not supported in Android RFID SDK. INVENTORY_START_EVENT Inventory Operation started. In case of periodic trigger, this event
INVENTORY_STOP_EVENT Inventory Operation has stopped. In case of periodic trigger this
ACCESS_START_EVENT Not supported in Android RFID SDK. ACCESS_STOP_EVENT Not supported in Android RFID SDK. DISCONNECTION_EVENT Event notifying disconnection from the Reader. The Application
BUFFER_FULL_EVENT When the internal buffers are 100% full, this event is sig naled and
NXP_EAS_ALARM_EVENT Not Supported in Android RFID SDK. READER_EXCEPTION_EVENT Event notifying that an exception has occurred in the Reader.
HANDHELD_TRIGGER_EVENT A hand-held Gun/Button event Pull/Release has occurred. TEMPERATURE_ALARM_EVENT When Temperature reaches Threshold level, this event is
BATTERY_EVENT Events notifying different levels of battery, state of the battery, if
OPERATION_END_SUMMARY_EVENT Event generated when operation end summary has been
BATCH_MODE_EVENT The batch mode event notification when the reader indicates
POWER_EVENT Events which notify the different power states of the reader device.
Events
Event Description
is triggered for each period.
event is triggered for each period.
can call reconnect method periodically to attempt reconnection or call disconnect method to cleanup and exit.
tags are discarded in FIFO manner.
When this event is signaled, StatusEventData.ReaderExceptionEventData.ReaderExceptionEv entType can be called to know the reason for the exception which is coming as part of Events.StatusEventArgs. The Application can continue to use the connection if the reader renders is usable.
generated. The event data contains source name (PA/Ambient), current Temperature and alarm Level (Low, High or Critical)
charging or discharging.
generated. The data associated with the event contains total rounds, total number of tags and total time in micro secs.
whether batch mode is in progress.
The event data contains cause, voltage, current and power.
(continued on next page)
Page 85
ZEBRA RFID SDK for Android 5 - 11
// registering for read tag data notification
EventHandler eventHandler = new EventHandler(); reader.Events.addEventsListener(eventHandler);
// Subscribe required status notification myReader.Events.setInventoryStartEvent(true); myReader.Events.setInventoryStopEvent(true); // enables tag read notification. if this is set to false, no tag read notification is send myReader.Events.setTagReadEvent(true); myReader.Events.setReaderDisconnectEvent(true); myReader.Events.setBatteryEvent(true); myReader.Events.setBatchModeEvent(true);
// Read/Status Notify handler
// Implement the RfidEventsLister class to receive event notifications class EventHandler implements RfidEventsListener { // Read Event Notification public void eventReadNotify(RfidReadEvents e){ // Recommended to use new method getReadTagsEx for better performance in case of large tag population TagData[] myTags = myReader.Actions.getReadTags(100); if (myTags != null) { for (int index = 0; index < myTags.length; index++) { System.out.println("Tag ID " + myTags[index].getTagID());
if (myTags[index].getOpCode() == ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ && myTags[index].getOpStatus() == ACCESS_OPERATION_STATUS.ACCESS_SUCCESS) { if (myTags[index].getMemoryBankData().length() > 0) { System.out.println(" Mem Bank Data " + myTags[index].getMemoryBankData()); } } } } } // Status Event Notification public void eventStatusNotify(RfidStatusEvents e) { System.out.println("Status Notification: " + e.StatusEventData.getStatusEventType()); } } // Unregistering for read tag data notification
reader.Events.removeEventsListener(eventHandler);
Page 86
5 - 12 RFD8500/i RFID Developer Guide

Device Status Related Events

Device status, like battery, power, and temperature, is obtained through events after initiating the following API
reader.Config.getDeviceStatus(battery, power, temperature)
Response to the above API comes as battery event, power event, and temperature event according to the set boolean value in the respective parameters.
The following is an example of how to get these events.
try { if (reader != null) reader.Config.getDeviceStatus(true, false, false); else stopTimer(); } catch (InvalidUsageException e) { e.printStackTrace(); } catch (OperationFailureException e) { e.printStackTrace(); }

Basic Operations

Tag Storage Settings

This section covers the basic/simple operations that an application would need to be performed on an RFID reader which includes inventory and single tag access operations.
The application needs to get the tags from the dll which are reported by the reader. Tags can be reported as part of an Inventory operation (reader.Actions.Inventory.perform) or a Read Access operation (reader.Actions.TagAccess.readEvent or reader.Actions.TagAccess.readWait).
Applications can also configure to receive ta g re po rt s tha t ind ica te th e re su lts of ac ce ss op er at ion s as shown below.
TagStorageSettings tagStorageSettings = reader.Config.getTagStorageSettings(); tagStorageSettings.enableAccessReports ( true); reader.Config.setTagStorageSettings(tagStorageSettings);
Each tag has a set of associated information along with it. During the Inventory operation the reader reports the EPC-ID of the tag where as during the Read-Access operation the requested Memory Bank Data is also reported apart from EPC-ID. In either case, there is additional information like PC-bits, RSSI, last time seen, tag seen count, etc. that is available for each tag. This information is reported to the application as TagData for each tag reported by the reader.
Applications can also choose to enable/disable reporting certain fields in TAG_DATA. Disabling certain fields can sometimes improve the performance as the reader and the dll are not processing that information. It can also result in specific behavior. For example, disabling reporting an Antenna Id can result in the application receiving a single unique tag even though they were multiple entries of the same tag reported from different antennas. The following snippet shows enabling the reporting of PeakRSSI, Tag Seen Count, PC and CRC only and disabling other fields like Antenna ID, Time Stamps, and XPC.
(continued on next page)
Page 87
ZEBRA RFID SDK for Android 5 - 13
TagStorageSettings tagStorageSettings = reader.Config.getTagStorageSettings(); TAG_FIELD[] tagField = new TAG_FIELD[4]; tagField[0] = TAG_FIELD.PC; tagField[1] = TAG_FIELD.PEAK_RSSI; tagField[2] = TAG_FIELD.TAG_SEEN_COUNT; tagField[3] = TAG_FIELD.CRC; tagStorageSettings.setTagFields(tagField); reader.Config.setTagStorageSettings(tagStorageSettings);
Following are a few use-cases that get tags from the reader.
Simple Inventory (Continuous)
A Simple Continuous Inventory operation reads all tags in the field of view of all antennas of the connected RFID reader. It uses no filters (pre-filters or post-filters) and the start and stop trigger for the inventory is the default (i.e., start immediately when reader.Actions.Inventory.perform is called, and stop immediately when reader.Actions.Inventory.stop is called).
// perform simple inventory
reader.Actions.Inventory.perform();
// Keep getting tags in the eventReadNotify event if registered
// stop the inventory
reader.Actions.Inventory.stop();
Simple Access Operations - On Single Tag
Tag Access operations can be performed on a specific tag or can be ap plie d on tags that ma tch a specific Access-Filter. If no Access-Filter is specified the Access Operation is performed on all tags in the field of view of chosen antennas.
This section covers the Simple Tag Access operation on a specific tag which c ould be in the fie ld of view of any of the antennas of the connected RFID read er.
// dpo should be disabled before any access operation
reader.Config.setDPOState(DYNAMIC_POWER_OPTIMIZATION.DISABLE);
Read
The application can call method reader.Actions.TagAccess.readWait to read data from a specific memory bank.
// Read user memory bank for the given tag ID
String tagId = "1234ABCD00000000000025B1"; TagAccess tagAccess = new TagAccess(); TagAccess.ReadAccessParams readAccessParams = tagAccess.new ReadAccessParams(); TagData readAccessTag; readAccessParams.setAccessPassword(0); readAccessParams.setByteCount(8); readAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER); readAccessParams.setByteOffset(0); readAccessTag = reader.Actions.TagAccess.readWait(tagId, readAccessParams, null); System.out.println(readAccessTag.getMemoryBank().toString() + " : " + readAccessTag.getMemoryBankData());
Page 88
5 - 14 RFD8500/i RFID Developer Guide
Write, Block-Write
The application can call method reader.Actions.TagAccess.writeWait or reader.Actions.TagAccess.blockWriteWait to write data to a specific memory bank. The response is returned as a Tagdata from where number of words can be retrieved.
// Write user memory bank data
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.WriteAccessParams writeAccessParams = tagAccess.new WriteAccessParams();
byte[] writeData = new byte[] {0x11, 0x22, 0x33, 0x44};
writeAccessParams.setAccessPassword(0);
writeAccessParams.setWriteDataLength(writeData.Length);
writeAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);
writeAccessParams.setByteOffset(0);
writeAccessParams.setWriteData(writeData);
// antenna Info is null – performs on all antenna
TagData tagData = reader.Actions.TagAccess.writeWait(tagId, writeAccessParams, null);
Lock
The application can call method reader.Actions.TagAccess.lockWait to perform a lock operation on one or more memory banks with specific privileges.
// Lock the tag
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.LockAccessParams lockAccessParams = tagAccess.new LockAccessParams();
/* lock now */
lockAccessParams.setLockPrivilege(LOCK_DATA_FIELD.LOCK_USER_MEMORY, LOCK_PRIVILEGE.LOCK_PRIVILEGE_READ_WRITE);
lockAccessParams.setAccessPassword(0);
reader.Actions.TagAccess.lockWait(tagId, lockAccessParams, null);
Page 89
ZEBRA RFID SDK for Android 5 - 15
Kill
The application can call method reader.Actions.TagAccess.killWait to kill a tag.
// Kill the tag
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.KillAccessParams killAccessParams = tagAccess.new KillAccessParams();
killAccessParams.setKillPassword(0);
reader.Actions.TagAccess.killWait(tagId, killAccessParams, null);
Block-Erase
The application can call RFID_BlockErase to erase the contents of a tag.
// Block Erase
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.BlockEraseAccessParams blockEraseAccessParams = tagAccess.new BlockEraseAccessParams();
blockEraseAccessParams.setAccessPassword(0);
blockEraseAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER); // user memory bank
blockEraseAccessParams.setByteOffset(0); // start erasing from offset 0
blockEraseAccessParams.setByteCount(16); // number of bytes to erase
reader.Actions.TagAccess.blockEraseWait(tagId, blockEraseAccessParams, null);
Block-Permalock
The application can call method Reader.Actions.TagAccess.blockPermalockWait to block a permalock tag. Tags reported as part of Block-Permalock access operation have TagData.getOpCode as ACCESS_OPERATION_BLOCK_PERMALOCK and TagData.getOpStatus indicating the result of the operation; if TagData.OpStatus is ACCESS_SUCCESS, TagData.getMemoryBankData contains the Block-Permalock Mask Data.
// Block-Perma Lock the tag
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.BlockPermalockAccessParams blockPermalockAccessParams = tagAccess.new BlockPermalockAccessParams();
byte[] permalockMask = new byte[] {(byte)0xF0, 0x00};
(continued on next page)
Page 90
5 - 16 RFD8500/i RFID Developer Guide
blockPermalockAccessParams.setReadLock(true);
blockPermalockAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);
blockPermalockAccessParams.setByteOffset(0);
blockPermalockAccessParams.setByteCount(1);
blockPermalockAccessParams.setMask(permalockMask);
blockPermalockAccessParams.setMaskLength(2);
reader.Actions.TagAccess.blockPermalockWait(tagId, blockPermalockAccessParams, null);
Access Operations on Specific Memory Field of Single Tag
The following functions assist in writing to specific memory fields of a specific tag:
1. writeTagIDWait - This method writes to TagID of tag(s) and adjusts the PC bits according to the length
of the TagID. When the TagID is modified, this API ensures that the tag subsequently backscatters the modified EPC, for which it also writes the length of the new or updated (PC + EPC) into the first 5 bits of the tag’s PC.
2. writeKillPasswordWait - This method writes the kill password of the tag(s).
3. writeAccessPasswordWait - This method writes the access password of the tag(s).

Advanced Operations

Using Pre-Filters

Pre-filters are the same as the Select command of C1G2 specification. Once applied, pre-filters are applied prior to Inventory and Access operations.

Introduction

Singulation
Singulation refers to the method of identifying an individual Tag in a multiple-Tag environment. RFID readers could support State-Aware or State-Unaware pre-filtering (or singulation) which is indicated by the boolean flag IsTagInventoryStateAwareSingulationSupported in the ReaderCapabilities class.
In order to filter tags that match a specific condition, it is necessary to use the tag-sessions and their states (setting the tags to different states based on match criteria - reader.Actions.PreFilters.add) so that while performing inventory, tags can be instructed to participate (singulation ­reader.Config.Antennas.setSingulationControl) or not participate in the inventory based on their states.
Sessions and Inventoried Flags
Tags provide four sessions (denoted S0, S1, S2, and S3) and maintain an independent inventoried flag for each session. Each of the four inventoried flags has two values, denoted A and B. These inventoried flag of each session can be set to A or B based on match criteria using method reader.Actions.PreFilters.add.
Page 91
ZEBRA RFID SDK for Android 5 - 17
Selected Flag
Tags provide a selected flag, SL, which can be asserted or deasserted based on match criteria using method reader.Actions.PreFilters.add.
State-Aware Singulation
In state-aware singulation the application can specify detailed controls for singulation: Action and Target. Action indicates whether matching Tags assert or deassert SL (Selected Flag), or set their inventorie d fla g to A
or to B. Tags conforming to the ma tc h crit er ia sp ecified using the method reader.Actions.PreFilters.Add are considered matching and the remaining are non-matching.
Target indicates whether to modify a tag’s SL flag or its inven toried flag, and in the case of inventor ied it further specifies one of four sessions.
Applying Pre-Filters
The following are the steps to use pre-filters:
Add pre-filters
Set appropriate singulation controls
Perform Inventory or Access operation
Add Pre-filters
Each RFID reader supports a maximum number of pre-filters per antenna as indicated by reader.ReaderCapabilites.getMaxNumPreFilters which can be known using the ReaderCapabilities.
The application can set pre-filters using reader.Actions.PreFilters.add and remove using reader.Actions.PreFilters.delete.
State-Aware Settings
// Add state aware pre-filter
PreFilters filters = new PreFilters();
PreFilters.PreFilter filter = filters.new PreFilter();
byte[] tagMask = new byte[] { 0x12, 0x11 };
filter.setAntennaID((short)3);// Set this filter for Antenna ID 3
filter.setTagPattern(tagMask);// Tags which starts with 0x1211
filter.setTagPatternBitCount(tagMask.length * 8);
filter.setBitOffset(32); // skip PC bits (always it should be in bit length)
filter.setMemoryBank(MEMORY_BANK.MEMORY_BANK_EPC);
(continued on next page)
Page 92
5 - 18 RFD8500/i RFID Developer Guide
filter.setFilterAction(FILTER_ACTION.FILTER_ACTION_STATE_AWARE); // use state aware singulation
filter.StateAwareAction.setTarget(TARGET.TARGET_INVENTORIED_STATE_S1); // inventoried flag of session S1 of matching tags to B
filter.StateAwareAction.setStateAwareAction(STATE_AWARE_ACTION.STATE_AWARE_ACTION_INV_B; // not to select tags that match the criteria
reader.Actions.PreFilters.add(filter);
// It is also required to set appropriate singulation control not to
// get tags with inventoried flag B for session 1
Set Appropriate Singulation Controls
Now that the pre-filters are set (i.e., tags are classified into matching or non-matching criteria), the application needs to specify which tags should participate in the inventory using reader.Config.Antennas.setSingulationControl(). Singulation Control must be specified with respect to each antenna like pre-filters.
State-Aware Singulation
// Set the singulation control
SingulationControl s1_singulationControl = reader.Config.Antennas.getSingulationControl(1);
s1_singulationControl.setSession(SESSION.SESSION_S1);
s1_singulationControl.Action.setInventoryState(INVENTORY_STATE.INVENTORY_STATE_B);
s1_singulationControl.Action.setSLFlag(SL_FLAG.SL_FLAG_DEASSERTED);
s1_singulationControl.Action.setPerformStateAwareSingulationAction(true);
reader.Config.Antennas.setSingulationControl(1, s1_singulationControl);
Perform Inventory or Access operation
Inventory or Access ope ration when pe rformed after setting pre-filter s, use the tags filt ered out of pre-filters for their operation.
Page 93
ZEBRA RFID SDK for Android 5 - 19

Using Triggers

Triggers are the conditions that should be satisfied in order to start or stop an operation (Inventory or Access Sequence). This information can be specified using TriggerInfo class. The application can also configure the Tag-Report trigger which indicates when to receive ‘n’ unique Tag-Reports from the Reader.
We have to use Config.setStartTrigger and Config.setStopTrigger APIs to set triggers on the reader.
The following are some use-cases of using TRIGGER_INFO:
Periodic Inventory: Start inventory at a specified time for a specified duration repe atedly.
TriggerInfo triggerInfo = new TriggerInfo();
// start inventory on 12th of this month and 12am and runs 200 milliseconds of every 2
seconds
triggerInfo.StartTrigger.setTriggerType(START_TRIGGER_TYPE.START_TRIGGER_TYPE_PERIODI
C);
triggerInfo.StartTrigger.Periodic.setPeriod(2000); // perform inventory for 2 seconds
// start time
SYSTEMTIME startTime = new SYSTEMTIME();
startTime.Day = 6;
startTime.Month = 8;
startTime.Year = 2011;
startTime.Hour = 9;
startTime.Minute = 20;
startTime.Second = 5;
triggerInfo.StartTrigger.Periodic.StartTime = startTime;
// stop trigger
triggerInfo.StopTrigger.setTriggerType(STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_DURATION);
triggerInfo.StopTrigger.setDurationMilliSeconds(200); // stop after 200 milliseconds
// report back all read tags after completion of one round of inventory (i.e. one
period)
triggerInfo.setTagReportTrigger(0);
Perform ‘n’ Rounds of Inventory with a timeout: Start condition could be an y; Stop condition is to perform
‘n’ rounds of inventory and then stop or stop inventory after the sp ecified timeout.
TriggerInfo triggerInfo = new TriggerInfo();
// start inventory immediate
(continued on next page)
Page 94
5 - 20 RFD8500/i RFID Developer Guide
triggerInfo.StartTrigger.setTriggerType(START_TRIGGER_TYPE.START_TRIGGER_TYPE_IMMEDIA TE);
// stop trigger
triggerInfo.StopTrigger.setTriggerType(STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_N_ATTEMPTS _WITH_TIMEOUT);
triggerInfo.StopTrigger.NumAttempts.setN((short)3); // perform 3 rounds of inventory
triggerInfo.StopTrigger.NumAttempts.setTimeout(3000); // timeout after 3 seconds
// report back all read tags after 3 rounds of inventory
triggerInfo.setTagReportTrigger(0);
Read ‘n’ tags with a timeout: Start condition could be any; Stop condition is to stop after reading ‘n’ tags or stop inventory after the specified timeout.
TriggerInfo triggerInfo = new TriggerInfo();
// start inventory immediate
triggerInfo.StartTrigger.setTriggerType(START_TRIGGER_TYPE.START_TRIGGER_TYPE_IMMEDIA TE);
// stop trigger
triggerInfo.StopTrigger.setTriggerType(STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_TAG_OBSERV ATION_WITH_TIMEOUT);
triggerInfo.StopTrigger.TagObservation.setN((short)100); // stop inventory after reading 100 tags
triggerInfo.StopTrigger.TagObservation.setTimeout(3000); // timeout after 3 seconds
// report back all read tags after getting 100 unique tags or after 3 seconds
triggerInfo.setTagReportTrigger(0);
Inventory based on hand-held trigger: Start inventory when hand-held gun/button trigger is pulled, and stop inventory when the and-held gun/button trigger is released or subject to timeout.
TriggerInfo triggerInfo = new TriggerInfo();
triggerInfo.StartTrigger.setTriggerType(START_TRIGGER_TYPE.START_TRIGGER_TYPE_HANDHEL D);
// Start Inventory when the Handheld trigger is pressed
triggerInfo.StartTrigger.Handheld.setHandheldTriggerEvent(HANDHELD_TRIGGER_EVENT_TYPE .HANDHELD_TRIGGER_PRESSED);
triggerInfo.StopTrigger.setTriggerType(STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_HANDHELD_W ITH_TIMEOUT);
// Stop Inventory when the Handheld trigger is released
triggerInfo.StopTrigger.Handheld.setHandheldTriggerEvent(HANDHELD_TRIGGER_EVENT_TYPE. HANDHELD_TRIGGER_RELEASED);
triggerInfo.StopTrigger.Handheld.setHandheldTriggerTimeout(0);
Page 95
ZEBRA RFID SDK for Android 5 - 21
Set the trigger using following APIs, pe rform inventory and other ope ration which is using above set sta rt
and stop triggers
reader.Config.setStartTrigger(triggerInfo.StartTrigger);
reader.Config.setStopTrigger(triggerInfo.StopTrigger);
reader.Actions.Inventory.perform(null, null, null);

Inventory

Inventory with Triggers
There are various situations that act as conditions (triggers) for performing inventory. See Using Triggers on
page 5-19 to configure triggers.
The following shows an example of performing one round of inventory on antennas 1 and 3.
TriggerInfo triggerInfo = new TriggerInfo();
// perform inventory on antenna 1 & 3
short[] antennaList = new short[] { 1, 3 };
AntennaInfo antennaInfo = new AntennaInfo(antennaList);
// start inventory immediate
triggerInfo.StartTrigger.setTriggerType(START_TRIGGER_TYPE.START_TRIGGER_TYPE_IMMEDIATE);
// stop trigger
triggerInfo.StopTrigger.setTriggerType(STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_N_ATTEMPTS_WITH _TIMEOUT);
triggerInfo.StopTrigger.NumAttempts.setN((short)1); // perform 1 round of inventory
triggerInfo.StopTrigger.NumAttempts.setTimeout(0); // reader default timeout
// report back all read tags after 1 round of inventory
triggerInfo.setTagReportTrigger(0);
// perform inventory
reader.Config.setStartTrigger(triggerInfo.StartTrigger); reader.Config.setStopTrigger(triggerInfo.StopTrigger);
reader.Actions.Inventory.perform(null, null, antennaInfo);
Page 96
5 - 22 RFD8500/i RFID Developer Guide

Access

Using Access-Filters
In order to perform an access operation on multiple tags, the application can set ACCESS_FILTER to filter the required tags. If ACCESS_FILTER is not specified, the operation is performed on all tags. In any case, the PRE_FILTER(s) (if any is set) applies prior to ACCESS_FILTER.
The following access-filter gets all tags that have zeroed reserved memory bank.
AccessFilter accessFilter = new AccessFilter();
byte[] tagMask = new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff };
// Tag Pattern A
accessFilter.TagPatternA.setMemoryBank(MEMORY_BANK.MEMORY_BANK_RESERVED);
accessFilter.TagPatternA.setTagPattern(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
accessFilter.TagPatternA.setTagPatternBitCount(8 * 8);
accessFilter.TagPatternA.setBitOffset(0);
accessFilter.TagPatternA.setTagMask(tagMask);
accessFilter.TagPatternA.setTagMaskBitCount(tagMask.length * 8);
accessFilter.setAccessFilterMatchPattern(FILTER_MATCH_PATTERN.A);
Access Operation on Multiple Tags
Performing a single Access operation on multiple tags is an asynchronous operation. The function issues the access-operation and returns. The reader performs one round of inventory using pre-filters, if any, and then applies the access-filters and the resultant tags are subject to the access-operation. When the access operation is complete, the Dll signals the eventStatusNotify event with event data as INVENTORY_STOP_EVENT. In case of Read access operation (reader.Actions.TagAccess.readEvent) the event eventReadNotify is signaled when tags are reported.
The following snippet shows a sample write-access operation:
// Create Event to signify access operation complete
reader.Events.setInventoryStartEvent(true);
reader.Events.setInventoryStopEvent(true);
// Data Read Notification from the reader
class EventHandler implements RfidEventsListener {
(continued on next page)
Page 97
ZEBRA RFID SDK for Android 5 - 23
// Read Event Notification
public void eventReadNotify(RfidReadEvents e){
TagData tag = e.getReadEventData().tagData;
System.out.println("Tag ID " + tag.getTagID());
if (tag.getOpCode() == ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ &&
tag.getOpStatus() == ACCESS_OPERATION_STATUS.ACCESS_SUCCESS)
{
if (tag.getMemoryBankData().length() > 0) {
System.out.println(" Mem Bank Data " + tag.getMemoryBankData());
}
}
}
// Status Event Notification
public void eventStatusNotify(RfidStatusEvents e) {
if (e.StatusEventData.getStatusEventType() == STATUS_EVENT_TYPE.INVENTORY_START_EVENT) {
// Access operation started
} else if(e.StatusEventData.getStatusEventType() == STATUS_EVENT_TYPE.INVENTORY_STOP_EVENT) { // Access operation stopped - Can be used to signal waiting thread
}
}
}
// Access Filter - EPC ID starting with 0x1122
AccessFilter accessFilter = new AccessFilter();
byte[] tagMask = new byte[] { 0xff, 0xff };
(continued on next page)
Page 98
5 - 24 RFD8500/i RFID Developer Guide
// Tag Pattern A
accessFilter.TagPatternA.setMemoryBank(MEMORY_BANK.MEMORY_BANK_EPC);
accessFilter.TagPatternA.setTagPattern(new byte[] { 0x11, 0x22});
accessFilter.TagPatternA.setTagPatternBitCount(2 * 8);
accessFilter.TagPatternA.setBitOffset(0);
accessFilter.TagPatternA.setTagMask(tagMask);
accessFilter.TagPatternA.setTagMaskBitCount(tagMask.length * 8);
accessFilter.setAccessFilterMatchPattern(FILTER_MATCH_PATTERN.A);
// Write user memory bank data
TagAccess tagAccess = new TagAccess();
TagAccess.WriteAccessParams writeAccessParams = tagAccess.new WriteAccessParams();
byte[] writeData = new byte[4] { 0xff, 0xff, 0xff, 0xff };
writeAccessParams.setAccessPassword(0);
writeAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);
writeAccessParams.setByteOffset(0);
writeAccessParams.setWriteDataLength(writeData.length);
writeAccessParams.setWriteData(writeData);
// Asynchronous write operation
reader.Actions.TagAccess.writeEvent(writeAccessParams, accessFilter, null);
// wait for access operation to complete (INVENTORY_STOP_EVENT is signaled after completin g the access operation in the eventStatusNotify)
Page 99
ZEBRA RFID SDK for Android 5 - 25

Using Access Sequence

The application can issue multiple access operations on a single go using Access-Sequence API. This is useful when each tag from a set of (access-filtered) tags is to be subject to an order of access operations.
The maximum number of access-operations that can be specified in an access sequence is available in reader.ReaderCapabilites.getMaxNumOperationsInAccessSequence of ReaderCapabilities class.
The operations are performed in the same order in which it is added to it sequence. An operation can be removed from the sequence using reader.Actions.TagAccess.OperationSequence.delete and finally de-initialized if no more needed by calling the function
reader.Actions.TagAccess.OperationSequence.deleteAll().
// add Write Access operation - Write to User memory
TagAccess tagAccess = new TagAccess();
TagAccess.Sequence opSequence = tagAccess.new Sequence(tagAccess);
TagAccess.Sequence.Operation op1 = opSequence.new Operation();
op1.setAccessOperationCode(ACCESS_OPERATION_CODE.ACCESS_OPERATION_WRITE);
op1.WriteAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);
op1.WriteAccessParams.setAccessPassword(0);
op1.WriteAccessParams.setByteOffset(0);
op1.WriteAccessParams.setWriteData(new byte[] { (byte)0x55, (byte)0x66, (byte)0x77, (byte)0x88 });
op1.WriteAccessParams.setWriteDataLength(4);
reader.Actions.TagAccess.OperationSequence.add(op1);
// add Write Access operation - Write to Reserved memory bank
TagAccess.Sequence.Operation op2 = opSequence.new Operation();
op2.setAccessOperationCode(ACCESS_OPERATION_CODE.ACCESS_OPERATION_WRITE);
op2.WriteAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);
op2.WriteAccessParams.setAccessPassword(0);
op2.WriteAccessParams.setByteOffset(0);
op2.WriteAccessParams.setWriteData(new byte[] { (byte)0xBB, (byte)0xBB, (byte)0xBB, (byte)0xBB });
op2.WriteAccessParams.setWriteDataLength(4);
reader.Actions.TagAccess.OperationSequence.add(op2);
// perform access sequence
reader.Actions.TagAccess.OperationSequence.performSequence();
// if the access operation is to be terminated without meeting stop tr igger (if specified), stopSequence method can be called
reader.Actions.TagAccess.OperationSequence.stopSequence();
Page 100
5 - 26 RFD8500/i RFID Developer Guide

Gen2v2 Operations

This section covers the Gen2V2 operations that an application would need to performed on a RFID Reader which supports Gen2v2 commands such as authenticate, untraceable, and readbuffer.

authenticate

Authenticate operation takes in the message data and message length with few of the options such as decision on including the response length, sending the response, etc.
The AuthenticateParams contain the message data, message length and other settings to be sent to the reader . The accessfilter parameter contains the tag pattern on which the operation occurs.
// authenticate
// Tag Pattern A accessFilter.TagPatternA.setMemoryBank(MEMORY_BANK.MEMORY_BANK_EPC);
accessFilter.TagPatternA.setTagPattern(new byte[]{(byte)0xe2, (byte)0xc0 });
accessFilter.TagPatternA.setTagPatternBitCount(16);
accessFilter.TagPatternA.setBitOffset(32);
accessFilter.TagPatternA.setTagMask(tagMask);
accessFilter.TagPatternA.setTagMaskBitCount(tagMask.length*8);
accessFilter.setAccessFilterMatchPattern(FILTER_MATCH_PATTERN.A);
Gen2v2 gen2V2 = new Gen2v2();
Gen2v2.AuthenticateParams AuthenticateParams = gen2V2.new AuthenticateParams();
AuthenticateParams.setMsgData("2001FD5D8048F48DD09AAD22000111");
AuthenticateParams.setMsgLen(120);
AuthenticateParams.setIncrespLen(true);
AuthenticateParams.setStoreResp(false);
AuthenticateParams.setSentResp(true);
try {
reader.Actions.gen2v2Access.authenticate(AuthenticateParams, accessFilter, null);
} catch (InvalidUsageException e) {
e.printStackTrace();
} catch (OperationFailureException e) {
e.printStackTrace(); }
)
// Keep getting response in the eventReadNotify event if registered
Loading...