Hi there,
I am new to this, so please excuse me for any misunderstanding while at the same time I will appreciate if one can correct it.
I have been reading docs and working on samples esp for card-emulation mode. [simulator I am using is Nokia 6212 and 6131).
I am trying to get the E2E picture clear here for the communication that happens between the mobile device and the POS terminal [contactless reader] in card emulation mode.

If we have a requirement to build a mobile wallet which can hold multiple cards [credit/debit] issued by one party(bank) and allow the customer to use any of those card at the point of sale.
There are quite a number of things evident that we will need :
  1. as many cardlets for each card hosted on secure element [ we might use the SIM secure element instead of internal secure element]
  2. one midlet for the UI purpose to retrieve the balances of each card [interacting with the specific cardlet wrt to the card] hosted on the device memory.
  3. one midlet that controls the card in terms of setting the priority of the card to be used hosted on the device memory.
  4. one CRS application [cardlet using globalplatform api] that helps to control the registry of apps as SECM.

Now what is not clear, is the exact flow that happens and which components participate here.

say, the user launches the midlet (or it can be launched automatically using Push Registry) before the POS terminal and select the card (from the list of cards in his/her mobile wallet), this involves the calling the SECM cardlet using the JSR177, which will change the priority of the card.
Once the user has selected the card, user taps it on the POS reader and this should succeed in completing the transaction using the card selected.

As I understand the POS reader in the contactless mode will send the WUKA/WUKB commands along with RATS command and resulting in ATS response command followed by SELECT PSE command and then using the AID from the CFI received from the response.

But the missing links are the interaction between the NFC controller and the SIM [card emulation mode]. How does NFC controller passes the command to the exact AID when there are multiple secure element available such as SE on SIM and Internal SE.
Where do NFC controller route the command SELECT PSE and to which applet/application?
is the 1PAY.SYS.DDF01 file name fixed as I have seen at some places reference to 2PAY.SYS.DDF01... not sure what should be used? - I believe this should be standard.

NFC controller is more likely to be just a communication medium where it receive the tags/message from the POS reader (or another device) and passes to the appropriate device, which unit does that intelligent work? What is that unit that parses the NDEF message extract the APDU command and pass it appropriately?
How does the card-session is being maintained for the entire transaction?

is there any contactless applet/application also needs to be written as part of this? as the cardlet using the Javacard Framework are more likely to be just processing the APDU commands..

thanks,
archit