resetKernelAppData

Resets all application data stored in the EMV kernel for both contact and contactless transactions.

This method clears all previously loaded application configurations, parameters, and data from both contact and contactless EMV kernels. It effectively returns the kernel to a clean state preserving the kernel initialization.

Reset operations typically include:

  1. Contact application data removal - Clears all contact EMV application configurations

  2. Contactless application data removal - Clears all contactless kernel application settings

  3. Parameter cleanup - Removes application-specific parameters and configurations

  4. Memory cleanup - Frees allocated memory used for application data storage

Data cleared includes:

  • Application Identifiers (AIDs) and their associated parameters

  • Terminal configuration data specific to applications

  • Application selection priorities and preferences

  • Kernel-specific application settings and TLV data

  • Transaction limits and application-specific thresholds

Prerequisites:

  • EMV kernel environment must be initialized via initializeKernelEnvironment

  • No active transaction should be in progress

  • System should be in idle state

Post-conditions:

  • All application data is removed from both contact and contactless kernels

  • Kernels remain initialized but without application configurations

  • System is ready to receive new application data via configuration methods

  • Memory allocated for application data is freed

Usage scenarios:

  • Before loading new application configurations

  • During system maintenance or updates

  • When switching between different application sets

  • For error recovery when application data becomes corrupted

Thread safety: Implementation should ensure thread-safe reset operations. Concurrent access during reset should be handled gracefully to prevent data corruption.

Exceptions: This function MUST NOT throw any exception. Any error must be indicated through NexusRet Any unexpected error must be mapped as NexusRet.INTERR

Implementation notes:

  • Implementations should log detailed information about each reset step

  • Failed reset operations should provide clear error messages

  • Ensure atomic operation where possible (all or nothing)

  • Validate kernel state before and after reset operations

  • Does not throw any exception

Return

NexusRet indicating the reset operation result:

  • NexusRet.OK: All application data successfully cleared from both kernels

  • NexusRet.INTERR: Internal error during reset operation

  • Other values: Specific reset errors as defined by the implementation

Example usage:

    val result = emvPort.resetKernelAppData()
if (result == NexusRet.OK) {
// Application data cleared successfully
println("EMV kernel application data reset successfully")
// Now ready to load new application configurations
} else {
// Handle reset failure
println("Failed to reset EMV application data: $result")
}