endContactlessKernelAppDataLoad

Finalizes and commits all staged contactless application data into the EMV kernels.

This method completes the contactless application data loading sequence by validating, processing, and activating all application configurations that were previously loaded via setContactlessKernelAppData calls for various kernel types. It saves the configuration data to persistent storage and configures all contactless EMV kernels for transaction processing.

Prerequisites:

Operations performed:

  1. Buffer persistence - Saves current contactless application data buffer to XML storage

  2. Kernel configuration - Applies the validated configurations to all contactless EMV kernels

Post-conditions:

  • All staged contactless application data is committed and active in the respective kernels

  • Contactless EMV kernels are configured and ready for transaction processing

  • Application configurations are persisted to storage for future use

Thread safety: This method should be called from the same thread that performed the setContactlessKernelAppData calls to ensure data consistency and prevent configuration 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:

  • Validate that at least one contactless application configuration was loaded before finalizing

  • Log detailed information about the number of kernel types, applications committed and their AIDs

  • Ensure atomic operation where possible (all configurations committed or none)

  • Handle kernel-specific validation and configuration requirements

Return

NexusRet indicating the finalization result:

  • NexusRet.OK: All contactless application data committed successfully to the kernels

  • NexusRet.INTERR: Internal error during finalization or kernel configuration

  • Other values: Specific validation or configuration errors as defined by the implementation

Usage sequence: This method must be called after all desired setContactlessKernelAppData calls:

// Load multiple contactless application configurations for different kernel types
emvPort.setContactlessKernelAppData(KernelType.VISA, visaConfig)
emvPort.setContactlessKernelAppData(KernelType.MASTERCARD, mastercardConfig)
emvPort.setContactlessKernelAppData(KernelType.AMEX, amexConfig)

// Finalize and commit all contactless configurations
val result = emvPort.endContactlessKernelAppDataLoad()

if (result == NexusRet.OK) {
// All contactless applications committed successfully
println("Contactless EMV kernels configured with all application data")
// Kernels are now ready for contactless card transactions
} else {
// Handle finalization failure
println("Failed to finalize contactless application data: $result")
// May need to reset and reload application configurations
}

Timber log suggestion: Log total kernel types and AIDs committed.