NFC transaction error processing method and device

By exiting the transaction state when the NFC module receives a protocol error message, the transaction stuck problem caused by communication anomalies is solved, and the transaction success rate and user experience are improved.

CN120598566APending Publication Date: 2025-09-05BEIJING CEC HUADA ELECTRONIC DESIGN CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510667242.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-22
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

During near-field communication transactions, when communication is abnormally interrupted, the transaction status is easily stuck and cannot be automatically restored, resulting in a decrease in the success rate of single transactions and the need for users to frequently intervene manually, affecting transaction efficiency and experience.

Method used

When the NFC module receives a protocol error message, the NFC host instructs it to exit the transaction state and forcibly end the error state, providing a basis for subsequent restart of the transaction process.

Benefits of technology

By forcibly exiting the error state, tedious exit and re-entry operations are avoided, significantly improving the success rate of single transactions, and enhancing transaction efficiency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120598566A_ABST
    Figure CN120598566A_ABST
Patent Text Reader

Abstract

One or more embodiments of the present specification provide an NFC transaction error processing method and device, the method comprising: when an NFC module is in a transaction state, an NFC master terminal receives a protocol error message from the NFC module for instructing the NFC module to receive a protocol error instruction from a read-write device; and based on the protocol error message, the NFC master terminal instructs the NFC module to exit the transaction state. The problem that the transaction process is blocked due to the fact that the read-write device continuously sends error instructions in the related technology is solved. By forcibly quitting the error state, a basis is provided for the subsequent restarting transaction process, so that the tedious operation that the card needs to leave and then enter is avoided, and the success rate of single transaction is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of this specification relate to the field of electronic device technology, and more particularly, to a method and apparatus for handling NFC transaction errors. Background Art

[0002] Near Field Communication (NFC), a short-range, high-frequency wireless communication technology, has been widely used in a variety of fields, including mobile payments, access control systems, and electronic ticketing. It allows electronic devices to exchange data securely over short distances. Users simply hold an NFC-enabled device near a reader to quickly complete transactions and identity verification, greatly enhancing convenience.

[0003] During the development of this application, the inventors discovered that during a near-field communication (NFC) transaction, if the transaction process is interrupted due to a communication anomaly, a serious flaw may occur: the transaction status may become stuck and unable to automatically recover. In this case, the transaction process cannot continue or automatically restart, and the device must be physically removed from the card reader's field of view and re-entered to restore communication.

[0004] This defect will lead to a decrease in the success rate of single transactions, and users will need to frequently intervene manually, which will greatly affect transaction efficiency and experience. Summary of the Invention

[0005] In view of this, one or more embodiments of this specification provide the following technical solutions:

[0006] According to a first aspect of one or more embodiments of this specification, a method for handling NFC transaction errors is provided, which is applied to an electronic device, the electronic device including an NFC module and an NFC master terminal for controlling the NFC module. The method includes: when the NFC module is in a transaction state, the NFC master terminal receives a protocol error message from the NFC module, indicating that the NFC module has received an instruction of a protocol error from a reader / writer device; and based on the protocol error message, the NFC master terminal instructs the NFC module to exit the transaction state.

[0007] According to a second aspect of one or more embodiments of this specification, an NFC transaction error handling device is proposed, including: an information interaction module, configured to receive, when the NFC module is in a transaction state, a protocol error message from the NFC module, indicating that the NFC module has received an instruction of a protocol error from a reader / writer; and an error handling module, configured to, based on the protocol error message, instruct the NFC master end to exit the transaction state.

[0008] According to a third aspect of one or more embodiments of this specification, an electronic device is provided, comprising an NFC module and an NFC master terminal for controlling the NFC module, wherein the NFC module is configured to, when in a transaction state, send a protocol error message to the NFC master terminal if a protocol error instruction is received from a reader / writer device; and the NFC master terminal is configured to instruct the NFC module to exit the transaction state based on the protocol error message.

[0009] According to a fourth aspect of one or more embodiments of this specification, an electronic device is proposed, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor implements the steps of the method described in the first aspect by running the executable instructions.

[0010] According to a fifth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.

[0011] According to a sixth aspect of one or more embodiments of this specification, a computer program product is proposed, comprising a computer program / instruction, which implements the steps of the method described in the first aspect when executed by a processor.

[0012] As can be seen from the above embodiments, this specification addresses the issue of transaction flow blockage caused by the reader / writer continuously sending erroneous commands, by instructing the NFC module to exit the transaction state when it confirms that the module has received a protocol error command. This forced exit from the error state provides a basis for restarting the transaction flow, thus avoiding the tedious process of leaving and re-entering the card exchange, significantly improving the success rate of single transactions. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 It is a schematic diagram of an NFC transaction error handling service system provided by an exemplary embodiment.

[0014] Figure 2 This is one of the flow charts of a method for handling NFC transaction errors provided by an exemplary embodiment.

[0015] Figure 3 This is the second flowchart of a method for handling NFC transaction errors provided by an exemplary embodiment.

[0016] Figure 4 This is a schematic diagram of a module structure of an electronic device provided by an exemplary embodiment.

[0017] Figure 5 It is a structural diagram of an electronic device provided by an exemplary embodiment.

[0018] Figure 6 It is a block diagram of an NFC transaction error handling device provided by an exemplary embodiment. DETAILED DESCRIPTION

[0019] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.

[0020] In near-field communication (NFC) transaction scenarios, when the transaction process is interrupted due to abnormal communication, the relevant technology has a serious defect that the transaction status is stuck and cannot be automatically recovered. For example, when a card reader interacts with an electronic device with an NFC module, if the card reader does not correctly receive the device's response instruction, it will continue to send invalid wake-up instructions, causing the NFC device to enter a protocol error state. At this time, the transaction process can neither continue to execute nor automatically restart. The device must be physically moved out of the card reader's field and re-entered to restore communication. This defect directly leads to a significant decrease in the success rate of a single transaction, and users need to frequently intervene manually, which greatly affects transaction efficiency and experience.

[0021] In view of this, this specification proposes a method for handling NFC transaction errors. When an electronic device confirms that an NFC module in a transaction state believes that a received instruction has a protocol error, it can instruct the NFC module to exit the transaction state.

[0022] During implementation, the electronic device includes an NFC module and an NFC master end for controlling the NFC module; when the NFC module is in a transaction state, the NFC master end receives a protocol error message from the NFC module, indicating that the NFC module has received an instruction with a protocol error from a reader / writer device; based on the protocol error message, the NFC master end instructs the NFC module to exit the transaction state.

[0023] In the above technical solution, when an NFC module in a transaction state receives a protocol error command, it can be instructed to exit the transaction state. This solves the problem in related technologies where the reader / writer device continuously sends error commands, causing the transaction process to be blocked. By forcibly exiting the error state, it provides a basis for restarting the transaction process, thus avoiding the tedious operation of leaving the card and then re-entering the card, significantly improving the success rate of single transactions.

[0024] Figure 1 This is a schematic diagram of the architecture of an NFC transaction error handling service system provided by an exemplary embodiment. Figure 1 As shown, the system may include a server 11, a network 12, and several electronic devices, such as a PC (Personal Computer) 13, a mobile phone 14, and the like.

[0025] The server 11 can be a physical server containing an independent host, or a virtual server hosted by a host cluster. During operation, the server 11 can run the server-side program of an application to implement the relevant functions of the application. For example, when the server 11 runs the program of the NFC transaction error handling service, it can be implemented as a corresponding NFC transaction error handling service platform.

[0026] PC13 and mobile phone 14 are only some types of electronic devices that users can use. In fact, users can obviously also use electronic devices such as the following types: tablet devices, laptops, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smart watches, etc.), etc., and one or more embodiments of this specification do not limit this. During operation, the electronic device can run a client-side program of a certain application to implement the relevant functions of the application. For example, when the electronic device runs the program of the NFC transaction error handling service, it can be implemented as a client of the NFC transaction error handling service. Among them, the client application of the above-mentioned NFC transaction error handling service can be started and run on the electronic device. The client-side program can be a native application installed on the electronic device, or the client-side program can be a small program, a quick application or other similar forms. Of course, when using web technologies such as HTML5 or similar, the relevant functions can be implemented through the page displayed by the browser. The browser here can be an independent browser application or a browser module embedded in certain applications.

[0027] Regarding the network 12 for interaction between electronic devices such as PC 13 and mobile phone 14 and server 11, communication can be achieved using a wired or wireless network based on the communication methods supported by the corresponding electronic devices, and this specification does not limit this. For example, if PC 13 supports both wired and wireless communication, then communication can be achieved using a wired or wireless network as needed, while mobile phone 14 generally only supports wireless communication and thus can achieve communication using a wireless network.

[0028] In order to enable people skilled in the art to better understand the technical solutions in this application, the technical solutions in this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this application.

[0029] See Figure 2 , Figure 2 An exemplary embodiment provides an NFC transaction error handling method, which is applied to an electronic device with NFC function (such as a terminal). The electronic device may include an NFC module and an NFC master end, wherein the NFC module may include an NFC chip, NFC firmware, etc., wherein the NFC chip is the hardware basis for realizing the NFC function and is responsible for radio frequency communication between the reader and writer; the NFC firmware is software running on the NFC chip, which is used to process NFC controller interface (NFC controller interface, NCI) commands and contactless protocols. The NFC firmware can control the operation of the NFC chip so that it can perform data transmission and communication interaction according to predetermined rules; the NFC master end (also called the master end SDK) can be application control software running on the electronic device, which can be used to manage the state machine of the NFC device, handle error reporting and recovery logic, etc.

[0030] The method may include the following steps:

[0031] Step S210: When the NFC module is in a transaction state, the NFC master receives a protocol error message from the NFC module, indicating that the NFC module has received an instruction from a reader / writer device indicating a protocol error.

[0032] In one embodiment, when an electronic device enters the field range of a reader / writer device, it can be activated by the reader / writer device, for example, by receiving a wake-up command from the reader / writer device to activate the NFC module, which is equivalent to establishing a connection between the NFC module and the reader / writer device. Then, based on the interaction information with the reader / writer device, the electronic device can enter a transaction state, for example, by receiving a Request for Answer To Select (RATS) command from the reader / writer device, and the NFC module can respond with an Answer To Select (ATS) command and enter a transaction state, which is to start a transaction process with the reader / writer device, for example, starting a payment process or a security authentication process.

[0033] When the NFC module is in a transaction state, the transaction information between the NFC module and the reader / writer must comply with a specific transaction protocol, such as ISO / IEC 14443-4. If an error occurs during the transaction, such as an error in the exchanged information or a failed transmission, the NFC module may receive a command from the reader / writer containing a protocol error—that is, a command that does not comply with the transaction protocol. Upon receiving a command that does not comply with the transaction protocol, the NFC firmware in the NFC module can send a protocol error message to the NFC host.

[0034] Step S220: Based on the protocol error message, the NFC host instructs the NFC module to exit the transaction state.

[0035] After receiving the protocol error message reported by the NFC module (NFC firmware), the NFC master can determine whether the transaction has failed based on the protocol error message. In order to allow the NFC module to restart the transaction or reconnect with the reader / writer device as soon as possible, the NFC master can instruct the NFC module to exit the current transaction state if it determines that the transaction has failed, so that the NFC module can respond appropriately to the received instruction.

[0036] In the above embodiment, when an NFC module in a transaction state receives a protocol error command, it can be instructed to exit the transaction state. This solves the problem in related technologies where the reader / writer device continuously sends error commands, causing the transaction process to be blocked. By forcibly exiting the error state, a basis is provided for restarting the transaction process, thus avoiding the tedious operation of leaving the card and then re-entering the card, significantly improving the success rate of single transactions.

[0037] In one embodiment, in step S220, after receiving the protocol error message reported by the NFC module, the NFC master end can count the number of protocol error messages received (or continuously received) to determine whether a preset number threshold is reached. If the counted number does not reach the number threshold, the message can be ignored; if the counted number reaches the number threshold, it can be determined that the current transaction has failed, and the NFC module is instructed to exit the current transaction state.

[0038] The quantity threshold can be set according to actual needs, for example, it can be 1, 2, 3, etc.

[0039] In the above embodiment, by determining whether the number of received protocol error messages reaches a threshold, unnecessary transaction terminations caused by transient communication noise or environmental interference can be avoided, thereby improving the system's tolerance to occasional errors.

[0040] In one embodiment, when counting the number of received protocol error messages, a time span for the statistics may be defined. A determination is made as to whether the number of received protocol error messages within the preset time span reaches a threshold; if so, the current transaction is determined to have failed, and the NFC module is instructed to exit the current transaction state.

[0041] In one embodiment, in step S220, when the NFC host determines that a transaction error may occur based on the received protocol error message, it may instruct the NFC module to deactivate (Deactivate) and enter a discovery (Discovery) state.

[0042] By instructing the NFC module to deactivate and enter the discovery state, the transaction process can be quickly restarted. This step enables the NFC device to re-respond to the activation process of the reader / writer (for example, responding to the reader / writer's wake-up command), simulating the effect of the card "re-entering the field" and resuming the transaction without physically removing the card, shortening the error recovery time and improving the user experience.

[0043] In one embodiment, to ensure that the NFC master's command to instruct the NFC module to deactivate and enter the discoverable state can be executed smoothly without being interrupted by the data processing process uploaded by other controller interfaces (NFC Controller Interface, NCI), the data threshold can be set to 1. That is, when the protocol error message reported by the NFC firmware is received for the first time, the NFC module is instructed to deactivate and enter the discoverable state. This method can prevent the NFC master from being blocked by multiple protocol error messages.

[0044] In one embodiment, during a transaction, the interaction between the NFC module and the reader / writer device may experience at least one of the following anomalies: the timing of the command sent by the reader / writer device is incorrect, resulting in the NFC module receiving a command that should not have been received and does not contain syntax errors; the format or parameters of the command sent by the reader / writer device do not conform to or are incompatible with the current transaction protocol, resulting in the NFC module receiving an invalid command. When the NFC module receives a command in any of these situations, the NFC firmware will report a protocol error message to the NFC master. The NFC master can determine whether the transaction failed based on the protocol error message and, if so, instruct the NFC module to deactivate and enter the discovery state.

[0045] In one embodiment, in the transaction state, if the NFC module receives a wake-up command sent by the reader / writer device, it can report a protocol error message to the NFC master end; the NFC master end can determine whether the transaction has failed based on the protocol error message; if so, it instructs the NFC module to deactivate and enter the to-be-discovered state.

[0046] Among them, the wake-up command may include: Wake-Up Command for Type A (WUPA); Wake-Up Command for Type B (WUPB); Request Command for Type A (REQA); etc.

[0047] Figure 3 A flow chart of an NFC transaction error handling method provided by the present application is shown.

[0048] Step S301: When an electronic device with an NFC module enters the field range of a reader / writer, the NFC module can be activated through the discovery process. At this time, the NFC firmware can send an activation notification message to the NFC master. After activating the NFC module, the reader / writer can send a RATS to the NFC module.

[0049] Step S302: After receiving the RATS, the NFC module can respond to the ATS to the reader / writer device and enter the transaction state (such as ISO / IEC14443-4). At this time, the NFC module expects to exchange information with the reader / writer device at the transaction protocol layer corresponding to the transaction state (such as ISO / IEC14443-4 layer) to execute the transaction process;

[0050] Step S303: If the read / write device receives the ATS, the read / write device can determine the transaction start process and enter the transaction state to execute step S304; if the read / write device does not receive the ATS, execute step S305;

[0051] Step S304: The NFC module and the reader / writer device exchange information at the transaction protocol layer to continue the transaction process until the transaction is completed. For example, the NFC module can instruct the security element (SE) to interact with the reader / writer device to perform security authentication and data encryption.

[0052] Step S305: The reader / writer device continues to send wake-up commands, indicating that the reader / writer device considers that the connection with the NFC module is interrupted and needs to re-establish the connection through a wake-up command; the wake-up command can be WUPA / WUPB / REQA;

[0053] Step S306: Because the wake-up instruction does not comply with the transaction protocol layer or is incompatible with the transaction protocol layer, the NFC firmware reports a protocol error message to the NFC master.

[0054] Step S307: After receiving the protocol error message, the NFC host may determine whether the transaction has failed based on the protocol error message; if not, the protocol error message is ignored; if so, the NFC module may be instructed to deactivate and enter a pending discovery state;

[0055] Step S308: The NFC module executes the deactivation process and the rediscovery process, responds to the wake-up instruction of the reader / writer device, and restarts a new transaction process.

[0056] In one embodiment, to minimize the impact on single transaction time, the deactivation and rediscovery processes need to be completed as quickly as possible. This reduces the processing time of the NFC master after receiving a protocol error message, ensuring a prompt response to the error. The NFC master can be instructed to prioritize processing protocol error messages, meaning that protocol error messages have a higher processing priority.

[0057] In one embodiment, a switch control for protocol error messages can be set on the NFC master end. If the switch control is turned on, the NFC master end instructs the NFC module to deactivate and enter the discovery state when receiving the protocol error message; if the switch control is turned off, the NFC master end does not perform the deactivation and discovery processes when receiving the protocol error message.

[0058] Figure 4 This is a schematic diagram of a module of an electronic device provided by an exemplary embodiment. Figure 4 The electronic device includes an NFC module 401 and an NFC master terminal 402 for controlling the NFC module 401, wherein the NFC module 401 is configured to send a protocol error message to the NFC master terminal 402 if it receives a protocol error instruction from a reader / writer device when in a transaction state; and the NFC master terminal 402 is configured to instruct the NFC module 401 to exit the transaction state based on the protocol error message.

[0059] In one embodiment, the NFC master is configured to determine whether the number of times the protocol error message is received reaches a preset threshold; if so, instruct the NFC module to exit the transaction state.

[0060] In one implementation, the NFC master is configured to instruct the NFC module to deactivate and enter a discovery state.

[0061] In one embodiment, the NFC module is further used to receive a request selection response command RATS from the reader / writer device in an activated state; send a selection response command ATS to the reader / writer device and enter a transaction state; receive a wake-up instruction from the reader / writer device; wherein the wake-up instruction is an instruction sent by the reader / writer device to wake up the NFC module without receiving the ATS.

[0062] Figure 5 This is a schematic structural diagram of an electronic device provided by an exemplary embodiment. Figure 5 At the hardware level, the device includes a processor 502, an internal bus 504, a network interface 506, a memory 508, and a non-volatile memory 510. Of course, it may also include hardware required for other functions. One or more embodiments of this specification can be implemented based on software, such as the processor 502 reading the corresponding computer program from the non-volatile memory 510 into the memory 508 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0063] Please refer to Figure 6 NFC transaction error handling device can be applied to Figure 6 The device shown in FIG. 1 is used to implement the technical solution of this specification. The NFC transaction error handling device may include: an information interaction module 601 and an error handling module 602. The message receiving module 601 is configured to receive a protocol error message from the NFC module when the NFC module is in a transaction state, indicating that the NFC module has received a protocol error instruction from a reader / writer; and the error handling module 602 is configured to, based on the protocol error message, instruct the NFC master to exit the transaction state.

[0064] Furthermore, the error handling module 602 is configured to determine whether the number of times the protocol error message is received reaches a preset threshold; if so, instruct the NFC module to exit the transaction state.

[0065] Furthermore, the quantity threshold is 1.

[0066] Furthermore, the error handling module 602 is configured to instruct the NFC module to be deactivated and enter a to-be-discovered state.

[0067] Furthermore, the instruction indicating a protocol error is received from the read / write device includes a wake-up instruction.

[0068] Furthermore, before the NFC master receives a protocol error message from the NFC module, the information interaction module 601 is also used to receive a request selection response command RATS from the reader / writer device in an activated state; the reader / writer device sends a selection response command ATS and enters the transaction state; and receives a wake-up instruction from the reader / writer device.

[0069] Furthermore, the wake-up instruction includes at least one of the following: WUPA; WUPB; REQA.

[0070] Based on the same concept as the above method, this specification also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor implements the steps of the method described in any of the above embodiments by running the executable instructions.

[0071] Based on the same concept as the above method, this specification also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented.

[0072] Based on the same concept as the above method, this specification also provides a computer program product, including a computer program / instruction, which implements the steps of the method described in any of the above embodiments when executed by a processor.

Claims

1. A method for handling NFC transaction errors, characterized in that: Applied to an electronic device, the electronic device includes an NFC module and an NFC master terminal for controlling the NFC module, the method comprising: When the NFC module is in a transaction state, the NFC master receives a protocol error message from the NFC module, indicating that the NFC module has received an instruction of a protocol error from a reader / writer device; Based on the protocol error message, the NFC host instructs the NFC module to exit the transaction state.

2. The method according to claim 1, characterized in that The NFC host instructing the NFC module to exit the transaction state based on the protocol error message includes: Determine whether the number of times the protocol error message is received reaches a preset number threshold; if so, the NFC master instructs the NFC module to exit the transaction state.

3. The method according to claim 2, characterized in that The quantity threshold is 1.

4. The method according to any one of claims 1 to 3, characterized in that Instructing the NFC module to exit the transaction state at the NFC host end includes: The NFC master terminal instructs the NFC module to deactivate and enter a discovery state.

5. The method according to claim 1, wherein The instruction indicating a protocol error is received from the read / write device includes a wake-up instruction.

6. The method according to any one of claims 1 to 3, characterized in that Before the NFC master receives a protocol error message from the NFC module, the method further includes: The NFC module receives a request selection response command RATS from the reader / writer device when in an activated state; The NFC module sends a select response command ATS to the reader / writer device and enters the transaction state; The NFC module receives a wake-up instruction from the reader / writer device; wherein the wake-up instruction is an instruction for waking up the NFC module sent by the reader / writer device without receiving the ATS.

7. The method according to claim 5, characterized in that The wake-up instruction includes at least one of the following: WUPA; WUPB; REQA.

8. An NFC transaction error handling device, characterized in that: include: An information interaction module, configured to receive a protocol error message from the NFC module when the NFC module is in a transaction state, indicating that the NFC module has received a protocol error instruction from the reader / writer device; An error handling module is configured to, based on the protocol error message, cause the NFC master end to instruct the NFC module to exit the transaction state.

9. An electronic device, characterized in that: The electronic device includes an NFC module and an NFC master end for controlling the NFC module, wherein the NFC module is configured to, when in a transaction state, send a protocol error message to the NFC master end if it receives a protocol error instruction from a reader / writer device; and the NFC master end is configured to instruct the NFC module to exit the transaction state based on the protocol error message.

10. An electronic device, characterized in that: include: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method according to any one of claims 1 to 7 by executing the executable instructions.

11. A computer-readable storage medium, characterized in that Computer instructions are stored thereon, and when the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

12. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 7.