Near-field communication methods, near-field communication devices and terminal devices

By detecting the proximity of a terminal device using a proximity sensor and sending a characteristic signal to wake it up and switch modes, the problem of limited interaction in the screen-off state of mobile terminals is solved, achieving flexible compatibility and efficient interaction in different states.

CN123123869APending Publication Date: 2026-11-17ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611588262.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-14
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing technologies, the interaction methods between mobile terminals and near-field communication devices are limited in different working states (screen on/unlocked or screen off), resulting in insufficient ease of use. In particular, the inability to actively transmit card reader signals in the screen-off state leads to interaction failure.

Method used

Near-field communication devices detect the proximity of terminal devices through proximity sensors and send a characteristic signal to wake up the terminal devices and switch to card reader mode when no card reader signal is received, ensuring smooth interaction in different states.

Benefits of technology

It enables normal interaction with near-field communication devices even when the screen is off, avoiding increased power consumption and radio frequency conflicts, and improving device compatibility and interaction success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123869A_ABST
    Figure CN123123869A_ABST
Patent Text Reader

Abstract

This specification provides a near-field communication method, a near-field communication device, and a terminal device. The solution includes: when the near-field communication device is in card emulation mode, in response to determining that a terminal device has entered a preset proximity range, detecting whether a card reader signal is received from the terminal device; if the card reader signal is not received, the near-field communication device switches to card reader mode and sends a feature signal; the feature signal is used to instruct the terminal device to switch to card reader mode; after sending the feature signal, the near-field communication device switches to card emulation mode to perform near-field communication with the terminal device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to one or more embodiments in the field of near-field communication technology, and particularly to near-field communication methods. This specification also relates to a near-field communication device, a terminal device, a computing device, a computer-readable storage medium, and a computer program product. Background Technology

[0002] Near Field Communication (NFC) is a short-range, high-frequency wireless communication technology widely used in payment, access control, and transportation card applications. NFC-enabled devices typically support both card emulation and reader modes. In card emulation mode, the device can be read by a reader and retrieve stored tag information; in reader mode, the device can actively transmit radio frequency signals to read other NFC tags or cards. With the increasing prevalence of NFC-enabled mobile communication terminals (such as smartphones), users are increasingly inclined to use mobile terminals to replace physical cards for various near-field communication services, which places higher demands on the compatibility and ease of interaction of near-field communication devices.

[0003] In near-field communication (NFC) scenarios, the interaction method between NFC devices and mobile terminals typically depends on the current operating state of the mobile terminal. For example, when the mobile terminal is in an unlocked state with the screen on, its card reader function is usually active, capable of actively transmitting radio frequency signals. However, when the mobile terminal is in an off-screen or locked state, to reduce power consumption, its card reader function is often disabled, retaining only the card emulation mode to passively respond to card reader signals. However, in actual use, users may bring their mobile terminals close to the NFC device at any time in any state (such as unlocked or off-screen). If the NFC device can only adapt to the interaction method in one state, it will limit the user's ease of use.

[0004] Therefore, a more flexible and robust near-field communication solution is needed. Summary of the Invention

[0005] In view of the above, one or more embodiments of this specification provide a near-field communication method, a near-field communication device, a terminal device, a computing device, and a computer-readable medium to provide a more flexible and robust near-field communication solution.

[0006] According to a first aspect of one or more embodiments of this specification, a near-field communication method is provided, applied to a near-field communication device, the method comprising: When the near-field communication device is in card emulation mode, in response to determining that a terminal device has entered a preset proximity range, it detects whether it receives a card reader signal from the terminal device. If the card reader signal is not received, the near-field communication device switches to card reader mode and sends a feature signal; the feature signal is used to instruct the terminal device to switch to card reader mode. After sending the characteristic signal, the near-field communication device switches to card emulation mode to perform near-field communication with the terminal device.

[0007] According to a second aspect of one or more embodiments of this specification, a near-field communication method is provided, applied to a terminal device, the method comprising: When the terminal device is in card emulation mode, it receives a characteristic signal sent by a near-field communication device; In response to receiving the feature signal, the terminal device switches from card emulation mode to card reader mode; In the card reader mode, a card reader signal is sent to the near-field communication device to read the tag information in the near-field communication device.

[0008] According to a third aspect of one or more embodiments of this specification, a near-field communication device is provided, comprising: A proximity sensor is used to determine whether a terminal device has entered a preset proximity range; The near-field communication module supports both card emulation mode and card reader mode. The controller, connected to both the proximity sensor and the near-field communication module, is used for: When the near-field communication module is in card emulation mode, in response to the proximity sensor determining that a terminal device has entered the preset proximity range, the near-field communication module detects whether it receives a card reader signal from the terminal device. If the card reader signal is not received, the near-field communication module is controlled to switch to card reader mode and send a feature signal, which is used to instruct the terminal device to switch to card reader mode; After sending the characteristic signal, the near-field communication module is controlled to switch to card emulation mode to perform near-field communication with the terminal device.

[0009] According to a fourth aspect of one or more embodiments of this specification, a terminal device is provided, comprising: The near-field communication module supports both card emulation mode and card reader mode. The processor, connected to the near-field communication module, is configured to: receive a feature signal sent by a near-field communication device through the near-field communication module when the near-field communication module is in card emulation mode; identify the feature signal in response to receiving the feature signal; control the near-field communication module to switch from card emulation mode to card reader mode based on the identification result; and control the near-field communication module to send a card reader signal to the near-field communication device in card reader mode to read tag information in the near-field communication device in card reader mode.

[0010] According to a fifth aspect of one or more embodiments of this specification, a computing device is provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor, when executing the computer instructions, implements the steps of the near-field communication method.

[0011] According to a sixth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided that stores computer instructions which, when executed by a processor, implement the steps of the near-field communication method.

[0012] According to a seventh aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the near-field communication method described above.

[0013] One embodiment of this specification achieves at least the following beneficial effects: After the near-field communication device determines that a terminal device has entered a preset proximity range through proximity sensing, it first detects whether the terminal device has actively transmitted a card reader signal. Only when no such signal is detected does it send a feature signal to wake up the terminal device and switch to card reader mode. After sending the signal, it switches back to card emulation mode to conduct near-field communication with the terminal device. Since the device only sends the feature signal when it confirms that the terminal device is close and in a silent state, it avoids the power consumption overhead of continuously transmitting radio frequency signals and also avoids radio frequency conflicts with the terminal device that is actively reading a card. At the same time, the device switches back to card emulation mode in a timely manner after waking up the terminal device, ensuring that both parties can establish a correct card reader-card emulation communication relationship. Therefore, the near-field communication device can be compatible with different working states of the terminal device. Regardless of whether the terminal device is originally in card emulation mode or card reader mode, it can complete near-field communication interaction, improving device compatibility and interaction success rate. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 This diagram illustrates a specific application scenario of a near-field communication method provided in the embodiments of this specification. Figure 2 A flowchart illustrating a near-field communication method applied to a near-field communication terminal, provided as an embodiment of this specification; Figure 3 A flowchart illustrating a near-field communication method applied to a terminal device, provided as an embodiment of this specification; Figure 4 This diagram illustrates the near-field communication interaction process between a near-field communication terminal and a user terminal device in a practical application scenario provided by an embodiment of this specification. Figure 5 A timing diagram of a near-field communication method provided in an embodiment of this specification is shown; Figure 6 The embodiments provided in this specification correspond to Figure 2 A schematic diagram of the structure of a near-field communication device; Figure 7 The embodiments provided in this specification correspond to Figure 3 A schematic diagram of the structure of a near-field communication device; Figure 8 A structural block diagram of a computing device provided according to an embodiment of this specification is shown. Detailed Implementation

[0016] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0017] This specification uses specific terms to describe embodiments thereof. Terms such as "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic associated with at least one embodiment of this specification. Therefore, it should be emphasized and noted that references to "an embodiment," "one embodiment," or "an alternative embodiment" in different locations throughout this specification do not necessarily refer to the same embodiment. Furthermore, those skilled in the art can combine and integrate the different embodiments or examples described herein, as well as the features of those different embodiments or examples, without contradiction.

[0018] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “an,” “an,” “the,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification includes any or all possible combinations of one or more associated listed items.

[0019] The terms “comprising,” “including,” or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitation, the presence of additional identical or equivalent elements in the process, method, product, or apparatus that includes said elements is not excluded.

[0020] Although the terms "first," "second," etc., may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, "first" may also be referred to as "second," and similarly, "second" may also be referred to as "first," without departing from the scope of one or more embodiments of this specification. Ordinal numbers such as "first," "second," etc., do not necessarily indicate order; often they are used to facilitate the distinction of objects. For example, "first server" and "second server" usually refer to two servers. To distinguish these two servers, they are described as "first server" and "second server." Of course, sometimes these two servers may be the same server.

[0021] Depending on the context, the word "if" as used here can be interpreted as "when," "when," or "in response to determination."

[0022] In this specification, unless explicitly stated otherwise, "receiving and sending data" does not necessarily mean direct receiving and sending; it can also mean indirect receiving and sending. For example, A receiving data sent by B can be understood as A directly receiving the data sent by B, or it can be understood as A indirectly receiving the data sent by B through other entities such as C. Similarly, B sending data to A can be understood as B sending the data directly to A, or it can be understood as B indirectly sending the data to A through other entities such as C. Here, C can be one entity, or it can be two or more entities.

[0023] In this specification, unless explicitly stated otherwise, the relationships between structures can be direct or indirect. For example, when describing "A is connected to B," unless it is explicitly stated that A and B are directly connected, it should be understood that A can be directly connected to B or indirectly connected to B. Similarly, when describing "A is on top of B," unless it is explicitly stated that A is directly above B (AB is adjacent and A is above B), it should be understood that A can be directly above B or indirectly above B (AB is separated by other elements, and A is above B). And so on.

[0024] 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 one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. The collection, use and processing of related data shall comply with the relevant laws, regulations and standards of the relevant regions, and corresponding operation entry points shall be provided for users to choose to authorize or refuse.

[0025] The following explains the terms and concepts used in one or more embodiments of this specification.

[0026] Near Field Communication (NFC) is a short-range, high-frequency wireless communication technology developed from Radio Frequency Identification (RFID) technology. It operates at a frequency of 13.56 MHz and typically has a communication distance of less than 20 centimeters. NFC technology supports two main operating modes: reader mode (PCD mode) and card emulation mode (PICC mode). In reader mode, the NFC device actively transmits an RF carrier signal to read information from nearby NFC tags or cards. In card emulation mode, the NFC device acts as a contactless smart card, passively responding to reading requests from an external reader and returning stored tag information. Due to its contactless, fast pairing, and low power consumption characteristics, NFC technology is widely used in mobile payments, access control, transportation card payments, and device pairing applications.

[0027] A card reader (Proximity Coupling Device, PCD) in the NFC standard refers to a device capable of generating a radio frequency field and reading proximity integrated circuit cards (PICC). The reader actively transmits a radio frequency carrier signal to provide power to the passive card and sends a read request according to the NFC protocol standard to retrieve the data stored on the card. Card readers are typically used in scenarios requiring active card reading, such as identity authentication, payment terminals, and access control systems.

[0028] A proximity card (PICC), in the NFC standard, refers to a contactless smart card using a radio frequency interface. It obtains its operating power by coupling to the radio frequency field generated by the reader. Proximity cards do not require an internal power source; when they enter the coverage area of ​​the reader's radio frequency field, their internal circuitry is activated, enabling them to respond to commands sent by the reader and return stored tag data. Common proximity cards include access cards, transportation cards, and payment cards. Furthermore, NFC devices that support card emulation (such as smartphones) can also function as proximity cards, simulating the identity and data of a physical card.

[0029] Low Power Card Detection (LPCD) is an operating mode employed by devices with NFC reader functionality (such as smartphones) to reduce power consumption. In this mode, the device does not continuously emit radio frequency fields; instead, it periodically emits brief detection signals at relatively long intervals to detect the presence of nearby NFC tags or cards. Due to the extremely low duty cycle of the detection signal transmission, the power consumption of this mode is significantly lower than the continuous radio frequency transmission in reader mode. When the device detects the presence of an NFC tag or card, LPCD mode triggers the device to switch to reader mode to execute the subsequent complete card reading process.

[0030] Near Field Communication (NFC) is widely used in various scenarios such as payment, access control, transportation, data exchange, and device pairing. Devices with NFC functionality typically support two operating modes: reader mode (PCD mode) and card emulation mode (PICC mode). In reader mode, the device actively transmits radio frequency carrier signals to read information from nearby NFC tags or cards; for example, an access control reader reads an access card, or a mobile phone reads the balance on a public transport card. In card emulation mode, the device simulates a contactless smart card, passively responding to the reader's reading request and returning the stored tag information; for example, a mobile phone simulates an access control card to swipe at a gate, or a mobile phone simulates a public transport card to pass through a turnstile. In addition, NFC also supports point-to-point communication mode for bidirectional data transmission between two devices, such as electronic business card exchange, Bluetooth or Wi-Fi quick pairing, etc.

[0031] Taking near-field communication (NFC) payments as a specific example, a common interaction method in NFC payment scenarios is that the POS device acts as a card reader, and the mobile phone simulates a virtual credit or debit card. The user brings the phone close to the POS device, and the card reader reads the virtual card information on the phone to complete the payment. However, due to some mobile phone manufacturers not enabling virtual card modes and business strategy considerations, another interaction method has also been widely adopted—the mobile phone acts as a card reader to read NFC tags. In this method, after the phone screen is turned on or unlocked, it is brought close to the NFC tag device. After reading the tag information, a notification pops up or the payment application is directly launched. The user confirms to complete the payment. Compared with QR code payments, this shortens the payment path and improves the payment experience.

[0032] As mobile devices, power management is crucial for smartphones. To reduce power consumption, smartphones typically disable card reader mode when the screen is off (also known as screen-off / screen-free) and only retain card emulation mode to passively respond to external card readers. This means that when a user holds a screen-off phone close to an NFC tag device, near-field communication cannot be established because the phone cannot actively transmit a card reader signal. However, many users have a habit of touching NFC tag devices while the screen is off. If the phone could function as a card reader even when the screen is off without significantly increasing power consumption, it would greatly improve ease of use. Simultaneously, the proposed solution must also be compatible with existing interaction methods for using the phone as a card reader when unlocked.

[0033] One related implementation involves NFC tag devices using a time-sharing multiplexing mechanism between reader mode and card emulation mode. In reader mode, the device periodically transmits carrier signals. The phone defaults to card emulation mode, and once it detects the carrier signal transmitted by the device, it switches to reader mode to establish communication. This approach faces the following problem: if the phone is unlocked (in which case the phone itself may also actively transmit reader signals in reader mode) and approaches the device, once it detects the carrier signal transmitted by the device first, the phone may be mistakenly triggered to enter card emulation mode, causing it not to transmit reader signals or to display a wallet selection interface, resulting in a poor user experience when unlocked.

[0034] Therefore, a more flexible and robust near-field communication solution is needed to enable smooth interaction with near-field communication devices regardless of the terminal device's operating state (such as screen on / off or screen off).

[0035] To address the shortcomings in related technologies, this specification provides a near-field communication method in its embodiments, wherein the near-field communication device actively predicts whether a terminal device is approaching and adaptively determines the interaction method based on the terminal device's operating state.

[0036] Specifically, in the embodiments of this specification, the near-field communication device can operate in card emulation mode by default. Based on this, the near-field communication device first determines whether a terminal device has entered a preset proximity range through proximity sensing. This step allows the device to detect the presence of a terminal device when it approaches but has not yet entered the effective near-field communication range, reserving a time window for subsequent judgment. Once a terminal device is confirmed to have entered the range, the near-field communication device immediately checks whether it receives a card reader signal from that terminal device. This detection step can identify the current operating state of the terminal device—if the terminal device is in a screen-on unlocked state, its card reader function is usually active and it will actively transmit a card reader signal; if the terminal device is in a screen-off state, the card reader function is disabled, and it will not transmit a card reader signal. Based on the detection results, the device adaptively determines its subsequent behavior: if a reader signal is received, it indicates that the terminal device has actively worked as a reader, and the device can maintain card emulation mode to interact normally with it; if no reader signal is received, it indicates that the terminal device is currently in a silent state (e.g., screen off), and the device actively switches to reader mode to send a characteristic signal. This characteristic signal is used to instruct the terminal device to switch to reader mode. After recognizing this signal, the terminal device switches from card emulation mode to reader mode, thus being successfully "wake up" as the active reader. After completing the transmission of the characteristic signal, the device promptly switches back to card emulation mode to establish a correct reader-card emulation communication relationship with the terminal device that has switched to reader mode, completing subsequent near-field communication.

[0037] Therefore, the solution of the embodiments in this specification solves the problem that the terminal device cannot actively initiate near-field communication when the card reader mode is closed in the screen-off state. It wakes up the terminal device by using the device's characteristic signal to switch to card reader mode, realizing normal interaction in the screen-off state. At the same time, by first detecting whether the terminal device is transmitting a card reader signal before deciding whether to send a wake-up signal, it avoids the problem of card ejection or radio frequency conflict caused by the accidental triggering of the carrier signal when the terminal device is in the unlocked state and actively reading the card. Thus, it is compatible with the existing interaction methods in the unlocked state of the terminal device.

[0038] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0039] The solutions provided in the embodiments of this specification can be applied to various interaction scenarios between terminal devices with near-field communication (NFC) capabilities and NFC devices. The terminal devices may include, but are not limited to, portable or wearable mobile communication terminals such as smartphones, tablets, smartwatches, smart rings, and smart bracelets. The NFC devices may include, but are not limited to, payment terminals, group meal payment devices, attendance machines, access control card readers, smart door locks, and vehicle-mounted NFC modules deployed in various business scenarios. Both the aforementioned terminal devices and NFC devices possess NFC communication capabilities and support both reader mode and card emulation mode.

[0040] The solutions provided in the embodiments of this specification can be deployed and work collaboratively on the terminal device side and the near-field communication device side as independent software modules, hardware modules, or a combination of software and hardware. Alternatively, the server side can cooperate with the terminal device or the near-field communication device to complete some processing logic. This specification does not limit this approach. For example, the near-field communication device can report the detected proximity event of the terminal device to the server, which decides whether to trigger the transmission of a feature signal according to a preset strategy and returns the decision result to the near-field communication device for execution. Furthermore, the feature signal recognition logic on the terminal device side can be carried out by the NFC driver module at the operating system level or by an upper-layer application. Those skilled in the art can flexibly choose according to actual deployment needs.

[0041] Figure 1 This is a schematic diagram illustrating a specific application scenario of a near-field communication method provided in the embodiments of this specification.

[0042] like Figure 1As shown, a user holds a terminal device 100 (e.g., a smartphone) close to a near-field communication (NFC) device 200 (e.g., an NFC interactive device installed at a merchant's cash register or access control). The terminal device 100 may be in an unlocked state with the screen on or in a locked state with the screen off. The NFC device 200 continuously monitors for approaching objects within the detection range of its internal proximity sensor (e.g., a time-of-flight sensor). When the user enters the detection range with the terminal device 100, the NFC device 200 senses the proximity of the terminal device 100 through the proximity sensor. Subsequently, the NFC device 200 checks whether it receives a reader signal from the terminal device 100—if the terminal device 100 is in an unlocked state with the screen on, its NFC reader function is usually active and it will actively transmit a reader signal; if the terminal device 100 is in a locked state with the screen off, its reader function is disabled and it will not transmit a reader signal. The near-field communication device 200 adaptively determines the subsequent interaction method based on the detection result: if a card reader signal is received, it maintains card emulation mode and interacts normally with the terminal device 100; if no card reader signal is received, it switches to card reader mode and sends a feature signal. After receiving the feature signal, the terminal device 100 switches from card emulation mode to card reader mode, and then the near-field communication device 200 switches back to card emulation mode to complete near-field communication with the terminal device 100—for example, the terminal device 100 reads the tag information in the near-field communication device 200 and then activates the payment application to complete the payment, or activates the access control application to open the door. Throughout the entire interaction process, the user only needs to perform the single action of bringing the terminal device 100 close to the near-field communication device 200, without needing to pay attention to the current state of the terminal device 100 or perform any additional manual operations.

[0043] The embodiments of this specification provide a near-field communication method. This specification also relates to a near-field communication device, a terminal device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.

[0044] Figure 2 This is a flowchart illustrating a near-field communication method applied to a near-field communication terminal, provided as an embodiment of this specification.

[0045] From a procedural perspective, the entity executing the process can be a program mounted on a near-field communication terminal. It can be understood that this method can be executed by any device, equipment, platform, or cluster of devices with computing and processing capabilities.

[0046] like Figure 2 As shown, this process, applied to near-field communication devices, may include the following steps: Step 202: When the near-field communication device is in card emulation mode, in response to determining that a terminal device has entered the preset proximity range, detect whether a card reader signal sent by the terminal device is received.

[0047] The near-field communication (NFC) device supports both card emulation mode and reader mode. Card emulation mode refers to the NFC device simulating a contactless smart card, passively responding to external reader requests and returning stored tag information. Reader mode refers to the NFC device actively emitting radio frequency carrier signals to read information from nearby NFC tags or cards. The reader signal refers to the NFC signal emitted by the terminal device in reader mode, which may include, but is not limited to, detection signals emitted in low-power card detection mode, radio frequency carrier signals emitted in standard card detection mode, or card search signals.

[0048] In some embodiments of this specification, the near-field communication device may default to card emulation mode. When the near-field communication device is in card emulation mode, a proximity sensor can be used to determine whether a terminal device has entered a preset proximity range. The preset proximity range refers to a spatial range pre-set by the near-field communication device to trigger subsequent detection operations. This range can be defined in various ways, such as by a distance threshold, a signal strength threshold, or other location-related parameters. As an example, when the distance between the terminal device and the near-field communication device is less than or equal to a preset distance threshold, the terminal device can be considered to have entered the preset proximity range.

[0049] Once a terminal device is detected entering a preset proximity range, the near-field communication (NFC) device can detect whether it receives a card reader signal from that terminal device. The card reader signal refers to the NFC signal emitted by the terminal device in card reader mode, which may include, but is not limited to, detection signals emitted in low-power card detection mode, radio frequency carrier signals emitted in standard card detection mode, or card search signals. This detection step can be used to identify whether the terminal device is currently actively operating as a card reader—if the terminal device is in a screen-on unlocked state, its card reader function is usually active and it will actively emit a card reader signal; if the terminal device is in a screen-off or locked state, the card reader function is disabled, and it will not emit a card reader signal.

[0050] Based on some embodiments of this specification, since the near-field communication device only triggers the subsequent detection process after determining that the terminal device has entered the preset proximity range through the proximity sensor, rather than continuously transmitting radio frequency signals for polling, the power consumption of the device in standby mode can be reduced. At the same time, by detecting whether the terminal device is actively transmitting a card reader signal before sending any wake-up signal, the subsequent interaction method can be adaptively determined according to the actual working state of the terminal device, avoiding radio frequency signal conflicts with terminal devices that are already working in card reader mode.

[0051] In one or more embodiments of this specification, the step of detecting whether a card reader signal is received from the terminal device in response to determining that a terminal device has entered a preset proximity range includes: when the near-field communication device is in card emulation mode, detecting whether a terminal device has entered the preset proximity range using a proximity sensor in the near-field communication device; and detecting whether a card reader signal is received from the terminal device in response to detecting that a terminal device has entered the preset proximity range.

[0052] Specifically, the determination of whether a terminal device has entered a preset proximity range using a proximity sensor can be achieved as follows: When the near-field communication device is in card emulation mode, the proximity sensor in the near-field communication device can continuously or periodically detect whether an object is approaching within its preset detection range. When the proximity sensor detects an object entering the preset detection range, the near-field communication device can further determine whether the object is a terminal device. In some embodiments, the proximity sensor can distinguish the terminal device from other objects by the object's size, reflection signal characteristics, etc.; in other embodiments, the proximity sensor can also simply detect whether any object has entered the preset proximity range, while the subsequent terminal device identification is handled by other modules. This specification does not limit this.

[0053] In some embodiments of this specification, the proximity sensor can be any type of sensor capable of detecting whether an object has entered a preset range. For example, the proximity sensor may include a distance sensor, such as a time-of-flight sensor or a traditional infrared ranging sensor (which measures distance by measuring the intensity or angle of reflected light). The distance sensor determines whether an object has entered the preset proximity range by measuring the distance between the terminal device and the near-field communication device. Alternatively, the proximity sensor may also include a proximity detection module based on signal strength detection, which determines whether the terminal device is approaching by detecting the signal strength of the wireless signal (such as Bluetooth signal, Wi-Fi signal, etc.) emitted by the terminal device. Those skilled in the art will understand that various types of proximity sensors can be applied to the solutions provided in this specification, as long as they can achieve the function of detecting whether the terminal device has entered the preset proximity range.

[0054] Furthermore, the proximity information detected by the proximity sensor can be expressed as distance information between the terminal device and the near-field communication device, or as other parameters that reflect positional relationships, such as signal strength and angle information. For example, when a wireless signal (such as a Bluetooth signal) emitted by the terminal device is received by the near-field communication device, the near-field communication device can estimate the distance to the terminal device by measuring the received signal strength indication (RSSI) of the signal. Similarly, when a wireless signal emitted by the terminal device is received by multiple antennas of the near-field communication device, the direction and position of the terminal device relative to the near-field communication device can be determined using angle of arrival (AOA) measurement technology. All of the above methods can be used to determine whether the terminal device has entered a preset proximity range, and this specification does not limit this method.

[0055] Based on some embodiments of this specification, in the above scheme, the proximity sensor actively detects whether the terminal device has entered the preset proximity range, so that the near-field communication device can know its presence when the terminal device is close but has not yet entered the effective distance of near-field communication, thus reserving processing time for subsequent detection and mode switching; and since the power consumption of proximity sensor detection is usually lower than the power consumption of the near-field communication module continuously transmitting radio frequency signals, using proximity sensor as a detection means can reduce the overall power consumption of the device.

[0056] In one or more embodiments of this specification, the proximity sensor (the distance sensor) may include a time-of-flight sensor. A time-of-flight sensor is a sensor that calculates distance by measuring the time required for a signal to travel from emission to reflection. This signal can be an optical signal (such as infrared light, visible light, or laser) or an acoustic signal (such as ultrasound). Accordingly, the time-of-flight sensor may include infrared time-of-flight sensors, laser time-of-flight sensors, ultrasonic time-of-flight sensors, etc. As long as the sensor's operating logic is "emit signal → signal reflection → receive signal → calculate time difference → obtain distance," it can be considered a sensor based on the time-of-flight principle.

[0057] Specifically, the step of detecting whether a terminal device has entered a preset proximity range using a proximity sensor in the near-field communication device includes: the time-of-flight sensor emitting a probe wave and receiving a reflected wave reflected by the terminal device; calculating the distance between the terminal device and the near-field communication device based on the time difference between the emission time of the probe wave and the reception time of the reflected wave; and determining whether the terminal device has entered the preset proximity range based on the distance.

[0058] Furthermore, when the proximity sensor is a time-of-flight sensor, it can include a transmitter and a receiver. The process of detecting whether a terminal device has entered a preset proximity range can be as follows: the transmitter emits a detection wave (e.g., light wave or sound wave), which is reflected upon encountering an object; the receiver receives the reflected wave; the controller calculates the distance between the object and the near-field communication device based on the time difference between the emission time of the detection wave and the reception time of the reflected wave, combined with the propagation speed of the detection wave (e.g., the speed of light or the speed of sound). If the calculated distance is less than or equal to a preset distance threshold, it can be determined that the object (i.e., the terminal device) has entered the preset proximity range.

[0059] Taking an infrared time-of-flight sensor as an example, its transmitter emits infrared light signals. These signals are reflected back after encountering the terminal device, and the receiver receives the reflected infrared light signals. The controller calculates the distance between the terminal device and the near-field communication device based on the time difference between the transmission and reception times. Similarly, taking an ultrasonic sensor as an example, its transmitter emits ultrasonic signals. These signals are reflected back after encountering the terminal device, and the receiver receives the reflected ultrasonic signals. The controller calculates the distance based on the time difference.

[0060] Based on some embodiments of this specification, in the above scheme, the time-of-flight sensor calculates the distance by measuring the flight time of the signal. It has high ranging accuracy and fast response speed, and can accurately determine whether the terminal device has entered the preset proximity range. At the same time, the detection wave (such as infrared light or ultrasonic wave) of the time-of-flight sensor is not affected by the radio frequency signal of the near-field communication device itself, and can work independently when the near-field communication module is in card analog mode (not transmitting radio frequency signal), so as to achieve low power consumption and high reliability proximity detection.

[0061] The preset proximity range can be defined by a preset distance threshold. Specifically, the preset distance threshold refers to a distance critical value pre-set by the near-field communication device. When the distance between the terminal device and the near-field communication device is less than or equal to this threshold, the near-field communication device can be triggered to perform subsequent detection operations. This preset distance threshold can be set based on a combination of factors: for example, it can refer to the effective operating distance at which the near-field communication device can effectively wake up the terminal device for mode switching by sending feature signals, so as to ensure that when the terminal device enters the preset proximity range, the feature signals subsequently sent by the device can be effectively received by the terminal device; it can refer to the detection accuracy range of the proximity sensor itself, so as to ensure that the proximity sensor can stably and accurately detect the terminal device within the preset distance threshold; it can refer to the effective sensing distance at which the radio frequency signal of the terminal device can be effectively sensed by the near-field communication device under normal circumstances, so as to ensure that when the terminal device is in card reader mode and emits a card reader signal, the signal can be effectively detected by the near-field communication device within the preset proximity range; it can also be adaptively adjusted according to the specific application scenario requirements (such as access control scenarios, payment scenarios, etc.) to meet the requirements of detection sensitivity and response speed. The above factors can be used individually or in any combination as the basis for setting the parameters. Those skilled in the art can flexibly determine the parameters according to the actual deployment environment. Based on some embodiments of this specification, by comprehensively considering the signal coverage capability of the device, the detection capability of the sensor, and the signal characteristics of the terminal device to set the preset distance threshold, it is possible to ensure proximity detection sensitivity and reliability while taking into account the differentiated needs of different application scenarios.

[0062] In one or more embodiments of this specification, the step of detecting whether a card reader signal is received from the terminal device in response to detecting that a terminal device has entered the preset proximity range includes: starting a time window timing after detecting that the terminal device has entered the preset proximity range; and detecting whether a card reader signal is received from the terminal device within the time window.

[0063] Specifically, this time window can start from the moment the terminal device is detected entering a preset proximity range and last for a preset duration. Within this time window, the near-field communication device can continuously monitor whether it receives a card reader signal from the terminal device through its near-field communication module. If a card reader signal is received within the time window, it can be determined that the terminal device is currently in card reader mode (e.g., the terminal device is in a screen-on unlocked state); if no card reader signal is received within the time window, it can be determined that the terminal device is currently in a silent state (e.g., the terminal device is in a screen-off state).

[0064] The duration of this time window can be set according to the actual application scenario and the operating characteristics of the terminal device. For example, considering that the terminal device's card reader signal transmission is usually periodic (such as the periodic detection signal in low-power card detection mode), the duration of the time window can be set to cover the duration of at least one card reader signal transmission. In some embodiments, the duration of this time window can be on the order of hundreds of milliseconds, such as 350 milliseconds, to ensure that the card reader signals that the terminal device may emit can be reliably captured. In some embodiments, the duration of this time window can be dynamically determined according to the moment when the near-field communication device detects that the terminal device has entered a preset proximity range.

[0065] Based on some embodiments of this specification, in the above scheme, by setting a time window to limit the duration of detecting the card reader signal, the near-field communication device can avoid waiting indefinitely for the card reader signal and falling into a long-term unresponsive state. At the same time, the design of this time window enables the near-field communication device to make a quick judgment within a short time window after the terminal device approaches, thereby completing the mode switch or maintaining the current mode in a timely manner, improving the timeliness of the interaction.

[0066] In some embodiments, the duration of the time window can be set to be greater than or equal to the complete cycle of the terminal device sending one card reader signal. The complete transmission cycle refers to the duration of one complete card reader signal transmission behavior of the terminal device, which may include the duration of one signal transmission and the interval between two adjacent transmissions.

[0067] The purpose of setting the time window length to be no less than one complete transmission cycle of the terminal device's card reader signal is to ensure the reliability of detection. When the terminal device sends a card reader signal in card reader mode, it may use continuous transmission or time-division multiplexing (i.e., periodically transmitting detection signals at certain intervals). In time-division multiplexing, the transmission and interval of the card reader signal alternate. If the time window length is too short, it may fall exactly within the interval between two transmissions, thus missing the card reader signal emitted by the terminal device and causing a false judgment. Therefore, setting the time window length to be no less than one complete transmission cycle ensures that regardless of the phase of the time window's start time relative to the terminal device's transmission cycle, at least one complete card reader signal transmission can be covered within the window, thereby avoiding missed detections.

[0068] Based on some embodiments of this specification, in the above scheme, by setting the duration of the time window to be no less than one complete transmission cycle of the terminal device's card reader signal, the near-field communication device has high reliability in determining whether the terminal device has issued a card reader signal. Even if the terminal device uses time-division multiplexing to send the card reader signal, the time window can still completely cover at least one transmission cycle, thereby accurately identifying the working status of the terminal device and reducing misjudgments caused by an excessively short window.

[0069] Step 204: If the card reader signal is not received, the near-field communication device switches to card reader mode and sends a feature signal; the feature signal is used to instruct the terminal device to switch to card reader mode.

[0070] In some embodiments of this specification, if the near-field communication device does not receive a card reader signal from the terminal device within a time window, the near-field communication device may switch to card reader mode and send a characteristic signal. The characteristic signal is a radio frequency signal in the near-field communication frequency band. The characteristic signal can be used to instruct the terminal device to switch to card reader mode.

[0071] Near-field communication (NFC) devices can switch between reader mode and card emulation mode in various hardware ways. In some embodiments, the NFC module may include a single NFC chip with both reader and card emulation functions, which can switch between reader mode and card emulation mode in a time-division manner. When a feature signal needs to be sent, the single NFC chip switches from card emulation mode to reader mode and sends the feature signal; after sending, the single NFC chip switches back to card emulation mode. In other embodiments, the NFC module may include two NFC chips: a first NFC chip with reader function and a second NFC chip with card emulation function. The first NFC chip may be in an on state by default, and the second NFC chip may be in an off state by default, so that the NFC device operates in card emulation mode by default. When a feature signal needs to be sent, the NFC device may activate the second NFC chip, which then sends the feature signal; after sending, the second NFC chip may be deactivated, restoring the device to card emulation mode.

[0072] In some embodiments, the near-field communication device switches to card reader mode and sends a characteristic signal, which may specifically include sending the characteristic signal within a preset duration after the near-field communication device switches to card reader mode. This preset duration can be a short time period, such as tens to hundreds of milliseconds, to reduce device power consumption and minimize interference to the terminal device. After sending the characteristic signal, the near-field communication device can switch back to card emulation mode within a preset time interval to promptly establish communication with the terminal device that has switched to card reader mode.

[0073] Based on some embodiments of this specification, in the above scheme, the near-field communication device actively switches to reader mode to send a feature signal to wake up the terminal device when it does not detect the reader signal of the terminal device, realizing the transformation of the interaction mode from passive waiting to active wake-up; since the device only sends the feature signal when it confirms that the terminal device is in a state of not transmitting a reader signal, it avoids radio frequency signal conflict with the terminal device that is already working in reader mode; at the same time, by limiting the transmission duration of the feature signal to a preset duration and switching back to card emulation mode in a timely manner after the transmission is completed, the device can quickly recover to a readable state without affecting the normal near-field communication with the terminal device.

[0074] In one or more embodiments of this specification, the step of switching the near-field communication device to reader mode and sending a characteristic signal if the reader signal is not received includes: determining that the terminal device is in a silent state if the reader signal is not received; the silent state characterizes the working state of the terminal device not actively sending a reader signal; in response to determining that the terminal device is in a silent state, the near-field communication device switches to reader mode and sends a characteristic signal.

[0075] The silent state refers to the operating state where the terminal device does not actively send a card reader signal; that is, the terminal device maintains radio frequency silence in near-field communication and does not actively transmit card reader detection signals. The silent state can be understood from a radio frequency behavior perspective. Any scenario where the terminal device does not actively transmit a card reader signal, regardless of whether its screen is on or off, or what power management mode its operating system is in, can be categorized as a silent state. For example, the terminal device is in a silent state when it is in card emulation mode; the terminal device's NFC function is disabled; and the terminal device is in a radio frequency sleep state. From the perspective of the near-field communication device's own judgment logic, it does not need to care about the terminal device's internal mode. As long as no card reader signal is received within the detection window, it is considered to be in a silent state, thus triggering subsequent actions. In response to determining that the terminal device is in a silent state, the near-field communication device can switch to card reader mode and send a characteristic signal.

[0076] In some embodiments of this specification, the determination of the silent state is based on whether a card reader signal is received within a time window—if a card reader signal is received, it indicates that the terminal device is not currently in a silent state (i.e., in an active transmission state); if no signal is received, it indicates that the terminal device is in a silent state. This determination method does not rely on the terminal device actively reporting its status information; it can be completed solely through passive detection by the near-field communication device.

[0077] Based on some embodiments of this specification, by using whether or not a card reader signal is received as the basis for determining whether the terminal device is in a silent state, the near-field communication device can know the working status of the terminal device through its own detection without relying on the terminal device to actively report status information, and then adaptively decide whether to send a feature signal.

[0078] In one or more embodiments of this specification, the silent state includes the terminal device being in card emulation mode; the feature signal is used to trigger the terminal device in card emulation mode to switch to card reader mode.

[0079] The card emulation mode refers to the working mode in which the terminal device emulates a contactless smart card and passively responds to an external card reader. In near-field communication protocols, card emulation mode is essentially a passive communication mode. In this mode, the terminal device does not actively initiate communication or actively transmit card reader detection signals, but relies on the radio frequency field provided by the external card reader for power and response. Therefore, when the terminal device is in card emulation mode, it does not actively send card reader signals, which is a typical case of the aforementioned silent state.

[0080] When the terminal device is in card emulation mode, a feature signal can be used to trigger the terminal device to switch to card reader mode. Specifically, after detecting the feature signal in card emulation mode, the terminal device can switch from card emulation mode to card reader mode. Since the feature signal is a radio frequency carrier signal sent by the near-field communication device in card reader mode, the antenna of the near-field communication module of the terminal device can receive the signal when it is in card emulation mode. The near-field communication driver layer or related processing module of the terminal device can identify the physical characteristics of the feature signal and determine the mode switching command indicated by the feature signal according to a preset correspondence, thereby executing the switch from card emulation mode to card reader mode.

[0081] In some embodiments of this specification, when the terminal device is in card emulation mode, its screen may be on or off. As long as its near-field communication module is currently operating in card emulation mode and does not actively transmit card reader signals, it can be considered as a silent state. The solutions in this specification are also applicable to the above-mentioned scenarios.

[0082] Based on some embodiments of this specification, since the feature signal is used to trigger the terminal device in card emulation mode to switch to card reader mode, the terminal device can switch from passive response state to active card reading state after receiving the feature signal, thereby realizing interaction with near field communication devices.

[0083] In some embodiments, the screen state (e.g., on / off) and lock state (e.g., locked / unlocked) of a terminal device can present various combinations in actual use, and the state in which different manufacturers or models of terminal devices transmit card reader signals may also differ. For example, some terminal devices transmit card reader signals when the screen is on and unlocked, some terminal devices may also transmit card reader signals when the screen is on but not unlocked, while most terminal devices do not transmit card reader signals when the screen is off. The solution provided in this specification does not rely on distinguishing specific combinations of screen state and lock state, but rather on judging from the functional behavior of whether the terminal device transmits a card reader signal. When the terminal device transmits a card reader signal, it indicates that its card reader function is active; when the terminal device does not transmit a card reader signal, it indicates that it is not currently actively working as a card reader. Near field communication devices identify the current working state of the terminal device by detecting the presence of a card reader signal, rather than by detecting the screen state or lock state of the terminal device. In other words, regardless of whether the terminal device's screen is on or off, or whether it is locked or unlocked, as long as the near-field communication device detects a card reader signal emitted by the terminal device, it determines that the device is in card reader mode; if no card reader signal is detected within the time window, the terminal device is determined to be in silent mode. This method of judgment based on functional behavior rather than physical state allows the solution provided in this manual to adapt to the differences in screen state and lock state combinations of different manufacturers and models of terminal devices.

[0084] In one or more embodiments of this specification, when the terminal device is in card emulation mode, the screen of the terminal device may be in a screen-off state.

[0085] In real-world usage scenarios, to reduce power consumption, terminal devices typically disable the card reader function when the screen is off. Their near-field communication (NFC) modules can then retain only card emulation mode to passively respond to external card readers. Therefore, terminal devices in screen-off state are usually in card emulation mode, not actively transmitting card reader signals, a typical scenario associated with a silent state. Upon receiving a characteristic signal in screen-off state, the terminal device can switch from card emulation mode to card reader mode, thus enabling it to interact with NFC devices as a card reader even when the screen is off.

[0086] In some embodiments of this specification, even when the terminal device is in a screen-off state but not in card emulation mode (e.g., NFC function is completely turned off), the terminal device can still receive characteristic signals sent by the near-field communication device, and respond to the signal to wake up near-field communication related functions and switch to card reader mode. This specification does not limit this.

[0087] Based on some embodiments of this specification, a terminal device in a screen-off state is woken up by a feature signal and switched to card reader mode. This allows the terminal device to actively participate in near-field communication as a card reader even when the screen is off and the card reader function is usually turned off, thus expanding its near-field communication capability in a screen-off state without increasing the standby power consumption of the terminal device.

[0088] In one or more embodiments of this specification, the feature signal is generated based on a preset protocol between the near-field communication device and the terminal device; the preset protocol is used to define the correspondence between the physical characteristics of the feature signal and the mode switching command of the terminal device.

[0089] The preset protocol refers to the communication rules agreed upon in advance between the near-field communication device and the terminal device. For example, the preset protocol may stipulate that characteristic signals with specific pulse widths, specific pulse intervals, and specific pulse counts correspond to the instruction "switch to reader mode"; characteristic signals with different physical characteristics may correspond to other instructions. The near-field communication device generates and sends characteristic signals according to the preset protocol, and the terminal device receives and identifies the characteristic signals according to the same preset protocol, thereby deciphering the meaning of the instruction carried by the characteristic signals.

[0090] The preset protocol can be pre-configured at the factory of the near-field communication (NFC) device or configured through subsequent firmware upgrades or software updates. In some embodiments, the preset protocol can be determined through negotiation between the NFC device service provider and the terminal device manufacturer, and supported in the terminal device's operating system driver layer or NFC module. The terminal device can detect and identify characteristic signals through the operating system driver layer, and then determine the corresponding mode switching command according to the preset protocol.

[0091] Based on some embodiments of this specification, a pre-defined protocol defines the correspondence between the physical characteristics of a feature signal and a mode switching command, enabling near-field communication devices to transmit mode switching commands by adjusting the physical characteristics of the feature signal (rather than the data content carried in the signal). The terminal device only needs to detect and identify the physical characteristics of the feature signal to parse the meaning of the command, without the need for complex processing such as demodulation and decoding of the signal, thus reducing the computational overhead and power consumption required for the terminal device to identify the feature signal.

[0092] In one or more embodiments of this specification, the feature signal is a radio frequency carrier signal with a preset pulse pattern in the near-field communication frequency band; the feature signal is used to trigger the terminal device in card emulation mode to switch to card reader mode.

[0093] The near-field communication frequency band typically refers to the 13.56MHz band, which is the carrier frequency specified in the near-field communication technology standard. The preset pulse pattern refers to the time-amplitude pattern of the characteristic signal in the time domain, which may include parameters such as pulse width, pulse interval, and number of pulses. For example, a preset pulse pattern can specify that the characteristic signal consists of multiple pulses, each with a specific duration width and a specific time interval between pulses. By detecting the pulse pattern of the received radio frequency carrier signal, the terminal device can identify whether the signal is a characteristic signal and perform corresponding mode switching accordingly.

[0094] In some embodiments of this specification, the feature signal may be an unmodulated carrier signal, meaning the feature signal does not carry modulated data content and only transmits information through its physical characteristics (such as pulse width, pulse interval, pulse number, etc.). Since the terminal device only needs to detect the presence or absence of the radio frequency carrier pulse and its time-domain characteristics, without performing demodulation processing, the identification overhead of the terminal device can be reduced. In other embodiments, the feature signal may also be a modulated carrier signal used to carry other auxiliary information; this specification does not limit this.

[0095] In some embodiments of this specification, the near-field communication device may transmit characteristic signals in bursts, that is, transmit a concentrated set of radio frequency pulses containing a predetermined number of pulses within a short period of time, rather than continuously. This burst-based transmission method helps reduce the power consumption of the near-field communication device and minimizes potential interference to other near-field communication devices in the environment.

[0096] Based on some embodiments of this specification, the feature signal adopts a radio frequency carrier signal in the near-field communication band and has a preset pulse pattern, enabling the terminal device to identify the signal by detecting the pulse pattern in the near-field communication band without the need for additional communication bands or hardware support, and is compatible with the existing near-field communication hardware of the terminal device; at the same time, since the feature signal only transmits instruction information through its physical characteristics, the terminal device can complete the identification through the driver layer without waking up the upper layer application, which helps to reduce the overall power consumption of the terminal device.

[0097] In one or more embodiments of this specification, the preset pulse pattern of the characteristic signal is a non-standard pulse pattern; the non-standard pulse pattern refers to a pulse pattern that has different pulse characteristics (such as different pulse widths and / or pulse intervals) from the device discovery signal pattern (i.e., polling sequence pattern) specified in the near field communication standard.

[0098] In near-field communication standards (such as ISO / IEC 14443 and ISO / IEC 18092) and NFC Forum specifications, card readers periodically send a series of polling command signals (such as REQA, REQB, SENS_REQ, etc.) to detect different types of cards. These signals have pulse patterns specified by the standards. When a terminal device receives an RF signal conforming to the standard polling sequence pattern in card emulation mode, it recognizes it as a device discovery process initiated by a standard card reader and may trigger the terminal device to display a wallet selection interface.

[0099] The non-standard pulse pattern differs from the standard device discovery signal pattern. Therefore, when a terminal device receives this characteristic signal, it will not recognize it as a device discovery process initiated by a standard card reader, thus avoiding triggering the card packet ejection behavior. The terminal device can identify the non-standard pulse pattern through its driver layer and, according to a preset protocol, recognize it as a mode switching command, executing a switch from card emulation mode to card reader mode without triggering the card packet selection interface.

[0100] In some embodiments of this specification, the difference between a non-standard pulse pattern and a standard polling sequence pattern can be reflected in the pulse width, pulse interval, number of pulses, or any combination of the above aspects. For example, the feature signal may have a narrower pulse width than the standard polling sequence; or the feature signal may have a different pulse interval than the standard polling sequence; or the feature signal may have a different number of pulses than the standard polling sequence.

[0101] Based on some embodiments of this specification, since the feature signal uses a non-standard pulse pattern, it has a physically identifiable difference from the device detection signal pattern specified by the near-field communication standard. The terminal device can thus distinguish the feature signal from the standard card reader signal, thereby performing a mode switch instead of triggering a card packet selection process when the feature signal is detected. The non-standard pulse pattern makes the feature signal different from the standard signal at the physical layer, realizing the purpose of transmitting instructions without complex protocol interaction at the data layer.

[0102] In one or more embodiments of this specification, the preset pulse pattern differs from the device detection signal pattern in at least one of the following: pulse width, pulse interval, and number of pulses.

[0103] Taking the feature signal in some embodiments as an example, its pulse width can be on the order of tens of microseconds, the number of pulses can be 1 to 4, and the interval between adjacent pulses can be 10 to 30 milliseconds. These numerical ranges can serve as specific examples of a preset pulse pattern, enabling the feature signal to differ from the standard polling sequence in multiple dimensions such as pulse width, number of pulses, and pulse interval. The aforementioned numerical ranges of pulse width and interval can be pre-configured in the driver layer of the terminal device as a basis for identifying the feature signal.

[0104] In some embodiments of this specification, multiple physical characteristics of the feature signal, such as pulse width, number of pulses, and pulse interval, can be used in combination to further reduce the probability that the terminal device misidentifies the feature signal as a signal detected by the standard device. For example, even if the pulse width of a feature signal is similar to that of the standard signal, if its pulse interval or number of pulses is different from that of the standard signal, the terminal device can still make an accurate identification based on the comprehensive combination of physical characteristics.

[0105] Based on some embodiments of this specification, by setting the preset pulse pattern of the feature signal to differ from the device-detected signal pattern in at least one of pulse width, pulse interval, and pulse number, the terminal device can quickly identify and distinguish the feature signal at the driver layer, and then execute the corresponding mode switching command; the combined use of multiple physical features such as pulse width, pulse interval, and pulse number can improve the recognition accuracy.

[0106] In some embodiments of this specification, the process of the terminal device identifying the feature signal and performing mode switching can be completed at the operating system driver layer, that is, before the card wallet is popped up (the card wallet selection interface appears). Because the feature signal uses a non-standard pulse pattern, the terminal device will not recognize it as a device discovery process initiated by a standard card reader, and therefore will not trigger the card wallet selection process. After detecting the non-standard pulse pattern, the near-field communication driver layer of the terminal device can recognize it as a mode switching instruction according to a preset protocol and switch from card emulation mode to card reader mode. The entire process requires no manual intervention from the user. The terminal device's ability to identify and respond to feature signals can be achieved through driver layer adaptation by the terminal device manufacturer. In some embodiments, the terminal device manufacturer can support the detection, identification, and mode switching functions of feature signals by upgrading the operating system or near-field communication driver module. Regarding how the terminal device can identify specific feature signals and perform mode switching accordingly (rather than popping up the card wallet), the specific driver layer implementation can be developed by the terminal device manufacturer based on the characteristics of its operating system and hardware platform.

[0107] Step 206: After sending the characteristic signal, the near-field communication device switches to card emulation mode to perform near-field communication with the terminal device.

[0108] In some embodiments of this specification, after sending a feature signal, the near-field communication (NFC) device can switch back to card emulation mode to conduct NFC communication with the terminal device. Specifically, after sending the feature signal, the NFC device can switch from reader mode back to card emulation mode, restoring the NFC device to a state readable by an external card reader. Upon receiving the feature signal, the terminal device identifies the signal according to a preset protocol and switches from card emulation mode to reader mode. At this time, the NFC device is in card emulation mode, and the terminal device is in reader mode. A reader-card emulation communication relationship conforming to the NFC standard can be established between the two—the terminal device, acting as a reader, transmits radio frequency (RF) signals, and the NFC device, acting as the read card, responds to the RF signals by returning stored tag information.

[0109] Referring to the description of the dual-mode implementation above, the near-field communication device can switch from reader mode back to card emulation mode by controlling a single NFC chip after transmitting a feature signal, or by turning off the NFC chip with reader function while allowing the NFC chip with card emulation function to continue operating. In some embodiments, the near-field communication device can perform a mode switch immediately after transmitting the feature signal, allowing the device to return to card emulation mode in the shortest possible time.

[0110] Based on some embodiments of this specification, since the near-field communication device switches back to card emulation mode in a timely manner after sending the characteristic signal, the device can establish a correct card reader-card emulation communication relationship with the terminal device in card emulation mode after the terminal device switches to card reader mode, thereby completing subsequent near-field communication interactions; the near-field communication device in card emulation mode can passively respond to the card reading request of the terminal device and return tag information without actively initiating communication, which matches the current working state of the terminal device in card reader mode.

[0111] In one or more embodiments of this specification, the near-field communication device switches to card reader mode and sends a feature signal, specifically including: sending the feature signal within a first preset time period after the near-field communication device switches to card reader mode; after sending the feature signal, the near-field communication device switches to card emulation mode, specifically including: switching the near-field communication device to card emulation mode within a second preset time period after the feature signal is sent.

[0112] The first preset duration refers to the time window from the moment the near-field communication device switches to reader mode to the moment it begins sending the feature signal. This first preset duration can be a relatively short period of time, such as a few milliseconds or less, so that the feature signal can be sent in a timely manner after the device switches to reader mode, avoiding the device remaining in reader mode for an extended period of time.

[0113] The second preset duration refers to the time window from the moment the feature signal is sent to the moment the near-field communication device switches back to card emulation mode. This second preset duration can also be a relatively short period of time, allowing the device to quickly return to card emulation mode after sending the feature signal.

[0114] In some embodiments, after switching to reader mode, the near-field communication device can immediately send a feature signal (i.e., within a first preset time period, which can approach zero), and immediately switch back to card emulation mode after the feature signal is sent (i.e., within a second preset time period, which can also approach zero). In other words, the near-field communication device only performs the operation of sending a feature signal in reader mode, and switches back to card emulation mode without performing any other near-field communication operations after sending. This "send and switch back" operation mode limits the time the device spends in reader mode to the shortest time required to send the feature signal.

[0115] Based on some embodiments of this specification, since the near-field communication device sends a characteristic signal within a first preset time period after switching to card reader mode, and switches back to card emulation mode within a second preset time period after the transmission is completed, the dwell time of the device in card reader mode is limited to a short range. On the one hand, this reduces the power consumption of the device transmitting radio frequency signals in card reader mode, and on the other hand, it reduces the potential interference that the device may cause to other near-field communication devices in the environment in card reader mode. At the same time, the quick switch back to card emulation mode also allows the device to enter a state that can be read by the terminal device as soon as possible, which helps to shorten the overall interaction time.

[0116] In one or more embodiments of this specification, when the near-field communication device is in card emulation mode, before detecting whether a terminal device has entered a preset proximity range via the proximity sensor, the initial state of the near-field communication device is card emulation mode. That is, the near-field communication device defaults to card emulation mode after power-on and begins to perform the operation of detecting whether a terminal device has entered the preset proximity range via the proximity sensor in this state. With card emulation mode as the initial state, the device can passively respond when an external card reader approaches, or actively wake up a terminal device that is in a silent state when it approaches, thus flexibly adapting to different interaction scenarios.

[0117] The initial state of the near-field communication device is card emulation mode, meaning that when the device is not triggered to perform any near-field communication operation, its near-field communication module is in card emulation mode and does not actively transmit radio frequency signals. This initial state setting helps reduce the power consumption of the device in standby mode, because in card emulation mode the device does not need to continuously transmit radio frequency carrier signals, but only needs to keep the proximity sensor working.

[0118] Based on some embodiments of this specification, since the initial state of the near-field communication device is card emulation mode, the device maintains a low-power standby state when not triggered, without the need to continuously transmit radio frequency signals, which helps to reduce the standby power consumption of the device; at the same time, the card emulation mode as the initial state also enables the device to be compatible with interaction with external card readers, and the device can passively respond when these external card readers actively initiate card reading operations.

[0119] In one or more embodiments of this specification, after detecting whether a card reader signal is received from the terminal device, the method further includes: if the card reader signal is received, maintaining the card emulation mode of the near-field communication device to perform near-field communication with the terminal device.

[0120] Specifically, when a near-field communication (NFC) device detects a card reader signal from a terminal device within a time window, it indicates that the terminal device is currently in card reader mode and actively transmitting a card reader signal. This means that the terminal device has already initiated NFC communication. In this case, the NFC device does not need to send a feature signal to wake up the terminal device; it only needs to maintain the current card emulation mode, wait for the terminal device to send a card reader request signal, and passively respond.

[0121] This approach enables near-field communication (NFC) devices to operate in scenarios where the terminal device is in a screen-on, unlocked state and the card reader function is activated. In these scenarios, the terminal device itself actively transmits card reader signals, and the NFC device can interact normally with it while maintaining card emulation mode, without needing to perform additional mode switching or signal transmission operations. In other words, the NFC device can adaptively choose the interaction path based on whether it receives the terminal device's card reader signal: if a card reader signal is received, it follows the "maintain card emulation mode" path; otherwise, it follows the "send a feature signal to wake up the terminal device" path.

[0122] Based on some embodiments of this specification, since the near-field communication device maintains card emulation mode and does not send a feature signal when it detects a card reader signal from the terminal device, it avoids signal conflicts or terminal malfunctions that may be caused by repeatedly sending a wake-up signal when the terminal device is already in card reader mode, thus ensuring compatibility with the existing interaction methods of the terminal device. By adopting different processing paths for the two scenarios of "receiving a card reader signal" and "not receiving a card reader signal", the near-field communication device can adaptively select the interaction method according to the actual working state of the terminal device, thereby achieving compatibility with different working states of the terminal device.

[0123] In one or more embodiments of this specification, the near-field communication with the terminal device includes: receiving a card reading request signal sent by the terminal device in card reader mode; and sending tag information to the terminal device in response to the card reading request signal.

[0124] Specifically, after the terminal device switches to reader mode based on a characteristic signal, the terminal device, acting as a reader, can actively transmit radio frequency signals, including a card read request signal for requesting the reading of tag information. Upon receiving this card read request signal in card emulation mode, the near-field communication (NFC) device can determine its stored tag information and return it to the terminal device. This tag information may include various data stored in the NFC device, such as identity information, payment-related information, access control credential information, and Uniform Resource Locators (URLs). The NFC device can return the tag information in accordance with the NFC standard's provisions for data return in card emulation mode, for example, by modulating the tag information into a reflected signal using load modulation and returning it to the terminal device.

[0125] In some embodiments of this specification, the near-field communication device can enter a waiting-to-be-read state after sending a feature signal and switching back to card emulation mode. At this time, the terminal device has switched to card reader mode and can send card search signals, card reading request signals, etc., according to the card reading process of the near-field communication standard. The near-field communication device responds sequentially to complete the transmission of tag information.

[0126] Based on some embodiments of this specification, since the near-field communication device responds to the terminal device's card reading request signal and returns tag information in card emulation mode, the terminal device can complete the reading of tag information according to the standard near-field communication card reading process after switching to card reader mode; the return of tag information is completed passively in card emulation mode, which matches the interaction mode of the terminal device actively reading tags as a card reader, thus realizing smooth near-field communication between the two.

[0127] In one or more embodiments of this specification, the tag information is used to invoke an application on the terminal device. Invocation may refer to the terminal device, upon receiving the tag information, launching the corresponding application based on the identifier carried in the tag information (such as an application identifier, a Uniform Resource Locator, a custom Uniform Resource Identifier, etc.), or switching an already running application to the foreground and opening a specified page.

[0128] For example, in a near-field communication (NFC) payment scenario, NFC devices can be deployed at the merchant's checkout counter. When a user brings their terminal device (e.g., a smartphone) close to the NFC device, the device switches from card emulation mode to reader mode and reads the tag information returned by the NFC device. This tag information may contain a Uniform Resource Locator (URL) used to launch the payment application. The terminal device uses this URL to launch the payment application and open a payment page or payment confirmation page, where the user can enter the amount or directly click confirm to complete a transaction.

[0129] In other embodiments, the tag information can also be used for other purposes. For example, in an access control scenario, the tag information can be used to invoke an access control application and transmit an access control identifier, allowing the terminal device to complete access control authorization verification and door opening operations through the application. As another example, in a data exchange scenario, the tag information can be used to invoke a data sharing application and transmit a data retrieval address. Those skilled in the art can flexibly configure the specific content and purpose of the tag information according to actual business needs; this specification does not limit this.

[0130] Based on some embodiments of this specification, since the tag information can be used to activate the application on the terminal device, the terminal device can directly jump to the specified page of the application after completing near-field communication. Users do not need to manually open the application or scan the QR code, which reduces user operation steps and improves business execution efficiency. The specific content of the tag information can be flexibly configured according to different business scenarios, so that the solution can be applied to various application scenarios such as payment, access control, and data exchange.

[0131] While one or more embodiments of this specification provide method steps as described in the embodiments or flowcharts, it is understood that the order of steps listed in the embodiments or flowcharts is merely one possible execution order among many steps and does not represent the only possible execution order. The order of some steps may be adjusted according to actual needs, or some steps may be omitted. When the claims involve method steps, changes in the order of such steps, or parallel execution between steps, are also within the scope of protection of the claims.

[0132] Figure 2The method described above involves a near-field communication (NFC) device in card emulation mode determining whether a terminal device has entered a preset proximity range through proximity sensing. The device then checks whether it receives a reader signal from the terminal device. If no signal is received, it indicates that the terminal device is not actively operating as a reader. The device then switches to reader mode and sends a characteristic signal to instruct the terminal device to switch to reader mode. After sending the signal, it switches back to card emulation mode to continue NFC communication with the terminal device. Based on this scheme, since the device only triggers subsequent detection and signal transmission processes after confirming that the terminal device has entered the preset proximity range, it avoids the power consumption overhead caused by the device continuously transmitting radio frequency signals. By detecting whether the terminal device is actively transmitting a reader signal before sending the characteristic signal to wake up the terminal device, it can adaptively determine whether to initiate a wake-up interaction based on the actual operating state of the terminal device. The device actively sends a feature signal only when the terminal device is in a silent state. This avoids radio frequency conflicts with terminal devices that are actively reading cards (if the terminal device is already in card reader mode and actively transmitting a card reader signal, the device can maintain card emulation mode for normal interaction without sending an additional signal). It also avoids signal conflicts or terminal malfunctions that may be caused by repeatedly sending wake-up signals to terminal devices that are already in card reader mode. At the same time, the device switches back to card emulation mode in a timely manner after sending the feature signal, ensuring that the correct card reader-card emulation communication relationship can be established between the device as the reader and the terminal device that has switched to card reader mode in subsequent near-field communication. This allows near-field communication interaction to be completed with the device regardless of the original working state of the terminal device, thereby improving the compatibility of near-field communication devices with different terminal device working states and the success rate of interaction.

[0133] In some embodiments of this specification, the above solution can also reduce the probability of the terminal device popping up the wallet due to receiving a radio frequency signal. In the application scenario of this application, the near-field communication device is in card emulation mode by default. The desired interaction method is for the terminal device to switch to card reader mode to read the tag information in the near-field communication device, rather than the terminal device popping up the wallet selection interface due to the detection of a radio frequency signal—popping up the wallet would interrupt the user's operation process and add unnecessary interaction steps. Specifically, the near-field communication device does not immediately send a feature signal after detecting that the terminal device has entered the preset proximity range. Instead, it first detects whether the terminal device is actively transmitting a card reader signal. It only sends a feature signal when no card reader signal is detected (i.e., the terminal device is in a silent state, such as when the screen is off or in card emulation mode). If the terminal device is in a screen-on unlocked state, its card reader function is usually active and actively transmitting a card reader signal. At this time, after the near-field communication device detects the card reader signal, it remains in card emulation mode and does not send a feature signal, thus not triggering the terminal device to pop up the wallet interface. If the terminal device is in a silent state, such as screen-off or card emulation mode, it does not actively transmit card reader signals. In this case, although the near-field communication (NFC) device sends a characteristic signal, the terminal device, upon detecting this signal, recognizes it as a mode switching command according to a preset protocol and switches to card reader mode, rather than recognizing it as a standard polling signal. Therefore, the wallet interface will not pop up. It is through this "detect first, then send" mechanism that the NFC device only sends the characteristic signal when the terminal device is in a silent state where receiving signals will not cause the wallet to pop up. This reduces the probability of the terminal device popping up the wallet while achieving the desired interaction method, minimizing unnecessary interruptions to the user's operation.

[0134] The various technical features in the above embodiments can be combined arbitrarily, as long as there is no conflict or contradiction between the combinations of features. However, due to space limitations, they have not been described one by one. Therefore, the arbitrary combination of various technical features in the above embodiments is also within the scope of this specification.

[0135] Based on the same idea, corresponding to the above-mentioned method on the near-field communication device side, the embodiments of this specification also provide a near-field communication method for a user-used terminal device.

[0136] Figure 3 This is a flowchart illustrating a near-field communication method applied to a terminal device, provided as an embodiment of this specification.

[0137] From a programming perspective, the entity executing the process can be a program mounted on a terminal device. It can be understood that this method can be executed by any device, equipment, platform, or cluster of devices with computing and processing capabilities.

[0138] like Figure 3As shown, this process, applied to near-field communication devices, may include the following steps: Step 302: When the terminal device is in card emulation mode, receive the characteristic signal sent by the near field communication device; Step 304: In response to receiving the feature signal, the terminal device switches from card emulation mode to card reader mode; Step 306: In the card reader mode, send a card reader signal to the near-field communication device to read the tag information in the near-field communication device.

[0139] In some embodiments of this specification, the terminal device may support card emulation mode and card reader mode. The terminal device may include, but is not limited to, portable or wearable mobile communication terminals such as smartphones, tablets, smartwatches, smart rings, and smart bracelets. Card emulation mode refers to the terminal device emulating a contactless smart card and passively responding to an external card reader; card reader mode refers to the terminal device actively transmitting radio frequency carrier signals to read information from nearby NFC tags or cards.

[0140] In card emulation mode, the terminal device can receive characteristic signals sent by near-field communication (NFC) devices. These characteristic signals can be radio frequency (RF) signals in the NFC frequency band and may possess specific physical characteristics (such as pulse width, pulse interval, and pulse count), as described above. The terminal device receives these characteristic signals through the antenna of its NFC module and transmits them to its processor or NFC driver module for processing.

[0141] Upon receiving the characteristic signal, the terminal device can switch from card emulation mode to card reader mode. Specifically, the terminal device can identify the received characteristic signal, determine the operation indicated by the characteristic signal (e.g., switching to card reader mode) based on the identification result, and then execute the corresponding mode switch. This identification and switching process can be completed at the terminal device's operating system driver layer without waking up the upper-layer application or requiring manual user intervention.

[0142] After switching to reader mode, the terminal device can send a reader signal to the near-field communication (NFC) device to read tag information from the NFC device. The reader signal may include signals specified in the NFC standard, such as card search signals and card read request signals. Upon receiving the reader signal in card emulation mode, the NFC device can return the stored tag information. The terminal device can then read this tag information and perform corresponding business operations accordingly.

[0143] Based on some embodiments of this specification, since the terminal device actively switches to card reader mode after receiving a feature signal in card emulation mode, the terminal device, which was originally in a passive waiting state, can be woken up by the near-field communication device and switched to become the active card reader. Thus, near-field communication can still be completed even when the terminal device itself does not actively transmit card reader signals. The identification and switching of feature signals by the terminal device can be completed at the driver layer without user intervention and without affecting the user's normal use of the terminal device.

[0144] In one or more embodiments of this specification, the terminal device can receive characteristic signals sent by a near-field communication device when it is in card emulation mode and in a screen-off state. The screen-off state refers to the terminal device's screen being off. In this state, the terminal device typically disables the card reader function to reduce power consumption, and its near-field communication module can retain only card emulation mode to passively respond to external card readers. Therefore, the terminal device in the screen-off state is usually in card emulation mode and does not actively transmit card reader signals, which is a typical accompanying scenario of the aforementioned silent state.

[0145] After receiving a characteristic signal while the terminal device is in screen-off mode, it can switch from card emulation mode to card reader mode while the screen remains off, and then complete the subsequent card reading operation. Throughout the entire process, the terminal device's screen can remain off, enabling near-field communication interaction in card reader mode without needing to be turned on.

[0146] In some embodiments, after the terminal device switches from card emulation mode to card reader mode while in a screen-off state, its screen may remain off until tag information is read, at which point the screen will be turned on based on the content of the tag information (such as services requiring user confirmation). In other embodiments, the terminal device may also turn on the screen while switching to card reader mode to indicate to the user that a near-field communication operation is currently being performed. This specification does not limit this.

[0147] Based on some embodiments of this specification, since the terminal device can receive characteristic signals and switch to card reader mode when it is in card emulation mode and screen off, the terminal device can respond to the wake-up of the near-field communication device without turning on the screen, thus completing the functional expansion of near-field communication while maintaining low power consumption. The wake-up and switching process in screen off mode does not require manual operation by the user. The user can complete the interaction by bringing the terminal device close to the near-field communication device, without having to pay attention to the current screen state of the terminal device.

[0148] In one or more embodiments of this specification, the feature signal may be generated based on a preset protocol between the near-field communication device and the terminal device; the preset protocol refers to the communication rules agreed upon in advance between the near-field communication device and the terminal device, which can be used to define the correspondence between the physical characteristics of the feature signal and the mode switching instructions of the terminal device.

[0149] For example, a preset protocol can specify that a characteristic signal with a specific combination of pulse width, pulse interval, and pulse number corresponds to the instruction to "switch to reader mode". The near-field communication device generates and sends the characteristic signal according to the preset protocol, and the terminal device receives and identifies the characteristic signal according to the same preset protocol, thereby parsing the meaning of the instruction carried by the characteristic signal.

[0150] The preset protocol can be pre-configured when the near-field communication device leaves the factory, or it can be configured through subsequent firmware upgrades or software updates. In some embodiments, the preset protocol can be determined through negotiation between the near-field communication device service provider and the terminal device manufacturer, and supported in the terminal device's operating system driver layer or near-field communication module.

[0151] In response to receiving a characteristic signal, the terminal device can identify the characteristic signal. Identifying the characteristic signal may include: identifying the physical characteristics of the characteristic signal, and determining the corresponding mode switching command based on the correspondence between the physical characteristics and a preset protocol. The physical characteristics may include at least one of the pulse width, pulse interval, and pulse count of the characteristic signal, or a combination of multiple characteristics. For example, after receiving a radio frequency signal, the near-field communication driver layer of the terminal device can detect whether the carrier frequency of the signal is in the near-field communication band. If it is in the near-field communication band, it further detects the pulse pattern of the signal (including pulse width, pulse interval, pulse count, etc.) and compares the detected pulse pattern with the physical characteristics defined in the preset protocol. If they match, the signal is determined to be a characteristic signal, and the corresponding mode switching command is obtained. The terminal device can switch from card emulation mode to card reader mode according to the mode switching command.

[0152] Upon receiving the characteristic signal, the terminal device can perform the aforementioned identification and switching operations before the card packet is displayed. Specifically, because the characteristic signal uses a non-standard pulse pattern, it has physically identifiable differences from the device detection signal pattern specified in the near-field communication standard (e.g., different pulse widths and / or pulse intervals and / or pulse numbers). When the near-field communication driver layer of the terminal device detects this signal, it can first determine whether it is a characteristic signal. If so, it directly performs mode switching without triggering the card packet selection process. In this way, the terminal device can complete the mode switching before the system displays the card packet interface, avoiding interruption of the user's operation process by the card packet display.

[0153] In some embodiments, the terminal device can identify feature signals through the operating system driver layer, that is, implement the detection, identification, and mode switching logic of feature signals in the low-level driver of the operating system. Since the driver layer is located at a lower level of the operating system, its response speed to radio frequency signals is usually faster than that of upper-level applications, and it can complete the identification and processing of feature signals before the system pulls up the card.

[0154] In some embodiments of this specification, after switching to reader mode, the terminal device can send a reader signal to the near-field communication device and receive tag information returned by the near-field communication device. The tag information may include a Uniform Resource Locator (URL), an application identifier, or other information used to invoke the application. The terminal device can perform a target service based on this tag information. For example, in a near-field payment scenario, the tag information read by the terminal device may contain a URL for invoking the payment application. The terminal device uses this URL to invoke the payment application and open a payment page or payment confirmation page, where the user can enter the amount or directly click confirm to complete a transaction. As another example, in an access control scenario, the tag information may contain an identifier for invoking the access control application. The terminal device uses this identifier to invoke the access control application and complete access control authorization verification and door opening operations.

[0155] Based on some embodiments of this specification, since the feature signals are generated based on a preset protocol, the terminal device can determine the corresponding mode switching command by recognizing the physical characteristics of the feature signals, without the need for complex protocol stack parsing of the signals, thus reducing the processing overhead required for the terminal device to recognize feature signals. Since the correspondence between the physical characteristics of the feature signals and the mode switching commands is predefined by the preset protocol, a lightweight interaction mechanism can be formed between the near-field communication device and the terminal device, allowing the terminal device to complete the recognition and response to feature signals at the driver layer. The terminal device performs recognition and switching before the card packet is raised, completing the mode switching before the system triggers the card packet selection process, avoiding interruption of the user's operation process by the card packet pop-up. The tag information contains a Uniform Resource Locator or other information that triggers the application, enabling the terminal device to directly jump to the specified page of the application after reading the tag information, eliminating the need for the user to manually open the application or scan a QR code, reducing user operation steps and improving business execution efficiency.

[0156] Figure 4 This diagram illustrates the near-field communication interaction process between a near-field communication terminal and a user terminal device in a practical application scenario provided by an embodiment of this specification.

[0157] like Figure 4As shown, this method can be applied to a near-field communication (NFC) system, which may include an NFC device and a terminal device. The NFC device can operate by default in card emulation mode (PICC mode) and continuously send detection signals through its proximity sensor (e.g., a ToF sensor, i.e., a time-of-flight sensor) to detect the presence of a terminal device. The detection signal can be a non-NFC signal, such as an infrared light signal or an ultrasonic signal. The terminal device can operate by default in card emulation mode when the screen is off, capable of receiving signals from an external card reader, but its card reader function can be disabled for power consumption considerations.

[0158] When a user brings their terminal device close to the near-field communication (NFC) device, the NFC device detects this proximity event using its proximity sensor. In response to this detection, the NFC device can initiate a timer and simultaneously probe for a reader signal from the terminal device via the coil (i.e., antenna) of its NFC module. This detection can occur within a time window. The time window can be preset, starting from the moment the proximity event is detected, and its duration can be pre-defined, for example, 350 milliseconds or 500 milliseconds.

[0159] If the terminal device is in an unlocked state (e.g., screen is on and unlocked, or some models transmit a card reader signal as soon as the screen is on), its card reader function can be activated and it can transmit a card reader signal (e.g., a detection signal in low-power card detection mode). If the near-field communication device detects the card reader signal emitted by the terminal device through its coil within the time window, it determines that the terminal device is currently in card reader mode. At this time, the near-field communication device does not perform subsequent mode switching operations, but continues to maintain card emulation mode and directly interacts with the terminal device in card reader mode for near-field communication.

[0160] If the terminal device is in a screen-off state, its card reader function can be disabled, and it will not emit a card reader signal. If the near-field communication device does not detect a card reader signal emitted by the terminal device through the coil within the time window, it determines that the terminal device is currently in a silent state (e.g., screen off and in card emulation mode). In response to this determination, the near-field communication device can switch to card reader mode (PCD mode) and send regular radio frequency carrier signals, i.e., the aforementioned characteristic signals. For example, the near-field communication device can send 1 to 4 regular low-power card detection mode signals, each signal having a duration of 25 to 35 microseconds, and the interval between two adjacent signals having a duration of 10 to 30 milliseconds.

[0161] After a terminal device in card emulation mode detects a regular radio frequency carrier signal sent by a near-field communication (NFC) device via the coil of its NFC module, it can identify the signal (e.g., by identifying its physical characteristics according to a preset protocol), determine the presence of a NFC device nearby, and switch from card emulation mode to reader mode in screen-off mode. After transmitting the regular radio frequency carrier signal, the NFC device can switch back to card emulation mode. Subsequently, the terminal device, now in reader mode, can send a reader signal to interact with the NFC device in card emulation mode, such as reading tag information from the NFC device.

[0162] In the above process, setting a time window to detect whether the terminal device actively transmits a card reader signal can prevent the near-field communication device from mistakenly sending an RF carrier signal when the terminal device is already in card reader mode. If the device directly sends an RF carrier signal by default, some terminal devices (especially Android devices) may pop up a wallet selection interface (such as the default NFC wallet, transportation card, access card, etc.) after receiving the RF field signal, thus interrupting the user's operation. In this solution, the near-field communication device only sends an RF carrier signal when it confirms that the terminal device has not actively transmitted a card reader signal (i.e., it is in a silent state), thereby reducing the probability that the terminal device will pop up a wallet due to receiving an RF field signal. At the same time, through the linkage between the near-field communication device and the terminal device, the terminal device can complete near-field communication interaction with the near-field communication device through card reader mode, whether in the unlocked state or the screen-off state, thereby improving the user's near-field communication experience in different usage scenarios.

[0163] Furthermore, in some embodiments of this specification, after the near-field communication device detects the proximity of the terminal device through the proximity sensor, it will detect whether it receives a card reader signal from the terminal device through the coil of its near-field communication module within a time window. The card reader signal may include the LPCD signal emitted by the terminal device in low-power card detection mode.

[0164] If an LPCD signal is detected from the terminal device within the specified time window, it indicates that the terminal device is currently in reader mode (e.g., the terminal device is in a screen-on unlocked state), and its low-power card detection function is activated, periodically emitting LPCD detection signals. In this case, the near-field communication device can determine that the terminal device has actively acted as a card reader, without needing to send a feature signal to wake up the terminal device. Therefore, the near-field communication device can maintain card emulation mode and directly interact with the terminal device's reader mode—the terminal device, acting as a card reader, sends a card reading request signal, and the near-field communication device, acting as the read card, returns the stored tag information.

[0165] In some embodiments, if an LPCD signal emitted by a terminal device is detected within the time window, the near-field communication device can also adjust its own operating parameters according to the characteristics of the LPCD signal, such as the intensity and frequency, for example, adjusting the response sensitivity or transmission power in card emulation mode to optimize the communication quality with the terminal device.

[0166] In some embodiments, if an LPCD signal emitted by the terminal device is detected within the time window, but no complete card reading request is subsequently received from the terminal device (e.g., the terminal device only emits a detection signal in LPCD mode without entering standard card detection mode), the near-field communication device can send an excitation signal to prompt the terminal device to switch from low-power card detection mode to standard card detection mode, thereby establishing a complete near-field communication connection. This excitation signal can be a radio frequency carrier signal with a specific pattern, used to instruct the terminal device to exit low-power card detection mode and enter standard card detection mode. After receiving this excitation signal, the terminal device can switch from LPCD mode to standard card detection mode, interacting with the near-field communication device with higher transmission power and a more complete protocol flow.

[0167] In this way, the solution can adaptively select different interaction paths within the time window based on whether the LPCD signal of the terminal device is detected. When the LPCD signal is detected, it maintains the card emulation mode for direct interaction or sends an excitation signal to prompt it to enter the standard card detection mode. When the LPCD signal is not detected, it sends a feature signal to wake up the terminal device and switch to the card reader mode, thereby achieving compatibility with different working states of the terminal device.

[0168] Figure 5 A timing diagram of a near-field communication method provided in an embodiment of this specification is shown.

[0169] like Figure 5 As shown, the timing diagram may include the operation timing of the near field communication device side (e.g., NFC tag device) and the state changes of the terminal device side (e.g., mobile phone).

[0170] In its initial state, near-field communication devices can continuously send detection signals (such as infrared light signals) through their proximity sensors (such as ToF sensors) to detect whether a terminal device is approaching. When the terminal device is in screen-off mode, it can default to operating in PICC mode.

[0171] At time t1, the terminal device enters the detection range of the proximity sensor of the near-field communication device. The proximity sensor detects the proximity event of the terminal device. At this time, the terminal device is still in a screen-off state and is operating in card emulation mode.

[0172] In response to the detection of a proximity event of a terminal device, the near-field communication (NFC) device initiates a time window T3, which begins timing from the moment the proximity event is detected. Within this time window (e.g., T3 = 350 milliseconds, 500 milliseconds, etc.), the NFC device uses the coil (i.e., antenna) of its NFC module to detect whether it receives a card reader signal (e.g., a detection signal in low-power card detection mode) from the terminal device. The duration of the time window T3 can be preset, and its value can be adjusted according to the actual application scenario, such as 350 milliseconds, 500 milliseconds, etc.

[0173] If the near-field communication device does not detect a card reader signal from the terminal device within the time window T3, it is determined that the terminal device is currently in a screen-off state and its card reader function is disabled. In response to this determination, the near-field communication device can switch to card reader mode and send a regular radio frequency carrier signal (i.e., a characteristic signal). The regular radio frequency carrier signal may include one or more pulses. Figure 5 As shown, the duration of each pulse can be T1 (e.g., 25 microseconds, 35 microseconds, etc.). When multiple pulses are included, the time interval between two adjacent pulses can be T2 (e.g., 10 milliseconds, 30 milliseconds, etc.). After transmitting the regular radio frequency carrier signal, the near-field communication device can switch back to card emulation mode.

[0174] After receiving the regular radio frequency carrier signal through the coil of its near-field communication module in card emulation mode, the terminal device can identify the physical characteristics of the signal and determine the corresponding mode switching command according to a preset protocol. In response to the mode switching command, the terminal device switches from card emulation mode to card reader mode in the screen-off state and can send a card reader signal to read the tag information in the near-field communication device.

[0175] In the above timing sequence, the duration of time window T3 determines the length of time the near-field communication device waits to detect the reader signal after detecting the proximity of the terminal device. This duration needs to be long enough to cover the reader signals that the terminal device may emit (e.g., the detection signals periodically emitted by the terminal device in time-division multiplexing mode), thus ensuring that the reader signal of the terminal device is not missed due to an excessively short time window; at the same time, this duration can also be set to an appropriate value according to the actual scenario requirements to avoid the waiting time being too long and affecting the timeliness of the interaction.

[0176] Based on some embodiments of this specification, in the above timing process, since the near-field communication device does not immediately send an RF carrier signal after detecting the proximity of the terminal device, but first detects whether the terminal device has transmitted a card reader signal within the time window T3, and only sends an RF carrier signal when no card reader signal is detected, the problem of card ejection or RF conflict that may be caused by the device directly sending an RF signal when the terminal device is already in card reader mode can be avoided. At the same time, by setting an appropriate duration for the time window T3, the reliability of the detection of the terminal device's card reader signal and the timeliness of the interaction can be taken into account.

[0177] Additionally, it should be noted that in the embodiments of this specification, the characteristic signal sent by the near-field communication device can be physically manifested as a radio frequency carrier pulse similar to the LPCD (Low Power Card Detection) signal, but the technical purpose and signal design considerations are different from those of the LPCD (Low Power Card Detection) signal.

[0178] LPCD signals are detection signals periodically emitted by terminal devices (such as mobile phones) in low-power card detection mode. Their purpose is to detect the presence of nearby NFC tags or cards with a low duty cycle, thereby reducing device power consumption. The pulse width and interval of the LPCD signal are typically determined by the terminal device manufacturer based on its power management strategy.

[0179] In the embodiments of this specification, the technical purpose of the characteristic signal sent by the near-field communication device is to transmit a mode switching instruction to the terminal device in card emulation mode, instructing the terminal device to switch from card emulation mode to card reader mode. To achieve this purpose, the characteristic signal can be generated based on a preset protocol between the near-field communication device and the terminal device. This preset protocol defines the correspondence between the physical characteristics of the characteristic signal (such as pulse width, pulse interval, pulse number, etc.) and the mode switching instruction. Therefore, although the characteristic signal can be represented as a radio frequency carrier pulse at the physical layer, its signal pattern (such as pulse width, interval, and number) is specially designed and may differ from the pattern of the LPCD signal transmitted by the terminal device in low-power card detection mode, so that the terminal device can distinguish it from ordinary LPCD signals or standard polling signals.

[0180] Based on the same idea, this specification also provides devices corresponding to the above methods in its embodiments.

[0181] Figure 6 The embodiments provided in this specification correspond to Figure 2 A schematic diagram of the structure of a near-field communication device.

[0182] like Figure 6 As shown, the near-field communication device may include: Proximity sensor 602 is used to determine whether a terminal device has entered a preset proximity range; The 604 near-field communication module supports card emulation mode and card reader mode; Controller 606, connected to both the proximity sensor and the near-field communication module, is used for: When the near-field communication module is in card emulation mode, in response to the proximity sensor determining that a terminal device has entered the preset proximity range, the near-field communication module detects whether it receives a card reader signal from the terminal device. If the card reader signal is not received, the near-field communication module is controlled to switch to card reader mode and send a feature signal, which is used to instruct the terminal device to switch to card reader mode; After sending the characteristic signal, the near-field communication module is controlled to switch to card emulation mode to perform near-field communication with the terminal device.

[0183] based on Figure 6 The embodiments of this specification also provide some specific implementation schemes for the device, which will be described below.

[0184] Optionally, the proximity sensor includes a distance sensor.

[0185] Optionally, the distance sensor includes a time-of-flight sensor.

[0186] Optionally, the time-of-flight sensor includes a transmitter and a receiver; the transmitter is used to transmit a probe wave, and the receiver is used to receive a reflected wave reflected by the terminal device; the controller is also used to calculate the distance between the terminal device and the near-field communication device based on the time difference between the transmission time of the probe wave and the reception time of the reflected wave, and to determine whether the terminal device has entered the preset proximity range based on the distance.

[0187] Optionally, the near-field communication module includes a single NFC chip with card reader and card emulation functions.

[0188] Optionally, the near-field communication module includes a first NFC chip with card reader functionality and a second NFC chip with card emulation functionality; the first NFC chip is in the on state by default, and the second NFC chip is in the off state by default.

[0189] Optionally, the controller controls the near-field communication module to switch to reader mode and send the feature signal by turning on the second NFC chip; after sending the feature signal, it controls the near-field communication module to switch to card emulation mode by turning off the second NFC chip.

[0190] Optionally, in response to the proximity sensor determining that a terminal device has entered the preset proximity range, the controller starts a time window timing and detects within the time window whether the near-field communication module receives a card reader signal from the terminal device.

[0191] Optionally, the duration of the time window is greater than or equal to the complete transmission cycle of the terminal device sending one card reader signal.

[0192] Optionally, the controller controls the near-field communication module to send the feature signal within a first preset time period after the near-field communication module switches to card reader mode; and controls the near-field communication module to switch to card emulation mode within a second preset time period after the feature signal is sent.

[0193] Optionally, if the controller does not receive the card reader signal, it determines that the terminal device is in a silent state, the silent state representing the working state of the terminal device not actively sending the card reader signal, and in response to determining that the terminal device is in the silent state, it controls the near-field communication module to switch to card reader mode and send the feature signal.

[0194] Optionally, the silent state includes the state in which the terminal device is in card emulation mode.

[0195] Optionally, the characteristic signal is a radio frequency carrier signal in the near-field communication band.

[0196] Optionally, the characteristic signal is a radio frequency carrier signal with a preset pulse pattern in the near-field communication frequency band; the preset pulse pattern is a non-standard pulse pattern, and the non-standard pulse pattern has a different pulse width and / or pulse interval than the device detection signal pattern specified in the near-field communication standard.

[0197] Optionally, the feature signal is generated based on a preset protocol between the near-field communication device and the terminal device; the preset protocol is used to define the correspondence between the physical characteristics of the feature signal and the mode switching command.

[0198] Optionally, the physical characteristics include at least one of the pulse width, pulse interval, and number of pulses of the characteristic signal.

[0199] Optionally, the characteristic signal is an unmodulated carrier signal.

[0200] Optionally, after sending the feature signal, the near-field communication device switches to card emulation mode. The near-field communication module is also used to receive a card reading request signal sent by the terminal device in card reader mode, and to send tag information to the terminal device in response to the card reading request signal.

[0201] Optionally, the tag information is used to invoke an application on the terminal device.

[0202] It is understood that the modules mentioned above refer to computer programs or program segments used to perform one or more specific functions. Furthermore, the distinction between these modules does not imply that the actual program code must also be separate.

[0203] For ease of description, the above devices are described by function as various modules or devices. Of course, when implementing one or more of these specifications, the functions of each module or device can be implemented in the same or different software and / or hardware, or a module or device that performs the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are merely illustrative. For example, the division of modules or devices is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0204] The above is an illustrative scheme of a near-field communication device according to this embodiment. It should be noted that the technical solution of this near-field communication device and the technical solution of the near-field communication method applied to the near-field communication device described above belong to the same concept. For details not described in detail in the technical solution of the near-field communication device, please refer to the description of the technical solution of the near-field communication method applied to the near-field communication device described above.

[0205] Based on the same idea, this specification also provides devices corresponding to the above methods in its embodiments.

[0206] Figure 7 The embodiments provided in this specification correspond to Figure 3 A schematic diagram of the structure of a near-field communication device.

[0207] like Figure 7 As shown, the terminal device may include: The near-field communication module 702 supports card emulation mode and card reader mode; The processor 704, connected to the near-field communication module, is configured to: receive a feature signal sent by a near-field communication device through the near-field communication module when the near-field communication module is in card emulation mode; identify the feature signal in response to receiving the feature signal; control the near-field communication module to switch from card emulation mode to card reader mode based on the identification result; and control the near-field communication module to send a card reader signal to the near-field communication device in card reader mode to read tag information in the near-field communication device.

[0208] based on Figure 7The embodiments of this specification also provide some specific implementation schemes for the device, which will be described below.

[0209] Optionally, the screen of the terminal device may be in a screen-off state when in card emulation mode, or it may be in a screen-on state.

[0210] Optionally, the feature signal is generated based on a preset protocol between the near-field communication device and the terminal device; the preset protocol is used to define the correspondence between the physical characteristics of the feature signal and the mode switching command.

[0211] Optionally, the processor identifies the feature signal by: identifying the physical characteristics of the feature signal; and determining the mode switching instruction corresponding to the feature signal based on the correspondence between the physical characteristics and the preset protocol.

[0212] Optionally, the physical characteristics include at least one of the pulse width, pulse interval, and number of pulses of the characteristic signal.

[0213] Optionally, the characteristic signal is a radio frequency carrier signal with a preset pulse pattern in the near-field communication frequency band.

[0214] Optionally, the preset pulse pattern of the characteristic signal is a non-standard pulse pattern; the non-standard pulse pattern has a different pulse width and / or pulse interval than the device detection signal pattern specified in the near-field communication standard.

[0215] Optionally, the processor controls the near-field communication module to switch from card emulation mode to card reader mode according to the mode switching instruction.

[0216] Optionally, the terminal device identifies the feature signal through the operating system driver layer.

[0217] Optionally, after the near-field communication module receives the feature signal, the processor controls the near-field communication module to switch from card emulation mode to card reader mode before pulling up the card.

[0218] Optionally, the near-field communication module includes an NFC antenna and an NFC chip.

[0219] Optionally, after the near-field communication module sends the card reader signal to the near-field communication device in the card reader mode, it is also used to receive tag information returned by the near-field communication device; the processor is also used to execute the target service according to the tag information.

[0220] Optionally, the processor executes the target service based on the tag information, including: activating an application on the terminal device based on the tag information.

[0221] Optionally, the tag information includes a Uniform Resource Locator (URL); the processor opens a specified page in the application based on the URL.

[0222] It is understood that the modules mentioned above refer to computer programs or program segments used to perform one or more specific functions. Furthermore, the distinction between these modules does not imply that the actual program code must also be separate.

[0223] For ease of description, the above devices are described by function as various modules or devices. Of course, when implementing one or more of these specifications, the functions of each module or device can be implemented in the same or different software and / or hardware, or a module or device that performs the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are merely illustrative. For example, the division of modules or devices is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0224] The above is an illustrative scheme of a near-field communication device according to this embodiment. It should be noted that the technical solution of this near-field communication device belongs to the same concept as the technical solution of the near-field communication method applied to terminal devices described above. For details not described in detail in the technical solution of the near-field communication device, please refer to the description of the technical solution of the near-field communication method applied to terminal devices described above.

[0225] Based on the same idea, this specification also provides devices corresponding to the above methods in its embodiments.

[0226] Figure 8 A structural block diagram of a computing device 800 provided according to an embodiment of this specification is shown.

[0227] The computing device 800 includes: Memory 810 and processor 820; The memory 810 is used to store computer programs / instructions, and the processor 820 is used to execute the computer programs / instructions, which, when executed by the processor 820, implement the steps of the near-field communication method.

[0228] Specifically, the components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and the database 850 is used to store data.

[0229] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0230] In one embodiment of this specification, the above-described components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.

[0231] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 800 can also be a mobile or stationary server.

[0232] The near-field communication method is implemented when the processor 820 executes the computer instructions.

[0233] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the near-field communication method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the near-field communication method described above.

[0234] An embodiment of this specification also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the near-field communication method as described above.

[0235] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium belongs to the same concept as the technical solution of the near-field communication method described above. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the near-field communication method described above.

[0236] An embodiment of this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the near-field communication method described above.

[0237] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the above-described near-field communication method belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the above-described near-field communication method.

[0238] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device, medium, and product embodiments are basically similar to the method embodiments, so the descriptions are relatively simple, and relevant parts can be referred to the descriptions of the method embodiments. The devices, media, products, and methods provided in the embodiments of this specification correspond to each other; therefore, the devices, media, and products also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the corresponding devices, media, and products will not be repeated here.

[0239] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0240] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program a digital system themselves to "integrate" it onto a PLD, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using one of these hardware description languages ​​and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.

[0241] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0242] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0243] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0244] Those skilled in the art will understand that one or more embodiments of this specification can be provided as a method, system, or computer program product. Therefore, embodiments of this specification can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0245] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0246] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0247] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0248] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0249] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0250] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital character versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0251] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0252] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A near-field communication method, applied to a near-field communication device, the method comprising: When the near-field communication device is in card emulation mode, in response to determining that a terminal device has entered a preset proximity range, it detects whether it receives a card reader signal from the terminal device. If the card reader signal is not received, the near-field communication device switches to card reader mode and sends a feature signal; the feature signal is used to instruct the terminal device to switch to card reader mode. After sending the characteristic signal, the near-field communication device switches to card emulation mode to perform near-field communication with the terminal device.

2. The method as described in claim 1, wherein the step of detecting whether a card reader signal is received from the terminal device in response to determining that a terminal device has entered a preset proximity range includes: When the near-field communication device is in card emulation mode, the proximity sensor in the near-field communication device detects whether a terminal device has entered a preset proximity range. In response to the detection that a terminal device has entered the preset proximity range, the system detects whether it has received a card reader signal from the terminal device.

3. The method of claim 2, wherein, The proximity sensor includes a time-of-flight sensor; the step of detecting whether a terminal device has entered a preset proximity range using the proximity sensor in the near-field communication device includes: The time-of-flight sensor emits a probe wave and receives a reflected wave reflected by the terminal device; The distance between the terminal device and the near-field communication device is calculated based on the time difference between the transmission time of the probe wave and the reception time of the reflected wave. The distance determines whether the terminal device has entered the preset proximity range.

4. The method as described in claim 2, wherein the step of detecting whether a card reader signal is received from the terminal device in response to detecting that a terminal device has entered the preset proximity range includes: After detecting that the terminal device has entered the preset proximity range, a time window timing is started; Within the time window, it is detected whether a card reader signal from the terminal device is received.

5. The method as described in claim 4, wherein the duration of the time window is greater than or equal to the complete cycle of the terminal device sending one card reader signal.

6. The method as described in claim 1, wherein if the reader signal is not received, the near-field communication device switches to reader mode and sends a characteristic signal, comprising: If no signal is received from the card reader, the terminal device is determined to be in a silent state. The silent state indicates that the terminal device is not actively sending a card reader signal. In response to determining that the terminal device is in a silent state, the near-field communication device switches to reader mode and sends a feature signal.

7. The method of claim 6, wherein the silent state includes the terminal device being in card emulation mode; the feature signal is used to trigger the terminal device in card emulation mode to switch to card reader mode.

8. The method as described in claim 7, wherein the screen of the terminal device is in an off state.

9. The method of claim 1, wherein, The feature signal is generated based on a preset protocol between the near-field communication device and the terminal device; the preset protocol is used to define the correspondence between the physical characteristics of the feature signal and the mode switching command of the terminal device.

10. The method as described in claim 1, wherein the characteristic signal is a radio frequency carrier signal with a preset pulse pattern in the near-field communication frequency band; the characteristic signal is used to trigger the terminal device in card emulation mode to switch to card reader mode.

11. The method of claim 10, wherein the preset pulse pattern of the characteristic signal is a non-standard pulse pattern; the non-standard pulse pattern has different pulse characteristics from the device detection signal pattern specified in the near-field communication standard.

12. The method as described in claim 1, wherein the near-field communication device switches to reader mode and sends a characteristic signal, specifically comprising: The feature signal is transmitted within a first preset time period after the near-field communication device switches to card reader mode; After sending the characteristic signal, the near-field communication device switches to card emulation mode, specifically including: Within a second preset time period after the characteristic signal is sent, the near-field communication device is switched to card emulation mode.

13. The method as described in claim 2, wherein when the near-field communication device is in card emulation mode, before the proximity sensor detects whether a terminal device has entered a preset proximity range, the initial state of the near-field communication device is card emulation mode.

14. The method of claim 2, further comprising, after detecting whether a card reader signal is received from the terminal device: If the card reader signal is received, the card emulation mode of the near-field communication device is maintained to conduct near-field communication with the terminal device.

15. The method according to any one of claims 1 to 14, wherein the near-field communication with the terminal device comprises: Receive the card reading request signal sent by the terminal device in card reader mode; In response to the card reading request signal, tag information is sent to the terminal device.

16. The method of claim 15, wherein, The tag information is used to activate the application on the terminal device.

17. A near-field communication method applied to a terminal device, the method comprising: When the terminal device is in card emulation mode, it receives a characteristic signal sent by a near-field communication device; In response to receiving the feature signal, the terminal device switches from card emulation mode to card reader mode; In the card reader mode, a card reader signal is sent to the near-field communication device to read the tag information in the near-field communication device.

18. The method of claim 17, wherein, When the terminal device is in card emulation mode and in screen-off state, it receives the characteristic signal sent by the near field communication device.

19. The method of claim 17, wherein, The feature signal is generated based on a preset protocol between the near-field communication device and the terminal device; the preset protocol is used to define the correspondence between the physical characteristics of the feature signal and the mode switching command.

20. A near-field communication device, comprising: A proximity sensor is used to determine whether a terminal device has entered a preset proximity range; The near-field communication module supports both card emulation mode and card reader mode. The controller, connected to both the proximity sensor and the near-field communication module, is used for: When the near-field communication module is in card emulation mode, in response to the proximity sensor determining that a terminal device has entered the preset proximity range, the near-field communication module detects whether it receives a card reader signal from the terminal device. If the card reader signal is not received, the near-field communication module is controlled to switch to card reader mode and send a feature signal, which is used to instruct the terminal device to switch to card reader mode; After sending the characteristic signal, the near-field communication module is controlled to switch to card emulation mode to perform near-field communication with the terminal device.

21. A terminal device, comprising: The near-field communication module supports both card emulation mode and card reader mode. The processor, connected to the near-field communication module, is configured to: receive a feature signal sent by a near-field communication device through the near-field communication module when the near-field communication module is in card emulation mode; identify the feature signal in response to receiving the feature signal; control the near-field communication module to switch from card emulation mode to card reader mode based on the identification result; and control the near-field communication module to send a card reader signal to the near-field communication device in card reader mode to read tag information in the near-field communication device in card reader mode.

22. A computing device, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 19.

23. A computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 19.

24. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 19.