CN113473434A - Bluetooth connection method, device, computer equipment and computer readable storage medium - Google Patents

Bluetooth connection method, device, computer equipment and computer readable storage medium Download PDF

Info

Publication number
CN113473434A
CN113473434A CN202110944887.XA CN202110944887A CN113473434A CN 113473434 A CN113473434 A CN 113473434A CN 202110944887 A CN202110944887 A CN 202110944887A CN 113473434 A CN113473434 A CN 113473434A
Authority
CN
China
Prior art keywords
bluetooth
connection
equipment
application
broadcast packet
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.)
Pending
Application number
CN202110944887.XA
Other languages
Chinese (zh)
Inventor
童佳林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Tuya Information Technology Co Ltd
Original Assignee
Hangzhou Tuya Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hangzhou Tuya Information Technology Co Ltd filed Critical Hangzhou Tuya Information Technology Co Ltd
Priority to CN202110944887.XA priority Critical patent/CN113473434A/en
Publication of CN113473434A publication Critical patent/CN113473434A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup

Abstract

The application relates to a Bluetooth connection method, a Bluetooth connection device, a computer device and a readable storage medium, wherein the method comprises the following steps: acquiring a Bluetooth device object establishing Bluetooth connection with a system layer by a system method; and establishing Bluetooth connection with the Bluetooth equipment in an application layer according to the Bluetooth equipment object. Through the method and the device, the problem that the Bluetooth equipment paired in the system layer can not be connected in the Bluetooth mode is solved.

Description

Bluetooth connection method, device, computer equipment and computer readable storage medium
Technical Field
The present application relates to the field of internet of things, and in particular, to a bluetooth connection method, apparatus, computer device, and computer-readable storage medium.
Background
The general connection mode of the Bluetooth equipment is that the Bluetooth equipment sends a Bluetooth broadcast packet, and after the intelligent terminal APP receives the Bluetooth broadcast packet, the content of the broadcast packet is analyzed, and the Bluetooth equipment is checked and connected. And after the connection is successful, obtaining information such as a service characteristic value and the like. However, for devices needing to interact with the intelligent terminal system, after the bluetooth device completes the common bluetooth network distribution, the bluetooth device needs to be paired with the system bottom layer. Devices interacting with the intelligent terminal system need to receive system music, notifications, telephone calls, and the like, for example. After the devices of the type are successfully paired, if the intelligent terminal APP is killed, or the Bluetooth device in the APP is offline, the system layer can still be connected with the Bluetooth device; in one case, if the APP is removed, the Bluetooth system layer and the Bluetooth device are still in a connected state, when the APP is opened again, the Bluetooth broadcast packet cannot be sent when the Bluetooth is connected, therefore, the intelligent terminal application cannot search the broadcast packet content of the Bluetooth device, and the application cannot be connected with the Bluetooth device at the moment. But the real case of a bluetooth device is: the client system layer bluetooth remains connected to the bluetooth device, but the client application may appear offline, which is not practical.
Occurring for the above specific bluetooth devices: the bottom layer Bluetooth of the mobile phone system is connected with the Bluetooth equipment, but the bottom layer Bluetooth of the mobile phone system cannot be connected with the Bluetooth equipment in the application. In the current scheme, if the user wants to connect to the bluetooth device at this time, the connection between the bluetooth device and the system layer must be disconnected manually, that is: the user goes bluetooth interface disconnection bluetooth equipment in the cell-phone setting, makes bluetooth equipment send the broadcast package, then uses APP could search for bluetooth equipment through bluetooth broadcast package, and connect this bluetooth equipment. The method greatly increases the operation difficulty of the user, and the operation is very complicated.
Disclosure of Invention
The embodiment of the application provides a Bluetooth connection method, a Bluetooth connection device, computer equipment and a computer-readable storage medium, so as to at least solve the problem that Bluetooth connection cannot be performed on Bluetooth equipment paired in a system layer in the related art.
In a first aspect, an embodiment of the present application provides a bluetooth connection method, where the method includes:
acquiring a Bluetooth device object establishing Bluetooth connection with a system layer by a system method;
and establishing Bluetooth connection with the Bluetooth equipment in an application layer according to the Bluetooth equipment object.
In some embodiments, after the establishing the bluetooth connection with the bluetooth device at the application layer, the method further comprises:
reading a Bluetooth broadcast packet stored in the Bluetooth equipment;
verifying whether the Bluetooth equipment belongs to the application corresponding to the application layer or not according to the Bluetooth broadcast packet;
if not, the Bluetooth connection between the Bluetooth equipment and the application layer is disconnected.
In some embodiments, the obtaining the bluetooth broadcast packet stored in the bluetooth device includes:
and reading the characteristic value information of the Bluetooth equipment to obtain the Bluetooth broadcast packet.
In some embodiments, verifying whether the bluetooth device belongs to the application according to the bluetooth broadcast packet includes:
analyzing a first field of the Bluetooth broadcast packet to obtain an identifier of the Bluetooth equipment;
according to whether the identification of the Bluetooth equipment is matched with the application or not;
and if so, determining that the Bluetooth equipment belongs to the application.
In some of these embodiments, the method further comprises:
if the Bluetooth equipment belongs to the application corresponding to the application layer, analyzing a second field of the Bluetooth broadcast packet to obtain a security protocol version of the Bluetooth broadcast packet;
analyzing a third field of the Bluetooth broadcast packet according to the security protocol version to obtain an encryption mode of the Bluetooth broadcast packet;
analyzing a fourth field of the Bluetooth broadcast packet according to the encryption mode to obtain the equipment type, UUID, activation state, Mac address and productId of the Bluetooth equipment;
verifying whether the device type, UUID, activation state, Mac address and productId of the Bluetooth device meet a preset matching rule or not;
and if not, disconnecting the Bluetooth connection with the Bluetooth equipment in the application layer.
In some of these embodiments, the bluetooth device comprises a bluetooth device that needs to interact with system applications.
In some embodiments, the bluetooth device object for establishing the bluetooth connection with the system layer is obtained by a retrievecennectpperadhersalwithservices method.
In a second aspect, an embodiment of the present application provides a bluetooth connection apparatus, including: the device comprises an acquisition module and a connection module; wherein:
the acquisition module is used for acquiring a Bluetooth device object establishing Bluetooth connection with a system layer through a system method;
and the connection module is used for establishing Bluetooth connection with the Bluetooth equipment in an application layer according to the Bluetooth equipment object.
In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the bluetooth connection method according to the first aspect is implemented.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the bluetooth connection method according to the first aspect is implemented.
Compared with the related technology, the Bluetooth connection method provided by the embodiment of the application acquires the Bluetooth equipment object establishing Bluetooth connection with the system layer through the system method; and establishing Bluetooth connection with the Bluetooth equipment in an application layer according to the Bluetooth equipment object, thereby solving the problem that the Bluetooth equipment in the application cannot be normally connected when the specific Bluetooth equipment is paired with the Bluetooth equipment in a system layer in the related technology.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a flowchart of a bluetooth connection method provided in an embodiment of the present application;
fig. 2 is a block diagram of a bluetooth connection device according to an embodiment of the present disclosure;
fig. 3 is a flowchart of a bluetooth connection method according to the preferred embodiment of the present application;
fig. 4 is an internal structural diagram of a computer device provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
The embodiment also provides a Bluetooth connection method. Fig. 1 is a flowchart of a bluetooth connection method according to an embodiment of the present application, and as shown in fig. 1, the flowchart includes the following steps:
and step 110, acquiring a Bluetooth device object establishing Bluetooth connection with a system layer through a system method.
And step 120, establishing a bluetooth connection with the bluetooth device in an application layer according to the bluetooth device object.
Currently, a bluetooth device that needs to interact with a system application not only establishes bluetooth connection with an application layer of a client application in a normal state, but also establishes bluetooth connection with a system layer of the client. When the client application exits or goes offline, the Bluetooth device still maintains the Bluetooth connection state with the system layer, and the Bluetooth device does not send the Bluetooth broadcast packet in the state. If a user wants to establish bluetooth connection between the bluetooth device and an application layer of the client application, the bluetooth connection between the bluetooth device and the system bottom layer needs to be manually disconnected in advance, so that the bluetooth device can send a bluetooth broadcast packet, and the bluetooth connection between the bluetooth device and the application layer can be established through the bluetooth broadcast packet. However, this solution requires manual operation by the user and is very cumbersome.
Based on the problems existing in the above scenes, the application provides a bluetooth connection method, which can be applied to client applications, such as a doodle APP, wherein the doodle APP is a platform Internet of Things (IoT) intelligent APP, and can control intelligent devices of different brands and classes through one APP. In order to establish a bluetooth connection between a bluetooth device in a connection state with a system layer and a client, a bluetooth connection method provided by the present application first obtains a bluetooth device object, which may specifically be an instance of the bluetooth device object, and iOS is a CBPeripheral object. By way of example of iOS, bluetooth devices connected to the system layer can be acquired by the method of retrievecevennect personals services. And after the Bluetooth device object which is connected with the system layer is acquired, the Bluetooth connection between the Bluetooth device and the application layer is established according to the Bluetooth device object.
The method comprises the steps that a Bluetooth device object which is connected with a system layer in a Bluetooth mode is obtained through a system method; and establishing Bluetooth connection with the Bluetooth equipment in an application layer according to the Bluetooth equipment object. Therefore, the user can directly establish the Bluetooth connection of the application layer between the Bluetooth equipment in the connection state with the system layer and the client, the user does not need to manually disconnect the Bluetooth connection of the system layer and then perform the Bluetooth connection of the system layer, and the operation is more convenient.
In some embodiments, after the establishing the bluetooth connection with the bluetooth device at the application layer, the method further comprises:
reading a Bluetooth broadcast packet stored in the Bluetooth equipment;
verifying whether the Bluetooth equipment belongs to the application corresponding to the application layer or not according to the Bluetooth broadcast packet;
if not, the Bluetooth connection between the Bluetooth equipment and the application layer is disconnected.
Because the bluetooth connection established between the bluetooth device object and the bluetooth device may have an insecurity problem, for example, the bluetooth connections corresponding to all the acquired bluetooth devices may be established in the application layer, regardless of whether the bluetooth device belongs to the application. Therefore, this embodiment proposes a method, after establishing a bluetooth connection with a bluetooth device in an application layer, further checking the bluetooth device to check whether the bluetooth device belongs to an application, that is, whether the bluetooth device belongs to an application that has established the bluetooth connection.
It should be noted that the bluetooth connection in this step is only a simple connection setup, and cannot complete the transceiving and control of the control command.
Specifically, after the bluetooth device object is acquired, the product information of the bluetooth device needs to be taken to determine whether the bluetooth device is in the corresponding application. However, since the product information of the bluetooth device is in the bluetooth broadcast packet sent by the bluetooth device, the method provided in this embodiment needs hardware end assistance, writes data of the bluetooth broadcast packet into the bluetooth device in advance, reads the bluetooth broadcast packet stored in the bluetooth device after obtaining the object of the bluetooth device, obtains the bluetooth device information, further verifies the bluetooth device according to the bluetooth device information, and verifies whether the bluetooth device belongs to the application corresponding to the application layer. For example, the bluetooth device establishes a bluetooth connection on an application layer with a graffiti APP, and then checks whether the bluetooth device belongs to the graffiti device.
In some embodiments, verifying whether the bluetooth device belongs to an application corresponding to an application layer according to the bluetooth device broadcast packet includes:
analyzing a first field of the Bluetooth broadcast packet to obtain an identifier of the Bluetooth equipment;
according to whether the identification of the Bluetooth equipment is matched with the application or not;
and if so, determining that the Bluetooth equipment belongs to the application.
In this embodiment, a set of matching rules of the doodle is established to determine whether the bluetooth device is a doodle device, and what meets the preset rules is the doodle device.
In some embodiments, the bluetooth broadcast packet is written into the feature value of the bluetooth device, and the data in the bluetooth broadcast packet is obtained by reading the feature value information of the bluetooth device. For example, the iOS end is: CBCharacteriostic object. The bluetooth broadcast packet content may specifically include:
Figure BDA0003216305460000061
in this embodiment, after acquiring the bluetooth device object, the application is first connected to the bluetooth, and then the service and the feature value of the bluetooth device are acquired after connection, and the broadcast packet content (bluetooth device information) of the bluetooth device is obtained by reading the feature value information, and then the bluetooth device is checked according to the bluetooth device information to verify whether the bluetooth device belongs to the application. It should be noted that, the bluetooth broadcast packet is written into the feature value in an embedded manner, and data in the bluetooth broadcast packet in the feature value changes according to a preset rule.
After the Bluetooth connection is successful, if the broadcast packet content under the corresponding characteristic value cannot be obtained, the Bluetooth device is not a product applied by the Bluetooth device and can be ignored; or after checking the content of the received Bluetooth broadcast packet, if the Bluetooth device is confirmed to be under other account numbers or belong to other applied devices after checking, the Bluetooth device is also ignored; if the verification is successful, the Bluetooth equipment belongs to the Bluetooth equipment applied by the Bluetooth equipment, and the Bluetooth equipment is further verified.
In some embodiments, if the bluetooth device belongs to the application corresponding to the application layer, a second field of the bluetooth broadcast packet is analyzed to obtain a security protocol version of the bluetooth broadcast packet;
analyzing a third field of the Bluetooth broadcast packet according to the security protocol version to obtain an encryption mode of the Bluetooth broadcast packet;
analyzing a fourth field of the Bluetooth broadcast packet according to the encryption mode to obtain the equipment type, UUID, activation state, Mac address and productId of the Bluetooth equipment;
verifying whether the device type, UUID, activation state, Mac address and productId of the Bluetooth device meet a preset matching rule or not;
and if not, disconnecting the Bluetooth connection with the Bluetooth equipment in the application layer.
If the Bluetooth connection is matched with the Bluetooth device, the Bluetooth connection of the Bluetooth device on an application layer is determined, namely, safe Bluetooth communication connection is established between the client APP and the Bluetooth device, and the client APP can send a control command through the communication channel to control the Bluetooth device.
In some of these embodiments, the bluetooth device comprises a bluetooth device that needs to interact with system applications.
This type of bluetooth device needs to receive music, notifications, phone calls, etc. sent by the system, such as bluetooth bracelet, loud speaker, etc.
The embodiments of the present application are described and illustrated below by means of preferred embodiments.
Fig. 2 is a flowchart of a bluetooth connection method according to a preferred embodiment of the present application. As shown in fig. 2, the bluetooth connection method includes:
acquiring a Bluetooth device object establishing Bluetooth connection with a system layer by a system method;
establishing Bluetooth connection with Bluetooth equipment in an application layer according to the Bluetooth equipment object;
reading the characteristic value information of the Bluetooth equipment to obtain the Bluetooth equipment information;
if the information of the Bluetooth equipment is not acquired, disconnecting the Bluetooth connection between the corresponding Bluetooth equipment and the application layer;
if the Bluetooth device information is acquired, verifying whether the Bluetooth device belongs to the application or not according to the Bluetooth device information;
if the Bluetooth equipment does not belong to the application, disconnecting the Bluetooth connection between the corresponding Bluetooth equipment and the application layer;
if the Bluetooth broadcast packet belongs to the safety protocol version, analyzing a second field of the Bluetooth broadcast packet to obtain a safety protocol version of the Bluetooth broadcast packet;
analyzing a third field of the Bluetooth broadcast packet according to the security protocol version to obtain an encryption mode of the Bluetooth broadcast packet;
analyzing a fourth field of the Bluetooth broadcast packet according to the encryption mode to obtain the equipment type, UUID, activation state, Mac address and productId of the Bluetooth equipment;
verifying whether the device type, UUID, activation state, Mac address and productId of the Bluetooth device meet a preset matching rule or not;
if the Bluetooth connection is matched with the Bluetooth device, determining the Bluetooth connection of the Bluetooth device in an application layer;
and if not, disconnecting the Bluetooth connection with the Bluetooth equipment in the application layer.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.
The present embodiment further provides a bluetooth connection device, which is used to implement the foregoing embodiments and preferred embodiments, and the details of which have been already described are not repeated. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 3 is a block diagram of a bluetooth connection apparatus according to an embodiment of the present application, and as shown in fig. 3, the apparatus includes: an acquisition module 310 and a connection module 320; wherein:
an obtaining module 310, configured to obtain, by a system method, a bluetooth device object that establishes a bluetooth connection with a system layer;
the connection module 320 is configured to establish a bluetooth connection with the bluetooth device in the application layer according to the bluetooth device object.
The method comprises the steps that a Bluetooth device object which is connected with a system layer in a Bluetooth mode is obtained through a system method; and establishing Bluetooth connection with the Bluetooth equipment in an application layer according to the Bluetooth equipment object. Therefore, the user can directly establish the Bluetooth connection of the application layer between the Bluetooth equipment in the connection state with the system layer and the client, the user does not need to manually disconnect the Bluetooth connection of the system layer and then perform the Bluetooth connection of the system layer, and the operation is more convenient.
In some embodiments, the system further comprises a verification module, wherein the verification module is configured to: reading a Bluetooth broadcast packet stored in the Bluetooth equipment; verifying whether the Bluetooth equipment belongs to the application corresponding to the application layer or not according to the Bluetooth broadcast packet; if not, the Bluetooth connection between the Bluetooth equipment and the application layer is disconnected.
In some embodiments, the verification module is further configured to: and reading the characteristic value information of the Bluetooth equipment to obtain the Bluetooth broadcast packet.
In some embodiments, the verification module is further configured to:
acquiring a preset matching rule corresponding to the application;
analyzing a first field of the Bluetooth broadcast packet to obtain an identifier of the Bluetooth equipment;
verifying whether the identifier of the Bluetooth equipment is matched with the application or not according to a preset matching rule;
and if so, determining that the Bluetooth equipment belongs to the application.
In some embodiments, the system further comprises a verification module for:
if the Bluetooth equipment belongs to the application corresponding to the application layer, analyzing a second field of the Bluetooth broadcast packet to obtain a security protocol version of the Bluetooth broadcast packet;
analyzing a third field of the Bluetooth broadcast packet according to the security protocol version to obtain an encryption mode of the Bluetooth broadcast packet;
analyzing a fourth field of the Bluetooth broadcast packet according to the encryption mode to obtain the equipment type, UUID, activation state, Mac address and productId of the Bluetooth equipment;
verifying whether the device type, UUID, activation state, Mac address and productId of the Bluetooth device meet a preset matching rule or not;
if the Bluetooth connection is matched with the Bluetooth device, determining the Bluetooth connection of the Bluetooth device in an application layer;
and if not, disconnecting the Bluetooth connection with the Bluetooth equipment in the application layer. .
In some of these embodiments, the bluetooth device comprises a bluetooth device that needs to interact with system applications.
In some embodiments, the bluetooth device object for establishing the bluetooth connection with the system layer is obtained by a retrievecennectpperadhersalwithservices method.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
In addition, the bluetooth connection method described in connection with fig. 1 in the embodiment of the present application may be implemented by a computer device. Fig. 4 is a hardware structure diagram of a computer device according to an embodiment of the present application.
The computer device may include a processor 41 and a memory 42 storing computer program instructions.
Specifically, the processor 41 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
Memory 42 may include, among other things, mass storage for data or instructions. By way of example, and not limitation, memory 42 may include a Hard Disk Drive (Hard Disk Drive, abbreviated to HDD), a floppy Disk Drive, a Solid State Drive (SSD), flash memory, an optical Disk, a magneto-optical Disk, tape, or a Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 42 may include removable or non-removable (or fixed) media, where appropriate. The memory 42 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 42 is a Non-Volatile (Non-Volatile) memory. In particular embodiments, Memory 42 includes Read-Only Memory (ROM) and Random Access Memory (RAM). The ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), Electrically rewritable ROM (earrom), or FLASH Memory (FLASH), or a combination of two or more of these, where appropriate. The RAM may be a Static Random-Access Memory (SRAM) or a Dynamic Random-Access Memory (DRAM), where the DRAM may be a Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), an Extended data output Dynamic Random-Access Memory (EDODRAM), a Synchronous Dynamic Random-Access Memory (SDRAM), and the like.
Memory 42 may be used to store or cache various data files for processing and/or communication use, as well as possibly computer program instructions for execution by processor 41.
The processor 41 may implement any of the bluetooth connection methods in the above embodiments by reading and executing computer program instructions stored in the memory 42.
In some of these embodiments, the computer device may also include a communication interface 43 and a bus 40. As shown in fig. 4, the processor 41, the memory 42, and the communication interface 43 are connected via the bus 40 to complete mutual communication.
The communication interface 43 is used for implementing communication between modules, devices, units and/or apparatuses in the embodiments of the present application. The communication interface 43 may also be implemented with other components such as: the data communication is carried out among external equipment, image/data acquisition equipment, a database, external storage, an image/data processing workstation and the like.
Bus 40 comprises hardware, software, or both coupling the components of the computer device to each other. Bus 40 includes, but is not limited to, at least one of the following: data Bus (Data Bus), Address Bus (Address Bus), Control Bus (Control Bus), Expansion Bus (Expansion Bus), and Local Bus (Local Bus). By way of example, and not limitation, Bus 40 may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (FSB), a Hyper Transport (HT) Interconnect, an ISA (ISA) Bus, an InfiniBand (InfiniBand) Interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a microchannel Architecture (MCA) Bus, a PCI (Peripheral Component Interconnect) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a Video Electronics Bus (audio Electronics Association), abbreviated VLB) bus or other suitable bus or a combination of two or more of these. Bus 40 may include one or more buses, where appropriate. Although specific buses are described and shown in the embodiments of the application, any suitable buses or interconnects are contemplated by the application.
The computer device may execute the bluetooth connection method in the embodiment of the present application based on the obtained program instruction, thereby implementing the bluetooth connection method described in conjunction with fig. 1.
In addition, in combination with the bluetooth connection method in the foregoing embodiments, the embodiments of the present application may be implemented by providing a computer-readable storage medium. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the bluetooth connection methods in the above embodiments.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A bluetooth connection method, the method comprising:
acquiring a Bluetooth device object establishing Bluetooth connection with a system layer by a system method;
and establishing Bluetooth connection with the Bluetooth equipment in an application layer according to the Bluetooth equipment object.
2. The method of claim 1, wherein after the establishing the bluetooth connection with the bluetooth device at the application layer, the method further comprises:
reading a Bluetooth broadcast packet stored in the Bluetooth equipment;
verifying whether the Bluetooth equipment belongs to the application corresponding to the application layer or not according to the Bluetooth broadcast packet;
if not, the Bluetooth connection between the Bluetooth equipment and the application layer is disconnected.
3. The method of claim 2, wherein the obtaining the stored bluetooth broadcast packets in the bluetooth device comprises:
and reading the characteristic value information of the Bluetooth equipment to obtain the Bluetooth broadcast packet.
4. The method of claim 2, wherein verifying whether the bluetooth device belongs to the application according to the bluetooth broadcast packet comprises:
analyzing a first field of the Bluetooth broadcast packet to obtain an identifier of the Bluetooth equipment;
according to whether the identification of the Bluetooth equipment is matched with the application or not;
and if so, determining that the Bluetooth equipment belongs to the application.
5. The method of claim 2, further comprising:
if the Bluetooth equipment belongs to the application corresponding to the application layer, analyzing a second field of the Bluetooth broadcast packet to obtain a security protocol version of the Bluetooth broadcast packet;
analyzing a third field of the Bluetooth broadcast packet according to the security protocol version to obtain an encryption mode of the Bluetooth broadcast packet;
analyzing a fourth field of the Bluetooth broadcast packet according to the encryption mode to obtain the equipment type, UUID, activation state, Mac address and productId of the Bluetooth equipment;
verifying whether the device type, UUID, activation state, Mac address and productId of the Bluetooth device meet a preset matching rule or not;
and if not, disconnecting the Bluetooth connection with the Bluetooth equipment in the application layer.
6. The method of claim 1, wherein the bluetooth device comprises a bluetooth device that needs to interact with a system application.
7. The method of claim 1, wherein the bluetooth device object for establishing bluetooth connection with the system layer is obtained by a retrieveconnectedpeers services method.
8. A bluetooth connection device, comprising: the device comprises an acquisition module and a connection module; wherein:
the acquisition module is used for acquiring a Bluetooth device object establishing Bluetooth connection with a system layer through a system method;
and the connection module is used for establishing Bluetooth connection with the Bluetooth equipment in an application layer according to the Bluetooth equipment object.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the bluetooth connection method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the bluetooth connection method according to any one of claims 1 to 7.
CN202110944887.XA 2021-08-17 2021-08-17 Bluetooth connection method, device, computer equipment and computer readable storage medium Pending CN113473434A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110944887.XA CN113473434A (en) 2021-08-17 2021-08-17 Bluetooth connection method, device, computer equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110944887.XA CN113473434A (en) 2021-08-17 2021-08-17 Bluetooth connection method, device, computer equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN113473434A true CN113473434A (en) 2021-10-01

Family

ID=77867803

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110944887.XA Pending CN113473434A (en) 2021-08-17 2021-08-17 Bluetooth connection method, device, computer equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113473434A (en)

Citations (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103636141A (en) * 2012-11-16 2014-03-12 华为终端有限公司 Method for establishing Bluetooth connection, mobile terminal, Bluetooth devices and system
CN104768125A (en) * 2015-04-20 2015-07-08 北京旅信顺捷软件科技有限公司 Intelligent mobile device and BLE device pairing method
CN105392114A (en) * 2015-12-03 2016-03-09 北京握奇智能科技有限公司 NFC based rapid Bluetooth connection system and method
CN105471478A (en) * 2015-09-28 2016-04-06 小米科技有限责任公司 Message sending method, message receiving method and devices
CN105550909A (en) * 2016-02-22 2016-05-04 苏州工业园区服务外包职业学院 Business pushing system and method
WO2017076269A1 (en) * 2015-11-03 2017-05-11 国民技术股份有限公司 Smart device, and method and apparatus for establishing bluetooth connection between devices therefor
CN107454563A (en) * 2017-09-08 2017-12-08 歌尔科技有限公司 A kind of Bluetooth communication method, device and bluetooth equipment
CN107770762A (en) * 2017-11-20 2018-03-06 飞天诚信科技股份有限公司 A kind of method and device for establishing bluetooth connection
WO2018076604A1 (en) * 2016-10-25 2018-05-03 华为技术有限公司 Bluetooth pairing method and terminal device
CN108279948A (en) * 2018-01-09 2018-07-13 维沃移动通信有限公司 A kind of application program launching method and mobile terminal
CN108924805A (en) * 2018-07-13 2018-11-30 杭州网易云音乐科技有限公司 Bluetooth connecting method, medium and the first, second electronic equipment and calculating equipment
CN109688573A (en) * 2019-01-22 2019-04-26 北京深思数盾科技股份有限公司 Exchange method and bluetooth equipment between bluetooth equipment
CN109743692A (en) * 2018-12-28 2019-05-10 深圳Tcl新技术有限公司 Acquisition methods, system and the computer readable storage medium of bluetooth hot spot information
CN110062104A (en) * 2019-03-13 2019-07-26 维沃移动通信有限公司 Application program launching method, device and mobile terminal
CN110086926A (en) * 2019-04-15 2019-08-02 努比亚技术有限公司 Starting method, apparatus, mobile terminal and the storage medium of terminal applies
CN110582078A (en) * 2019-08-28 2019-12-17 RealMe重庆移动通信有限公司 Bluetooth pairing method and device, storage medium and electronic equipment
CN110753334A (en) * 2019-10-25 2020-02-04 华为技术有限公司 Bluetooth communication method, device and equipment with Bluetooth communication function
CN112822663A (en) * 2019-10-31 2021-05-18 华为技术有限公司 Bluetooth connection method and related device
CN112887952A (en) * 2021-01-28 2021-06-01 Oppo广东移动通信有限公司 Method and device for connecting Bluetooth device and terminal, and electronic device
CN113055864A (en) * 2019-12-26 2021-06-29 Oppo广东移动通信有限公司 Bluetooth connection method, device, storage medium and electronic equipment
CN113132962A (en) * 2019-04-16 2021-07-16 华为技术有限公司 Bluetooth scanning method and electronic equipment

Patent Citations (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103636141A (en) * 2012-11-16 2014-03-12 华为终端有限公司 Method for establishing Bluetooth connection, mobile terminal, Bluetooth devices and system
CN104768125A (en) * 2015-04-20 2015-07-08 北京旅信顺捷软件科技有限公司 Intelligent mobile device and BLE device pairing method
CN105471478A (en) * 2015-09-28 2016-04-06 小米科技有限责任公司 Message sending method, message receiving method and devices
WO2017076269A1 (en) * 2015-11-03 2017-05-11 国民技术股份有限公司 Smart device, and method and apparatus for establishing bluetooth connection between devices therefor
CN105392114A (en) * 2015-12-03 2016-03-09 北京握奇智能科技有限公司 NFC based rapid Bluetooth connection system and method
CN105550909A (en) * 2016-02-22 2016-05-04 苏州工业园区服务外包职业学院 Business pushing system and method
WO2018076604A1 (en) * 2016-10-25 2018-05-03 华为技术有限公司 Bluetooth pairing method and terminal device
CN107454563A (en) * 2017-09-08 2017-12-08 歌尔科技有限公司 A kind of Bluetooth communication method, device and bluetooth equipment
CN107770762A (en) * 2017-11-20 2018-03-06 飞天诚信科技股份有限公司 A kind of method and device for establishing bluetooth connection
CN108279948A (en) * 2018-01-09 2018-07-13 维沃移动通信有限公司 A kind of application program launching method and mobile terminal
CN108924805A (en) * 2018-07-13 2018-11-30 杭州网易云音乐科技有限公司 Bluetooth connecting method, medium and the first, second electronic equipment and calculating equipment
CN109743692A (en) * 2018-12-28 2019-05-10 深圳Tcl新技术有限公司 Acquisition methods, system and the computer readable storage medium of bluetooth hot spot information
CN109688573A (en) * 2019-01-22 2019-04-26 北京深思数盾科技股份有限公司 Exchange method and bluetooth equipment between bluetooth equipment
CN110062104A (en) * 2019-03-13 2019-07-26 维沃移动通信有限公司 Application program launching method, device and mobile terminal
CN110086926A (en) * 2019-04-15 2019-08-02 努比亚技术有限公司 Starting method, apparatus, mobile terminal and the storage medium of terminal applies
CN113132962A (en) * 2019-04-16 2021-07-16 华为技术有限公司 Bluetooth scanning method and electronic equipment
CN110582078A (en) * 2019-08-28 2019-12-17 RealMe重庆移动通信有限公司 Bluetooth pairing method and device, storage medium and electronic equipment
CN110753334A (en) * 2019-10-25 2020-02-04 华为技术有限公司 Bluetooth communication method, device and equipment with Bluetooth communication function
CN112822663A (en) * 2019-10-31 2021-05-18 华为技术有限公司 Bluetooth connection method and related device
CN113055864A (en) * 2019-12-26 2021-06-29 Oppo广东移动通信有限公司 Bluetooth connection method, device, storage medium and electronic equipment
CN112887952A (en) * 2021-01-28 2021-06-01 Oppo广东移动通信有限公司 Method and device for connecting Bluetooth device and terminal, and electronic device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
佚名: "[BLE--SMP]蓝牙的SMP安全管理简介", Retrieved from the Internet <URL:《https://blog.csdn.net/suxiang198/article/details/48650883》> *
佚名: "iOS蓝牙4.0关于ANCS的配对", Retrieved from the Internet <URL:《retrieveConnectedPeripheralsWithServices》> *
王瑞祥: "基于BLE技术的智能手环方案与应用层安全模型设计", 《中国优秀硕士学位论文全文数据库 (信息科技辑)》, 15 April 2018 (2018-04-15) *

Similar Documents

Publication Publication Date Title
US11093981B2 (en) Smart broadcasting device
CN104767713B (en) Account binding method, server and system
CN108667699B (en) Method and device for interconnecting terminal equipment and gateway equipment
WO2016029595A1 (en) Method, device, and equipment for calling open platform and non-volatile computer storage medium
CN110167192B (en) Bluetooth connection management method and device, electronic equipment and non-transient storage medium
CN111132305B (en) Method for 5G user terminal to access 5G network, user terminal equipment and medium
US20140134986A1 (en) System, electronic device, method of communicating, and computer-readable storage medium having communication program stored therein
CN111404695B (en) Token request verification method and device
CN110730446A (en) Login method, terminal and computer storage medium
CN107508784B (en) Application login method and terminal equipment
WO2017157290A1 (en) Interception method, core network device and base station
CN109040050B (en) Data interaction method and related product
CN113573291A (en) Bluetooth connection method, device, computer equipment and computer readable storage medium
WO2020044088A1 (en) File transfer method and apparatus thereof, and device/terminal/server
CN104092599B (en) A kind of method and mobile terminal of mobile terminal detection mail outbox Service-Port
CN105282821A (en) Terminal and method for connecting the terminal with wireless fidelity WiFi access point
CN113473434A (en) Bluetooth connection method, device, computer equipment and computer readable storage medium
JP2006514763A (en) Distributed authentication system and method for permitting connection to communication device
CN108282784B (en) Wireless network access method, MiFi terminal, mobile terminal and storage medium
CN112887155B (en) QoS (quality of service) associated information synchronization method and related product
CN115801299A (en) Meta-universe identity authentication method, device, equipment and storage medium
CN111741463B (en) Communication connection method, related equipment and storage medium
CN113691964B (en) Bluetooth device connection method, device and storage medium
CN115004634B (en) Information processing method, device, equipment and storage medium
CN114071455A (en) Secret-free authentication method, server, system and gateway equipment

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