Near field communication method and related device

By obtaining the device feature information of the NFC card reader, the card swiping interface of the NFC simulated card is automatically selected and displayed, which solves the problem that the electronic device cannot automatically select the appropriate card when there are multiple NFC simulated cards, and improves the execution efficiency and speed of NFC services.

CN120659030AActive Publication Date: 2025-09-16HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510623819.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2024-08-14
Filing Date
2024-12-05
Publication Date
2025-09-16
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

Existing electronic devices cannot automatically select a suitable NFC simulated card for data interaction when there are multiple NFC simulated cards, resulting in low efficiency of NFC service execution.

Method used

By receiving the detection frame and confirmation frame of the NFC card reader device, it obtains its device feature information, automatically selects and displays the appropriate NFC simulated card swiping interface, and conducts data interaction, including access control, door lock opening, vehicle unlocking, transaction payment and other services.

Benefits of technology

It improves the speed and efficiency of NFC card swiping, reduces user operation steps, and realizes instant NFC simulated card selection and data interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120659030A_ABST
    Figure CN120659030A_ABST
Patent Text Reader

Abstract

The invention provides a near field communication method and a related device, and when an electronic device enters a radio frequency field emitted by an NFC card reading device, the electronic device can receive a detection frame emitted by the NFC card reading device. The electronic device can send a detection acknowledgement frame to the NFC card reading device after receiving the detection frame, wherein the detection acknowledgement frame can be used for indicating that the electronic device has received the detection frame. The NFC card reading device can send a notification frame to the electronic device after receiving the detection frame, and the notification frame carries the device feature information of the NFC card reading device. After the electronic device receives the notification frame, the first NFC simulation card can be determined from one or more NFC simulation cards through the device feature information of the NFC card reading device. In this way, the electronic device can automatically and accurately select the appropriate NFC simulation card and quickly pop up the card swiping interface of the first NFC simulation card, and the NFC card swiping speed and efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The application number of the original application is 202411785060.9, and the original application date is December 5, 2024. The entire content of the original application is incorporated into this application by reference. Technical Field

[0002] The present application relates to the field of wireless communication technology, and in particular to a near field communication method and related devices. Background Art

[0003] With the development of wireless communication technology, near field communication (NFC) technology has been widely used. NFC technology is the integration and evolution of contactless radio frequency identification (RFID) and interconnection technology. In NFC technology, NFC devices with NFC function can be divided into three working modes when communicating through NFC technology: proximity coupling device (PCD) mode (also known as reader mode), proximity smart card (PICC) mode (also known as card emulation mode) and point-to-point (P2P) mode.

[0004] Currently, some NFC-enabled electronic devices (such as mobile phones, tablets, and wearable devices) support both PICC mode and PCD mode. Users can activate one or more NFC emulation cards in their electronic devices. When in PICC mode, the electronic device can simulate itself as a PICC that complies with NFC standards based on the data from the NFC emulation card and exchange data with an NFC device in PCD mode. If an electronic device has multiple NFC emulation cards activated, when it is near an NFC card reader, it can only use the default NFC emulation card to exchange data with the NFC card reader in an attempt to perform NFC services. However, if the default NFC emulation card cannot perform NFC services with the NFC card reader, the NFC service will fail. For example, an electronic device can have both an access card and a bank card activated, but the default NFC emulation card on the device is a bank card. When a user brings the electronic device close to the NFC card reader on a gate, the electronic device will be unable to open the door. The user must change the default NFC emulation card on the electronic device to the access card and then bring it close to the NFC card reader again to open the gate. This shows that the card swiping operation steps of electronic devices are complicated and the efficiency of electronic devices in performing NFC services is low. Summary of the Invention

[0005] The present application provides a near field communication method and related devices, which can improve the speed and efficiency of NFC card swiping.

[0006] In the first aspect, the present application provides a near-field communication method, comprising: after entering the radio frequency field of an NFC card reader device, receiving a Probe frame sent by the NFC card reader device, the Probe frame being used to indicate that the NFC card reader device supports a specified NFC protocol; sending a Probe ACK frame to the NFC card reader device, the Probe ACK frame being used to indicate that the electronic device supports the specified NFC protocol; receiving a Notify frame sent by the NFC card reader device, the Notify frame carrying device feature information of the NFC card reader device; based on the device feature information of the NFC card reader device, determining a first NFC simulated card from one or more NFC simulated cards on the electronic device, wherein different device feature information corresponds to different NFC simulated cards, and the device feature information of the NFC card reader device includes a service identifier and a device organization identifier, wherein the service identifier is used to indicate the type of NFC service supported by the NFC card reader device, and the device organization identifier is used to indicate the manufacturer that uses the NFC card reader device to provide NFC services.

[0007] Through a near-field communication method provided by an embodiment of the present application, an electronic device can receive a probe (Probe) frame emitted by an NFC card reader device when entering the radio frequency field emitted by an NFC card reader device. After receiving the Probe frame, the electronic device can send a probe confirmation (Probe Acknowledge, Probe ACK) frame to the NFC card reader device, and the Probe ACK frame can be used to indicate that the electronic device has received the Probe frame. After receiving the Probe frame, the NFC card reader device can send a notification (Notify) frame to the electronic device, wherein the Notify frame carries the device feature information of the NFC card reader device. After receiving the Notify frame, the electronic device can determine the first NFC simulated card from one or more NFC simulated cards through the device feature information of the NFC card reader device and display the card swiping interface of the first NFC simulated card. The electronic device can interact with the NFC card reader device through NFC to complete the card swiping service of the first NFC simulated card. In this way, the electronic device can automatically and accurately select the appropriate NFC simulated card and quickly pop up the card swiping interface of the first NFC simulated card, thereby improving the speed and efficiency of NFC card swiping.

[0008] In one possible implementation, the device feature information of the NFC card reader also includes a device group identifier, where the device group identifier is used to indicate the group to which the NFC service provided by the NFC card reader belongs. In this way, by including the service identifier, device organization identifier, and device group identifier in the device feature information, the target NFC simulated card can be accurately selected.

[0009] In one possible implementation, after determining a first NFC simulated card from one or more NFC simulated cards on the electronic device based on the device feature information of the NFC card reader, the method further includes: outputting a card swiping prompt for the first NFC simulated card, where the card swiping prompt for the first NFC simulated card is used to prompt the electronic device that the first NFC simulated card is being used to swipe the card. In this way, a card swiping prompt for the target NFC simulated card can be popped up immediately, allowing the user to instantly perceive the NFC card swiping process.

[0010] In one possible implementation, after determining a first NFC simulated card from one or more NFC simulated cards on the electronic device based on the device characteristic information of the NFC card reader, the method further includes: sending a Notify ACK frame to the NFC card reader, wherein the Notify ACK frame carries a first notification result, the first notification result being used to indicate that the electronic device has successfully selected the first NFC simulated card. In this way, the electronic device can notify the NFC card reader of the successful selection of the target NFC simulated card, allowing the NFC card reader to promptly execute subsequent NFC command interaction processes.

[0011] In a possible implementation, after sending the Notify ACK frame to the NFC card reader, the method further includes: performing data interaction with the NFC card reader via NFC to complete the card swiping service of the first NFC simulated card.

[0012] Among them, card swiping services may include opening access control, unlocking doors, unlocking vehicles, transaction payments, electronic ticket verification, digital certificate verification, and swiping transportation cards to get on and off the bus.

[0013] In one possible implementation, the data interaction with the NFC card reader device is performed through NFC to complete the card swiping service of the first NFC simulated card, specifically including: sending the card information of the first NFC simulated card to the NFC card reader device, and the card information of the first NFC simulated card is used by the NFC card reader device to perform the card swiping service of the first NFC simulated card; receiving the card swiping result of the first NFC simulated card sent by the NFC card reader device.

[0014] The card information of the first NFC simulated card may include one or more of access control information, key information, transaction account information, and electronic ticket information. The access control information may include one or more of the card number and the card number's expiration date. The key information may include one or more of the key code and the key code's expiration date. The transaction account information may include one or more of the transaction account identifier and the remaining balance in the transaction account. The electronic ticket information may include one or more of the electronic ticket code, the electronic ticket verification time, and the electronic ticket's expiration date.

[0015] In one possible implementation, before sending the card information of the first NFC simulated card to the NFC card reader device, the method also includes: receiving a mapping list query command sent by the NFC card reader device, the mapping list query command being used to request the electronic device to return a first mapping list to the NFC card reader device, the first mapping list being used to indicate the mapping relationship between device feature information and the identifier of a dedicated file DF; sending a mapping list query response to the NFC card reader device, the mapping list query response carrying the first mapping list; receiving a Select DF command sent by the NFC card reader device, the Select DF command carrying the identifier of the first DF; obtaining a first DF based on the identifier of the first DF through a first applet, the first DF including the card information of the first NFC simulated card; sending a second response to the NFC card reader device, the second response being used to indicate that the electronic device has successfully obtained the first DF; and obtaining the card information of the first NFC simulated card from the first DF.

[0016] In this way, the NFC card reader determines the identifier of the first DF from the first mapping list based on the device feature information of the NFC card reader, thereby reducing the processing and computing load of the NFC card device (e.g., electronic device, NFC tag card). For example, when a physical NFC tag card is close to the NFC card reader device, due to insufficient computing power of the NFC tag card, the NFC card reader device can read the first mapping list in the NFC tag card to select the first DF, thereby reducing the processing and computing load of the NFC tag card.

[0017] In one possible implementation, before receiving the mapping list query command sent by the NFC card reader, the method further includes: receiving a small program selection Select AID command sent by the NFC card reader, wherein the Select AID command carries the identifier of the first applet; in response to the small program selection Select AID command, based on the identifier of the first applet, determining the first applet from one or more applets; and sending a first response to the NFC card reader, wherein the first response is used to indicate that the electronic device has successfully selected the first applet. In this way, the first applet on the electronic device can be selected, and the first applet can perform subsequent encryption and decryption processes related to the card information of the first NFC simulated card.

[0018] In one possible implementation, the Notify frame also carries an identifier of the first Applet; before sending the card information of the first NFC simulated card to the NFC card reader, the method further includes: determining the identifier of a first DF corresponding to the device feature information of the NFC card reader based on the device feature information of the NFC card reader and a first mapping list, wherein the first mapping list is used to indicate the mapping relationship between the device feature information and the identifier of a dedicated file DF; obtaining the first DF based on the identifier of the first DF through the first applet; and obtaining the card information of the first NFC simulated card from the first DF. In this way, after receiving the Notify frame, the electronic device can determine the first Applet and obtain the first DF through the first Applet, thereby improving the NFC card swiping speed.

[0019] In one possible implementation, the first DF also includes a first external authentication key; and sending the card information of the first NFC simulated card to the NFC card reader device specifically includes: encrypting the card information of the first NFC simulated card using the first external authentication key and a first random number through the first applet to obtain encrypted data; and sending the encrypted data to the NFC card reader device, where the encrypted data is used by the NFC card reader device to decrypt the card information of the first NFC simulated card. The card information of the first NFC simulated card is used by the NFC card reader device to execute the card swiping service of the first NFC simulated card. In this way, the security of the card information of the first NFC simulated card during transmission can be improved.

[0020] In a possible implementation, before using the first external authentication key and the first random number to encrypt the card information of the first NFC simulated card to obtain encrypted data, the method also includes: receiving a card information acquisition command sent by the NFC card reader device, the card information acquisition command is used to request to obtain the card information of the first NFC simulated card; encrypting the card information of the first NFC simulated card using the first external authentication key and the first random number through the first Applet to obtain encrypted data, specifically including: responding to the card information acquisition command, using the first external authentication key and the first random number to encrypt the card information of the first NFC simulated card stored in the first DF to obtain encrypted data.

[0021] In one possible implementation, before receiving the card information acquisition command sent by the NFC card reader device, the method also includes: receiving a random number acquisition Get Challenge command sent by the NFC card reader device; generating the first random number through the first Applet in response to the Get Challenge command; sending a third response to the NFC card reader device, the third response carrying the first random number; receiving an external authentication command sent by the NFC card reader device, the external authentication command carrying an authentication ciphertext; decrypting the first random number from the authentication ciphertext using the first external authentication key in the first DF through the first Applet; and sending a fourth response to the NFC card reader device, the fourth response carrying a first authentication result, the first authentication result being used to indicate that the electronic device has successfully decrypted the first random number from the authentication ciphertext.

[0022] In one possible implementation, after receiving the card swiping result of the first NFC simulated card sent by the NFC card reader, the method further includes: outputting a prompt corresponding to the card swiping result of the first NFC simulated card. In this way, the user can be informed of the card swiping result immediately.

[0023] In one possible implementation, after receiving the card swipe result of the first NFC simulated card sent by the NFC card reader, the method further includes: sending a fifth response to the NFC card reader, where the fifth response is used to indicate that the electronic device has successfully received the card swipe result of the first NFC simulated card. In this way, the NFC card reader can immediately know that the electronic device has successfully received the card swipe result.

[0024] In the second aspect, the present application provides another near-field communication method, which is applied to an NFC card reader device, including: sending a Probe frame, which is used to indicate that the NFC card reader device supports a specified NFC protocol; receiving a ProbeACK frame sent by an electronic device, which is used to indicate that the electronic device supports the specified NFC protocol; sending a Notify frame to the electronic device, which carries device feature information of the NFC card reader device, and the Notify frame is used by the electronic device to determine a first NFC simulated card from one or more NFC simulated cards on the electronic device based on the device feature information of the NFC card reader device, wherein different device feature information corresponds to different NFC simulated cards, and the device feature information of the NFC card reader device includes a service identifier and a device organization identifier, wherein the service identifier is used to indicate the type of NFC service supported by the NFC card reader device, and the device organization identifier is used to indicate the manufacturer that uses the NFC card reader device to provide NFC services.

[0025] In a possible implementation, the device characteristic information of the NFC card reader device further includes a device group identifier, where the device group identifier is used to indicate a group to which the NFC service provided by the NFC card reader device belongs.

[0026] In one possible implementation, after sending the Notify frame to the electronic device, the method further includes: receiving a Notify ACK frame sent by the electronic device, where the Notify ACK frame carries a first notification result, and the first notification result is used to indicate that the electronic device has successfully selected the first NFC simulated card.

[0027] In a possible implementation, after receiving the Notify ACK frame sent by the electronic device, the method further includes: performing data interaction with the electronic device through NFC to complete the card swiping service of the first NFC simulated card.

[0028] In one possible implementation, the data interaction with the electronic device through NFC to complete the card swiping service of the first NFC simulated card specifically includes: receiving the card information of the first NFC simulated card sent by the electronic device; executing the card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card; and sending the card swiping result of the first NFC simulated card to the electronic device.

[0029] In one possible implementation, before receiving the card information of the first NFC simulated card sent by the electronic device, the method also includes: sending a mapping list query command to the electronic device, the mapping list query command is used to request the electronic device to return a first mapping list to the NFC card reader device, the first mapping list is used to indicate the mapping relationship between the device feature information and the identifier of the dedicated file DF; receiving a mapping list query response sent by the electronic device, the mapping list query response carries the first mapping list; sending a Select DF command to the electronic device, the Select DF command carries the identifier of the first DF, and the Select DF command requests to obtain the first DF; receiving a second response sent by the electronic device, the second response is used to indicate that the electronic device has successfully obtained the first DF.

[0030] In one possible implementation, before sending the mapping list query command to the electronic device, the method further includes: sending a Select AID command to the electronic device, wherein the Select AID command carries the identifier of the first Applet, and the Select AID command is used to request the electronic device to select the first Applet; and receiving a first response sent by the electronic device, wherein the first response is used to indicate that the electronic device has successfully selected the first Applet.

[0031] In a possible implementation, the Notify frame further carries an identifier of the first Applet, and the identifier of the first Applet is used by the electronic device to select the first Applet.

[0032] In one possible implementation, the first DF also includes a first external authentication key; the card information of the first NFC simulated card received from the electronic device specifically includes: receiving encrypted data sent by the electronic device; and decrypting the card information of the first NFC simulated card from the encrypted data using the first external authentication key and the first random number.

[0033] In a possible implementation, before receiving the encrypted data sent by the electronic device, the method further includes: sending a card information acquisition command to the electronic device, where the card information acquisition command is used to request acquisition of card information of the first NFC simulated card.

[0034] In one possible implementation, before sending a card information acquisition command to the electronic device, the method also includes: sending a Get Challenge command to the electronic device, the Get Challenge command being used to request the first Applet of the electronic device to generate the first random number; sending a third response to the NFC card reader device, the third response carrying the first random number; encrypting the first random number using the first external authentication key to obtain an authentication ciphertext; sending an external authentication command to the electronic device, the external authentication command carrying the authentication ciphertext; receiving a fourth response sent by the electronic device, the fourth response carrying a first authentication result, the first authentication result being used to indicate that the electronic device has successfully decrypted the first random number from the authentication ciphertext.

[0035] In one possible implementation, after receiving the card swiping result of the first NFC simulated card sent by the NFC card reader device, the method also includes: receiving a fifth response sent by the electronic device, and the fifth response is used to indicate that the electronic device has successfully received the card swiping result of the first NFC simulated card.

[0036] In a third aspect, the present application provides an NFC system, comprising: an electronic device and an NFC card reader device; wherein the NFC card reader device is used to send a detection Probe frame, which is used to indicate that the NFC card reader device supports a specified NFC protocol; the electronic device is used to receive the Probe frame after entering the radio frequency field of the NFC card reader device; the electronic device is also used to send a Probe ACK frame to the NFC card reader device after receiving the Probe frame, which is used to indicate that the electronic device supports the specified NFC protocol; the NFC card reader device is also used to send a Notify frame to the electronic device after receiving the Probe ACK frame, which Notify frame carries device feature information of the NFC card reader device; the electronic device is also used to determine a first NFC simulated card from one or more NFC simulated cards on the electronic device based on the device feature information of the NFC card reader device, wherein different device feature information corresponds to different NFC simulated cards, and the device feature information of the NFC card reader device includes a service identifier and a device organization identifier, wherein the service identifier is used to indicate the type of NFC service supported by the NFC card reader device, and the device organization identifier is used to indicate the manufacturer using the NFC card reader device to provide NFC services.

[0037] In a possible implementation, the device characteristic information of the NFC card reader device further includes a device group identifier, where the device group identifier is used to indicate a group to which the NFC service provided by the NFC card reader device belongs.

[0038] In a possible implementation, the electronic device is further configured to output a card swiping prompt for the first NFC simulated card, where the card swiping prompt for the first NFC simulated card is configured to prompt the electronic device that the first NFC simulated card is being used to swipe the card.

[0039] In one possible implementation, the electronic device is further used to send a Notify ACK frame to the NFC card reader device after determining the first NFC simulated card. The Notify ACK frame carries a first notification result, and the first notification result is used to indicate that the electronic device has successfully selected the first NFC simulated card.

[0040] In a possible implementation, the electronic device is further configured to, after sending a NotifyACK frame to the NFC card reader, perform data interaction with the NFC card reader through NFC to complete the card swiping service of the first NFC simulated card.

[0041] In a fourth aspect, an embodiment of the present application provides a near-field communication method, which is applied to an electronic device and is characterized in that the method includes: after entering the radio frequency field of an NFC card reader device, receiving a Probe frame sent by the NFC card reader device, the Probe frame is used to indicate that the NFC card reader device supports a first NFC protocol; sending a Probe ACK frame to the NFC card reader device, the Probe ACK frame is used to indicate that the electronic device supports the first NFC protocol; receiving a Notify frame sent by the NFC card reader device, the Notify frame carrying device feature information of the NFC card reader device; sending a NotifyACK frame to the NFC card reader device, wherein the Notify ACK frame is used to indicate that the electronic device has successfully received the Notify frame.

[0042] An NFC communication method is provided in an embodiment of the present application. Through the signaling interaction process of the access layer in the NFC communication method, the device feature information of the NFC card reader device is sent to the electronic device using a Notify frame, so that the electronic device can determine the target NFC service based on the device feature information of the NFC card reader device before performing data transmission at the application layer. In this way, the electronic device can prepare the data required for the target NFC service or output a prompt for the target NFC service before performing data transmission at the application layer. In this way, the electronic device and the NFC card reader device can complete different types of NFC services at the application layer after the same signaling interaction process at the access layer through NFC. The resources and costs of the electronic device are saved.

[0043] In one possible implementation, the device characteristic information of the NFC card reader device includes a service identifier and a device organization identifier, wherein the service identifier is used to indicate the type of NFC service supported by the NFC card reader device, and the device organization identifier is used to indicate the manufacturer that uses the NFC card reader device to provide NFC services. In this way, the electronic device 100 can determine the target NFC service based on the device characteristic information of the NFC card reader device 200 before performing application layer data transmission.

[0044] In one possible implementation, the device feature information of the NFC card reader also includes a device group identifier, where the device group identifier is used to indicate the group to which the NFC service provided by the NFC card reader belongs. In this way, by including the service identifier, device organization identifier, and device group identifier in the device feature information, the target NFC simulated card can be accurately selected.

[0045] In one possible implementation, after receiving the Notify frame sent by the NFC card reader, the method further includes: determining and outputting a card swiping prompt for the first NFC simulated card based on the device feature information of the NFC card reader 200, where the card swiping prompt for the first NFC simulated card is used to prompt the electronic device that the first NFC simulated card is being used to swipe the card. In this way, the card swiping prompt for the target NFC simulated card can be popped up immediately, allowing the user to immediately perceive the NFC card swiping process.

[0046] In one possible implementation, after sending a Notify ACK frame to the NFC card reader, the method further includes: receiving an applet selection command sent by the NFC card reader, the applet selection command carrying an identifier of a first applet; determining a first NFC simulated card corresponding to the first applet based on the identifier of the first applet; and sending card information of the first NFC simulated card to the NFC card reader via the first applet, the card information of the first NFC simulated card being used by the NFC card reader to perform a card swiping service for the first NFC simulated card. In this way, the electronic device can determine the first NFC simulated card corresponding to the first applet through the identifier of the first applet.

[0047] In a possible implementation, after sending the card information of the first NFC simulated card to the NFC card reader device through the first Applet, the method further includes: receiving a card swiping result of the first NFC simulated card sent by the NFC card reader device.

[0048] The card information of the first NFC simulated card may include one or more of access control information, key information, transaction account information, and electronic ticket information. The access control information may include one or more of the card number and the card number's expiration date. The key information may include one or more of the key code and the key code's expiration date. The transaction account information may include one or more of the transaction account identifier and the remaining balance in the transaction account. The electronic ticket information may include one or more of the electronic ticket code, the electronic ticket verification time, and the electronic ticket's expiration date.

[0049] In one possible implementation, determining the first NFC simulated card corresponding to the first applet based on the identifier of the first applet specifically includes: determining the first applet from one or more applets based on the identifier of the first applet; and determining, through the first applet, a first DF corresponding to the first NFC simulated card from the MF of the first applet, where the MF of the first applet includes one or more DFs, the one or more DFs include the first DF, and the first DF includes card information of the first NFC simulated card. In this way, the electronic device can obtain the card information of the first NFC simulated card from the MF of the first applet.

[0050] In one possible implementation, determining the first DF corresponding to the first NFC simulated card from the MF of the first Applet through the first Applet specifically includes: obtaining the MF of the first Applet through the first Applet, the MF of the first Applet including a first mapping list and one or more DFs; obtaining a first mapping table from the MF of the first Applet, the first mapping table being used to indicate a mapping relationship between device feature information and DF identifiers; determining the identifier of the first DF corresponding to the device feature information of the NFC card reader device from the MF of the first Applet based on the device feature information of the NFC card reader device and the first mapping list; and determining the first DF from the MF of the first Applet through the first Applet based on the identifier of the first DF. In this way, the first DF of the first NFC simulated card can be determined from the MF of the first Applet in combination with the device information of the NFC card reader device, thereby obtaining the card information of the first NFC simulated card from the first DF.

[0051] In one possible implementation, the first DF also includes a first external authentication key; sending the card information of the first NFC simulated card to the NFC card reader device through the first Applet specifically includes: encrypting the card information of the first NFC simulated card stored in the first DF using the first external authentication key and a first random number through the first Applet to obtain encrypted data; sending the encrypted data to the NFC card reader device, and the encrypted data is used by the NFC card reader device to decrypt the card information of the first NFC simulated card.

[0052] In a possible implementation, before using the first external authentication key and the first random number to encrypt the card information of the first NFC simulated card to obtain encrypted data, the method also includes: receiving a card information acquisition command sent by the NFC card reader device, the card information acquisition command is used to request to obtain the card information of the first NFC simulated card; encrypting the card information of the first NFC simulated card using the first external authentication key and the first random number through the first Applet to obtain encrypted data, specifically including: responding to the card information acquisition command, using the first external authentication key and the first random number to encrypt the card information of the first NFC simulated card stored in the first DF to obtain encrypted data.

[0053] In one possible implementation, before receiving the card information acquisition command sent by the NFC card reader device, the method also includes: receiving a Get Challenge command sent by the NFC card reader device; generating the first random number through the first Applet in response to the GetChallenge command; sending a third response to the NFC card reader device, the third response carrying the first random number; receiving an external authentication command sent by the NFC card reader device, the external authentication command carrying an authentication ciphertext; decrypting the first random number from the authentication ciphertext using the first external authentication key in the first DF through the first Applet; and sending a fourth response to the NFC card reader device, the fourth response carrying a first authentication result, the first authentication result being used to indicate that the electronic device has successfully decrypted the first random number from the authentication ciphertext.

[0054] In a possible implementation, after receiving the card swiping result of the first NFC simulated card sent by the NFC card reader, the method further includes: outputting a prompt corresponding to the card swiping result of the first NFC simulated card.

[0055] In one possible implementation, after receiving the swipe result of the first NFC simulated card from the NFC card reader, the method further includes: sending a fifth response to the NFC card reader, where the fifth response indicates that the electronic device has successfully received the swipe result of the first NFC simulated card. In this way, the user can be notified of the swipe result immediately.

[0056] In one possible implementation, after sending a Notify ACK frame to the NFC card reader device, the method further includes: receiving a parameter negotiation command sent by the NFC card reader device; and sending a parameter negotiation response to the NFC card reader device, where the parameter negotiation command and the parameter negotiation response are used by the NFC card reader device to negotiate data transmission parameters at the application layer with the electronic device.

[0057] In a possible implementation, the data transmission parameter includes any one or more of a maximum transmission rate and a maximum data transmission length during application layer data transmission.

[0058] In a fifth aspect, an embodiment of the present application provides an NFC simulated card selection method, which is applied to an NFC card reader device, the method including: sending a Probe frame, which is used to indicate that the NFC card reader device supports a first NFC protocol; receiving a Probe ACK frame sent by an electronic device, which is used to indicate that the electronic device supports the first NFC protocol; sending a Notify frame to the electronic device, which carries device feature information of the NFC card reader device; receiving a Notify ACK frame sent by the electronic device, wherein the Notify ACK frame is used to indicate that the electronic device has successfully received the Notify frame.

[0059] In one possible implementation, the device feature information of the NFC card reader device includes a service identifier and a device organization identifier, wherein the service identifier is used to indicate the type of NFC service supported by the NFC card reader device, and the device organization identifier is used to indicate the manufacturer that uses the NFC card reader device to provide NFC services.

[0060] In a possible implementation, the device characteristic information of the NFC card reader device further includes a device group identifier, where the device group identifier is used to indicate a group to which the NFC service provided by the NFC card reader device belongs.

[0061] In one possible implementation, after receiving the notification confirmation Notify ACK frame sent by the electronic device, the method also includes: sending a mini-program selection command to the electronic device, the mini-program selection command carries the identifier of the first Applet, and the mini-program selection command is used to request the electronic device to select the first Applet; receiving the card information of the first NFC simulated card sent by the electronic device through the first Applet; and executing the card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card.

[0062] In a possible implementation, after receiving the card information of the first NFC simulated card sent by the electronic device through the first Applet, the method further includes: sending a card swiping result of the first NFC simulated card to the electronic device.

[0063] In one possible implementation, the receiving of the card information of the first NFC simulated card sent by the electronic device through the first Applet specifically includes: receiving encrypted data sent by the electronic device through the first Applet; and decrypting the card information of the first NFC simulated card from the encrypted data using a first external authentication key and a first random number.

[0064] In one possible implementation, before using the first external authentication key and the first random number to decrypt the card information of the first NFC simulated card from the encrypted data, the method further includes: sending a card information acquisition command to the electronic device, where the card information acquisition command is used to request acquisition of the card information of the first NFC simulated card.

[0065] In one possible implementation, before sending a card information acquisition command to the electronic device, the method also includes: sending a Get Challenge command to the electronic device, the Get Challenge command being used to request the first Applet of the electronic device to generate the first random number; sending a third response to the NFC card reader device, the third response carrying the first random number; encrypting the first random number using the first external authentication key to obtain an authentication ciphertext; sending an external authentication command to the electronic device, the external authentication command carrying the authentication ciphertext; receiving a fourth response sent by the electronic device, the fourth response carrying a first authentication result, the first authentication result being used to indicate that the electronic device has successfully decrypted the first random number from the authentication ciphertext.

[0066] In one possible implementation, after receiving the card swiping result of the first NFC simulated card sent by the NFC card reader device, the method also includes: receiving a fifth response sent by the electronic device, and the fifth response is used to indicate that the electronic device has successfully received the card swiping result of the first NFC simulated card.

[0067] In one possible implementation, after receiving the Notify ACK frame sent by the electronic device, the method further includes: sending a parameter negotiation command to the NFC card reader device; receiving a parameter negotiation response sent by the electronic device, the parameter negotiation command and the parameter negotiation response being used by the NFC card reader device to negotiate data transmission parameters at the application layer with the electronic device.

[0068] In a possible implementation, the data transmission parameter includes any one or more of a maximum transmission rate and a maximum data transmission length during application layer data transmission.

[0069] In a sixth aspect, an embodiment of the present application provides an NFC system, including an electronic device and an NFC card reader; wherein the electronic device is used to execute the near-field communication method in the above-mentioned fourth aspect and any possible implementation of the fourth aspect; the NFC card reader is used to execute the near-field communication method in the above-mentioned fifth aspect and any possible implementation of the fifth aspect.

[0070] In a seventh aspect, an embodiment of the present application provides an electronic device, comprising one or more processors, one or more memories, and a transceiver. The transceiver and the one or more memories are coupled to the one or more processors, and the one or more memories are used to store a computer program. When the one or more processors execute the computer program, the near-field communication method according to the first aspect and any possible implementation of the first aspect is performed.

[0071] In an eighth aspect, an embodiment of the present application provides an NFC card reader device, comprising one or more processors, one or more memories, and a transceiver. The transceiver and one or more memories are coupled to the one or more processors, and the one or more memories are used to store a computer program. When the one or more processors execute the computer program, the near-field communication method according to the second aspect and any possible implementation of the second aspect is performed.

[0072] In a ninth aspect, embodiments of the present application provide an NFC device, comprising one or more processors, one or more memories, and a transceiver. The transceiver and one or more memories are coupled to the one or more processors, and the one or more memories are used to store a computer program. When the one or more processors execute the computer program, the near field communication method of the first aspect and any possible implementation of the first aspect is performed.

[0073] The NFC device may be an electronic device or an NFC tag card.

[0074] In the tenth aspect, an embodiment of the present application provides a computer storage medium storing a computer program. When the computer program is executed by a processor, it implements the near-field communication method in the above-mentioned first aspect and any possible implementation method of the first aspect.

[0075] In the eleventh aspect, an embodiment of the present application provides a computer storage medium storing a computer program. When the computer program is executed by a processor, the near field communication method in the above-mentioned second aspect and any possible implementation method of the second aspect is implemented.

[0076] In the twelfth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the near-field communication method in the above-mentioned first aspect and any possible implementation method of the first aspect.

[0077] In a thirteenth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the near-field communication method in the above-mentioned second aspect and any possible implementation method of the second aspect.

[0078] In the fourteenth aspect, an embodiment of the present application provides a chip system, comprising a processing circuit and an interface circuit, wherein the interface circuit is used to receive code instructions and transmit them to the processing circuit, and the processing circuit is used to run the code instructions to execute the near-field communication method in the above-mentioned first aspect and any possible implementation method of the first aspect.

[0079] In the fifteenth aspect, an embodiment of the present application provides a chip system, comprising a processing circuit and an interface circuit, wherein the interface circuit is used to receive code instructions and transmit them to the processing circuit, and the processing circuit is used to run the code instructions to execute the near-field communication method in the above-mentioned second aspect and any possible implementation method of the second aspect.

[0080] The beneficial effects of the above-mentioned third aspect, fifth aspect to fifteenth aspect and any possible implementation of the third aspect, fifth aspect to fifteenth aspect can refer to the beneficial effects of the above-mentioned first aspect, fourth aspect and any possible implementation of the first and fourth aspects, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0081] Figure 1 A schematic diagram of the NFC working principle provided in an embodiment of the present application;

[0082] Figure 2 A schematic diagram of the architecture of an NFC system provided in an embodiment of the present application;

[0083] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0084] Figure 4 A schematic diagram of an NFC protocol stack provided in an embodiment of the present application;

[0085] Figures 5A-5D A schematic diagram of a process in which a group of users manually select an NFC simulated card to swipe, provided in an embodiment of the present application;

[0086] Figure 6 A schematic diagram of a near field communication method according to an embodiment of the present application;

[0087] Figure 7A A schematic diagram of the frame format of a Probe frame provided in an embodiment of the present application;

[0088] Figure 7B A schematic diagram of the frame format of a Notify frame provided in an embodiment of the present application;

[0089] Figures 8A-8D A schematic diagram of a set of scenarios for automatically selecting an NFC simulated card swiping provided in an embodiment of the present application;

[0090] Figures 9A-9D A schematic diagram of another set of scenarios for automatically selecting an NFC simulated card swiping provided in an embodiment of the present application;

[0091] Figure 10 A schematic diagram of a near field communication method according to an embodiment of the present application;

[0092] Figure 11 A schematic diagram of the file structure of an MF provided in an embodiment of the present application;

[0093] Figure 12 A flowchart of an NFC simulated card selection method provided in another embodiment of the present application;

[0094] Figure 13 A schematic diagram of the card swiping process of the second NFC protocol provided in an embodiment of the present application;

[0095] Figure 14 A schematic diagram of a near field communication method when a first NFC protocol and a second NFC protocol coexist provided in an embodiment of the present application;

[0096] Figure 15 A schematic diagram of a flow chart of a near field communication method provided in another embodiment of the present application;

[0097] Figure 16 A schematic diagram of the frame format of a Notify frame provided in an embodiment of the present application;

[0098] Figure 17 A schematic diagram of the NFC simulated card swiping process in a near field communication method provided in an embodiment of the present application;

[0099] Figure 18 This is a schematic diagram of the specific card swiping process of the NFC simulated card provided in the embodiment of this application;

[0100] Figure 19 A schematic diagram of the file structure of an MF provided in another embodiment of the present application;

[0101] Figure 20AThis is the NFC simulated card swiping process in the near field communication method provided in another embodiment of the present application;

[0102] Figure 20B This is the NFC simulated card swiping process in the near field communication method provided in another embodiment of the present application;

[0103] Figure 21 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0104] Figure 22 A schematic diagram of the structure of a communication device provided in an embodiment of the present application;

[0105] Figure 23 A schematic structural diagram of another communication device provided in an embodiment of the present application;

[0106] Figure 24 A schematic structural diagram of another communication device provided in an embodiment of the present application;

[0107] Figure 25 A schematic diagram of the structure of another communication device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0108] The following is a clear and detailed description of the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship between related objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0109] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of the technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.

[0110] The following describes the working principle of NFC in the embodiments of the present application.

[0111] Figure 1 A schematic diagram showing an NFC working principle provided in an embodiment of the present application is shown.

[0112] like Figure 1As described, the two parties communicating using NFC technology may include a proximity coupling device (PCD) (also known as an NFC card reader) and a proximity smart card (PICC). Among them, the PCD can achieve contactless communication with the PICC in close proximity. The PCD and the PICC can allow near-field communication at a specific data rate (e.g., 106kbps, 212kbps, 424kbps, or 848kbps) and a specific frequency (e.g., 13.56MHz). The communication between the PCD and the PICC can occur within a close distance between the PCD and the PICC, for example, within a range of approximately 2 cm to 4 cm.

[0113] The PCD can generate high-frequency alternating current to generate a radio frequency field of a specified frequency (for example, 13.56MHz) and send data to the PICC through the radio frequency field. When the PICC is close to the PCD, it can sense the radio frequency field emitted by the PCD. After the PICC enters the radio frequency field emitted by the PCD, it can obtain energy from the radio frequency field of the PCD through electromagnetic induction, and use the obtained energy to generate electricity to drive the internal circuit of the PICC and analyze the data sent by the PCD through the radio frequency field, thereby realizing data transmission from the PCD to the PICC. The PICC can also send data to the PCD by load modulating the radio frequency field, thereby realizing data transmission from the PICC to the PCD.

[0114] In the embodiment of the present application, the PICC can be a physical NFC tag card, and some NFC devices (for example, mobile phones, tablets, smart watches and other electronic devices) can also simulate themselves into PICCs that comply with NFC standards through the data of the NFC simulation card to realize the functions of the PICC and perform NFC interaction with the PCD.

[0115] The following describes an NFC system provided in an embodiment of the present application.

[0116] Figure 2 FIG2 shows a schematic diagram of the architecture of an NFC system 10 provided in an embodiment of the present application.

[0117] like Figure 2 As shown, the NFC system 10 may include an electronic device 100 and an NFC card reader 200. The electronic device 100 can simulate itself as a PICC that complies with NFC standards by using the data information of an NFC emulated card to implement PICC functions. The NFC card reader 200 can function as a PCD to perform NFC interactions with the electronic device 100 in PICC mode.

[0118] In one possible implementation, the electronic device 100 may support both PICC mode and PCD mode. In PCD mode, the electronic device 100 may function as a PCD to transmit a radio frequency field to communicate with the PICC. In PICC mode, the electronic device 100 may function as a PICC to passively receive the radio frequency field transmitted by the PCD and perform NFC interaction with the PCD using load modulation technology.

[0119] In the embodiment of the present application, after the NFC function is enabled, the electronic device 100 can be in PICC mode. If the electronic device 100 supports both PCD mode and PICC mode, the electronic device 100 can switch between the PICC mode and the PCD mode in a time-sharing manner after the NFC function is enabled.

[0120] In the embodiment of the present application, the device type of the electronic device 100 can be any of a mobile phone, a tablet computer, a handheld computer, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), as well as smart home devices such as smart large screens and smart speakers, wearable devices such as smart bracelets, smart watches, and smart glasses, extended reality (XR) devices such as augmented reality (AR), virtual reality (VR), and mixed reality (MR), in-vehicle devices or smart city devices, etc.

[0121] The device type of the NFC card reader 200 can be any of a mobile phone, tablet computer, handheld computer, desktop computer, laptop computer, super mobile personal computer, netbook, cellular phone, personal digital assistant, as well as smart home devices such as smart large screens and smart speakers, wearable devices such as smart bracelets, smart watches, smart glasses, extended reality devices such as augmented reality, virtual reality, and mixed reality, vehicles, gates, smart door locks, card readers, payment terminals, ticket purchasing and / or ticket verification terminals, bank service terminals, ID card reading devices, etc.

[0122] The following is a schematic structural diagram of an electronic device 100 provided in an embodiment of the present application.

[0123] Figure 3 A schematic structural diagram of an electronic device 100 provided in an embodiment of the present application is shown.

[0124] like Figure 3As shown, the electronic device 100 may include a processor 101 and an NFC module 102. Among them, one or more applications may be running in the processor 101. Among them, the one or more applications may include one or more of a wallet application, one or more host-based card emulation (HCE) applications, etc. Optionally, the electronic device 100 may further include a secure element (SE) 103 and / or a subscriber identity module (SIM) card. The processor 101 may be connected to the NFC module 102, SE103, and SIM card 104 respectively. The NFC module 102 may also be connected to the SE103 and the SIM card 104.

[0125] The NFC module 102 may include an NFC controller ( Figure 3 Not shown), NFC transceiver ( Figure 3 Not shown) and NFC memory ( Figure 3 The NFC controller may be connected to the processor 101, and the NFC controller may also be connected to the NFC transceiver and the NFC memory respectively.

[0126] The NFC controller is primarily used for modulating and demodulating contactless communication signals, controlling the input and output of data in the NFC memory, and interacting with the processor 101. The NFC transceiver is used to transmit and receive NFC signals (e.g., 13.56 MHz radio frequency signals). It may include electromagnetic compatibility (EMC) filtering circuits, matching circuits, receiving circuits, and an NFC antenna, among others. The NFC antenna may be a loop antenna that implements the proximity-based contactless communication capabilities of the NFC module 102. The NFC memory may be used to store data sent by the NFC module 102 to the NFC card reader 200, as well as data received from the NFC card reader 200. In some embodiments, the NFC memory may be a memory shared by all of the above components in the NFC module 102. For example, some data in the NFC memory may be accessed by the NFC controller, while other data may be accessed by the SE 103.

[0127] In other embodiments, the NFC memory may also be a collection of multiple memories. For example, the NFC controller may include a first memory from these multiple memories. The first memory may include instructions or data used or recycled by the NFC controller. If the NFC controller needs to use the instructions or data again, it can be directly called from the first memory, thereby reducing the waiting time of the NFC controller. SE103 may include a second memory from these multiple memories. The second memory may include card information of an NFC simulated card based on a secure element. In this way, if SE103 needs to read the card information of the NFC simulated card, the card information of the NFC simulated card can be read from the second memory in SE103. SIM card 104 may include a third memory from these multiple memories. The third memory may include card information of an NFC simulated card based on a SIM card. In this way, if SIM card 104 needs to read the card information of the NFC simulated card, the card information of the NFC simulated card can be read from the third memory in SIM card 104.

[0128] In some embodiments, the NFC memory may also store routing information. In some embodiments, the routing information may be controlled or managed by the NFC controller, and the routing information may include a routing table consisting of a list of routing rules. Each routing rule includes an applet identifier (AID) and a destination; the destination is where the applet for implementing the business logic of the NFC emulated card runs. The destination may include an HCE application running in the processor 101 of the electronic device 100, or an SE 103 or SIM card 104 connected to the NFC controller.

[0129] The SE 103 and the NFC module 102 may be two independent chips. Alternatively, the SE 103 and the NFC module 102 may be packaged in one chip.

[0130] The electronic device 100 can activate one or more NFC emulation cards in the application based on user input, thereby enabling the electronic device 100 to support one or more NFC services. The service processing logic of the NFC emulation card in the electronic device 100 is specifically implemented by an applet. The applet can be stored and run in the hardware device or software module corresponding to the NFC emulation card (for example, HCE application, SIM card, SE, etc.).

[0131] The card emulation mode on the electronic device 100 can be divided into a hardware-based virtual card mode (virtualcardmode) and a software-based HCE mode.

[0132] 1. In the hardware-based virtual card mode, the electronic device 100 can provide the operating environment of the Applet corresponding to the NFC simulated card and the storage and processing of the business data of the NFC simulated card through SE103 or SIM card 104. As the front end of contactless communication, the NFC module 102 forwards the command received from the external PCD to SE103 or SIM card 104, which is then processed by the Applet in SE103 or SIM card 104 and sends response data to the external PCD through the NFC module 102. The user can activate one or more NFC simulated cards in the wallet application, and the wallet application can write the applets and card data of one or more NFC simulated cards into SE103. Alternatively, the user can activate one or more NFC simulated cards in the SIM card application. The SIM card application can write the applets and card data of one or more NFC simulated cards into the SIM card 104 for storage.

[0133] 2. In the software-based HCE mode, the HCE application running in the processor 101 can provide the operating environment of the Applet corresponding to the NFC simulated card and the storage and processing of the business data of the NFC simulated card. After receiving the command sent by the external PCD, the NFC module 102 can send the command to the HCE application. The HCE application can process the command received by the NFC module through the Applet or cloud server running in the HCE application, and generate response data to the PCD. The HCE application can send the response data to the NFC module 102. The NFC module 102 can send the response data to the external PCD. The user can activate one or more NFC simulated cards in the HCE application, and the HCE application can run one or more NFC simulated card applets and save the card data of the NFC simulated card in the local memory of the electronic device 100 or on the cloud server.

[0134] Optionally, the processor 101 may also run an NFC basic service module. The NFC basic service module may be used to provide common management functions for one or more NFC services. The common management functions may include file management, card long-term activation, security management, service routing management, and other functions.

[0135] For example, in the above-mentioned card emulation scenario, a native application related to NFC is installed in the electronic device 100. In addition, the user can also download and install a third-party application in the electronic device 100 through the application store. Generally speaking, the native application can adopt a hardware-based virtual card solution, while the third-party application can adopt an HCE solution. The native application can be a wallet application, etc., and the third-party application can be, for example, Alipay, PayPal, WeChat application, etc. The above examples are only used to explain this application and should not be construed as limiting.

[0136] The following describes an NFC protocol stack provided in an embodiment of the present application.

[0137] Figure 4 A schematic diagram of an NFC protocol stack provided in an embodiment of the present application is shown.

[0138] like Figure 4 As shown, the NFC protocol stack may include a physical layer, a radio frequency layer, an access layer, a transport layer, and an application layer.

[0139] Among them, the physical layer can be used to implement the physical characteristics of NFC technology communication.

[0140] The radio frequency layer can be used to implement radio frequency specifications during NFC technology communication, such as data rate, frequency of radio frequency signals, etc.

[0141] The access layer can be used to implement polling and device discovery, service result notification, card conflict management, transmission protocol negotiation, timeout and retransmission mechanism, PICC / PCD mode switching, and integrated card selection.

[0142] The transport layer includes a high-speed data transmission protocol, through which data transmission between the PCD and the PICC at the application layer can be achieved.

[0143] The application layer can be used to implement one or more NFC services and one or more service management policies. Among them, one or more NFC services may include codeless payment, electronic tickets, access control, digital ID cards, full-scene touch, short-range data transmission, etc. One or more business management policies may include any one or more of file management, long-term card activation, security management, and service routing management. The processing logic of the NFC service can be executed by an applet. In one possible implementation, the processing logic of the service management policy can be executed by the NFC basic service module.

[0144] The following describes a process in which a user manually selects an NFC simulated card swipe on the electronic device 100 in an embodiment of the present application.

[0145] Figures 5A-5DA schematic diagram of a process in which a group of users manually select an NFC simulated card to swipe is shown in an embodiment of the present application.

[0146] like Figure 5A As shown, the electronic device 100 can display a desktop 510. The desktop 510 may include one or more application icons. For example, the one or more application icons may include a wallet application icon 511, a clock application icon, a settings application icon, a recorder application icon, a dial application icon, a message application icon, a contact application icon, and a camera application icon. A status bar 512 may be displayed at the top of the desktop 510. The status bar 512 may include one or more status indicators, which may include but are not limited to a strength indicator of a communication signal (e.g., a cellular network signal, a WLAN signal), a time indicator, a battery indicator, an NFC function indicator 513, a time indicator, and the like. When the electronic device 100 displays the NFC function indicator 513 in the status bar 512, it may indicate that the electronic device 100 has turned on the NFC function.

[0147] The electronic device 100 may receive a user input (eg, a single click) on the wallet application icon 511. In response to the input, the electronic device 100 may display the following information: Figure 5B Wallet application interface 520 is shown.

[0148] like Figure 5B As shown, the wallet application interface 520 may include one or more functional controls, wherein the one or more functional controls may include a card package control 521, a payment control, a ride control, and a door opening control.

[0149] The electronic device 100 may receive a user input to the card package control 521 (eg, a single click). In response to the input, the electronic device 100 may display the following information: Figure 5C The card wallet interface 530 is shown.

[0150] like Figure 5C As shown, the card package interface 530 may include options for one or more types of NFC simulated cards activated by the user. Among them, the options for one or more types of NFC simulated cards may include options for transportation cards, access control cards, smart door lock key cards, and car key cards. For example, the transportation card options may include options for Shenzhentong transportation cards. The access control card options may include options 531 for the access control card for community A, options for the access control card for community B, options for the access control card for community C, and the like. The smart door lock key card options may include options for the door lock key card for home. The car key card options may include options for the key card for vehicle M9.

[0151] The electronic device 100 may receive a user input (eg, a single click) on the option 531 for the access card of the A cell. In response to the input, the electronic device 100 may display the following information: Figure 5D The card swipe interface 540 is shown.

[0152] like Figure 5D As shown, the card swiping interface 540 may include an icon 541 of the access card of community A. Optionally, the card swiping interface 540 may also include a card swiping prompt 542, wherein the type of the card swiping prompt 542 may include one or more of a text prompt, a picture prompt, a sound prompt, a vibration prompt, etc. For example, the card swiping prompt 542 may be a text prompt "Please place the back of the phone on the card reader to swipe the card". Optionally, the card swiping interface 540 may also include a default card setting control 543, an edit control 544 and a delete control 545. Among them, the default card setting control 543 can be used to set the access card of community A to the default NFC simulated card. The edit control 544 can be used to edit the name of the access card of community A. The delete control 545 can be used to delete the data of the access card of community A.

[0153] When the electronic device 100 displays the card swiping interface 540, if it is close to an NFC card reader, it can use the data of the NFC simulated card corresponding to the card swiping interface 540 (for example, the access card of Community A) to interact with the NFC card reader. If the NFC simulated card corresponding to the card swiping interface 540 matches the NFC card reader, the electronic device 100 and the NFC card reader can complete the NFC service of the NFC simulated card corresponding to the card swiping interface 540. For example, the electronic device 100 completes verification with the NFC card reader on the gate of Community A using the data of the access card of Community A, thereby opening the gate of Community A.

[0154] As can be seen from the above card swiping process, when a user wants to use the electronic device 100 in PICC mode to perform a target NFC service, they need to open the application and manually select the target NFC simulated card corresponding to the target NFC service, and then place the electronic device 100 close to the NFC card reader to complete the target NFC service. In this way, every time the user wants to use the NFC service, they need to open the application and reselect the target NFC simulated card, which is very inconvenient for the user.

[0155] In one possible implementation, the user can set a commonly used NFC simulated card as the default NFC simulated card in the application. In this way, when the electronic device 100 is close to the NFC card reader, the electronic device 100 can use the data of the default NFC simulated card to interact with the NFC card reader. However, when the default NFC simulated card does not match the NFC card reader, the user needs to open the application on the electronic device 100 and reselect the target NFC simulated card to interact with the NFC card reader. It is impossible for the electronic device 100 to automatically and accurately select the appropriate NFC simulated card.

[0156] Therefore, an embodiment of the present application provides an NFC simulated card selection method. When an electronic device 100 enters the radio frequency field emitted by an NFC card reader 200, the electronic device 100 can receive a probe frame emitted by the NFC card reader 200. After receiving the probe frame, the electronic device 100 can send a probe acknowledgement (Probe ACK) frame to the NFC card reader 200. The Probe ACK frame can be used to indicate that the electronic device 100 has received the probe frame. After receiving the probe frame, the NFC card reader 200 can send a notification (Notify) frame to the electronic device 100, wherein the Notify frame carries device feature information of the NFC card reader. After receiving the Notify frame, the electronic device 100 can determine a first NFC simulated card from one or more NFC simulated cards based on the device feature information. The electronic device 100 can interact with the NFC card reader 200 via NFC to complete the card swiping service of the first NFC simulated card. In this way, the electronic device 100 can automatically and accurately select the appropriate NFC simulated card and quickly pop up the card swiping interface of the first NFC simulated card, thereby improving the speed and efficiency of NFC card swiping.

[0157] The following describes a near field communication method provided in an embodiment of the present application.

[0158] Figure 6 The flowchart of a near field communication method provided in an embodiment of the present application is exemplarily shown.

[0159] like Figure 6 As shown, the NFC simulated card selection method can be applied to a communication system including an electronic device 100 and an NFC card reader device 200. The NFC card reader device 200 can operate in PCD mode. The electronic device 100 can be in PICC mode by default after the NFC function is turned on. The NFC simulated card selection method may include the following steps:

[0160] S601 . The electronic device 100 enters the radio frequency field of the NFC card reader 200 .

[0161] S602. The NFC card reader 200 sends a probe frame.

[0162] The Probe frame may be used to indicate that the NFC card reader 200 supports a specified NFC protocol (which may be referred to as a first NFC protocol). The NFC card reader 200 may periodically send the Probe frame.

[0163] For example, Figure 7A As shown, the Probe frame may include a frame control header and a check field. The data length of the frame control header may be 3 bytes, and the data length of the check field may be 2 bytes. The frame control header may include a protocol identification field, a frame type field, and a protocol version field. The NFC protocol may use a cyclic redundancy check (CRC) to check the NFC transmission frame. Therefore, the check field of the Probe frame may carry a CRC code.

[0164] NFC transmission frames may include Data frames, Probe frames, ProbeACK frames, Conflict frames, Conflict ACK frames, Pick frames, Pick ACK frames, Notify frames, Notify ACK frames, Reset frames, Reset ACK frames, Command frames, and Response frames. The Frame Type field of an NFC transmission frame may be used to indicate the frame type of the NFC transmission frame. For example, the value of the Frame Type field in a Data frame may be "0x00." The value of the Frame Type field in a Probe frame may be "0x01", the value of the Frame Type field in a Probe ACK frame may be "0x02", the value of the Frame Type field in a Conflict frame may be "0x03", the value of the Frame Type field in a Conflict ACK frame may be "0x04", the value of the Frame Type field in a Pick frame may be "0x05", the value of the Frame Type field in a Pick ACK frame may be "0x06", the value of the Frame Type field in a Notify frame may be "0x07", the value of the Frame Type field in a Notify ACK frame may be "0x08", the value of the Frame Type field in a Reset frame may be "0x09", the value of the Frame Type field in a Reset ACK frame may be "0x0A", the value of the Frame Type field in a Command frame may be "0x0B", and the value of the Frame Type field in a Response frame may be "0x0C". Frame Type field values ​​0x0D to 0x88 are reserved values ​​for extensions to more types of NFC transmission frames in the first NFC protocol. The value of the frame type field "0x09-0xFF" can be a vendor-defined value. The above examples are only used to explain the present application and should not be construed as limiting.

[0165] The data length of the protocol identification field can be 1 byte. The protocol identification field in the Probe frame can be used to indicate the specified NFC protocol (i.e., the first NFC protocol) adopted by the NFC card reader 200 when sending the Probe frame. The value of the protocol identification field can be the identifier of the specified NFC protocol, for example, "0x7C".

[0166] The data length of the frame type field can be 1 byte. The frame type field in the Probe frame can be used to indicate the frame type of the Probe frame. For example, the value of the frame type field of the Probe frame can be "0x01".

[0167] S603. After receiving the Probe frame, the electronic device 100 sends a Probe ACK frame to the NFC card reader 200.

[0168] The Probe ACK frame may be used to indicate that the electronic device 100 supports the specified NFC protocol (which may be referred to as the first NFC protocol) indicated by the Probe frame.

[0169] If the electronic device 100 does not support the specified NFC protocol indicated by the Probe frame, the electronic device 100 may not send the Probe ACK frame.

[0170] S604. After receiving the Probe ACK frame, the NFC card reader device 200 sends a Notify frame to the electronic device 100, where the Notify frame carries device feature information of the NFC card reader device 200.

[0171] In one possible implementation, the Probe ACK frame may carry a result indicating whether the electronic device 100 supports a specified NFC protocol. If the electronic device 100 supports the specified NFC protocol indicated by the Probe frame, the electronic device 100 may carry result A in the Probe ACK frame, which indicates that the electronic device 100 supports the specified NFC protocol. If the electronic device 100 does not support the specified NFC protocol indicated by the Probe frame, the electronic device 100 may carry result B in the Probe ACK frame, which indicates that the electronic device 100 does not support the specified NFC protocol. After the NFC card reader 200 receives the Probe ACK frame carrying result A sent by the electronic device 100, the NFC card reader 200 may send a Notify frame to the electronic device 100.

[0172] The device feature information may include a service identifier (SID) and a device organization identifier (also known as an NFC device organization unique identifier (ND_OUI)).

[0173] Optionally, the device characteristic information may include any one or more of a service identifier (SID), a device organization identifier (ND_OUI), and a device group identifier (also known as an NFC device group identifier (NFC device group identify, ND_GID)).

[0174] 1. A service identifier (SID) may be used to indicate the type of NFC service supported by the NFC card reader 200 based on the NFC function.

[0175] In one possible implementation, the NFC service type may include a main service type and a sub-service type. Therefore, the service identifier may include a main service identifier and a sub-service identifier. The main service identifier may be used to indicate the main service type supported by the NFC card reader 200, and the sub-service identifier may be used to indicate the sub-service type supported by the NFC card reader 200 under a certain main service type. The main service type may include one or more of access control, keys, transportation, banking, digital currency, digital certificates, codeless payment, electronic tickets, wireless charging, tap-to-pay, and multi-function cards. The sub-service types corresponding to access control may include one or more of community access control, enterprise access control, government access control, and campus access control. The sub-service types corresponding to keys may include one or more of smart door locks, car keys from the Intelligent Car Connectivity Industry Ecosystem Alliance (ICCE), car keys from the Car Connectivity Consortium (CCC), car keys from the Intelligent Car Connectivity Open Alliance (ICCOA), and hotel room cards. Sub-service types for transportation cards may include one or more of domestic and overseas transportation cards. Sub-service types for banks may include one or more of UnionPay, UnionPay International, Visa, and MasterCard. Sub-service types for digital currencies may include digital currencies defined by the People's Bank of China. Sub-service types for digital certificates may include one or more of identity cards, Hong Kong and Macau passes, driver's licenses, social security cards, and passports. Sub-service types for codeless payment may include one or more of general services, membership card discount services, and payment institution discount services. Sub-service types for electronic tickets may include electronic ticket purchase and park entry services. Sub-service types for wireless charging may include wireless charging, etc. Sub-service types for tap-to-pay may include one or more of one-tap pairing, one-tap multi-screen collaboration, one-tap voice transmission, one-tap image transmission, one-tap friend addition, and one-tap transfer. Sub-service types for multi-function cards may include one or more of multi-function all-in-one cards, etc.

[0176] The main service identifier may occupy 1 byte, and the sub-service identifier may occupy 1 byte. For example, the values ​​of the main service identifier and the sub-service identifier may be as shown in Table 1 below.

[0177] Table 1

[0178]

[0179]

[0180] It can be seen from Table 1 above:

[0181] 1.1. When the main service identifier is "0x01", the main service type is access control.

[0182] If the subservice identifier is "0x01," the subservice type is residential access control. If the subservice identifier is "0x02," the subservice type is enterprise access control. If the subservice identifier is "0x03," the subservice type is government access control. If the subservice identifier is "0x04," the subservice type is campus access control. If the main service type is access control, the subservice identifier values ​​"0x00" and "0x05 to 0xFF" are reserved for protocol extensions.

[0183] 1.2. When the main service identifier is "0x02", the main service type is key.

[0184] If the subservice identifier is "0x01," the subservice type is a smart door lock. If the subservice identifier is "0x02," the subservice type is an ICCE car key. If the subservice identifier is "0x03," the subservice type is a CCC car key. If the subservice identifier is "0x04," the subservice type is an ICCOA car key. If the subservice identifier is "0x05," the subservice type is a hotel room card. When the primary service type is a key, the subservice identifier values ​​"0x00" and "0x06 to 0xFF" are reserved for protocol extensions.

[0185] 1.3. When the main service identifier is "0x03", the main service type is transportation.

[0186] If the subservice identifier is "0x01," the subservice type is a domestic transportation card in China. If the subservice identifier is "0x02," the subservice type is a non-domestic transportation card. When the primary service type is transportation, the subservice identifier values ​​"0x00" and "0x03 to 0xFF" are reserved for protocol extensions.

[0187] 1.4. When the main service identifier is "0x04", the main service type is bank.

[0188] If the sub-service identifier is "0x01", the sub-service type is UnionPay, UnionPay International, Visa, or MasterCard. If the main service type is bank, the sub-service identifier values ​​"0x00" and "0x02 to 0xFF" can be reserved for protocol extension.

[0189] 1.5. When the main service identifier is "0x05", the main service type is digital currency.

[0190] If the sub-service identifier is "0x00", the sub-service type is digital currency defined by the People's Bank of China. In the case of digital currency as the main service type, the sub-service identifier value "0x01 to 0xFF" can be reserved for protocol extension.

[0191] 1.6. When the primary service identifier is "0x06", the primary service type is digital certificate.

[0192] If the subservice identifier is "0x01," the subservice type is an ID card. If the subservice identifier is "0x02," the subservice type is a Hong Kong and Macau Pass. If the subservice identifier is "0x03," the subservice type is a driver's license. If the subservice identifier is "0x04," the subservice type is a social security card. If the subservice identifier is "0x05," the subservice type is a passport. When the primary service type is a digital certificate, the subservice identifier values ​​"0x00" and "0x06 to 0xFF" are reserved for protocol extensions.

[0193] 1.7. When the main service identifier is "0x07", the main service type is codeless payment.

[0194] If the sub-service identifier is "0x01," the sub-service type is a general service. If the sub-service identifier is "0x02," the sub-service type is a membership card discount service. If the sub-service identifier is "0x03," the sub-service type is a payment institution discount service. If the main service type is codeless payment, the sub-service identifier values ​​"0x00" and "0x04 to 0xFF" are reserved for protocol extensions.

[0195] 1.8. When the main service identifier is "0x08", the main service type is electronic ticket.

[0196] If the sub-service identifier is "0x01", the sub-service type is the electronic ticket admission service. In the case of the main service type being electronic ticket, the sub-service identifier values ​​"0x00" and "0x04 to 0xFF" can be reserved for protocol extension.

[0197] 1.9. When the main service identifier is "0x09", the main service type is wireless charging.

[0198] If the sub-service identifier is "0x00", the sub-service type is wireless charging. Among them, when the main service type is wireless charging, the value of the sub-service identifier "0x01 to 0xFF" can be reserved for protocol extension.

[0199] 1.10. When the main service identifier is "0x0A", the main service type is the touch-and-pay function.

[0200] If the sub-service identifier is "0x01", the sub-service type is one-touch pairing. If the sub-service identifier is "0x02", the sub-service type is one-touch multi-screen collaboration. If the sub-service identifier is "0x03", the sub-service type is one-touch voice transmission. If the sub-service identifier is "0x04", the sub-service type is one-touch picture transmission. If the sub-service identifier is "0x05", the sub-service type is one-touch adding friends. If the sub-service identifier is "0x06", the sub-service type is one-touch transfer. Among them, when the main service type is the touch-to-touch function, the sub-service identifier values ​​"0x00" and "0x07~0xFF" can be reserved for protocol extension.

[0201] 1.11. When the main service identifier is "0x0B", the main service type is multi-function card.

[0202] If the sub-service identifier is "0x01", the sub-service type is a multi-function card. If the main service type is a multi-function card, the sub-service identifier values ​​"0x00" and "0x02 to 0xFF" can be reserved for protocol extension.

[0203] 1.12. The values ​​of the primary service identifier "0x00" and "0x0B to 0xFF" can be reserved for protocol extension.

[0204] The examples shown in Table 1 above are only used to explain the present application and should not be construed as limiting the present application.

[0205] 2. The device organization identifier (ND_OUI) can be used to identify the manufacturer providing NFC services using the NFC card reader 200. The registration authority of the NFC protocol standard organization can assign different device organization identifiers to different manufacturers. For example, manufacturers providing NFC services may include one or more smart door lock manufacturers, one or more property management companies, one or more auto parts manufacturers, one or more transportation card management departments, etc.

[0206] For example, if the NFC service of the NFC card reader 200 is community access control, the device organization identifier of the NFC card reader 200 may be the organization identifier applied for by the property management company to which the NFC card reader 200 belongs to from the NFC standards organization. For example, the device organization identifier applied for by Vanke Property Management from the registration authority of the NFC standards organization may be "0x1A3B27".

[0207] If the NFC service provided by the NFC card reader 200 is a smart door lock, the device organization identifier of the NFC card reader 200 may be an organization identifier applied for by the smart door lock manufacturer to which the NFC card reader 200 belongs to the NFC standard organization.

[0208] If the NFC service provided by the NFC card reader 200 is a car key, the device organization identifier of the NFC card reader 200 may be an organization identifier applied for by the vehicle manufacturer to which the NFC card reader 200 belongs to the NFC standard organization.

[0209] If the NFC service provided by the NFC card reader 200 is a multi-function card, the device organization identifier of the NFC card reader 200 may be the organization identifier applied for by the card issuing organization to which the NFC card reader 200 belongs from the NFC standards organization. The PICC corresponding to the multi-function card may include campus cards, work cards, and other cards with multiple functions such as access control, stored value, and consumption. The card issuing organization to which the NFC card reader 200 belongs may include companies, schools, and other organizations.

[0210] The above examples are only used to explain the present application and should not be construed as limiting the present application.

[0211] 3. The device group identifier (ND_GID) can be used to indicate the group to which the NFC service provided by the NFC card reader device 200 belongs. The device group identifier can be assigned based on the purpose and location of the NFC card reader device 200. Different NFC services can have different group divisions.

[0212] For example, if the NFC service provided by the NFC card reader 200 is community access control, the device group identifier of the NFC card reader 200 may include a hash value obtained by hashing the city name and the community name, and a random number. For example, the data length of the device group identifier of the NFC card reader 200 may be 6 bytes, the hash value obtained by hashing the city name and the community name may be located in the first 4 bytes of the device group identifier, and the random number may be located in the last 2 bytes of the device group identifier.

[0213] If the NFC service provided by the NFC card reader 200 is a smart door lock, the device group identifier of the NFC card reader 200 may include a hash value obtained by hashing the serial number (SN) of the NFC card reader 200 and a random number. For example, the data length of the device group identifier of the NFC card reader 200 may be 6 bytes, the hash value obtained by hashing the serial number (SN) of the NFC card reader 200 may be located in the first 4 bytes of the device group identifier, and the random number may be located in the last 2 bytes of the device group identifier.

[0214] If the NFC service provided by the NFC card reader 200 is a car key, the device group identifier of the NFC card reader 200 may include a hash value obtained by hashing the vehicle identification number (VIN) of the NFC card reader 200 and a random number. For example, the data length of the device group identifier of the NFC card reader 200 may be 6 bytes, the hash value obtained by hashing the vehicle identification number of the NFC card reader 200 may be located in the first 4 bytes of the device group identifier, and the random number may be located in the last 2 bytes of the group identifier.

[0215] If the NFC service provided by the NFC card reader 200 is a multi-function card, the device group identifier of the NFC card reader 200 may be a preset value.

[0216] The above examples are only used to explain the present application and should not be construed as limiting the present application.

[0217] like Figure 7B As shown, the Notify frame may include a frame control header, a device identification element, and a check field. The data length of the frame control header of the Notify frame may be 4 bytes, and the frame control header of the Notify frame may include a protocol identification field, a frame type field, a control information field, and a frame length field.

[0218] The protocol identification field in the Notify frame may have a data length of 1 byte and may be used to indicate the specific NFC protocol used by the NFC card reader 200 when sending the Notify frame. The value of the protocol identification field may be an identifier of the specific NFC protocol, for example, "0x7C".

[0219] The data length of the frame type field in the Notify frame can be 1 byte. The frame type field in the Notify frame can be used to indicate the frame type of the Notify frame. For example, the value of the frame type field in the Notify frame can be "0x05".

[0220] The control information field in the Notify frame can have a data length of 1 byte. The control information field in the Notify frame can be used to indicate whether there is a conflict between multiple PICC devices. PICC devices include physical NFC tags, electronic devices in PICC mode, and the like.

[0221] The data length of the frame length field in the Notify frame can be 1 byte. The frame length field in the Notify frame can be used to indicate the data length of the device identification element.

[0222] The device identification element may include device feature information. Specifically, the device feature information may include a service identifier (SID) and a device organization identifier (ND_OUI). Optionally, the device feature information may also include a device group identifier (ND_GID). The data length of the service identifier (SID) may be 2 bytes, the data length of the device organization identifier (ND_OUI) may be 3 bytes, and the data length of the device group identifier (ND_GID) may be 6 bytes.

[0223] Optionally, the device identification element may further include an element code, an identification mask, a device type identification, and a device individual identification.

[0224] The element code can be used to indicate the identification of the control element. The control element can include any one or more of the device identification element, card identification element, transmission capability element, security algorithm element, etc. The control elements can be carried in a flexible combination in the NFC control frame. Since the Notify frame carries the device identification element, the element code in the Notify frame is used to indicate the identification of the device identification element. The data length of the element code can be 1 byte. For example, the element code of the device identification element can be "0x00", the element code of the card identification element can be "0x01", the element code of the transmission capability element can be 0x02, the element code of the security algorithm element can be "0x03", and the value of the element code "0x04~0xFF" can be reserved for protocol extension or manufacturer customization.

[0225] The identification mask in the device identification element can be used to indicate the type of device identification carried in the device identification element. The data length of the identification mask can be 1 byte.

[0226] The device identification may include one or more of the following: device type identification (also known as NFC device type identifier (ND_TID)), service identification (SID), device organization identification (ND_OUI), device group identification (ND_GID), device individual identification (also known as NFC device private identifier (ND_PID)), etc.

[0227] The device type identifier can be used to indicate the device type of the NFC card reader 200. The device type indicated in the device type identifier can include any of a mobile phone, a wearable device, a card reader device that does not require interaction with an electronic device, and a card reader device that requires interaction with an electronic device. The correspondence between the device type identifier and the device type can be shown in Table 2 below.

[0228] Table 2

[0229] Device type identification Device Type 0x01 cell phone 0x02 Wearable devices 0x03 Card reader that does not require NFC interaction with electronic devices 0x04 A card reader that requires NFC interaction with an electronic device 0x00, 0x05~0xFF Reserve

[0230] It can be seen from Table 2 above that when the device type identifier is "0x01", it indicates that the device type of the NFC card reader device 200 is a mobile phone. When the device type identifier is "0x02", it indicates that the device type of the NFC card reader device 200 is a wearable device. When the device type identifier is "0x03", it indicates that the device type of the NFC card reader device 200 is a card reader device that does not require NFC interaction with electronic devices, such as security gates, wireless charging devices, etc. When the device type identifier is "0x04", it indicates that the device type of the NFC card reader device 200 is a card reader device that requires NFC interaction with electronic devices, such as access control devices, transportation card readers, vehicles, etc. The values ​​of the device type identifier "0x00" and "0x05~0xFF" are reserved for protocol extension. The above Table 2 can be used to explain this application and should not constitute a limitation on this application.

[0231] The ND_PID can be used to indicate the individual ID of the NFC card reader 200 within a class of card readers with the same device organization ID and device group ID. The manufacturer of the NFC card reader 200 must ensure that the ND_PIDs of the same class of card readers with the same device organization ID and device group ID are distinct.

[0232] In the embodiment of the present application, the above Figure 7B The format of the Notify frame shown is an example for explaining the present application and should not constitute a limitation to the present application.

[0233] S605 . The electronic device 100 determines a first NFC simulated card from one or more NFC simulated cards on the electronic device 100 based on the device feature information of the NFC card reader 200 .

[0234] After activating one or more NFC simulated cards, the electronic device 100 can save the device feature information corresponding to each of the one or more NFC simulated cards. Different device feature information corresponds to different NFC simulated cards. For example, the correspondence between device feature information and NFC simulated cards can be shown in Table 3 below:

[0235] Table 3

[0236]

[0237] As shown in Table 3 above, device feature information 1 corresponds to the access card for Community A. Device feature information 1's primary service identifier can be "0x01," its sub-service identifier can be "0x01," its organization identifier can be "0x1A3B27," and its group identifier can be "0x18ed29d7c6d5." Device feature information 2 corresponds to the access card for Community B. Device feature information 2's primary service identifier can be "0x01," its sub-service identifier can be "0x01," its organization identifier can be "0x1A3B27," and its group identifier can be "0x89b6337b0006." Device feature information 3 corresponds to the access card for Community C. Device feature information 3's primary service identifier can be "0x01," its sub-service identifier can be "0x01," its organization identifier can be "0x1A3B29," and its group identifier can be "0x7b04481a15c0." Device feature information 4 corresponds to the Shenzhen Tong transportation card, where the primary service identifier of device feature information 4 can be "0x03", the sub-service identifier can be "0x01", and the device organization identifier can be "0x2C3D11". Device feature information 5 corresponds to the home door lock key card, where the primary service identifier of device feature information 5 can be "0x02", the sub-service identifier can be "0x01", the device organization identifier can be "0x332A99", and the device group identifier can be "0x5ea970d54450". Device feature information 6 corresponds to the key card for vehicle M9, where the primary service identifier of device feature information 6 can be "0x02", the sub-service identifier can be "0x02", the device organization identifier can be "0x37BCA1", and the device group identifier can be "0x38d112bd15d3".

[0238] For example, the device feature information of the NFC card reader device 200 is the device feature information 1 shown in Table 3 above. After receiving the Notify frame carrying the NFC card reader device 200, the electronic device 100 determines that the first NFC simulated card that matches the device feature information of the NFC card reader device 200 is the access control card of cell A.

[0239] The examples shown in Table 3 above are only used to explain this application and should not constitute a limitation on this application.

[0240] In one possible implementation, the correspondence between device feature information and NFC simulated cards can be managed and stored by the NFC module 102 (for example, it can be stored inside the NFC module 102 or in the SE). After receiving the Notify frame, the NFC module 102 in the electronic device 100 can determine the first NFC simulated card from one or more NFC simulated cards in the electronic device 100 based on the device feature information of the NFC card reader 200. Then, the NFC module 102 can send the identifier of the first NFC simulated card to the application (for example, the wallet application) running in the processor 101, so that the application (for example, the wallet application) running in the processor 101 displays a card swipe prompt for the first NFC simulated card.

[0241] In one possible implementation, the correspondence between device feature information and NFC simulated cards can be stored by an application running in the processor 101 (for example, it can be stored in the application or in the trusted execution environment (TEE) of the processor). After receiving the Notify frame, the NFC module 102 in the electronic device 100 can send the device feature information of the NFC card reader device 200 to the application running in 101. The application running in the processor 101 can determine the first NFC simulated card from one or more NFC simulated cards of the electronic device 100 based on the device feature information of the NFC card reader device 200. The application running in the processor 101 (for example, a wallet application) can display a card swiping prompt for the first NFC simulated card.

[0242] S606. After determining the first NFC simulated card, the electronic device 100 outputs a card swiping prompt for the first NFC simulated card.

[0243] The first NFC simulated card swipe prompt can be used to prompt the electronic device that the first NFC simulated card is being used to swipe the card. The first NFC simulated card swipe prompt can include one or more of an image prompt, a text prompt, an audio prompt, and a vibration prompt. The image prompt can include one or more of a static image prompt, a dynamic image prompt, and a video prompt.

[0244] For example, after determining the first NFC simulated card, the electronic device 100 may display a card swiping interface for the first NFC simulated card, wherein the card swiping interface for the first NFC simulated card may include prompt information for the first NFC simulated card. For example, the prompt information may be a card-shaped icon with the name of the first NFC simulated card displayed on the card-shaped icon. The card swiping interface for the first NFC simulated card may be used to prompt the user that the electronic device 100 is swiping the card using the first NFC simulated card.

[0245] S607. After determining the first NFC simulated card, the electronic device 100 sends a Notify ACK frame to the NFC card reader 200. The Notify ACK frame carries a first notification result. The first notification result can be used to indicate that the electronic device 100 has successfully selected the first NFC simulated card.

[0246] If the electronic device 100 fails to select an NFC simulated card from one or more NFC simulated cards that matches the device feature information of the NFC card reader 200, the electronic device 100 may send a notification confirmation frame carrying a second notification result. The second notification result indicates that the electronic device 100 failed to select an NFC simulated card. After receiving the notification confirmation frame carrying the second notification result, the NFC card reader 200 periodically sends a probe frame.

[0247] S608. The electronic device 100 and the NFC card reader 200 perform data exchange via NFC, completing the first NFC simulated card swiping service.

[0248] Among them, card swiping services may include opening access control, unlocking doors, unlocking vehicles, transaction payments, electronic ticket verification, digital certificate verification, and swiping transportation cards to get on and off the bus.

[0249] Specifically, the electronic device 100 can send the card information of the first NFC simulated card to the NFC card reader 200 through NFC data exchange. The NFC card reader 200 can perform the card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card. The NFC card reader 200 can send the card swiping result of the first NFC simulated card to the electronic device 100 through NFC command exchange.

[0250] The card information of the first NFC simulated card may include one or more of access control information, key information, transaction account information, and electronic ticket information. The access control information may include one or more of the card number and the card number's expiration date. The key information may include one or more of the key code and the key code's expiration date. The transaction account information may include one or more of the transaction account identifier and the remaining balance in the transaction account. The electronic ticket information may include one or more of the electronic ticket code, the electronic ticket verification time, and the electronic ticket's expiration date.

[0251] A near field communication method is provided in an embodiment of the present application. When the electronic device 100 enters the radio frequency field emitted by the NFC card reader device 200, the electronic device 100 can receive a probe (Probe) frame emitted by the NFC card reader device 200. After receiving the Probe frame, the electronic device 100 can send a probe confirmation (ProbeAcknowledge, Probe ACK) frame to the NFC card reader device 200. The Probe ACK frame can be used to indicate that the electronic device 100 has received the Probe frame. After receiving the Probe frame, the NFC card reader device 200 can send a notification (Notify) frame to the electronic device 100, wherein the Notify frame carries the device feature information of the NFC card reader device 200. After receiving the Notify frame, the electronic device 100 can determine the first NFC simulated card from one or more NFC simulated cards through the device feature information of the NFC card reader device 200 and display the card swiping interface of the first NFC simulated card. The electronic device 100 can interact with the NFC card reader device 200 through NFC to complete the card swiping service of the first NFC simulated card. In this way, the electronic device 100 can automatically and accurately select a suitable NFC simulated card and quickly pop up the card swiping interface of the first NFC simulated card, thereby improving the speed and efficiency of NFC card swiping.

[0252] Figures 8A-8D A schematic diagram of a set of scenarios for automatically selecting an NFC simulated card swiping provided in an embodiment of the present application is shown.

[0253] For example, Figure 8A As shown, the NFC card reader device 200 can be an access control gate. When the physical NFC tag card or the electronic device 100 in PICC mode is close to the card swiping area of ​​the NFC card reader device 200, the physical NFC tag card or the electronic device 100 in PICC mode can perform NFC interaction with the NFC card reader device 200. Among them, the electronic device 100 can be in PICC mode after turning on the NFC function. The electronic device 100 can have one or more NFC simulation cards activated. For example, the one or more NFC simulation cards can include Shenzhentong transportation card, access control card of community A, access control card of community B, access control card of community C, home door lock key card and key card of vehicle M9, etc.

[0254] like Figure 8B As shown, when the screen of the electronic device 100 is off, the electronic device 100 can be placed close to the card swiping area of ​​the NFC card reader 200. After detecting the electronic device 100, the NFC card reader 200 can perform NFC signaling interaction with the electronic device 100.

[0255] like Figure 8CAs shown, after the electronic device 100 receives the Notify frame sent by the NFC card reader 200, the electronic device 100 can select the access control card for cell A that matches the NFC card reader 200 from one or more NFC simulated cards based on the device feature information of the NFC card reader 200 carried in the Notify frame. The electronic device 100 can light up the screen and display the card swiping interface 810. Among them, the card swiping interface 810 displays a card icon 811 corresponding to the access control card for cell A. The card icon 811 can be used to prompt the user that the electronic device 100 is using the access control card for cell A to swipe the card.

[0256] like Figure 8D As shown, the electronic device 100 can use the card information of the access card of cell A and send it to the NFC card reader 200 for verification. If the NFC card reader 200 successfully verifies the card information of the access card of cell A, it sends the card swiping result 1 to the electronic device 100 and opens the gate of the NFC card reader 200. The card swiping result 1 is used to indicate that the NFC simulated card swiping is successful. After receiving the card swiping result 1, the electronic device 100 can display a prompt 812 on the card swiping interface 810. The prompt 812 can be used to prompt the user that the gate of the NFC card reader 200 has been successfully opened. The prompt 812 can be one or more of a text prompt, an image prompt, an audio prompt, a vibration prompt, etc. For example, the prompt 812 can be a text prompt "Access control door opened successfully" and an image prompt with a check mark pattern.

[0257] If the NFC card reader 200 fails to verify the card information of the access card of the cell A, it sends a card swiping result 2 to the electronic device 100. The card swiping result 2 is used to indicate that the NFC simulated card swiping failed.

[0258] Figures 9A-9D A schematic diagram of another set of scenarios for automatically selecting an NFC simulated card swiping provided in an embodiment of the present application is shown.

[0259] Another example is Figure 9A As shown, the NFC card reader device 200 can be a smart door lock. When the physical NFC tag card or the electronic device 100 in PICC mode is close to the card swiping area of ​​the NFC card reader device 200, the physical NFC tag card or the electronic device 100 in PICC mode can perform NFC interaction with the NFC card reader device 200. Among them, the electronic device 100 can be in PICC mode after turning on the NFC function. The electronic device 100 can be activated with one or more NFC simulation cards. For example, the one or more NFC simulation cards can include Shenzhentong transportation card, access control card of community A, access control card of community B, access control card of community C, home door lock key card and key card of vehicle M9, etc.

[0260] like Figure 9B As shown, when the screen of the electronic device 100 is off, the electronic device 100 can be placed close to the card swiping area of ​​the NFC card reader 200. After detecting the electronic device 100, the NFC card reader 200 can perform NFC signaling interaction with the electronic device 100.

[0261] like Figure 9C As shown, after the electronic device 100 receives the Notify frame sent by the NFC card reader 200, the electronic device 100 can select a home door lock key card that matches the NFC card reader 200 from one or more NFC simulated cards based on the device feature information of the NFC card reader 200 carried in the Notify frame. The electronic device 100 can light up the screen and display a card swiping interface 910. Among them, the card swiping interface 910 displays a card icon 911 corresponding to the home door lock key card. The card icon 911 can be used to prompt the user that the electronic device 100 is using the home door lock key card for swiping.

[0262] like Figure 9D As shown, the electronic device 100 can use the card information of the home door lock key card and send it to the NFC card reader device 200 for verification. If the NFC card reader device 200 successfully verifies the card information of the home door lock key card, it sends the card swiping result 1 to the electronic device 100 and opens the door lock of the NFC card reader device 200. The card swiping result 1 is used to indicate that the NFC simulated card swiping is successful. After receiving the card swiping result 1, the electronic device 100 can display a prompt 912 on the card swiping interface 910. The prompt 912 can be used to prompt the user that the door gate of the NFC card reader device 200 has been successfully opened. The prompt 912 can be one or more of a text prompt, an image prompt, an audio prompt, a vibration prompt, etc. For example, the prompt 912 can be a text prompt "Access control door opened successfully" and an image prompt with a check mark pattern.

[0263] If the NFC card reader 200 fails to verify the card information of the home door lock key card, it sends a card swipe result 2 to the electronic device 100. The card swipe result 2 is used to indicate that the NFC simulated card swipe failed.

[0264] It should be noted that in the embodiment of the present application, one or more NFC simulated cards are activated on the electronic device 100. The electronic device 100 can be placed close to the NFC card reader device 200 when the screen is turned off, locked, or the desktop is displayed, and no NFC simulated card swiping interface is displayed, thereby entering the radio frequency field of the NFC card reader device 200. The NFC card reader device 200 can perform NFC signaling interaction with the electronic device 100, allowing the electronic device 100 to obtain the device feature information of the NFC card reader device 200 from the Notify frame sent by the NFC card reader device 200. After the electronic device 100 determines the first NFC simulated card from one or more activated NFC simulated cards based on the device feature information of the NFC card reader device 200, it can output a card swiping prompt for the first NFC simulated card. In this way, the user does not need to select a certain NFC simulated card in advance, and the electronic device 100 can automatically and accurately select the NFC simulated card that matches the NFC card reader device 200.

[0265] The following describes a near field communication method provided in an embodiment of the present application in conjunction with NFC signaling interaction.

[0266] Figure 10 The flowchart of a near field communication method provided in an embodiment of the present application is exemplarily shown.

[0267] like Figure 10 As shown, the NFC simulated card selection method can be applied to a communication system including an electronic device 100 and an NFC card reader device 200. The NFC card reader device 200 can operate in PCD mode. The electronic device 100 can be in PICC mode by default after the NFC function is turned on. The NFC simulated card selection method may include the following steps:

[0268] S1001 . The electronic device 100 enters the radio frequency field of the NFC card reader 200 .

[0269] S1002. The NFC card reader 200 sends a probe frame.

[0270] S1003. After receiving the Probe frame, the electronic device 100 sends a Probe ACK frame to the NFC card reader 200.

[0271] S1004. After receiving the Probe ACK frame, the NFC card reader device 200 sends a Notify frame to the electronic device 100, where the Notify frame carries device feature information of the NFC card reader device 200.

[0272] S1005 . The electronic device 100 determines a first NFC simulated card from one or more NFC simulated cards on the electronic device 100 based on the device feature information of the NFC card reader 200 .

[0273] S1006. After determining the first NFC simulated card, the electronic device 100 outputs a card swiping prompt for the first NFC simulated card.

[0274] S1007. After determining the first NFC simulated card, the electronic device 100 sends a Notify ACK frame to the NFC card reader 200. The Notify ACK frame carries a first notification result. The first notification result can be used to indicate that the electronic device 100 has successfully selected the first NFC simulated card.

[0275] For details of steps S1001 to S1007, please refer to the above Figure 6 Steps S601 to S607 in the illustrated embodiment are not described in detail here.

[0276] S1008. After receiving the notification confirmation frame, the NFC card reader 200 sends a small program selection (Select AID) command to the electronic device 100, wherein the small program selection command carries the identifier of the first applet.

[0277] S1009. Based on the identifier of the first applet, the electronic device 100 determines the first applet from one or more applets and runs the first applet.

[0278] Among them, the service processing logic of the NFC simulation card in the electronic device 100 is specifically implemented by an applet. The applet can be stored and run in the hardware device or software module corresponding to the NFC simulation card (for example, NFC module 102, HCE application, SIM card, SE, etc.). Since one or more NFC simulation cards are activated on the electronic device 100. Therefore, there can be one or more applets on the electronic device 100. Among them, one NFC simulation card corresponds to one applet. The applets corresponding to different NFC simulation cards may be different or the same.

[0279] For example, the correspondence between the NFC simulated card and the Applet may be shown in Table 4 below:

[0280] Table 4

[0281] Card Name Mini Program Identifier (AID) Jiangsu Transportation Card A00000063201010530013000FFFFFFFF Shenzhen Tong Transportation Card 535A542E57414C4C45542E454E56 Lingnantong Transportation Card 5943542E55534552 Wuhan Tong Transportation Card A00000534257485448 Chongqing One Card 4351515041592E5359533331 Shanghai Public Transport Card A0000003330101020063485750415902 UnionPay A0000003330053440121561126241000 Bank of China Card A00000000353504200080822 China Construction Bank Card A00000000353504200080807 China Merchants Bank Card A0000003330101010003080000030801 BMW car key card A00000000353504200080836 Huawei door lock key card F0000000485750415906000002029703 Vanke Property Management access card B00000007819392019283

[0282] As can be seen from Table 4 above, the Applet ID (AID) corresponding to the Jiangsu Transportation Card is "A00000063201010530013000FFFFFFFF." The Applet ID (AID) corresponding to the Shenzhen Tong Transportation Card is "535A542E57414C4C45542E454E56," the Applet ID (AID) corresponding to the Lingnan Transportation Card is "5943542E55534552," and the Applet ID (AID) corresponding to the Wuhan Tong Transportation Card is "A00000534257485448." The Applet identifier (AID) corresponding to Chongqing Yikatong is "4351515041592E5359533331", the Applet identifier (AID) corresponding to Shanghai Public Transport Card is "A0000003330101020063485750415902", the Applet identifier (AID) corresponding to UnionPay is "A0000003330053440121561126241000", the Applet identifier (AID) corresponding to Bank of China Card is "A00000000353504200080822", and the Applet identifier (AID) corresponding to China Construction Bank Card is "A00000000353504200080822". Assume that the Applet identifier (AID) corresponding to the bank card is "A00000000353504200080807", the Applet identifier (AID) corresponding to the China Merchants Bank card is "A0000003330101010003080000030801", the Applet identifier (AID) corresponding to the BMW car key card is "A00000000353504200080836", and the Applet identifier (AID) corresponding to the Huawei door lock key card is "F0000000485750415906000002029703". The Applet identifier (AID) corresponding to the Vanke property access card is "B00000007819392019283".

[0283] The examples shown in Table 4 above are only used to explain the present application and should not be construed as limiting the present application.

[0284] S1010. After determining the first Applet, the electronic device 100 sends a response (Response) 1 to the NFC card reader 200, where the response 1 is used to indicate that the electronic device 100 has successfully selected the first Applet.

[0285] S1011. After receiving the response 1, the NFC card reader 200 sends a mapping list query command to the electronic device 100.

[0286] The mapping list query command is used to request the electronic device 100 to return the first mapping list to the NFC card reader 200 .

[0287] S1012. After receiving the mapping list query command, the electronic device 100 may send a mapping list query response to the NFC card reader 200. The mapping list query response carries a first mapping list, wherein the first mapping list is used to indicate a mapping relationship between device feature information and a dedicated file (DF) identifier.

[0288] The electronic device 100 can store data of one or more NFC simulated cards in the form of a file tree. The data of the NFC simulated card may include device feature information, keys, permission information and other data associated with the NFC simulated card. Among them, the file tree may include a master file (MF), a dedicated file (DF), and an elementary file (EF). Among them, one or more EFs and one or more DFs can be stored under the directory of the MF, and one or more EFs can be stored under the directory of each DF. Among them, one NFC simulated card corresponds to one DF, and different NFC simulated cards correspond to different DFs. Since an NFC simulated card can correspond to one or more card information, one or more card information EFs for storing card information can be stored in one DF (for example, a DF can support up to 8 card information EFs, and the data length of each card information EF can be 4 bytes) and external authentication keys corresponding to one or more card information EFs. Among them, the external authentication keys corresponding to different card information EFs in the same DF are the same or different.

[0289] For example, Figure 11 As shown, the NFC simulated cards activated on the electronic device 100 may include the access card of the A community, the access card of the B community, the access card of the C community, the Shenzhen Tong transportation card, and the home door lock key card. Therefore, the MF directory may store the key EF1, the Applet identity public key EF, the Applet identity private key EF, the mapping table EF, DF1, DF2, DF3, DF4, and DF5. Among them:

[0290] 1. Key EF1 may include a master key and a maintenance key. The master key in key EF1 can be used for encryption and decryption when data in key EF1 is updated. The maintenance key in key EF1 can be used for encryption and decryption when data in the applet identity public key EF, applet identity private key EF, and mapping table EF are updated.

[0291] 2. Applet identity private key EF can be used to store the identity private keys used by one or more applets.

[0292] 3. Applet identity public key EF can be used to store the identity public keys used by one or more applets.

[0293] 4. Mapping list EF can be used to store the above-mentioned first mapping list, which is used to indicate the mapping relationship between device feature information and DF identifiers. For example, device feature information 1 corresponds to DF1, which can be used to store the data of the access card for community A. Device feature information 2 corresponds to DF2, which can be used to store the data of the access card for community B. Device feature information 3 corresponds to DF3, which can be used to store the data of the access card for community C. Device feature information 4 corresponds to DF4, which can be used to store the data of the Shenzhen Tong transportation card. Device feature information 5 corresponds to DF5, which can be used to store the data of the home door lock key card.

[0294] 5. DF1 stores key EF11, device feature information EF12, file permission list EF13, and X card information EFs. X is a positive integer. Key EF11 may include a master key, a maintenance key, and X external authentication keys. The master key in key EF11 can be used for encryption and decryption when data in key EF11 is updated. The maintenance key in key EF11 can be used for encryption and decryption when data in device feature information EF12, file permission list EF13, and X card information EFs in DF1 are updated. The X external authentication keys in DF1 correspond to the X card information EFs in DF1, with one external authentication key corresponding to each card information EF. The external authentication keys corresponding to different card information EFs in DF1 can be the same or different. For example, DF1 may include card information EF storing card information 1 and card information EF storing card information 2. Card information 1 can be used to unlock the access control of Building 1 in Community A, and card information 2 can be used to unlock the access control of Building 2 in Community A. Device feature information EF12 can be used to store the device feature information corresponding to DF1. The file permission list EF13 may be used to indicate the read and write permissions of the X card information EFs in DF1.

[0295] 6. DF2 stores key EF21, device feature information EF22, file permission list EF23, and Y card information EFs. Y is a positive integer. Key EF21 may include a master key, a maintenance key, and Y external authentication keys. The master key in key EF21 can be used for encryption and decryption when data in key EF21 is updated. The maintenance key in key EF21 can be used for encryption and decryption when data in device feature information EF22, file permission list EF23, and Y card information EFs in DF2 are updated. The Y external authentication keys in DF2 correspond to the Y card information EFs in DF2. One external authentication key corresponds to one card information EF. The external authentication keys corresponding to different card information EFs in DF2 can be the same or different. For example, DF2 may include card information EF storing card information 3, where card information 3 can be used to open all access control doors within cell B. Device feature information EF22 can be used to store the device feature information corresponding to DF2. File permission list EF23 can be used to indicate the read and write permissions of the Y card information EFs in DF2.

[0296] 7. DF3 stores key EF31, device feature information EF32, file permission list EF33, and Z card information EFs. Z is a positive integer. Key EF31 may include a master key, a maintenance key, and Z external authentication keys. The master key in key EF31 can be used for encryption and decryption when data in key EF31 is updated. The maintenance key in key EF31 can be used for encryption and decryption when data in device feature information EF32, file permission list EF33, and Z card information EFs in DF3 are updated. The Z external authentication keys in DF3 correspond to the Z card information EFs in DF3. One external authentication key corresponds to one card information EF. The external authentication keys corresponding to different card information EFs in DF3 can be the same or different. For example, DF3 may include card information EF storing card information 4, where card information 4 can be used to open all access control doors within cell C. Device feature information EF32 can be used to store the device feature information corresponding to DF3. File permission list EF33 can be used to indicate the read and write permissions of the Z card information EFs in DF3.

[0297] 8. DF4 stores key EF41, device feature information EF42, file permission list EF43, and L card information EFs. L is a positive integer. Key EF41 may include a master key, a maintenance key, and L external authentication keys. The master key in key EF41 can be used for encryption and decryption when data in key EF41 is updated. The maintenance key in key EF41 can be used for encryption and decryption when data in device feature information EF42, file permission list EF43, and L card information EFs in DF4 are updated. The L external authentication keys in DF4 correspond to the L card information EFs in DF4, with one external authentication key corresponding to one card information EF. The external authentication keys corresponding to different card information EFs in DF4 can be the same or different. For example, DF4 may include card information EF storing card information 5, where card information 5 can be used for public transportation payment within Shenzhen. Device feature information EF42 can be used to store the device feature information corresponding to DF4. File permission list EF43 can be used to indicate the read and write permissions of the L card information EFs in DF4.

[0298] 9. DF5 stores key EF51, device feature information EF52, file permission list EF53, and M card information EFs. M is a positive integer. Key EF51 may include a master key, a maintenance key, and M external authentication keys. The master key in key EF51 can be used for encryption and decryption when data in key EF51 is updated. The maintenance key in key EF51 can be used for encryption and decryption when data in device feature information EF52, file permission list EF53, and M card information EFs in DF5 are updated. The M external authentication keys in DF5 correspond to the M card information EFs in DF5. One external authentication key corresponds to one card information EF. Different card information EFs in DF5 can have the same or different external authentication keys. For example, DF5 may include card information EF storing card information 6, which can be used to unlock a home door. Device feature information EF52 can be used to store the device feature information corresponding to DF5. File permission list EF53 can be used to indicate the read and write permissions of the M card information EFs in DF5.

[0299] above Figure 11 The examples shown are only used to explain the present application and should not be construed as limiting the present application.

[0300] After receiving the mapping list query command, the electronic device 100 can Figure 11 The first mapping list is obtained from the mapping list EF under the MF directory shown, and then a mapping list query response carrying the first mapping list is sent to the NFC card reader device 200.

[0301] In some embodiments, the card emulation mode of the electronic device 100 may include a hardware-based virtual card mode (virtualcardmode) and a software-based HCE mode. The data of one or more NFC emulation cards simulated by the hardware-based virtual card mode may be as described above. Figure 11 The file tree format shown is stored in a device such as SE or SIM card. The data of one or more NFC simulated cards simulated in the HCE mode based on software can be stored in the above Figure 11 The file tree format shown is saved by the HCE application. Optionally, the HCE application can store the data of one or more NFC simulated cards in the read-only memory (ROM) of the electronic device 100 in the above file tree format. Optionally, the HCE application can store the data of one or more NFC simulated cards in the above file tree format on a cloud server.

[0302] S1013. After receiving the mapping list query response, the NFC card reader device 200 may determine the identifier of the first DF from the first mapping list based on the device feature information of the NFC card reader device 200.

[0303] In this way, the NFC card reader 200 can determine the identifier of the first DF from the first mapping list based on the device characteristic information of the NFC card reader 200, thereby reducing the processing and computing load of the NFC card device (e.g., the electronic device 100, the NFC tag card). For example, when a physical NFC tag card is close to the NFC card reader 200, due to insufficient computing power of the NFC tag card, the NFC card reader 200 can read the first mapping list in the NFC tag card to select the first DF, thereby reducing the processing and computing load of the NFC tag card.

[0304] S1014. The NFC card reader 200 sends a Select DF command to the electronic device 100, wherein the Select DF command carries the identifier of the first DF.

[0305] S1015. After receiving the Select DF command, the electronic device 100 obtains the first DF based on the identifier of the first DF through the first Applet.

[0306] The electronic device 100 can be based on the identification of the first DF from the above Figure 11 In the file tree shown, find the first DF under the MF file directory.

[0307] S1016. After obtaining the first DF from the MF file through the first Applet, the electronic device 100 sends a response (Response) 2 to the NFC card reader 200, where the response 2 is used to indicate that the electronic device 100 has successfully obtained the first DF.

[0308] S1017. After receiving the response 2, the NFC card reader 200 sends a random number acquisition (GetChallenge) command to the electronic device 100.

[0309] S1018. The electronic device 100 generates a first random number through the first Applet.

[0310] S1019. The electronic device 100 sends a response (Response) 3 to the NFC card reader 200, where the response 3 carries the first random number.

[0311] S1020. After receiving the response 3, the NFC card reader 200 encrypts the first random number using the first external authentication key to obtain an authentication ciphertext.

[0312] S1021. The NFC card reader 200 sends an external authentication command to the electronic device 100, wherein the external authentication command carries an authentication ciphertext.

[0313] S1022. After receiving the external authentication command, the electronic device 100 uses the first external authentication key in the first DF through the first Applet to decrypt the first random number from the authentication ciphertext.

[0314] Since the first DF may include one or more card information EFs, where one card information EF corresponds to one external authentication key, the first DF may also include one or more external authentication keys. The electronic device 100 may use the one or more external authentication keys in the first DF in sequence to decrypt the authentication ciphertext through the first Applet. When the first random number is successfully decrypted using one of the external authentication keys in the first DF, it indicates that the external authentication key is the first external authentication key, and the electronic device 100 has successfully authenticated the NFC card reader 200.

[0315] S1023. After the electronic device 100 decrypts the first random number from the authentication ciphertext using the first external authentication key in the first DF through the first applet, it sends a response (Response) 4, where the response 4 carries the first authentication result. The first authentication result is used to indicate that the electronic device 100 successfully decrypted the first random number from the authentication ciphertext.

[0316] S1024. After receiving the response 4 carrying the first authentication result, the NFC card reader 200 sends a card information acquisition command to the electronic device 100.

[0317] The card information acquisition command is used to acquire the card information of the first NFC simulated card stored in the first DF.

[0318] S1025. After receiving the card information acquisition command, the electronic device 100 uses the first external authentication key and the first random number to encrypt the card information of the first NFC simulated card stored in the first DF through the first Applet to obtain encrypted data.

[0319] S1026 . The electronic device 100 sends the encrypted data to the NFC card reader 200 .

[0320] S1027. After receiving the encrypted data, the NFC card reader 200 can use the first external authentication key and the first random number to decrypt the card information of the first NFC simulated card from the encrypted data, and perform the card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card.

[0321] In one possible implementation, the first NFC simulated card may have one or more card information. If the one or more external authentication keys stored in the first DF are the same and are all the above-mentioned first external authentication keys, the electronic device 100 can encrypt the one or more card information of the first NFC simulated card stored in the first DF using the first external authentication key through the first Applet to obtain encrypted data. After receiving the encrypted data, the NFC card reader device 200 can use the first external authentication key to decrypt the one or more card information of the first NFC simulated card from the first DF. The NFC card reader device 200 can perform a card swiping service based on the one or more card information of the first NFC simulation. If the NFC card reader device 200 successfully swipes the card based on any one of the one or more card information of the first NFC simulation, it means that the first NFC simulated card swiping is successful. If the NFC card reader device 200 fails to swipe the card based on all one or more card information of the first NFC simulation, it means that the first NFC simulated card swiping fails.

[0322] In one possible implementation, the first NFC emulated card may have multiple pieces of card information, and the multiple external authentication keys stored in the first DF may not all be the same. After determining the first external authentication key from the multiple external authentication keys, the electronic device 100 may determine one or more pieces of card information EF corresponding to the first external authentication key and obtain one or more pieces of target card information of the first NFC emulated card from the one or more pieces of card information EF corresponding to the first external authentication key. The electronic device 100 may encrypt the one or more pieces of target card information of the first NFC emulated card using the first external authentication key via a first applet to obtain encrypted data. After receiving the encrypted data, the NFC card reader 200 may decrypt the one or more pieces of target card information from the first DF using the first external authentication key. The NFC card reader 200 may perform a card swiping service based on the one or more pieces of target card information of the first NFC emulated card. If the NFC card reader 200 successfully swipes the card based on any one of the one or more pieces of target card information of the first NFC emulated card, the swiping of the first NFC emulated card is successful. If the NFC card reader 200 fails to swipe the card based on any of the one or more pieces of target card information of the first NFC emulated card, the swiping of the first NFC emulated card is unsuccessful.

[0323] Among them, card swiping services may include opening access control, unlocking doors, unlocking vehicles, transaction payments, electronic ticket verification, digital certificate verification, and swiping transportation cards to get on and off the bus.

[0324] The card information of the first NFC simulated card may include one or more of access control information, key information, transaction account information, and electronic ticket information. The access control information may include one or more of the card number and the card number's expiration date. The key information may include one or more of the key code and the key code's expiration date. The transaction account information may include one or more of the transaction account identifier and the remaining balance in the transaction account. The electronic ticket information may include one or more of the electronic ticket code, the electronic ticket verification time, and the electronic ticket's expiration date.

[0325] S1028. The NFC card reader 200 sends the card swiping result to the electronic device 100.

[0326] The card swipe result includes a first card swipe result or a second card swipe result. The first card swipe result is used to indicate that the first NFC simulated card swipe was successful, and the second card swipe result is used to indicate that the first NFC simulated card swipe failed. If the NFC card reader 200 successfully performs the card swipe based on the card information of the first NFC simulated card, the NFC card reader 200 may send the first card swipe result.

[0327] If the NFC card reader 200 fails to execute the card swiping service based on the card information of the first NFC simulated card, the NFC card reader 200 may send a second card swiping result.

[0328] After receiving the card swiping result, the electronic device 100 can output a prompt corresponding to the card swiping result. Figure 8D or Figure 9D The embodiments shown will not be described in detail here.

[0329] S1029. After receiving the card swiping result, the electronic device 100 may send a response (Response) 5 to the NFC card reader 200, where the response 5 is used to indicate that the electronic device 100 has successfully received the card swiping result.

[0330] In one possible implementation, step S1006 is optional, and the electronic device 100 may not output the card swipe prompt for the first NFC simulated card. When the physical NFC tag is brought into close proximity with the NFC card reader 200, the NFC tag may execute other steps performed by the electronic device 100 in addition to step S1006, as the NFC tag does not have a display or audio output module.

[0331] In one possible implementation, steps S1017 to S1023 are optional, and the NFC card reader 200 may directly execute step S1024 after receiving response 2. After receiving the card information acquisition command, the electronic device 100 may not encrypt the card information of the first NFC simulated card and directly send the card information of the first NFC simulated card to the NFC card reader 200. After receiving the card information of the first NFC simulated card, the NFC card reader 200 may perform the card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card.

[0332] In the embodiment of the present application, the above response 1 can be called the first response, the above response 2 can be called the second response, the above response 3 can be called the third response, the above response 4 can be called the fourth response, and the above response 5 can be called the fifth response.

[0333] A near field communication method is provided in an embodiment of the present application. When the electronic device 100 enters the radio frequency field emitted by the NFC card reader device 200, the electronic device 100 can receive a probe frame emitted by the NFC card reader device 200. After receiving the Probe frame, the electronic device 100 can send a probe confirmation (ProbeAcknowledge, Probe ACK) frame to the NFC card reader device 200. The Probe ACK frame can be used to indicate that the electronic device 100 has received the Probe frame. After receiving the Probe frame, the NFC card reader device 200 can send a notification (Notify) frame to the electronic device 100, wherein the Notify frame carries the device feature information of the NFC card reader device 200. After receiving the Notify frame, the electronic device 100 can determine the first NFC simulated card from one or more NFC simulated cards based on the device feature information of the NFC card reader device 200 and display the card swiping interface of the first NFC simulated card. The NFC card reader device 200 can obtain the first mapping list in the electronic device 100 and determine the first DF storing the card information of the first NFC simulated card from the first mapping list. Then, the NFC card reader 200 can obtain the card information of the first NFC simulated card stored in the first DF from the electronic device 100, and then complete the card swiping service of the first NFC simulated card. In this way, the electronic device 100 can automatically and accurately select the appropriate NFC simulated card, quickly pop up the card swiping interface of the first NFC simulated card and complete the card swiping service, thereby improving the speed and efficiency of NFC card swiping.

[0334] A near field communication method provided in another embodiment of the present application is introduced below in conjunction with NFC signaling interaction.

[0335] Figure 12 The following is a flow chart showing an NFC simulated card selection method provided in an embodiment of the present application.

[0336] like Figure 12 As shown, the NFC simulated card selection method can be applied to a communication system including an electronic device 100 and an NFC card reader device 200. The NFC card reader device 200 can operate in PCD mode. The electronic device 100 can be in PICC mode by default after the NFC function is turned on. The NFC simulated card selection method may include the following steps:

[0337] S1201 . The electronic device 100 enters the radio frequency field of the NFC card reader 200 .

[0338] S1202. The NFC card reader 200 sends a probe frame.

[0339] S1203. After receiving the Probe frame, the electronic device 100 sends a Probe ACK frame to the NFC card reader 200.

[0340] For details about steps S1201 to S1203, please refer to the above Figure 6 Steps S601 to S603 in the illustrated embodiment are not described in detail here.

[0341] S1204. After receiving the Probe ACK frame, the NFC card reader device 200 sends a Notify frame to the electronic device 100, where the Notify frame carries the device feature information of the NFC card reader device 200 and the identifier of the first Applet.

[0342] S1205 . The electronic device 100 determines a first NFC simulated card from one or more NFC simulated cards on the electronic device 100 based on the device feature information of the NFC card reader 200 .

[0343] For specific content, please refer to the above Figure 6 Step S605 in the illustrated embodiment will not be described in detail here.

[0344] S1206. After determining the first NFC simulated card, the electronic device 100 outputs a card swiping prompt for the first NFC simulated card.

[0345] For specific content, please refer to the above Figure 6 Step S606 in the illustrated embodiment will not be described in detail here.

[0346] S1207. The electronic device 100 determines the identifier of the first DF based on the device feature information of the NFC card reader 200 and the first mapping list, wherein the first mapping list is used to indicate the mapping relationship between the device feature information and the identifier of the DF.

[0347] For a detailed description of the first mapping list, please refer to the above Figure 11 The embodiments shown will not be described in detail here.

[0348] S1208. After determining the first NFC simulated card, the electronic device 100 sends a Notify ACK frame to the NFC card reader 200. The Notify ACK frame carries a first notification result. The first notification result can be used to indicate that the electronic device 100 has successfully selected the first NFC simulated card.

[0349] S1209. After receiving the response 2, the NFC card reader 200 sends a random number acquisition (GetChallenge) command to the electronic device 100.

[0350] S1210. The electronic device 100 generates a first random number through the first Applet.

[0351] S1211. The electronic device 100 sends a response (Response) 3 to the NFC card reader 200, where the response 3 carries a first random number.

[0352] S1212. After receiving the response 3, the NFC card reader 200 encrypts the first random number using the first external authentication key to obtain an authentication ciphertext.

[0353] S1213. The NFC card reader 200 sends an external authentication command to the electronic device 100, wherein the external authentication command carries an authentication ciphertext.

[0354] S1214. After receiving the external authentication command, the electronic device 100 obtains the first DF based on the identifier of the first DF through the first Applet, and uses the first external authentication key in the first DF to decrypt the first random number from the authentication ciphertext.

[0355] S1215. After the electronic device 100 decrypts the first random number from the authentication ciphertext using the first external authentication key in the first DF through the first applet, it sends a response (Response) 4, where the response 4 carries the first authentication result. The first authentication result indicates that the electronic device 100 successfully decrypted the first random number from the authentication ciphertext.

[0356] S1216. After receiving the response 4 carrying the first authentication result, the NFC card reader 200 sends a card information acquisition command to the electronic device 100.

[0357] The card information acquisition command is used to acquire the card information of the first NFC simulated card stored in the first DF.

[0358] S1217. After receiving the card information acquisition command, the electronic device 100 uses the first external authentication key and the first random number through the first Applet to encrypt the card information of the first NFC simulated card stored in the first DF to obtain encrypted data.

[0359] S1218. The electronic device 100 sends the encrypted data to the NFC card reader 200.

[0360] S1219. After receiving the encrypted data, the NFC card reader 200 can use the first external authentication key and the first random number to decrypt the card information of the first NFC simulated card from the encrypted data, and perform the card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card.

[0361] S1220. The NFC card reader 200 sends the card swiping result to the electronic device 100.

[0362] S1221. After receiving the card swiping result, the electronic device 100 may send a response (Response) 5 to the NFC card reader 200, where the response 5 is used to indicate that the electronic device 100 has successfully received the card swiping result.

[0363] For details about steps S1209 to S1221, please refer to the above Figure 10 Steps S1017 to S1029 in the illustrated embodiment are not described in detail here.

[0364] In one possible implementation, step S1206 is optional, and the electronic device 100 may not output the card swipe prompt for the first NFC simulated card. When the physical NFC tag is brought into close proximity with the NFC card reader 200, the NFC tag may execute other steps performed by the electronic device 100 in addition to step S1206, as the NFC tag does not have a display or audio output module.

[0365] In one possible implementation, steps S1209 to S1215 are optional. After receiving the Notify ACK frame, the NFC card reader 200 may directly proceed to step S1216. After receiving the card information acquisition command, the electronic device 100 may not encrypt the card information of the first NFC simulated card and directly send the card information of the first NFC simulated card to the NFC card reader 200. After receiving the card information of the first NFC simulated card, the NFC card reader 200 may perform the card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card.

[0366] In the embodiment of the present application, the above response 3 can be called a third response, the above response 4 can be called a fourth response, and the above response 5 can be called a fifth response.

[0367] A near field communication method is provided in an embodiment of the present application. When the electronic device 100 enters the radio frequency field emitted by the NFC card reader device 200, the electronic device 100 can receive a probe (Probe) frame emitted by the NFC card reader device 200. After receiving the Probe frame, the electronic device 100 can send a probe confirmation (ProbeAcknowledge, Probe ACK) frame to the NFC card reader device 200. The Probe ACK frame can be used to indicate that the electronic device 100 has received the Probe frame. After receiving the Probe frame, the NFC card reader device 200 can send a notification (Notify) frame to the electronic device 100, wherein the Notify frame carries the device feature information of the NFC card reader device 200 and the identifier of the first Applet. After receiving the Notify frame, the electronic device 100 can determine the first NFC simulated card from one or more NFC simulated cards based on the device feature information of the NFC card reader device 200 and display the card swiping interface of the first NFC simulated card. The electronic device 100 can determine the first DF storing the card information of the first NFC simulated card from the first mapping list based on the device feature information of the NFC card reader device 200 through the first Applet. Then, the electronic device 100 can send the card information of the first NFC simulated card stored in the first DF to the NFC card reader 200, and then let the NFC card reader 200 complete the card swiping service of the first NFC simulated card. In this way, the electronic device 100 can automatically and accurately select the appropriate NFC simulated card, quickly pop up the card swiping interface of the first NFC simulated card and complete the card swiping service, thereby improving the speed and efficiency of NFC card swiping.

[0368] In the embodiment of the present application, the above Figure 6 、 Figure 10 and Figure 12 The NFC protocol in the illustrated embodiment may be referred to as a first NFC protocol.

[0369] The following describes the second NFC protocol provided in the embodiments of the present application.

[0370] Figure 13 This is a schematic diagram of the card swiping process of the second NFC protocol provided in an embodiment of the present application.

[0371] like Figure 13As shown, the card swiping process of the second NFC protocol can be applied to an NFC system including an electronic device 100 and an NFC card reader device 200. Among them, the electronic device 100 can be in PICC mode. For example, after the electronic device 100 turns on the NFC function, it is in PICC mode by default, and the NFC card reader device 200 can be in PCD mode. The card swiping process of the second NFC protocol may include a signaling interaction process of the access layer and a data transmission process of the application layer. Among them, the signaling interaction process of the access layer in the second NFC protocol can refer to the standard protocol "ISO / IEC14443-3 protocol". The data transmission process of the application layer in the second NFC protocol can refer to the standard protocol "ISO / IEC14443-4 protocol".

[0372] The card swiping process of the second NFC protocol may include the following steps S1301 to S1313. The access layer protocol process in the second NFC protocol may include steps S1302 to S1307. The data transmission process in the application layer in the second NFC protocol may include steps S1308 to S1313.

[0373] S1301 . The electronic device 100 enters the radio frequency field of the NFC card reader 200 .

[0374] S1302 . The NFC card reader 200 may send a request command of the second NFC protocol to the electronic device 100 .

[0375] In some embodiments of the present application, the NFC card reader device 200 in PCD mode can broadcast a request command through the radio frequency field. When the electronic device 100 in PICC mode enters the radio frequency field of the NFC card reader device 200, the electronic device 100 can receive the request command broadcast by the NFC card reader device 200.

[0376] In some embodiments of the present application, the request command may be a request command type A (REQA) or a request command type B (REQB) in the ISO 14443-3 protocol / IEC 14443-3 protocol.

[0377] S1303 . The electronic device 100 may send a request response command of the second NFC protocol to the NFC card reader 200 .

[0378] In some embodiments of the present application, the request response command may be a type A request reply command (answer to request type A, ATQA) or a type B request reply command (answer to request type B, ATQB) in the "ISO / IEC14443-3 protocol". In the ISO / IEC14443-3 protocol, an NFC device in PICC mode that receives REQA / REQB may return ATQA / ATQB if it supports the ISO / IEC14443-3 protocol. In some embodiments of the present application, the electronic device 100 includes an NFC emulation card that supports an NFC protocol (e.g., the ISO / IEC14443 protocol). Therefore, after the electronic device 100 receives the request command broadcast by the NFC card reader device 200, it may send a request response command to the NFC card reader device 200.

[0379] In some embodiments of the present application, the electronic device 100 may generate a request response command based on the request response command parameter in the NFC parameters of the activated NFC emulated card, and send the request response command to the NFC card reader device 200. In some examples, the request response command sent by the electronic device 100 may indicate whether the NFC emulated card in the electronic device 100 supports the anti-collision mechanism in the access layer protocol process, such as the bit-oriented anti-collision mechanism in the ISO / IEC14443-3 protocol. In some examples, the request response command sent by the electronic device 100 may include the length of the unique identifier (UID) of the NFC emulated card in the electronic device 100.

[0380] In some embodiments of the present application, the NFC card reader device 200 can determine whether the electronic device 100 supports the anti-collision mechanism in the access layer protocol process based on the request response command sent by the electronic device 100. If the judgment result is yes, the request response command sent by the electronic device 100 is verified to be successful; if the judgment result is no, the request response command is verified to fail.

[0381] In some embodiments of the present application, the NFC card reader device 200 can not only determine whether the electronic device 100 supports the anti-collision mechanism in the access layer protocol, but also determine whether the length of the UID carried in the request response command (i.e., the UID of the NFC simulated card in the activated state in the electronic device 100) is consistent with the preset length range of the NFC card reader device 200. For example, the preset length range is the range of the UID length of the target PICC required by the NFC card reader device 200. When the electronic device 100 supports the anti-collision mechanism in the access layer protocol and the length of the UID carried in the request response command is consistent with the preset length range of the NFC card reader device 200, the NFC card reader device 200 verifies that the request response command sent by the electronic device 100 is successful; otherwise, the verification fails.

[0382] In some embodiments of the present application, when the NFC card reader device 200 verifies the request response command sent by the electronic device 100 and passes it, the NFC card reader device 200 may continue with the subsequent process of the access layer protocol, for example, executing S1304.

[0383] S1304 . The NFC card reader 200 may send an anti-collision command to the electronic device 100 .

[0384] In some embodiments of the present application, the anti-collision command may instruct an NFC device in PICC mode to return the entire UID. In some embodiments of the present application, the SEL field in the anti-collision command has a value of 93, and the NVB field has a value of 20. In some embodiments of the present application, the anti-collision command may also be referred to as a select command. The anti-collision command and the select command described in S1306 may be different select commands, for example, including different fields and having different values.

[0385] S1305. The electronic device 100 may send the UID of the activated NFC simulated card to the NFC card reader 200.

[0386] In some embodiments of the present application, the electronic device 100 may send the UID parameter in the NFC parameters of the activated NFC simulation card to the NFC card reader 200 .

[0387] S1306 . The NFC card reader 200 may send a select command to the electronic device 100 .

[0388] In some embodiments of the present application, the NFC card reader device 200 may determine that the electronic device 100 is selected, and thus may send a selection command to the electronic device 100. In some examples, after the NFC card reader device 200 sends the anti-collision command, it receives a UID sent by the electronic device 100, and there is no conflict between multiple NFC devices in PICC mode (i.e., there is no card conflict), so the NFC card reader device 200 may determine that the electronic device 100 is selected.

[0389] In some embodiments of the present application, the selection command may include an SEL field, an NVB field, all UIDs and CRC codes of the selected electronic device 100 , the SEL field may take a value of 20, and the NVB field may take a value of 70.

[0390] S1307: The electronic device 100 may send a select acknowledge (SAK) command to the NFC card reader 200. The select acknowledge command is used to indicate support for the application layer protocol process.

[0391] Because the activated NFC emulated card in the electronic device 100 supports the second NFC protocol, that is, the application layer protocol process, the selection confirmation command sent by the electronic device 100 to the NFC card reader 200 indicates support for the application layer protocol process. Therefore, when the received selection confirmation command indicates support for the application layer protocol process, the NFC card reader 200 can verify that the selection confirmation command has passed.

[0392] In some embodiments of the present application, when the NFC card reader device 200 verifies and passes the selection confirmation command sent by the electronic device 100, the NFC card reader device 200 may initiate an application layer protocol process, for example, may execute S1308.

[0393] S1308. The NFC card reader 200 may send a request for answer to select (RATS) command to the electronic device 100.

[0394] S1309. The electronic device 100 may send an answer to select (ATS) command to the NFC card reader 200.

[0395] In some embodiments of the present application, the electronic device 100 includes an NFC emulation card that supports the application layer protocol. Therefore, after the electronic device 100 receives the RATS command sent by the NFC card reader 200, it can send an ATS command to the NFC card reader 200.

[0396] In some embodiments of the present application, the ATS command can be used for the electronic device 100 and the NFC card reader device 200 to negotiate the communication parameters used in the communication process of the application layer protocol. The ATS command may include the communication parameters used in the electronic device 100 to implement the communication process of the application layer protocol, such as a length byte (indicating the frame length), an interface byte 1 (indicating the rate), an interface byte 2 (indicating the frame waiting time (FWT) and the start frame protection time (SFGT)), an interface byte 3 (indicating whether the logical channel number (channel identity, CID) is supported) and a history byte, etc.

[0397] In some embodiments of the present application, the NFC card reader device 200 can obtain the communication parameters for implementing the communication process of the application layer protocol in the electronic device 100 based on the answer to select (ATS) command, and the NFC card reader device 200 can determine whether the communication parameters meet the preset requirements of the NFC card reader device 200, for example, determining whether the communication parameters are the same as the communication parameters required by the NFC card reader device 200 for implementing the communication process of the application layer protocol. If the judgment result is yes, the verification passes; if the judgment result is no, the verification fails. When the NFC card reader device 200 verifies the ATS command, the NFC card reader device 200 and the electronic device 100 can transmit the application protocol data unit (APDU) in the application layer protocol, for example, S1310 can be executed.

[0398] S1310. The NFC card reader 200 may send a small program selection (Select AID) command to the electronic device 100, wherein the Select AID command may carry the identifier of the first Applet.

[0399] S1311. The electronic device 100 determines the target NFC simulated card corresponding to the first Applet according to the identifier of the first Applet.

[0400] S1312. The electronic device 100 sends the card information of the target NFC simulated card to the NFC card reader 200 through the first Applet.

[0401] In some embodiments of the present application, the electronic device 100 can obtain the identifier of the first Applet carried in the selectAID command, and determine whether there is an NFC simulated card corresponding to the first Applet among one or more NFC simulated cards included in the electronic device 100. When an NFC simulated card corresponding to the first Applet is activated on the electronic device 100, the electronic device 100 can send the card information of the target NFC simulated card corresponding to the first Applet to the NFC card reader 200.

[0402] In some examples, the card information of the NFC simulated card may include one or more of access control information, key information, transaction account information, and electronic ticket information. The access control information may include one or more of the card number and the card number's expiration date. The key information may include one or more of the key code and the key code's expiration date. The transaction account information may include one or more of the transaction account identifier and the remaining balance in the transaction account. The electronic ticket information may include one or more of the electronic ticket code, the electronic ticket verification time, and the electronic ticket's expiration date.

[0403] S1313. The NFC card reader 200 executes the card swiping service of the target NFC simulated card based on the card information of the target NFC simulated card.

[0404] Among them, card swiping services may include opening access control, unlocking doors, unlocking vehicles, transaction payments, electronic ticket verification, digital certificate verification, and swiping transportation cards to get on and off the bus.

[0405] Specifically, the electronic device 100 can send the card information of the target NFC simulated card to the NFC card reader 200 through NFC data exchange. The NFC card reader 200 can perform the card swiping service of the target NFC simulated card based on the card information of the target NFC simulated card. The NFC card reader 200 can send the card swiping result of the target NFC simulated card to the electronic device 100 through NFC command exchange.

[0406] The card information of the target NFC simulated card may include one or more of access control information, key information, transaction account information, and electronic ticket information. The access control information may include one or more of the card number and the card number's expiration date. The key information may include one or more of the key code and the key code's expiration date. The transaction account information may include one or more of the transaction account identifier and the remaining balance in the transaction account. The electronic ticket information may include one or more of the electronic ticket code, the electronic ticket verification time, and the electronic ticket's expiration date.

[0407] The following describes the process of the NFC simulated card selection method in an embodiment of the present application in which the NFC card reader 200 supports both the first NFC protocol and the second NFC protocol, and the electronic device 100 also supports both the first NFC protocol and the second NFC protocol.

[0408] Figure 14 A schematic diagram of a flow chart of an NFC simulated card selection method when a first NFC protocol and a second NFC protocol coexist provided in an embodiment of the present application is shown.

[0409] like Figure 14As shown, the electronic device 100 can be in PICC mode. For example, after the electronic device 100 turns on the NFC function, it is in PICC mode by default, and the NFC card reader 200 can be in PCD mode. The card swiping process of the electronic device 100 supporting both the first NFC protocol and the second NFC protocol can include the following steps:

[0410] S1401 . The electronic device 100 enters the radio frequency field of the NFC card reader 200 .

[0411] S1402 . The NFC card reader 200 sends a probe frame of the first NFC protocol to the electronic device 100 .

[0412] S1403 . The NFC card reader 200 sends a request command of the second NFC protocol to the electronic device 100 .

[0413] Since the NFC card reader 200 supports both the first NFC protocol and the second NFC protocol, the NFC card reader 200 can periodically poll and send a probe frame of the first NFC protocol and a request command of the second NFC protocol. In each polling cycle, one probe frame of the first NFC protocol or one request command of the second NFC protocol is sent.

[0414] S1404 . The electronic device 100 sends a Probe ACK frame of the first NFC protocol to the NFC card reader 200 .

[0415] If the electronic device 100 receives a detection frame of the first NFC protocol and a request command of the second NFC protocol in two consecutive polling cycles after entering the RF field of the NFC card reader 200, it can be determined that the NFC card reader 200 supports the first NFC protocol and the second NFC protocol. Therefore, the electronic device 100 can send a notification frame of the first NFC protocol to the NFC card reader 200.

[0416] If the electronic device 100 receives a detection frame of the first NFC protocol in two consecutive polling cycles after entering the RF field of the NFC card reader 200, it can be determined that the NFC card reader 200 only supports the first NFC protocol. Therefore, the electronic device 100 can send a notification frame of the first NFC protocol to the NFC card reader 200.

[0417] If the electronic device 100 receives the detection frame of the second NFC protocol in two consecutive polling cycles after entering the radio frequency field of the NFC card reader 200, it can be determined that the NFC card reader 200 only supports the second NFC protocol. Therefore, the electronic device 100 can send a request response command of the second NFC protocol to the NFC card reader 200. After receiving the request response command of the second NFC protocol, the NFC card reader 200 can perform the above-mentioned communication with the electronic device 100. Figure 13 Steps S1304 to S1313 in the illustrated embodiment are not described in detail here.

[0418] S1405. The NFC card reader device 200 sends a notification (Notify) frame of the first NFC protocol to the electronic device 100, wherein the Notify frame carries device feature information of the NFC card reader device 200.

[0419] The format of the Notify frame can refer to the above Figure 6 The embodiments shown will not be described in detail here.

[0420] S1406. The NFC card reader 200 determines whether there is a first NFC simulated card matching the device feature information of the NFC card reader 200 among the one or more NFC simulated cards supporting the first NFC protocol on the electronic device 100.

[0421] S1407. If there is a first NFC simulated card that matches the device feature information of the NFC card reader device 200 among one or more NFC simulated cards that support the first NFC protocol on the electronic device 100, the electronic device 100 can send a first notification confirmation frame to the NFC card reader device 200, wherein the first notification confirmation frame carries a first notification result, and the first notification result is used to indicate that the electronic device 100 has successfully selected the first NFC simulated card that matches the device feature information of the NFC card reader device 200.

[0422] S1408. After receiving the first notification confirmation frame, the NFC card reader 200 can interact with the electronic device 100 via NFC and perform the card swiping service of the first NFC simulated card.

[0423] The NFC card reader 200 and the electronic device 100 perform data exchange via NFC and execute the card swiping service of the first NFC simulated card. Figure 6 Step S608 or Figure 10 Steps S1008 to S1029 in the embodiment shown or Figure 12 Steps S1209 to S1221 in the illustrated embodiment are not described in detail here.

[0424] S1409. If there is no first NFC simulated card that matches the device feature information of the NFC card reader 200 among the one or more NFC simulated cards that support the first NFC protocol on the electronic device 100, the electronic device 100 can determine whether there are one or more NFC simulated cards that support the second NFC protocol on the electronic device 100.

[0425] S1410. If the electronic device 100 does not have one or more NFC simulated cards that support the second NFC protocol, the electronic device 100 can send a second notification confirmation frame to the NFC card reader 200, wherein the second notification confirmation frame carries a second notification result, and the second notification result is used to indicate that the electronic device 100 failed to select the NFC simulated card.

[0426] After receiving the second notification confirmation frame, the NFC card reader 200 can end the NFC interaction process with the electronic device 100. After ending the NFC interaction process with the electronic device 100, the NFC card reader 200 can periodically poll and send a probe frame (Probe) of the first NFC protocol and a request command of the second NFC protocol.

[0427] S1411. If the electronic device 100 has one or more NFC simulated cards that support the second NFC protocol, the electronic device 100 can send a third notification confirmation frame to the NFC card reader 200, wherein the third notification confirmation frame carries a third notification result, and the third notification result is used to indicate that the electronic device 100 failed to select the NFC simulated card that supports the first NFC protocol, but there is an NFC simulated card that supports the second NFC protocol on the electronic device 100.

[0428] S1412. After receiving the third notification frame, the NFC card reader 200 may send a small program selection (Select AID) command to the electronic device 100, wherein the Select AID command may carry the identifier of the first Applet.

[0429] In one possible implementation, if the electronic device 100 does not have a first NFC simulated card that matches the device feature information of the NFC card reader 200 among the one or more NFC simulated cards that support the first NFC protocol, but the electronic device 100 has one or more NFC simulated cards that support the second NFC protocol, the electronic device 100 may send the above-mentioned first notification confirmation frame to the NFC card reader 200. After receiving the first notification frame, the NFC card reader 200 may send a small program selection (Select AID) command to the electronic device 100, where the SelectAID command may carry the identifier of the first applet.

[0430] S1413. The electronic device 100 determines, based on the identifier of the first Applet, a second NFC simulated card corresponding to the first Applet from one or more NFC simulated cards that support the second NFC protocol.

[0431] In one possible implementation, if there is no first Applet on the electronic device 100, that is, there is no second NFC simulation card corresponding to the first Applet among the one or more NFC simulation cards that support the second NFC protocol. Therefore, the electronic device 100 can send a small program selection failure response to the NFC card reader device 200, wherein the small program selection failure response is used to indicate that there is no first Applet on the electronic device 100. After receiving the small program selection failure response, the NFC card reader device 200 can end the NFC interaction process with the electronic device 100. After ending the NFC interaction process with the electronic device 100, the electronic device 100 can periodically poll and send the detection frame (Probe) of the first NFC protocol and the request command of the second NFC protocol.

[0432] S1414. The electronic device 100 sends the card information of the second NFC simulated card to the NFC card reader 200 through the first Applet.

[0433] S1415. The NFC card reader 200 performs the card swiping service of the second NFC simulated card based on the card information of the second NFC simulated card.

[0434] Among them, card swiping services may include opening access control, unlocking doors, unlocking vehicles, transaction payments, electronic ticket verification, digital certificate verification, and swiping transportation cards to get on and off the bus.

[0435] Specifically, the electronic device 100 can send the card information of the second NFC simulated card to the NFC card reader 200 through NFC data exchange. The NFC card reader 200 can perform the card swiping service of the target NFC simulated card based on the card information of the second NFC simulated card. The NFC card reader 200 can send the card swiping result of the second NFC simulated card to the electronic device 100 through NFC command exchange.

[0436] The card information of the second NFC simulated card may include one or more of access control information, key information, transaction account information, and electronic ticket information. The access control information may include one or more of the card number and the card number's expiration date. The key information may include one or more of the key code and the key code's expiration date. The transaction account information may include one or more of the transaction account identifier and the remaining balance in the transaction account. The electronic ticket information may include one or more of the electronic ticket code, the electronic ticket verification time, and the electronic ticket's expiration date.

[0437] The NFC simulated card selection method provided by the embodiment of the present application can achieve the following situation: when there is no first NFC simulated card matching the device feature information of the NFC card reader 200 among the one or more NFC simulated cards supporting the first NFC protocol on the electronic device 100, but there are one or more NFC simulated cards supporting the second NFC protocol on the electronic device 100, the electronic device 100 can also use the communication process of the first NFC protocol to send the card information of the second NFC simulated card supporting the second NFC protocol to the NFC card reader 200, so that the NFC card reader 200 attempts to execute the card swiping service of the second NFC simulated card, thereby avoiding the need to re-execute the access layer protocol process in the second NFC protocol, thereby saving the time of the electronic device 100 swiping the card on the NFC card reader 200.

[0438] The following describes a process of a near field communication method provided in another embodiment of the present application.

[0439] Because some existing NFC protocols have different signaling interaction processes at the access layer, and the signaling interaction process at the access layer of the NFC protocol is forcibly bound to the NFC service at the application layer, different NFC services require different NFC protocols. Some electronic devices, such as mobile phones, can support multiple NFC services. Therefore, they need to support multiple NFC protocols, which increases the resource and cost requirements of the electronic devices.

[0440] Therefore, a near field communication method is provided in an embodiment of the present application, which can enable the electronic device 100 to receive a probe (Probe) frame transmitted by the NFC card reader device 200 when the electronic device 100 enters the radio frequency field transmitted by the NFC card reader device 200. After receiving the Probe frame, the electronic device 100 can send a probe confirmation (ProbeACK) frame to the NFC card reader device 200, and the Probe ACK frame can be used to indicate that the electronic device 100 has received the Probe frame. After receiving the Probe frame, the NFC card reader device 200 can send a notification (Notify) frame to the electronic device 100, wherein the Notify frame carries the device feature information of the NFC card reader device 200. After receiving the Notify frame, the electronic device 100 can return a Notify ACK frame to the NFC card reader device 200. After receiving the Notify ACK frame, the NFC card reader device 200 can perform application layer data transmission with the electronic device 100. In this way, through the signaling interaction process of the access layer in the NFC communication method, the device feature information of the NFC card reader device 200 is sent to the electronic device 100 using the Notify frame, so that the electronic device 100 can determine the target NFC service based on the device feature information of the NFC card reader device 200 before performing data transmission at the application layer. In this way, the electronic device 100 can prepare the data required for the target NFC service or output a prompt for the target NFC service before performing data transmission at the application layer. In this way, the electronic device 100 and the NFC card reader device 200 can complete different types of NFC services at the application layer after the same signaling interaction process at the access layer through NFC. This saves resources and costs of electronic devices.

[0441] Figure 15 A schematic flow chart of a near field communication method provided in an embodiment of the present application is shown.

[0442] like Figure 15 As shown, the near field communication method can be applied to an NFC system including an electronic device 100 and an NFC card reader 200. The electronic device 100 can be in PICC mode, for example, the electronic device 100 is in PICC mode by default after the NFC function is enabled. The NFC card reader 200 can be in PCD mode.

[0443] The NFC communication method may include the following steps S1501 to S1508. The NFC communication method may include a signaling interaction process at the access layer and a data transmission process at the application layer. The signaling interaction at the access layer may include the following steps S1502 to S1508. In the signaling interaction process at the access layer in the first NFC protocol, steps S1506 and S1507 are optional.

[0444] S1501 . The electronic device 100 enters the radio frequency field of the NFC card reader 200 .

[0445] S1502. The NFC card reader 200 may send a probe frame.

[0446] The Probe frame may be used to indicate that the NFC card reader 200 supports a specified NFC protocol (which may be referred to as a first NFC protocol). The NFC card reader 200 may periodically send the Probe frame.

[0447] For a description of the Probe frame structure, please refer to the above Figure 7A The text part of the illustrated embodiment will not be repeated here.

[0448] S1503. After receiving the Probe frame, the electronic device 100 sends a Probe ACK frame to the NFC card reader 200.

[0449] The Probe ACK frame may be used to indicate that the electronic device 100 supports the specified NFC protocol (which may be referred to as the first NFC protocol) indicated by the Probe frame.

[0450] If the electronic device 100 does not support the specified NFC protocol indicated by the Probe frame, the electronic device 100 may not send the Probe ACK frame.

[0451] S1504. After receiving the Probe ACK frame, the NFC card reader 200 sends a Notify frame to the electronic device 100.

[0452] The Notify frame carries the device characteristic information of the NFC card reader 200. The device characteristic information may include any one or more of a service identifier (SID), a device organization identifier (ND_OUI), and a device group identifier (also known as an NFC device group identifier (ND_GID)).

[0453] 1. A service identifier (SID) may be used to indicate the type of NFC service supported by the NFC card reader 200 based on the NFC function.

[0454] 2. The device organization identifier (ND_OUI) can be used to identify the manufacturer providing NFC services using the NFC card reader 200. The registration authority of the NFC protocol standard organization can assign different device organization identifiers to different manufacturers. For example, manufacturers providing NFC services may include one or more smart door lock manufacturers, one or more property management companies, one or more auto parts manufacturers, one or more transportation card management departments, etc.

[0455] 3. The device group identifier (ND_GID) can be used to indicate the group to which the NFC service provided by the NFC card reader device 200 belongs. The device group identifier can be assigned based on the purpose and location of the NFC card reader device 200. Different NFC services can have different group divisions.

[0456] For a detailed description of the service identifier (SID), device organization identifier (ND_OUI), and device group identifier (also known as NFC device group identifier (ND_GID)), please refer to the aforementioned Figure 6 The embodiments shown are not described in detail here.

[0457] The Notify frame may include a frame control header, a device identification element, and a checksum field. The data length of the frame control header of the Notify frame may be 4 bytes, and the frame control header of the Notify frame may include a protocol identification field, a frame type field, a control information field, and a frame length field. Optionally, the device identification element may also include an element code, an identification mask, a device type identification, and a device individual identification. For a detailed description of the format of the Notify frame, please refer to the above Figure 7B The embodiments shown will not be described in detail here.

[0458] In one possible implementation, after the electronic device 100 obtains the device characteristic information of the NFC card reader 200 from the Notify ACK frame, it can perform an action corresponding to the device characteristic information of the NFC card reader 200 based on the device characteristic information of the NFC card reader 200. The action corresponding to the device characteristic information of the NFC card reader 200 can include outputting an NFC service prompt. For example, the NFC service prompt can be any one or more of a card swipe prompt for an NFC simulated card (e.g., an access card, key card, transportation card, bank card, etc.), a wireless charging prompt, a codeless payment prompt, an electronic ticket prompt, a tap-and-pay function prompt, a multi-function card prompt, and the like.

[0459] S1505. After receiving the Notify frame, the electronic device 100 sends a Notify ACK frame to the NFC card reader 200.

[0460] The Notify ACK frame is used to indicate that the electronic device 100 has received the Notify frame sent by the NFC card reader 200 .

[0461] For example, Figure 16As shown, the Notify ACK frame may include a frame control header and a checksum field. The data length of the frame control header may be 2 bytes, and the data length of the checksum field may be 2 bytes. The frame control header may include a protocol identification field, a frame type field, and a protocol version field. The data length of the protocol identification field may be 1 byte, and the data length of the frame type may be 1 byte. In an embodiment of the present application, a cyclic redundancy check (CRC) may be used to check the NFC transmission frame. Therefore, the checksum field of the Notify frame may carry a CRC code. The protocol identification field in the Notify ACK frame may be used to indicate the first NFC protocol used by the NFC card reader 200 when sending the Notify ACK frame. The value of the protocol identification field may be the identifier of the first NFC protocol, for example, "0x7C". The frame type field in the Notify ACK frame may be used to indicate the frame type of the Notify ACK frame. For example, the value of the frame type field of the Notify ACK frame may be "0x08".

[0462] S1506 . After receiving the Notify ACK frame, the NFC card reader 200 may send a parameter negotiation command to the electronic device 100 .

[0463] S1507 . After receiving the parameter negotiation command, the electronic device 100 may send a parameter negotiation response to the NFC card reader 200 .

[0464] The parameter negotiation command frame type may be a command frame, and the parameter negotiation response frame type may be a response frame. The parameter negotiation command and parameter negotiation response may be used by the NFC card reader 200 and the electronic device 100 to negotiate application-layer data transmission parameters. The data transmission parameters may include any one or more of the maximum transmission rate and maximum data transmission length during application-layer data transmission.

[0465] S1508. The NFC card reader 200 performs application layer data transmission with the electronic device 100.

[0466] The NFC card reader 200 and the electronic device 100 may perform application layer data transmission according to the data transmission parameters negotiated through the parameter negotiation command and the parameter negotiation response.

[0467] In one possible implementation, the above steps S1506 and S1507 are optional. If the NFC card reader device 200 does not need to send a parameter negotiation command to the electronic device 100 after receiving the Notify ACK frame, the NFC card reader device 200 and the electronic device 100 can perform application layer data transmission using default data transmission parameters.

[0468] An NFC communication method is provided in the embodiment of the present application. Through the signaling interaction process of the access layer in the NFC communication method, the device feature information of the NFC card reader device 200 is sent to the electronic device 100 using a Notify frame, so that the electronic device 100 can determine the target NFC service based on the device feature information of the NFC card reader device 200 before performing data transmission at the application layer. In this way, the electronic device 100 can prepare the data required for the target NFC service or output a prompt for the target NFC service before performing data transmission at the application layer. In this way, the electronic device 100 and the NFC card reader device 200 can complete different types of NFC services at the application layer after the same signaling interaction process at the access layer through NFC. The resources and costs of the electronic device are saved.

[0469] In an example of an embodiment of the present application, the Probe frame may be referred to as a first NFC frame, the Probe ACK frame may be referred to as a second NFC frame, the Notify frame may be referred to as a third NFC frame, and the Notify ACK frame may be referred to as a fourth NFC frame.

[0470] The following describes the NFC simulated card swiping process in the near field communication method provided in the embodiment of the present application, in conjunction with a scenario in which one or more NFC simulated cards are activated on the electronic device 100.

[0471] Figure 17 A schematic diagram of the card swiping process of an NFC simulated card in a near field communication method provided in an embodiment of the present application is shown.

[0472] like Figure 17 As shown, the NFC card swiping process in this near-field communication method can be applied to an NFC system including an electronic device 100 and an NFC card reader 200. The electronic device 100 can be in PICC mode, for example, which is the default mode after the NFC function is enabled. The NFC card reader 200 can be in PCD mode. The NFC card swiping process can include a signaling interaction process at the access layer and a data transmission process at the application layer.

[0473] The NFC card swiping process may include steps S1701 to S1710. The access layer signaling interaction process in the NFC card swiping process may include steps S1702 to S1707. Steps S1706 and S1707 are optional during the access layer signaling interaction process. The application layer data transmission process in the NFC card swiping process may include steps S1708 to S1710.

[0474] S1701 . The electronic device 100 enters the radio frequency field of the NFC card reader 200 .

[0475] S1702. The NFC card reader 200 may send a probe frame.

[0476] S1703. After receiving the Probe frame, the electronic device 100 sends a Probe ACK frame to the NFC card reader 200.

[0477] S1704. After receiving the Probe ACK frame, the NFC card reader 200 sends a Notify frame to the electronic device 100.

[0478] The Notify frame carries the device feature information of the NFC card reader 200 .

[0479] S1705. After receiving the Notify frame, the electronic device 100 sends a Notify ACK frame to the NFC card reader 200.

[0480] S1706. After receiving the Notify ACK frame, the NFC card reader 200 may send a parameter negotiation command to the electronic device 100.

[0481] S1707. After receiving the parameter negotiation command, the electronic device 100 may send a parameter negotiation response to the NFC card reader 200.

[0482] For the process from step S1701 to step S1707, please refer to the above Figure 15 Steps S1501 to S1507 in the illustrated embodiment are not described in detail here.

[0483] S1708. After receiving the parameter negotiation response, the NFC card reader 200 sends a small program selection (Select AID) command to the electronic device 100. The small program selection (Select AID) command carries the identifier of the first applet.

[0484] S1709. The electronic device 100 determines the first NFC simulated card corresponding to the first Applet based on the identifier of the first Applet.

[0485] S1710. After determining the first NFC simulated card corresponding to the first Applet, the electronic device 100 sends the card information of the first NFC simulated card to the NFC card reader 200 through the first Applet.

[0486] In some embodiments of the present application, the electronic device 100 can obtain the identifier of the first Applet carried in the selectAID command, and determine whether there is an NFC simulated card corresponding to the first Applet among one or more NFC simulated cards included in the electronic device 100. When an NFC simulated card corresponding to the first Applet is activated on the electronic device 100, the electronic device 100 can send the card information of the target NFC simulated card corresponding to the first Applet to the NFC card reader 200.

[0487] In some examples, the card information of the NFC simulated card may include one or more of access control information, key information, transaction account information, and electronic ticket information. The access control information may include one or more of the card number and the card number's expiration date. The key information may include one or more of the key code and the key code's expiration date. The transaction account information may include one or more of the transaction account identifier and the remaining balance in the transaction account. The electronic ticket information may include one or more of the electronic ticket code, the electronic ticket verification time, and the electronic ticket's expiration date.

[0488] The NFC card reader 200 performs a card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card.

[0489] Among them, card swiping services may include opening access control, unlocking doors, unlocking vehicles, transaction payments, electronic ticket verification, digital certificate verification, and swiping transportation cards to get on and off the bus.

[0490] Specifically, the electronic device 100 can send the card information of the target NFC simulated card to the NFC card reader 200 through NFC data exchange. The NFC card reader 200 can perform the card swiping service of the target NFC simulated card based on the card information of the target NFC simulated card. The NFC card reader 200 can send the card swiping result of the target NFC simulated card to the electronic device 100 through NFC command exchange.

[0491] The card information of the target NFC simulated card may include one or more of access control information, key information, transaction account information, and electronic ticket information. The access control information may include one or more of the card number and the card number's expiration date. The key information may include one or more of the key code and the key code's expiration date. The transaction account information may include one or more of the transaction account identifier and the remaining balance in the transaction account. The electronic ticket information may include one or more of the electronic ticket code, the electronic ticket verification time, and the electronic ticket's expiration date.

[0492] Through the NFC simulated card swiping process in the near field communication method provided in the embodiment of the present application, through the signaling interaction process of the access layer in the NFC communication method, the device feature information of the NFC card reader 200 is sent to the electronic device 100 through the Notify frame, so that the electronic device 100 can determine the target NFC service based on the device feature information of the NFC card reader 200 before performing application layer data transmission. During the application layer data transmission process, the NFC card reader 200 can send a Select AID command to the electronic device 100, wherein the Select AID command carries the identifier of the first applet, so that the electronic device 100 can determine the first NFC simulated card corresponding to the first applet based on the identifier of the first applet, and send the card information of the first NFC simulated card to the NFC card reader 200, so that the NFC card reader 200 can complete the card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card. In this way, the electronic device 100 and the NFC card reader 200 can complete the card swiping operation under different NFC services.

[0493] The following describes in detail the NFC simulated card swiping process in the embodiment of the present application in combination with the scenario where one or more NFC simulated cards are activated on the electronic device 100.

[0494] Figure 18 A schematic diagram of the specific card swiping process of the NFC simulated card provided in an embodiment of the present application is shown.

[0495] like Figure 18 As shown, the NFC simulated card swiping process can be applied to an NFC system including an electronic device 100 and an NFC card reader device 200. The electronic device 100 can be in PICC mode. For example, the electronic device 100 is in PICC mode by default after turning on the NFC function. The NFC card reader device 200 can be in PCD mode. The electronic device 100 may include a processor 101 and an NFC module 102. An application may be running in the processor 101. The application may include any one of NFC-related native applications (for example, a wallet application), HCE applications, etc.

[0496] The NFC simulated card swiping process may include the following steps S1801 to S1828.

[0497] S1801 . The electronic device 100 enters the radio frequency field of the NFC card reader 200 .

[0498] S1802. The NFC card reader 200 may send a probe frame.

[0499] S1803. After receiving the Probe frame, the NFC module 102 sends a Probe ACK frame to the NFC module 102.

[0500] S1804. After receiving the Probe ACK frame, the NFC card reader 200 sends a Notify frame.

[0501] The Notify frame carries the device feature information of the NFC card reader 200 .

[0502] S1805. After receiving the Notify frame, the NFC module 102 sends a Notify ACK frame to the NFC card reader 200.

[0503] S1806. After receiving the Notify ACK frame, the NFC card reader 200 may send a parameter negotiation command to the NFC module 102.

[0504] S1807. After receiving the parameter negotiation command, the NFC module 102 may send a parameter negotiation response to the NFC card reader 200.

[0505] Among them, steps S1801 to S1807 can refer to the above Figure 15 Steps S1501 to S1507 in the illustrated embodiment are not described in detail here.

[0506] S1808. After receiving the Notify frame, the NFC module 102 may send the device feature information of the NFC card reader 200 to the application.

[0507] S1809. After receiving the device characteristic information of the NFC card reader 200, the application may determine and output a card swiping prompt of the first NFC simulated card based on the device characteristic information of the NFC card reader 200.

[0508] Among them, the application can manage and store the correspondence between device feature information and NFC simulated cards. For example, the correspondence between device feature information and NFC simulated cards can be stored in the application or in the trusted execution environment (TEE) of the processor 101. The application can determine the first NFC simulated card from one or more NFC simulated cards of the electronic device 100 based on the device feature information of the NFC card reader device 200 and the correspondence between the device feature information and the NFC simulated card. The application running in the processor 101 (for example, a wallet application) can display a card swiping prompt for the first NFC simulated card.

[0509] The first NFC simulated card swipe prompt can be used to prompt the electronic device that the first NFC simulated card is being used to swipe the card. The first NFC simulated card swipe prompt can include one or more of an image prompt, a text prompt, an audio prompt, and a vibration prompt. The image prompt can include one or more of a static image prompt, a dynamic image prompt, and a video prompt.

[0510] For example, after determining the first NFC simulated card, the application can display a card swiping interface for the first NFC simulated card, wherein the card swiping interface for the first NFC simulated card can include prompt information for the first NFC simulated card. For example, the prompt information can be a card-shaped icon with the name of the first NFC simulated card displayed on the card-shaped icon. The card swiping interface for the first NFC simulated card can be used to prompt the user that the electronic device 100 is swiping the card using the first NFC simulated card.

[0511] S1810. The NFC card reader 200 sends a Select AID command to the NFC module 102. The Select AID command carries the identifier of the first applet.

[0512] S1811. After receiving the Select AID command, the NFC module 102 determines the first applet from one or more applets based on the identifier of the first applet.

[0513] S1812. The NFC module 102 sends a response 1 to the NFC card reader 200, where the response 1 is used to indicate that the electronic device 100 has successfully selected the first Applet.

[0514] Among them, the service processing logic of the NFC simulation card in the electronic device 100 is specifically implemented by an applet. The applet can be stored and run in the hardware device or software module corresponding to the NFC simulation card (for example, NFC module 102, HCE application, SIM card, SE, etc.). Since one or more NFC simulation cards are activated on the electronic device 100. Therefore, there can be one or more applets on the electronic device 100. Among them, one NFC simulation card corresponds to one applet.

[0515] Each Applet corresponds to a Master File (MF), and different Applets correspond to different MFs. Therefore, after determining the first Applet, the NFC module 102 can obtain the MF of the first Applet through the first Applet.

[0516] S1813. The NFC module 102 determines the first DF corresponding to the first NFC simulated card from the MF of the first Applet through the first Applet.

[0517] If the MF of the first Applet includes a DF, then the DF is the first DF corresponding to the first NFC simulated card.

[0518] If the MF of the first applet includes multiple DFs, the MF of the first applet may further include a first mapping table, wherein the first mapping table is used to indicate the mapping relationship between the device feature information in the MF of the first applet and the identifier of a dedicated file (DF). The first applet may determine the first DF corresponding to the first NFC simulated card based on the device feature information of the NFC card reader 200 and the first mapping table.

[0519] The electronic device 100 may store data of one or more NFC simulated cards in the form of a file tree. The data of the NFC simulated card may include device feature information, keys, permission information, and other data associated with the NFC simulated card. The file tree may include a master file (MF), a dedicated file (DF), and an elementary file (EF). One or more EFs and one or more DFs may be stored under the MF directory, and one or more EFs may be stored under the directory of each DF. One NFC simulated card corresponds to one DF, and different NFC simulated cards correspond to different DFs. Since one NFC simulated card may correspond to one or more card information, one DF may store one or more card information EFs for storing card information (for example, one DF may support storing up to 8 card information EFs, and the data length of each card information EF may be 4 bytes) and external authentication keys corresponding to one or more card information EFs. The external authentication keys corresponding to different card information EFs in the same DF may be the same or different.

[0520] For example, the NFC simulated cards activated on the electronic device 100 may include the access card of Community A, the access card of Community B, the access card of Community C, the Shenzhentong transportation card, and the door lock key card of the home. Among them, since all the access cards can correspond to the same Applet, the card information of the access card of Community A, the card information of the access card of Community B, and the card information of the access card of Community C can all be placed in different DFs in MF1. The Shenzhentong transportation card corresponds to another Applet, so the card information of the Shenzhentong transportation card can be placed in a DF of MF2. The door lock key card of the home corresponds to a separate Applet, so the card information of the door lock key card of the home can be placed in a DF of MF3.

[0521] For example, Figure 19As shown, MF1 may include key EF1, Applet identity public key EF, Applet identity private key EF, mapping table EF, DF1, DF2 and DF3.

[0522] 1. Key EF1 may include a master key and a maintenance key. The master key in key EF1 can be used for encryption and decryption when data in key EF1 is updated. The maintenance key in key EF1 can be used for encryption and decryption when data in the applet identity public key EF, applet identity private key EF, and mapping table EF are updated.

[0523] 2. Applet identity private key EF can be used to store the identity private keys used by one or more applets.

[0524] 3. Applet identity public key EF can be used to store the identity public keys used by one or more applets.

[0525] 4. Mapping list EF can be used to store the first mapping list described above. The first mapping list is used to indicate the mapping relationship between device feature information and DF identifiers. For example, device feature information 1 corresponds to DF1, which can be used to store the access card data for cell A. Device feature information 2 corresponds to DF2, which can be used to store the access card data for cell B. Device feature information 3 corresponds to DF3, which can be used to store the access card data for cell C.

[0526] 5. DF1 stores key EF11, device feature information EF12, file permission list EF13, and X card information EFs. X is a positive integer. Key EF11 may include a master key, a maintenance key, and X external authentication keys. The master key in key EF11 can be used for encryption and decryption when data in key EF11 is updated. The maintenance key in key EF11 can be used for encryption and decryption when data in device feature information EF12, file permission list EF13, and X card information EFs in DF1 are updated. The X external authentication keys in DF1 correspond to the X card information EFs in DF1, with one external authentication key corresponding to each card information EF. The external authentication keys corresponding to different card information EFs in DF1 can be the same or different. For example, DF1 may include card information EF storing card information 1 and card information EF storing card information 2. Card information 1 can be used to unlock the access control of Building 1 in Community A, and card information 2 can be used to unlock the access control of Building 2 in Community A. Device feature information EF12 can be used to store the device feature information corresponding to DF1. The file permission list EF13 may be used to indicate the read and write permissions of the X card information EFs in DF1.

[0527] 6. DF2 stores key EF21, device feature information EF22, file permission list EF23, and Y card information EFs. Y is a positive integer. Key EF21 may include a master key, a maintenance key, and Y external authentication keys. The master key in key EF21 can be used for encryption and decryption when data in key EF21 is updated. The maintenance key in key EF21 can be used for encryption and decryption when data in device feature information EF22, file permission list EF23, and Y card information EFs in DF2 are updated. The Y external authentication keys in DF2 correspond to the Y card information EFs in DF2. One external authentication key corresponds to one card information EF. The external authentication keys corresponding to different card information EFs in DF2 can be the same or different. For example, DF2 may include card information EF storing card information 3, where card information 3 can be used to open all access control doors within cell B. Device feature information EF22 can be used to store the device feature information corresponding to DF2. File permission list EF23 can be used to indicate the read and write permissions of the Y card information EFs in DF2.

[0528] 7. DF3 stores key EF31, device feature information EF32, file permission list EF33, and Z card information EFs. Z is a positive integer. Key EF31 may include a master key, a maintenance key, and Z external authentication keys. The master key in key EF31 can be used for encryption and decryption when data in key EF31 is updated. The maintenance key in key EF31 can be used for encryption and decryption when data in device feature information EF32, file permission list EF33, and Z card information EFs in DF3 are updated. The Z external authentication keys in DF3 correspond to the Z card information EFs in DF3. One external authentication key corresponds to one card information EF. The external authentication keys corresponding to different card information EFs in DF3 can be the same or different. For example, DF3 may include card information EF storing card information 4, where card information 4 can be used to open all access control doors within cell C. Device feature information EF32 can be used to store the device feature information corresponding to DF3. File permission list EF33 can be used to indicate the read and write permissions of the Z card information EFs in DF3.

[0529] above Figure 19 The examples shown are only used to explain the present application and should not be construed as limiting the present application.

[0530] If the MF corresponding to the first Applet is MF1, the first Applet can obtain the device feature information of the NFC card reader 200 from the NFC module 102 or the application, and then Figure 19The first mapping list is obtained from the mapping list EF of MF1 shown in FIG. Then, the first Applet can determine the first DF corresponding to the first NFC simulated card according to the device feature information of the NFC card reader 200 and the first mapping list.

[0531] S1814. After receiving the response 1, the NFC card reader 200 sends a random number acquisition (GetChallenge) command to the NFC module 102.

[0532] S1815. The NFC module 102 generates a first random number through the first Applet.

[0533] S1816. The NFC module 102 sends a response (Response) 3 to the NFC card reader 200, where the response 3 carries the first random number.

[0534] S1817. After receiving response 3, the NFC card reader 200 encrypts the first random number using the first external authentication key to obtain an authentication ciphertext.

[0535] S1818. The NFC card reader 200 sends an external authentication command to the electronic device 100, wherein the external authentication command carries an authentication ciphertext.

[0536] S1819. After receiving the external authentication command, the NFC module 102 uses the first external authentication key in the first DF through the first Applet to decrypt the first random number from the authentication ciphertext.

[0537] S1820. After decrypting the first random number from the authentication ciphertext using the first external authentication key in the first DF through the first applet, the NFC module 102 sends a response (Response) 4, where Response 4 carries the first authentication result. The first authentication result is used to indicate that the electronic device 100 successfully decrypted the first random number from the authentication ciphertext.

[0538] S1821. After receiving the response 4 carrying the first authentication result, the NFC card reader 200 sends a card information acquisition command to the NFC module 102.

[0539] S1822. After receiving the card information acquisition command, the NFC module 102 uses the first external authentication key and the first random number through the first Applet to encrypt the card information of the first NFC simulated card stored in the first DF to obtain encrypted data.

[0540] S1823. The NFC module 102 sends the encrypted data to the NFC card reader 200.

[0541] S1824. After receiving the encrypted data, the NFC card reader 200 can use the first external authentication key and the first random number to decrypt the card information of the first NFC simulated card from the encrypted data, and perform the card swiping service of the first NFC simulated card based on the card information of the first NFC simulated card.

[0542] S1825. The NFC card reader 200 sends the card swiping result to the NFC module 102.

[0543] S1826. After receiving the card swiping result, the NFC module 102 may send a response (Response) 5 to the NFC card reader 200, where the response 5 is used to indicate that the electronic device 100 has successfully received the card swiping result.

[0544] The specific contents of steps S1814 to S1826 can be found in the above Figure 10 Steps S1017 to S1029 in the illustrated embodiment are not described in detail here.

[0545] S1827. After receiving the card swiping result sent by the NFC card reader 200, the NFC module 102 may send the card swiping result to the application.

[0546] S1828. After receiving the card swiping result, the application can display the card swiping result of the first NFC simulated card.

[0547] A near field communication method is provided in an embodiment of the present application. When the electronic device 100 enters the radio frequency field emitted by the NFC card reader device 200, the electronic device 100 can receive a probe (Probe) frame emitted by the NFC card reader device 200. After receiving the Probe frame, the electronic device 100 can send a probe confirmation (Probe ACK) frame to the NFC card reader device 200. The Probe ACK frame can be used to indicate that the electronic device 100 has received the Probe frame. After receiving the Probe frame, the NFC card reader device 200 can send a notification (Notify) frame to the electronic device 100, wherein the Notify frame carries the device feature information of the NFC card reader device 200. After receiving the Notify frame, the electronic device 100 can determine the first NFC simulated card from one or more NFC simulated cards through the device feature information of the NFC card reader device 200 and display a card swiping prompt for the first NFC simulated card. Then, the NFC card reader device 200 can obtain the card information of the first NFC simulated card stored in the first DF from the electronic device 100, thereby completing the card swiping service of the first NFC simulated card. In this way, the electronic device 100 can automatically and accurately select a suitable NFC simulated card, quickly pop up the card swiping prompt of the first NFC simulated card and complete the card swiping service, thereby improving the speed and efficiency of NFC card swiping.

[0548] The following describes the card swiping process of the near field communication method provided in the embodiment of the present application in conjunction with a scenario in which NFC simulated cards with multiple NFC protocols are activated on the electronic device 100.

[0549] Scenario 1: The electronic device 100 can open a first NFC simulated card with a first NFC protocol and a third NFC simulated card with a third NFC protocol. When the NFC card reader 200 supports swiping the first NFC simulated card with the first NFC protocol but does not support swiping the third simulated card with the third NFC protocol, the NFC card reader 200 and the electronic device 100 can communicate with each other through the above Figure 17 or Figure 18 The card swiping process shown allows the electronic device 100 to select the first NFC simulated card to complete the card swiping.

[0550] Scenario 2: The electronic device 100 can open a first NFC simulated card with a first NFC protocol and a third NFC simulated card with a third NFC protocol. When the NFC card reader 200 supports the first NFC simulated card with a first NFC protocol and the third simulated card with a third NFC protocol for swiping, the NFC card reader 200 and the electronic device 100 can communicate with each other through the following: Figure 20A In the card swiping process shown, the electronic device 100 preferentially selects the first NFC simulated card to complete the card swiping process.

[0551] Figure 20A The diagram shows the card swiping process of an NFC simulated card in a near field communication method provided in another embodiment of the present application.

[0552] like Figure 20A As shown, the card swiping process of the NFC simulated card in the near field communication method can be applied to an NFC system including an electronic device 100 and an NFC card reader device 200. The electronic device 100 can be in PICC mode. For example, the electronic device 100 is in PICC mode by default after turning on the NFC function. The NFC card reader device 200 can be in PCD mode. The electronic device 100 can have a first NFC simulated card of a first NFC protocol and a third NFC simulated card of a third NFC protocol enabled. The NFC card reader device 200 supports card swiping with the first NFC simulated card of the first NFC protocol and the third simulated card of the third NFC protocol.

[0553] The NFC simulated card swiping process may include steps S2001 to S2011. The access layer signaling interaction process in the first NFC protocol may include steps S2003 to S2008. Steps S2007 and S2008 are optional during the access layer signaling interaction process in the first NFC protocol. The application layer data transmission process in the first NFC protocol may include steps S2009 to S2011.

[0554] S2001. The electronic device 100 enters the radio frequency field of the NFC card reader 200.

[0555] S2002. The NFC card reader 200 may send a request command of the third NFC protocol.

[0556] S2003. The NFC card reader 200 may send a probe frame.

[0557] Since the NFC card reader 200 supports swiping of a first NFC simulated card using the first NFC protocol and a third NFC simulated card using the third NFC protocol, the NFC card reader 200 may alternately send a card search request using the third NFC protocol and a card search request using the first NFC protocol. The card search request using the third NFC protocol may be a REQA frame, and the card search request using the first NFC protocol may be a Probe frame.

[0558] If the electronic device 100 receives the first card search request of the third NFC protocol after entering the radio frequency field of the NFC card reader 200, the electronic device 100 may wait to receive the second card search request. If the second card search request is the card search request of the first NFC protocol (i.e., Probe frame), the electronic device 100 may respond to the second card search request by sending a card search response of the first NFC protocol (i.e., Probe ACK frame) to the NFC card reader 200.

[0559] If the electronic device 100 receives the first card search request of the first NFC protocol after entering the radio frequency field of the NFC card reader 200, the electronic device 100 responds to the first card search request and sends a card search response of the first NFC protocol (i.e., Probe ACK frame) to the NFC card reader 200.

[0560] In this way, when the NFC card reader 200 and the electronic device 100 support both the first NFC protocol and the third NFC protocol, the NFC card reader 200 and the electronic device 100 can preferentially use the first NFC protocol for communication.

[0561] S2004. After receiving the Probe frame, the electronic device 100 sends a Probe ACK frame to the NFC card reader 200.

[0562] S2005. After receiving the Probe ACK frame, the NFC card reader 200 sends a Notify frame to the electronic device 100.

[0563] The Notify frame carries the device feature information of the NFC card reader 200 .

[0564] S2006. After receiving the Notify frame, the electronic device 100 sends a Notify ACK frame to the NFC card reader 200.

[0565] S2007. After receiving the Notify ACK frame, the NFC card reader 200 may send a parameter negotiation command to the electronic device 100.

[0566] S2008. After receiving the parameter negotiation command, the electronic device 100 may send a parameter negotiation response to the NFC card reader 200.

[0567] S2009. After receiving the parameter negotiation response, the NFC card reader 200 sends a mini-program selection (Select AID) command to the electronic device 100.

[0568] S2010. The electronic device 100 determines a first NFC simulated card of the first NFC protocol based on the identifier of the first Applet.

[0569] S2011. After determining the first NFC simulated card of the first NFC protocol, the electronic device 100 sends the card information of the first NFC simulated card to the NFC card reader 200 through the first Applet.

[0570] For the process from step S2004 to step S2011, please refer to the above Figure 17 Steps S1703 to S1710 in the illustrated embodiment are not described in detail here.

[0571] Through the above Figure 20A In the NFC simulated card swiping process in the near field communication method shown, when the NFC card reader 200 supports a first NFC simulated card of a first NFC protocol and a third simulated card of a third NFC protocol for swiping, the NFC card reader 200 and the electronic device 100 can prioritize allowing the electronic device 100 to select the first NFC simulated card to complete the card swiping process.

[0572] Scenario 3: The electronic device 100 does not have the first NFC simulated card of the first NFC protocol enabled but has the third NFC simulated card of the third NFC protocol enabled. When the NFC card reader 200 supports the first NFC simulated card of the first NFC protocol and the third simulated card of the third NFC protocol for swiping, the NFC card reader 200 and the electronic device 100 can communicate with each other through the following Figure 20B In the illustrated card swiping process, the electronic device 100 preferentially attempts to select the first NFC protocol to communicate with the NFC card reader 200. If the electronic device 100 cannot select the NFC emulated card of the first NFC protocol, the electronic device 100 and the NFC card reader 200 may terminate the communication process of the first NFC protocol and swipe the card using a third emulated card of a third NFC protocol.

[0573] Figure 20B The diagram shows the card swiping process of an NFC simulated card in a near field communication method provided in another embodiment of the present application.

[0574] like Figure 20B As shown, the card swiping process of the NFC simulated card in the near field communication method can be applied to an NFC system including an electronic device 100 and an NFC card reader device 200. The electronic device 100 can be in PICC mode. For example, the electronic device 100 is in PICC mode by default after turning on the NFC function. The NFC card reader device 200 can be in PCD mode. The electronic device 100 does not have a first NFC simulated card of the first NFC protocol activated, but has a third NFC simulated card of the third NFC protocol activated. The NFC card reader device 200 supports card swiping by the first NFC simulated card of the first NFC protocol and the third simulated card of the third NFC protocol.

[0575] The card swiping process of the NFC simulated card may include the following steps S2101 to S2118. Among them, the signaling interaction process of the access layer in the first NFC protocol may include the following steps S2103 to S2108. Among them, in the signaling interaction process of the access layer in the first NFC protocol, the following steps S2107 and S2108 are optional. The data transmission process of the application layer in the first NFC protocol may include the following steps S2109 to S2111. The data transmission process of the application layer in the first NFC protocol may include the following steps S2109 to S2111. The signaling interaction process of the access layer in the third NFC protocol may include the following steps S2112 to S2118.

[0576] S2101 . The electronic device 100 enters the radio frequency field of the NFC card reader 200 .

[0577] S2102. The NFC card reader 200 may send a request command of the third NFC protocol.

[0578] S2103. The NFC card reader 200 may send a probe frame.

[0579] Since the NFC card reader 200 supports swiping a first NFC simulated card using the first NFC protocol and a third NFC simulated card using the third NFC protocol, the NFC card reader 200 can alternately send a card search request using the third NFC protocol and a card search request using the first NFC protocol during the polling phase. The card search request using the third NFC protocol can be a REQA frame, and the card search request using the first NFC protocol can be a Probe frame.

[0580] If the electronic device 100 receives the first card search request of the third NFC protocol after entering the radio frequency field of the NFC card reader 200, the electronic device 100 may wait to receive the second card search request. If the second card search request is a card search request of the first NFC protocol (i.e., a Probe frame), the electronic device 100 may respond to the second card search request by sending a card search response of the first NFC protocol (i.e., a Probe ACK frame) to the NFC card reader 200. If the second card search request is also a card search request of the third NFC protocol (i.e., a Probe frame), the electronic device 100 may respond to the second card search request by sending a card search response of the third NFC protocol (e.g., ATQA) to the NFC card reader 200.

[0581] If the electronic device 100 receives the first card search request of the first NFC protocol after entering the radio frequency field of the NFC card reader 200, the electronic device 100 responds to the first card search request and sends a card search response of the first NFC protocol (i.e., Probe ACK frame) to the NFC card reader 200.

[0582] In this way, when the NFC card reader 200 and the electronic device 100 support both the first NFC protocol and the third NFC protocol, the NFC card reader 200 and the electronic device 100 can preferentially use the first NFC protocol for communication.

[0583] S2104. After receiving the Probe frame, the electronic device 100 sends a Probe ACK frame to the NFC card reader 200.

[0584] S2105. After receiving the Probe ACK frame, the NFC card reader 200 sends a Notify frame to the electronic device 100.

[0585] The Notify frame carries the device feature information of the NFC card reader 200 .

[0586] S2106. After receiving the Notify frame, the electronic device 100 sends a Notify ACK frame to the NFC card reader 200.

[0587] S2107. After receiving the Notify ACK frame, the NFC card reader 200 may send a parameter negotiation command to the electronic device 100.

[0588] S2108. After receiving the parameter negotiation command, the electronic device 100 may send a parameter negotiation response to the NFC card reader 200.

[0589] S2109. After receiving the parameter negotiation response, the NFC card reader 200 sends a small program selection (Select AID) command to the electronic device 100. The Select AID command carries the identifier of the first applet.

[0590] For the process from step S2104 to step S2109, please refer to the above Figure 17 Steps S1703 to S1708 in the illustrated embodiment are not described in detail here.

[0591] S2110. The electronic device 100 determines that the first applet is not present on the electronic device 100 based on the identifier of the first applet.

[0592] S2111. After the electronic device 100 determines that the first applet is not present on the electronic device 100 based on the identifier of the first applet, the electronic device 100 sends a response (Response) 6 to the NFC card reader 200. The response 6 indicates that the electronic device 100 has not successfully selected the first applet.

[0593] Because the first NFC emulated card using the first NFC protocol is not enabled on electronic device 100, the first applet may not be present on electronic device 100. Therefore, after determining the absence of the first applet based on the identifier of the first applet, electronic device 100 may send response 6 to NFC card reader 200 to terminate the communication process using the first NFC protocol. For example, the value carried in response 6 may be "6A82."

[0594] In one possible implementation, the first NFC simulated card and the fourth NFC simulated card may both correspond to the first Applet. For example, different access control cards under the first NFC protocol correspond to the same Applet. Therefore, when the electronic device 100 has not activated the first NFC simulated card but has activated the fourth NFC simulated card, after receiving the applet selection (SelectAID) command, the electronic device 100 can determine that there is a first Applet on the electronic device 100 based on the identifier of the first Applet. Furthermore, the electronic device 100 can send a response 1 to the NFC card reader device 200. The response 1 is used to indicate that the electronic device 100 has successfully selected the first Applet. After successfully selecting the first Applet, the electronic device 100 can send the card information of the fourth NFC simulated card to the NFC card reader device 200 through the first Applet. Since the NFC card reader device 200 does not support the fourth NFC simulated card for card swiping, the NFC card reader device 200 will return a card swiping failure result to the electronic device 100, thereby ending the communication process of the first NFC protocol.

[0595] After the communication process of the first NFC protocol is finished, the NFC card reader device 200 may return to the polling phase.

[0596] In one possible implementation, each time the NFC card reader 200 enters the polling phase, it may first determine whether a card swipe attempt using the first NFC protocol failed within a period of time (e.g., 2 seconds) before entering the polling phase. If a card swipe attempt using the first NFC protocol failed within a period of time (e.g., 2 seconds) before entering the polling phase, the NFC card reader 200 may send a card search request using the third NFC protocol during the polling phase but not a card search request using the first NFC protocol. If a card swipe attempt using the first NFC protocol did not fail within a period of time (e.g., 2 seconds) before entering the polling phase, the NFC card reader 200 may alternately send a card search request using the third NFC protocol and a card search request using the first NFC protocol during the polling phase.

[0597] In one possible implementation, the NFC card reader device 200 may send a card search request of the third NFC protocol and a card search request of the first NFC protocol when in the polling phase. If the electronic device 100 receives the first card search request of the third NFC protocol after entering the radio frequency field of the NFC card reader device 200, the electronic device 100 may determine whether the electronic device 100 fails to swipe the card using the first NFC protocol within a period of time (e.g., 2 seconds) before receiving the first card search request. If the electronic device 100 fails to swipe the card using the first NFC protocol within a period of time (e.g., 2 seconds) before receiving the first card search request, the electronic device 100 may send a card search response (e.g., ATQA) of the third NFC protocol to the NFC card reader device 200 in response to the first card search request.

[0598] If the electronic device 100 does not fail to swipe the card using the first NFC protocol within a period of time (e.g., 2 seconds) before receiving the first card search request, the electronic device 100 may wait to receive the second card search request. If the second card search request is a card search request using the first NFC protocol (i.e., a Probe frame), the electronic device 100 may respond to the second card search request by sending a card search response using the first NFC protocol (i.e., a Probe ACK frame) to the NFC card reader 200. If the second card search request is also a card search request using the third NFC protocol, the electronic device 100 may respond to the second card search request by sending a card search response using the third NFC protocol to the NFC card reader 200.

[0599] Among them, the above-mentioned failure to swipe the card using the first NFC protocol includes: the electronic device 100 fails to successfully select the first Applet according to the identifier of the first Applet carried in the Select AID command, or the electronic device 100 successfully selects the first Applet according to the identifier of the first Applet carried in the Select AID command but fails to swipe the card through the first Applet.

[0600] S2112. The NFC card reader 200 sends a card search request of the third NFC protocol.

[0601] S2113. After receiving the card search request of the third NFC protocol, the electronic device 100 sends a card search response (for example, ATQA) of the third NFC protocol to the NFC card reader 200.

[0602] S2114. The NFC card reader 200 may send an anti-collision command to the electronic device 100.

[0603] In some embodiments of the present application, the anti-collision command may instruct the NFC device in PICC mode to return the entire UID. In some embodiments of the present application, the SEL field in the anti-collision command has a value of 93, and the NVB field has a value of 20.

[0604] S2115. The electronic device 100 may send the UID of the third NFC simulated card to the NFC card reader 200.

[0605] Since the electronic device 100 has a third NFC simulation card that supports the third NFC protocol, the electronic device 100 can send the UID parameter in the NFC parameters of the activated NFC simulation card to the NFC card reader 200 after receiving the anti-collision command.

[0606] The NFC card reader 200 can determine whether the UID of the third NFC simulated card belongs to the preset UID list of the NFC card reader 200. If the determination result is yes, the UID verification of the third NFC simulated card is passed. The preset UID list of the NFC card reader 200 can include one or more UIDs. For example, if the NFC card reader 200 is the access control gate of cell A, the preset UID list of the NFC card reader 200 includes the UID of the access control card of cell A.

[0607] In some embodiments of the present application, when the NFC card reader device 200 passes the UID verification of the third NFC simulated card, the NFC card reader device 200 may continue with the subsequent process of the access layer protocol, for example, executing S2116.

[0608] S2116. The NFC card reader 200 may send a Select UID command to the electronic device 100.

[0609] In some embodiments of the present application, the NFC card reader device 200 may determine that the electronic device 100 is selected, and therefore may send a SelectUID command to the electronic device 100. In some examples, after the NFC card reader device 200 sends the anti-collision command, it receives a UID sent by the electronic device 100, and there is no conflict between multiple NFC devices in PICC mode (i.e., there is no card conflict). Therefore, the NFC card reader device 200 may determine that the electronic device 100 is selected.

[0610] In some embodiments of the present application, the selection command may include an SEL field, an NVB field, all UIDs and CRCs of the selected electronic device 100 , the SEL field may take a value of 20, and the NVB field may take a value of 70.

[0611] S2117. The electronic device 100 may send a select acknowledgement (SAK) command to the NFC card reader 200.

[0612] In some embodiments of the present application, the electronic device 100 may generate a selection confirmation command based on the SAK parameter in the NFC parameters of the third NFC emulated card, and send the selection confirmation command to the NFC card reader 200. When the third NFC emulated card in the electronic device 100 does not support the application layer protocol, the selection confirmation command sent by the electronic device 100 to the NFC card reader 200 indicates that the application layer protocol is not supported. When the received selection confirmation command indicates that the application layer protocol is not supported, the NFC card reader 200 may verify that the selection confirmation command has passed.

[0613] S2118. The NFC card reader 200 and the electronic device 100 perform a card swiping service of a third NFC simulated card.

[0614] Since the NFC card reader 200 successfully verifies the UID of the third NFC simulated card in S2115 and successfully verifies the selection confirmation command in S2117, the NFC card reader 200 can determine that the third NFC simulated card has been successfully authenticated and can execute a card swiping service for the third NFC simulated card. Card swiping services may include any of: access control, door unlocking, vehicle unlocking, transaction payment, electronic ticket verification, digital ID verification, and swiping a transit card to board or exit a vehicle. In some examples, the NFC card reader 200 can send a card swiping result of the third NFC simulated card to the electronic device 100. Since the NFC card reader 200 successfully authenticates the third NFC simulated card, the card swiping result indicates success. In other examples, if the NFC card reader 200 fails to authenticate the third NFC simulated card, the NFC card reader 200 can send a card swiping result indicating failure to the electronic device 100.

[0615] Through the above Figure 20B In the NFC simulated card swiping process in the near field communication method shown in the figure, the electronic device 100 does not have the first NFC simulated card of the first NFC protocol activated but has the third NFC simulated card of the third NFC protocol activated. When the NFC card reader 200 supports the first NFC simulated card of the first NFC protocol and the third simulated card of the third NFC protocol for swiping, the NFC card reader 200 and the electronic device 100 can be connected through the following Figure 20BIn the card swiping process shown, the electronic device 100 is given priority to try to select the first NFC protocol to communicate with the NFC card reader 200. If the electronic device 100 cannot swipe the card with the NFC simulated card of the first NFC protocol, the electronic device 100 can end the communication process of the first NFC protocol with the NFC card reader 200, and swipe the card with the third simulated card of the third NFC protocol. In this way, the electronic device 100 can give priority to trying to swipe the card with the first NFC protocol. When the card swiping with the first NFC protocol fails, the electronic device 100 can also switch to swiping the card with the third NFC protocol in time. This improves the success rate of card swiping in scenarios with multiple NFC protocols.

[0616] Another hardware structure of an electronic device 100 provided in an embodiment of the present application is introduced below.

[0617] Figure 21 A hardware structure diagram of an electronic device 100 provided in an embodiment of the present application is shown.

[0618] The embodiment will be described in detail below using the electronic device 100 as an example. It should be understood that Figure 21 The electronic device 100 shown is only one example, and the electronic device 100 may have more Figure 21 More or fewer components may be shown, two or more components may be combined, or the components may be arranged differently. Figure 21 The various components shown in the drawings may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

[0619] The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include one or more of a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0620] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0621] Processor 110 may include one or more processing units. For example, processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors. The controller may generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. Processor 110 may also include memory for storing instructions and data. In some embodiments, the memory in processor 110 is a high-speed cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces processor 110's waiting time, and thus improves system efficiency.

[0622] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.

[0623] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0624] The charging management module 140 is configured to receive charging input from a charger. The power management module 141 is configured to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, and the wireless communication module 160.

[0625] The wireless communication functionality of electronic device 100 can be implemented using antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, a modem processor, and a baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0626] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0627] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0628] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0629] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0630] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display screen panel can also be made of an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniLED, a microLED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.

[0631] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0632] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The internal memory 121 can be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0633] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0634] The pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. The air pressure sensor 180C is used to measure air pressure. The magnetic sensor 180D includes a Hall sensor. The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). The distance sensor 180F is used to measure distance. The proximity light sensor 180G can include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The ambient light sensor 180L is used to sense the brightness of ambient light. The fingerprint sensor 180H is used to collect fingerprints. The temperature sensor 180J is used to detect temperature. The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194. The bone conduction sensor 180M can obtain vibration signals. The buttons 190 include a power button, a volume button, etc. The motor 191 can generate vibration prompts. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc.

[0635] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 100 by inserting it into or removing it from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.

[0636] In some embodiments, the wireless communication module 160 can be specifically used to establish a short-range wireless communication link with the NFC card reader device 200 so that short-range wireless data transmission can be performed between the two. For example, the above-mentioned short-range wireless communication link can be a Bluetooth link, a Wi-Fi link, an NFC link, etc. Therefore, the wireless communication module 160 can specifically include a Bluetooth communication module, a Wi-Fi communication module or an NFC module. Among them, the NFC module may include any appropriate components for implementing proximity-based contactless communication between the electronic device 100 and the NFC card reader device 200, thereby providing NFC functionality for the electronic device 100. Among them, the description of the NFC module can refer to the above Figure 3 The embodiments shown will not be described in detail here.

[0637] The above content elaborates on the method provided by the present application. In order to facilitate better implementation of the above scheme of the embodiment of the present application, the embodiment of the present application also provides corresponding devices or equipment.

[0638] In the embodiment of the present application, the electronic device 100 and the NFC card reader device 200 can be divided into functional modules according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.

[0639] The following will be combined Figures 22 to 25 The communication device according to the embodiment of the present application is described in detail.

[0640] In the case of integrated units, see Figure 22 , Figure 22 2 is a schematic diagram of the structure of the communication device 2200 provided in an embodiment of the present application. The communication device 2200 may be the electronic device 100 or the NFC tag card in the above embodiment. Optionally, the communication device 2200 may be a chip / chip system, for example, an NFC chip. Figure 22 As shown, the communication device 2200 may include a transceiver unit 2210 and a processing unit 2220 .

[0641] Among them, the transceiver unit 2210 can also be used to execute the functional steps such as NFC sending and NFC receiving performed by the electronic device 100 in the above embodiment of the present application.

[0642] Optionally, the processing unit 2220 may also be used to execute the functional steps related to NFC protocol parsing and encapsulation, NFC service processing flow, and display performed by the electronic device 100 in the above-mentioned embodiment of the present application.

[0643] It should be understood that the communication device 2200 in this design can execute the method steps executed by the electronic device 100 in the aforementioned embodiment. For the sake of brevity, they will not be repeated here.

[0644] In the case of integrated units, see Figure 23 , Figure 23 2 is a schematic diagram of the structure of the communication device 2300 provided in the embodiment of the present application. The communication device 2300 may be the NFC card reader 200 in the above embodiment. Figure 23 As shown, the communication device 2300 may include a transceiver unit 2310 and a processing unit 2320 .

[0645] Optionally, the transceiver unit 2310 may also be configured to execute the functional steps related to NFC sending and NFC receiving performed by the NFC card reader 200 in the above embodiment of the present application.

[0646] Optionally, the processing unit 2320 may also be configured to execute the functional steps of the NFC protocol parsing and encapsulation and the NFC service processing flow executed by the NFC card reader 200 in the above-mentioned embodiment of the present application.

[0647] It should be understood that the communication device 2300 in this design can correspondingly execute the method steps executed by the NFC card reader device 200 in the aforementioned embodiment. For the sake of brevity, they are not repeated here.

[0648] The electronic device 100 and the NFC card reader 200 of the embodiment of the present application are described above. It should be understood that any device having the above Figure 22 Any product of any form having the functions of the electronic device 100 as described above Figure 23 Any product that has the functions of the NFC card reader 200 falls within the protection scope of the embodiments of the present application.

[0649] As a possible product form, the electronic device 100 described in the embodiment of the present application can be implemented by a general bus architecture.

[0650] See also Figure 24 , Figure 24 2 is a schematic diagram of the structure of the communication device 2400 provided in an embodiment of the present application. The communication device 2400 may be the electronic device 100 or the NFC tag card, or a device in the electronic device 100 or a device in the NFC tag card. Figure 24As shown, the communication device 2400 includes a processor 2401 and a transceiver 2402 internally connected to and communicating with the processor 2401. The processor 2401 is a general-purpose processor or a dedicated processor, etc. For example, it can be a central processing unit and / or an NFC controller, etc. The transceiver 2402 can be called a transceiver unit, a transceiver, or a transceiver circuit, etc., for implementing a transceiver function. The transceiver 2402 may include a receiver and a transmitter. The receiver can be called a receiver or a receiving circuit, etc., for implementing a receiving function, such as an NFC receiving function; the transmitter can be called a transmitter or a transmitting circuit, etc., for implementing a transmitting function, such as an NFC transmitting function. Optionally, the communication device 2400 may further include an antenna 2403 and / or a radio frequency unit ( Figure 24 (not shown), for example, an NFC antenna, where the NFC antenna can be a coil-shaped antenna. The antenna 2403 and / or the radio frequency unit can be located inside the communication device 2400 or can be separated from the communication device 2400, that is, the antenna 2403 and / or the radio frequency unit can be remotely or distributedly deployed.

[0651] Optionally, the communication device 2400 may include one or more memories 2404, on which instructions may be stored. The instructions may be computer programs. The computer programs may be executed on the communication device 2400 to enable the communication device 2400 to perform the method steps described in the above embodiments of this application. Optionally, the memories 2404 may also store data. The communication device 2400 and the memories 2404 may be provided separately or integrated together.

[0652] The processor 2401 , the transceiver 2402 , and the memory 2404 may be connected via a communication bus.

[0653] In one design, the communication device 2400 can be used to perform the functions of the electronic device 100 in the aforementioned embodiment: the processor 2401 can be used to execute the functional steps such as NFC protocol parsing and encapsulation, NFC service processing flow and display performed by the electronic device 100 in the aforementioned embodiment of this application and / or other processes for the technology described herein; the transceiver 2402 can be used to execute the functional steps such as NFC sending and NFC receiving performed by the electronic device 100 in the aforementioned embodiment of this application and / or other processes for the technology described herein.

[0654] In any of the above designs, processor 2401 may include a transceiver for implementing receiving and transmitting functions. For example, the transceiver may be a transceiver circuit, an interface, or an interface circuit. The transceiver circuit, interface, or interface circuit for implementing the receiving and transmitting functions may be separate or integrated. The transceiver circuit, interface, or interface circuit may be used for reading and writing code / data, or the transceiver circuit, interface, or interface circuit may be used for transmitting or delivering signals.

[0655] In any of the above designs, the processor 2401 may store instructions, which may be computer programs. The computer programs run on the processor 2401, which may enable the communication device 2400 to perform the method steps performed by the electronic device 100 in the above embodiments of the present application. The computer program may be fixed in the processor 2401, in which case the processor 2401 may be implemented by hardware.

[0656] In one implementation, the communication device 2400 may include a circuit that can implement the functions of sending, receiving, or communicating in the aforementioned method embodiments. The processor and transceiver described in this application can be implemented on an integrated circuit (IC), an analog IC, a radio frequency integrated circuit RFIC, a mixed signal IC, an application specific integrated circuit (ASIC), a printed circuit board (PCB), an electronic device, etc. The processor and transceiver can also be manufactured using various IC process technologies, such as complementary metal oxide semiconductor (CMOS), N-type metal oxide semiconductor (nMetal-oxide-semiconductor, NMOS), P-type metal oxide semiconductor (positive channel metal oxide semiconductor, PMOS), bipolar junction transistor (bipolar junction transistor, BJT), bipolar CMOS (BiCMOS), silicon germanium (SiGe), gallium arsenide (GaAs), etc.

[0657] The scope of the communication device described in this application is not limited thereto, and the structure of the communication device may not be limited thereto. Figure 24 The communication device 2400 may be an independent device or may be part of a larger device. For example, the communication device 2400 may be:

[0658] (1) Independent integrated circuit IC, or chip, or chip system or subsystem; (2) A collection of one or more ICs, optionally, the IC collection may also include a storage component for storing data, computer programs; (3) ASIC, such as NFC chip; (4) Modules that can be embedded in other devices; (5) Receivers, terminals, smart terminals, cellular phones, wireless devices, handheld devices, mobile units, vehicle-mounted devices, network devices, cloud devices, artificial intelligence devices, etc.; (6) Others, etc.

[0659] As a possible product form, the NFC card reader device 200 described in the embodiment of the present application can be implemented by a general bus architecture.

[0660] See also Figure 25 , Figure 25 2 is a schematic diagram of the structure of the communication device 2500 provided in the embodiment of the present application. The communication device 2500 may be the NFC card reader device 200, or a device therein. Figure 25 As shown, the communication device 2500 includes a processor 2501 and a transceiver 2502 connected to the internal communication of the processor 2501. The processor 2501 is a general-purpose processor or a dedicated processor. For example, it can be an NFC controller. The transceiver 2502 can be called a transceiver unit, a transceiver, or a transceiver circuit, etc., for implementing the transceiver function. The transceiver 2502 can include a receiver and a transmitter. The receiver can be called a receiver or a receiving circuit, etc., for implementing the receiving function; the transmitter can be called a transmitter or a transmitting circuit, etc., for implementing the transmitting function. Optionally, the communication device 2500 can also include an antenna 2503 and / or a radio frequency unit (not shown in the figure). The antenna 2503 and / or the radio frequency unit can be located inside the communication device 2500, or can be separated from the communication device 2500, that is, the antenna 2503 and / or the radio frequency unit can be remotely or distributedly deployed.

[0661] Optionally, the communication device 2500 may include one or more memories 2504, on which instructions may be stored. The instructions may be computer programs, which can be executed on the communication device 2500 to enable the communication device 2500 to perform the method steps described in the above embodiments of this application. Optionally, the memories 2504 may also store data. The communication device 2500 and the memories 2504 may be provided separately or integrated together.

[0662] The processor 2501 , the transceiver 2502 , and the memory 2504 may be connected via a communication bus.

[0663] In one design, the communication device 2500 can be used to perform the functions of the NFC card reader device 200 in the aforementioned embodiment: the processor 2501 can be used to execute the functional steps of the NFC protocol parsing and encapsulation, NFC service processing flow and / or other processes for the technology described herein performed by the NFC card reader device 200 in the aforementioned embodiment; the transceiver 2502 can be used to execute the functional steps of the NFC card reader device 200 in the aforementioned embodiment, such as NFC sending and NFC receiving, and / or other processes for the technology described herein.

[0664] In any of the above designs, processor 2501 may include a transceiver for implementing receiving and transmitting functions. For example, the transceiver may be a transceiver circuit, an interface, or an interface circuit. The transceiver circuit, interface, or interface circuit for implementing the receiving and transmitting functions may be separate or integrated. The transceiver circuit, interface, or interface circuit may be used for reading and writing code / data, or the transceiver circuit, interface, or interface circuit may be used for transmitting or delivering signals.

[0665] In any of the above designs, the processor 2501 may store instructions, which may be computer programs. The computer programs, when executed on the processor 2501, may cause the communication device 2500 to execute the method steps performed by the NFC card reader 200 in the above method embodiment. The computer programs may be fixed in the processor 2501, in which case the processor 2501 may be implemented by hardware.

[0666] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the steps performed by the electronic device 100 in the above-mentioned various method embodiments.

[0667] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps performed by the NFC card reader 200 in the above-mentioned various method embodiments can be implemented.

[0668] An embodiment of the present application further provides a computer program product, including a computer program. When the computer program runs on a computer, the computer can implement the steps performed by the electronic device 100 in each of the above method embodiments.

[0669] The embodiment of the present application further provides a computer program product, including a computer program. When the computer program is executed on a computer, the computer can implement the steps performed by the NFC card reader 200 in each of the above method embodiments.

[0670] The present application also provides a chip system, which includes a processing circuit and an interface circuit. The interface circuit is configured to receive code instructions and transmit them to the processing circuit. The processing circuit is configured to execute the code instructions so that the chip system implements the steps performed by the electronic device 100 in any method embodiment of the present application. The chip system can be a single chip or a chip module composed of multiple chips.

[0671] The present application also provides a chip system, which includes a processing circuit and an interface circuit. The interface circuit is configured to receive code instructions and transmit them to the processing circuit. The processing circuit is configured to execute the code instructions so that the chip system implements the steps performed by the NFC card reader 200 in any method embodiment of the present application. The chip system can be a single chip or a chip module composed of multiple chips.

[0672] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A near field communication method, applied to an electronic device, characterized in that: The method comprises: Receive a first frame sent by an NFC card reader device, where the first frame is used to indicate that the NFC card reader device supports a first NFC protocol; Sending a second frame to the NFC card reader device, where the second frame is used to indicate that the electronic device supports the first NFC protocol; receiving a third frame sent by the NFC card reader device, where the third frame carries device feature information of the NFC card reader device; A fourth frame is sent to the NFC card reader device, wherein the fourth frame is used to indicate that the electronic device has successfully received the third frame.

2. The method according to claim 1, characterized in that The device feature information of the NFC card reader device includes a service identifier and a device organization identifier, wherein the service identifier is used to indicate the type of NFC service supported by the NFC card reader device, and the device organization identifier is used to indicate the manufacturer that uses the NFC card reader device to provide NFC services.

3. The method according to claim 1 or 2, characterized in that The device characteristic information of the NFC card reader device further includes a device group identifier, wherein the device group identifier is used to indicate the group to which the NFC service provided by the NFC card reader device belongs.

4. The method according to any one of claims 1 to 3, characterized in that After receiving the third frame sent by the NFC card reader, the method further includes: Based on the device feature information of the NFC card reader 200, a card swiping prompt of the first NFC simulated card is determined and output, where the card swiping prompt of the first NFC simulated card is used to prompt the electronic device that the electronic device is swiping the first NFC simulated card.

5. The method according to any one of claims 1 to 4, characterized in that After sending the fourth frame to the NFC card reader device, the method further includes: receiving a mini-program selection command sent by the NFC card reader, wherein the mini-program selection command carries an identifier of the first applet; Determining a first NFC simulated card corresponding to the first Applet based on the identifier of the first Applet; The card information of the first NFC simulated card is sent to the NFC card reader device through the first Applet, and the card information of the first NFC simulated card is used by the NFC card reader device to perform a card swiping service of the first NFC simulated card.

6. The method according to claim 5, characterized in that After sending the card information of the first NFC simulated card to the NFC card reader device through the first Applet, the method further includes: Receive the card swiping result of the first NFC simulated card sent by the NFC card reader.

7. The method according to claim 5 or 6, characterized in that The determining, based on the identifier of the first Applet, the first NFC simulated card corresponding to the first Applet specifically includes: Determining a first applet from one or more applets based on the identifier of the first applet; Through the first Applet, the first DF corresponding to the first NFC simulated card is determined from the MF of the first Applet, the MF of the first Applet includes one or more DFs, the one or more DFs include the first DF, and the first DF includes card information of the first NFC simulated card.

8. The method according to claim 7, characterized in that The determining, by the first Applet, from the MF of the first Applet, a first DF corresponding to the first NFC simulated card specifically includes: Acquire, through the first applet, the MF of the first applet, where the MF of the first applet includes a first mapping list and one or more DFs; Obtaining a first mapping table from the MF of the first Applet, where the first mapping table is used to indicate a mapping relationship between device feature information and a DF identifier; Based on the device feature information of the NFC card reader device and the first mapping list, determine the identifier of the first DF corresponding to the device feature information of the NFC card reader device from the MF of the first applet; The first DF is determined from the MF of the first Applet based on the identifier of the first DF through the first Applet.

9. The method according to claim 7 or 8, characterized in that The first DF also includes a first external authentication key; The sending, through the first Applet, the card information of the first NFC simulated card to the NFC card reader device specifically includes: Encrypting the card information of the first NFC simulated card stored in the first DF using a first external authentication key and a first random number through the first Applet to obtain encrypted data; The encrypted data is sent to the NFC card reader device, where the encrypted data is used by the NFC card reader device to decrypt the card information of the first NFC simulated card.

10. The method according to claim 9, characterized in that Before encrypting the card information of the first NFC simulated card using the first external authentication key and the first random number to obtain encrypted data, the method further includes: receiving a card information acquisition command sent by the NFC card reader device, wherein the card information acquisition command is used to request acquisition of card information of the first NFC simulated card; The encrypting the card information of the first NFC simulated card using the first external authentication key and the first random number through the first Applet to obtain encrypted data specifically includes: In response to the card information acquisition command, the card information of the first NFC simulated card stored in the first DF is encrypted using the first external authentication key and the first random number to obtain encrypted data.

11. The method according to claim 10, characterized in that Before receiving the card information acquisition command sent by the NFC card reader, the method further includes: Receive a Get Challenge command sent by the NFC card reader; In response to the Get Challenge command, generating the first random number through the first Applet; Sending a third response to the NFC card reader, where the third response carries the first random number; Receiving an external authentication command sent by the NFC card reader device, wherein the external authentication command carries an authentication ciphertext; Decrypting the first random number from the authentication ciphertext using the first external authentication key in the first DF through the first Applet; A fourth response is sent to the NFC card reader device, where the fourth response carries a first authentication result, where the first authentication result is used to indicate that the electronic device has successfully decrypted the first random number from the authentication ciphertext.

12. The method according to any one of claims 6 to 11, characterized in that After receiving the card swiping result of the first NFC simulated card sent by the NFC card reader, the method further includes: Output a prompt corresponding to the card swiping result of the first NFC simulated card.

13. The method according to any one of claims 6 to 12, characterized in that After receiving the card swiping result of the first NFC simulated card sent by the NFC card reader, the method further includes: A fifth response is sent to the NFC card reader device, where the fifth response is used to indicate that the electronic device has successfully received the card swiping result of the first NFC simulated card.

14. The method according to any one of claims 1 to 13, characterized in that After sending the fourth frame to the NFC card reader device, the method further includes: Receive a parameter negotiation command sent by the NFC card reader; A parameter negotiation response is sent to the NFC card reader device, where the parameter negotiation command and the parameter negotiation response are used by the NFC card reader device to negotiate data transmission parameters at the application layer with the electronic device.

15. The method according to claim 14, characterized in that The data transmission parameters include any one or more of a maximum transmission rate and a maximum data transmission length when performing data transmission at the application layer.

16. A near field communication method, applied to an NFC card reader device, characterized in that: The method comprises: Sending a first frame, where the first frame is used to indicate that the NFC card reader device supports a first NFC protocol; receiving a second frame sent by an electronic device, where the second frame is used to indicate that the electronic device supports the first NFC protocol; Sending a third frame to the electronic device, where the third frame carries device feature information of the NFC card reader device; A fourth frame sent by the electronic device is received, wherein the fourth frame is used to indicate that the electronic device has successfully received the third frame.

17. The method according to claim 16, characterized in that The device feature information of the NFC card reader device includes a service identifier and a device organization identifier, wherein the service identifier is used to indicate the type of NFC service supported by the NFC card reader device, and the device organization identifier is used to indicate the manufacturer that uses the NFC card reader device to provide NFC services.

18. The method according to claim 16 or 17, characterized in that The device characteristic information of the NFC card reader device further includes a device group identifier, wherein the device group identifier is used to indicate the group to which the NFC service provided by the NFC card reader device belongs.

19. The method according to any one of claims 16 to 18, characterized in that After receiving the fourth frame sent by the electronic device, the method further includes: Sending an applet selection command to the electronic device, wherein the applet selection command carries an identifier of the first applet and is used to request the electronic device to select the first applet; receiving card information of the first NFC simulated card sent by the electronic device through the first Applet; Based on the card information of the first NFC simulated card, a card swiping service of the first NFC simulated card is executed.

20. The method according to claim 19, characterized in that After receiving the card information of the first NFC simulated card sent by the electronic device through the first Applet, the method further includes: Sending a card swiping result of the first NFC simulated card to the electronic device.

21. The method according to claim 19 or 20, characterized in that The receiving the card information of the first NFC simulated card sent by the electronic device through the first Applet specifically includes: receiving encrypted data sent by the electronic device through the first Applet; The card information of the first NFC simulated card is decrypted from the encrypted data using a first external authentication key and a first random number.

22. The method according to claim 21, characterized in that Before decrypting the card information of the first NFC simulated card from the encrypted data using the first external authentication key and the first random number, the method further includes: A card information acquisition command is sent to the electronic device, where the card information acquisition command is used to request acquisition of the card information of the first NFC simulated card.

23. The method according to claim 22, characterized in that Before sending the card information acquisition command to the electronic device, the method further includes: Sending a Get Challenge command to the electronic device, where the Get Challenge command is used to request a first applet of the electronic device to generate the first random number; Sending a third response to the NFC card reader, where the third response carries the first random number; Encrypt the first random number using the first external authentication key to obtain an authentication ciphertext; Sending an external authentication command to the electronic device, where the external authentication command carries the authentication ciphertext; A fourth response sent by the electronic device is received, where the fourth response carries a first authentication result, where the first authentication result is used to indicate that the electronic device has successfully decrypted the first random number from the authentication ciphertext.

24. The method according to any one of claims 20 to 23, characterized in that After receiving the card swiping result of the first NFC simulated card sent by the NFC card reader, the method further includes: Receive a fifth response sent by the electronic device, where the fifth response is used to indicate that the electronic device has successfully received a card swiping result of the first NFC simulated card.

25. The method according to any one of claims 16 to 24, characterized in that After receiving the fourth frame sent by the electronic device, the method further includes: Sending a parameter negotiation command to the NFC card reader; Receive a parameter negotiation response sent by the electronic device, where the parameter negotiation command and the parameter negotiation response are used by the NFC card reader device to negotiate data transmission parameters at the application layer with the electronic device.

26. The method according to claim 25, characterized in that The data transmission parameters include any one or more of a maximum transmission rate and a maximum data transmission length when performing data transmission at the application layer.

27. An NFC system, characterized in that: Including electronic equipment and NFC card reading equipment; wherein, The electronic device is configured to perform the near field communication method according to any one of claims 1 to 15; The NFC card reader device is used to execute the near field communication method according to any one of claims 16 to 26.

28. An electronic device, characterized in that: include: One or more processors, one or more memories, and a transceiver, wherein the transceiver and the one or more memories are coupled to the one or more processors, the one or more memories are used to store a computer program, and when the one or more processors execute the computer program, the near field communication method according to any one of claims 1 to 15 is performed.

29. An NFC card reader device, characterized in that: include: One or more processors, one or more memories, and a transceiver, wherein the transceiver and the one or more memories are coupled to the one or more processors, and the one or more memories are used to store a computer program, and when the one or more processors execute the computer program, the near field communication method according to any one of claims 16 to 26 is performed.

30. A computer-readable storage medium, characterized in that A computer program is stored, and when the computer program is executed by a processor, the near field communication method according to any one of claims 1 to 15 is implemented.

31. A computer-readable storage medium, characterized in that A computer program is stored, and when the computer program is executed by a processor, the near field communication method according to any one of claims 16 to 26 is implemented.

32. A computer program product, characterized in that The invention comprises a computer program, and when the computer program is executed by a processor, the near field communication method according to any one of claims 1 to 15 is implemented.

33. A computer program product, characterized in that The method comprises a computer program, and when the computer program is executed by a processor, the method implements the near field communication method according to any one of claims 16 to 26.

34. A chip system, characterized in that: The method comprises a processing circuit and an interface circuit, wherein the interface circuit is used to receive code instructions and transmit the code instructions to the processing circuit, and the processing circuit is used to run the code instructions to execute the near field communication method according to any one of claims 1 to 15.

35. A chip system, characterized in that: The method comprises a processing circuit and an interface circuit, wherein the interface circuit is used to receive code instructions and transmit the code instructions to the processing circuit, and the processing circuit is used to run the code instructions to execute the near field communication method according to any one of claims 16 to 26.

Citation Information

Patent Citations

  • NFC device communication method, NFC device communication apparatus, and NFC device

    CN103609034A

  • Method for data frame routing processing, near field communication controller, and terminal

    CN107636982A

  • Simulation card switching method, electronic equipment and communication system

    CN114462560A

  • Receiving system for use in near field communication and mode detection method therefore

    US20110206142A1

  • Method for extending simulation function of NFC card, NFC extension device and NFC terminal

    WO2023056775A1