Near field communication (NFC) module state switching method and device and electronic equipment

By receiving Bluetooth signals, determining the distance between devices and switching the NFC module status, the problem of failure of switching NFC module status between devices of different manufacturers is solved, and the normal progress and success rate of cross-vendor NFC services are achieved.

CN119254273APending Publication Date: 2025-01-03GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411358951.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

Technical Problem

The state switching of existing electronic devices in NFC module between different manufacturers fails, resulting in the inability to carry out NFC services normally, especially due to the lack of unified NFC standard instructions, devices of different manufacturers cannot trigger the NFC interaction process normally.

Method used

By receiving the Bluetooth signal sent by the second electronic device, the distance between devices is determined according to the signal strength, and the status of the first NFC module is automatically switched to ensure that the NFC module performs business operations in an appropriate working mode.

Benefits of technology

It improves the accuracy and flexibility of state switching of NFC modules, ensures the normal progress of NFC services between electronic devices of different manufacturers and operating systems, and improves the success rate of NFC services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254273A_ABST
    Figure CN119254273A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a state switching method and device of a near field communication (NFC) module and electronic equipment. The method is applied to a first electronic device, the first electronic device comprises a first NFC module, and the method comprises the following steps: receiving a first Bluetooth signal sent by a second electronic device; determining the distance between the first electronic equipment and the second electronic equipment according to the signal intensity of the first Bluetooth signal; and switching the state of the first NFC module according to the distance. According to the state switching method and device of the NFC module and the electronic equipment, the first electronic equipment can automatically switch the state of the first NFC module according to the first Bluetooth signal sent by the second electronic equipment, so that the accuracy and flexibility of state switching of the NFC module are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a state switching method, device and electronic device of a near field communication (NFC) module. Background Art

[0002] In order to improve the convenience of users' lives, most electronic devices on the market have NFC (Near Field Communication) functions, so as to realize NFC-based mobile payment, access card swiping, identity recognition and other applications. At present, the state switching of the NFC module of an electronic device mainly depends on the NFC interaction process with the other electronic device, such as switching states according to the NFC card search command and NFC response command sent by the other electronic device. However, electronic devices may not be able to trigger the NFC interaction process normally, especially for electronic devices from different manufacturers. The NFC interaction process often cannot be triggered normally, resulting in the failure of the state switching of the NFC module. Summary of the invention

[0003] The embodiments of the present application disclose a method and device for switching the state of a near field communication NFC module, a method and device for sending a signal, an electronic device, and a program product. A first electronic device can automatically switch the state of a first NFC module according to a first Bluetooth signal sent by a second electronic device, thereby improving the accuracy and flexibility of the NFC module state switching.

[0004] The present application embodiment discloses a state switching method of a near field communication (NFC) module, which is applied to a first electronic device, wherein the first electronic device includes a first NFC module. The method includes:

[0005] receiving a first Bluetooth signal sent by a second electronic device;

[0006] determining a distance between the first electronic device and the second electronic device according to a signal strength of the first Bluetooth signal;

[0007] The state of the first NFC module is switched according to the distance.

[0008] The present application embodiment discloses a signal sending method, which is applied to a second electronic device, and the method includes:

[0009] In response to a service triggering operation, determining that the second electronic device is in a target NFC service scenario;

[0010] A first Bluetooth signal is sent, where the first Bluetooth signal carries a first identifier, where the first identifier is used to characterize that the second electronic device is in the target NFC business scenario, so that the first electronic device that receives the first Bluetooth signal determines the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal, and switches the state of the first NFC module according to the distance.

[0011] The embodiment of the present application discloses a state switching device of a near field communication (NFC) module, which is applied to a first electronic device, wherein the first electronic device includes a first NFC module, and the device includes:

[0012] A Bluetooth receiving module, used for receiving a first Bluetooth signal sent by a second electronic device;

[0013] a distance measuring module, configured to determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal;

[0014] A state switching module is used to switch the state of the first NFC module according to the distance.

[0015] The embodiment of the present application discloses a signal sending device, which is applied to a second electronic device, and the device includes:

[0016] A scenario determination module, configured to determine, in response to a service triggering operation, that the second electronic device is in a target NFC service scenario;

[0017] The Bluetooth sending module is used to send a first Bluetooth signal, where the first Bluetooth signal carries a first identifier, and the first identifier is used to indicate that the second electronic device is in the target NFC business scenario, so that the first electronic device that receives the first Bluetooth signal can determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal, and switch the state of the first NFC module according to the distance.

[0018] 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.

[0019] 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.

[0020] 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.

[0021] The embodiments of the present application disclose a state switching method and device for a near field communication NFC module, a signal sending method and device, an electronic device, and a program product. A first electronic device receives a first Bluetooth signal sent by a second electronic device, determines the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal, and switches the state of the first NFC module according to the distance. The first electronic device can automatically switch the state of the first NFC module according to the first Bluetooth signal sent by the second electronic device, thereby improving the accuracy and flexibility of the NFC module state switching, and can ensure the normal progress of the NFC business between the first electronic device and the second electronic device, thereby improving the success rate of the NFC business. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] 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.

[0023] Figure 1 This is an application scenario diagram of a method for switching the state of a near field communication NFC module in an embodiment;

[0024] Figure 2 A flowchart of a method for switching the state of a near field communication NFC module in one embodiment;

[0025] Figure 3 is a flow chart of a method for switching the state of a near field communication NFC module in another embodiment;

[0026] Figure 4 is a system architecture diagram of a first electronic device in an embodiment;

[0027] Figure 5 is a flow chart of a method for switching the state of a near field communication NFC module in another embodiment;

[0028] Figure 6 is a timing diagram of a state switching method of a near field communication NFC module in one embodiment;

[0029] Figure 7 It is a flowchart of performing smoothing processing on the first distances determined multiple times in one embodiment, and judging whether to exit the first polling mode according to the result after the smoothing processing;

[0030] Figure 8 is a flow chart of a signal sending method in one embodiment;

[0031] Fig. 9 A block diagram of a state switching device of a near field communication NFC module in one embodiment;

[0032] Fig.10 is a block diagram of a signal sending device in one embodiment;

[0033] Fig.11 FIG. 4 is a structural block diagram of an electronic device in an embodiment. DETAILED DESCRIPTION

[0034] 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.

[0035] 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.

[0036] 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.

[0037] The following are some explanations and descriptions of some terms that may be involved in this application:

[0038] NFC: It is an emerging technology that allows electronic devices to exchange data when they are close to each other.

[0039] 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.

[0040] Card Emulation (CE) mode: The NFC device is simulated as an NFC card and can communicate with the reader / writer.

[0041] 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.

[0042] 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).

[0043] 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.

[0044] Type F: NFC-F is a type of NFC card defined in the FeliCa protocol of the NFC standard.

[0045] 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.

[0046] Polling mode: The NFC device generates a carrier wave or a polling command to discover nearby NFC devices or NFC cards.

[0047] 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.

[0048] UUID (Universally Unique Identifier): used to identify the signal type of Bluetooth signal.

[0049] BLE (Bluetooth Low Energy): A personal area network technology launched by the Bluetooth Technology Alliance, which has the advantages of low power consumption and low cost.

[0050] At present, electronic devices from some manufacturers on the market can achieve "touch and pay" interaction with 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 touch and pay interaction instruction, the two electronic devices cannot recognize each other and cannot trigger the "touch and pay" 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 business between the two electronic devices.

[0051] The state switching method, device, electronic device, and program product of the near field communication NFC module disclosed in the embodiments of the present application improve the accuracy and flexibility of the NFC module state switching, and can ensure the normal progress of the NFC business between the first electronic device and the second electronic device, thereby improving the success rate of the NFC business.

[0052] Figure 1 FIG. 1 is an application scenario diagram of a method for switching the state of a near field communication NFC module in an embodiment. Figure 1 As shown, the state switching method of the near field communication NFC module can be applied to the first electronic device 110. 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.

[0053] The first electronic device 110 may include a first NFC module.

[0054] The second electronic device 120 may send a first Bluetooth signal, and the first electronic device 110 may receive the first Bluetooth signal, and determine the distance between the first electronic device 110 and the second electronic device 120 according to the signal strength of the first Bluetooth signal. The first electronic device 110 may switch the state of the first NFC module according to the distance.

[0055] In some embodiments, 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 is not limited thereto.

[0056] The second electronic device 120 may include a second NFC module, and the first electronic device 110 and the second electronic device 120 may perform NFC communication and NFC services.

[0057] In some embodiments, the second electronic device 120 may be the initiator of the NFC service. When the second electronic device 120 triggers the NFC service, the second electronic device 120 may send a first Bluetooth signal. The first electronic device 110 may determine the distance between itself and the second electronic device 120 based on the received first Bluetooth signal, and switch the state of the first NFC module based on the distance, thereby ensuring that the subsequent NFC service between the first electronic device 110 and the second electronic device 120 proceeds normally, thereby enabling NFC services to be carried out between electronic devices of different manufacturers and / or different operating systems.

[0058] like Figure 2 As shown, in one embodiment, a method for switching the state of a near field communication (NFC) module is provided, which can be applied to the first electronic device mentioned above. The method may include the following steps:

[0059] Step 210: Receive a first Bluetooth signal sent by a second electronic device.

[0060] The first electronic device receives a first Bluetooth signal sent by the second electronic device, where the first Bluetooth signal may be a Bluetooth signal that triggers the first electronic device to determine the distance between the first electronic device and the second electronic device and to switch the state of the first NFC module.

[0061] In some embodiments, the first Bluetooth signal may include a BLE broadcast signal. The first electronic device may scan the BLE broadcast signal sent by the second electronic device.

[0062] In some embodiments, the first Bluetooth signal may be sent by the second electronic device when it needs to perform NFC interaction with the first electronic device. Further, the second electronic device may send the first Bluetooth signal when it is in the target NFC business scenario, and the first Bluetooth signal may be used to indicate that the second electronic device is in the target NFC business scenario.

[0063] NFC business scenarios can be used to characterize the business types of NFC business to be carried out between multiple electronic devices. For example, 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 may be one of the NFC business scenarios.

[0064] 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.

[0065] 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.

[0066] The payment scenario may refer to a scenario in which payment is implemented based on NFC technology, in which an electronic device at one end may simulate an NFC card with payment function, such as a bank card, subway card, etc., and an electronic device at the other end may swipe the simulated NFC card to implement payment services.

[0067] 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.

[0068] 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.

[0069] 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.

[0070] 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.

[0071] In an embodiment of the present application, the second electronic device may be the service initiator of the NFC service, that is, the NFC service may be triggered on the 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.

[0072] In some embodiments, the first Bluetooth signal may carry a first identifier, and the first identifier may be used to indicate that the second electronic device is in a target NFC business scenario, and the first identifier may identify the target NFC business scenario.

[0073] 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.

[0074] 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.

[0075] The first electronic device can receive the first Bluetooth signal sent by the second electronic device, and can determine the target NFC business scenario according to the first identifier carried by the first Bluetooth signal, thereby triggering subsequent NFC state switching and other processes.

[0076] In some embodiments, the second electronic device may determine that the second electronic device is in a target NFC service scenario in response to a service triggering operation, and send a first Bluetooth signal carrying a first identifier, where the first Bluetooth signal is used to indicate that the second electronic device is in the target NFC service scenario.

[0077] The service triggering operation may include but is not limited to the operation of triggering the second 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.

[0078] The second electronic device can determine, according to the service triggering operation, a target NFC service scenario corresponding to the NFC service triggered by the second electronic device, and the NFC service triggered by the second electronic device is the NFC service to be performed.

[0079] In some embodiments, the first Bluetooth signal may include a BLE 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.

[0080] 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.

[0081] 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.

[0082] Step 220: Determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal.

[0083] 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 may be.

[0084] Optionally, each time the first electronic device receives a first Bluetooth signal, it may determine the distance between the first electronic device and the second electronic device based on the signal strength of the received first Bluetooth signal. Optionally, after receiving multiple first Bluetooth signals, the first electronic device may determine the distance between the first electronic device and the second electronic device based on the signal strengths corresponding to the multiple first Bluetooth signals. For example, the signal strengths corresponding to the multiple first Bluetooth signals may be averaged, or the signal strengths corresponding to the multiple first Bluetooth signals may be weighted and calculated, and the distance between the first electronic device and the second electronic device may be determined based on the calculated signal strength. It should be noted that the specific method of calculating the distance between two electronic devices based on the signal strength of the first Bluetooth signal is not limited here.

[0085] In some embodiments, when a first electronic device receives a first Bluetooth signal sent by a second electronic device, it may first determine whether the first Bluetooth signal carries a first identifier, and when it is determined that the first Bluetooth signal carries the first identifier, determine the distance between the first electronic device and the second electronic device based on the signal strength of the first Bluetooth signal.

[0086] When the first Bluetooth signal carries the first identifier, the first electronic device can determine that it is currently in the target NFC business scenario corresponding to the first identifier, and will most likely conduct NFC business with the second electronic device that sends the first Bluetooth signal. Therefore, 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, and the state of the first NFC module can be switched based on the distance, thereby ensuring the normal progress of subsequent NFC business.

[0087] Step 230: Switch the state of the first NFC module according to the distance.

[0088] The state of the first NFC module may refer to the state of the first NFC module sending and receiving information. Optionally, the state of the first NFC module may include an operating mode of the first NFC module, and the first NFC module may be controlled to switch between a reader / writer mode and a card emulation mode according to the distance between the first NFC module and the second electronic device.

[0089] Optionally, the state of the first NFC module may also be a state in which the first NFC module sends different NFC instructions, such as a state in which the first NFC module sends polling instructions of different NFC types.

[0090] In some embodiments, the first electronic device can determine whether the distance between the first electronic device 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 first electronic device is likely to conduct NFC business with the second electronic device. The first electronic device can control the first NFC module to switch to a target state. The target state can be a state in which the first NFC module can accurately perform an NFC interaction process with the second NFC module of the second electronic device. For example, the target state can be a state in which the NFC interaction process is only performed with the second NFC module of the second electronic device, but is not limited to this.

[0091] In some embodiments, after the first electronic device controls the first NFC module to switch to the target state, it can continue to receive the first Bluetooth signal sent by the second electronic device, continue to monitor the distance between the first electronic device and the second electronic device, and determine whether to control the first NFC module to exit the target state based on the distance. For example, when the distance between the first electronic device and the second electronic device is greater than the distance threshold, it means that the first electronic device and the second electronic device are far away and it is unlikely to continue the NFC business, then the first NFC module can be controlled to exit the target state, and the first NFC module after exiting the target state can normally exchange information with other NFC devices or NFC tags, so as to meet the different usage needs of users and improve the user experience.

[0092] In an embodiment of the present application, a first electronic device receives a first Bluetooth signal sent by a second electronic device, determines a distance between the first electronic device and the second electronic device based on a signal strength of the first Bluetooth signal, and switches a state of the first NFC module based on the distance. The first electronic device can automatically switch the state of the first NFC module based on the first Bluetooth signal sent by the second electronic device, thereby improving the accuracy and flexibility of the NFC module state switching, and can ensure the normal progress of the NFC service between the first electronic device and the second electronic device, thereby improving the success rate of the NFC service.

[0093] like Figure 3 As shown, in another embodiment, a method for switching the state of a near field communication (NFC) module is provided, which can be applied to the first electronic device mentioned above. The method may include the following steps:

[0094] Step 302: Receive a first Bluetooth signal sent by a second electronic device.

[0095] In some embodiments, the first electronic device may register a receiver corresponding to the first Bluetooth signal, and the receiver may be used to monitor the first Bluetooth signal. Furthermore, an application of the first electronic device (such as an application supporting the NFC function) may register a receiver corresponding to the first Bluetooth signal, and the type of Bluetooth signal to be monitored may be configured when registering the receiver. For example, the type of Bluetooth signal to be monitored may be configured as a Bluetooth signal carrying a first identifier, and the application identifier of the application may be transmitted to the Bluetooth module, such as the package name or number of the application, so that after the Bluetooth module determines that the received first Bluetooth signal has been processed, it needs to be reported to the application.

[0096] As a specific implementation, the application of the first electronic device can call a registration interface to register a receiver corresponding to the first Bluetooth signal, and can set a scanFilter to the registration interface to notify the Bluetooth module of the type of Bluetooth signal to be monitored. The application identifier of the application can also be passed to the Bluetooth module through the registration interface. Furthermore, callback content can also be configured, and the callback content can be used to indicate the content that the Bluetooth module needs to report to the application, such as the signal strength of the first Bluetooth signal, the distance mapped by the signal strength, the signal content of the first Bluetooth signal, etc., but not limited to this.

[0097] For example, Figure 4 FIG. 1 is a system architecture diagram of a first electronic device in an embodiment. Figure 4 As shown, after the application layer of the first electronic device registers the receiver corresponding to the first Bluetooth signal, it can keep monitoring the callback of the Bluetooth module. Based on the registered receiver, the Bluetooth module can scan the first Bluetooth signal carrying the first identifier. After the Bluetooth module receives the first Bluetooth signal, the binder thread can process the received first Bluetooth signal, for example, it can determine the mapping distance according to the signal strength of the first Bluetooth signal, and upload the callback content to the application through the GATT (Generic Attribute Profile) of the framework layer, the adapter, etc.

[0098] In some embodiments, the application of the first electronic device may register the receiver corresponding to the first Bluetooth signal in a dynamic registration manner, wherein dynamic registration refers to a registration manner performed as required when the application is running.

[0099] In this implementation, by registering the receiver corresponding to the first Bluetooth signal, the first Bluetooth signal can be accurately received and the corresponding callback content can be obtained, and the signal content of the first Bluetooth signal can be easily parsed, thereby facilitating information transmission between the two parties. Moreover, the dynamic registration method is adopted to facilitate the cancellation of the monitoring when the first Bluetooth signal does not need to be scanned, which can reduce unnecessary overhead.

[0100] Step 304: When it is determined that the first Bluetooth signal carries the first identifier and the second identifier, determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal.

[0101] In some embodiments, in order to improve the accuracy of identifying the first Bluetooth signal, the first Bluetooth signal may also carry 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.

[0102] Exemplarily, the second identifier may also be a customized identifier. Different NFC interaction scenarios may correspond to the same second identifier. For example, the second identifier may be 0x1122334455 or 0x5544332211, etc., but is not limited thereto.

[0103] In some embodiments, the second identifier is located in the device name field of the first Bluetooth signal, for example, the second identifier may be located in the local name field of the first Bluetooth signal. Optionally, the device name field may also include a device identifier of the second electronic device, such as a device ID (Identity document) of the second electronic device, so that the first electronic device can accurately identify the identity of the second electronic device that sends the first Bluetooth signal, especially in a scenario where there are multiple second electronic devices sending the first Bluetooth signal, the device identifier can be used to accurately interact with each second electronic device for NFC services.

[0104] By carrying the second identifier in the device name field of the first Bluetooth number, BLE broadcast customization can be implemented in a limited BLE broadcast location, helping to more accurately identify the identity of the second electronic device sending the first Bluetooth signal, improve the accuracy of subsequent state switching of the first NFC module, and improve the accuracy of subsequent NFC services.

[0105] Step 306: Switch the state of the first NFC module according to the distance.

[0106] For the description of step 306 , reference may be made to the relevant description in the above embodiment, which will not be repeated here.

[0107] In the embodiment of the present application, by combining the first identifier with the second identifier, the first Bluetooth signal can be accurately identified and ranging can be performed based on the first Bluetooth signal, thereby triggering a subsequent NFC interaction process and improving the accuracy of NFC interaction.

[0108] like Figure 5 As shown, in another embodiment, a method for switching the state of a near field communication (NFC) module is provided, which can be applied to the first electronic device mentioned above. The method may include the following steps:

[0109] Step 502: Receive a first Bluetooth signal sent by a second electronic device.

[0110] Step 504: Determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal.

[0111] For the description of steps 502 to 504 , reference may be made to the relevant description in the above embodiment, which will not be repeated here.

[0112] Step 506: If the distance is less than or equal to the distance threshold, control the first NFC module to enter a first polling mode; the first polling mode refers to a mode in which the first NFC module only sends a target polling instruction.

[0113] The first electronic device can determine whether the distance between the first electronic device and the second electronic device is less than or equal to the distance threshold, and if the distance between the first electronic device and the second electronic device is less than or equal to the distance threshold, the first NFC module can be controlled to enter the first polling mode. The first polling mode refers to a mode in which 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 the card simulation interaction process.

[0114] 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.

[0115] 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.

[0116] 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 with the NFC standard protocol.

[0117] 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.

[0118] 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.

[0119] Furthermore, when the distance between the first electronic device and the second electronic device is less than or equal to the distance threshold, the first electronic device may modify the hardware parameters of the first NFC module, turn off 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 business data corresponding to the target NFC business scenario into the first NFC module.

[0120] 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.

[0121] Step 508: 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; the first NFC instruction is a user-defined NFC instruction.

[0122] 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.

[0123] Optionally, the first NFC instruction may be a Type V NFC instruction customized by a manufacturer of the second electronic device.

[0124] 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.

[0125] When the first electronic device receives the first Bluetooth signal and controls the first NFC module to be in the first polling mode, 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 that supports the NFC function is close to the first electronic device.

[0126] 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.

[0127] In some embodiments, when it is detected that the second electronic device is close to the first electronic device, the first NFC module can be controlled to stop sending the target polling instruction and 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.

[0128] 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 to the outside.

[0129] 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.

[0130] When the first electronic device detects that the second electronic device is approaching, the first electronic device can control the first NFC module 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 approaching the first electronic device, the first NFC module may not enter a silent state first, but only enter a silent state when the second electronic device is detected to be approaching 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.

[0131] In addition, 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.

[0132] Step 510: 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 according to the service data.

[0133] In some embodiments, when the distance between the first electronic device and the second electronic device is less than or equal to the distance threshold, the service data corresponding to the target NFC service scenario can be written to 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.

[0134] 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.

[0135] 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.

[0136] 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.

[0137] 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.

[0138] 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.

[0139] When the first electronic device receives the first NFC instruction sent by the 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 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.

[0140] 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.

[0141] 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.

[0142] 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.

[0143] In this implementation, when the first electronic device receives the first Bluetooth signal, that is, determines that it is in the target NFC business scenario, if the distance between the first electronic device and the second electronic device is less than the distance threshold, the business data can be written to the first NFC module. 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, simplifying the interaction process of NFC business between multiple electronic devices, and ensuring the normal operation 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.

[0144] For example, Figure 6 FIG. 1 is a timing diagram of a method for switching states of a near field communication NFC module in an embodiment. Figure 6As 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.

[0145] 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.

[0146] In an embodiment of the present application, when the first electronic device is in a target NFC business scenario and the distance between the first electronic device and the second electronic device is less than a distance threshold, the first NFC module can be controlled to enter a first polling mode. In this 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.

[0147] In some embodiments, the above method may further include: when the exit condition is met, the first electronic device may 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.

[0148] Furthermore, the multiple NFC card types may include multiple types of Type A, Type B, Type F, and Type V.

[0149] 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:

[0150] (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.

[0151] (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.

[0152] (3) The distance between the first electronic device and the second electronic device is greater than a distance threshold.

[0153] If the distance between the first electronic device and the second electronic device is greater than the distance threshold, the first NFC module can be controlled 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, etc., to meet NFC usage requirements in different scenarios.

[0154] 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 smooth the multiple determined distances, and determine whether to exit the first polling mode according to the smoothed result.

[0155] If the result after smoothing is greater than the target distance, the first NFC module may be controlled to switch from the first polling mode to the second polling mode. Optionally, the target distance 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.

[0156] Furthermore, a smoothing coefficient may be set, and based on the smoothing coefficient, the first distances determined multiple times are smoothed. If the result after smoothing is greater than the target distance, the first NFC module is controlled to switch from the first polling mode to the second polling mode; wherein the first distance is a distance greater than a distance threshold.

[0157] For example, Figure 7 As shown, performing smoothing on the first distances determined multiple times, and judging whether to exit the first polling mode according to the result of the smoothing, may include the following steps:

[0158] Step 702: a first distance greater than a distance threshold is detected for the first time.

[0159] Step 704: multiply the first distance by the smoothing coefficient to obtain a multiplication result.

[0160] Step 706 , determine whether the multiplication result is greater than the target distance, if so, execute step 708 , if not, execute step 710 .

[0161] Step 708: Control the first NFC module to switch from the first polling mode to the second polling mode.

[0162] Step 710, receiving the next determined distance.

[0163] Step 712, determine whether the distance determined next time is greater than the distance threshold, if so, execute step 714, if not, execute step 716.

[0164] Step 714 , multiply the multiplication result by the smoothing coefficient to obtain a new multiplication result, and continue to execute step 706 .

[0165] Step 716, clear the current multiplication result.

[0166] After the first electronic device determines the distance between itself and the second electronic device according to the signal strength of the received first Bluetooth signal each time, it can determine whether the distance is greater than the distance threshold, and if so, the distance is used as the first distance. If the first distance greater than the distance threshold is detected for the first time, the first distance greater than the distance threshold is detected for the first time, which may refer to the detection of the first distance greater than the distance threshold when there is no currently recorded multiplication result.

[0167] The first electronic device may multiply the first distance by the smoothing coefficient to obtain a multiplication result, and determine whether the multiplication result is greater than the target distance. If the multiplication result is greater than the target distance, it means that the second electronic device is really far away from the first electronic device, and the first NFC module may be controlled to exit the first polling mode and switch from the first polling mode to the second polling mode. If the multiplication result is not greater than the target distance, it means that the second electronic device is not necessarily really far away from the first electronic device, and it may be due to obstacles on the transmission path that cause the signal strength to be weak, and the multiplication result may be recorded.

[0168] When the first electronic device obtains the next determined distance between the first electronic device and the second electronic device, it can continue to determine whether the next determined distance is greater than the distance threshold. If it is greater than the distance threshold, the currently recorded multiplication result can be multiplied by the smoothing coefficient to obtain a new multiplication result, and it is continued to determine whether the multiplication result is greater than the target distance. If the next determined distance is not greater than the distance threshold, the current multiplication result can be cleared, and step 702 can be re-executed.

[0169] In this implementation, the first electronic device may smooth the distances determined multiple times, and determine whether to control the first NFC module to exit the first polling mode according to the result of the smoothing process, thereby improving the accuracy of controlling the state switching of the first NFC module.

[0170] 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.

[0171] In an embodiment of the present application, 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. 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 of the same manufacturer or the same operating system, etc., to meet NFC usage requirements in different scenarios.

[0172] like Figure 8 As shown, in one embodiment, a signal sending method is provided, which can be applied to the second electronic device mentioned above, and the method may include the following steps:

[0173] Step 810: In response to the service triggering operation, determine that the second electronic device is in a target NFC service scenario.

[0174] Step 820: Send a first Bluetooth signal, where the first Bluetooth signal carries a first identifier, where the first identifier is used to indicate that the second electronic device is in a target NFC business scenario, so that the first electronic device that receives the first Bluetooth signal 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 switch the state of the first NFC module based on the distance.

[0175] In some embodiments, the method may further include:

[0176] sending a first NFC instruction through the second NFC module, wherein 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;

[0177] The service data is read from the first NFC module through the second NFC module, and the NFC service is performed according to the service data.

[0178] 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 according to 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; the first polling mode refers to a mode in which the first NFC module only sends a target polling instruction, and the target polling instruction is used to discover electronic devices that support the NFC function and can prevent the discovered electronic devices from entering the card simulation interaction process.

[0179] It should be noted that the description of the signal sending method applied to the second electronic device provided in the embodiment of the present application can refer to the relevant description of the state switching method of the near field communication NFC module applied to the first electronic device provided in the above embodiments, and will not be repeated here.

[0180] In an embodiment of the present application, when the second electronic device is in a target NFC business scenario, the first electronic device can send a first Bluetooth signal carrying a first identifier, and the first electronic device receives the first Bluetooth signal sent by the second electronic device, determines the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal, and switches the state of the first NFC module according to the distance. The first electronic device can automatically switch the state of the first NFC module according to the first Bluetooth signal sent by the second electronic device, thereby improving the accuracy and flexibility of the NFC module state switching, and can ensure the normal progress of the NFC business between the first electronic device and the second electronic device, thereby improving the success rate of the NFC business.

[0181] like Fig. 9 As shown, in one embodiment, a state switching device 900 of a near field communication NFC module is provided, which can be applied to the above-mentioned first electronic device. The state switching device 900 of the near field communication NFC module includes a Bluetooth receiving module 910, a ranging module 920 and a state switching module 930.

[0182] The Bluetooth receiving module 910 is used to receive a first Bluetooth signal sent by a second electronic device.

[0183] The distance measuring module 920 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.

[0184] The state switching module 930 is used to switch the state of the first NFC module according to the distance.

[0185] In one embodiment, the first Bluetooth signal carries a first identifier, and the first identifier is used to indicate that the second electronic device is in a target NFC service scenario.

[0186] The distance measuring module 920 is further configured to determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal when it is determined that the first Bluetooth signal carries the first identifier.

[0187] In one embodiment, the first Bluetooth signal further carries a second identifier, and the second identifier is used to indicate that the second electronic device is in an NFC interaction scenario.

[0188] The distance measuring module 920 is further configured to determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal when it is determined that the first Bluetooth signal carries the first identifier and the second identifier.

[0189] In one embodiment, the first identifier includes a universal unique identifier UUID, and the second identifier is located in a device name field of the first Bluetooth signal.

[0190] In one embodiment, the state switching module 930 is further used to control the first NFC module to enter a first polling mode if the distance is less than or equal to a distance threshold; the first polling mode refers to a mode in which the first NFC module only sends a target polling instruction, and 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.

[0191] In one embodiment, the state switching device 900 of the near field communication NFC module further includes an NFC receiving module and an NFC control module.

[0192] The NFC receiving module 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.

[0193] 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 according to the service data.

[0194] In one embodiment, the NFC control module is further used to control the first NFC module to stop sending the target polling instruction and control the first NFC module to enter a silent state when detecting that the second electronic device is close to the first electronic device; the silent state refers to a state in which the first NFC module listens to the first NFC instruction and does not send the NFC instruction.

[0195] In one embodiment, the state switching module 930 is further used to control the first NFC module to switch from the first polling mode to the second polling mode if the distance between the first electronic device and the second electronic device is greater than the distance threshold, 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.

[0196] In one embodiment, the state switching module 930 is further used to smooth the distances determined multiple times, and if the result after smoothing is greater than the target distance, control the first NFC module to switch from the first polling mode to the second polling mode; wherein the target distance is determined according to the distance threshold.

[0197] In one embodiment, the state switching module 930 is further used to smooth the first distances determined multiple times according to a smoothing coefficient, and if the result after smoothing is greater than the target distance, control the first NFC module to switch from the first polling mode to the second polling mode; the first distance is a distance greater than a distance threshold.

[0198] In one embodiment, the state switching module 930 is further used to, when the first distance greater than the distance threshold is detected for the first time, multiply the first distance by the smoothing coefficient to obtain a multiplication result; determine whether the multiplication result is greater than the target distance; if the multiplication result is greater than the target distance, control the first NFC module to switch from the first polling mode to the second polling mode; if the multiplication result is not greater than the target distance, and the next determined distance is greater than the distance threshold, multiply the multiplication result by the smoothing coefficient to obtain a new multiplication result, and re-determine whether the multiplication result is greater than the target distance; and if the next determined distance is not greater than the distance threshold, clear the current multiplication result.

[0199] In one embodiment, the device 900 for switching the state of a near field communication NFC module further includes a registration module.

[0200] The registration module is used to register a receiver corresponding to the first Bluetooth signal in a dynamic registration manner, and the receiver is used to monitor the first Bluetooth signal.

[0201] In an embodiment of the present application, a first electronic device receives a first Bluetooth signal sent by a second electronic device, determines a distance between the first electronic device and the second electronic device based on a signal strength of the first Bluetooth signal, and switches a state of the first NFC module based on the distance. The first electronic device can automatically switch the state of the first NFC module based on the first Bluetooth signal sent by the second electronic device, thereby improving the accuracy and flexibility of the NFC module state switching, and can ensure the normal progress of the NFC service between the first electronic device and the second electronic device, thereby improving the success rate of the NFC service.

[0202] like Fig.10 As shown, in one embodiment, a signal sending device 1000 is provided, which can be applied to the above-mentioned second electronic device. The signal sending device 1000 may include a scene determination module 1010 and a Bluetooth sending module 1020.

[0203] The scenario determination module 1010 is used to determine, in response to a service triggering operation, whether the second electronic device is in a target NFC service scenario.

[0204] The Bluetooth sending module 1020 is used to send a first Bluetooth signal, which carries a first identifier. The first identifier is used to indicate that the second electronic device is in a target NFC business scenario, so that the first electronic device that receives the first Bluetooth signal can determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal, and switch the state of the first NFC module according to the distance.

[0205] In one embodiment, the signal sending device 1000 may further include an NFC sending module and a reading module.

[0206] The NFC sending module 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.

[0207] 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 according to the service data.

[0208] 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 according to 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; the first polling mode refers to a mode in which the first NFC module only sends a target polling instruction, and the target polling instruction is used to discover electronic devices that support the NFC function and can prevent the discovered electronic devices from entering the card simulation interaction process.

[0209] In an embodiment of the present application, when the second electronic device is in a target NFC business scenario, the first electronic device can send a first Bluetooth signal carrying a first identifier, and the first electronic device receives the first Bluetooth signal sent by the second electronic device, determines the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal, and switches the state of the first NFC module according to the distance. The first electronic device can automatically switch the state of the first NFC module according to the first Bluetooth signal sent by the second electronic device, thereby improving the accuracy and flexibility of the NFC module state switching, and can ensure the normal progress of the NFC business between the first electronic device and the second electronic device, thereby improving the success rate of the NFC business.

[0210] Fig.11 FIG. 1 is a structural block diagram of an electronic device in an embodiment. Fig.11 As shown, the electronic device 1100 may include one or more of the following components: a processor 1110, a memory 1120 coupled to the processor 1110, and a transceiver unit 1230, wherein the memory 1120 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 1110, so that the electronic device 1100 implements the state switching method of the near field communication NFC module applied to the first electronic device as described in the above embodiments.

[0211] The processor 1110 may include one or more processing cores. The processor 1110 uses various interfaces and lines to connect various parts of the entire electronic device 1100, and executes various functions and processes data of the electronic device 1100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1120, and calling data stored in the memory 1120. Optionally, the processor 1110 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 1110 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 1110, but may be implemented separately through a communication chip.

[0212] The memory 1120 may include a random access memory (RAM) or a read-only memory (ROM). The memory 1120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 1120 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 1100 during use, etc.

[0213] 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.

[0214] 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 headphone device implements the signal sending method applied to a second electronic device as described in the above embodiments.

[0215] 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 the state switching method of a near field communication NFC module applied to a first electronic device as described in the above embodiments.

[0216] 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 signal sending method applied to a second electronic device as described in the above embodiments.

[0217] 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 the state switching method of a near field communication NFC module applied to a first electronic device as described in the above embodiments.

[0218] 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 the signal sending method applied to a second electronic device as described in the above embodiments.

[0219] 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.

[0220] 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).

[0221] 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".

[0222] 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.

[0223] 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.

[0224] 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.

[0225] 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.

[0226] The above is a detailed introduction to a method, device and electronic device for switching the state of a near field communication NFC module disclosed in the embodiment of the present application. The principle and implementation method of the present application are described in detail using specific examples. 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 state switching method for a near field communication NFC module, characterized in that: Applied to a first electronic device, the first electronic device includes a first NFC module, and the method includes: receiving a first Bluetooth signal sent by a second electronic device; determining a distance between the first electronic device and the second electronic device according to a signal strength of the first Bluetooth signal; The state of the first NFC module is switched according to the distance.

2. The method according to claim 1, characterized in that The first Bluetooth signal carries a first identifier, and the first identifier is used to indicate that the second electronic device is in a target NFC service scenario; and determining the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal includes: When it is determined that the first Bluetooth signal carries the first identifier, the distance between the first electronic device and the second electronic device is determined according to the signal strength of the first Bluetooth signal.

3. The method according to claim 2, characterized in that The first Bluetooth signal also carries a second identifier, where the second identifier is used to indicate that the second electronic device is in an NFC interaction scenario; The determining, when determining that the first Bluetooth signal carries the first identifier, the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal includes: When it is determined that the first Bluetooth signal carries the first identifier and the second identifier, the distance between the first electronic device and the second electronic device is determined according to the signal strength of the first Bluetooth signal.

4. The method according to claim 3, characterized in that The first identifier includes a universal unique identifier UUID, and the second identifier is located in a device name field of the first Bluetooth signal.

5. The method according to claim 1, characterized in that The switching of the state of the first NFC module according to the distance includes: If the distance is less than or equal to the distance threshold, the first NFC module is controlled to enter a first polling mode; the first polling mode refers to a mode in which the first NFC module only sends a target polling instruction, and the target polling instruction is used to discover electronic devices that support the NFC function and can prevent the discovered electronic devices from entering the card simulation interaction process.

6. The method according to claim 5, characterized in that After controlling the first NFC module to enter the first polling mode, the method further includes: 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 service data from the first NFC module and performs an NFC service according to the service data.

7. The method according to claim 6, characterized in that Before receiving the first NFC instruction sent by the second electronic device, the method further includes: 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 the NFC instruction.

8. The method according to any one of claims 5 to 7, characterized in that , the switching of the state of the first NFC module according to the distance further includes: If the distance between the first electronic device and the second electronic device is greater than the distance threshold, control 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.

9. The method according to any one of claims 5 to 7, characterized in that , the switching of the state of the first NFC module according to the distance further includes: Smoothing the distances determined multiple times, and if a result after the smoothing is greater than a target distance, controlling the first NFC module to switch from the first polling mode to a second polling mode; Wherein, the target distance is determined according to the distance threshold.

10. The method according to claim 9, characterized in that The performing smoothing on the distances determined multiple times, and if a result after the smoothing is greater than the target distance, controlling the first NFC module to switch from the first polling mode to the second polling mode, includes: The first distances determined multiple times are smoothed according to a smoothing coefficient, and if a result after smoothing is greater than a target distance, the first NFC module is controlled to switch from the first polling mode to the second polling mode; the first distance is a distance greater than the distance threshold.

11. The method according to claim 10, characterized in that The method of smoothing the first distances determined multiple times according to the smoothing coefficient, and controlling the first NFC module to switch from the first polling mode to the second polling mode if the result after the smoothing is greater than the target distance, includes: When a first distance greater than the distance threshold is detected for the first time, multiplying the first distance by the smoothing coefficient to obtain a multiplication result; Determining whether the multiplication result is greater than the target distance; If the multiplication result is greater than the target distance, controlling the first NFC module to switch from the first polling mode to the second polling mode; If the multiplication result is not greater than the target distance, and the distance determined next time is greater than the distance threshold, the multiplication result is multiplied by the smoothing coefficient to obtain a new multiplication result, and the step of determining whether the multiplication result is greater than the target distance is re-executed; If the distance determined next time is not greater than the distance threshold, the current multiplication result is cleared.

12. The method according to claims 1 to 7, 10 to 11, characterized in that: Before receiving the first Bluetooth signal sent by the second electronic device, the method further includes: A receiver corresponding to the first Bluetooth signal is registered in a dynamic registration manner, and the receiver is used to monitor the first Bluetooth signal.

13. A signal sending method, characterized in that: Applied to a second electronic device, the method includes: In response to a service triggering operation, determining that the second electronic device is in a target NFC service scenario; A first Bluetooth signal is sent, where the first Bluetooth signal carries a first identifier, where the first identifier is used to characterize that the second electronic device is in the target NFC business scenario, so that the first electronic device that receives the first Bluetooth signal determines the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal, and switches the state of the first NFC module according to the distance.

14. A state switching device for a near field communication (NFC) module, characterized in that: Applied to a first electronic device, the first electronic device includes a first NFC module, and the device includes: A Bluetooth receiving module, used for receiving a first Bluetooth signal sent by a second electronic device; a distance measuring module, configured to determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal; A state switching module is used to switch the state of the first NFC module according to the distance.

15. A signal sending device, characterized in that: Applied to a second electronic device, the device comprises: A scenario determination module, configured to determine, in response to a service triggering operation, that the second electronic device is in a target NFC service scenario; The Bluetooth sending module is used to send a first Bluetooth signal, where the first Bluetooth signal carries a first identifier, and the first identifier is used to indicate that the second electronic device is in the target NFC business scenario, so that the first electronic device that receives the first Bluetooth signal can determine the distance between the first electronic device and the second electronic device according to the signal strength of the first Bluetooth signal, and switch the state of the first NFC module according to the distance.

16. 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 12 or 13.

17. 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 12 or 13.