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:
ChangeDateDescription
-01 Rev A10/2015Initial Release
-02 Rev A3/2016Software Maintenance Updates
-03 Rev A9/2016Updates for the standard RFD8500 (for Rev C software) and RFD8500i; changed
-04 Rev A12/2016Updates 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
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 PROJECTprovides 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
xRFD8500/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 followingconventions:
•
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 GUIDExi
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
xiiRFD8500/i RFID Developer Guide
Page 15
Chapter 1RFD8500 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 - 2RFD8500/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.
• 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 OVERVIEW1 - 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 - 4RFD8500/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 OVERVIEW1 - 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 - 6RFD8500/i RFID Developer Guide
Page 21
Chapter 2GETTING 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 - 2RFD8500/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 PROJECT2 - 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 - 4RFD8500/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 PROJECT2 - 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 - 6RFD8500/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 3ZEBRA 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 - 2RFD8500/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];
/* 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 - 4RFD8500/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]) {
-(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 - 6RFD8500/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(@"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 - 8RFD8500/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 - 10RFD8500/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) {
}
}
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)
{
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 - 12RFD8500/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
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]);
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;
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) {
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 - 20RFD8500/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(@"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 */
[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 */
/* 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:
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]);
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 - 26RFD8500/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 */
-(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]);
}
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 - 30RFD8500/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 */
/* 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 *
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 */
- (void)srfidEventProximityNotify:(int)readerID aProximityPersent:(int)proximityPersent {
NSLog(@"Tag proximity notification from RFID reader with ID = %d\n",
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 - 36RFD8500/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.
// 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];
SRFID_RESULT result = [sdkInstance srfidStopOperation:readerId
aStatusMessage:&statusMessage];
Page 64
3 - 38RFD8500/i RFID Developer Guide
Page 65
Chapter 4GETTING 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 - 2RFD8500/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 ANDROID4 - 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 - 4RFD8500/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 ANDROID4 - 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 - 6RFD8500/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 ANDROID4 - 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 - 8RFD8500/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 ANDROID4 - 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 - 10RFD8500/i RFID Developer Guide
Page 75
Chapter 5ZEBRA 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 - 2RFD8500/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.
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 Android5 - 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) {
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 - 4RFD8500/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 Android5 - 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).
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 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 Android5 - 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.
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 Android5 - 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.
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 - 10RFD8500/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_EVENTNot supported in Android RFID SDK.
BUFFER_FULL_WARNING_EVENTWhen the internal buffers are 90% full, this event is signaled.
ANTENNA_EVENTNot supported in Android RFID SDK.
INVENTORY_START_EVENTInventory Operation started. In case of periodic trigger, this event
INVENTORY_STOP_EVENTInventory Operation has stopped. In case of periodic trigger this
ACCESS_START_EVENTNot supported in Android RFID SDK.
ACCESS_STOP_EVENTNot supported in Android RFID SDK.
DISCONNECTION_EVENTEvent notifying disconnection from the Reader. The Application
BUFFER_FULL_EVENTWhen the internal buffers are 100% full, this event is sig naled and
NXP_EAS_ALARM_EVENTNot Supported in Android RFID SDK.
READER_EXCEPTION_EVENTEvent notifying that an exception has occurred in the Reader.
HANDHELD_TRIGGER_EVENTA hand-held Gun/Button event Pull/Release has occurred.
TEMPERATURE_ALARM_EVENTWhen Temperature reaches Threshold level, this event is
BATTERY_EVENTEvents notifying different levels of battery, state of the battery, if
OPERATION_END_SUMMARY_EVENTEvent generated when operation end summary has been
BATCH_MODE_EVENTThe batch mode event notification when the reader indicates
POWER_EVENTEvents which notify the different power states of the reader device.
Events
EventDescription
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 Android5 - 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 - 12RFD8500/i RFID Developer Guide
Device Status Related Events
Device status, like battery, power, and temperature, is obtained through events after initiating the following API
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.
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.
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
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.
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.
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 Android5 - 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.
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.
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 Android5 - 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
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.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.
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.
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 Android5 - 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 &&
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
// 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 Android5 - 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
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);