CN111586657B - Near field communication method, device, storage medium and mobile terminal - Google Patents
Near field communication method, device, storage medium and mobile terminal Download PDFInfo
- Publication number
- CN111586657B CN111586657B CN202010357405.6A CN202010357405A CN111586657B CN 111586657 B CN111586657 B CN 111586657B CN 202010357405 A CN202010357405 A CN 202010357405A CN 111586657 B CN111586657 B CN 111586657B
- Authority
- CN
- China
- Prior art keywords
- near field
- field communication
- mobile terminal
- communication connection
- communication equipment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Telephone Function (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The embodiment of the application provides a near field communication method, a near field communication device, a storage medium and a mobile terminal, wherein the method comprises the following steps: when the mobile terminal detects that the near field communication equipment is in a communication range, establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters; judging whether the near field communication connection is successfully established; and if the near field communication connection is not successfully established, replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again until the near field communication connection is successfully established. Because the radio frequency parameters are pre-stored in the mobile terminal, the success rate of the connection between the mobile terminal and the near field communication equipment can be improved by replacing the near field communication parameters until the near field communication connection between the mobile terminal and the near field communication equipment is successful.
Description
Technical Field
The present disclosure relates to the field of electronic technologies, and in particular, to a near field communication method, an apparatus, a storage medium, and a mobile terminal.
Background
At present, with the popularization of NFC (Near Field Communication) mobile phones, access cards can be simulated through the NFC function of the mobile phones, so that the access card reader can be identified through the mobile phone, and the function of the access control system can be removed.
However, the parameters of the current NFC antennas are all uniformly debugged according to standard devices, and a mobile phone can identify a card reader of the standard device, but cannot identify a card reader of a non-standard device.
Disclosure of Invention
The embodiment of the application provides a near field communication method, a near field communication device, a storage medium and a mobile terminal, which can improve the success rate of connection between near field communication equipment and the mobile terminal.
In a first aspect, an embodiment of the present application provides a near field communication method, which is applied to a mobile terminal, and includes:
when the mobile terminal detects that the near field communication equipment is in a communication range, establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters;
judging whether the near field communication connection is successfully established;
and if the near field communication connection is not successfully established, replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again until the near field communication connection is successfully established.
In a second aspect, an embodiment of the present application provides a near field communication device, which is applied in a mobile terminal, and includes:
the connection module is used for establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters when the mobile terminal detects that the near field communication equipment is in a communication range;
the judging module is used for judging whether the near field communication connection is established successfully or not;
and the processing module is used for replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again when the near field communication connection is not established successfully until the near field communication connection is established successfully.
In a third aspect, embodiments of the present application further provide a storage medium storing a computer program, which, when running on a computer, causes the computer to execute the near field communication method as described above.
In a fourth aspect, an embodiment of the present application further provides a mobile terminal, including a processor and a memory, where the memory stores a computer program, and the processor is configured to execute the near field communication method as described above by calling the computer program.
According to the near field communication method, the near field communication device, the storage medium and the mobile terminal, when the mobile terminal detects that the near field communication equipment is in a communication range, a near field communication connection is established with the near field communication equipment by adopting preset near field communication parameters; judging whether the near field communication connection is successfully established; and if the near field communication connection is not successfully established, replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again until the near field communication connection is successfully established. Because the radio frequency parameters are pre-stored in the mobile terminal, the success rate of the connection between the mobile terminal and the near field communication equipment can be improved by replacing the near field communication parameters until the near field communication connection between the mobile terminal and the near field communication equipment is successful.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments will be briefly introduced below. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 is a first flowchart of a near field communication method according to an embodiment of the present disclosure.
Fig. 2 is a schematic flowchart of a near field communication method according to an embodiment of the present disclosure.
Fig. 3 is a third flowchart of a near field communication method according to an embodiment of the present application.
Fig. 4 is a schematic structural diagram of a near field communication device according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of a mobile terminal according to an embodiment of the present application.
Fig. 6 is a second structural schematic diagram of a mobile terminal according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It should be apparent that the described embodiments are only a few embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a near field communication method, a near field communication device, a storage medium and a mobile terminal. The mobile terminal may be a smart phone, a tablet computer, or other devices, and may also be a game device, an AR (Augmented Reality) device, a data storage device, an audio playing device, a video playing device, a notebook computer, or the like, which will be described in detail below with the smart phone as an example.
Referring to fig. 1, fig. 1 is a first flowchart of a near field communication method according to an embodiment of the present disclosure, where the near field communication method includes:
101. and when the mobile terminal detects that the near field communication equipment is in a communication range, establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters.
The near field communication device may be a card reader, or may be a card, such as a bus card or a subway card. When the near field communication device is a card reader, the mobile terminal may be an analog card, for example, the mobile terminal may be used for swiping a gate, a bus, a subway, or the like, and when the near field communication device is a card, the mobile terminal may also have a function of a card reader, for example, recharging a bus card, or the like.
The communication range may be a distance that the mobile terminal and the near field communication device may allow for communication connection, that is, a distance between the near field communication device and the mobile terminal, and the distance may be 0 to 3 centimeters, that is, the communication range is 0 to 3 centimeters.
The preset near field communication parameters are preset in the mobile terminal, and the preset near field communication parameters are multiple, wherein the preset near field communication parameters can correspond to the types of the near field communication equipment, and each near field communication parameter corresponds to one type of near field communication equipment. And the mobile terminal is in near field communication connection with the near field communication equipment through preset near field communication parameters.
102. And judging whether the near field communication connection is successfully established.
Because the currently used near field communication parameters are not necessarily applicable to all near field communication devices, if the near field communication devices are non-standard devices, the mobile terminal may be unsuccessfully connected with the near field communication devices, and therefore, the problem can be solved simply and efficiently by judging whether the near field communication connection is established successfully.
103. And if the near field communication connection is not successfully established, replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again until the near field communication connection is successfully established.
If the near field communication connection is not successfully established, the mobile terminal is not successfully connected with the near field communication equipment, or the near field communication equipment is not connected with the mobile terminal.
And replacing the preset near field communication parameters by one time or multiple times until the mobile terminal is successfully in communication connection with the near field communication equipment. For example, the preset near field communication parameters include N, a near field communication parameter a is currently adopted, near field communication connection is established again with the near field communication device by changing to the near field communication parameter B, if the near field communication connection is still not established successfully, the near field communication parameter B is changed to the near field communication parameter C to perform communication connection again, and the parameters are changed in sequence until the parameters are successfully changed, so that the success rate of connection between the mobile terminal and the near field communication device can be improved.
It should be noted that the preset nfc parameters may be replaced in sequence, or may be replaced according to near field communication parameters with similar frequencies, where the frequency is a frequency range of the nfc parameters, and for example, the frequency may be 13.56MHz.
According to the near field communication method provided by the embodiment of the application, when the mobile terminal detects that the near field communication equipment is in a communication range, a near field communication connection is established with the near field communication equipment by adopting preset near field communication parameters; judging whether the near field communication connection is successfully established; and if the near field communication connection is not successfully established, replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again until the near field communication connection is successfully established. The radio frequency parameters are stored in the mobile terminal in advance, and the success rate of the connection between the mobile terminal and the near field communication equipment can be improved by replacing the near field communication parameters until the near field communication connection between the mobile terminal and the near field communication equipment is successful.
It can be understood that an embodiment of the present application further provides a near field communication method, please refer to fig. 2, where fig. 2 is a second flowchart schematic diagram of the near field communication method provided in the embodiment of the present application, where the near field communication method includes:
201. and when the mobile terminal detects that the near field communication equipment is in a communication range, establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters.
The near field communication device may be a card reader, or may be a card, such as a bus card or a subway card. When the near field communication device is a card reader, the mobile terminal may be an analog card, for example, the mobile terminal may be used for swiping a gate, a bus, a subway, or the like, and when the near field communication device is a card, the mobile terminal may also have a function of a card reader, for example, recharging a bus card, or the like.
The communication range may be a distance that the mobile terminal and the near field communication device may allow communication connection, that is, a distance between the near field communication device and the mobile terminal, and the distance may be 0 to 3 centimeters, that is, the communication range is 0 to 3 centimeters.
The preset near field communication parameters are preset in the mobile terminal, and the preset near field communication parameters are multiple, wherein the preset near field communication parameters can correspond to the types of the near field communication equipment, and each near field communication parameter corresponds to one type of near field communication equipment. And the mobile terminal is in near field communication connection with the near field communication equipment through preset near field communication parameters.
202. And when the mobile terminal works in a card simulation mode, receiving a first near field communication connection request sent by the near field communication equipment.
The card simulation mode refers to a function of the mobile terminal similar to a card, for example, the mobile terminal can be used for releasing access control, or the mobile terminal can be used for a subway station and a user can enter the station by swiping the card through the mobile terminal.
When the mobile terminal is used for simulating the access control card, the access control card is close to the back of the mobile terminal, and the mobile terminal generates the access control simulation card according to the data of the access control card by reading the data of the access control card.
Wherein, the generation of the entrance guard simulation card according to the data of the entrance guard card can be understood as that a card is generated according to the data of the entrance guard card after the function of the mobile wallet reads the data of the entrance guard card, the card can be understood as an entrance guard simulation card, all data of the entrance guard card are stored in the card, and the entrance guard simulation card in the mobile phone can be identified with the card reader, so that the entrance guard card can be prevented from being carried, and convenience is brought to users for going out.
When the mobile terminal is used as an analog card, the card reader sends a first near field communication connection request when the analog card approaches the card reader, and the analog card receives the first near field communication connection request.
The first near field communication connection request may be an instruction for requesting a communication connection, for example, the card reader sends a near field communication connection request instruction to the analog card.
203. And sending first data authentication information of the mobile terminal to the near field communication equipment according to the first near field communication connection request.
And when the mobile terminal receives the first near field communication connection request, sending data authentication information of the mobile terminal to the near field communication device, where the first data authentication information of the mobile terminal may be key information, and the key information may include a near field communication protocol, a near field communication connection password, identity information of the mobile terminal, and the like.
204. And judging whether the mobile terminal receives feedback information sent by the near field communication equipment within a first preset time length, wherein the feedback information is the feedback information sent by the near field communication equipment according to the first data authentication information.
The card reader receives first data authentication information sent by the mobile terminal, the card reader judges whether the first data authentication information of the mobile terminal is valid or not according to the first data authentication information of the mobile terminal, if the first data authentication information of the mobile terminal is matched with the data information of the card reader, the first data authentication information of the mobile terminal is valid, the card reader sends feedback information to the mobile terminal, if the first data authentication information of the mobile terminal is not matched with the data information of the card reader, the first data authentication information of the mobile terminal is invalid, and the card reader does not send feedback information to the mobile terminal.
The first preset time is preset in the mobile terminal in advance, so that the mobile terminal can make an accurate and quick judgment, and the first preset time may be 5-10 seconds, for example.
205. And when the mobile terminal does not receive the feedback information sent by the near field communication equipment within the first preset time length, judging that the near field communication connection is not established successfully.
Because the first data authentication information sent by the mobile terminal is invalid, the card reader cannot send feedback information to the mobile terminal, so that the mobile terminal cannot receive the feedback information sent by the near field communication equipment within a first preset time length, and the near field communication connection between the mobile terminal and the card reader cannot be successful.
206. And if the near field communication connection is not successfully established, acquiring the communication frequency of each near field communication parameter in the historical near field communication record.
The historical communication record refers to a record of communication with the near field communication device by using the mobile terminal, wherein the communication frequency refers to the number of times of communication with the near field communication device by using the near field communication parameter, for example, the number of times of communication with the card reader by using the near field communication parameter a is 5, that is, the communication frequency is 5, the number of times of communication with the card reader by using the near field communication parameter B is 8, that is, the communication frequency is 8, and the number of times of communication with the card reader by using the near field communication parameter C is 12, that is, the communication frequency is 12.
207. And selecting the near field communication parameter with the maximum communication frequency to establish the near field communication connection with the near field communication equipment again according to the communication frequency of each near field communication parameter.
The success rate of near field communication between the near field communication parameters and the near field communication equipment is higher as the communication frequency of the near field communication parameters is higher, so that the success rate of establishing near field communication connection with the near field communication equipment again by selecting the near field communication parameters with the maximum communication frequency is higher.
It is understood that, in order to more conveniently obtain the near field communication parameter with the largest communication frequency, the communication frequencies of each near field communication parameter may be ordered from large to small or from small to large.
208. And if the near field communication connection is successfully established, detecting whether the near field communication connection is disconnected within a second preset time length.
Due to the fact that in practical application, although the near field communication connection between the mobile terminal and the near field communication device is successfully established, the access control is not released, or the card is not charged successfully, and the reason that the access control is not contacted or the card is not charged successfully is that the communication connection between the mobile device and the near field communication device is disconnected in the card swiping process.
The second preset duration is a parameter set in advance, which is convenient for the mobile terminal to make an accurate judgment quickly, for example, the second preset duration may be 1 to 3 seconds.
By detecting whether the near field communication connection between the mobile terminal and the near field communication equipment is disconnected within a preset time, the successful connection probability between the mobile terminal and the near field communication equipment can be improved.
209. And if the near field communication connection is disconnected within the second preset time, detecting whether the near field communication equipment is in the communication range again.
For example, when the near field communication is just established successfully, the mobile phone receives a voice message, and the user may move the mobile phone away from the card reader to read the voice message, so that the near field communication may be disconnected when the mobile phone is not in the communication range.
210. And if the near field communication equipment is in the communication range, establishing the near field communication connection with the near field communication equipment again by using the preset near field communication parameters which successfully establish the near field communication connection with the near field communication equipment.
If it is detected that the nfc link is disconnected within the second preset duration, and the nfc device is also within the communication range, which may be signal instability, an attempt may be made to establish the nfc link with the nfc device again using the preset nfc parameters that successfully establish the nfc link with the nfc device.
It can be understood that, if it is detected that the near field communication connection is disconnected within the second preset time period, and the near field communication device is also within the communication range, which may be signal instability or signal strength too poor, the signal strength of the near field communication parameter may be increased by increasing the transmission power of the preset near field communication parameter, so as to more stably establish a communication connection between the mobile terminal and the near field communication device. And the preset near field communication parameters are preset near field communication parameters for successfully establishing near field communication connection with the near field communication equipment.
According to the near field communication method provided by the embodiment of the application, when the mobile terminal detects that the near field communication equipment is in a communication range, a near field communication connection is established with the near field communication equipment by adopting preset near field communication parameters; when the mobile terminal is in a card simulation mode; after the mobile terminal sends the data authentication information, whether the mobile terminal receives feedback information sent by the near field communication equipment to judge whether the near field communication is established successfully or not is judged, if the near field communication connection is not established successfully, the near field communication parameters with the highest communication frequency are selected to establish the near field communication connection with the near field communication equipment again until the near field communication connection is established successfully. The success rate of near field communication between the near field communication parameters and the near field communication equipment is higher as the communication frequency of the near field communication parameters is higher, so that the success rate of establishing near field communication connection with the near field communication equipment again by selecting the near field communication parameters with the maximum communication frequency is higher.
Fig. 3 shows a schematic view of a third flow structure of the near field communication method according to the embodiment of the present application. The near field communication method further includes:
301. and when the mobile terminal detects that the near field communication equipment is in a communication range, establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters.
The near field communication device may be a card reader, or may be a card, for example, a public transportation card, a subway card, or the like. When the near field communication device is a card reader, the mobile terminal may be an analog card, for example, the mobile terminal may be used for swiping a gate, a bus, a subway, or the like, and when the near field communication device is a card, the mobile terminal may also have a function of a card reader, for example, recharging a bus card, or the like.
The communication range may be a distance that the mobile terminal and the near field communication device may allow communication connection, that is, a distance between the near field communication device and the mobile terminal, and the distance may be 0 to 3 centimeters, that is, the communication range is 0 to 3 centimeters.
The preset near field communication parameters are preset in the mobile terminal, and the preset near field communication parameters are multiple, wherein the preset near field communication parameters can correspond to the types of the near field communication equipment, and each near field communication parameter corresponds to one type of near field communication equipment. And the mobile terminal is in near field communication connection with the near field communication equipment through preset near field communication parameters.
302. And when the mobile terminal works in a card reader mode, sending a second near field communication connection request to the near field communication equipment.
The card reader mode means that the mobile phone can be equivalent to a card reader, and data information in the card can be read through the mobile phone. When the mobile terminal is used as a card reader, the near field communication device may be a card, for example, the near field communication device is a bus card or a subway card, and the mobile terminal may recharge the bus card or the subway card.
And if the second near field communication connection request is that the near field communication equipment approaches the mobile phone, the mobile phone sends a communication connection request instruction to the near field communication equipment, and the near field communication equipment performs corresponding operation according to the communication connection request instruction.
303. And receiving second data authentication information returned by the near field communication equipment according to the second near field communication connection request.
And when the near field communication equipment receives the second near field communication connection request, sending second data authentication information of the near field communication equipment to the mobile terminal.
The second data authentication information may be key information, and the key information may include a near field communication connection password, identity information of the near field communication device, and the like.
304. And judging whether the second data authentication information of the near field communication equipment is valid.
After receiving the second data authentication information, the mobile terminal determines whether the second data authentication information of the near field communication device is valid according to the second data authentication information, for example, whether the near field communication connection password according to the second data authentication information matches with the communication protocol of the mobile terminal, if so, it indicates that the second data authentication information of the near field communication device is valid, and if not, the second data authentication information of the near field communication device is invalid.
305. And if the second data authentication information is invalid, judging that the near field communication connection is not successfully established.
And if the second data authentication information is invalid, the near field communication password of the near field communication equipment is not matched with the near field communication protocol of the mobile terminal, and the near field communication connection between the mobile terminal and the near field communication equipment cannot be successfully established.
306. And acquiring the frequency of the current preset near field communication parameters.
The current preset near field communication parameters may be understood as near field communication parameters adopted when the mobile terminal is communicating with the near field communication device, that is, near field communication parameters adopted before the near field communication parameters are replaced when the mobile terminal is not successfully in communication with the near field communication device, for example, the mobile phone adopts a near field communication parameter a to try to perform near field communication connection with the card reader, and at this time, the a near field communication parameters are the current preset near field communication parameters.
The frequency of the near field communication parameter is a signal frequency used when the mobile phone performs near field communication with the card reader, and the frequency may be 13.56MHz, for example.
307. And adjusting the frequency of the current preset near field communication parameters according to preset parameters, and selecting the adjusted current preset near field parameters to establish near field communication connection with the near field communication equipment again.
The preset parameter may be understood as the amplitude of the frequency of the current preset near field communication parameter, which may be 0.3, for example, each time the frequency of the current preset near field communication parameter is adjusted up or down by 0.3MHz. For example, the frequency of the current preset near field communication parameters is 13.56MHz, and the frequency of the current preset near field communication parameters may be 13.26MHz or 13.86MHz each time the adjustment is made.
It can be understood that, replacing the preset near field communication parameters to establish a near field communication connection with the near field communication device again may further include:
acquiring signal intensity of all preset near field communication parameters;
and selecting the preset near field parameter with the maximum signal intensity to establish the near field communication connection with the near field communication equipment again according to the signal intensities of all the preset near field communication parameters.
In practical application, whether the mobile terminal and the near field communication device successfully establish the near field communication connection is related to the signal strength of the near field radio frequency parameter, and if the signal strength of the near field radio frequency parameter is too weak, the mobile terminal and the near field communication device cannot successfully establish the near field communication connection.
Therefore, in order to further improve the probability of successfully establishing the near field communication connection between the mobile terminal and the near field communication device, the preset near field parameter with the maximum signal strength is selected to establish the near field communication connection with the near field communication device again by acquiring the signal strengths of all the preset near field communication parameters.
It can be understood that, in order to further improve the probability that the mobile terminal and the near field communication device successfully establish the near field communication connection, the communication frequency and the signal strength of each preset near field communication parameter may also be obtained at the same time, and the near field communication parameter with the largest communication frequency and signal strength is selected to establish the near field communication connection with the near field communication device again. And when the signal intensity is maximum and the communication frequency is not maximum, selecting the near field communication parameter with the maximum communication frequency to establish the near field communication connection with the near field communication equipment again.
308. And if the near field communication connection is successfully established, detecting whether the near field communication connection is disconnected within a second preset time length.
Due to the fact that in practical application, although the near field communication connection between the mobile terminal and the near field communication device is successfully established, the access control is not released, or the card is not charged successfully, and the reason that the access control is not contacted or the card is not charged successfully is that the communication connection between the mobile device and the near field communication device is disconnected in the card swiping process.
The second preset duration is a parameter set in advance, which is convenient for the mobile terminal to make an accurate judgment quickly, for example, the second preset duration may be 1 to 3 seconds.
By detecting whether the mobile terminal and the near field communication equipment are disconnected within the preset time, the probability of successful connection between the mobile terminal and the near field communication equipment can be improved.
309. And if the near field communication connection is disconnected within the second preset time length, detecting whether the near field communication equipment is in a communication range again.
For example, when the near field communication is just established successfully, the mobile phone receives a voice message, and the user may move the mobile phone away from the card reader to read the voice message, so that the near field communication may be disconnected when the mobile phone is not in the communication range.
310. And if the near field communication equipment is in the communication range, establishing the near field communication connection with the near field communication equipment again by using the preset near field communication parameters for successfully establishing the near field communication connection with the near field communication equipment.
If it is detected that the nfc link is disconnected within the second preset duration, and the nfc device is also within the communication range, which may be signal instability, an attempt may be made to establish the nfc link with the nfc device again using the preset nfc parameters that successfully establish the nfc link with the nfc device.
It can be understood that, if it is detected that the near field communication connection is disconnected within the second preset time period, and the near field communication device is also within the communication range, which may be signal instability or signal strength too poor, the signal strength of the near field communication parameter may be increased by increasing the transmission power of the preset near field communication parameter, so as to more stably establish a communication connection between the mobile terminal and the near field communication device. And the preset near field communication parameters are preset near field communication parameters for successfully establishing near field communication connection with the near field communication equipment.
According to the near field communication method provided by the embodiment of the application, when the mobile terminal detects that the near field communication equipment is in a communication range, a near field communication connection is established with the near field communication equipment by adopting a preset near field communication parameter; when the mobile terminal is in a card reader mode; after the mobile terminal receives the data authentication information sent by the near field communication equipment, whether the near field communication is established successfully is judged by judging whether the data authentication information of the near field communication equipment is valid, if the near field communication connection is not established successfully, the frequency of the current near field communication parameters is adjusted according to preset parameters, the near field communication connection is established with the near field communication equipment again until the near field communication connection is established successfully, and the success rate of the near field communication connection between the mobile terminal and the near field communication equipment can be improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a near field communication device according to an embodiment of the present application, and the near field communication device 400 is applied in a mobile terminal, and includes:
the connection module 401 is configured to establish a near field communication connection with the near field communication device by using a preset near field communication parameter when the mobile terminal detects that the near field communication device is in a communication range;
a determining module 402, configured to determine whether the near field communication connection is successfully established;
the processing module 403 is configured to, when the nfc connection is not successfully established, replace the preset nfc parameter and establish the nfc connection with the nfc device again until the nfc connection is successfully established.
Wherein, the determining module 402 comprises:
the first receiving module is used for receiving a first near field communication connection request sent by the near field communication equipment when the mobile terminal works in a card simulation mode;
a first sending module, configured to send first data authentication information of the mobile terminal to the near field communication device according to the first near field communication connection request;
the determining module 402 is further configured to determine whether the mobile terminal receives feedback information sent by the near field communication device within a first preset time period, where the feedback information is feedback information sent by the near field communication device according to the first data authentication information.
The determining module 402 is further configured to, when the mobile terminal does not receive the feedback information sent by the nfc device within the first preset time period, establish the nfc connection unsuccessfully.
As can be appreciated, the determining module 402 further includes:
the second sending module is used for sending a second near field communication connection request to the near field communication equipment when the mobile terminal works in a card reader mode;
the first acquisition module is used for receiving second data authentication information returned by the near field communication equipment according to the second near field communication connection request;
the determining module 402 is further configured to determine whether second data authentication information of the near field communication device is valid; and if the second data authentication information is invalid, judging that the near field communication connection is not successfully established.
Wherein the processing module 403 comprises:
and the second acquisition module is used for acquiring the communication frequency of each near field communication parameter in the historical near field communication records.
And the first selection module is used for selecting the near field communication parameter with the maximum communication frequency to establish the near field communication connection with the near field communication equipment again according to the communication frequency of each near field communication parameter.
As can be understood, the processing module 403 further includes:
the third acquisition module is used for acquiring the frequency of the current preset near field communication parameters;
and the second selection module is used for adjusting the frequency of the current preset near field communication parameters according to preset parameters, and selecting the adjusted current preset near field parameters to establish near field communication connection with the near field communication equipment again.
As can be understood, the processing module 403 further includes:
and the fourth acquisition module is used for acquiring the signal intensity of all the preset near field communication parameters.
And the third selection module is used for selecting the preset near field communication parameter with the maximum signal intensity to establish the near field communication connection with the near field communication equipment again according to the signal intensities of all the preset near field communication parameters.
It is understood that the near field communication apparatus 400 further includes:
the first detection module is used for detecting whether the near field communication connection is disconnected within a second preset time length when the near field communication connection is established successfully;
and the second detection module is used for detecting whether the near field communication equipment is in a communication range again if the near field communication connection is disconnected within the second preset time length.
The processing module 403 is further configured to establish a near field communication connection with the near field communication device again by using preset near field communication parameters for successfully establishing a near field communication connection with the near field communication device when the near field communication device is within a communication range.
According to the near field communication device provided by the embodiment of the application, when the mobile terminal detects that the near field communication equipment is in a communication range, a near field communication connection is established with the near field communication equipment by adopting preset near field communication parameters; judging whether the near field communication connection is successfully established; and if the near field communication connection is not successfully established, replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again until the near field communication connection is successfully established. Because the radio frequency parameters are pre-stored in the mobile terminal, the success rate of the connection between the mobile terminal and the near field communication equipment can be improved by replacing the near field communication parameters until the near field communication connection between the mobile terminal and the near field communication equipment is successful.
Referring to fig. 5, fig. 5 is a schematic view illustrating a first structure of a mobile terminal according to an embodiment of the present application, where a mobile terminal 500 includes a processor 501 and a memory 502. The processor 501 is electrically connected to the memory 502.
The processor 501 is a control center of the mobile terminal 500, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the mobile terminal 500 and processes data by running or loading a computer program stored in the memory 502 and calling data stored in the memory 502.
The memory 502 may be used to store software programs and modules, and the processor 501 executes various functional applications and data processing by operating the computer programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like.
Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 access to the memory 502.
In the embodiment of the present application, the processor 501 in the mobile terminal 500 loads instructions corresponding to one or more processes of the computer program into the memory 602, and the processor 501 runs the computer program stored in the memory 502, so as to implement various functions as follows:
when the mobile terminal detects that the near field communication equipment is in a communication range, establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters;
judging whether the near field communication connection is successfully established;
and if the near field communication connection is not successfully established, replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again until the near field communication connection is successfully established.
Referring to fig. 6, fig. 6 is a second schematic structural diagram of a mobile terminal according to an embodiment of the present application, and the difference between the second schematic structural diagram and the mobile terminal shown in fig. 5 is that the mobile terminal further includes: a camera assembly 503, a display 504, an audio circuit 505, a radio frequency circuit 506, and a power supply 507. The camera module 503, the display 504, the audio circuit 505, the rf circuit 506, and the power supply 507 are electrically connected to the processor 501.
The camera assembly 503 may include Image Processing circuitry, which may be implemented using hardware and/or software components, and may include various Processing units that define an Image Signal Processing (Image Signal Processing) pipeline. The image processing circuit may include at least: a plurality of cameras, an Image Signal Processor (ISP), a control logic, and an Image memory. Where each camera may include at least one or more lenses and an image sensor. The image sensor may include an array of color filters (e.g., bayer filters). The image sensor may acquire light intensity and wavelength information captured with each imaging pixel of the image sensor and provide a set of raw image data that may be processed by an image signal processor.
The display 504 may be used to display information entered by or provided to the user as well as various graphical user interfaces that may be composed of graphics, text, icons, video, and any combination thereof.
The audio circuit 505 may be used to provide an audio interface between the user and the electronic device through a speaker, microphone.
The radio frequency circuit 506 may be used for transceiving radio frequency signals to establish wireless communication with a network device or other electronic devices through wireless communication, and for transceiving signals with the network device or other electronic devices.
A power supply 507 may be used to power the various components of the mobile terminal 500. In some embodiments, power supply 507 may be logically coupled to processor 501 through a power management system, such that functions to manage charging, discharging, and power consumption management are performed through the power management system.
In this embodiment, the processor 501 in the mobile terminal 500 loads instructions corresponding to one or more processes of the computer program into the memory 502 according to the following steps, and the processor 501 runs the computer program stored in the memory 502, so as to implement various functions, as follows:
when the mobile terminal detects that the near field communication equipment is in a communication range, establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters;
judging whether the near field communication connection is successfully established;
and if the near field communication connection is not successfully established, replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again until the near field communication connection is successfully established.
In some embodiments, the processor 501 is further configured to perform:
when the mobile terminal works in a card simulation mode, receiving a first near field communication connection request sent by the near field communication equipment;
according to the first near field communication connection request, sending first data authentication information of the mobile terminal to the near field communication equipment;
judging whether the mobile terminal receives feedback information sent by the near field communication equipment within a first preset time length, wherein the feedback information is the feedback information sent by the near field communication equipment according to the first data authentication information;
and when the mobile terminal does not receive the feedback information sent by the near field communication equipment within the first preset time length, judging that the near field communication connection is not established successfully.
In some embodiments, the processor 501 is further configured to perform:
when the mobile terminal works in a card reader mode, sending a second near field communication connection request to the near field communication equipment;
receiving second data authentication information returned by the near field communication equipment according to the second near field communication connection request;
judging whether second data authentication information of the near field communication equipment is valid or not;
and if the second data authentication information is invalid, judging that the near field communication connection is not successfully established.
In some embodiments, the processor 501 is further configured to perform:
acquiring the communication frequency of each near field communication parameter in the historical near field communication record;
and selecting the near field communication parameter with the maximum communication frequency to establish the near field communication connection with the near field communication equipment again according to the communication frequency of each near field communication parameter.
In some embodiments, the processor 501 is further configured to perform:
acquiring signal intensity of all preset near field communication parameters;
and selecting the preset near field communication parameter with the maximum signal intensity to establish the near field communication connection with the near field communication equipment again according to the signal intensity of all the preset near field communication parameters.
In some embodiments, after determining whether the near field communication connection is successfully established, the processor 501 is further configured to:
if the near field communication connection is successfully established, detecting whether the near field communication connection is disconnected within a second preset time length;
if the near field communication connection is disconnected within the second preset time length, detecting whether the near field communication equipment is in a communication range again;
and if the near field communication equipment is in the communication range, establishing the near field communication connection with the near field communication equipment again by using the preset near field communication parameters for successfully establishing the near field communication connection with the near field communication equipment.
According to the mobile terminal provided by the embodiment of the application, when the mobile terminal detects that the near field communication equipment is in a communication range, the near field communication connection is established with the near field communication equipment by adopting the preset near field communication parameters; judging whether the near field communication connection is successfully established; and if the near field communication connection is not successfully established, replacing the preset near field communication parameters to establish the near field communication connection with the near field communication equipment again until the near field communication connection is successfully established. The radio frequency parameters are stored in the mobile terminal in advance, and the success rate of the connection between the mobile terminal and the near field communication equipment can be improved by replacing the near field communication parameters until the near field communication connection between the mobile terminal and the near field communication equipment is successful.
An embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer executes the near field communication method according to any of the above embodiments.
It should be noted that, a person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by the relevant hardware instructed by a computer program, and the computer program can be stored in a computer readable storage medium, which can include but is not limited to: a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic or optical disk, and the like.
The near field communication method, the near field communication device, the storage medium, and the mobile terminal provided in the embodiments of the present application are described in detail above. The principles and implementations of the present application are described herein using specific examples, which are presented only to aid in understanding the present application. Meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manner and the application scope may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present application.
Claims (6)
1. A near field communication method is applied to a mobile terminal, and is characterized by comprising the following steps:
when the mobile terminal detects that the near field communication equipment is in a communication range, establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters; the preset near field communication parameters are stored in the mobile terminal and correspond to the types of near field communication equipment, and each preset near field communication parameter corresponds to one type of near field communication equipment;
judging whether the near field communication connection is successfully established;
if the near field communication connection is not established successfully, acquiring the communication frequency and the signal intensity of each preset near field communication parameter, selecting the near field communication parameter with the maximum communication frequency and signal intensity, and establishing the near field communication connection with the near field communication equipment again until the near field communication connection is established successfully;
if the near field communication connection is successfully established, detecting whether the near field communication connection is disconnected within a second preset time length; if the near field communication connection is disconnected within the second preset time length, detecting whether the near field communication equipment is in a communication range again; and if the near field communication equipment is in the communication range, establishing the near field communication connection with the near field communication equipment again by using the preset near field communication parameters which successfully establish the near field communication connection with the near field communication equipment.
2. The near field communication method of claim 1, wherein determining whether the near field communication connection is successfully established comprises:
when the mobile terminal works in a card simulation mode, receiving a first near field communication connection request sent by the near field communication equipment;
according to the first near field communication connection request, first data authentication information of the mobile terminal is sent to the near field communication equipment;
judging whether the mobile terminal receives feedback information sent by the near field communication equipment within a first preset time length, wherein the feedback information is the feedback information sent by the near field communication equipment according to the first data authentication information;
and when the mobile terminal does not receive the feedback information sent by the near field communication equipment within the first preset time length, judging that the near field communication connection is not established successfully.
3. The near field communication method of claim 1, wherein determining whether the near field communication connection is successfully established comprises:
when the mobile terminal works in a card reader mode, sending a second near field communication connection request to the near field communication equipment;
receiving second data authentication information returned by the near field communication equipment according to the second near field communication connection request;
judging whether second data authentication information of the near field communication equipment is valid or not;
and if the second data authentication information is invalid, judging that the near field communication connection is not successfully established.
4. A near field communication device applied to a mobile terminal, the near field communication device comprising:
the connection module is used for establishing near field communication connection with the near field communication equipment by adopting preset near field communication parameters when the mobile terminal detects that the near field communication equipment is in a communication range; the preset near field communication parameters are stored in the mobile terminal and correspond to the types of near field communication equipment, and each preset near field communication parameter corresponds to one type of near field communication equipment;
the judging module is used for judging whether the near field communication connection is established successfully or not;
the processing module is used for acquiring the communication frequency and the signal intensity of each preset near field communication parameter when the near field communication connection is not established successfully, selecting the near field communication parameter with the maximum communication frequency and signal intensity, and establishing the near field communication connection with the near field communication equipment again until the near field communication connection is established successfully; the near field communication connection is also used for detecting whether the near field communication connection is disconnected within a second preset time length or not when the near field communication connection is successfully established; if the near field communication connection is disconnected within the second preset time length, detecting whether the near field communication equipment is in a communication range again; and if the near field communication equipment is in the communication range, establishing the near field communication connection with the near field communication equipment again by using the preset near field communication parameters for successfully establishing the near field communication connection with the near field communication equipment.
5. A storage medium storing a computer program, characterized in that, when the computer program runs on a computer, it causes the computer to execute a near field communication method according to any one of claims 1 to 3.
6. A mobile terminal, characterized in that it comprises a processor and a memory, said memory storing a computer program, said processor being adapted to execute the near field communication method of any of claims 1-3 by invoking said computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010357405.6A CN111586657B (en) | 2020-04-29 | 2020-04-29 | Near field communication method, device, storage medium and mobile terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010357405.6A CN111586657B (en) | 2020-04-29 | 2020-04-29 | Near field communication method, device, storage medium and mobile terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111586657A CN111586657A (en) | 2020-08-25 |
CN111586657B true CN111586657B (en) | 2023-02-28 |
Family
ID=72120254
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010357405.6A Active CN111586657B (en) | 2020-04-29 | 2020-04-29 | Near field communication method, device, storage medium and mobile terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111586657B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112199306A (en) * | 2020-09-23 | 2021-01-08 | 建信金融科技有限责任公司 | Information card interface equipment virtualization implementation method and device, electronic equipment and readable storage medium |
CN112714505A (en) * | 2020-12-25 | 2021-04-27 | 上海东普信息科技有限公司 | Wireless communication method for unmanned aerial vehicle and carrying box and related equipment |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103095342A (en) * | 2011-11-01 | 2013-05-08 | 中国移动通信集团公司 | Communication method and device between near field communication terminal and card reader |
CN103533543A (en) * | 2013-10-08 | 2014-01-22 | 深圳Tcl新技术有限公司 | Terminal pairing method and device on basis of near field communication |
CN103684535A (en) * | 2012-09-19 | 2014-03-26 | 晨星软件研发(深圳)有限公司 | Mode switching module and mode switching method |
CN104574069A (en) * | 2015-01-30 | 2015-04-29 | 广东欧珀移动通信有限公司 | A near-field communication NFC payment method and device |
CN107437997A (en) * | 2017-08-15 | 2017-12-05 | 国民技术股份有限公司 | A kind of frequency communication devices and method |
CN108055089A (en) * | 2017-12-14 | 2018-05-18 | 中兴通讯股份有限公司 | The working frequency of NFC device determines method and device |
CN108205637A (en) * | 2017-10-13 | 2018-06-26 | 中兴通讯股份有限公司 | A kind of NFC configuration methods, mobile terminal and computer readable storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR102371705B1 (en) * | 2017-11-07 | 2022-03-08 | 삼성전자주식회사 | Device and method for controlling transactions of nfc reader with external electronic device |
-
2020
- 2020-04-29 CN CN202010357405.6A patent/CN111586657B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103095342A (en) * | 2011-11-01 | 2013-05-08 | 中国移动通信集团公司 | Communication method and device between near field communication terminal and card reader |
CN103684535A (en) * | 2012-09-19 | 2014-03-26 | 晨星软件研发(深圳)有限公司 | Mode switching module and mode switching method |
CN103533543A (en) * | 2013-10-08 | 2014-01-22 | 深圳Tcl新技术有限公司 | Terminal pairing method and device on basis of near field communication |
CN104574069A (en) * | 2015-01-30 | 2015-04-29 | 广东欧珀移动通信有限公司 | A near-field communication NFC payment method and device |
CN107437997A (en) * | 2017-08-15 | 2017-12-05 | 国民技术股份有限公司 | A kind of frequency communication devices and method |
CN108205637A (en) * | 2017-10-13 | 2018-06-26 | 中兴通讯股份有限公司 | A kind of NFC configuration methods, mobile terminal and computer readable storage medium |
CN108055089A (en) * | 2017-12-14 | 2018-05-18 | 中兴通讯股份有限公司 | The working frequency of NFC device determines method and device |
Non-Patent Citations (1)
Title |
---|
具有NFC功能的移动通信终端电路设计;许江成;《中国优秀硕士学位论文全文数据库(电子期刊)》;20140115;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN111586657A (en) | 2020-08-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107437009B (en) | Authority control method and related product | |
US20190108409A1 (en) | Face recognition method and related product | |
CN105071473B (en) | USB charging methods and device | |
CN108650671B (en) | Method, device, mobile terminal, storage medium and system for establishing Bluetooth connection | |
CN107832595B (en) | Locking method and related equipment | |
CN102025828B (en) | Terminal and control method thereof | |
CN111586657B (en) | Near field communication method, device, storage medium and mobile terminal | |
CN106454800A (en) | Identity verification method, device and system | |
CN104967593A (en) | Identity verification method, apparatus and system | |
CN107133577B (en) | Fingerprint identification method and device | |
CN107454660A (en) | Network method and device are stayed after failed authentication | |
CN107729833B (en) | Face detection method and related product | |
CN109711832A (en) | The methods, devices and systems paid | |
CN113705389A (en) | Face recognition module testing method and device, storage medium and electronic equipment | |
WO2019011106A1 (en) | State control method and related product | |
CN111246451A (en) | Function setting method and device of SIM card, storage medium and terminal | |
CN110827830B (en) | Voiceprint recognition method, voiceprint recognition device, terminal and storage medium based on voice data | |
CN111010716B (en) | Network control method, network control device, storage medium and electronic equipment | |
CN112672053A (en) | Photographing method, photographing device, terminal equipment and computer-readable storage medium | |
CN112989299A (en) | Interactive identity recognition method, system, device and medium | |
CN112667984A (en) | Identity authentication method and device, electronic equipment and storage medium | |
CN107580132A (en) | Information transmission method, device, storage medium and electronic equipment | |
CN109041145A (en) | Communication means, device, terminal and storage medium | |
CN105792296A (en) | CS fallback triggering method and terminal | |
CN101384052B (en) | Authentication method, mobile terminal and server |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |