org.opennfc
Class NfcManager

Object
  extended by org.opennfc.NfcManager

public final class NfcManager
extends Object

The NFC Manager class is the single-instance class used to access the Open NFC library.

Since:
Open NFC 4.0

Method Summary
 boolean getBooleanProperty(String property)
          Returns the value of a boolean property.
 CardEmulationRegistry getCardEmulationRegistry()
          Returns the single instance of the card emulation registry.
 CardListenerRegistry getCardListenerRegistry()
          Returns the single instance of the card listener registry.
static NfcManager getInstance(Object object)
          Returns the single instance of the NFC manager.
 int getIntegerProperty(String property)
          Returns the value of an integer property.
 NfcController getNfcController()
          Returns the single instance of NFC Controller.
 NfcTagManager getNfcTagManager()
          Returns the single instance of NFC Tag Manager.
 P2PManager getP2PManager()
          Returns the single instance of P2P Manager.
 String getProperty(String property)
          Returns the string value of a property.
 SeSlot[] getSeSlots()
          Returns the list of Secure Element Slots (including UICC).
 void setProperty(String property, boolean value)
          Sets the value of a boolean property.
 void setProperty(String property, int value)
          Sets the value of an integer property.
 void start()
          Starts the NFC Manager.
 void stop()
          Stops the NFC Manager.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static NfcManager getInstance(Object object)
Returns the single instance of the NFC manager.

Parameters:
object - a blind object provided to the Security Manager
Returns:
the NFC manager instance.
Throws:
SecurityException - if a security issue is detected

start

public void start()
           throws IllegalStateException,
                  NfcException
Starts the NFC Manager. This method shall be called once before any usage of the other NFC objects. Use stop() when the NFC objects are no longer used.

Throws:
IllegalStateException - if the NFC Manager is already started.
NfcException - if an error occurred in the initialization of the NFC Manager.
Since:
Open NFC 4.0
See Also:
stop()

stop

public void stop()
          throws NfcException,
                 IllegalStateException
Stops the NFC Manager. This method shall be called once when the NFC Manager is no longer used. The NFC manager is stopped even if an exception is thrown.

Throws:
IllegalStateException - if the NFC Manager is not started.
NfcException - if an error occurred in the event thread.
Since:
Open NFC 4.0
See Also:
start()

getProperty

public String getProperty(String property)
Returns the string value of a property. For the definition of the properties, see NFC Properties.

Parameters:
property - the identifier of the property.
Returns:
the property value.
Throws:
IllegalArgumentException - if the property is null.
IllegalArgumentException - if the property is not a string property.
SecurityException - if the calling application is not allowed to access this property.
Since:
Open NFC 4.0

getBooleanProperty

public boolean getBooleanProperty(String property)
Returns the value of a boolean property. For the definition of the properties, see NFC Properties.

Parameters:
property - the identifier of the property.
Returns:
the property value. false if the property is not a boolean property.
Throws:
IllegalArgumentException - if the property is null.
SecurityException - if the calling application is not allowed to access this property.
Since:
Open NFC 4.0

getIntegerProperty

public int getIntegerProperty(String property)
Returns the value of an integer property. For the definition of the properties, see NFC Properties.

Parameters:
property - the identifier of the property.
Returns:
the property value.
Throws:
IllegalArgumentException - if the property is null.
NumberFormatException - if the property is not an integer property.
SecurityException - if the calling application is not allowed to access this property.
Since:
Open NFC 4.0

setProperty

public void setProperty(String property,
                        boolean value)
Sets the value of a boolean property. For the definition of the properties, see NFC Properties.

Parameters:
property - the identifier of the property.
value - the property value.
Throws:
IllegalArgumentException - if the property is null.
IllegalArgumentException - if the property is not a boolean property.
IllegalArgumentException - if the property is read-only.
SecurityException - if the calling application is not allowed to access this property.
Since:
Open NFC 4.0

setProperty

public void setProperty(String property,
                        int value)
Sets the value of an integer property. For the definition of the properties, see NFC Properties.

Parameters:
property - the identifier of the property.
value - the property value.
Throws:
IllegalArgumentException - if the property is null.
IllegalArgumentException - if the property is not an integer property.
IllegalArgumentException - if the property is read-only.
SecurityException - if the calling application is not allowed to access this property.
Since:
Open NFC 4.0

getNfcTagManager

public NfcTagManager getNfcTagManager()
Returns the single instance of NFC Tag Manager.

Returns:
the NFC Tag Manager.

getSeSlots

public SeSlot[] getSeSlots()
Returns the list of Secure Element Slots (including UICC). If there is no Secure Element, the list is an empty array.

Returns:
the list of Secure Element Slots.
Throws:
SecurityException - if the calling application is not allowed to access the Secure Element(s).
Since:
Open NFC 4.3

getP2PManager

public P2PManager getP2PManager()
                         throws NfcException
Returns the single instance of P2P Manager.

Returns:
the P2P Manager.
Throws:
NfcException - if the platform doesn't support P2P feature.
SecurityException - if the calling application is not allowed to use the Peer to Peer protocol.
Since:
Open NFC 4.1

getCardListenerRegistry

public CardListenerRegistry getCardListenerRegistry()
Returns the single instance of the card listener registry.

Returns:
the card listener registry.
Throws:
SecurityException - if the calling application is not allowed to listen to cards.

getCardEmulationRegistry

public CardEmulationRegistry getCardEmulationRegistry()
Returns the single instance of the card emulation registry.

Returns:
the card emulation registry.
Throws:
SecurityException - if the calling application is not allowed to emulate cards.
Since:
Open NFC 4.1

getNfcController

public NfcController getNfcController()
Returns the single instance of NFC Controller.

Returns:
the NFC Controller instance.
Throws:
SecurityException - if the calling application is not allowed to access hardware.

Copyright © 2010-2011 Inside Secure
Except as noted, this content is licensed under Apache 2.0 License.