Near field communication (NFC) service processing method and device and electronic equipment
By determining the target NFC service scenario in the electronic device and writing service data, receiving custom NFC instructions to control the NFC module mode, the problem of interaction complexity of multiple devices is solved, and normal NFC service interaction between different systems and manufacturers is realized. Improved success rate and scope of application.
Patent Information
- Application Number
- CN202411358662.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-03
AI Technical Summary
In the prior art, the interaction process of NFC services between multiple electronic devices is complicated, especially the failure to identify and interact normally between devices of different operating systems and manufacturers, resulting in the failure of NFC services.
By determining the target NFC service scenario in the first electronic device, the service data is written to the NFC module, and upon detection of the second electronic device approaching, a custom NFC instruction is received, and the NFC module is controlled to be in the card simulation mode, so that the second electronic device is brought into the second electronic device, and the custom NFC command is received. The device can read service data and perform corresponding NFC services.
The NFC service interaction process between multiple electronic devices is simplified, ensuring the normal progress of NFC service between devices of different operating systems and manufacturers, and improving the success rate and scope of application of NFC service.
Smart Images

Figure CN119254272A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method, device and electronic device for processing near field communication (NFC) services. Background Art
[0002] In order to improve the convenience of users' lives, most electronic devices on the market have NFC (Near Field Communication) functions, thereby realizing NFC-based mobile payment, access card swiping, identity recognition and other applications. At present, the interaction process of NFC services between multiple electronic devices is relatively cumbersome, and how to simplify the interaction process of NFC services between multiple electronic devices has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The embodiments of the present application provide a method, device, electronic device, and program product for processing a near field communication (NFC) service, which can simplify the interaction process of NFC services between multiple electronic devices.
[0004] The embodiment of the present application discloses a method for processing a near field communication (NFC) service, which is applied to a first electronic device, wherein the first electronic device includes a first NFC module, and the method includes:
[0005] Determining a target NFC service scenario in which the first electronic device is located;
[0006] Writing the service data corresponding to the target NFC service scenario into the first NFC module;
[0007] When detecting that the second electronic device is close to the first electronic device, receiving a first NFC instruction sent by the second electronic device; the first NFC instruction is a custom NFC instruction;
[0008] In response to the first NFC instruction, the first NFC module is controlled to be in a card emulation mode, so that the second electronic device reads the service data from the first NFC module and performs an NFC service corresponding to the target NFC service scenario according to the service data.
[0009] The embodiment of the present application discloses a method for processing a near field communication (NFC) service, which is applied to a second electronic device, wherein the second electronic device includes a second NFC module, and the method includes:
[0010] The first NFC instruction is sent through the second NFC module, and the first NFC instruction is a customized NFC instruction, so that when the second electronic device is close to the first electronic device, the first electronic device receives the first NFC instruction and controls the first NFC module in the first electronic device to be in a card emulation mode in response to the first NFC instruction; the first NFC module stores business data corresponding to a target NFC business scenario; the business data is written into the first NFC module when the first electronic device determines that it is in the target NFC business scenario;
[0011] The service data is read from the first NFC module through the second NFC module, and the NFC service corresponding to the target NFC service scenario is performed according to the service data.
[0012] The embodiment of the present application discloses a device for processing a near field communication (NFC) service, which is applied to a first electronic device, wherein the first electronic device includes a first NFC module, and the device includes:
[0013] A service scenario determination module, configured to determine a target NFC service scenario in which the first electronic device is located;
[0014] A writing module, used to write the service data corresponding to the target NFC service scenario into the first NFC module;
[0015] An NFC receiving module, configured to receive a first NFC instruction sent by the second electronic device when detecting that the second electronic device is close to the first electronic device; the first NFC instruction is a user-defined NFC instruction;
[0016] The NFC control module is used to control the first NFC module to be in a card emulation mode in response to the first NFC instruction, so that the second electronic device reads the service data from the first NFC module and performs the NFC service corresponding to the target NFC service scenario according to the service data.
[0017] The embodiment of the present application discloses a near field communication (NFC) service processing device, which is applied to a second electronic device, wherein the second electronic device includes a second NFC module, and the device includes:
[0018] an NFC sending module, configured to send a first NFC instruction through the second NFC module, wherein the first NFC instruction is a user-defined NFC instruction, so that when the second electronic device is close to the first electronic device, the first electronic device receives the first NFC instruction and controls the first NFC module in the first electronic device to be in a card emulation mode in response to the first NFC instruction; the first NFC module stores business data corresponding to a target NFC business scenario; the business data is written into the first NFC module when the first electronic device determines that it is in the target NFC business scenario;
[0019] The reading module is used to read the service data from the first NFC module through the second NFC module, and perform the NFC service corresponding to the target NFC service scenario according to the service data.
[0020] An embodiment of the present application discloses an electronic device, including a memory, a processor, and a transceiver unit. The memory stores a computer program. When the computer program is executed by the processor, the electronic device implements the method described in any of the above embodiments.
[0021] An embodiment of the present application discloses a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor in an electronic device, the electronic device implements the method described in any of the above embodiments.
[0022] An embodiment of the present application discloses a computer program product, including a computer program. When the computer program is executed by a processor in an electronic device, the electronic device implements the method described in any of the above embodiments.
[0023] The processing method, device, electronic device, and program product of the near field communication NFC business disclosed in the embodiment of the present application, the first electronic device determines the target NFC business scenario in which it is located, and writes the business data corresponding to the target NFC business scenario into the first NFC module; when the second electronic device is detected to be close to the first electronic device, the first electronic device receives the first NFC instruction sent by the second electronic device, and the first NFC instruction is a customized NFC instruction. The first electronic device responds to the first NFC instruction and controls the first NFC module to be in the card simulation mode, so that the second electronic device can read the business data from the first NFC module, and perform the NFC business corresponding to the target business scenario according to the business data. In the embodiment of the present application, the first electronic device can directly write the business data to the first NFC module according to the target NFC business scenario in which it is located. When the first electronic device and the second electronic device are close, the first electronic device can control the first NFC module to be in the card simulation mode according to the first NFC instruction sent by the second electronic device, and realize the automatic switching of the mode of the first NFC module, so that the second electronic device can read the business data from the first NFC module and perform the NFC business, simplifying the interaction process of NFC business between multiple electronic devices, and can ensure the normal operation of NFC business between electronic devices with different operating systems and / or different manufacturers, and improve the success rate and application scope of NFC business. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 This is an application scenario diagram of a method for processing a near field communication (NFC) service in an embodiment;
[0026] Figure 2 is a timing diagram of a method for processing a near field communication NFC service in an embodiment;
[0027] Figure 3 It is a flowchart of a method for processing a near field communication (NFC) service in one embodiment;
[0028] Figure 4 It is a flowchart of a method for processing a near field communication NFC service in another embodiment;
[0029] Figure 5A is a timing diagram of a method for processing a near field communication NFC service in another embodiment;
[0030] Figure 5B is a timing diagram of a method for processing a near field communication NFC service in another embodiment;
[0031] Figure 6 It is a flowchart of a method for processing a near field communication NFC service in another embodiment;
[0032] Fig. 7A is a timing diagram of a method for processing a near field communication NFC service in another embodiment;
[0033] Figure 7B is a timing diagram of a method for processing a near field communication NFC service in another embodiment;
[0034] Fig. 8A is a timing diagram of a method for processing a near field communication NFC service in another embodiment;
[0035] Figure 8B is a timing diagram of a method for processing a near field communication NFC service in another embodiment;
[0036] Fig. 9 It is a flowchart of a method for processing a near field communication NFC service in another embodiment;
[0037] Fig.10 A block diagram of a device for processing a near field communication (NFC) service in one embodiment;
[0038] Fig.11 It is a block diagram of a device for processing near field communication (NFC) services in another embodiment;
[0039] Fig.12 FIG. 4 is a structural block diagram of an electronic device in an embodiment. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0041] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0042] It is understood that the terms "first", "second", etc. used in this application may be used in this article to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first electronic device may be referred to as a second electronic device, and similarly, a second electronic device may be referred to as a first electronic device. Both the first electronic device and the second electronic device are electronic devices, but they are not the same electronic device. The term "plurality" used in this application refers to two or more. The term "and / or" used in this application refers to one of the schemes, or any combination of multiple schemes.
[0043] The following are some explanations and descriptions of some terms that may be involved in this application:
[0044] NFC: It is an emerging technology that allows electronic devices to exchange data when they are close to each other.
[0045] Reader / Writer Mode: In this mode, the NFC device can be used as a reader / writer and can read the data written into the NFC tag.
[0046] Card Emulation (CE) mode: The NFC device is simulated as an NFC card and can communicate with the reader / writer.
[0047] Peer-to-Peer mode: Two NFC devices can both act as readers and NFC tags, and can use NFC technology to wirelessly interconnect and transmit data.
[0048] Type A: NFC-A, a type of NFC card defined in the ISO / IEC 14443 protocol of the NFC standard. When the reader transmits a signal to the NFC card, the signal is transmitted through a 13.56MHz radio frequency carrier, encoded using an improved Miller code, and modulated using 100% ASK (Amplitude Shift Keying).
[0049] Type B: NFC-B, a type of NFC card defined in the ISO / IEC 14443 protocol of the NFC standard. When the reader transmits a signal to the NFC card, the signal is transmitted through a 13.56MHz radio frequency carrier, encoded using NRZ code (Non-Return-to-Zero) and 10% ASK modulation.
[0050] Type F: NFC-F is a type of NFC card defined in the FeliCa protocol of the NFC standard.
[0051] Type V: NFC-V is a type of NFC card defined in the ISO / IEC 15693 protocol of the NFC standard. It is used to make up for the shortcomings of ISO / IEC 14443, such as insufficient communication distance and insufficient number of tags that can be read simultaneously.
[0052] Polling mode: The NFC device generates a carrier wave or a polling command to discover nearby NFC devices or NFC cards.
[0053] NDEF (NFC Data Exchange Format): is a standardized data format that can be used to exchange information between any compatible NFC device and another NFC device or NFC tag.
[0054] Most electronic devices on the market have NFC functions, and different electronic devices often need to interact with each other through NFC functions, such as file transfer, data sharing, identity authentication, card payment, etc. In related technologies, in order to perform NFC services between two electronic devices, the two electronic devices need to perform a large number of NFC command interactions first, and the interaction process is relatively cumbersome.
[0055] In addition, some electronic devices from some manufacturers on the market can interact with other electronic devices from the same manufacturer through the NFC function. However, for two electronic devices from different manufacturers, since there is no unified NFC standard for touch interaction instructions, the two electronic devices cannot recognize each other and cannot trigger the touch interaction process under the NFC function. For example, if an electronic device cannot identify whether the other device has both the NFC reader / writer function and the card emulation function, or only supports the card emulation function, the electronic device cannot accurately switch the working mode of the NFC module, resulting in the failure of NFC services between the two electronic devices.
[0056] The embodiments of the present application provide a method, device, electronic device, and program product for processing near field communication (NFC) services, which can simplify the interaction process of NFC services between multiple electronic devices, and can ensure the normal operation of NFC services between electronic devices of different systems and different manufacturers, thereby improving the success rate and scope of application of NFC services.
[0057] Figure 1 FIG. 1 is an application scenario diagram of a method for processing a near field communication NFC service in an embodiment. Figure 1As shown, NFC communication can be performed between the first electronic device 110 and the second electronic device 120, and the first electronic device 110 and the second electronic device 120 may include but are not limited to mobile phones, wearable devices (such as smart watches, smart glasses, etc.), vehicle terminals, tablet computers, laptops, PCs (Personal Computers), smart home devices (such as televisions, speakers, etc.), and other devices.
[0058] The first electronic device 110 may include a first NFC module, and the second electronic device 120 may include a second NFC module. The first NFC module and the second NFC module may perform NFC communication to implement an interactive process of an NFC service.
[0059] In some embodiments, the first electronic device 110 and the second electronic device 120 may be electronic devices produced by different manufacturers, and / or, the first electronic device 110 and the second electronic device 120 may be electronic devices installed with different operating systems, for example, the first electronic device 110 may be an electronic device installed with an Android operating system, and the second electronic device 120 may be an electronic device installed with an IOS operating system, or the first electronic device 110 may be an electronic device installed with an Android operating system, and the second electronic device 120 may be an electronic device installed with a Windows operating system, etc., but not limited thereto. It should be noted that the first electronic device 110 and the second electronic device 120 may also be electronic devices produced by the same manufacturer, or electronic devices installed with the same operating system.
[0060] The first electronic device 110 may be the initiator of the NFC service, or the second electronic device 120 may be the initiator of the NFC service, which is not limited here.
[0061] The first electronic device 110 can determine the target NFC business scenario in which it is located, and write the business data corresponding to the target NFC business scenario into the first NFC module. The second electronic device 120 can send a first NFC instruction through the second NFC module, and the first NFC instruction can be a customized NFC instruction, for example, the first NFC instruction can be a customized NFC instruction of the manufacturer of the second electronic device 120, etc. When the first electronic device 110 detects that it is close to the second electronic device 120, for example, the top of the first electronic device 110 (such as the end with the receiver, the front camera, etc.) touches the top of the second electronic device 120, that is, the first electronic device 110 and the second electronic device 120 perform a "touch and touch" interaction, etc., the first electronic device 110 can receive the first NFC instruction sent by the second electronic device. The first electronic device 110 can control the first NFC module to be in the card emulation mode in response to the first NFC instruction. The second electronic device 120 can read the business data from the first NFC module through the second NFC module, and perform the NFC business corresponding to the target NFC business scenario according to the business data.
[0062] Exemplarily, taking the target NFC business scenario as a file sharing scenario, the file sharing scenario may refer to a scenario where multiple electronic devices share data such as photos, audio, voice, video, files, etc. with each other. The first electronic device 110 may write the business data corresponding to the file sharing scenario into the first NFC module. For example, the business data corresponding to the file sharing scenario may include wireless communication information (such as Bluetooth communication information, Wi-Fi communication information, etc.) of the first electronic device 110. When the first electronic device 110 and the second electronic device 120 are close to each other, the first electronic device 110 receives the first NFC instruction sent by the second electronic device 120, controls the first NFC module to be in the card emulation mode, and the second electronic device 120 can read the wireless communication information from the first NFC module through the second NFC module, and establish a wireless communication connection (such as Bluetooth communication connection, Wi-Fi communication connection, etc.) with the first electronic device 110 based on the wireless communication information. Data can be transmitted between the first electronic device 110 and the second electronic device 120 through the wireless communication connection to achieve file sharing. .
[0063] Exemplarily, taking the target NFC business scenario as a game sharing scenario as an example, the game sharing scenario may refer to sharing game information between multiple electronic devices, such as sharing a game room, sharing a currently running game application, etc. The first electronic device 110 may write the business data corresponding to the game sharing scenario into the first NFC module. For example, the business data corresponding to the game sharing scenario may include the game information to be shared (such as the game room number, game character information, game application identification, etc.). When the first electronic device 1110 is close to the second electronic device 120, the first electronic device 110 receives the first NFC instruction sent by the second electronic device 120, controls the first NFC module to be in the card simulation mode, and the second electronic device 120 can read the game information to be shared from the first NFC module through the second NFC module, and share the game based on the game information to be shared, such as joining the shared game room, downloading or opening the corresponding game application, adding the game character of the first electronic device 110 to the game scene, etc., to achieve game sharing.
[0064] Exemplarily, taking the target NFC business scenario as a payment scenario, the payment scenario may refer to a scenario in which NFC technology is used for payment. The first electronic device 110 may write the business data corresponding to the payment scenario into the first NFC module. For example, the business data corresponding to the payment scenario may include NFC card information for payment (such as card identification, security verification information, balance information, etc.). When the first electronic device 110 is close to the second electronic device 120, the first electronic device 110 receives the first NFC instruction sent by the second electronic device 120, controls the first NFC module to be in card emulation mode, and the second electronic device 120 can read the NFC card information from the first NFC module through the second NFC module, and perform NFC payment services based on the NFC card information, such as deducting the NFC card balance in the first electronic device 110.
[0065] It should be noted that the NFC service performed between the first electronic device 110 and the second electronic device 120 may also be other NFC service scenarios, and is not limited to the several NFC service scenarios described above.
[0066] Figure 2 FIG. 1 is a timing diagram of a method for processing a near field communication (NFC) service in an embodiment. Figure 2 As shown, the method for processing the near field communication NFC service may include the following steps:
[0067] Step 1: The first electronic device determines a target NFC service scenario in which the first electronic device is located.
[0068] Step 2: The first electronic device writes the service data corresponding to the target NFC service scenario into the first NFC module.
[0069] Step 3: When the first electronic device and the second electronic device are close to each other, the first electronic device receives a first NFC instruction sent by the second electronic device.
[0070] Step 4: The first electronic device controls the first NFC module to be in a card emulation mode in response to the first NFC instruction.
[0071] Step 5: The second electronic device reads the service data from the first NFC module through the second NFC module.
[0072] Step 6: The second electronic device performs an NFC service corresponding to the target NFC service scenario with the first electronic device according to the read service data.
[0073] like Figure 3 As shown, in one embodiment, a method for processing a near field communication (NFC) service is provided, which can be applied to the first electronic device mentioned above. The method may include the following steps:
[0074] Step 310: determine a target NFC service scenario in which the first electronic device is located.
[0075] The first electronic device can identify the current target NFC business scenario. The NFC business scenario can be used to characterize the business type of the NFC business to be performed. Exemplarily, the NFC business scenarios may include but are not limited to file sharing scenarios, game sharing scenarios, payment scenarios, identity authentication scenarios, screen projection scenarios, resume broadcast scenarios, etc. The target NFC business scenario can be one of the NFC business scenarios.
[0076] Among them, the file sharing scenario may refer to a scenario in which file sharing is achieved through NFC interaction, such as a scenario in which multiple electronic devices share photos, audio, voice, video, files and other data with each other. It should be noted that multiple electronic devices in the file sharing scenario can transmit data through wireless communication connections, such as establishing a Bluetooth communication connection and / or a Wi-Fi communication connection based on NFC interaction, and transmitting data through the Bluetooth communication connection and / or the Wi-Fi communication connection to achieve file sharing.
[0077] The game sharing scenario may refer to a scenario in which game information is shared through NFC interaction, such as sharing a game room, sharing a currently running game application, etc.
[0078] The payment scenario may refer to a scenario in which payment is implemented based on NFC technology, in which the electronic device at one end can simulate an NFC card with payment function, such as a bank card, subway card, etc., and the electronic device at the other end can swipe the simulated NFC card to implement payment services.
[0079] The identity authentication scenario may refer to a scenario in which identity authentication is implemented based on NFC technology, in which an electronic device at one end can simulate an NFC card used for identity authentication, such as an access card, elevator card, etc., and an electronic device at the other end can swipe the simulated NFC card to implement identity authentication.
[0080] The screen projection scenario may refer to a scenario in which screen content is projected based on NFC technology, where the electronic device at one end may be the source device for projecting the content, and the electronic device at the other end may be the destination device for receiving the projected content. Data can be transmitted between the source device and the destination device through a wireless communication connection.
[0081] The resume scenario may refer to transferring multimedia data played on one electronic device to another electronic device for playback based on NFC interaction, such as transferring audio played on one electronic device to another electronic device for continued playback, transferring video played on one electronic device to another electronic device for continued playback, etc.
[0082] NFC services may refer to specific business matters based on NFC technology. For example, in a file sharing scenario, NFC services may include but are not limited to photo sharing services, audio transmission services, file transmission services, etc.; for another example, in a game sharing scenario, NFC services may be services for sharing game rooms, sharing game applications, etc.; for another example, in an identity authentication scenario, NFC services may be dormitory access card services, company access card services, etc., but are not limited thereto. It should be noted that the NFC services involved in the embodiments of the present application do not refer to services based solely on NFC technology. The NFC services may also be triggered by NFC technology and completed in combination with other communication technologies.
[0083] In some embodiments, the first electronic device may be the service initiator of the NFC service, that is, the NFC service may be triggered on the first electronic device. Taking the file sharing scenario as an example, the first electronic device may be the sharing end, and the second electronic device may be the shared end. In the case where the first electronic device is the service initiator of the NFC service, the first electronic device may directly determine the target NFC service scenario in which it is located. For example, the first electronic device may determine the NFC service to be performed based on the currently displayed interface, the currently running application, or the operation performed by the user, and determine the target NFC service scenario to which the NFC service to be performed belongs.
[0084] In some embodiments, the service initiator of the NFC service may be another electronic device, such as the service initiator of the NFC service may be a second electronic device. Taking the file sharing scenario as an example, the second electronic device may be the sharing end, and the first electronic device may be the shared end. In the case where the second electronic device is the service initiator of the NFC service, the second electronic device may send a communication signal, which may carry information indicating the target NFC service scenario. The first electronic device may determine the target NFC service scenario based on the communication signal when receiving the communication signal.
[0085] It should be noted that the embodiments of the present application do not limit the roles of the first electronic device and the second electronic device in the NFC service.
[0086] Step 320: Write the service data corresponding to the target NFC service scenario into the first NFC module.
[0087] When the first electronic device determines that it is in the target NFC service scenario, the first electronic device can write service data corresponding to the target NFC service scenario into the first NFC module. The service data corresponding to the target NFC service scenario may refer to data used to support the NFC service in the target NFC service scenario.
[0088] Each NFC business scenario may have corresponding business data, and the corresponding business data in different NFC business scenarios may be different. For example, the business data corresponding to the file sharing scenario may include the wireless communication information of the first electronic device; the business data corresponding to the game sharing scenario may include the game information to be shared; the business data corresponding to the payment scenario may include the NFC card information for payment, or the application information for implementing NFC payment, etc.; the business data corresponding to the identity authentication scenario may include identity authentication information, etc., but is not limited thereto.
[0089] Optionally, for different NFC services in the same NFC scenario, the business data written into the first NFC module can be the same. For example, in a file sharing scenario, whether it is a photo sharing service or a file transfer service, the corresponding business data can be wireless communication information, which can reduce the business data written to the first NFC module, simplify the writing process, and improve writing efficiency.
[0090] Optionally, for different NFC services in the same NFC scenario, the service data written into the first NFC module may also be different, and the service data written into the first NFC module may include specific service information corresponding to the NFC service to be performed, for example, for the service of sharing a game room in a game sharing scenario, the service data may include the shared game room number; for the service of sharing a game application in a game sharing scenario, the service data may include the application identifier and application link of the shared game application, but is not limited thereto. Writing the specific service information of the NFC service into the first NFC module can improve the accuracy of subsequent NFC services.
[0091] As an implementation manner, the first electronic device may write the service data to the first NFC module according to the NDEF format, thereby facilitating the subsequent reading of the service data from the first NFC module by the second electronic device.
[0092] In some embodiments, the first electronic device may also write a device identification to the first NFC module, and the device identification may be used to identify the identity of the first electronic device. For example, the device identification may include the device ID (Identity document) of the first electronic device, a verification code, etc., and the device identification may be used to enable the second electronic device to perform identity verification on the first electronic device. Furthermore, the verification code may be a randomly generated string, such as a string composed of one or more randomly generated numbers, letters, symbols, etc. By writing the device identification to the first NFC module, it is convenient for the subsequent second electronic device to read the device identification and perform identity verification on the first electronic device, thereby ensuring the accuracy and security of NFC services.
[0093] Step 330: When it is detected that the second electronic device is close to the first electronic device, a first NFC instruction sent by the second electronic device is received.
[0094] The second electronic device may include a second NFC module, and the second electronic device may send a first NFC instruction through the second NFC module. The first NFC instruction may be a customized NFC instruction, which may be different from a standard NFC instruction and is a customized NFC instruction by the manufacturer of the electronic device according to demand. Further, the first NFC instruction may be a customized NFC instruction by the manufacturer of the second electronic device, for example, the first NFC instruction may be a customized NFC polling instruction by the manufacturer of the second electronic device, and the customized NFC polling instruction by the manufacturer of the second electronic device may be used to discover electronic devices that support the NFC function and belong to the same manufacturer.
[0095] In an embodiment of the present application, the first electronic device may have the ability to monitor the first NFC instruction sent by the second electronic device, and the manufacturer of the second electronic device may not be the same manufacturer as the manufacturer of the first electronic device. The first electronic device may receive the NFC instruction sent by the second electronic device through the first NFC module, and identify whether the received NFC instruction is a customized first NFC instruction. It should be noted that the first electronic device can support monitoring of the first NFC instruction customized by the manufacturer of the second electronic device, and can also support monitoring of NFC instructions customized by the manufacturers of other electronic devices, and is not limited to supporting monitoring of NFC instructions customized by a specific manufacturer.
[0096] When the first electronic device is in the target NFC business scenario, the first electronic device can detect whether it is close to the second electronic device. Optionally, when the first electronic device is in the target NFC business scenario, the first NFC module can periodically send a detection signal to detect whether other electronic devices are close to the first electronic device. When an NFC coil is close to the outside of the first electronic device, the load of the first NFC module will change. The first electronic device can detect the load change, thereby determining that an NFC coil is close to the outside, and detecting that a second electronic device supporting the NFC function is close to the first electronic device.
[0097] When it is detected that the second electronic device is close to the first electronic device, the first electronic device may monitor the first NFC instruction to receive the first NFC instruction sent by the second electronic device.
[0098] Step 340: In response to the first NFC instruction, control the first NFC module to be in a card emulation mode, so that the second electronic device reads the service data from the first NFC module and performs an NFC service corresponding to the target NFC service scenario according to the service data.
[0099] In some embodiments, when a first electronic device receives a first NFC instruction sent by a second electronic device, it can identify the second electronic device as an electronic device from another manufacturer based on the first NFC instruction, and control the first NFC module to be in a card emulation mode, so that the second electronic device that belongs to a different manufacturer and / or has a different operating system from the first electronic device can accurately interact with the first electronic device through NFC information.
[0100] Furthermore, the first NFC module can be controlled to turn off the reader / writer mode and be in the card emulation mode only. The second NFC module of the second electronic device can be in the reader / writer mode and can read the business data stored in the first NFC module in the card emulation mode. By identifying the first NFC instruction sent by the second electronic device, the state of the first NFC module can be automatically switched, which simplifies the NFC interaction process between different electronic devices. Moreover, regardless of whether the first electronic device or the second electronic device is the business initiator, the first electronic device can be fixed in the card emulation mode and the second electronic device can be fixed in the reader / writer mode, which ensures the consistency of processing of different NFC business directions.
[0101] Optionally, the first electronic device may control the first NFC module to be in one or more card emulation modes of Type A, Type B, Type F, etc.
[0102] The second electronic device can perform an NFC service corresponding to the target NFC service scenario with the first electronic device based on the read service data. Optionally, after the second electronic device reads the service data through the second NFC module, the second NFC module can report the read service data to the upper layer application to perform the NFC service.
[0103] In an embodiment of the present application, the first electronic device can directly write business data to the first NFC module according to the target NFC business scenario. When the first electronic device is close to the second electronic device, the first electronic device can control the first NFC module to be in card emulation mode according to the first NFC instruction sent by the second electronic device, thereby automatically switching the mode of the first NFC module, so that the second electronic device can read the business data from the first NFC module and perform NFC business, which simplifies the interaction process of NFC business between multiple electronic devices, and can ensure the normal progress of NFC business between electronic devices with different operating systems and / or different manufacturers, thereby improving the success rate and scope of application of NFC business.
[0104] like Figure 4 As shown, in another embodiment, a method for processing a near field communication (NFC) service is provided, which can be applied to the first electronic device mentioned above. The method may include the following steps:
[0105] Step 402: determine a target NFC service scenario in which the first electronic device is located.
[0106] Step 404: write the service data corresponding to the target NFC service scenario into the first NFC module.
[0107] In some embodiments, the first electronic device may be a service initiator of the NFC service. In response to the service triggering operation, the first electronic device may determine a target NFC service scenario corresponding to the NFC service triggered by the first electronic device.
[0108] The service triggering operation may include but is not limited to the operation of triggering the first electronic device to display a designated service page, the triggering operation of the service components contained in the displayed interface, etc. The designated service page refers to a page used to trigger the NFC service, such as a photo sharing page, an audio sharing page, a game sharing page, a payment page, a screen projection page, etc. The service components may include but are not limited to notifications, buttons, dialog boxes, etc., and users can trigger NFC services by clicking on service components, etc.
[0109] The first electronic device may determine, according to the service triggering operation, a target NFC service scenario corresponding to the NFC service triggered by the first electronic device, and the NFC service triggered by the first electronic device is the NFC service to be performed.
[0110] In some embodiments, based on the NFC service triggered by the first electronic device, an NFC event may be registered, and based on the NFC event, service data corresponding to the target NFC service scenario may be written into the first NFC module.
[0111] The application program that detects the service triggering operation in the first electronic device can register an NFC event, and the registered NFC event can ensure that the application program can interact with the first NFC module, so that the application program can obtain information of the first NFC module. The application program can obtain service data, and write service data, device identification and other information to the first NFC module through the registered NFC event, thereby ensuring the accurate writing of service data, thereby ensuring the accurate conduct of subsequent NFC services.
[0112] In this implementation, the first electronic device can actively initiate an NFC service, thereby improving the flexibility of NFC service processing.
[0113] In some embodiments, the first electronic device may not be the service initiator of the NFC service, and the second electronic device may be the service initiator of the NFC service. The second electronic device may determine the target NFC service scenario corresponding to the NFC service triggered by the second electronic device in response to the service triggering operation, and the second electronic device may send a first Bluetooth signal based on the target NFC service scenario, and the first Bluetooth signal may carry a first identifier, which may be used to identify the target NFC service scenario.
[0114] The service triggering operation performed on the second electronic device may be similar to the service triggering operation performed on the first electronic device, and will not be repeated here. The second electronic device may determine the target NFC service scenario corresponding to the NFC service triggered by the second electronic device according to the service triggering operation, and the NFC service triggered by the second electronic device is the NFC service to be performed. The second electronic device may generate a first Bluetooth signal carrying a first identifier based on the determined target NFC service scenario.
[0115] Optionally, the first identifier can be a single identifier or a combination of multiple identifiers, and the first identifier can identify the target NFC business scenario corresponding to the NFC business triggered by the second electronic device. Furthermore, the first identifier can be a customized identifier, and different first identifiers can be customized for different NFC business scenarios, thereby identifying different NFC business scenarios.
[0116] For example, the first identifier may include a UUID (Universally Unique Identifier), which may identify the signal type of the first Bluetooth signal. Different UUIDs may be customized for different NFC business scenarios. For example, the UUID corresponding to the file sharing scenario may be 0x1234, and the UUID corresponding to the game sharing scenario may be 0x2345, etc., but is not limited thereto.
[0117] The first electronic device may receive a first Bluetooth signal sent by the second electronic device, and may determine a target NFC service scenario according to a first identifier carried in the first Bluetooth signal.
[0118] In some embodiments, the first Bluetooth signal may include a BLE (Bluetooth Low Energy) broadcast signal. The first electronic device may scan the BLE broadcast signal. For example, the first electronic device may periodically scan the BLE broadcast signal, parse the received BLE broadcast signal, and determine whether the BLE broadcast signal carries the first identifier. If a BLE broadcast signal carrying the first identifier is identified, the target NFC business scenario may be determined based on the first identifier.
[0119] Optionally, when the first electronic device is in a screen-on state, the first Bluetooth signal carrying the first identifier may be scanned, thereby reducing unnecessary power consumption loss and improving the battery life of the first electronic device.
[0120] Optionally, the first electronic device may scan the first Bluetooth signal carrying the first identifier when the NFC interaction function is turned on. If the first electronic device does not turn on the NFC interaction function, it may not scan the first Bluetooth signal carrying the first identifier, thereby reducing unnecessary power consumption and improving the battery life of the first electronic device.
[0121] In some embodiments, the first electronic device receives a first Bluetooth signal sent by the second electronic device, and can determine the distance between the first electronic device and the second electronic device based on the signal strength of the first Bluetooth signal, and write the business data corresponding to the target NFC business scenario into the first NFC module if the distance is less than or equal to a distance threshold.
[0122] The first electronic device receives the first Bluetooth signal sent by the second electronic device, and can first determine whether the first Bluetooth signal carries the first identifier. If it carries the first identifier, the distance between the first electronic device and the second electronic device can be calculated based on the signal strength of the first Bluetooth signal. The signal strength of the first Bluetooth signal may include but is not limited to RSSI (Received Signal Strength Indication). The greater the signal strength, the smaller the distance between the first electronic device and the second electronic device. The specific method of calculating the distance between the two electronic devices based on the signal strength of the first Bluetooth signal is not limited here.
[0123] The first electronic device can determine whether the distance between it and the second electronic device is less than a distance threshold. If the distance is less than the distance threshold, it means that the first electronic device and the second electronic device are relatively close, and the second electronic device is likely to conduct NFC business with the first electronic device. In this case, the business data corresponding to the target NFC business scenario can be written into the first NFC module, so that the second electronic device can read the business data from the first NFC module and perform NFC business processing, thereby improving the interaction accuracy of the NFC business.
[0124] As a specific implementation, an application of the first electronic device (such as an application supporting the NFC function) can register to monitor the first Bluetooth signal and configure the type of Bluetooth signal to be monitored, that is, the first identifier carried by the Bluetooth signal to be monitored. Optionally, the application of the first electronic device can register to monitor the first Bluetooth signal in a dynamic registration manner, so as to cancel the monitoring when the first Bluetooth signal does not need to be scanned, thereby reducing unnecessary overhead.
[0125] After the Bluetooth module of the first electronic device scans the first Bluetooth signal carrying the first identifier, the distance between the first electronic device and the second electronic device can be determined based on the signal strength corresponding to the first Bluetooth signal, and the signal content (such as the first identifier, etc.), signal strength, distance and other signals of the scanned first Bluetooth signal can be fed back to the application through a callback.
[0126] The application can monitor the callback sent by the Bluetooth module and determine whether the distance included in the callback of the Bluetooth module is less than the distance threshold. If it is less than the distance threshold, the application can write business data corresponding to the target NFC business scenario to the first NFC module.
[0127] In some embodiments, in order to improve the accuracy of identifying the first Bluetooth signal, the first Bluetooth signal may also include a second identifier, which can be used to characterize that the second electronic device is in an NFC interaction scenario. Through the first identifier and the second identifier, the first electronic device can accurately determine that the first Bluetooth signal is sent by the second electronic device in the target NFC interaction scenario, and then the distance between the first electronic device and the second electronic device can be determined based on the signal strength of the first Bluetooth signal.
[0128] Exemplarily, the second identifier may also be a customized identifier, and the same second identifier may correspond to different NFC interaction scenarios. For example, the second identifier may be 0x1122334455, or 0x5544332211, etc., but not limited thereto. By combining the first identifier with the second identifier, the first Bluetooth signal may be accurately identified and distance measurement may be performed based on the first Bluetooth signal, thereby triggering a subsequent NFC interaction process and improving the accuracy of the NFC interaction.
[0129] In this implementation, the first electronic device may not be the service initiator of the NFC service. The second electronic device as the service initiator can trigger the first electronic device to write the service data into the first NFC module by sending a first Bluetooth signal carrying a first identifier, thereby realizing accurate subsequent NFC services and improving the flexibility of NFC service processing.
[0130] Step 406, controlling the first NFC module to enter a silent state; the silent state refers to a state in which the first NFC module monitors the first NFC instruction and does not send an NFC instruction.
[0131] Step 408: When it is detected that the second electronic device is close to the first electronic device, a first NFC instruction sent by the second electronic device is received.
[0132] When the first electronic device determines that it is in the target NFC business scenario, the first NFC module can be controlled to enter a silent state, which refers to a state in which the first NFC module listens to the first NFC instruction and does not send an NFC instruction. In the silent state, the first NFC module can receive and identify the first NFC instruction sent by the second electronic device, but will not respond to the first NFC instruction, nor actively send other NFC instructions.
[0133] Optionally, the silent state can be understood as a state in which the first NFC module specifically processes customized NFC instructions of other manufacturers (such as the manufacturer of the second electronic device) and / or other operating systems. By switching the first NFC module to the silent state, the first NFC module can be enabled to monitor the first NFC instruction, which can ensure that the first NFC module recognizes the first NFC instruction more attentively, avoid NFC interaction errors (such as performing erroneous or unnecessary NFC instruction interactions, etc.), and further improve the accuracy and stability of NFC interactions between electronic devices of different manufacturers and / or different operating systems.
[0134] In some embodiments, when the second electronic device is detected to be close to the first electronic device, the first NFC module can be controlled to enter a silent state and monitor the first NFC instruction sent by the second electronic device. When the second electronic device is not detected to be close to the first electronic device, the first NFC module may not enter the silent state first, but only enter the silent state when the second electronic device is detected to be close to the first electronic device, and monitor the first NFC instruction sent by the second electronic device. When it is determined that the first electronic device is to conduct NFC business with the second electronic device, the first NFC instruction is monitored, thereby improving the accuracy of the state control and switching of the first NFC module.
[0135] Step 410, in response to the first NFC instruction, controlling the first NFC module to be in a card emulation mode, so that the second electronic device reads service data from the first NFC module, and performs an NFC service corresponding to a target NFC service scenario according to the service data.
[0136] The description of step 410 may refer to the relevant description in the above embodiment, and will not be repeated here.
[0137] In some embodiments, after the first electronic device controls the first NFC module to enter the silent state, the duration of the first NFC module entering the silent state can be timed. If the duration of the first NFC module entering the silent state exceeds the first duration threshold, and the first NFC instruction sent by the second electronic device is still not received, it means that the second electronic device is probably an NFC tag or an electronic device that only supports the NFC card emulation mode. In this case, the silent state can be exited to interact with NFC standard instructions, such as reading data of the second NFC module in the second electronic device through the first NFC module to interact with information, etc. By setting a timeout mechanism for the silent state, it is possible to avoid the first NFC module being in the silent state for a long time, resulting in the inability to interact normally with other NFC devices, thereby improving the user experience.
[0138] For example, Figure 5A FIG. 1 is a timing diagram of a method for processing a near field communication NFC service in another embodiment. Figure 5A As shown, the first electronic device can enter the specified business page, determine the target NFC business scenario, and write business data to the first NFC module. The second electronic device can be in a bright screen state and can display any interface. Optionally, the second electronic device can display any interface other than the specified business page. The second NFC module of the second electronic device can send a first NFC instruction. Optionally, the second NFC module can switch between a card reader mode and a card emulation mode, and send a first NFC instruction when in the card reader mode.
[0139] When the first electronic device and the second electronic device are "touched", the first electronic device can control the first NFC module to enter a silent state to listen to the first NFC instruction sent by the second electronic device. The first electronic device and the second electronic device are kept in contact, and when the first electronic device receives the first NFC instruction, it can turn off the reader / writer mode of the first NFC module and enter the card emulation mode, so that the second NFC module in the reader / writer mode of the second electronic device can read the business data from the first NFC module. The second electronic device can perform NFC business with the first electronic device based on the business data.
[0140] For example, Figure 5B FIG. 1 is a timing diagram of a method for processing a near field communication NFC service in another embodiment. Figure 5B As shown, the second electronic device can enter the designated business page and send a BLE broadcast carrying a first identifier, where the first identifier is used to identify the target NFC business scenario. The first electronic device can be in a bright screen state and can display any interface. Optionally, the first electronic device can display any interface other than the designated business page. The first electronic device can perform a BLE scan, receive a BLE broadcast sent by the second electronic device, and write business data to the first NFC module. The second NFC module of the second electronic device can send a first NFC instruction. Optionally, the second NFC module can switch between a card reader mode and a card emulation mode, and send a first NFC instruction when in a card reader mode.
[0141] When the first electronic device and the second electronic device are "touched", the first electronic device can control the first NFC module to enter a silent state to listen to the first NFC instruction sent by the second electronic device. The first electronic device and the second electronic device are kept in contact, and when the first electronic device receives the first NFC instruction, it can turn off the reader / writer mode of the first NFC module and enter the card emulation mode, so that the second NFC module in the reader / writer mode of the second electronic device can read the business data from the first NFC module. The second electronic device can perform NFC business with the first NFC device based on the business data.
[0142] In an embodiment of the present application, when the first electronic device is in the target NFC business scenario, business data can be written to the first NFC module, and the first NFC module can be controlled to enter a silent state. In this silent state, the first NFC module can receive and identify the first NFC instruction sent by the second electronic device, and does not send the NFC instruction externally, which can ensure that the first NFC module can more attentively identify the first NFC instruction, avoid NFC interaction errors (such as erroneous or unnecessary NFC instruction interactions, etc.), and use the first NFC instruction to accurately identify the identity of the second electronic device (an electronic device from a different manufacturer and / or with a different operating system), further improving the accuracy and stability of NFC interaction between electronic devices from different manufacturers and / or with different operating systems.
[0143] like Figure 6 As shown, in another embodiment, a method for processing a near field communication (NFC) service is provided, which can be applied to the first electronic device mentioned above. The method may include the following steps:
[0144] Step 602: determine a target NFC service scenario in which the first electronic device is located.
[0145] Step 604, control the first NFC module to enter a first polling mode, and write the service data corresponding to the target NFC service scenario into the first NFC module; the first polling mode refers to a mode in which the first NFC module only sends a target polling instruction.
[0146] For the description of step 602 and the description of writing the service data corresponding to the target NFC service scenario into the first NFC module, reference may be made to the relevant descriptions in the above embodiments, which will not be repeated here.
[0147] When the first electronic device is in a target NFC business scenario, the first NFC module can be controlled to enter a first polling mode, where the first NFC module only sends a target polling instruction, wherein the target polling instruction is used to discover electronic devices that support the NFC function and can prevent the discovered electronic devices from entering a card simulation interaction process.
[0148] In some embodiments, in the first polling mode, the first NFC module may be in a reader / writer mode, and generate a radio frequency field and send a target polling instruction, which may be received by an NFC device or an NFC tag that enters the radio frequency field generated by the first NFC module. Further, the target polling instruction may be an NFC instruction that does not trigger the electronic device that receives the target polling instruction to enter a card emulation interaction process, wherein the card emulation interaction process may refer to an interaction process in which the electronic device switches to a card emulation state and sends a response signal (such as a response signal carrying an NFC card type, etc.) to the first NFC mode.
[0149] Optionally, the target polling instruction includes a Type V type polling instruction, or a single carrier signal. Furthermore, when controlling the first NFC module to enter the first polling mode, the Type A type, Type B type and Type F type polling functions of the first NFC module can be turned off, that is, Type A type, Type B type and Type F type instructions are not sent. The reason for turning off the Type A type, Type B type and Type F type polling functions of the first NFC module is that the Type A type, Type B type and Type F type polling instructions will cause the second electronic device that receives the polling instruction to enter the Type A type, Type B type and Type F type card simulation interaction process. If the second electronic device mistakenly enters the card simulation interaction process, the NFC card will be erroneously popped up (for example, a bank card, bus card, etc. will be erroneously popped up), and the subsequent NFC business interaction process cannot be completed normally.
[0150] Optionally, the target polling instruction may be a Type V type polling instruction. Since most electronic devices currently do not have a Type V card emulation function, the Type V type polling instruction will not allow the second electronic device to enter the card emulation interaction process. It should be noted that, with the development of the NFC standard protocol, the target polling instruction may also be updated along with the NFC standard protocol.
[0151] Optionally, the target polling instruction may also be a single-carrier signal, which may not carry valid information or may carry relatively simple information. Then, the second electronic device receiving the single-carrier signal will not be triggered to enter the card simulation interaction process.
[0152] In some embodiments, in the first polling mode, the card emulation mode of the first NFC module can be retained, that is, the first NFC module can periodically switch between the reader / writer mode and the card emulation mode, and when the first NFC module is in the card emulation mode, the target polling instruction may not be found. By periodically switching between the reader / writer mode and the card emulation mode, it is convenient for the first electronic device to interact with the NFC card reader and the like, and the card emulation function of the first electronic device is realized, which can avoid that after the first NFC card enters the first polling mode, the NFC card reader or other electronic devices in the card reader mode cannot interact with the first NFC card normally, affecting the user experience.
[0153] In some embodiments, when the second electronic device is the service initiator, the first electronic device receives the first Bluetooth signal sent by the second electronic device, and can determine the distance between the first electronic device and the second electronic device based on the signal strength of the first Bluetooth signal, and control the first NFC module to enter the first polling mode when the distance is less than or equal to the distance threshold.
[0154] When the distance is less than or equal to the distance threshold, the first electronic device may modify the hardware parameters of the first NFC module, disable the Type A, Type B and Type F polling functions of the first NFC module, retain only the Type V polling function or send a single carrier signal, and write the service data corresponding to the target NFC service scenario into the first NFC module.
[0155] The first electronic device can determine the distance between itself and the second electronic device based on the first Bluetooth signal sent by the second electronic device, and control the first NFC module to enter the first polling mode when the distance is less than the distance threshold, thereby avoiding erroneous switching of the polling mode and improving the control accuracy of the first NFC module.
[0156] Step 606: When it is detected that the second electronic device is close to the first electronic device, the first NFC module is controlled to stop sending the target polling instruction, and the first NFC module is controlled to enter a silent state; the silent state refers to a state in which the first NFC module listens to the first NFC instruction and does not send an NFC instruction.
[0157] When the first electronic device detects that the second electronic device is approaching, for example, when it is detected that the first electronic device and the second electronic device perform a "touch and pay" interactive operation, the first NFC module can be controlled to stop sending the target polling instruction, and the first NFC module can be controlled to enter a silent state to monitor the first NFC instruction sent by the second electronic device.
[0158] Optionally, the first NFC instruction may be a Type V NFC instruction customized by a manufacturer of the second electronic device.
[0159] Step 608: Receive a first NFC instruction sent by the second electronic device.
[0160] Step 610: In response to the first NFC instruction, control the first NFC module to be in a card emulation mode, so that the second electronic device reads service data from the first NFC module and performs an NFC service corresponding to a target NFC service scenario according to the service data.
[0161] The description of steps 608 to 610 may refer to the relevant description in the above embodiments, and will not be repeated here.
[0162] In some embodiments, when the exit condition is met, the first electronic device can control the first NFC module to switch from the first polling mode to the second polling mode, where the second polling mode refers to a mode in which the first NFC mode sends polling instructions of multiple NFC card types in turn.
[0163] Furthermore, the multiple NFC card types may include multiple types of Type A, Type B, Type F, and Type V.
[0164] The exit condition may refer to a condition that triggers exiting the first polling mode. Optionally, the exit condition may include but is not limited to one or more of the following conditions:
[0165] (1) After the first NFC module enters the silent state, it has not received the first NFC instruction sent by the second electronic device, and the duration of entering the silent state exceeds a first duration threshold.
[0166] (2) The duration during which the first NFC module fails to receive the first NFC instruction sent by the second electronic device exceeds a second duration threshold.
[0167] (3) The distance between the first electronic device and the second electronic device is greater than a distance threshold.
[0168] In some embodiments, the signal strength of the first Bluetooth signal received by the first electronic device may change frequently due to obstacles or movement of the electronic device during the transmission of the first Bluetooth signal. Therefore, the first electronic device can determine the distance between the first electronic device and the second electronic device according to the multiple receptions of the first Bluetooth signal, and perform smoothing according to the distances corresponding to the multiple first Bluetooth signals, and determine whether to exit the first polling mode according to the result of the smoothing process.
[0169] Optionally, a smoothing coefficient may be set, and the distances corresponding to the first Bluetooth signals are smoothed based on the smoothing coefficient. Further, multiple distances greater than the distance threshold are smoothed based on the smoothing coefficient, and it is determined whether to control the first NFC module to exit the first polling mode according to the result of the smoothing process.
[0170] As a specific implementation, after receiving the first Bluetooth signal and determining the distance between the first electronic device and the second electronic device according to the first Bluetooth signal, the first electronic device can determine whether the distance is greater than a distance threshold. If the distance is greater than the distance threshold, the distance can be multiplied by a smoothing coefficient to obtain a multiplication result. It can be determined whether the multiplication result is greater than a target distance. If the multiplication result is greater than the target distance, the first NFC module can be controlled to exit the first polling mode and switch from the first polling mode to the second polling mode.
[0171] If the multiplication result is not greater than the target distance, the multiplication result can be recorded, and when the first Bluetooth signal is received next time, the distance corresponding to the first Bluetooth signal received next time is determined. If the distance corresponding to the first Bluetooth signal received next time is greater than the distance threshold, the multiplication result can be multiplied by the smoothing coefficient to obtain a new multiplication result. The step of determining whether the multiplication result is greater than the target distance can be re-executed until the multiplication result is greater than the target distance, then the first NFC module can be controlled to exit the first polling mode, or the distance corresponding to the first Bluetooth signal received next time is not greater than the distance threshold, then the recorded multiplication result can be cleared.
[0172] The target distance mentioned above may be determined according to a distance threshold. For example, the target distance may be a multiple of the distance threshold, such as the target distance may be twice the distance threshold, etc., but is not limited thereto.
[0173] In this implementation, the distances corresponding to the multiple first Bluetooth signals can be smoothed, and whether to control the first NFC module to exit the first polling mode can be determined based on the smoothed result, thereby improving the accuracy of controlling the state switching of the first NFC module.
[0174] In some embodiments, a protection duration corresponding to the first polling mode may be set, and the protection duration may refer to the duration during which the first NFC module is not allowed to exit the first polling mode after entering the first polling mode. The protection duration may be set according to actual needs, such as 30 seconds, 1 minute, etc., but is not limited thereto. After the duration of the first NFC module entering the first polling mode exceeds the protection duration, it may be determined whether to control the first NFC module to exit the first polling mode according to the distance between the first electronic device and the second electronic device, so as to avoid the first NFC module switching too frequently between different polling modes, resulting in unnecessary power consumption loss.
[0175] When the exit conditions are met, the first electronic device can control the first NFC module to switch from the first polling mode to the second polling mode. After switching to the second polling mode, the first NFC module can interact with NFC tags, electronic devices that only support card emulation mode, and electronic devices from the same manufacturer or the same operating system, so as to meet NFC usage requirements in different scenarios.
[0176] In an embodiment of the present application, when the first electronic device is in a target NFC business scenario, the first NFC module can be controlled to enter a first polling mode. In the first polling mode, the first NFC module can only send a target polling instruction to generate a radio frequency field to discover the electronic device, and will not allow the electronic device entering the radio frequency field to mistakenly enter the card simulation interaction process, thereby avoiding the situation of erroneous card ejection and ensuring the normal progress of subsequent NFC services.
[0177] For example, Fig. 7A FIG. 1 is a timing diagram of a method for processing a near field communication NFC service in another embodiment. Fig. 7A As shown, the first electronic device can enter the designated business page, determine the target NFC business scenario, write business data to the first NFC module, and turn off the Type A, Type B and Type F polling functions of the first NFC module, retaining only the Type V polling function or continuously sending a single carrier signal. The second electronic device can be in a bright screen state and can display any interface. Optionally, the second electronic device can display any interface other than the designated business page. The second NFC module of the second electronic device can send a first NFC instruction. Optionally, the second NFC module can switch between a card reader mode and a card emulation mode, and send a first NFC instruction when in the card reader mode.
[0178] When the first electronic device and the second electronic device are "touched", the first electronic device can control the first NFC module to enter a silent state to listen to the first NFC instruction sent by the second electronic device. The first electronic device and the second electronic device are kept in contact, and when the first electronic device receives the first NFC instruction, it can turn off the reader / writer mode of the first NFC module and enter the card emulation mode, so that the second NFC module in the reader / writer mode of the second electronic device can read the business data from the first NFC module. The second electronic device can perform NFC business with the first NFC device based on the business data.
[0179] For example, Figure 7B FIG. 1 is a timing diagram of a method for processing a near field communication NFC service in another embodiment. Figure 7B As shown, the second electronic device can enter the designated business page and send a BLE broadcast carrying a first identifier, which is used to identify the target NFC business scenario. The first electronic device can be in a bright screen state and can display any interface. Optionally, the first electronic device can display any interface other than the designated business page. The first electronic device can perform a BLE broadcast scan and receive a BLE broadcast sent by the second electronic device. When the first electronic device determines that the distance between the first electronic device and the second electronic device is less than the distance threshold according to the BLE broadcast, the first electronic device can write business data to the first NFC module and turn off the polling functions of Type A, Type B and Type F of the first NFC module, retaining only the polling function of Type V or continuously sending a single carrier signal. The second NFC module of the second electronic device can send a first NFC instruction. Optionally, the second NFC module can switch between a card reader mode and a card emulation mode, and send a first NFC instruction when in the card reader mode.
[0180] When the first electronic device and the second electronic device are "touched", the first electronic device can control the first NFC module to enter a silent state to listen to the first NFC instruction sent by the second electronic device. The first electronic device and the second electronic device are kept in contact, and when the first electronic device receives the first NFC instruction, it can turn off the reader / writer mode of the first NFC module and enter the card emulation mode, so that the second NFC module in the reader / writer mode of the second electronic device can read the business data from the first NFC module. The second electronic device can perform NFC business with the first NFC device based on the business data.
[0181] In the embodiment of the present application, business scenario recognition between multiple electronic devices can be realized, and the state of the first NFC module can be automatically switched, which simplifies the interaction process of NFC services between multiple electronic devices, thereby reducing the interaction complexity of NFC services. The first electronic device supports the recognition and processing of a customized first NFC instruction sent by a second electronic device of a different manufacturer and / or a different operating system, and when receiving the first NFC instruction, the first NFC module of the first electronic device is fixed to the card simulation mode, and the second NFC module of the second electronic device is fixed to the reader-writer mode, following the same interaction logic, which can ensure the normal operation of NFC services between electronic devices of different operating systems and / or different manufacturers, and improve the success rate and application scope of NFC services.
[0182] In some embodiments, taking the target business scenario as a data transmission scenario as an example, the data transmission scenario may refer to multimedia data transmission, file data transmission, etc. between multiple electronic devices. The business data corresponding to the data transmission scenario may include device information of the first electronic device. When the first electronic device detects that it is close to the second electronic device, the first electronic device receives the first NFC instruction sent by the second electronic device, and can respond to the first NFC instruction to control the first NFC module to be in card simulation mode, so that the second electronic device reads the device information of the first electronic device from the first NFC module, and the device information can be used to trigger the second electronic device to establish a wireless communication connection with the first electronic device. The first electronic device can transmit data with the second electronic device through a wireless communication connection.
[0183] In some embodiments, the device information of the first electronic device may include a device identification. When the first electronic device detects that the second electronic device is close to the first electronic device, a second Bluetooth signal carrying the device identification may be sent. The second electronic device may receive the second Bluetooth signal, and may compare the device identification carried by the second Bluetooth signal with the device identification read from the first NFC module. If the device identification carried by the second Bluetooth signal is consistent with the device identification read from the first NFC module, the second electronic device may establish a wireless communication connection with the first electronic device. For example, if the device identification carried by the second Bluetooth signal is consistent with the device identification read from the first NFC module, the second electronic device may establish a Bluetooth connection with the first electronic device based on the second Bluetooth signal, and may exchange Wi-Fi connection information through the Bluetooth connection. The second electronic device may establish a Wi-Fi communication connection with the first electronic device based on the Wi-Fi connection information, and perform data transmission through the Wi-Fi communication connection.
[0184] For example, Fig. 8A FIG. 1 is a timing diagram of a method for processing a near field communication NFC service in another embodiment. Fig. 8A As shown, the first electronic device can enter the data transmission page, determine that it is in the data transmission scenario, write device information to the first NFC module, and turn off the Type A, Type B and Type F polling functions of the first NFC module, and only retain the Type V polling function or continue to send a single carrier signal. The second electronic device can be in a bright screen state and can display any interface. The second NFC module of the second electronic device can send a first NFC instruction. Optionally, the second NFC module can switch between a card reader mode and a card emulation mode, and send a first NFC instruction when in the card reader mode.
[0185] When the first electronic device and the second electronic device are "touched", the first electronic device can control the first NFC module to enter a silent state to listen to the first NFC instruction sent by the second electronic device. The first electronic device and the second electronic device remain in contact, and when the first electronic device receives the first NFC instruction, it can turn off the reader / writer mode of the first NFC module and enter the card simulation mode, so that the second NFC module in the reader / writer mode of the second electronic device can read the device information from the first NFC module. The first electronic device can send a BLE broadcast carrying a device identifier, and the second electronic device scans the BLE broadcast, and when it is confirmed that the device identifier carried by the BLE broadcast is consistent with the device identifier read from the first NFC module, it establishes a Bluetooth communication connection with the first electronic device and establishes a Wi-Fi communication connection. Data transmission between the first electronic device and the second electronic device can be carried out through a Wi-Fi communication connection.
[0186] For example, Figure 8B FIG. 1 is a timing diagram of a method for processing a near field communication NFC service in another embodiment. Figure 8B As shown, the second electronic device can enter the data transmission page, determine that it is in the data transmission scenario, and send a BLE broadcast carrying a first identifier, which is used to identify the data transmission scenario. The first electronic device can be in a bright screen state and can display any interface. The first electronic device can perform a BLE broadcast scan and receive a BLE broadcast sent by the second electronic device. When the first electronic device determines that the distance between it and the second electronic device is less than the distance threshold according to the BLE broadcast, it can write business data to the first NFC module and turn off the Type A, Type B and Type F polling functions of the first NFC module, retaining only the Type V polling function or continuously sending a single carrier signal. The second NFC module of the second electronic device can send a first NFC instruction. Optionally, the second NFC module can switch between a card reader mode and a card emulation mode, and send a first NFC instruction when in the card reader mode.
[0187] When the first electronic device and the second electronic device are "touched", the first electronic device can control the first NFC module to enter a silent state to listen to the first NFC instruction sent by the second electronic device. The first electronic device and the second electronic device remain in contact, and when the first electronic device receives the first NFC instruction, it can turn off the reader / writer mode of the first NFC module and enter the card simulation mode, so that the second NFC module in the reader / writer mode of the second electronic device can read the device information from the first NFC module. The first electronic device can send a BLE broadcast carrying a device identifier, and the second electronic device scans the BLE broadcast, and when it is confirmed that the device identifier carried by the BLE broadcast is consistent with the device identifier read from the first NFC module, it establishes a Bluetooth communication connection with the first electronic device and establishes a Wi-Fi communication connection. Data transmission between the first electronic device and the second electronic device can be carried out through a Wi-Fi communication connection.
[0188] In this embodiment, the NFC interaction process of "touch and pay" for data transmission is unified between electronic devices of different manufacturers and / or different operating systems, the operation of "touch and pay" for data transmission is simplified, and regardless of whether the first electronic device is a data sender or a data receiver, the NFC interaction logic is the same, thereby ensuring the consistency of NFC interaction.
[0189] like Fig. 9 As shown, in one embodiment, another method for processing a near field communication (NFC) service is provided, which can be applied to the second electronic device mentioned above. The method may include the following steps:
[0190] Step 910, sending a first NFC instruction through the second NFC module, where the first NFC instruction is a customized NFC instruction, so that when the second electronic device is close to the first electronic device, the first electronic device receives the first NFC instruction and controls the first NFC module in the first electronic device to be in a card emulation mode in response to the first NFC instruction; the first NFC module stores business data corresponding to the target NFC business scenario; the business data is written into the first NFC module when the first electronic device determines that it is in the target NFC business scenario.
[0191] Step 920: read the service data from the first NFC module through the second NFC module, and perform an NFC service corresponding to the target NFC service scenario according to the service data.
[0192] In one embodiment, before step 910, the method may also include: in response to a service triggering operation, determining a target NFC service scenario corresponding to the NFC service triggered by the second electronic device; based on the target NFC service scenario, sending a first Bluetooth signal, the first Bluetooth signal carrying a first identifier, and the first identifier is used to identify the target NFC service scenario.
[0193] In one embodiment, the first Bluetooth signal is used to instruct the first electronic device to determine the distance between the first electronic device and the second electronic device based on the signal strength of the first Bluetooth signal, and when the distance is less than or equal to the distance threshold, write the business data corresponding to the target NFC business scenario into the first NFC module.
[0194] It should be noted that the description of the processing method of the near field communication NFC service applied to the second electronic device provided in the embodiment of the present application can refer to the relevant description of the processing method of the near field communication NFC service applied to the first electronic device provided in the above embodiments, and will not be repeated here.
[0195] In an embodiment of the present application, the first electronic device can directly write business data to the first NFC module according to the target NFC business scenario. When the first electronic device is close to the second electronic device, the first electronic device can control the first NFC module to be in card emulation mode according to the first NFC instruction sent by the second electronic device, thereby automatically switching the mode of the first NFC module, so that the second electronic device can read the business data from the first NFC module and perform NFC business, which simplifies the interaction process of NFC business between multiple electronic devices, and can ensure the normal progress of NFC business between electronic devices with different operating systems and / or different manufacturers, thereby improving the success rate and scope of application of NFC business.
[0196] like Fig.10As shown, in one embodiment, a near field communication NFC service processing device 1000 is provided, which can be applied to the above-mentioned first electronic device. The near field communication NFC service processing device 1000 includes a service scenario determination module 1010, a writing module 1020, an NFC receiving module 1030 and an NFC control module 1040.
[0197] The service scenario determination module 1010 is used to determine a target NFC service scenario in which the first electronic device is located.
[0198] The writing module 1020 is used to write the service data corresponding to the target NFC service scenario into the first NFC module.
[0199] The NFC receiving module 1030 is used to receive a first NFC instruction sent by the second electronic device when it is detected that the second electronic device is close to the first electronic device; the first NFC instruction is a user-defined NFC instruction.
[0200] The NFC control module 1040 is used to control the first NFC module to be in a card emulation mode in response to the first NFC instruction, so that the second electronic device reads the service data from the first NFC module and performs an NFC service corresponding to the target NFC service scenario according to the service data.
[0201] In one embodiment, the NFC control module 1040 is further used to control the first NFC module to enter a silent state; the silent state refers to a state in which the first NFC module monitors the first NFC instruction and does not send an NFC instruction.
[0202] In one embodiment, the NFC control module 1040 is further configured to control the first NFC module to enter a silent state when detecting that the second electronic device is close to the first electronic device.
[0203] In one embodiment, the NFC control module 1040 is further used to control the first NFC module to enter a first polling mode, where the first polling mode refers to a mode in which the first NFC module only sends a target polling instruction, where the target polling instruction is used to discover electronic devices that support the NFC function and to prevent the discovered electronic devices from entering a card simulation interaction process; and to control the first NFC module to stop sending the target polling instruction when it is detected that the second electronic device is close to the first electronic device.
[0204] In one embodiment, the NFC control module 1040 is further configured to control the first NFC module to stop sending the target polling instruction when it is detected that the second electronic device is close to the first electronic device.
[0205] In one embodiment, the target polling instruction includes a Type V polling instruction, or a single carrier signal.
[0206] In one embodiment, the NFC control module 1040 is further used to control the first NFC module to switch from the first polling mode to the second polling mode when the exit condition is met, and the second polling mode refers to a mode in which the first NFC mode sends polling instructions of multiple NFC card types in turn; the multiple NFC card types include multiple types of Type A, Type B, Type F and Type V.
[0207] In one embodiment, the service scenario determination module 1010 is used to determine, in response to a service triggering operation, a target NFC service scenario corresponding to the NFC service triggered by the first electronic device.
[0208] In one embodiment, the writing module 1020 is further used to register an NFC event based on the NFC service triggered by the first electronic device; based on the NFC event, write the service data corresponding to the target NFC service scenario into the first NFC module.
[0209] In one embodiment, the business scenario determination module 1010 is also used to receive a first Bluetooth signal sent by a second electronic device; the first Bluetooth signal is sent by the second electronic device in response to a business triggering operation; the first Bluetooth signal carries a first identifier, and the first identifier is used to identify a target NFC business scenario corresponding to the NFC business triggered by the second electronic device; and is used to determine the target NFC business scenario based on the first identifier carried by the first Bluetooth signal.
[0210] In one embodiment, the device 1000 for processing near field communication (NFC) services further includes a distance measurement module.
[0211] The distance measuring module is used to determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal.
[0212] The writing module 1020 is further configured to write the service data corresponding to the target NFC service scenario into the first NFC module when the distance is less than or equal to the distance threshold.
[0213] In one embodiment, the NFC control module 1040 is further used to control the first NFC module to turn off the reader / writer mode and be in the card emulation mode only.
[0214] In an embodiment of the present application, the first electronic device can directly write business data to the first NFC module according to the target NFC business scenario. When the first electronic device is close to the second electronic device, the first electronic device can control the first NFC module to be in card emulation mode according to the first NFC instruction sent by the second electronic device, thereby automatically switching the mode of the first NFC module, so that the second electronic device can read the business data from the first NFC module and perform NFC business, which simplifies the interaction process of NFC business between multiple electronic devices, and can ensure the normal progress of NFC business between electronic devices with different operating systems and / or different manufacturers, thereby improving the success rate and scope of application of NFC business.
[0215] like Fig.11 As shown, in one embodiment, a near field communication NFC service processing device 1100 is provided, which can be applied to the above-mentioned second electronic device. The near field communication NFC service processing device 1100 may include an NFC sending module 11110 and a reading module 1120.
[0216] The NFC sending module 1110 is used to send a first NFC instruction through a second NFC module, where the first NFC instruction is a customized NFC instruction, so that when the second electronic device is close to the first electronic device, the first electronic device receives the first NFC instruction and controls the first NFC module in the first electronic device to be in a card emulation mode in response to the first NFC instruction; the first NFC module stores business data corresponding to a target NFC business scenario; the business data is written into the first NFC module when the first electronic device determines that it is in the target NFC business scenario.
[0217] The reading module 1120 is used to read the service data from the first NFC module through the second NFC module, and perform the NFC service corresponding to the target NFC service scenario according to the service data.
[0218] In one embodiment, the device 1100 for processing near field communication (NFC) services further includes a Bluetooth sending module.
[0219] The Bluetooth sending module is used to determine, in response to a service triggering operation, a target NFC service scenario corresponding to the NFC service triggered by the second electronic device; based on the target NFC service scenario, send a first Bluetooth signal, the first Bluetooth signal carries a first identifier, and the first identifier is used to identify the target NFC service scenario.
[0220] In one embodiment, the first Bluetooth signal is used to instruct the first electronic device to determine the distance between the first electronic device and the second electronic device based on the signal strength of the first Bluetooth signal, and when the distance is less than or equal to the distance threshold, write the business data corresponding to the target NFC business scenario into the first NFC module.
[0221] In an embodiment of the present application, the first electronic device can directly write business data to the first NFC module according to the target NFC business scenario. When the first electronic device is close to the second electronic device, the first electronic device can control the first NFC module to be in card emulation mode according to the first NFC instruction sent by the second electronic device, thereby automatically switching the mode of the first NFC module, so that the second electronic device can read the business data from the first NFC module and perform NFC business, which simplifies the interaction process of NFC business between multiple electronic devices, and can ensure the normal progress of NFC business between electronic devices with different operating systems and / or different manufacturers, thereby improving the success rate and scope of application of NFC business.
[0222] Fig.12 FIG. 1 is a structural block diagram of an electronic device in an embodiment. Fig.12 As shown, the electronic device 1200 may include one or more of the following components: a processor 1210, a memory 1220 coupled to the processor 1210, and a transceiver unit 1230, wherein the memory 1220 may store one or more computer programs, and the one or more computer programs may be configured to be executed by one or more processors 1210, so that the electronic device 1200 implements the processing method of the near field communication NFC service applied to the first electronic device as described in the above embodiments.
[0223] The processor 1210 may include one or more processing cores. The processor 1210 uses various interfaces and lines to connect various parts of the entire electronic device 1200, and executes various functions and processes data of the electronic device 1200 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1220, and calling data stored in the memory 1220. Optionally, the processor 1210 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 1210 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1210, but may be implemented separately through a communication chip.
[0224] The memory 1220 may include a random access memory (RAM) or a read-only memory (ROM). The memory 1220 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 1220 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the electronic device 1200 during use, etc.
[0225] The transceiver unit 1230 may include at least an NFC module. Further, the transceiver unit 1230 may also include but not limited to a Bluetooth module, a Wi-Fi module, etc., which can be used to provide communication functions.
[0226] An embodiment of the present application discloses an electronic device, including a memory, a processor, and a transceiver unit. The memory stores a computer program. When the computer program is executed by the processor, the headset device implements the processing method of the near field communication NFC service applied to the second electronic device as described in the above embodiments.
[0227] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor in an electronic device, the electronic device implements a method for processing a near field communication (NFC) service applied to a first electronic device as described in the above embodiments.
[0228] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor in an electronic device, the electronic device implements a method for processing a near field communication (NFC) service applied to a second electronic device as described in the above embodiments.
[0229] An embodiment of the present application discloses a computer program product, which includes a computer program. When the computer program can be executed by a processor in an electronic device, the electronic device implements a processing method for a near field communication (NFC) service applied to a first electronic device as described in the above embodiments.
[0230] An embodiment of the present application discloses a computer program product, which includes a computer program. When the computer program can be executed by a processor in an electronic device, the electronic device implements a method for processing a near field communication (NFC) service applied to a second electronic device as described in the above embodiments.
[0231] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a ROM, etc.
[0232] As used herein, any reference to memory, storage, database, or other medium may include nonvolatile and / or volatile memory. Suitable nonvolatile memory may include ROM, programmable ROM (Programmable ROM, PROM), erasable PROM (Erasable PROM, EPROM), electrically erasable PROM (Electrically Erasable PROM, EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which is used as an external cache memory. By way of illustration and not limitation, RAM may be in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), memory bus direct RAM (RDRAM) and direct memory bus dynamic RAM (DRDRAM).
[0233] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application. It should be noted that "multiple" in the present application includes "two or more".
[0234] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0235] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0236] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0237] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0238] The above is a detailed introduction to a method, device and electronic device for processing a near field communication NFC service disclosed in an embodiment of the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for processing a near field communication (NFC) service, characterized in that: Applied to a first electronic device, the first electronic device includes a first NFC module, and the method includes: Determining a target NFC service scenario in which the first electronic device is located; Writing the service data corresponding to the target NFC service scenario into the first NFC module; When detecting that the second electronic device is close to the first electronic device, receiving a first NFC instruction sent by the second electronic device; the first NFC instruction is a custom NFC instruction; In response to the first NFC instruction, the first NFC module is controlled to be in a card emulation mode, so that the second electronic device reads the service data from the first NFC module and performs an NFC service corresponding to the target NFC service scenario according to the service data.
2. The method according to claim 1, characterized in that Before receiving the first NFC instruction sent by the second electronic device, the method further includes: The first NFC module is controlled to enter a silent state; the silent state refers to a state in which the first NFC module monitors a first NFC instruction and does not send an NFC instruction.
3. The method according to claim 2, characterized in that The controlling the first NFC module to enter a silent state includes: When it is detected that the second electronic device is close to the first electronic device, the first NFC module is controlled to enter a silent state.
4. The method according to any one of claims 1 to 3, characterized in that: After determining the target NFC service scenario in which the first electronic device is located, the method further includes: Controlling the first NFC module to enter a first polling mode, where the first polling mode refers to a mode in which the first NFC module only sends a target polling instruction, where the target polling instruction is used to discover electronic devices supporting the NFC function and prevent the discovered electronic devices from entering a card simulation interaction process; The method further comprises: When it is detected that the second electronic device is close to the first electronic device, the first NFC module is controlled to stop sending the target polling instruction.
5. The method according to claim 4, characterized in that The target polling instruction includes a Type V polling instruction or a single carrier signal.
6. The method according to claim 4, characterized in that The method further comprises: When an exit condition is met, controlling the first NFC module to switch from the first polling mode to a second polling mode, where the second polling mode refers to a mode in which the first NFC mode sends polling instructions of multiple NFC card types in turn; The multiple NFC card types include multiple types of Type A, Type B, Type F, and Type V.
7. The method according to any one of claims 1 to 3, 5 to 6, characterized in that: The determining a target NFC service scenario in which the first electronic device is located includes: In response to the service triggering operation, a target NFC service scenario corresponding to the NFC service triggered by the first electronic device is determined.
8. The method according to claim 7, characterized in that The step of writing the service data corresponding to the target NFC service scenario into the first NFC module includes: Registering an NFC event based on the NFC service triggered by the first electronic device; Based on the NFC event, business data corresponding to the target NFC business scenario is written into the first NFC module.
9. The method according to any one of claims 1 to 3, 5 to 6, characterized in that: The determining a target NFC service scenario in which the first electronic device is located includes: Receiving a first Bluetooth signal sent by a second electronic device; the first Bluetooth signal is sent by the second electronic device in response to a service triggering operation; the first Bluetooth signal carries a first identifier, and the first identifier is used to identify a target NFC service scenario corresponding to the NFC service triggered by the second electronic device; The target NFC service scenario is determined according to the first identifier carried by the first Bluetooth signal.
10. The method according to claim 9, characterized in that Before writing the service data corresponding to the target NFC service scenario into the first NFC module, the method includes: determining a distance between the first electronic device and the second electronic device according to a signal strength of the first Bluetooth signal; The step of writing the service data corresponding to the target NFC service scenario into the first NFC module includes: When the distance is less than or equal to a distance threshold, the service data corresponding to the target NFC service scenario is written into the first NFC module.
11. The method according to any one of claims 1 to 3, 5 to 6, characterized in that: The controlling the first NFC module to be in a card emulation mode includes: The first NFC module is controlled to turn off the reader / writer mode and be in the card emulation mode only.
12. A method for processing a near field communication (NFC) service, characterized in that: Applied to a second electronic device, the second electronic device includes a second NFC module, and the method includes: The first NFC instruction is sent through the second NFC module, and the first NFC instruction is a customized NFC instruction, so that when the second electronic device is close to the first electronic device, the first electronic device receives the first NFC instruction and controls the first NFC module in the first electronic device to be in a card emulation mode in response to the first NFC instruction; the first NFC module stores business data corresponding to a target NFC business scenario; the business data is written into the first NFC module when the first electronic device determines that it is in the target NFC business scenario; The service data is read from the first NFC module through the second NFC module, and the NFC service corresponding to the target NFC service scenario is performed according to the service data.
13. The method according to claim 12, characterized in that Before sending the first NFC instruction through the second NFC module, the method further includes: In response to the service triggering operation, determining a target NFC service scenario corresponding to the NFC service triggered by the second electronic device; Based on the target NFC service scenario, a first Bluetooth signal is sent, where the first Bluetooth signal carries a first identifier, and the first identifier is used to identify the target NFC service scenario.
14. The method according to claim 13, characterized in that The first Bluetooth signal is used to instruct the first electronic device to determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal, and to write the business data corresponding to the target NFC business scenario into the first NFC module when the distance is less than or equal to a distance threshold.
15. A device for processing near field communication (NFC) services, characterized in that: Applied to a first electronic device, the first electronic device includes a first NFC module, and the device includes: A service scenario determination module, configured to determine a target NFC service scenario in which the first electronic device is located; A writing module, used to write the service data corresponding to the target NFC service scenario into the first NFC module; An NFC receiving module, configured to receive a first NFC instruction sent by the second electronic device when detecting that the second electronic device is close to the first electronic device; the first NFC instruction is a user-defined NFC instruction; The NFC control module is used to control the first NFC module to be in a card emulation mode in response to the first NFC instruction, so that the second electronic device reads the service data from the first NFC module and performs the NFC service corresponding to the target NFC service scenario according to the service data.
16. A device for processing near field communication (NFC) services, characterized in that: Applied to a second electronic device, the second electronic device includes a second NFC module, and the device includes: an NFC sending module, configured to send a first NFC instruction through the second NFC module, wherein the first NFC instruction is a user-defined NFC instruction, so that when the second electronic device is close to the first electronic device, the first electronic device receives the first NFC instruction and controls the first NFC module in the first electronic device to be in a card emulation mode in response to the first NFC instruction; the first NFC module stores business data corresponding to a target NFC business scenario; the business data is written into the first NFC module when the first electronic device determines that it is in the target NFC business scenario; The reading module is used to read the service data from the first NFC module through the second NFC module, and perform the NFC service corresponding to the target NFC service scenario according to the service data.
17. An electronic device, characterized in that: The electronic device comprises a memory, a processor and a transceiver unit. The memory stores a computer program. When the computer program is executed by the processor, the electronic device implements the method according to any one of claims 1 to 11 or 12 to 14.
18. A computer program product, characterized in that The method comprises a computer program, and when the computer program is executed by a processor in an electronic device, the electronic device implements the method according to any one of claims 1 to 11 or 12 to 14.
Citation Information
Cited By
Payment method, payment card and related device
CN120725669A
