Disclosure of Invention
The invention mainly aims to provide a method and a system for Bluetooth connection, which can solve the technical problems that the Bluetooth connection needs manual operation and the safety cannot be ensured.
The invention provides a Bluetooth connection method, which is used for connecting a Bluetooth terminal and a specified Bluetooth device, wherein the Bluetooth address information of the specified Bluetooth device is encrypted by a specified encryption algorithm, the Bluetooth terminal is provided with a decryption algorithm corresponding to the specified encryption algorithm, and the method comprises the following steps:
judging whether a Bluetooth connection instruction is received or not;
if receiving a Bluetooth connection instruction, monitoring sound information of the current environment;
decrypting the sound information to obtain the Bluetooth address information;
and connecting the appointed Bluetooth equipment according to the decrypted Bluetooth address information.
Further, the step of decrypting the sound information to obtain the bluetooth address information includes:
judging whether the sound information contains encoded audio data;
and if the audio data contains the coded audio data, decoding the audio data according to the decryption algorithm corresponding to the specified encryption algorithm to obtain Bluetooth address information.
Further, the step of determining whether the sound information contains encoded audio data includes:
judging whether the sound information has audio data of a plurality of different specific frequency combinations;
and if so, determining that the sound information contains the encoded audio data.
Further, there are a plurality of the designated bluetooth devices, the decrypted bluetooth address information includes a specific number, and the step of connecting the designated bluetooth devices according to the decrypted bluetooth address information includes:
comparing the sizes of specific numbers in the Bluetooth address information of a plurality of specified Bluetooth devices respectively;
and connecting the corresponding appointed Bluetooth equipment by using the decrypted Bluetooth address information with the maximum specific number.
Further, after the step of connecting the corresponding specified bluetooth device by using the decrypted bluetooth address information with the largest specific number, the method includes:
judging whether the connection time of the continuous connection with the appointed Bluetooth equipment exceeds preset time or not;
and if the preset time is exceeded, disconnecting the specified Bluetooth equipment.
The invention provides a Bluetooth connection system, which is used for connecting a Bluetooth terminal and a specified Bluetooth device, wherein the Bluetooth address information of the specified Bluetooth device is encrypted by a specified encryption algorithm, the Bluetooth terminal is provided with a decryption algorithm corresponding to the specified encryption algorithm, and the Bluetooth connection system comprises:
the Bluetooth connection instruction judging module is used for judging whether to receive a Bluetooth connection instruction;
the monitoring module is used for monitoring the sound information of the current environment if receiving the Bluetooth connection instruction;
the decryption module is used for decrypting the sound information to obtain the Bluetooth address information;
and the connection module is used for connecting the appointed Bluetooth equipment according to the decrypted Bluetooth address information.
Further, the decryption module includes:
the coding judgment submodule is used for judging whether the sound information contains coded audio data;
and the decoding submodule is used for decoding the audio data according to the decryption algorithm corresponding to the specified encryption algorithm if the audio data contains the encoded audio data so as to obtain Bluetooth address information.
Further, the encoding judgment sub-module includes:
a frequency judging unit for judging whether the sound information has audio data of a plurality of different specific frequency combinations;
and an encoding determination unit configured to determine that the sound information includes the encoded audio data if the determination is positive.
Further, there are a plurality of the specified bluetooth devices, the decrypted bluetooth address information includes a specific number, and the connection module includes:
the comparison submodule is used for respectively comparing the sizes of specific numbers in the Bluetooth address information of the specified Bluetooth devices;
and the decryption connection submodule is used for connecting the corresponding specified Bluetooth equipment by using the decrypted Bluetooth address information with the maximum specific number.
Further, the system includes:
the time judging module is used for judging whether the connection time of the continuous connection with the specified Bluetooth equipment exceeds the preset time or not;
and the disconnection module is used for disconnecting the connection with the specified Bluetooth equipment if the preset time is exceeded.
According to the Bluetooth connection method and the system, the encrypted Bluetooth address information in the sound information is acquired by monitoring and decrypting, so that Bluetooth connection is completed, and the technical problems that manual operation is required for Bluetooth connection and safety cannot be guaranteed are solved. The Bluetooth address information is output by sound by encoding the sound with a plurality of different specific frequencies, and only the different specific frequencies are identified to judge whether the sound is encoded, so that the calculation force is saved.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Reference will now be made in detail to the embodiments of the present invention, and it will be understood by those skilled in the art that, unless otherwise specified, the singular forms "a", "an", "the" and "the" used herein may include the plural forms as well. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
Referring to fig. 1, an embodiment of the present application provides a bluetooth connection method for connecting a bluetooth terminal and a designated bluetooth device, where bluetooth address information of the designated bluetooth device is encrypted by a designated encryption algorithm, and the bluetooth terminal has a decryption algorithm corresponding to the designated encryption algorithm, including the steps of:
s1, judging whether a Bluetooth connection instruction is received;
s2, if receiving a Bluetooth connection instruction, monitoring sound information of the current environment;
s3, decrypting the sound information to obtain the Bluetooth address information;
and S4, connecting the appointed Bluetooth equipment according to the decrypted Bluetooth address information.
The bluetooth terminal refers to a terminal with a bluetooth function, such as a bluetooth mobile phone, a bluetooth tablet computer, a bluetooth desktop computer, a bluetooth notebook computer, and the like. The bluetooth device refers to a device having a bluetooth function, such as a bluetooth mobile phone, a bluetooth tablet, a bluetooth desktop, a bluetooth notebook, a bluetooth headset, a bluetooth speaker, and the like. The Bluetooth equipment has an encryption algorithm, can encrypt the Bluetooth address information of the Bluetooth equipment and sends the information out in a sound mode. Correspondingly, the Bluetooth terminal has a corresponding decryption algorithm, and after receiving the encrypted Bluetooth address information sent in the form of voice, the Bluetooth terminal can decrypt the encrypted Bluetooth address information to obtain the Bluetooth address information.
Step S1 is performed to determine whether a bluetooth connection command is received. The bluetooth connection instruction can be generated by selecting a bluetooth connection option on a screen through a finger, or can be generated through a key or a key combination of a bluetooth terminal (such as a bluetooth terminal with keys, such as a bluetooth mobile phone, a bluetooth tablet computer, a bluetooth desktop computer, a bluetooth notebook computer, and the like); or receiving a Bluetooth connection instruction required by the APP after the APP is opened; or may be a bluetooth connection command generated by other means.
And step S2, if receiving the bluetooth connection command, monitoring the sound information of the current environment. The sound is monitored by a sound collection device (sound input device). The sound collection device (sound input device) may be a microphone or a microphone array. The sound collection device (sound input device) can be always turned on (no matter the Bluetooth terminal is in a standby state or a working state), and can also be turned on according to an instruction according to needs.
And step S3, decrypting the sound information to obtain the bluetooth address information. As mentioned above, the bluetooth device has an encryption algorithm, and can encrypt the bluetooth address information of the bluetooth device and send out the encrypted bluetooth address information in the form of sound. When the monitored sound contains the encrypted Bluetooth address information, the sound is indicated to contain the required information and is further processed. Wherein the sound containing the encrypted bluetooth address information of the bluetooth device may be emitted by the bluetooth device; the sound of the encrypted Bluetooth address information of the Bluetooth device can also be recorded and sent out through other sound output devices. As mentioned above, the bluetooth terminal has a corresponding decryption algorithm, and after receiving the encrypted bluetooth address information transmitted in the form of voice, decrypts it to obtain the bluetooth address information. Therefore, the security and the selectivity of the Bluetooth connection are improved in the whole process of encrypting and decrypting the Bluetooth address.
And step S4, connecting the appointed Bluetooth device by using the decrypted Bluetooth address information. As described above, the bluetooth terminal obtains the decrypted bluetooth address information of the bluetooth device, and connects to the bluetooth device through the bluetooth address information. Wherein, the process of connecting the bluetooth device includes: directly connecting the Bluetooth device; or generating an instruction whether to connect the Bluetooth device, and connecting the Bluetooth device after receiving the instruction.
Further, after the step S4, connecting the specified bluetooth device by using the decrypted bluetooth address information, the method further includes: receive or transmit data to the bluetooth device. Thereby realizing data transmission between the Bluetooth terminal and the Bluetooth equipment.
Referring to fig. 2, in an embodiment, the step S3 of decrypting the sound information to obtain the bluetooth address information includes:
s31, judging whether the sound information contains coded audio data;
and S32, if the audio data contains the coded audio data, decoding the audio data according to the decryption algorithm corresponding to the specified encryption algorithm to obtain Bluetooth address information.
Step S31 is performed to determine whether the sound information contains encoded audio data. The encoded sound may contain the required information. Only if it is determined that the heard sound is indeed encoded is it necessary to proceed to the next step. The encoding method may be any method, for example, encoding using frequency, timbre, or the like.
And step S32, if the encoded audio data is contained, decoding the audio data according to the decryption algorithm corresponding to the specified encryption algorithm to obtain bluetooth address information. Since the bluetooth address information is encrypted in this embodiment, it is only determined that the decoded data is encrypted and encrypted by the encryption algorithm of the bluetooth device that the decoded data is encrypted that the sound information is the required sound information. The specific determination method may be any feasible method, for example, determining whether the decoded data conforms to a specific format. As described above, it can be confirmed whether the bluetooth address information is encrypted by a specified encryption algorithm. Accordingly, bluetooth address information is obtained.
Further, the step S31 of determining whether the sound information includes encoded audio data includes:
s311, judging whether the sound information has audio data of a plurality of different specific frequency combinations;
and S312, if yes, judging that the sound information contains the coded audio data.
The encoding method may be any method, and when encoding is performed using a frequency, encoding may be performed by assigning a sound segment having a specific frequency within a specific time period a seconds to a specific signal. For example, to encode information XYZ, where X corresponds to a specific frequency E, Y corresponds to a specific frequency R, and Z corresponds to a specific frequency T, the encoded sound should have a frequency ERT within three consecutive durations of a seconds.
Steps S311 to S312 are performed to determine whether the monitored sounds have a plurality of different specific frequencies. The specific frequency can be any feasible frequency, and can include infrasonic waves, sound waves, ultrasonic waves, low frequency bands, medium and high frequency bands, such as any frequency of 10-500KHz, 20-50KHz and 50-20 KHz. Frequencies that fit within certain frequency ranges may also be considered as specific frequencies, e.g. a frequency of 10-20Hz as specific frequency 1 and 200-2000Hz as specific frequency 2.
As described above, when encoding is performed using frequencies, it is determined whether or not a sound has a plurality of different specific frequencies, and if the sound has a plurality of different specific frequencies, it is determined that the sound has been encoded; if there is only a single specific frequency or no specific frequency, it is determined that the encoding is not performed.
In one embodiment, the step S4 of connecting the designated bluetooth device according to the decrypted bluetooth address information includes:
s401, comparing the sizes of specific numbers in the Bluetooth address information of a plurality of specified Bluetooth devices respectively;
s402, connecting the corresponding appointed Bluetooth equipment by using the decrypted Bluetooth address information with the maximum specific number.
As in steps S401-402 above, connection to the designated bluetooth device is achieved. In some scenarios, a plurality of bluetooth devices are connected alternatively, for example, a bluetooth speaker and a bluetooth headset are available for connection, and at this time, a connection object should be selected. Specific numbers (for example, positive integers) can be added to the bluetooth address information to determine which device should be connected, wherein the specific numbers can be added at the beginning of the bluetooth address, added at the end of the bluetooth address, or inserted in the bluetooth address. The specific mode comprises the following steps: compared with the specific digital size, the Bluetooth device with the specific digital size is a device to be connected. Wherein, the special number can be added during coding or encryption.
After the step S402 of connecting the corresponding specified bluetooth device by using the decrypted bluetooth address information with the largest specific number in one embodiment, the method includes:
s5, judging whether the connection time of the continuous connection with the appointed Bluetooth equipment exceeds the preset time;
and S6, if the preset time is exceeded, disconnecting the specified Bluetooth device.
Breaking the connection is achieved as in step S5-6 above. When the bluetooth connection time is too long, the required connection time may be exceeded (e.g., the owner has left, but forgotten to turn off the bluetooth), thus causing a large amount of power consumption. Accordingly, when the continuous connection is too long, i.e., exceeds a predetermined time, the connection is disconnected. Wherein the predetermined time may be 1 hour, 3 hours, 5 hours, 10 hours, etc.
According to the Bluetooth connection method provided by the invention, the encrypted Bluetooth address information in the sound information is acquired by monitoring and decrypting means, so that Bluetooth connection is completed, and the technical problems that manual operation is required for Bluetooth connection and the safety cannot be ensured are solved. The Bluetooth address information is output by sound by encoding the sound with a plurality of different specific frequencies, and only the different specific frequencies are identified to judge whether the sound is encoded, so that the calculation force is saved.
Referring to fig. 3, an embodiment of the present application provides a bluetooth connection system, configured to connect a bluetooth terminal and a specified bluetooth device, where bluetooth address information of the specified bluetooth device is encrypted by a specified encryption algorithm, and the bluetooth terminal has a decryption algorithm corresponding to the specified encryption algorithm, and includes:
a bluetooth connection instruction judging module 10, configured to judge whether to receive a bluetooth connection instruction;
the monitoring module 20 is configured to monitor sound information of the current environment if the bluetooth connection instruction is received;
the decryption module 30 is configured to decrypt the sound information to obtain the bluetooth address information;
and the connection module 40 is used for connecting the specified Bluetooth equipment according to the decrypted Bluetooth address information.
The bluetooth terminal refers to a terminal with a bluetooth function, such as a bluetooth mobile phone, a bluetooth tablet, a bluetooth desktop computer, a bluetooth notebook computer, and so on. A bluetooth device refers to a device having a bluetooth function, such as a bluetooth mobile phone, a bluetooth tablet, a bluetooth desktop, a bluetooth notebook, a bluetooth headset, a bluetooth speaker, and so on. The Bluetooth equipment has an encryption algorithm, can encrypt the Bluetooth address information of the Bluetooth equipment and sends the information out in a sound mode. Correspondingly, the Bluetooth terminal has a corresponding decryption algorithm, and after receiving the encrypted Bluetooth address information sent in the form of voice, the Bluetooth terminal can decrypt the encrypted Bluetooth address information to obtain the Bluetooth address information.
The bluetooth connection instruction determining module 10 determines whether to receive a bluetooth connection instruction. The bluetooth connection instruction can be generated by selecting a bluetooth connection option on a screen through a finger, or can be generated through a key or a key combination of a bluetooth terminal (such as a bluetooth terminal with keys, such as a bluetooth mobile phone, a bluetooth tablet computer, a bluetooth desktop computer, a bluetooth notebook computer, and the like); or receiving a Bluetooth connection instruction required by the APP after the APP is opened; or may be a bluetooth connection command generated by other means.
The monitoring module 20 monitors the sound information of the current environment if receiving the bluetooth connection command. The sound is monitored by a sound collection device (sound input device). The sound collection device (sound input device) may be a microphone or a microphone array. The sound collection device (sound input device) can be always turned on (no matter the Bluetooth terminal is in a standby state or a working state), and can also be turned on according to an instruction according to needs.
And the decryption module 30 decrypts the sound information to obtain the bluetooth address information. As mentioned above, the bluetooth device has an encryption algorithm, and can encrypt the bluetooth address information of the bluetooth device and send out the encrypted bluetooth address information in the form of sound. When the monitored sound contains the encrypted Bluetooth address information, the sound is indicated to contain the required information and is further processed. Wherein the sound containing the encrypted bluetooth address information of the bluetooth device may be emitted by the bluetooth device; the sound of the encrypted Bluetooth address information of the Bluetooth device can also be recorded and sent out through other sound output devices. As mentioned above, the bluetooth terminal has a corresponding decryption algorithm, and after receiving the encrypted bluetooth address information transmitted in the form of voice, decrypts it to obtain the bluetooth address information. Therefore, the security and the selectivity of the Bluetooth connection are improved in the whole process of encrypting and decrypting the Bluetooth address. As described above, the bluetooth terminal obtains the decrypted bluetooth address information of the bluetooth device, and connects to the bluetooth device through the bluetooth address information. Wherein, the process of connecting the bluetooth device includes: directly connecting the Bluetooth device; or generating an instruction whether to connect the Bluetooth device, and connecting the Bluetooth device after receiving the instruction.
Further, the Bluetooth device also comprises a module for receiving or transmitting data to the Bluetooth device. Thereby realizing data transmission between the Bluetooth terminal and the Bluetooth equipment.
Referring to fig. 4, in an embodiment, the decryption module 30 includes:
an encoding judgment sub-module 31, configured to judge whether the sound information contains encoded audio data;
and the decoding submodule 32 is configured to, if the encoded audio data is included, decode the audio data according to the decryption algorithm corresponding to the specified encryption algorithm to obtain bluetooth address information.
The encoding judgment sub-module 31 judges whether the sound information contains encoded audio data. The encoded sound may contain the required information. Only if it is determined that the heard sound is indeed encoded is it necessary to proceed to the next step. The encoding method may be any method, for example, encoding using frequency, timbre, or the like.
And the decoding submodule 32 is used for decoding the audio data according to the decryption algorithm corresponding to the specified encryption algorithm if the encoded audio data is contained, so as to obtain the Bluetooth address information. Since the bluetooth address information is encrypted in this embodiment, it is only determined that the decoded data is encrypted and encrypted by the encryption algorithm of the bluetooth device that the decoded data is encrypted that the sound information is the required sound information. The specific determination method may be any feasible method, for example, determining whether the decoded data conforms to a specific format. As described above, it can be confirmed whether the bluetooth address information is encrypted by a specified encryption algorithm. Accordingly, bluetooth address information is obtained.
Referring to fig. 5, further, the encoding determining sub-module 31 includes:
a frequency judging unit 311 for judging whether there are audio data of a plurality of different specific frequency combinations in the sound information;
an encoding determination unit 312, configured to determine that the sound information includes the encoded audio data if yes.
The encoding method may be any method, and when encoding is performed using a frequency, encoding may be performed by assigning a sound segment having a specific frequency within a specific time period a seconds to a specific signal. For example, to encode information XYZ, where X corresponds to a specific frequency E, Y corresponds to a specific frequency R, and Z corresponds to a specific frequency T, the encoded sound should have a frequency ERT within three consecutive durations of a seconds.
Frequency determining section 311 and coding determining section 312 determine whether or not the monitored sound has a plurality of different specific frequencies. The specific frequency can be any feasible frequency, and can include infrasonic waves, sound waves, ultrasonic waves, low frequency bands, medium and high frequency bands, such as any frequency of 10-500KHz, 20-50KHz and 50-20 KHz. Frequencies that fit within certain frequency ranges may also be considered as specific frequencies, e.g. a frequency of 10-20Hz as specific frequency 1 and 200-2000Hz as specific frequency 2.
As described above, when encoding is performed using frequencies, it is determined whether or not a sound has a plurality of different specific frequencies, and if the sound has a plurality of different specific frequencies, it is determined that the sound has been encoded; if there is only a single specific frequency or no specific frequency, it is determined that the encoding is not performed.
Referring to fig. 6, in an embodiment, there are a plurality of designated bluetooth devices, the decrypted bluetooth address information includes a specific number, and the connection module 40 includes:
a comparison submodule 401 configured to compare sizes of specific numbers in the bluetooth address information of the plurality of designated bluetooth devices, respectively;
and a decryption connection sub-module 402, configured to connect the corresponding specified bluetooth device by using the decrypted bluetooth address information with the largest specific number.
The connection to the designated bluetooth device is implemented as in sub-modules S401-402 described above. In some scenarios, a plurality of bluetooth devices are connected alternatively, for example, a bluetooth speaker and a bluetooth headset are available for connection, and at this time, a connection object should be selected. Specific numbers can be added in the Bluetooth address information so as to judge which device should be connected, wherein the specific numbers can be added at the head of the Bluetooth address, can be added at the tail of the Bluetooth address, and can be inserted in the Bluetooth address. The specific mode comprises the following steps: compared with the specific digital size, the Bluetooth device with the specific digital size is a device to be connected. Wherein, the special number can be added during coding or encryption.
Referring to fig. 7, in one embodiment, the bluetooth connected system includes:
a time judging module 50, configured to judge whether a connection time for continuously connecting to the specified bluetooth device exceeds a predetermined time;
and a disconnection module 60, configured to disconnect the specified bluetooth device if the predetermined time is exceeded.
Disconnection of the connection is achieved as in the above-described modules 50-60. When the bluetooth connection time is too long, the required connection time may be exceeded (e.g., the owner has left, but forgotten to turn off the bluetooth), thus causing a large amount of power consumption. Accordingly, when the continuous connection is too long, i.e., exceeds a predetermined time, the connection is disconnected. Wherein the predetermined time may be 1 hour, 3 hours, 5 hours, 10 hours, etc.
According to the Bluetooth connection system provided by the invention, the encrypted Bluetooth address information in the sound information is acquired by monitoring and decrypting means, so that Bluetooth connection is completed, and the technical problems that manual operation is required for Bluetooth connection and the safety cannot be ensured are solved. The Bluetooth address information is output by sound by encoding the sound with a plurality of different specific frequencies, and only the different specific frequencies are identified to judge whether the sound is encoded, so that the calculation force is saved.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.