|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
public interface NfcController
This class controls the hardware features of the NFC Controller. Only a system-level application should use this class.
| Nested Class Summary | |
|---|---|
static class |
NfcController.Mode
|
| Method Summary | |
|---|---|
void |
firmwareUpdate(byte[] firmware,
NfcController.Mode mode)
Updates the firmware and/or the configuration of the NFC controller. |
String |
getFirmwareInfo(byte[] firmware)
Returns the name and the versio of a Firmware. |
int |
getFirmwareUpdateState()
Returns the current progress status of a firmware update operation. |
NfcController.Mode |
getMode()
Returns the current mode of the NFC controller. |
byte[] |
productionTest(byte[] testCommand)
Performs a NFC controller production test. |
void |
registerCardCollisionHandler(CollisionEventHandler handler)
Registers a new card collision handler. |
void |
registerExceptionEventHandler(NfcControllerExceptionEventHandler handler)
Starts monitoring the NFC controller exceptions. |
void |
registerUnknownCardHandler(boolean startDetection,
UnknownCardEventHandler handler)
Registers a new unknown card handler. |
void |
reset(NfcController.Mode mode)
Resets the NFC controller. |
void |
selfTest()
Performs self-test of the NFC controller. |
void |
switchStandbyMode(boolean standbyOn)
Switches the forced standby mode on or off. |
void |
unregisterCardCollisionHandler(CollisionEventHandler handler)
Unregisters a card collision handler registered with registerCardCollisionHandler(org.opennfc.hardware.CollisionEventHandler). |
void |
unregisterExceptionEventHandler(NfcControllerExceptionEventHandler handler)
Stops monitoring NFC controller exceptions registered with registerExceptionEventHandler(org.opennfc.hardware.NfcControllerExceptionEventHandler). |
void |
unregisterUnknownCardHandler(UnknownCardEventHandler handler)
Unregisters a unknown card handler registered with registerUnknownCardHandler(boolean, org.opennfc.hardware.UnknownCardEventHandler). |
| Method Detail |
|---|
void reset(NfcController.Mode mode)
throws NfcException
mode - the NFC controller mode be entered after the reset operation:
Mode.MAINTENANCE for the maintenance mode, orMode.ACTIVE for the active mode.IllegalArgumentException - if mode is null or has a wrong value.
IllegalStateException - reset() cannot be called while a reset is already pending.
NfcException - an error occured with the NFC Controller.
String getFirmwareInfo(byte[] firmware)
throws NfcException
firmware - the firmware buffer.
IllegalArgumentException - if firmware is null.
NfcException - if an error is detected in the firmware format.firmwareUpdate()
void firmwareUpdate(byte[] firmware,
NfcController.Mode mode)
throws NfcException
The NFC Controller firmware may be updated with a new version of the firmware software. The firmware file shall be provided by the NFC Controller manufacturer.
After a successful update operation, the NFC Controller is rebooted. The persistent information is reset to its default value.
The update operation may fail if it is not completed (due to a power loss for example)
or if the new firmware is not validated by the NFC Controller (wrong format, wrong version, or wrong signature).
In case of failed update, the previous version of the firmware or its persistent data may be corrupted.
This may cause the NFC Controller invalidating the current firmware and the NFC Controller mode becomes
Mode.NO_FIRMWARE. If the previous firmware and its persistent data are not corrupted,
the NFC Controller is rebooted in the mode Mode.MAINTENANCE
or Mode.ACTIVE.
The method getFirmwareInfo() retrieves the information of a firmware file.
The firmware update operation may require several seconds to complete.
The method getFirmwareUpdateState() may be used to follow the progression of the operation.
Important Note
If a UICC is connected by SWP to the NFC Controller, the UICC should be rebooted after a Firmware update. Rebooting the UICC may require rebooting the NFC device. The explanation is the following: When a firmware is downloaded in the NFC Controller, the UICC configuration stored in the NFC Controller is lost. There is no message in the ETSI specification to inform the UICC of this configuration loss. The UICC can rebuild the configuration only during UICC power up sequence.
The firmware update is provided in firmware. The format of this buffer is proprietary.
firmwareUpdate() should be called from one of the maintenance modes.
firmware - the firmware binary value.mode - the NFC controller mode to be entered after the update operation:
Mode.MAINTENANCE for the maintenance mode, orMode.ACTIVE for the active mode.IllegalArgumentException - if firmware is null.
IllegalArgumentException - if mode is null or has a wrong value.
IllegalStateException - firmwareUpdate() is called while the NFC controller is not in one the maintenance modes.
NfcException - with one of the following error code:
NfcErrorCode.TIMEOUT A timeout occured during the communication with the NFC controller.NfcErrorCode.BAD_FIRMWARE_FORMAT An error is detected in the format of the firmware update buffer.NfcErrorCode.BAD_FIRMWARE_VERSION The firmware is not compliant with the NFC Controller type,
with the NFC HAL Binding or with the current configuration of the NFC Controller.NfcErrorCode.BAD_FIRMWARE_SIGNATURE The signature of the firmware update buffer is not valid.NfcErrorCode.DURING_FIRMWARE_BOOT The new firmware does not boot correctly.getFirmwareUpdateState(),
getFirmwareInfo()int getFirmwareUpdateState()
firmwareUpdate()NfcController.Mode getMode()
void registerExceptionEventHandler(NfcControllerExceptionEventHandler handler)
throws NfcException
unregisterExceptionEventHandler() should be called to unregister the
listener.
handler - the NfcControllerExceptionEventHandler whose
NfcControllerExceptionEventHandler.onExceptionOccured()
method will be called when an exception is detected.
IllegalArgumentException - if handler is null.
IllegalArgumentException - if handler is already
registered.
NfcException - in case of a registration error occurs.unregisterExceptionEventHandler(),
NfcControllerExceptionEventHandlervoid unregisterExceptionEventHandler(NfcControllerExceptionEventHandler handler)
registerExceptionEventHandler(org.opennfc.hardware.NfcControllerExceptionEventHandler).
handler - the handler in case of exception
IllegalArgumentException - if handler is null.
IllegalArgumentException - if handler is not already
registered.registerExceptionEventHandler()
void selfTest()
throws NfcException
The test is executed and the method returns without exception if the test succeeds. The self-test must be executed when the NFC Controller is in maintenance mode. The precise description of the self test is provided in the documentation of the NFC Controller.
NfcException - if the test fails or if an error occurs.
byte[] productionTest(byte[] testCommand)
throws NfcException
The test parameters are given in a buffer. A result buffer is provided to receive a result. Production tests do not always return a test result. The test result is obtained from the measurements performed by external test devices.
Production tests shall be executed when the NFC Controller is in maintenance mode. Any ongoing production test should be stopped before starting a new test.
The precise description of the production tests and the associated parameters is provided in the release notes of the NFC HAL implementation for each NFC Controller.
testCommand - the test command to be executed.
NfcException - if an error occurs
void switchStandbyMode(boolean standbyOn)
throws NfcException
Calling switchStandbyMode() initiates the switch to the active mode or to the standby mode. The NFC Controller may need some time to switch to the requested mode after the return of the method. See NFC Controller Modes.
Should be called in one of the following modes:
standbyOn - if forced standby mode is enabled or not.
IllegalStateException - if the NFC Controller is not in a valid mode to call this method.
NfcException - if the standby mode is not supported by the NFC Controller.
void registerCardCollisionHandler(CollisionEventHandler handler)
throws NfcException
A collision is detected when the following conditions are met:
After a successful registration, the handler is called each time a new
card collision is detected. unregisterCardCollisionHandler() should be called to unregister the
listener.
handler - the CollisionEventHandler whose
CollisionEventHandler.onCollisionDetected() method will
be called when a collision has been detected.
IllegalArgumentException - if handler is null.
IllegalArgumentException - if handler is already registered.
NfcException - in case of a registration error occurs.unregisterCardCollisionHandler(),
CollisionEventHandlervoid unregisterCardCollisionHandler(CollisionEventHandler handler)
registerCardCollisionHandler(org.opennfc.hardware.CollisionEventHandler).
handler - the card detection handler.
IllegalArgumentException - if handler is null.
IllegalArgumentException - if handler is not already registered.registerCardCollisionHandler()
void registerUnknownCardHandler(boolean startDetection,
UnknownCardEventHandler handler)
throws NfcException
unregisterUnknownCardHandler() should be called to unregister the
listener.
startDetection - forces a permanent detection.handler - the UnknownCardEventHandler whose
UnknownCardEventHandler.onUnknownCardDetected() method
will be called when an unknown card has been presented.
IllegalArgumentException - if handler is null.
IllegalArgumentException - if handler is already
registered.
NfcException - in case of a registration error occurs.unregisterUnknownCardHandler(),
UnknownCardEventHandlervoid unregisterUnknownCardHandler(UnknownCardEventHandler handler)
registerUnknownCardHandler(boolean, org.opennfc.hardware.UnknownCardEventHandler).
handler - the unknown card handler.
IllegalArgumentException - if handler is null.
IllegalArgumentException - if handler is not already
registered.registerUnknownCardHandler()
|
Copyright © 2010-2011 Inside Secure |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||