|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
PlainTagConnection | This interface defines the basic mechanism to communicate with the different RFID tags that contain non-NFC Forum formatted data. |
Provides interfaces for physical RF targets.
This package defines a high level interface for accessing the most common contactless RF targets. These interfaces provide a physical level access to the targets.
Features of different contactless targets vary a lot. It would be impossible
for this API to support all these features. This API provides a high level
interface to access RFID_TAG
targets.
PlainTagConnection
can be used with physical RFID
targets that do not support NDEF and do not have target-specific interface
defined by the API implementation. This still requires that the API implementation
supports handling of that physical target type. Since PlainTagConnection
interface might be inconvenient to use, it should
be extended with target-specific connection interfaces to enable the efficient
use of the features 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 Contactless Communication API public class CCAPIExample implements TargetListener { private DiscoveryManager dm; public CCAPIExample() { registerTargetToDiscovery(); } public void registerTargetToDiscovery() { // Register RFID_TAG target to discovery } public void targetDetected(TargetProperties[] prop) { // Select first found target TargetProperties 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 } catch (IOException e) { // handle exception } } }
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |