11.07.2015 Views

Contactless Communication API - Oracle Software Delivery Cloud

Contactless Communication API - Oracle Software Delivery Cloud

Contactless Communication API - Oracle Software Delivery Cloud

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong>JSR 257Version 1.1Java Community Process / JSR 257 Expert Group


<strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong>: JSR 257Version1.1Published2009-06-01DescriptionMaintenance ReleaseStatus: Maintenance Release / Final Release 2Released: 2009-06-01Copyright © 2003-2009 Nokia Corporation. All rights reserved.RESEARCH AND EVALUATION LICENSENOKIA CORPORATION IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE TERMS CONTAINED INTHIS LICENSE (“LICENSE”). PLEASE READ THE TERMS AND CONDITIONS OF THIS LICENSE CAREFULLY. BY ACCESSINGOR USING THE SPECIFICATION YOU WILL BE BOUND BY THE TERMS OF THIS LICENSE.JSR 257 <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> ( “Specification”)Specification Lead: Nokia Corporation (“Specification Lead”)Version: 1.1Status: Maintenance Release / Final Release 2Release: 2009-06-01Copyright 2003-2006, 2009 Nokia Corporation. All rights reserved.1. NOTICE; LIMITED LICENSE GRANTS1.1 The Specification Lead hereby grants You a non-exclusive, non-transferable, worldwide, royalty-free, fullypaid-up, limited license (without the right to sublicense) solely under intellectual property rights licensableby the Specification Lead to analyze and to use the Specification for research, evaluation, optimization anddevelopment purposes. In addition You may make a reasonable number of verbatim copies of this Specificationin its entirety for Your private or internal use, as applicable, in accordance with the terms and conditions ofthis License.1.2 No rights are granted under this License for internal deployment, the creation and/or distribution ofimplementations of the Specification for direct or indirect (including strategic) gain or advantage, themodification of the Specification (other than to the extent of Your fair use rights) or the distribution of theSpecification or making the Specification available for 3rd parties.1.3 Except as expressly set forth in this license, You acquire no right, title or interest in or to Specification orany other intellectual property licensable by the Specification Lead and no other rights are granted by implication,estoppel or otherwise. The Specification may only be used in accordance with the license terms set forth herein.This License will terminate immediately without notice from Specification Lead if You fail to comply with anyprovision of this License.2. TRADEMARKS2.1 Nokia is a registered trademark of Nokia Corporation. Nokia Corporation's product names are eithertrademarks or registered trademarks of Nokia Corporation. Your access to this Specification should not beconstrued as granting, by implication, estoppel or otherwise, any license or right to use any marks appearingin the Specification without the prior written consent of Nokia Corporation or Nokia's licensors. No right, title,or interest in or to any trademarks, service marks, or trade names of any third parties, is granted hereunder.


2.2 You shall not be allowed to remove any of the copyright statements or disclaimers or other proprietarynotices contained in the Specification and You are obliged to include the copyright statement and the disclaimers,if any, in any copies of the Specification You make.3. DISCLAIMER OF WARRANTIES3.1 SUBJECT TO ANY STATUTORY WARRANTIES OR CONDITIONS WHICH CAN NOT BE EXCLUDED, THE SPECIFICATIONIS PROVIDED “AS IS” WITHOUT WARRANTY OR CONDITION OF ANY KIND EITHER EXPRESS, IMPLIED, OR STATUTORY,INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, FITNESS FORA PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, ANDSTATUTORY ARE HEREBY DISCLAIMED. THE ENTIRE RISK ARISING OUT OF OR RELATING TO THE USE OR PERFORMANCEOF THE SPECIFICATION REMAINS WITH YOU.3.2 THE SPECIFICATION MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES AREPERIODICALLY ADDED TO THE INFORMATION THEREIN; THESE CHANGES WILL BE INCORPORATED INTO NEW VERSIONSOF THE SPECIFICATION, IF ANY. SPECIFICATION LEAD MAY MAKE IMPROVEMENTS AND/OR CHANGES TO THE PRODUCT(S)AND/OR THE PROGRAM(S) DESCRIBED IN THE SPECIFICATION AT ANY TIME. Any use of such changes in theSpecification will be governed by the then-current license for the applicable version of the Specification.4. LIMITATION OF LIABILITY4.1 TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT WILL THE SPECIFICATION LEAD OR ITS SUPPLIERS BELIABLE FOR ANY LOST PROFITS, LOST SAVINGS, LOST REVENUE, LOST DATA, PROCUREMENT OF SUBSTITUE GOODS,OR FOR ANY DIRECT, INDIRECT, INCIDENTIAL, SPECIAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, EVEN IF THESPECIFICATION LEAD OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES OR DAMAGES. INADDITION THE SPECIFICATION LEAD AND ITS SUPPLIERS WILL NOT BE LIABLE FOR ANY DAMAGES CLAIMED BY YOUBASED ON ANY THIRD PARTY CLAIM.4.2 Some jurisdictions do not allow the exclusion of implied warranties, or the limitation for consequentialdamages, so Section 4.1 may not apply to You in whole, but in such case Section 4.1 will apply to You to themaximum extent permitted by applicable law.5. EXPORT CONTROL5.1 You shall follow all export control laws and regulations relating to Specification.6. RESTRICTED RIGHTS LEGEND6.1 Note to U.S. Government Users. The Specification is a “Commercial Items”, as that term is defined at 48C.F.R. 2. 101, consisting of “Commercial Computer <strong>Software</strong>” and “Commercial Computer <strong>Software</strong>Documentation”, as such terms are used in 48 C.F.R. 12.212 or 48 C.F.R. 227.7202, as applicable. Consistent with48 C.F.R. 12.212 or 48 C.F.R. 227.7202-1 through 227.7202-4, as applicable, the Commercial Computer <strong>Software</strong>Documentation are being licensed to U.S. Government end users a) only as Commercial Items and b) with onlythose rights as are granted to all other end users pursuant to the terms and conditions herein. Unpublished-rightsreserved under the copyright laws of the United States.


Table of ContentsPreface ........................................................................................................................................... vContributors ............................................................................................................................. vComments ............................................................................................................................... vDocument conventions ............................................................................................................... v<strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> ............................................................................................................ 1Overview ................................................................................................................................. 2Introduction ............................................................................................................ 2Goals ...................................................................................................................... 2Structure of the <strong>API</strong> .................................................................................................... 2Mandatory and optional parts ...................................................................................... 2System requirements ................................................................................................. 3Version information ................................................................................................... 3Related documentation .............................................................................................................. 4Terms and abbreviations ............................................................................................................. 5<strong>API</strong> Reference ................................................................................................................................... 6I. Package javax.microedition.contactless ........................................................................................ 7<strong>Contactless</strong>Exception ................................................................................................ 10DiscoveryManager .................................................................................................... 11TagConnection ........................................................................................................ 18TargetListener ......................................................................................................... 19TargetProperties ...................................................................................................... 20TargetType ............................................................................................................. 23TransactionListener .................................................................................................. 25II. Package javax.microedition.contactless.ndef ............................................................................... 26NDEFMessage .......................................................................................................... 28NDEFRecord ............................................................................................................ 33NDEFRecordListener .................................................................................................. 37NDEFRecordType ...................................................................................................... 38NDEFTagConnection .................................................................................................. 42III. Package javax.microedition.contactless.rf .................................................................................. 44PlainTagConnection .................................................................................................. 46IV. Package javax.microedition.contactless.sc .................................................................................. 48ISO14443Connection ................................................................................................ 49V. Package javax.microedition.contactless.visual .............................................................................. 51ImageProperties ...................................................................................................... 54SymbologyManager .................................................................................................. 60VisualTagCodingException .......................................................................................... 62VisualTagConnection ................................................................................................ 63Constant field values ................................................................................................................ 65Package javax.microedition.contactless ......................................................................... 65Package javax.microedition.contactless.ndef ................................................................... 65Package javax.microedition.contactless.visual ................................................................. 65Appendix A. Security ......................................................................................................................... 66Appendix B. Launching applications with MIDP 2.x PushRegistry .................................................................. 76Appendix C. Unique identifiers of targets ............................................................................................... 78Appendix D. Future items ................................................................................................................... 79Appendix E. Examples of RFID communication ......................................................................................... 80Index ............................................................................................................................................ 83iv


PrefaceThis specification was produced by the JSR 257 Expert Group in the Java Community Process (JCP). For more information,visit the JSR 257 web page at http://www.jcp.org/en/jsr/detail?id=257 .ContributorsThe Expert Group consisted of representatives from the following companies and individuals:• BenQ Corporation• Cingular Wireless• Esmertec AG• FeliCa Networks, Inc• Gemplus Corporation• LG Electronics Inc.• Matsushita Electric Industrial Co., Ltd.• Micacchi, Gino• Motorola• NEC Corporation• Nokia Corporation• Orange France SAComments• Philips Electronics UK Ltd• Samsung Electronics Corporation• Semacode CorporationYour comments about this specification are welcome. Please send them by electronic mail to the following address:Document conventionsThe key words must, must not, required, shall, shall not, should, should not, recommended, may and optional in thisspecification are to be interpreted as described in RFC 2119 (see "Related documentation").Monospaced type is used to denote literal text, such as class names and code samples.Unicode characters are expressed in the U+NNNN notation, where NNNN denotes a 16-bit code point.v


<strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong>


OverviewIntroductionGoalsThis specification defines the <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong>, a Java ME optional package containing an applicationprogramming interface that allows applications to access information on contactless targets, such as RFID tags and barcodes.<strong>Contactless</strong> communication in this specification is based on the Radio Frequency IDentification (RFID) technology. Exceptionsto this are visual tags (bar codes) that use camera technology. RFID technology can be used to communicate with RFIDtags and external smart cards. RFID is widely used, for example, in item identification and article surveillance. Each RFIDtarget has a unique identification number that can be used to identify the tagged object. RFID readers are used to readthe data from the target and to write data to them. The communication distance is usually less than 10 centimeters. TheRFID readers use the 13.56 MHz radio frequency in the communication.Connecting to a web page by scanning an RFID or a visual tag (bar code) in the corner of a movie poster or calling to afriend by touching a RFID tag that contains the phone number are some of the use cases the <strong>Contactless</strong> <strong>Communication</strong><strong>API</strong> enables. This <strong>API</strong> provides a mechanism to discover contactless targets and communicate with them.NFC Forum specifies a data packaging format (NDEF) to exchange information between an NFC device and another NFCdevice or with a RFID tag. This <strong>API</strong> takes advantage of this data formatting by providing a connection to any physical targetthat supports the NDEF data formatting defined in the NFC Forum. Using this NDEF data format, the application developercan exchange NDEF formatted data with a target without knowing its physical type.This <strong>API</strong> allows communication with external smart cards by providing a discovery mechanism for them. The actualcommunication with the ISO14443 compliant smart cards is done using APDU commands. A device, that contains RFIDhardware, can emulate a contactless smart card to an external reader device. This feature is called card emulation mode.For example, with transportation tickets the device contains bus tickets and the external reader in the bus reads one ticketfrom the device. For these situations the <strong>API</strong> provides a notification to the application that the secure elements in thedevice have been accessed through the RFID hardware.The goal of the <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> is to provide access to the information stored on various contactless targets.The design of the <strong>API</strong> must make it easy and flexible to add new contactless targets to this framework. The <strong>API</strong> must alsoprovide information about the contactless targets supported by the implementation.Structure of the <strong>API</strong>The classes and interfaces in this specification are divided into five packages. The functionalities related to different targetsare separated into their own packages. This division makes it easier to manage the mandatory and optional parts of the<strong>API</strong>. The packages are listed below:• javax.microedition.contactless provides target discovery and classes common to all targets• javax.microedition.contactless.ndef contains classes and interfaces needed to communicate with tagsthat have NDEF formatted data• javax.microedition.contactless.rf allows communication with RFID tags that do not have NDEF formatteddata• javax.microedition.contactless.sc enables communication with external smart cards• javax.microedition.contactless.visual allows reading and generating visual tagsMandatory and optional partsThe <strong>API</strong> implementation must include all classes and interfaces defined in this specification, but some of the functionalitiesmay be left unimplemented. The <strong>API</strong> implementation selects the physical target types it supports. This selection determinesthe list of packages whose functionalities must be fully implemented. If the functionality in an optional package isimplemented, the corresponding target must be supported. If a target is not supported an exception must be thrown if2


Overviewthe application tries to use any of the methods in corresponding package. This means that if, for example, visual tag targetis not supported and the application calls SymbologyManager.getReadSymbologies() method, an exception isthrown. All targets that can be potentially accessed through this <strong>API</strong> are defined in the TargetType class. The list oftarget types supported by the <strong>API</strong> implementation can be obtained using methodDiscoveryManager.getSupportedTargetTypes().Mandatory part:• package javax.microedition.contactlessOptionally mandatory parts:• Package javax.microedition.contactless.ndef, if NDEF_TAG target is supported• Package javax.microedition.contactless.rf, if RFID_TAG target is supported• Package javax.microedition.contactless.sc, if ISO14443_CARD target is supported• Package javax.microedition.contactless.visual, if VISUAL_TAG target is supportedSystem requirementsThe minimum platform required by this <strong>API</strong> is the Connected, Limited Device Configuration (CLDC), version 1.1. The <strong>API</strong> canalso be used with Connected Device Configuration (CDC), version 1.0, and any subsequent platform versions that aresupersets of the minimum platform.Version informationApplications can determine the version of the <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> present in the device, if any, by querying thevalue of the system property microedition.contactless.version. For this version of the <strong>API</strong> the value returnedmust be the string "1.1". If the value returned is null, the <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> must not be present.3


Related documentation[CDC] Connected Device Configuration Specification, Version 1.1. Java Community Process. August, 2005.http://www.jcp.org/en/jsr/detail?id=218.[CLDC] Connected, Limited Device Configuration Specification, Version 1.1. Java Community Process. March, 2003.http://www.jcp.org/en/jsr/detail?id=139.[ISO7816-4] Identification cards - Integrated circuit cards - Part 4: Organization, security and commands for interchange.International Organization for Standardization. 2005. http://www.iso.org.[ISO7816-5] Identification cards - Integrated circuit cards - Part 5: Registration of application providers. InternationalOrganization for Standardization. 2004. http://www.iso.org.[ISO14443-4] Identification cards - <strong>Contactless</strong> integrated circuit(s) cards - Proximity cards - Part 4: Transmission protocol.International Organization for Standardization. 2001. http://www.iso.org.[14977] Information technology - Syntactic metalanguage - Extended BNF. International Organization for Standardization.1996. http://www.iso.org.[JTWI] Java Technology for the Wireless Industry, Version 1.0. Java Community Process. .http://www.jcp.org/en/jsr/detail?id=185.[Keywords] S. Bradner. Key Words for use in RFCs to Indicate Requirement Levels. RFC 2119. March, 1997.http://www.ietf.org/rfc/rfc2119.txt?number=2119.[MIDP2] Mobile Information Device Profile, version 2.1. Java Community Process. June, 2006.http://www.jcp.org/en/jsr/detail?id=118.[NDEF] NFC Data Exchange Format (NDEF), version 1.0. NFC Forum. March, 2006. http://www.nfc-forum.org/home.[NFC RTD] NFC Record Type Definition Specification, version 1.0. NFC Forum. March, 2006. http://www.nfc-forum.org/home.[RFC2046] Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types. RFC 2046. . http://www.ietf.org/rfc/rfc2046.txt.[RFC3986] Uniform Resource Identifier (URI): Generic Syntax. RFC 3986. . http://www.ietf.org/rfc/rfc3986.txt.[SATSA] Security and Trust Services <strong>API</strong>, version 1.0. Java Community Process. June, 2006.http://www.jcp.org/en/jsr/detail?id=177.4


Terms and abbreviationsAIDAPDUBNFCard emulation modeGCFInterrogation fieldMIMENDEFNDEF recordNDEF messageNFCNFC Forum formatting / NDEFformattingRFRFIDRFID tag / tagRTDSecure elementSIMTargetURIURLApplication IDentifier that identifies smart card applications uniquely. Defined in theISO 7816-5 specification.Application Protocol Data Unit is the protocol used to communicate with smart cards.Defined in the ISO 7816-4 specification.Backus-Naur FormA mode where the device is acting as a contactless smart card in the communicationwith the external reader.Generic Connection FrameworkArea surrounding the device, where RF field is activeMultipurpose Internet Mail ExtensionNFC Data Exchange FormatData that is formatted according to NFC Forum data format specification (NDEF). Onerecord consists of the record type, record identifier and of the actual data of therecord. Defined in the NFC Data Exchange Format specification.An NDEF message contains one or more NDEF records. Defined in the NFC DataExchange Format specification.Near Field <strong>Communication</strong>Target device or tag supports the handling of data formatted according to NFC Forumdata packaging specification (NDEF)Radio FrequencyRadio Frequency IDentificationAn RFID tag is a microchip combined with an antenna in a compact package. Thepackaging is structured to allow the RFID tag to be attached to an object. The tagcontains a unique serial number, but may have other information.Record Type Description. Defined in NFC Record Type Definition Specification.Tamper resistant device such as a SIM card. A secure element can not only store datasecurely but also use it in secure-sensitive operations like for example in cryptographiccomputations.Subscriber Identity ModuleAny device that supports some form of contactless communication.Uniform Resource IdentifierUniform Resource Locator5


<strong>API</strong> Reference


Package javax.microedition.contactlessProvides functionality common to all contactless targets.Interface summaryTagConnectionTargetListenerTargetPropertiesTransactionListenerClass summaryDiscoveryManagerTargetTypeException summary<strong>Contactless</strong>ExceptionThis is a marker interface for all RFID tag and smart card related connections in the<strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> .The TargetListener provides a mechanism for the application to be notified, whencontactless targets are discovered by the device hardware.This interface collects the properties that are common for all contactless targetssupported by this specification.This interface provides a notification to the application about secure element activityin card emulation mode.The DiscoveryManager class offers the mechanism to discover targets for contactlesscommunication.This class collects the contactless target types supported by the <strong>Contactless</strong><strong>Communication</strong> <strong>API</strong> .This <strong>Contactless</strong>Exception is thrown when an unsupported operation is attempted.Package DocumentationProvides functionality common to all contactless targets.Discovering contactless targets is the starting point of this <strong>API</strong>. Once a target is discovered, an application can communicatewith it. This package contains the contactless target discovery. It provides a mechanism to request notification abouttargets appearing to the proximity of the device. The following diagram gives an overview to the target discovery and tothe whole structure of the <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> . It also shows the relationships between different packages inthis <strong>API</strong>.7


Package javax.microedition.contactlessApplications can use classes and interfaces in this package to discover contactless targets. By getting an instance ofDiscoveryManager class, the application can register to receive notifications about contactless targets appearing into theproximity of the device. Based on the appearing targets, the application can use a target-specific connection defined inthe subpackages to communicate with the target. The URL needed to open the connection to the target is provided in theTargetProperties parameter in the notification. This target-specific connection can be for example ISO14443Connection, when external smart card is available. These target-specific connection objects contain methods to access and manipulatedata on the target.This <strong>API</strong> defines the basic connection interfaces to the most common targets. However the <strong>API</strong> implementation shouldprovide additional and more detailed target-specific connection interfaces to the physical targets it supports.Connections to different contactless targets are designed on top of Generic Connection Framework (GCF). Each differenttarget type defines a new protocol to the GCF. However only one of these protocols is visible in this specification and therest are left to the <strong>API</strong> implementation. The visual tag related protocol is visible and all the RFID related protocols arehidden. The reason to hide the protocols is the nature of RFID communication. It is impossible to know what kind of targetappears to the proximity of the device and therefore the URL needed to open a connection to the target is not revealedbeforehand to the application developer. Instead the URL is provided to the application in the notification about thediscovered target.An application does not have any means to control the time the target is available in the proximity of the device. It can beseveral seconds or just a touch to the target. Since the communication with the contactless targets should happen infraction of a second, applications should take this into consideration in the design phase and try to perform connectionrelated operations accordingly.The following code example illustrates how the contactless targets can be discovered. The examples later in this specificationsupplement this example.import java.io.IOException;import javax.microedition.contactless.*;import javax.microedition.contactless.ndef.*;import javax.microedition.io.Connector;8


Package javax.microedition.contactless// Example class of how to discover targets using// JSR 257 <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong>//public class CC<strong>API</strong>Example implements TargetListener {private DiscoveryManager dm;public CC<strong>API</strong>Example() {registerTargetToDiscovery();}public void registerTargetToDiscovery() {// Check that NDEF_TAG target is supportedTargetType[] targets = DiscoveryManager.getSupportedTargetTypes();boolean supported = false;for (int i=0; i


<strong>Contactless</strong>ExceptionInheritance<strong>Contactless</strong>Exception — exception class in package javax.microedition.contactlesspublic class <strong>Contactless</strong>Exception extends java.lang.ExceptionConstructor summary<strong>Contactless</strong>Exception()<strong>Contactless</strong>Exception(java.lang.String message)java.lang.Object → java.lang.Throwable → java.lang.Exception → <strong>Contactless</strong>ExceptionMethods inherited from class java.lang.ThrowablefillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause,printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitDirect known subclassesDescriptionConstructorsjavax.microedition.contactless.visual.VisualTagCodingExceptionThis <strong>Contactless</strong>Exception is thrown when an unsupported operation is attempted. Examples of such operationsinclude:• trying to invoke methods on a target that is not supported by the <strong>API</strong> implementation• trying to invoke a method that is not supported by the target• trying to use symbology that is not supported by the <strong>API</strong> implementation<strong>Contactless</strong>Exception()public <strong>Contactless</strong>Exception ()Constructs a <strong>Contactless</strong>Exception with no detail message.<strong>Contactless</strong>Exception(java.lang.String)Parameterspublic <strong>Contactless</strong>Exception (java.lang.String message)Constructs a <strong>Contactless</strong>Exception with the specified detail message.message - description of the exceptional situation10


DiscoveryManagerDiscoveryManager — class in package javax.microedition.contactlesspublic class DiscoveryManager extends java.lang.ObjectMethod summaryvoidvoidvoidstatic DiscoveryManagerjava.lang.Stringstatic TargetType[]voidvoidvoidvoidaddNDEFRecordListener(javax.microedition.contactless.ndef.NDEFRecordListener listener,javax.microedition.contactless.ndef.NDEFRecordType recordType)addTargetListener(TargetListener listener,TargetTypetargetType)addTransactionListener(TransactionListener listener)getInstance()getProperty(java.lang.String name)getSupportedTargetTypes()removeNDEFRecordListener(javax.microedition.contactless.ndef.NDEFRecordListener listener,javax.microedition.contactless.ndef.NDEFRecordType recordType)removeTargetListener(TargetListener listener,TargetTypetargetType)removeTransactionListener(TransactionListener listener)setProperty(java.lang.String name,java.lang.String value)InheritanceDescriptionjava.lang.Object → DiscoveryManagerMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitThe DiscoveryManager class offers the mechanism to discover targets for contactless communication. It is the startingpoint for the application using the <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> . This class also manages the different listeners in this<strong>API</strong>.This class also provides a method to query contactless targets supported by the <strong>API</strong> implementation. MethodgetSupportedTargetTypes returns the list of supported contactless targets. All the targets that can be accessed throughthis <strong>API</strong> are specified in the TargetType class.TargetListener is used to request a notification for a specific contactless TargetType the application is interested in.NDEFRecordListener provides a notification about specific NDEF record type that is in the read from the NFC Forum complianttag.Inside a Java virtual machine, there must be at most one TargetListener for each TargetType . The restriction forone TargetListener is needed, because the RFID hardware is able to handle only one connection to the physical targetat a time. The registration of TargetListener should fail, if there is an existing listener in other virtual machines or inthe native platform. The addTargetListener method throws an exception, if there is an existing listener defined. Theexisting listener may be a native application.11


Package javax.microedition.contactlessDiscoveryManagerThe <strong>API</strong> implementation must restrict the number of simultaneous listeners set for one NDEF record type. The reason forthe restriction may be usability or hardware restrictions. The addNDEFRecordListener method throws an exception if themaximum number of registered listeners for an NDEF record type is exceeded. On the MIDP 2.x platform the PushRegistryentry for an NDEF record type in a MIDlet that is not executing increases the number of registered listeners by one. Moreinformation about PushRegistry in the Appendix B: Launching applications with MIDP 2.x PushRegistry .An application can get information about NDEF formatted data on a NDEF tag target through both TargetListener andNDEFRecordListener . If the application wants to write data to the tag, it must register TargetListener . If theapplication is only interested in the data in specified record type on the tag, it should register NDEFRecordListenerfor that record type. The data provided in the NDEFRecordListener notification is read-only and the application hasno access to the target after receiving this notification. One application may set both of these listeners at the same time.In this case the application has to be aware that the notifications may arrive almost simultaneously and to design theapplication accordingly. Applications should not register listeners for targets or for NDEF records it is not interested in.The following diagram depicts the relationships of the two listeners that the application can register for NDEF_TAG target.Diagram also specifies the order in which the notifications must be sent.12


Package javax.microedition.contactlessDiscoveryManagerOnce the NDEF_TAG target is discovered the <strong>API</strong> implementation must read the first NDEF record on the target. After thatthe implementation checks the TargetListener set for NDEF_TAG target. If the listener is registered, theTargetListener.targetDetected notification must be sent to the registered application. If there is not a registeredTargetListener for NDEF_TAG , the implementation must check if there is a registered listener for the physical typeof the target. Each NDEF_TAG is also either RFID_TAG or ISO14443_CARD on the physical level. If the physical leveltarget has a registered TargetListener , the targetDetected notification must be sent to that application.If the target has a first NDEF record and is not empty, the <strong>API</strong> implementation must handle the NDEFRecordListenerregistrations. If an application has a PushRegistry entry for this NDEF record type, the system must start that application.13


Package javax.microedition.contactlessDiscoveryManagerMethodsIf the first NDEF record has one or more listeners registered, NDEFRecordListener.recordDetected notification must besent to the registered application.TransactionListener provides a notification about the communication between an external reader device and the secureelement on the device through the RFID hardware to the application. Support for the detection of the possible transactionsdepends on the underlying platform and of the RFID reader hardware. If the <strong>API</strong> implementation can not support thisfeature, the registration of the TransactionListener must throw an exception.The implementation of this class must maintain the information about registered listeners. When an application registersa listener of any kind, the <strong>API</strong> implementation must send this notification right away if there is a corresponding targetcurrently in the interrogation field.Even if multiple requested targets are available in the proximity of the device, only oneTargetListener.targetDetected notification is sent to the application. This notification must contain the propertiesof the new targets in the interrogation field, always properties of at least one target. The notification may contain propertiesof all the targets in the field.addNDEFRecordListener(javax.microedition.contactless.ndef.NDEFRecordListener,javax.microedition.contactless.ndef.NDEFRecordType)ParametersThrowspublic void addNDEFRecordListener(javax.microedition.contactless.ndef.NDEFRecordListenerlistener, javax.microedition.contactless.ndef.NDEFRecordType recordType) throwsjavax.microedition.contactless.<strong>Contactless</strong>ExceptionAdds NDEFRecordListener for the specified NDEF record type. Setting a listener for a NDEF record type that already has themaximum number of listeners registered, will cause an IllegalStateException to be thrown.The registration of new NDEFRecordListener must throw an IllegalStateException if the maximum numberof registered listeners is exceeded. If the registering application has a PushRegistry entry for the specified NDEF recordtype, the listener registration must be successful.listener - listener to be addedrecordType - NDEF record type the application is interested injava.lang.IllegalStateException - if NDEFRecordListener for the NDEF record has already been maximumnumber of listeners registeredjava.lang.NullPointerException - if listener or recordType is null<strong>Contactless</strong>Exception - if NDEF_TAG target is not supported by the <strong>API</strong> implementationjavax.microedition.contactless.<strong>Contactless</strong>ExceptionaddTargetListener( TargetListener , TargetType )ParametersThrowspublic void addTargetListener( TargetListener listener, TargetType targetType) throwsjavax.microedition.contactless.<strong>Contactless</strong>Exception, java.lang.IllegalStateExceptionAdds TargetListener for specified TargetType to receive a notification, when the requested type of target is available inthe proximity of the device. One TargetListener for each TargetType is allowed. Setting a listener for a target typethat already has a registered TargetListener , will cause an IllegalStateException to be thrown. The existinglistener may be a native application.listener - listener to be addedtargetType - contactless target the application is interested in<strong>Contactless</strong>Exception - if targetType is not supported by the <strong>API</strong> implementation14


Package javax.microedition.contactlessDiscoveryManagerjava.lang.IllegalStateException - if TargetListener for the targetType has already been registeredjava.lang.NullPointerException - if listener or targetType is nulljavax.microedition.contactless.<strong>Contactless</strong>ExceptionaddTransactionListener( TransactionListener )public void addTransactionListener( TransactionListenerjavax.microedition.contactless.<strong>Contactless</strong>Exceptionlistener) throwsParametersThrowsgetInstance()ReturnsThrowsAdds a TransactionListener to receive a notification of the possible transactions happening between the RFID hardwareand the secure element on the device. This transaction happens when an external reader device is accessing secure elementon the device through the RFID hardware. If this feature cannot be supported a <strong>Contactless</strong>Exception must bethrown when trying to register this listener. Multiple listeners are allowed and the notification must be sent to all of them.listener - listener to be addedjava.lang.NullPointerException - if listener is null<strong>Contactless</strong>Exception - if ISO14443_CARD target is not supported or if the <strong>API</strong> implementation can not supportthis featurejavax.microedition.contactless.<strong>Contactless</strong>Exceptionpublic static DiscoveryManager getInstance()This factory method is used to retrieve the instance of this singleton class. Permission needed to instantiate this class canbe found from Appendix A: Security .the instance of the classjava.lang.SecurityException - if the application does not have the permission to instantiate this classgetProperty(java.lang.String)ParametersReturnsThrowspublic java.lang.String getProperty(java.lang.String name)With this method the application can query the properties related to the target discovery. The property can be, for example,the speed to be used in the communication. The property name values are implementation dependant and not specifiedin the <strong>API</strong>.name - the name of the propertythe value of the property, null if the property with the specified name has not been definedjava.lang.NullPointerException - if name is nullgetSupportedTargetTypes()public staticTargetType [] getSupportedTargetTypes()15


Package javax.microedition.contactlessDiscoveryManagerReturns the list of target types supported by the <strong>API</strong> implementation. Possible target types are specified in the TargetTypeclass.Returnssupported target typesremoveNDEFRecordListener(javax.microedition.contactless.ndef.NDEFRecordListener,javax.microedition.contactless.ndef.NDEFRecordType)ParametersThrowspublic voidremoveNDEFRecordListener(javax.microedition.contactless.ndef.NDEFRecordListener listener,javax.microedition.contactless.ndef.NDEFRecordType recordType)Removes the NDEFRecordListener from the specified NDEF record type. This method should be used, when the applicationis not interested in the NDEF record type anymore. If the specified listener and record type pair is not registered, thismethod returns silently without actions.listener - listener to be removedrecordType - NDEF record typejava.lang.NullPointerException - if listener or recordType is nullremoveTargetListener( TargetListener , TargetType )ParametersThrowspublic void removeTargetListener( TargetListener listener, TargetType targetType)Removes the TargetListener from the specified TargetType . This method should be used when the application is notinterested in the target anymore. If the listener and target type pair is not registered, this method returns silently withoutactions.listener - listener to be removedtargetType - the contactless targetjava.lang.NullPointerException - if listener or targetType is nullremoveTransactionListener( TransactionListener )public void removeTransactionListener( TransactionListenerlistener)ParametersThrowsRemoves the specified TransactionListener . If the specified listener is not registered, this method returns silently withoutactions.listener - listener to be removedjava.lang.NullPointerException - if listener is nullsetProperty(java.lang.String, java.lang.String)public void setProperty(java.lang.String name, java.lang.String value)16


Package javax.microedition.contactlessDiscoveryManagerParametersThrowsAllows the application to set a property related to the target discovery. The property can be, for example, the speed to beused in the communication. The name values for these discovery-related properties are implementation dependant andnot specified in the <strong>API</strong>.name - the name of the propertyvalue - the value for the propertyjava.lang.NullPointerException - if name or value is nulljava.lang.IllegalArgumentException - if the property name is not supported by the <strong>API</strong> implementation or ifthe value of the property is invalid17


TagConnectionInheritanceTagConnection — interface in package javax.microedition.contactlesspublic interface TagConnection extends javax.microedition.io.ConnectionMethods inherited from class javax.microedition.io.ConnectioncloseAll superinterfacesjavax.microedition.io.ConnectionAll known subinterfacesDescriptionNDEFTagConnection , PlainTagConnection ,ISO14443ConnectionThis is a marker interface for all RFID tag and smart card related connections in the <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> . Eachconnection that can be used to communicate with a RFID tag or with an external smart card must extend this interface.The following class diagram depicts the relationship of the different connections in this <strong>API</strong>.18


TargetListenerTargetListener — interface in package javax.microedition.contactlesspublic interface TargetListenerMethod summaryvoidtargetDetected(TargetProperties[] properties)DescriptionMethodsThe TargetListener provides a mechanism for the application to be notified, when contactless targets are discoveredby the device hardware. This interface captures the event related to this target discovery. Applications must implementthis interface to receive the notifications.If an application has set a TargetListener through DiscoveryManager.addTargetListener(listener, targetType) method,it will receive this notification when the specified target is detected. The TargetListener provides information aboutthe whole target, where NDEFRecordListener provides notification about the data on the target and it applies only to theNDEF_TAG target.The application is responsible for any possible synchronization required in the listener methods. The listener methodsmust return quickly and should not perform any extensive processing. The method calls are intended as triggers for theapplication. The application should do all necessary extensive processing in a separate thread and only use these methodsto initiate the processing.targetDetected( TargetProperties [])Parameterspublic void targetDetected( TargetProperties [] properties)Called by the platform, when the contactless target that has a registered TargetListener is discovered by the device.The type of the target is identified in the TargetProperties parameter. This notification always contains properties of atleast one target. If there are multiple targets in the interrogation field, properties of all targets are returned.properties - properties of the detected targets19


TargetPropertiesTargetProperties — interface in package javax.microedition.contactlesspublic interface TargetPropertiesMethod summaryjava.lang.Class[]java.lang.Stringjava.lang.StringTargetType[]java.lang.Stringjava.lang.Stringjava.lang.StringbooleangetConnectionNames()getMapping()getProperty(java.lang.String name)getTargetTypes()getUid()getUrl()getUrl(java.lang.Class connectionName)hasTargetType(TargetType type)DescriptionMethodsThis interface collects the properties that are common for all contactless targets supported by this specification.The <strong>API</strong> implementation may extend this interface to store more target type and physical media type specific properties.getConnectionNames()ReturnsgetMapping()Returnspublic java.lang.Class[] getConnectionNames()Returns the names of connection interfaces that can be opened to communicate with the target as Class objects. Themarker interface TagConnection must not be returned. The <strong>API</strong> implementation must use the lowest level interface incase of inherited connections.the list of available connections to the targetpublic java.lang.String getMapping()If the target type is RFID_TAG this method returns the name of the mapping between the commands in thePlainTagConnection and the physical target structure. The returned String can be, for example, " Mifare 1K ". If theaccess to the tag is only supported through some target-specific connection interface the <strong>API</strong> implementation providesand not through the PlainTagConnection interface, this method returns null . If mapping name is provided for theRFID_TAG , the PlainTagConnection must be one of the connections returned with the methodgetConnectionNames . Mapping names ISO14443A and ISO14443B may be used to indicate protocol based mapping.For NDEF_TAG targets this method returns the name and the version of the NDEF mapping, like for example, " JewelTagv1.0" ". In both cases the mapping name is provided by the <strong>API</strong> implementation or by the physical tag manufacturer. Forother target types the method must return null .the name of the mapping, or null if target type does not have mapping20


Package javax.microedition.contactlessTargetPropertiesgetProperty(java.lang.String)ParametersReturnspublic java.lang.String getProperty(java.lang.String name)With this method the application can query target specific properties. This property can be, for example, the slot numberneeded to open a JSR 177 APDUConnection to the external smart card. In this case the name of the property could beJSR177_slot . The property name values are implementation dependant and not specified in the <strong>API</strong>.name - the name of the requested propertythe value of the property, null if the property with the specified name has not been definedgetTargetTypes()publicTargetType [] getTargetTypes()Returns the type of the discovered target. Possible return values are defined in TargetType class. An NDEF_TAG targetalways has other physical level target type. This type is either RFID_TAG or ISO14443_CARD . In the case of NDEF_TAGalso the physical level type must be returned. The NDEF_TAG target must be the first value in the return array followedby the physical level type.Returnsan array of the target typesgetUid()public java.lang.String getUid()Returns the unique identifier (UID) for the target. The identifier is likely to be globally unique, though with some devicesit may not be constant all the time. Visual tags do not have this identifier. The rules for constructing the UID for differenttarget technologies are defined in the Appendix C: Unique identifiers of targets .Returnsthe UID of the target, null if target does not support this propertygetUrl()public java.lang.String getUrl()Returns the URL to open a connection to the NDEF_TAG target. If the type of the target is not NDEF_TAG null is returned.Returnsthe URL to NDEF_TAG target, otherwise nullgetUrl(java.lang.Class)public java.lang.String getUrl(java.lang.Class connectionName)Returns the URL for the requested connection to the discovered target. This URL used to open a connection to the target.ParametersconnectionName - name of the connectionReturnsthe URL to the target21


Package javax.microedition.contactlessTargetPropertiesThrowsjava.lang.NullPointerException - if connectionName is nulljava.lang.IllegalArgumentException - if the URL for the given connectionName is not supported or allowedby the targethasTargetType( TargetType )public boolean hasTargetType( TargetTypetype)Convenience method for checking if the detected target is of specified target type.Parameterstype - the type of the targetReturnstrue if the target is of the specified type, else false22


TargetTypeTargetType — class in package javax.microedition.contactlesspublic class TargetType extends java.lang.ObjectField summarystatic TargetTypestatic TargetTypestatic TargetTypestatic TargetTypeISO14443_CARDNDEF_TAGRFID_TAGVISUAL_TAGInheritanceDescriptionFieldsISO14443_CARDNDEF_TAGRFID_TAGjava.lang.Object → TargetTypeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitThis class collects the contactless target types supported by the <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> . New target types can beadded to this class only in a new version of this specification. The application developers must take into account that thelist of target types may be extended in the future.The NFC Forum data formatting (NDEF) gives an application level categorization for the target types. Therefore eachNDEF_TAG is also categorized as either RFID_TAG or ISO14443_CARD on the physical level. Information about theconnections that can be opened to the physical target is provided in the TargetProperties.getConnectionNames() method.public static final TargetType ISO14443_CARDISO14443-4 compliant smart card accessed with APDU commands defined in ISO7816-4. <strong>Communication</strong> with this targetmay be done using ISO14443Connection .public static final TargetType NDEF_TAGA tag that contains NFC Forum formatted data. NFC Forum specifies a list of mandatory physical tags and they all must bedetected as NDEF_TAG by the implementation of this <strong>API</strong>. If the physical tag type is other than one of the mandatory tagtypes defined by the NFC Forum, and the <strong>API</strong> implementation support the NDEF formatted data for that physical tag type,it must be detected as NDEF_TAG .NDEF formatted data may be accessed with NDEFTagConnection .public static final TargetType RFID_TAGGeneral RFID tag containing data in a proprietary format. <strong>Communication</strong> with this target may be done usingPlainTagConnection or one of the possible target-specific classes provided by the <strong>API</strong> implementation.23


Package javax.microedition.contactlessTargetTypeVISUAL_TAGpublic static final TargetType VISUAL_TAGGeneral visual tag. <strong>Communication</strong> with this target may be done using VisualTagConnection .24


TransactionListenerTransactionListener — interface in package javax.microedition.contactlesspublic interface TransactionListenerField summarystatic byteUNKNOWN_SLOTMethod summaryvoidexternalReaderDetected(byte slot)DescriptionFieldsUNKNOWN_SLOTMethodsThis interface provides a notification to the application about secure element activity in card emulation mode. When anactivity has happened between the secure element on the device and an external reader device through the RFID hardware,this notification is sent to the application registered to receive it. Applications must implement this interface to receivethe notifications. Applications are not participating to these transactions.The application is responsible for any possible synchronization required in the listener methods. The listener methodsmust return quickly and should not perform any extensive processing. The method calls are intended as triggers for theapplication. The application should do all necessary extensive processing in a separate thread and only use these methodsto initiate the processing.public static final byte UNKNOWN_SLOTA constant to use when the slot number is not known.Value: -1externalReaderDetected(byte)Parameterspublic void externalReaderDetected(byte slot)Called by the platform, when a card emulation event has happened on the RFID hardware. This notification informs theapplication, that there might be changes in the data on the secure element.If the application displays for example the number of metro tickets left in the device, after receiving this notification theapplication can update the number of available tickets shown on the screen. How the number of tickets is acquired fromthe secure element is out of scope for this specification.slot - the slot needed to open the APDUConnection defined in JSR 177 to the internal secure element, may beUNKNOWN_SLOT constant defined in this interface, if the slot can not be identified25


Package javax.microedition.contactless.ndefProvides functionality to exchange NDEF formatted data with other contactless targets.Interface summaryNDEFRecordListenerNDEFTagConnectionClass summaryNDEFMessageNDEFRecordNDEFRecordTypeThe NDEFRecordListener provides a mechanism for the application to be notified,when NDEF records are discovered from the contactless targets.The NDEFTagConnection interface defines the basic functionality for exchanging NFCForum formatted data with RFID tags and contactless smart cards.This class represents an NDEF message.This class represents an NDEF record.This class encapsulates the type of an NDEF record.Package DocumentationProvides functionality to exchange NDEF formatted data with other contactless targets.The NFC Forum specifies a data packaging format to exchange information between an NFC device and another NFC deviceor a tag. The data formatting is based on NDEF records that contain type, type format, identifier and the actual data. This<strong>API</strong> takes advantage of this data formatting by providing a connection to any physical target that supports NDEF dataformatting defined by the NFC Forum. Using this data format, the application developer does not have to know the physicaltype of the target to exchange NDEF messages with it. This package provides means to generate and manipulate NDEFmessages and NDEF records.Applications can request a notification when the discovered target contains a specified NDEF record type. This is done bysetting an NDEFRecordListener with DiscoveryManager.addNDEFRecordListener method. When a target containing therequested NDEF record type is detected, a notification is sent to the registered application(s). The data from the target isprovided to the application(s) in the notification.This <strong>API</strong> supports the possibility to request application startup based on the data on the target appearing to the proximityof the device. The application startup is supported for the NDEF record types and for the secure element activity in cardemulation mode. For more information see Appendix B: Launching applications with MIDP 2.x PushRegistry .The following code example shows how to read data from an NDEF_TAG target.import java.io.IOException;import javax.microedition.contactless.*;import javax.microedition.contactless.ndef.*;import javax.microedition.io.Connector;// Example class of how to read data from NDEF_TAG target// using JSR 257 <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong>//public class CC<strong>API</strong>Example implements TargetListener {private NDEFTagConnection conn = null;public CC<strong>API</strong>Example() {registerTargetToDiscovery();}public void registerTargetToDiscovery() {// do the target discovery registration}public void targetDetected(TargetProperties[] prop) {// Select first found targetTargetProperties target = prop[0];26


Package javax.microedition.contactless.ndef}// check that target type is NDEF_TAGTargetType[] types = target.getTargetTypes();for (int i=0; i


NDEFMessageNDEFMessage — class in package javax.microedition.contactless.ndefpublic class NDEFMessage extends java.lang.ObjectConstructor summaryNDEFMessage()NDEFMessage(NDEFRecord[] records)NDEFMessage(byte[] data,int offset)Method summaryvoidintNDEFRecordNDEFRecord[]NDEFRecordNDEFRecord[]NDEFRecordType[]voidvoidvoidbyte[]appendRecord(NDEFRecord record)getNumberOfRecords()getRecord(int index)getRecord(NDEFRecordType recordType)getRecord(byte[] id)getRecords()getRecordTypes()insertRecord(int index,NDEFRecord record)removeRecord(int index)setRecord(int index,NDEFRecord record)toByteArray()InheritanceDescriptionConstructorsNDEFMessage()java.lang.Object → NDEFMessageMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitThis class represents an NDEF message. An NDEF message consists of one or more NDEF records. This class allows themanipulation of the NDEF records inside the NDEF message in the memory. It provides methods to add, remove and updateNDEF records in the message. The NFC Forum NDEF specification is used as basis for this class, but some features, for example,chunking defined in the NDEF specification are left to the <strong>API</strong> implementation. The NDEF message sent to the target mustcontain at least one NDEF record.public NDEFMessage ()28


Package javax.microedition.contactless.ndefNDEFMessageCreates an NDEF message that has no NDEF records.NDEFMessage( NDEFRecord [])ParametersThrowspublic NDEFMessage ( NDEFRecord [] records)Creates an NDEF message containing the specified NDEF records. The NDEF records are added in the order they are given.records - NDEF records to be added to the NDEF messagejava.lang.NullPointerException - if records is null or if any of the given record objects inside the recordsarray is nulljava.lang.IllegalArgumentException - if records is an empty array or payload identifiers in the NDEF recordsare not uniqueNDEFMessage(byte[], int)ParametersThrowsMethodspublic NDEFMessage (byte[] data, int offset)Creates an NDEF message from the byte array starting from the specified offset in the byte array. The offset must be avalue greater than or equal to 0 and less than the length of the byte array. The additional bytes in the array after the lastNDEFRecord are ignored.data - the byte array containing the NDEF recordsoffset - start index of the NFC Forum formatted data in the byte arrayjava.lang.NullPointerException - if data is nulljava.lang.ArrayIndexOutOfBoundsException - if offset is invalidjava.lang.IllegalArgumentException - if data can not be formed to NDEF messageappendRecord( NDEFRecord )public void appendRecord( NDEFRecordrecord)ParametersThrowsAdds a new NDEF record after the last NDEF record in the NDEF message. The number of the NDEF records is increased byone.record - the new NDEF record to be addedjava.lang.NullPointerException - if record is nulljava.lang.IllegalArgumentException - if an NDEF record with the same payload identifier already existsgetNumberOfRecords()Returnspublic int getNumberOfRecords()Returns the number of NDEFRecord objects in the NDEF message.number of NDEF records29


Package javax.microedition.contactless.ndefNDEFMessagegetRecord(int)ParametersReturnsThrowspublic NDEFRecord getRecord(int index)Returns the NDEF record from the specified index in the NDEF message. The index must be a value greater than or equalto 0 and less than the current number of NDEF records in the NDEF message.index - index of the requested NDEF recordthe requested NDEF recordjava.lang.IndexOutOfBoundsException - if index is invalidgetRecord( NDEFRecordType )ParametersReturnsThrowspublic NDEFRecord [] getRecord( NDEFRecordType recordType)Returns the NDEF records with specified record type. If multiple records have the same record type, all these records arereturned. The order of the returned records is the same as in the original NDEF records.recordType - type of the requested NDEF recordthe requested NDEF records, null if no record with the requested record type are foundjava.lang.NullPointerException -getRecord(byte[])ParametersReturnsThrowsgetRecords()public NDEFRecord getRecord(byte[] id)Returns the NDEF record with the specified payload identifier.id - payload identifier of the requested NDEF recordthe NDEF record with requested identifier, null if matching record is not foundjava.lang.NullPointerException - if id is nullpublicNDEFRecord [] getRecords()Returns all NDEF records in the NDEF message.ReturnsNDEF records in the NDEF message, zero-length array if there are no NDEF records in the NDEF message30


Package javax.microedition.contactless.ndefNDEFMessagegetRecordTypes()publicNDEFRecordType [] getRecordTypes()Returns the record type objects of all NDEF records in the NDEF message. If there are several NDEF records with the samerecord type, they are all included in the returned array.Returnsthe record types of the NDEF records in the NDEF message, zero-length array, if there are no NDEF records in the NDEFmessageinsertRecord(int, NDEFRecord )ParametersThrowspublic void insertRecord(int index, NDEFRecord record)Adds the specified NDEF record to the NDEF records at the specified index. The index must be a value greater than or equalto 0 and less than the current number of NDEF records in the NDEF message. Each NDEF record in the NDEF records with anindex greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.index - index to which the new NDEF record is addedrecord - new NDEF record to be addedjava.lang.IndexOutOfBoundsException - if index is invalidjava.lang.NullPointerException - if record is nulljava.lang.IllegalArgumentException - if a NDEF record with the same payload identifier already existsremoveRecord(int)ParametersThrowspublic void removeRecord(int index)Removes an NDEF record from the specified index. The index must be a value greater than or equal to 0 and less than thecurrent number of NDEF records in the NDEF message. Each NDEF record in the NDEF records with an index greater thanthe specified index is shifted downward to have an index one smaller than the value it had previously.index - index of the NDEF record to be removedjava.lang.IndexOutOfBoundsException - if index is invalidsetRecord(int, NDEFRecord )ParametersThrowspublic void setRecord(int index, NDEFRecord record)Replaces the NDEF record at the specified index. The index must be a value greater than or equal to 0 and less than thecurrent number of NDEF records in the NDEF message.index - index of the record to be updatedrecord - updated NDEF recordjava.lang.IndexOutOfBoundsException - if index is invalidjava.lang.NullPointerException - if record is nulljava.lang.IllegalArgumentException - if an NDEF record with the same payload identifier already exists, exceptthe one that is about to be replaced31


Package javax.microedition.contactless.ndefNDEFMessagetoByteArray()public byte[] toByteArray()Returns the whole NDEF message with all the NDEF records as a byte array.ReturnsNDEF message as a byte array, null if NDEFMessage does not contain any NDEF records32


NDEFRecordNDEFRecord — class in package javax.microedition.contactless.ndefpublic class NDEFRecord extends java.lang.ObjectConstructor summaryNDEFRecord(NDEFRecordType recordType,byte[] id,byte[] payload)NDEFRecord(byte[] data,int offset)Method summaryvoidbyte[]NDEFMessagebyte[]longNDEFRecordTypevoidbyte[]appendPayload(byte[] payload)getId()getNestedNDEFMessage(int offset)getPayload()getPayloadLength()getRecordType()setId(byte[] id)toByteArray()InheritanceDescriptionjava.lang.Object → NDEFRecordMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitThis class represents an NDEF record. An NDEF record consists of type, type format, identifier for the payload and the actualpayload in a byte array. This class is an abstraction of the NDEF record defined by the NFC Forum NDEF specification and ithides some of the fields defined in that specification and leaves them to the <strong>API</strong> implementation. NDEF record may containsubrecords. Nested records can be accessed by getting the record payload and then parsing that payload into new NDEFrecords.A record type gives an identity to the payload in the record. Based on the record type information the application knowsthe meaning of the record payload. This information is used to guide the processing of the payload, like for example inthe application start as described in the appendix B. The type of the first NDEF record inside NDEF message, by convention,should provide the processing context not only for the first record but for the whole NDEF message.The NDEF record also contains an optional identifier for the payload. This identifier may be used to refer to the payload inother records. The value of the ID field is an identifier in the form of a URI RFC (3986). This class provides methods forgetting and setting this identifier. Character encoding used in identifier field must be UTF-8.The chunking feature defined in the NDEF specification must be handled below the Java <strong>API</strong> level. Only complete NDEFrecords are provided to the Java application. This means that the device implementing this <strong>API</strong> should have enough memoryto handle complete NDEF records.33


Package javax.microedition.contactless.ndefNDEFRecordConstructorsNDEFRecord( NDEFRecordType , byte[], byte[])public NDEFRecord ( NDEFRecordTyperecordType, byte[] id, byte[] payload)ParametersThrowsCreates a new NDEFRecord with specified record type, identifier and payload. The constructor implementation mustmake a copy from the original identifier and payload.Record identifier is given in the URL format and it may be null . In this case it must be omitted from the NDEF record.Payload of the NDEF record may be null or a zero-length array. Both these cases mean that payload must be omittedfrom the NDEF record.If record type format is NDEFRecordType.EMPTY the identifier and the payload must be omitted from the NDEF record.recordType - record type of the NDEF recordid - payload identifierpayload - payload of the record as byte arrayjava.lang.NullPointerException - if recordType is nullNDEFRecord(byte[], int)ParametersThrowsMethodspublic NDEFRecord (byte[] data, int offset)Formulates a new NDEF record from the given byte array starting from the specified index. The byte array should containthe record type name, type format, identifier, length and the payload of the record. The offset must be a value greaterthan or equal to 0 and less than the length of the payload byte array.data - the byte array containing the NDEF recordoffset - start index of the NDEF record data in the payload byte arrayjava.lang.NullPointerException - if data is nulljava.lang.ArrayIndexOutOfBoundsException - if the offset is invalidjava.lang.IllegalArgumentException - if the data cannot be formulated to NDEF recordappendPayload(byte[])ParametersThrowspublic void appendPayload(byte[] payload)This method appends payload into the end of the NDEF record payload. If payload is an empty array or null , this methodreturns without any additions to the existing payload. If the record type format is EMPTY , the payload must be omittedfrom the NDEF record and using this method causes an IllegalArgumentException to the thrown.payload - payload to be addedjava.lang.IllegalArgumentException - if record type format is EMPTY and this method is called34


Package javax.microedition.contactless.ndefNDEFRecordgetId()public byte[] getId()Returns the identifier for the record payload. This can be used to refer to this payload from other records.Returnsdata identifier, null if identifier has been omitted from the NDEF recordgetNestedNDEFMessage(int)ParametersReturnsThrowsgetPayload()Returnspublic NDEFMessage getNestedNDEFMessage(int offset)Returns the nested NDEF message from the record payload. The beginning of the message is identified by the offset. Theoffset must be a value greater than or equal to 0 and less than the length of the payload byte array. If the NDEF recorddoes not have payload null is returned.offset - the start index of the NDEF message in the payload byte arraythe nested NDEF message, null if the NDEF record does not have payloadjava.lang.ArrayIndexOutOfBoundsException - if the offset is invalidjava.lang.IllegalArgumentException - if the record payload can not be formulated to NDEF messagepublic byte[] getPayload()Returns the payload in the NDEF record as byte array.the payload of the NDEF record, null if payload has been omitted from the NDEF recordgetPayloadLength()Returnspublic long getPayloadLength()Returns the length of the payload in the NDEF record. This method is offered for convenience, so that the payload lengthis available before actually retrieving it.getRecordType()ReturnssetId(byte[])the length of the payload, 0 if payload has been omitted from the NDEF recordpublic NDEFRecordType getRecordType()Returns the record type of this record. This object contains the actual type and the type format information.Returns the reference to record type object of this recordpublic void setId(byte[] id)35


Package javax.microedition.contactless.ndefNDEFRecordParametersThrowstoByteArray()ReturnsSets the identifier for the record payload. This identifier can be used to refer to the payload in this record from other recordsand it is given in the URL format. Identifier may be null . In this case it must be omitted from the NDEF record. If therecord type format is EMPTY , the identifier must be omitted from the NDEF record and using this method causes anIllegalArgumentException to the thrown. The implementation must make a copy from the original identifier.id - identifier of the payloadjava.lang.IllegalArgumentException - if record type format is EMPTY and this method is calledpublic byte[] toByteArray()Returns the NDEF record as byte array, containing the record type name, type format, identifier, length and the payload ofthe record. This method has the same effect as calling NDEFMessage.toByteArray() for an NDEFMessage object that hasonly a single NDEFRecord object. The NDEFRecord must have both the MB and ME set.NDEF record as a byte array36


NDEFRecordListenerNDEFRecordListener — interface in package javax.microedition.contactless.ndefpublic interface NDEFRecordListenerMethod summaryvoidrecordDetected(NDEFMessage ndefMessage)DescriptionMethodsThe NDEFRecordListener provides a mechanism for the application to be notified, when NDEF records are discoveredfrom the contactless targets. The notification is requested based on the NDEF record type on the target. Through thisnotification the application has a read-only access to the data on the target, but it has no possibility to open a connectionto it. Applications must implement this interface to receive the notification.There can be multiple applications registered to receive notifications about different NDEF records. If this <strong>API</strong> is implementedon the MIDP 2.x platform, the applications can also request startup based on the NDEF record type on the target withPushRegistry entries. For more information on that, see Appendix B: Launching applications with MIDP 2.x PushRegistry.The diagram in DiscoveryManager shows what is the relationship of this listener to the TargetListener .The application is responsible for any possible synchronization required in the listener methods. The listener methodsmust return quickly and should not perform any extensive processing. The method calls are intended as triggers for theapplication. The application should do all necessary extensive processing in a separate thread and only use these methodsto initiate the processing.recordDetected( NDEFMessage )public void recordDetected( NDEFMessagendefMessage)ParametersCalled by the platform, when the requested NDEF record type is discovered by the device from the contactless target. Thedata is provided to the application in the parameter.ndefMessage - an NDEFMessage instance containing the data from the target37


NDEFRecordTypeNDEFRecordType — class in package javax.microedition.contactless.ndefpublic class NDEFRecordType extends java.lang.ObjectField summarystatic intstatic intstatic intstatic intstatic intstatic intEMPTYEXTERNAL_RTDMIMENFC_FORUM_RTDUNKNOWNURIConstructor summaryNDEFRecordType(int format,java.lang.String name)Method summarybooleanintjava.lang.Stringbyte[]intequals(java.lang.Object recordType)getFormat()getName()getNameAsBytes()hashCode()InheritanceDescriptionjava.lang.Object → NDEFRecordTypeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitThis class encapsulates the type of an NDEF record. It stores the name and format of the record type name. Possible nameformats are provided as constants in this class. Record type names used in this class and in the <strong>API</strong> must follow the rulesdefined by the NFC Forum RTDs and the RFCs.The record type name format defines the structure and the format for the record type name. Possible formats are MIMEmedia types defined in RFC 2046, absolute URIs defined in RFC 3986, NFC Forum well-known types, defined in the NFC ForumRTDs, NFC Forum external types and unknown. The application developer may also define own record type names usingnaming conventions of NFC Forum RTDs. These record type names are categorized as NFC Forum external types.The responsibility of the character encodings used in the record type names are left to the application. The <strong>API</strong>implementation must use US-ASCII character encoding with the record type names. This class also provides a conveniencemethod to compare record types. The comparison rules for record type names are defined in equals method.The implementation of this class must remove the prefix urn:nfc:wkt: from the NFC Forum RTD names and the prefixurn:nfc:ext: from the NFC Forum external record type names. This means that the getName() method must returnthe record type name without any prefixes.38


Package javax.microedition.contactless.ndefNDEFRecordTypeFieldsEMPTYpublic static final int EMPTYRecord type name format identifier for the empty record. This format indicates there is no type name associated with thisrecord. When this format is used, the record type name is omitted. The only valid value for the record type name with thisEMPTY record type is null .Value: 0EXTERNAL_RTDMIMEpublic static final int EXTERNAL_RTDRecord type name format identifier for application specific record type names that follow the NFC Forum naming conventions.Value: 4public static final int MIMERecord type name format identifier for the MIME type defined in the RFC 2046.Value: 2NFC_FORUM_RTDUNKNOWNURIpublic static final int NFC_FORUM_RTDRecord type name format identifier for the NFC Forum Record Type Description.Value: 1public static final int UNKNOWNRecord type name format identifier for the unknown record type. This format indicates that the type of the payload isunknown. The only valid values for the record type name with this UNKNOWN record type is null .Value: 5public static final int URIRecord type name format identifier for the URI type defined in the RFC 3986.Value: 3ConstructorsNDEFRecordType(int, java.lang.String)public NDEFRecordType (int format, java.lang.String name)Creates a new record type object. The format must be one of the constants defined in this class. If the format is EMPTY orUNKNOWN the name must be null . The record type names of NFC_FORUM_RTD and EXTERNAL_RTD record types mustfollow the naming rules defined in the NFC Forum RTD specification. The record type name must only contain charactersin the US_ASCII character set.39


Package javax.microedition.contactless.ndefNDEFRecordTypeParametersThrowsMethodsIf the record type format is URI the URI should be percent-encoded and the percent-encoded URIs must be normalizedto upper-case letters.format - record type formatname - record type namejava.lang.IllegalArgumentException - if format is not one of the constants defined in this class or the typeformat is EMPTY or UNKNOWN and the type name is not null or the type name is not valid NFC_FORUM_RTD orEXTERNAL_RTD name or name contains characters outside US_ASCII character setequals(java.lang.Object)public boolean equals(java.lang.Object recordType)This method compares two record type objects. They are equal if both the record type format and record type name areequal and they both use the same character encoding. The following table defines the comparison rules for different recordtype name formats.Record type formatMIMEURINFC_FORUM_RTDEXTERNAL_RTDUNKNOWNEMPTYComparison rule for record type nameComparison character-by-character in case-insensitive mannerup to the first ";".Reserved characters must be percent-encoded and thehexadecimal digits in those normalized to upper-case letters.The scheme and host parts of the URI must be normalized tolower-case. After this the URIs are compared in thecharacter-by-character in case-sensitive manner.Comparison character-by-character in case-sensitive manner.Comparison character-by-character in case-insensitive manner.Both record type names must be null .Both record type names must be null .ParametersReturnsgetFormat()ReturnsgetName()recordType - record type that this record type is compared totrue if record types are equal, else falsepublic int getFormat()Returns the format of the record type name. Possible return values are defined as constants in this class.record type name formatpublic java.lang.String getName()Returns the name of the NDEF record without any prefixes defined in the NFC Forum. If the format of the record is EMPTYor UNKNOWN , this method must return null . If the format of the record is URI the method must return the name in40


Package javax.microedition.contactless.ndefNDEFRecordTypesame format as it was given in the constructor (with or without percent-encoding). The record type name is characterencoded using US_ASCII character set.Returnsthe record type name of the NDEF record, null if record type is EMPTY or UNKNOWNgetNameAsBytes()ReturnshashCode()Returnspublic byte[] getNameAsBytes()Returns the name of the NDEF record without any prefixes defined in the NFC Forum. If the type of the record is EMPTY orUNKNOWN , this method must return null . The character encoding is left to the application.the record type name of the NDEF record as byte array, null if record type is EMPTY or UNKNOWNpublic int hashCode()Returns a hash code value for the record type object. Two object that refer to the same NDEFRecordType must have thesame hash code. For more information see java.lang.Object.hashCode() method.hash value of the record type41


NDEFTagConnectionNDEFTagConnection — interface in package javax.microedition.contactless.ndefpublic interface NDEFTagConnection extends javax.microedition.contactless.TagConnectionMethod summaryNDEFMessagevoidreadNDEF()writeNDEF(NDEFMessage message)InheritanceMethods inherited from class javax.microedition.io.ConnectioncloseAll superinterfacesDescriptionMethodsreadNDEF()ReturnsThrowsjavax.microedition.contactless.TagConnectionThe NDEFTagConnection interface defines the basic functionality for exchanging NFC Forum formatted data with RFIDtags and contactless smart cards. The actual data is stored in the NDEFMessage object containing the data in NDEF records.This interface provides the means to read data from and write data to a target without knowing the actual physical typeof the target. Each different target type that contains NFC Forum formatted data can be accessed through this interface. Ifthe target-specific connection class implementing this interface does not support handling of NDEF messages, the methodsdefined in this connection must throw <strong>Contactless</strong>Exception .NDEFTagConnection extends the Generic Connection Framework (GCF) architecture. It defines a new protocol to beused when communicating with contactless targets that have NFC Forum formatted data. The URL required to open theconnection to the target can be retrieved from TargetProperties received in the targetDetected notification.There can be only one write operation ongoing at once and all other read and write attempts during that time will causean IllegalStateException to be thrown.public NDEFMessage readNDEF() throwsjavax.microedition.contactless.<strong>Contactless</strong>Exception, java.io.IOExceptionReads NFC Forum formatted data from the target. This method blocks until reading is completed or the connection totarget is lost.The <strong>API</strong> implementation must read the whole NDEFMessage from the target at once. The <strong>API</strong> implementations maysupport data buffering. As the length of the target availability in the RFID field cannot be predicted, some hardware maytry to read the content of the tag immediately once it appears to the interrogation field.NDEF message read from the target, null if target does not contain any data<strong>Contactless</strong>Exception - if NFC Forum formatting is not supported by the targetjava.lang.IllegalStateException - if write operation is ongoingjava.io.IOException - if connection to the target is lost or it has been closedjavax.microedition.contactless.<strong>Contactless</strong>Exception42


Package javax.microedition.contactless.ndefNDEFTagConnectionwriteNDEF( NDEFMessage )ParametersThrowspublic void writeNDEF( NDEFMessage message) throwsjavax.microedition.contactless.<strong>Contactless</strong>Exception, java.io.IOExceptionWrites NFC Forum formatted data in the NDEF message to the target. This method overwrites all the existing data on thetarget and it blocks until writing is completed or the connection to target is lost.Writing data to the target may fail for various reasons. The <strong>API</strong> implementation must read the newly written data rightafter the write operation and make sure that all data was written correctly to the target. Returning from this method mustmean that writing was successful. If writing failed an IOException is thrown.message - NDEF message to be written to the target<strong>Contactless</strong>Exception - if NFC Forum formatting is not supported by the targetjava.lang.NullPointerException - if message is nulljava.lang.IllegalArgumentException - if message does not contain any NDEF recordsjava.lang.IllegalStateException - if other write operation is ongoingjava.io.IOException - if writing data to the target failed, connection to the target is lost or it has been closedjava.lang.SecurityException - if the application does not have permission to write to a targetjavax.microedition.contactless.<strong>Contactless</strong>Exception43


Package javax.microedition.contactless.rfProvides interfaces for physical RF targets.Interface summaryPlainTagConnectionThis interface defines the basic mechanism to communicate with the different RFIDtags that contain non-NFC Forum formatted data.Package DocumentationProvides interfaces for physical RF targets.This package defines a high level interface for accessing the most common contactless RF targets. These interfaces providea physical level access to the targets.Features of different contactless targets vary a lot. It would be impossible for this <strong>API</strong> to support all these features. This<strong>API</strong> provides a high level interface to access RFID_TAG targets. PlainTagConnection can be used with physical RFID targetsthat do not support NDEF and do not have target-specific interface defined by the <strong>API</strong> implementation. This still requiresthat the <strong>API</strong> implementation supports handling of that physical target type. Since PlainTagConnection interface mightbe inconvenient to use, it should be extended with target-specific connection interfaces to enable the efficient use of thefeatures of the target.The following example shows how to open a PlainTagConnection to the discovered target.import java.io.IOException;import javax.microedition.contactless.*;import javax.microedition.contactless.rf.PlainTagConnection;import javax.microedition.io.Connector;// Example class of how to use PlainTagConnection of// JSR 257 <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong>public class CC<strong>API</strong>Example implements TargetListener {private DiscoveryManager dm;public CC<strong>API</strong>Example() {registerTargetToDiscovery();}public void registerTargetToDiscovery() {// Register RFID_TAG target to discovery}public void targetDetected(TargetProperties[] prop) {// Select first found targetTargetProperties target = prop[0];try {Class[] connNames = target.getConnectionNames();String url = target.getUrl(connNames[0]);if (connNames[0].equals(Class.forName("javax.microedition.contactless.rf.PlainPlainTagConnection"))) {String mapping = target.getMapping();PlainTagConnection conn =(PlainTagConnection)Connector.open(url);// Construct input vector based on the mapping// and begin communication}}catch (ClassNotFoundException e) {// handle exception}44


Package javax.microedition.contactless.rf}}catch (IOException e) {// handle exception}Author.Nokia CorporationVersion. 1.045


PlainTagConnectionPlainTagConnection — interface in package javax.microedition.contactless.rfpublic interface PlainTagConnection extends javax.microedition.contactless.TagConnectionMethod summaryjava.util.Vectortransceive(java.util.Vector input)InheritanceMethods inherited from class javax.microedition.io.ConnectioncloseAll superinterfacesDescriptionMethodsjavax.microedition.contactless.TagConnectionThis interface defines the basic mechanism to communicate with the different RFID tags that contain non-NFC Forumformatted data. This data is usually in the format defined by the tag vendor. Each of these data formats have their ownspecial features and access commands.This interface provides high level method to access non-NFC Forum formatted data on the target. The execution of, forexample, read command on a tag might require also the authentication and the data area selection before the actual readcan be done. From the application perspective it would be easiest to do all these actions with one method call. Thereforethis interface provides a Vector input parameter to set all the needed commands into one parameter and send them tothe target with one method call. Each command is presented as one element in the Vector . The returned Vectorcontains the elements that correspond to the return values of the commands in the input Vector . The Vector is usedto make the handling of separate commands and their return values easier.Still there may be a need to specify more tag-specific classes that support the actual structure and properties of the physicaltag. These more detailed tag-specific classes are out of scope for this <strong>API</strong>.transceive(java.util.Vector)ParametersReturnsThrowspublic java.util.Vector transceive(java.util.Vector input) throwsjavax.microedition.contactless.<strong>Contactless</strong>Exception, java.io.IOExceptionThis method allows the applications to communicate with the discovered RFID tag. The tag specific access commands areset to the input vector. These commands can be for example an authentication command and after that a read commandwith needed sector and block information.Since operations performed on the tag vary based on the physical type of the tag, return value of this method is impossibleto define. Therefore an output vector is provided into the method and the results of the requested commands are placedinto it.input - commands requested to be performed on the tagthe result of the performed commands<strong>Contactless</strong>Exception - if commands cannot be performed or the operation is not supported by the <strong>API</strong> implementation46


Package javax.microedition.contactless.rfPlainTagConnectionjava.lang.NullPointerException - if input is nulljava.io.IOException - if connection has been closedjavax.microedition.contactless.<strong>Contactless</strong>Exception47


Package javax.microedition.contactless.scProvides interfaces for communication with external smart cards.Interface summaryISO14443ConnectionThis interface defines access to the ISO 14443-4 compliant contactless smart card.Package DocumentationProvides interfaces for communication with external smart cards.<strong>Communication</strong> with external smart card is done using interfaces in this package. The smart cards are discovered the sameway as any other contactless target in this specification. Once the external smart card is discovered, the communicationwith it is done using ISO14443Connection . The communication is based on APDU commands.Relationship to JSR 177Both JSR 177 and JSR 257 allow the applications to access smart cards. Even the interfaces provided for that access arequite similar. This chapter explains why these separate interfaces are needed in different JSRs and what is the relationshipbetween these two.JSR 177 chapter 12 defines an APDUConnection . Java applications can use this interface to communicate with applicationson resident smart cards using APDU protocol (as defined in ISO-7816-4).This specification defines ISO14443Connection that provides a mechanism to access smart cards. Smart card can also beexternal, where as JSR 177 provides only access to resident smart cards. ISO14443Connection allows the access to thewhole smart card, where APDUConnection defined in JSR 177, is only used to communicate with a specific applicationon the smart card. Therefore ISO14443Conneciton provides a lower level access than APDUConnection .One of the main reasons for providing ISO14443Connection is that this specification does not mandate the use of JSR177. It is recommended that if JSR 177 is implemented on the device, it should be used in the implementation ofISO14443Connection .Author.Nokia CorporationVersion. 1.048


ISO14443ConnectionISO14443Connection — interface in package javax.microedition.contactless.scpublic interface ISO14443Connection extends javax.microedition.contactless.TagConnectionMethod summarybyte[]exchangeData(byte[] data)InheritanceMethods inherited from class javax.microedition.io.ConnectioncloseAll superinterfacesDescriptionjavax.microedition.contactless.TagConnectionThis interface defines access to the ISO 14443-4 compliant contactless smart card. With this interface application cancommunicate with contactless smart card using APDU commands. The APDU commands are defined in ISO7816-4 specificationor by the RFID hardware manufacturer. This interface does not replace APDUConnection interface specified in JSR 177.Implementation of this class may take advantage of JSR 177. The slot number needed to open an APDUConnection tothe external smart card may be provided though the TargetProperties.getProperty method.Following example shows how this connection can be used. It opens an ISO14443Connection to the discovered externalsmart card and sends APDU command to it.import java.io.IOException;import javax.microedition.contactless.*;import javax.microedition.contactless.sc.ISO14443Connection;import javax.microedition.io.Connector;//// Example class of how to use SmartCardConnection in JSR 257 <strong>Contactless</strong>// <strong>Communication</strong> <strong>API</strong>//public class TestSmartCard implements TargetListener, TransactionListener {public TestSmartCard() {try {DiscoveryManager dm = DiscoveryManager.getInstance();dm.addTargetListener(this, TargetType.ISO14443_CARD);dm.addTransactionListener(this);}catch (<strong>Contactless</strong>Exception ce) {}}// Smart card target has been found (reader mode)public void targetDetected(TargetProperties[] properties) {TargetProperties target = properties[0];Class[] classes = target.getConnectionNames();for (int i=0; i


Package javax.microedition.contactless.scISO14443Connection}}ISO14443Connection smc =(ISO14443Connection)Connector.open(url);// Generate command// Send command to smart cardbyte[] response = smc.exchangeData(commands);// handle response}}catch (ClassNotFoundException e) {// handle exception}catch (IOException e) {// handle exception}catch (<strong>Contactless</strong>Exception ce) {// handle exception}}MethodsexchangeData(byte[])ParametersReturnsThrows// External reader has been detected (tag emulation mode)public void externalReaderDetected(byte slot) {// update the UI based on the application ID received}public byte[] exchangeData(byte[] data) throws java.io.IOException,javax.microedition.contactless.<strong>Contactless</strong>ExceptionThis method allows exchanging APDU commands with an external smart card using ISO14443-4 communication. Responseto the sent commands is received as a return value. The APDU commands are defined in ISO7816-4 specification. The <strong>API</strong>implementation may also support APDU commands defined by the RFID hardware manufacturer.data - APDU commands to be sent to the smart cardresponse to the APDU commands from the smart card<strong>Contactless</strong>Exception - if the operation is not supported by the <strong>API</strong> implementationjava.lang.NullPointerException - if data is nulljava.lang.IllegalArgumentException - if data is an empty arrayjava.io.IOException - if connection has been closedjava.io.InterruptedIOException - if connection is closed during exchange operationjavax.microedition.contactless.<strong>Contactless</strong>Exception50


Package javax.microedition.contactless.visualProvides means to read information stored on visual tags (bar codes) and to generate visual tag images.Interface summaryImagePropertiesVisualTagConnectionClass summarySymbologyManagerException summaryVisualTagCodingExceptionThis interface collects the properties of visual tag image that are common to allsymbologies.This interface provides contactless connection to a visual tag (bar code) target.This class is a starting point when using visual tags.This exception captures the error situations related to encoding and decoding errorsin visual tag reading and image generation.Package DocumentationProvides means to read information stored on visual tags (bar codes) and to generate visual tag images.This package contains the functionality that allows contactless communication with visual tag targets. It contains interfacesand classes needed to read information stored on the visual tags. The package also includes a mechanism to generatevisual tag images using specified symbologies.There are a lot of different visual tag symbologies. Some of them are proprietary and some are available in the publicdomain as standardized specifications. This specification does not mandate the use of certain symbologies, since differentsymbologies are required in the different applications domains. Therefore it only provides a method for querying a list ofsymbologies that are supported for reading and for visual tag image generation by the <strong>API</strong> implementation.Visual tags are treated as any contactless target in this specification. They can be discovered through the DiscoveryManagerinterface, but a connection to them can also be opened manually. The URL needed to open a manual connection to thevisual tag is described in VisualTagConnection interface. After the connection is opened, the developer can read visualtags or generate visual tag images.The following example code shows how a connection to a visual tag can be opened manually to read a visual tag andgenerate a visual tag image. First the connection to a visual tag is opened manually. After that the data from the visualtag is read using Code 39 symbology. After that it generates a visual tag image with text "test" using Code 39 symbologyin encoding.import java.io.IOException;import javax.microedition.contactless.<strong>Contactless</strong>Exception;import javax.microedition.contactless.visual.*;import javax.microedition.io.Connector;// Example class of how to read visual tags and generate visual tag images// using JSR 257 <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong>public class TestVisual {private String mySymbology ="Code 39";public TestVisual() {readVisualTag();generateVisualTag();}public void readVisualTag() {boolean supported = false;try {// Check that needed symbology is supported for readingString[] symbologies = SymbologyManager.getReadSymbologies();51


Package javax.microedition.contactless.visualmySymbology);}for (int i=0; i < symbologies.length; i++) {if (symbologies[i].equals(mySymbology)) {supported = true;break;}}if (supported) {// Get supported image classesClass[] images = SymbologyManager.getImageClasses();// Get the visual tag imageObject image = getImage();// Read visual tagVisualTagConnection conn =(VisualTagConnection)Connector.open("vtag://");byte[] data = conn.readVisualTag(image, images[0], ►}else {// Handle data from the imageconn.close();//Symbology not supported for reading}}catch (IOException ioe) {// handle exception}catch (VisualTagCodingException ce) {// handle exception}public void generateVisualTag() {Image")) {boolean supported = false;try {// Check that needed symbology is supported for image generationString[] symbologies = SymbologyManager.getGenerateSymbologies();for (int i=0; i < symbologies.length; i++) {if (symbologies[i].equals(mySymbology)) {supported = true;break;}}if (supported == true) {// Get properties for code 39 symbologyImageProperties properties =SymbologyManager.getImageProperties(mySymbology);// Get supported image classesClass[] images = SymbologyManager.getImageClasses();int i;for (i=0; i < images.length; i++) {if (images[i].equals("javax.microedition.lcdui.►// LCDUI Image supportedbreak;}}// Generate visual tag imageVisualTagConnection conn =(VisualTagConnection)Connector.open("vtag://");byte[] data = "test".getBytes("UTF-8");Object vtagImage = conn.generateVisualTag(data, images[i], properties);Image img = (javax.microedition.lcdui.Image)vtagImage;52


Package javax.microedition.contactless.visual}}...}}catch (<strong>Contactless</strong>Exception ce) {// handle exception}catch (IOException ioe) {// handle exception}Author.Nokia CorporationVersion. 1.053


ImagePropertiesImageProperties — interface in package javax.microedition.contactless.visualpublic interface ImagePropertiesField summarystatic intstatic intstatic intPHYSICAL_SIZE_UNIT_INCHPHYSICAL_SIZE_UNIT_MILLIMETERPHYSICAL_SIZE_UNIT_PIXELMethod summaryintdoubleintdoublejava.lang.Objectint[]doublejava.lang.StringvoidvoidvoidvoidvoidvoidvoidgetLogicalUnitSize()getPhysicalHeigth()getPhysicalSizeUnit()getPhysicalWidth()getProperty(int key)getPropertyKeys()getResolution()getSymbology()setLogicalUnitSize(int size)setPhysicalHeight(double height)setPhysicalSizeUnit(int sizeUnit)setPhysicalWidth(double width)setProperty(int key,java.lang.Object value)setResolution(double resolution)setSymbology(java.lang.String symbology)DescriptionThis interface collects the properties of visual tag image that are common to all symbologies. It also provides an extensionmechanism to manage varying properties of different symbologies. These properties are used in visual tag image generation.The quiet zone required around the visual tag image to make it readable from the surrounding data is included into theheight and width specified for the visual tag image. This means that the <strong>API</strong> implementation must make sure that thegenerated image with the quiet zone fits into the given image dimensions.The <strong>API</strong> implementation must create a symbology specific class for each symbology that it supports. This symbology specificclass must implement this interface. These new classes collect all properties specific to a particular symbology. Thesymbology specific classes must define key names for the new properties as integer constants. The naming conventionfor the extended keys is that the name must start with the symbology name, like for example CODE-39_X_DIMENSION. The <strong>API</strong> implementation must provide default values for all the properties and specify what is the object the property is54


Package javax.microedition.contactless.visualImagePropertiesrepresented in. The methods in this interface can be used to change those default values and to get the values of thesymbology specific properties.As this specification does not specify any extended properties for the different symbologies these properties areimplementation dependent. This means that the application developer should always use the default values retrievedwith SymbologyManager.getImageProperties(symbology) method. Changing the default values is possible, but it makesthe application dependant on the specific <strong>API</strong> implementation.Following list describes the tasks the symbology-specific property class must handle:• Define key names for the new properties• Define representation type for the new properties ( String , integer, double, etc.)• Provide default values for the new propertiesBelow is an example of the properties class for Code 39 symbology. It provides four new properties for Code 39 symbology.public class Code39Properties implements ImageProperties {private String symbology;private double resolution;private double width;private double height;private int sizeUnit;private int logicalSizeUnit;public final static int CODE-39_X_DIMENSION = 51; // doublepublic final static int CODE-39_WIDE_TO_NARROW = 52; // doublepublic final static int CODE-39_INTERCHARACTER_GAP = 53; // doublepublic final static int CODE-39_CHECK_CHARACTER = 54; // booleanpublic Code39Properties() {this.symbology = "code-39";this.resolution = 72.0;this.width = 100.0;this.height = 20.0;this.sizeUnit = ImageProperties.PHYSICAL_SIZE_UNIT_PIXEL;this.logicalUnitSize = 1;}// set Code 39 related propertiessetProperty(CODE-39_X_DIMENSION, new Double(20.0));setProperty(CODE-39_WIDE_TO_NARROW, new Double(2.2));setProperty(CODE-39_INTERCHARACTER_GAP, new Double(3));setProperty(CODE-39_CHECK_CHARACTER, new Boolean(true));Fields}// Implements the methods from the ImageProperties...PHYSICAL_SIZE_UNIT_INCHpublic static final int PHYSICAL_SIZE_UNIT_INCHConstant for inches as physical size unit.Value: 2PHYSICAL_SIZE_UNIT_MILLIMETERpublic static final int PHYSICAL_SIZE_UNIT_MILLIMETER55


Package javax.microedition.contactless.visualImagePropertiesConstant for millimeters as physical size unit.Value: 3PHYSICAL_SIZE_UNIT_PIXELMethodspublic static final int PHYSICAL_SIZE_UNIT_PIXELConstant for pixels as physical size unit.Value: 1getLogicalUnitSize()Returnspublic int getLogicalUnitSize()Returns the size of a single unit used in the symbology in pixels. This unit can be, for example, the width of a module indata-matrix or the width of a narrow bar in code-39 symbology. The default value of this property is 1 pixel.the size of the symbology's logical unit in pixelsgetPhysicalHeigth()Returnspublic double getPhysicalHeigth()Returns the maximum height of the visual tag image. The height is represented in the unit specified by theImagePropertyes.getPhysicalSizeUnit() method.the maximum height of the imagegetPhysicalSizeUnit()Returnspublic int getPhysicalSizeUnit()Returns the unit for the physical dimensions. This parameter is represented as integer, where only valid values are theconstants defined in this class.physical size unit of the imagegetPhysicalWidth()Returnspublic double getPhysicalWidth()Returns the maximum width of the visual tag image. The width is represented in the unit specified by theImagePropertyes.getPhysicalSizeUnit() method.getProperty(int)the maximum width of the imagepublic java.lang.Object getProperty(int key)Returns the value of the requested property as an object . Returned value is either the default value set by theimplementation or the value modified by the application.56


Package javax.microedition.contactless.visualImagePropertiesParametersReturnskey - the identifier of the propertyvalue of the property, null if the key is not definedgetPropertyKeys()ReturnsgetResolution()ReturnsgetSymbology()Returnspublic int[] getPropertyKeys()Returns the list of the property keys. Since each property must have a default value, this method returns the keys for allextended properties. The actual property value can be retrieved with method ImageProperties.getProperty(int key) .key values of extended propertiespublic double getResolution()Returns the resolution of the visual tag image. The resolution means the number of dots (in printing) or pixels (on screen)per physical unit. With this the dots or pixels can be converted to physical size and vice versa.the resolution of the imagepublic java.lang.String getSymbology()Returns the symbology of the visual tag image.the name of the symbologysetLogicalUnitSize(int)ParametersThrowspublic void setLogicalUnitSize(int size)Sets the size of the single unit used in the symbology in pixels. This unit can be, for example, the width of a module indata-matrix or the width of a narrow bar in code-39 symbology. Value must be greater than zero.size - the size of the logical unit in pixelsjava.lang.IllegalArgumentException - if size is less or equal to zerosetPhysicalHeight(double)Parameterspublic void setPhysicalHeight(double height)Sets the maximum height for the visual tag image. This is the maximum height of the visual tag image that the applicationis able to handle.height - the maximum height57


Package javax.microedition.contactless.visualImagePropertiesThrowsjava.lang.IllegalArgumentException - if height is less or equal to zerosetPhysicalSizeUnit(int)ParametersThrowspublic void setPhysicalSizeUnit(int sizeUnit)Sets the unit for the physical dimensions. This parameter is represented as integer, where only valid values are the constantsdefined in this class.sizeUnit - unit of the physical sizejava.lang.IllegalArgumentException - if sizeUnit is not one of the constants defined in this classsetPhysicalWidth(double)ParametersThrowspublic void setPhysicalWidth(double width)Sets the maximum width for the visual tag image. This is the maximum width of the visual tag image that the applicationis able to handle.width - the maximum widthjava.lang.IllegalArgumentException - if width is less or equal to zerosetProperty(int, java.lang.Object)ParametersThrowspublic void setProperty(int key, java.lang.Object value)Sets the property for specified key.key - the key identifier of the propertyvalue - the value of the propertyjava.lang.IllegalArgumentException - if key is not one of the constants defined in the class implementing thisinterface or the value cannot be converted into the type of the propertyjava.lang.NullPointerException - if value is nullsetResolution(double)ParametersThrowspublic void setResolution(double resolution)Sets the resolution for the visual tag image.resolution - the image resolutionjava.lang.IllegalArgumentException - if resolution is less or equal to zero58


Package javax.microedition.contactless.visualImagePropertiessetSymbology(java.lang.String)public void setSymbology(java.lang.String symbology)Sets the symbology for the visual tag image.Parameterssymbology - the name of the symbologyThrowsjava.lang.NullPointerException - if symbology is null59


SymbologyManagerSymbologyManager — class in package javax.microedition.contactless.visualpublic class SymbologyManager extends java.lang.ObjectMethod summarystatic java.lang.String[]static java.lang.Class[]static ImagePropertiesstatic java.lang.String[]getGenerateSymbologies()getImageClasses()getImageProperties(java.lang.String symbologyName)getReadSymbologies()InheritanceDescriptionjava.lang.Object → SymbologyManagerMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitThis class is a starting point when using visual tags. Since this specification does not mandate the use of any particularsymbology, this class provides static methods for querying supported symbologies for visual tag reading and imagegeneration. It also has a static method for requesting ImageProperties needed in generation of a visual tag image.Before the application can start reading or generating visual tag images, it must know whether the needed symbologiesare supported by the <strong>API</strong> implementation. This check is done using methods in this class. If the symbology is supportedthe application can open a connection to visual tag and perform needed actions. Also the propertied needed in the visualtag image generation are provided through this class.The names of the symbologies vary a lot. Since only a small portion of the symbologies are standardized, names mightnot be widely adopted. The following table lists the standardized symbologies in the time this specification was finalized.The symbology names listed below must be used, when referring to standardized symbologies in the implementation ofthis specification.Symbology nameaztec-codecode-16kcode-39code-49code-93code-128codebardata-matrixean-upcinterleaved-2-of-5maxicodepdf417qr-codeStandardization bodyANSI/AIM BC13 ITS/97/002ANSI/AIM BC7-1995ANSI/AIM BC1-1995, ISO/IEC 16388ANSI/AIM BC6-1995ANSI/AIM BC5-1995ANSI/AIM BC4-1999, ISO/IEC 15417ANSI/AIM BC3-1995ISO/IEC 16022ISO/IEC 15420ANSI/AIM BC2-1995, ISO/IEC 16390ANSI/AIM BC10, ISO/IEC 16023ISO/IEC 15438AIM ITS/97/001, ISO/IEC 1800460


Package javax.microedition.contactless.visualSymbologyManagerMethodsFor other symbologies, than the ones listed above, the final naming convention it is left to an <strong>API</strong> implementer. All lettersin the symbology name must be lower case and spaces are replaced with hyphen. The name should also reflect the packagestructure of the <strong>API</strong> implementation.getGenerateSymbologies()Returnspublic static java.lang.String[] getGenerateSymbologies()Returns the list of symbologies that are supported by the <strong>API</strong> implementation for visual tag image generation. The namesof standardized symbologies that must be used are listed in the table in class description.supported symbologies for visual tag image generationgetImageClasses()Returnspublic static java.lang.Class[] getImageClasses()Returns the names of all image classes that are supported by the <strong>API</strong> implementation. Example of the return value couldbe javax.microedition.lcdui.Image if the <strong>API</strong> is implemented on MIDP environment.the image class names the <strong>API</strong> implementation supportsgetImageProperties(java.lang.String)ReturnsThrowspublic static ImageProperties getImageProperties(java.lang.String symbologyName)throws javax.microedition.contactless.<strong>Contactless</strong>ExceptionReturns the default properties of the specified symbology that are needed when generating visual tag image. If the specifiedsymbology is not supported by the <strong>API</strong> implementation, a <strong>Contactless</strong>Exception is thrown.the properties of the requested symbologyjava.lang.NullPointerException - if symbologyName is null<strong>Contactless</strong>Exception - if the requested symbology is not supported by the <strong>API</strong> implementationjavax.microedition.contactless.<strong>Contactless</strong>ExceptiongetReadSymbologies()Returnspublic static java.lang.String[] getReadSymbologies()Returns the list of symbologies that are supported by the <strong>API</strong> implementation for reading visual tags. The names ofstandardized symbologies that must be used are listed in the table in class description.supported symbologies for visual tag reading61


VisualTagCodingExceptionInheritanceDescriptionConstructorsVisualTagCodingException — exception class in package javax.microedition.contactless.visualpublic class VisualTagCodingException extendsjavax.microedition.contactless.<strong>Contactless</strong>ExceptionConstructor summaryVisualTagCodingException()VisualTagCodingException(java.lang.String message)java.lang.Object → java.lang.Throwable → java.lang.Exception →javax.microedition.contactless.<strong>Contactless</strong>Exception → VisualTagCodingExceptionMethods inherited from class java.lang.ThrowablefillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause,printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitThis exception captures the error situations related to encoding and decoding errors in visual tag reading and imagegeneration. It extends ContectlessException , which is used if the requested operation is not supported by the <strong>API</strong>implementation.VisualTagCodingException()public VisualTagCodingException ()Constructs a VisualTagCodingException without a detail messages.VisualTagCodingException(java.lang.String)Parameterspublic VisualTagCodingException (java.lang.String message)Constructs a VisualTagCodingException with a detail messages.message - description of the exceptional situation62


VisualTagConnectionVisualTagConnection — interface in package javax.microedition.contactless.visualpublic interface VisualTagConnection extends javax.microedition.io.ConnectionMethod summaryjava.lang.Objectbyte[]generateVisualTag(byte[] data,java.lang.Class imageClass,ImageProperties properties)readVisualTag(java.lang.Object tagImage,java.lang.Class imageClass,java.lang.String symbologyName)InheritanceMethods inherited from class javax.microedition.io.ConnectioncloseAll superinterfacesDescriptionMethodsjavax.microedition.io.ConnectionThis interface provides contactless connection to a visual tag (bar code) target. It can be used to retrieve data from visualtags and to generate visual tag images.VisualTagConnection is built on top of Generic Connection Framework GCF. The URL needed to open aVisualTagConnection is provided in the TargetProperties received in the TargetListener callback when target isdiscovered. The connection may also be opened manually without DiscoveryManager functionality. Below is the definitionfor the URL in the EBNF format. As the connection is opened before any target is available, the URL only contains the schemedefinition. ::= "vtag:"generateVisualTag(byte[], java.lang.Class, ImageProperties )Parameterspublic java.lang.Object generateVisualTag(byte[] data, java.lang.Class imageClass,ImageProperties properties) throwsjavax.microedition.contactless.visual.VisualTagCodingException, java.io.IOExceptionGenerates a visual tag image containing specified data. The visual tag image is generated according to the propertiesdefined in the properties parameter and it is an instance of the specified image class. The application developer retrievesthe image properties are with method SymbologyManager.getImageProperties . method. It is also recommended thatthe size of the screen is checked before generating the visual tag image to make sure that the generated image fitscompletely on the screen. If encoding of the data fails, a VisualTagCodingException is thrown.The implementation of this method must produce the best quality image that fits into the given image dimensions. Thismust be done with as little anti-aliasing as possible, and the returned image must still be readable. If the implementationcan not generate the image without heavy zooming or anti-aliasing, an IllegalArgumentException must be thrown.data - data to be encoded into the visual tag imageimageClass - the instance of the Class object that must be used in the generated image, null if platform defaultimage class is usedproperties - properties of visual tag image to be generated63


Package javax.microedition.contactless.visualVisualTagConnectionReturnsgenerated visual tag image objectThrowsjava.lang.NullPointerException - if data or properties is nulljava.lang.IllegalArgumentException - if imageClass is not supported by the <strong>API</strong> implementation or theimage according the properties cannot be generatedVisualTagCodingException - if encoding of the data failsjava.io.IOException - if connection has been closedjavax.microedition.contactless.visual.VisualTagCodingExceptionreadVisualTag(java.lang.Object, java.lang.Class, java.lang.String)ParametersReturnsThrowspublic byte[] readVisualTag(java.lang.Object tagImage, java.lang.Class imageClass,java.lang.String symbologyName) throwsjavax.microedition.contactless.visual.VisualTagCodingException, java.io.IOExceptionReads a visual tag. The application has access to the visual tag image and the used image class is provided as parameter.The symbology to be used in decoding the data is also specified. Names of the standardized symbologies are defined inSymbologyManager class. If decoding of the data fails, a VisualTagCodingException is thrown.tagImage - visual tag image to be decodedimageClass - the class identifying the type of the tagImage , null if platform default image class is usedsymbologyName - name of the symbology to be used in the data decodingdata from the visual tagjava.lang.NullPointerException - if tagImage or symbology is nulljava.lang.IllegalArgumentException - if symbology or imageClass is not supported by the <strong>API</strong> implementationVisualTagCodingException - if decoding visual tag failsjava.io.IOException - if connection has been closedjavax.microedition.contactless.visual.VisualTagCodingException64


Constant field valuesPackage javax.microedition.contactlessTransactionListenerUNKNOWN_SLOT-1Package javax.microedition.contactless.ndefNDEFRecordTypeEMPTYEXTERNAL_RTDMIMENFC_FORUM_RTDUNKNOWNURI042153Package javax.microedition.contactless.visualImagePropertiesPHYSICAL_SIZE_UNIT_INCHPHYSICAL_SIZE_UNIT_MILLIMETERPHYSICAL_SIZE_UNIT_PIXEL23165


Appendix A. SecurityThis appendix defines the permissions to protect the access to the RFID hardware. Permissions are checked by the platformprior to the access of the protected function. Some methods in this <strong>API</strong> are defined to throw a SecurityException ifthe caller does not have the permissions needed to perform the action. This must be enforced by an appropriate securityframework in the platform.Using the MIDP 2.x Security FrameworkOriginally the MIDP security model was defined in the MIDP 2.x Specification and the Recommended Security Policy. TheJava Technology for the Wireless Industry (JTWI), JSR 185 Specification defines the policy for the third-party domain("untrusted domain"). The Mobile Service Architecture (MSA) makes the four protection domains defined in the MIDP 2.xmandatory and defines the recommended security policies for the domains. A MIDlet suite can belong to one of the fourdomains:• Manufacturer domain• Operator domain• Identified third-party domain• Third-party domainIf this <strong>API</strong> is implemented on the MIDP 2.x platform, the security framework of MIDP 2.x must be used as defined below.The table below defines the names of the permissions used and the methods that are protected by that permission.Table A.1. Permissions in MIDP 2.x security frameworkPermission namejavax.microedition.contactless.DiscoveryManagerjavax.microedition.contactless.ndef.NDEFTagConnection.writejavax.microedition.io.Connector.ndefjavax.microedition.io.Connector.rfjavax.microedition.io.Connector.scjavax.microedition.io.Connector.vtagMethods protected by this permissionDiscoveryManager.getInstance()<strong>Contactless</strong>Connection.write(NDEFMessage message)opening NDEFTagConnectionopening PlainTagConnectionopening ISO14443Connectionopening VisualTagConnectionThe permissions must be placed into some function group. This specification does not mandate any particular functiongroup. This is left to the Mobile Service Architecture work to decide.Security on top of CDC configurationSince the <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> can be implemented on top of CDC configuration or in devices with MIDP 3 profile,this appendix defines the security permissions for that environment.The implementations of <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong> on configurations and profiles that use the fine grained securitypermissions based on java.security.Permission security checks must include corresponding permission classesdefined in this specification. The table below lists the methods that must perform permission checks and the requiredpermission classes.66


Table A.2. Class based permissions<strong>API</strong> callDiscoveryManager.getInstance()NDEFTagConnection.write(NDEFMessage message)Opening NDEFTagConnectionOpening PlainTagConnectionOpening ISO14443ConnectionOpening VisualTagConnectionRequired permission class<strong>Contactless</strong>Permission("discoveryManager.getInstance")<strong>Contactless</strong>Permission("ndef.write")NDEFProtocolPermissionRFProtocolPermissionSCProtocolPermissionVTagProtocolPermissionBelow are the listings of the permission classes defined in this specification.<strong>Contactless</strong>Permissionpackage javax.microedition.contactless;import java.security.BasicPermission;/*** This permission class represents access rights to general functionality of* <strong>Contactless</strong> <strong>Communication</strong> <strong>API</strong>. Separate permission classes are defined for the* protocols used to open the connections to contactless targets. These* permission classes can be found from the separate target packages.** A <strong>Contactless</strong>Permission contains a name (also referred to as* a "target name") but no actions list. The protected <strong>API</strong> calls and* corresponding target names are:** <strong>API</strong> call: DiscoveryManager.getInstance* Permission target name: discoveryManager.getInstance** <strong>API</strong> call: NDEFTagConnection.write* Permission target name: ndef.write** * * <strong>API</strong> call checking the permission* Permission target name* * * DiscoveryManager.getInstance* discoveryManager.getInstance* * * NDEFTagConnection.write* ndef.write* * ** As defined for BasicPermission the naming follows the* hierarchical property naming convention. An asterisk may appear by itself, or* if immediately preceded by a "." may appear at the end of the name, to signify* a wildcard match.** The action string is unused.** @author Nokia Corporation* @version 1.1*/public class <strong>Contactless</strong>Permission extends BasicPermission {/**67


}* Creates a new <strong>Contactless</strong>Permission instance with the* specified name. The name string should conform to the specification given* in the class description and follow the naming conventions described in* BasicPermission class.** @param name the name of the permission* @throws NullPointerException if name is null* @throws IllegalArgumentException if name is an empty string*/public <strong>Contactless</strong>Permission(String name) {}/*** Creates a new <strong>Contactless</strong>Permission instance with the* specified name. The name string should conform to the specification given* in the class description and follow the naming conventions described in* BasicPermission class. The actions parameter is* unused and should be null.** @param name the name of the permission* @param actions ignored* @throws NullPointerException if name is null* @throws IllegalArgumentException if name is an empty string*/public <strong>Contactless</strong>Permission(String name, String actions) {}►NDEFProtocolPermissionpackage javax.microedition.contactless.ndef;import java.security.Permission;import java.security.PermissionCollection;import javax.microedition.io.GCFPermission;/*** This class represents access rights to connections via the "ndef" protocol.* An NDEFProtocolPermission consists of a URI string but no actions* list.** The URI takes the following general form:** ndef://{address_part}** The value of the {address_part} field is implementation specific.* This is because the URI is not visible to the application before an actual* target is available. The {address_part} field may also end with* an asterisk. An asterisk indicates a match with any address that begins with* the part left from the asterisk and is followed by zero or more additional* characters. The asterisk alone matches all addresses.** @author Nokia Corporation* @version 1.1*/public final class NDEFProtocolPermission extends GCFPermission {/*** Constructs NDEFProtocolPermission with the specified URI as* its name. The URI string should conform to the68


* specification given above.** @param uri the URI string* @throws IllegalArgumentException if uri is malformed* @throws NullPointerException if uri is null*/public NDEFProtocolPermission(String uri) {}/*** Checks if the NDEFProtocolPermission object "implies" the* specified permission. To determine whether this object implies another* permission, p, this method checks that the following is* true and returns false if it is not:** * p is an instanceof NDEFProtocolPermission,* and* p's name equals or (in the case of wildcards) is* implied by this object's name.* ** @param p the permission to check against* @return true if the specified permission p is* implied by this object, false if not*/public boolean implies(Permission p) {}/*** Returns the canonical string representation of the actions. Since there* are no actions defined for NDEFProtocolPermission an* empty string "" is returned.** @return an empty string ""*/public String getActions() {}/*** Returns a new PermissionCollection for storing* NDEFProtocolPermission objects.** NDEFProtocolPermission object must* be stored in a manner that allows them to be inserted into the collection* in any order, but that also enables the PermissionCollection.implies* method to be implemented in an effective (and consistent) manner.** @return a new PermissionCollection object suitable for storing* NDEFProtocolPermission objects*/public PermissionCollection newPermissionCollection() {}/*** Checks two NDEFProtocolPermission objects for equality.** @param obj the object whose equality with this object is tested* @return true if obj is a* NDEFProtocolPermission and has the same URI string* as this NDEFProtocolPermission object*/public boolean equals(Object obj) {}69


}/*** Returns the hash code value for this object.** @return the hash code value for this object*/public int hashCode() {}RFProtocolPermission►package javax.microedition.contactless.rf;import java.security.Permission;import java.security.PermissionCollection;import javax.microedition.io.GCFPermission;/*** This class represents access rights to connections via the "rf" protocol.* A RFProtocolPermission consists of a URI string but no actions* list.** The URI takes the following general form:** rf://{address_part}** The value of the {address_part} field is implementation specific.* This is because the URI is not visible to the application before an actual* target is available. The {address_part} field may also end with* an asterisk. An asterisk indicates a match with any address that begins with* the part left from the asterisk and is followed by zero or more additional* characters. The asterisk alone matches all addresses.** @author Nokia Corporation* @version 1.1*/public final class RFProtocolPermission extends GCFPermission {/*** Constructs RFProtocolPermission with the specified URI.* The URI string should conform to the* specification given above.** @param uri the URI for the protocol* @throws IllegalArgumentException if uri is malformed* @throws NullPointerException if uri is null*/public RFProtocolPermission(String uri) {}/*** Checks if the RFProtocolPermission object "implies" the* specified permission. To determine whether this object implies another* permission, p, this method checks that the following is* true and returns false if it is not:** * p is an instanceof RFProtocolPermission, and* p's name equals or (in the case of wildcards) is implied by70


}* this object's name.* ** @param p the permission to check against* @return true if the specified permission p is* implied by this object, false if not*/public boolean implies(Permission p) {}/*** Returns the canonical string representation of the actions. Since there* are no actions defined for RFProtocolPermission an* empty string "" is returned.** @return an empty string ""*/public String getActions() {}/*** Returns a new PermissionCollection for storing* RFProtocolPermission objects.** RFProtocolPermission object must* be stored in a manner that allows them to be inserted into the collection* in any order, but that also enables the PermissionCollection.implies* method to be implemented in an effective (and consistent) manner.** @return a new PermissionCollection object suitable for storing* RFProtocolPermission objects*/public PermissionCollection newPermissionCollection() {}/*** Checks two RFProtocolPermission objects for equality.** @param obj the object whose equality with this object is tested* @return true if obj is a* RFProtocolPermission and has the same URI string as* this RFProtocolPermission object*/public boolean equals(Object obj) {}/*** Returns the hash code value for this object.** @return the hash code value for this object*/public int hashCode() {}SCProtocolPermission►package javax.microedition.contactless.sc;import java.security.Permission;import java.security.PermissionCollection;71


import javax.microedition.io.GCFPermission;/*** This class represents access rights to connections via the "sc" protocol.* A SCProtocolPermission consists of a URI string but no actions* list.** The URI takes the following general form:** sc://{address_part}** The value of the {address_part} field is implementation specific.* This is because the URI is not visible to the application before an actual* target is available. The {address_part} field may also end with* an asterisk. An asterisk indicates a match with any address that begins with* the part left from the asterisk and is followed by zero or more additional* characters. The asterisk alone matches all addresses.** @author Nokia Corporation* @version 1.1*/public final class SCProtocolPermission extends GCFPermission {/*** Constructs SCProtocolPermission with the specified URI.* The URI string should conform to the* specification given above.** @param uri the URI for the protocol* @throws IllegalArgumentException if uri is malformed* @throws NullPointerException if uri is null*/public SCProtocolPermission(String uri) {}/*** Checks if the SCProtocolPermission object "implies" the* specified permission. To determine whether this object implies another* permission, p, this method checks that the following is* true and returns false if it is not:** * p is an instanceof SCProtocolPermission, and* p's name equals or (in the case of wildcards) is implied by* this object's name.* ** @param p the permission to check against* @return true if the specified permission p is* implied by this object, false if not*/public boolean implies(Permission p) {}/*** Returns the canonical string representation of the actions. Since there* are no actions defined for SCProtocolPermission an* empty string "" is returned.** @return an empty string ""*/public String getActions() {}72


}/*** Returns a new PermissionCollection for storing* SCProtocolPermission objects.** SCProtocolPermission object must* be stored in a manner that allows them to be inserted into the collection* in any order, but that also enables the PermissionCollection.implies* method to be implemented in an effective (and consistent) manner.** @return a new PermissionCollection object suitable for storing* SCProtocolPermission objects*/public PermissionCollection newPermissionCollection() {}/*** Checks two SCProtocolPermission objects for equality.** @param obj the object whose equality with this object is tested* @return true if obj is a* SCProtocolPermission and has the same URI string as* this SCProtocolPermission object*/public boolean equals(Object obj) {}/*** Returns the hash code value for this object.** @return the hash code value for this object*/public int hashCode() {}VTagProtocolPermission►package javax.microedition.contactless.visual;import java.security.Permission;import java.security.PermissionCollection;import javax.microedition.io.GCFPermission;/*** This class represents access rights to connections via the "vtag" protocol.* A VTagProtocolPermission consists of a URI string but no actions* list.** The URI takes the following general form:** vtag://{address_part}** The value of the {address_part} field is implementation specific.* This is because the URI is not visible to the application before an actual* target is available. The {address_part} field may also end with* an asterisk. An asterisk indicates a match with any address that begins with* the part left from the asterisk and is followed by zero or more additional* characters. The asterisk alone matches all addresses.*73


* @author Nokia Corporation* @version 1.1*/public final class VTagProtocolPermission extends GCFPermission {/*** Constructs VTagProtocolPermission with the specified URI.* The URI string should conform to the* specification given above.** @param uri the URI for the protocol* @throws IllegalArgumentException if uri is malformed* @throws NullPointerException if uri is null*/public VTagProtocolPermission(String uri) {}/*** Checks if the VTagProtocolPermission object "implies" the* specified permission. To determine whether this object implies another* permission, p, this method checks that the following is* true and returns false if it is not:** * p is an instanceof VTagProtocolPermission,* and* p's name equals or (in the case of wildcards) is* implied by this object's name.* ** @param p the permission to check against* @return true if the specified permission p is* implied by this object, false if not*/public boolean implies(Permission p) {}/*** Returns the canonical string representation of the actions. Since there* are no actions defined for VTagProtocolPermission an* empty string "" is returned.** @return an empty string ""*/public String getActions() {}/*** Returns a new PermissionCollection for storing* VTagProtocolPermission objects.** VTagProtocolPermission object must* be stored in a manner that allows them to be inserted into the collection* in any order, but that also enables the PermissionCollection.implies* method to be implemented in an effective (and consistent) manner.** @return a new PermissionCollection object suitable for storing* VTagProtocolPermission objects*/public PermissionCollection newPermissionCollection() {}/*** Checks two VTagProtocolPermission objects for equality.74


}** @param obj the object whose equality with this object is tested* @return true if obj is a* VTagProtocolPermission and has the same URI string* as this VTagProtocolPermission object*/public boolean equals(Object obj) {}/*** Returns the hash code value for this object.** @return the hash code value for this object*/public int hashCode() {}►75


Appendix B. Launching applications with MIDP2.x PushRegistryIn order to minimize memory consumption in the device and to improve usability of the RF applications, this specificationsprovides means for starting applications based on events on RFID hardware. This means that when a target of requestedtype or target containing the requested NDEF record appears in the proximity of the device, applications registered for thisevent are started.There are several ways to provide this functionality. PushRegistry defined in the MIDP 2.x specification is the mostsuitable way and it is well known in the developer community. The nature of RFID based communication has to be takeninto account when using PushRegistry. Even though application is started based on discovered contactless target, thetarget may not be available anymore when the application tries to open a connection to it. In this case, theConnector.open method throws an IOException. Following chapters describe how the application startup basedon RFID events is done using MIDP 2.x PushRegistry.NFC Forum NDEF record pushThis specification provides application startup based on targets that have NFC Forum NDEF records. Registration for startupis based on the record type name and format of the NDEF record. There can be one application for each record type nameand format pair registered for startup at a time. If data on the target contains more than one NDEF record, the startup isbased on the record type name and format of the first matching record in the data.When a target is discovered, the application management software checks the PushRegistry entries. If there is an entryfor the NDEF record type name and format in the target, the application having that entry is started. If there is noPushRegistry entry, notification about discovered NDEF record is sent to the registered application that has set theNDEFRecordListener for that NDEF record type.Table B.3. NDEF record push URL in BNF format::= "ndef:"?name=::= "rtd" | "external_rtd" | "mime" | "uri"::= String of US_ASCII characters, the fully qualified name ofthe record typeBelow are two examples of possible URLs for NDEF record push.ndef:rtd?name=urn:nfc:wkt:SpThis URL registers an application to be started when tag containing Smart Poster RTD is discovered.ndef:mime?name=text/x-uriThis registers an application to be started when tag containing an URL is discovered.Secure element push (card emulation mode)Application startup through PushRegistry is also provided for smart card target. In card emulation mode the smartcard contains valuables, such as bus ticket that are read from an external contactless reader. An application can requeststartup when a transaction with the external secure element is completed.Table B.4. Secure element push URL in BNF format::= "secure-element:"?aid=::= String of numerical characters. Identifier is the aid definedin ISO7816-5 specification. Masks can be used.There might be several applications interested in implementing the TransactionListener interface to receiveexternalTransactionDetected notifications. When transaction has actually happened and there is a PushRegistryentry for that particular smart card application identifier, the application having the PushRegistry entry will be started76


and it receives the externalTransactionDetected notification. Notification will also be sent to all other applicationsthat have registered the TransactionListener with the DiscoveryManager methods.Implementation notesUnlike the push connections defined in JSR 118 for MIDP 2.x, the protocol defined in this specification includes a mechanismwhere the notification about discovered targets is held until it is processed by the started application.When the application is started in response to a Push message, the application should immediately registerNDEFRecordListener to receive notifications about discovered NDEF record. This guarantees that the application willreceive the ndefRecordDetected notifications right away. If an application fails to register the listeners when started,the platform implementation may delete notifications that have been stored, if it becomes necessary to do so.77


Appendix C. Unique identifiers of targetsThe unique identifier of the target varies between different communication technologies. This appendix defines the rulesthat the <strong>API</strong> implementation must follow when constructing the UID for discovered target.For those NDEF_TAG target types that support Canonical Target ID String Presentation (CID) defined in the NFC Forum,that identifier must be used. The targets that do not support CID the return value must be according to the following table.Table C.5. UID generation rules<strong>Communication</strong> protocolISO14443-3/4 type A card or tag (e.g. Mifare UltraLight orMifare DesFire)ISO14443-3/4 type B card or tagNFCIP-1 212,424 kbits (e.g. FeliCa card)ISO144443-3 type A tag (e.g. Jewel tag)UID generation rule4,7 or 10 UID bytes from the cascade anti-collision procedure4 PUPI bytes (random) from the initialization procedure8 NFCID2 bytes (2 fixed + 6 random) from the initializationprocedure4 UID bytes (UID0 to UID3) from RID command78


Appendix D. Future itemsDuring the development of this specification version 1.0 some of the items originally planned to be included were left outfrom the specification. This specification provides Java <strong>API</strong> for the features defined by the NFC Forum. And as some of thespecifications needed in this Java <strong>API</strong> were not finalized in the NFC Forum during the development of this specification,these features were left out to be included in the later version. These features to be later included into the JSR 257specification include:• NFC peer-to-peer communication• Connection interfaces for the NFC Forum mandated tag typesNFC Forum peer-to-peer communication allows exchanging data between two NFC enabled devices. The protocol for thishalf-duplex communication is defined in the NFC Forum.The NFC Forum mandates the support for NDEF mapping to few physical tag types. In addition to this mapping, the NFCForum also publishes a set of commands that can be used to access the manufacturer specific parts and data structures inthe physical tags. The intent for this Java <strong>API</strong> is to provide standardized connection interfaces for these manufacturerspecific parts. The finalization of the public command sets was ongoing when this version 1.0 of this specification wasfinalized.79


Appendix E. Examples of RFID communicationThis appendix shows two examples how to communicate with RFID tag. In the first example the communication is doneusing PlainTagConnection interface. The second example is a reference example of the communication usingtarget-specific connection provided by the <strong>API</strong> implementation.PlainTagConnection example/*** RFID reader MIDlet*/public class PlainTagMIDlet extends MIDlet implements TargetListener {private DiscoveryManager dm;public PlainTagMIDlet() {// Register TargetListenerdm = DiscoveryManager.getInstance();try {dm.addTargetListener(this,TargetType.RFID_TAG);}catch (<strong>Contactless</strong>Exception ce) {// handle exception}}}// Target discoveredpublic void targetDetected(TargetProperties[] props) {TargetProperties target = null;// Select target that has the right mappingfor (int i = 0; i < props.length; i++) {if (props[i].getMapping().equals("MyMapping")) {target = props[i];break;}else {i++;}}// right target foundif (target != null) {// do the communication in separate threadMyThread thread = new MyThread(target);thread.start();}}. . ./*** RFID reader thread*/public class MyThread extends Thread {private TargetProperties target;public MyThread(TargetProperties target) {this.target = target;}public void run() {try {80


}}PlainTagConnection pconn =(PlainTagConnection)Connector.open(target.getUrl());Vector input = new Vector();Vector output = new Vector();String cmd = new String( "read" );Integer sector = new Integer(2);Integer block = new Integer(1);byte[] key = {(byte)0x1, (byte)0x2, (byte)0x3,(byte)0x4, (byte)0x5, (byte)0x6,(byte)0x7};byte[] dataRead = new byte[16];byte[] accessBits = new byte[4];input.addElement( cmd );input.addElement( sector );input.addElement( block );input.addElement( key );output.addElement( dataRead );output.addElement( accessBits );output = pconn.transceive(input);pconn.close();// Process the data}catch (IOException ioe) {// Handle exception}catch (<strong>Contactless</strong>Exception ce) {// handle exception}Target-specific connection exampleIn this example the target-specific connection class used is only an imaginary example and not specified in this specification.It is only used to illustrate how the use of target-specific connection classes provided by the <strong>API</strong> implementation can makethe communication with the RFID tag a bit easier./*** RFID reader MIDlet*/public class PlainTagMIDlet extends MIDlet implements TargetListener {private DiscoveryManager dm;public PlainTagMIDlet() {dm = DiscoveryManager.getInstance();try {dm.addTargetListener(this,TargetType.RFID_TAG);}catch (<strong>Contactless</strong>Exception ce) {// handle exception}}public void targetDetected(TargetProperties[] props) {TargetProperties target = null;if (props.length > 1) {// Multiple targets found, exitreturn;}target = props[0];// right target found81


}if (target != null) {// do the communication in separate threadMyThread thread = new MyThread(target);thread.start();}}. . ./*** RFID reader thread*/public class MyThread extends Thread {private TargetProperties target;public MyThread(TargetProperties target) {this.target = target;}}public void run() {Class[] connections = target.getConnectionNames();Class connClass = null;for (int i = 0; i < connections.length; i++) {if (connections[i].getName().equals("com.company.JSRTagConnection")) {// Right connection name foundconnClass = connections[i];break;}else {i++;}}if (connClass != null) {try {JSRTagConnection conn = (JSRTagConnection)Connector.open(target.getUrl(connClass));int sector = 2;int block = 1;byte[] key = {(byte)0x1, (byte)0x2, (byte)0x3,(byte)0x4, (byte)0x5, (byte)0x6,(byte)0x7};byte ret = conn.authenticate(sector, key);if (ret == 0) {ret = conn.writeData(block, "Hello world");String data = conn.readData(block);// Process the data}conn.close();}catch (IOException ioe) {// Handle exception}}}82


IndexAaddNDEFRecordListener, 14addTargetListener, 14addTransactionListener, 15appendPayload, 34appendRecord, 29CClasses<strong>Contactless</strong>Exception, 10DiscoveryManager, 11NDEFMessage, 28NDEFRecord, 33NDEFRecordType, 38SymbologyManager, 60TargetType, 23VisualTagCodingException, 62Constructors<strong>Contactless</strong>Exception(), 10<strong>Contactless</strong>Exception(java.lang.String), 10NDEFMessage(), 28NDEFMessage(byte[], int), 29NDEFMessage(NDEFRecord[]), 29NDEFRecord(byte[], int), 34NDEFRecord(NDEFRecordType, byte[], byte[]), 34NDEFRecordType(int, java.lang.String), 39VisualTagCodingException(), 62VisualTagCodingException(java.lang.String), 62<strong>Contactless</strong>Exception, 10<strong>Contactless</strong>Exception(), 10<strong>Contactless</strong>Exception(java.lang.String), 10DDiscoveryManager, 11EEMPTY, 39equals, 40exchangeData, 50EXTERNAL_RTD, 39externalReaderDetected, 25FFieldsEMPTY, 39EXTERNAL_RTD, 39ISO14443_CARD, 23MIME, 39NDEF_TAG, 23NFC_FORUM_RTD, 39PHYSICAL_SIZE_UNIT_INCH, 55PHYSICAL_SIZE_UNIT_MILLIMETER, 55PHYSICAL_SIZE_UNIT_PIXEL, 56RFID_TAG, 23UNKNOWN, 39UNKNOWN_SLOT, 25URI, 39VISUAL_TAG, 24GgenerateVisualTag, 63getConnectionNames, 20getFormat, 40getGenerateSymbologies, 61getId, 35getImageClasses, 61getImageProperties, 61getInstance, 15getLogicalUnitSize, 56getMapping, 20getName, 40getNameAsBytes, 41getNestedNDEFMessage, 35getNumberOfRecords, 29getPayload, 35getPayloadLength, 35getPhysicalHeigth, 56getPhysicalSizeUnit, 56getPhysicalWidth, 56getProperty, 15, 21, 56getPropertyKeys, 57getReadSymbologies, 61getRecord, 30getRecords, 30getRecordType, 35getRecordTypes, 31getResolution, 57getSupportedTargetTypes, 15getSymbology, 57getTargetTypes, 21getUid, 21getUrl, 21HhashCode, 41hasTargetType, 22IImageProperties, 54insertRecord, 31InterfacesImageProperties, 54ISO14443Connection, 49NDEFRecordListener, 37NDEFTagConnection, 42PlainTagConnection, 46TagConnection, 18TargetListener, 19TargetProperties, 20TransactionListener, 25VisualTagConnection, 63ISO14443_CARD, 23ISO14443Connection, 49MMethodsaddNDEFRecordListener, 14addTargetListener, 14addTransactionListener, 15appendPayload, 34appendRecord, 2983


equals, 40exchangeData, 50externalReaderDetected, 25generateVisualTag, 63getConnectionNames, 20getFormat, 40getGenerateSymbologies, 61getId, 35getImageClasses, 61getImageProperties, 61getInstance, 15getLogicalUnitSize, 56getMapping, 20getName, 40getNameAsBytes, 41getNestedNDEFMessage, 35getNumberOfRecords, 29getPayload, 35getPayloadLength, 35getPhysicalHeigth, 56getPhysicalSizeUnit, 56getPhysicalWidth, 56getProperty, 15, 21, 56getPropertyKeys, 57getReadSymbologies, 61getRecord, 30getRecords, 30getRecordType, 35getRecordTypes, 31getResolution, 57getSupportedTargetTypes, 15getSymbology, 57getTargetTypes, 21getUid, 21getUrl, 21hashCode, 41hasTargetType, 22insertRecord, 31readNDEF, 42readVisualTag, 64recordDetected, 37removeNDEFRecordListener, 16removeRecord, 31removeTargetListener, 16removeTransactionListener, 16setId, 35setLogicalUnitSize, 57setPhysicalHeight, 57setPhysicalSizeUnit, 58setPhysicalWidth, 58setProperty, 16, 58setRecord, 31setResolution, 58setSymbology, 59targetDetected, 19toByteArray, 32, 36transceive, 46writeNDEF, 43MIME, 39NNDEF_TAG, 23NDEFMessage, 28NDEFMessage(), 28NDEFMessage(byte[], int), 29NDEFMessage(NDEFRecord[]), 29NDEFRecord, 33NDEFRecord(byte[], int), 34NDEFRecord(NDEFRecordType, byte[], byte[]), 34NDEFRecordListener, 37NDEFRecordType, 38NDEFRecordType(int, java.lang.String), 39NDEFTagConnection, 42NFC_FORUM_RTD, 39PPHYSICAL_SIZE_UNIT_INCH, 55PHYSICAL_SIZE_UNIT_MILLIMETER, 55PHYSICAL_SIZE_UNIT_PIXEL, 56PlainTagConnection, 46RreadNDEF, 42readVisualTag, 64recordDetected, 37removeNDEFRecordListener, 16removeRecord, 31removeTargetListener, 16removeTransactionListener, 16RFID_TAG, 23SsetId, 35setLogicalUnitSize, 57setPhysicalHeight, 57setPhysicalSizeUnit, 58setPhysicalWidth, 58setProperty, 16, 58setRecord, 31setResolution, 58setSymbology, 59SymbologyManager, 60TTagConnection, 18targetDetected, 19TargetListener, 19TargetProperties, 20TargetType, 23toByteArray, 32, 36TransactionListener, 25transceive, 46UUNKNOWN, 39UNKNOWN_SLOT, 25URI, 39VVISUAL_TAG, 24VisualTagCodingException, 62VisualTagCodingException(), 62VisualTagCodingException(java.lang.String), 62VisualTagConnection, 6384


WwriteNDEF, 4385

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!