Bluetooth device connection method, device, medium, and equipment
The mini program terminal obtains and displays the service information of Bluetooth devices, and realizes the function of users to quickly select and connect to devices, solves the problem of cumbersome Bluetooth device connection process in the existing technology, and improves the operation convenience and real-timeness of the device list.
Patent Information
- Application Number
- CN202211444856.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-18
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-11-18
AI Technical Summary
In the prior art, when the mobile terminal is connected to multiple Bluetooth devices, the process is complicated and the user operations are complicated. Especially in a home environment, the Bluetooth devices are numerous and widely distributed, resulting in troublesome connection process.
The mini-program terminal obtains the service information of each Bluetooth device in the surrounding environment, displays the device list, and after the user selects the device, determines whether it meets the connection requirements, sends a connection request, and forwards the service information after establishing the connection, simplifying the subsequent device connection process.
Simplifies the Bluetooth device connection process, improves user operation convenience, reduces duplicate device search and connection request steps, and ensures real-time and comprehensiveness of the device list.
Smart Images

Figure CN115835415B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Bluetooth connection, and in particular, to a method and device for connecting Bluetooth devices, a medium, and a device. Background Art
[0002] With the development of mobile phone terminals controlling household appliances through Bluetooth, the demand for mobile phone terminals to control multiple Bluetooth devices has increased. Currently, the connection process between a mobile phone terminal and each Bluetooth device is the same. Therefore, the more Bluetooth devices there are, the more troublesome the process for users to connect Bluetooth devices becomes. Therefore, it is necessary to optimize the process when a mobile phone terminal connects multiple Bluetooth devices. Summary of the Invention
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present invention provides a method and device for connecting Bluetooth devices, a medium, and a device.
[0004] In a first aspect, an embodiment of the present invention provides a method for connecting Bluetooth devices, which is executed by a mini-program terminal. The method includes:
[0005] Obtain first service information of each Bluetooth device in the surrounding environment; wherein, there are multiple Bluetooth devices in the surrounding environment, and each Bluetooth device is connected through WIFI, and each powered-on Bluetooth device is configured to be in a discoverable and connectable mode;
[0006] According to the first service information, display a first device list formed by each Bluetooth device;
[0007] In response to a device selection operation of the user in the first device list, determine whether the first Bluetooth device selected by the user meets the connection requirements. If so, send a first connection request to the first Bluetooth device, and the first connection request carries second service information of the mini-program terminal, so that after receiving the connection request, the first Bluetooth device establishes a first connection with the mini-program terminal according to the second service information, and forwards the second service information to each of the remaining Bluetooth devices after establishing the first connection;
[0008] In response to a device selection operation of the user in the first device list, determine whether the second Bluetooth device selected by the user meets the connection requirements. If so, disconnect the first connection with the first Bluetooth device, and send a second connection request to the second Bluetooth device, so that after receiving the second connection request, the second Bluetooth device establishes a second connection with the mini-program terminal according to the second service information obtained from the first Bluetooth device.
[0009] In a second aspect, an embodiment of the present invention provides a Bluetooth device connection device, which is deployed on a mini-program terminal. The device includes:
[0010] An information acquisition module, configured to acquire first service information of each Bluetooth device in the surrounding environment; wherein, there are multiple Bluetooth devices in the surrounding environment, and the Bluetooth devices are connected through WIFI, and each powered-on Bluetooth device is configured to be in a discoverable and connectable mode;
[0011] A list display module, configured to display a first device list formed by each Bluetooth device according to the first service information;
[0012] A first connection module, configured to, in response to a device selection operation of a user in the first device list, determine whether the selected first Bluetooth device meets the connection requirements. If so, send a first connection request to the first Bluetooth device, where the first connection request carries second service information of the applet terminal, so that the first Bluetooth device establishes a first connection with the applet terminal according to the second service information after receiving the connection request, and forwards the second service information to the remaining Bluetooth devices after establishing the first connection;
[0013] A second connection module, configured to, in response to a device selection operation of a user in the first device list, determine whether the selected second Bluetooth device meets the connection requirements. If so, disconnect the first connection with the first Bluetooth device and send a second connection request to the second Bluetooth device, so that the second Bluetooth device establishes a second connection with the applet terminal according to the second service information obtained from the first Bluetooth device when receiving the second connection request.
[0014] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is made to execute the method provided in the first aspect.
[0015] In a fourth aspect, an embodiment of the present invention provides a computing device, including a memory and a processor. An executable code is stored in the memory, and when the processor executes the executable code, the method provided in the first aspect is implemented.
[0016] The Bluetooth device connection method, device, medium, and device provided by the embodiments of the present invention have the following beneficial effects when combined respectively:
[0017] (1) Obtain the first service information of each Bluetooth device in the surrounding environment, and then display the first device list formed by each Bluetooth device according to the first service information. When the user selects the first Bluetooth device, the applet terminal determines whether the selected first Bluetooth device meets the connection requirements. If so, send a first connection request to the first Bluetooth device, and the second service information of the applet terminal is carried in the first connection request. In this way, after receiving the connection request, the first Bluetooth device will establish a first connection with the applet terminal according to the second service information, and forward the second service information to each of the remaining Bluetooth devices after establishing the first connection, so that the second service information of the applet terminal is also stored in each of the remaining Bluetooth devices. When the user selects the second Bluetooth device in the first device list, it is judged whether the first service information of the second Bluetooth device meets the connection requirements. If it meets the requirements, send a second connection request to the second Bluetooth device, and then establish a connection between the applet terminal and the second Bluetooth device. Since the information of the second Bluetooth device is included in the first device list, there is no need to perform the step of searching and discovering Bluetooth devices again. Since the second service information sent by the first Bluetooth device is stored in the second Bluetooth device, there is no need to carry the second service information of the applet terminal when sending the second connection request to the second Bluetooth device. It can be seen that the connection process between the second Bluetooth device and the applet terminal is simplified, and the convenience of the user to connect Bluetooth devices is improved.
[0018] (2) In one embodiment, after the applet terminal obtains the first service information of each Bluetooth device, a first device list is formed. At this time, each Bluetooth device in the first device list is obtained by the applet terminal through searching. Since the spatial range of Bluetooth search is limited, if the space in a family is relatively large, there may be one or some Bluetooth devices that are relatively far from the applet terminal and cannot be searched. After the applet terminal establishes a first connection with the first Bluetooth device, the first Bluetooth device can search for other Bluetooth devices located in the same local area network through WIFI. Therefore, the first Bluetooth device can send its own first service information and the first service information of each of the remaining Bluetooth devices that the first Bluetooth device can search to the applet terminal, so that the applet terminal obtains the first service information of the first Bluetooth device and each Bluetooth device connected to the first Bluetooth device, and then updates the first device list according to the newly obtained first service information, so as to ensure that the first service list is more comprehensive and reduce omissions.
[0019] (3) In one embodiment, after the mini-program terminal establishes a second connection with the second Bluetooth device, the second Bluetooth device will send the first service information of the second Bluetooth device and each Bluetooth device that the second Bluetooth device can search for to the mini-program terminal, so that the mini-program terminal can obtain the first service information of the second Bluetooth device and each Bluetooth device connected to the second Bluetooth device. After the mini-program terminal obtains the first service information of the second Bluetooth device and each Bluetooth device connected to the second Bluetooth device, it updates the first device list according to the newly obtained first service information. Since the first Bluetooth device may omit the first service information of one or more Bluetooth devices due to factors such as network fluctuations when sending its own first service information and the first service information of each Bluetooth device connected to the first Bluetooth device to the mini-program terminal. Therefore, after the second Bluetooth device establishes a second connection with the mini-program terminal, it will perform a WIFI search again and send the first service information of each Bluetooth device in the local area network at this time to the mini-program terminal, so that the Bluetooth devices identified in the updated first device list are consistent with each Bluetooth device in the current local area network. Updating the first device list again can ensure the real-time nature of the first device list.
[0020] (4) In one embodiment, when the mini-program terminal disconnects from the first Bluetooth device, the first service information of the first Bluetooth device is set to the reconnection buffer state, which indicates that the mini-program terminal will record that it has successfully connected to the first Bluetooth device before. Therefore, if the mini-program terminal reconnects to the first Bluetooth device again, the mini-program terminal does not need to judge the address information and device type code of the first Bluetooth device, and only needs to judge the Bluetooth signal strength. Moreover, the first service information of the first Bluetooth device does not need to be carried in the first connection request sent to the first Bluetooth device. It can be seen that setting the first service information of the first Bluetooth device as the reconnection buffer information can greatly simplify the process of reconnecting the first Bluetooth device and the mini-program terminal. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present invention and used together with the specification to explain the principles of the present invention.
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0023] Figure 1 It is a schematic flowchart of a method for connecting Bluetooth devices in an embodiment of the present invention;
[0024] Figure 2 This is the structural block diagram of the Bluetooth device connection device in an embodiment of the present invention. Specific embodiments
[0025] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0026] In the prior art, if a mini-program terminal wants to establish a connection with a Bluetooth device, several steps need to be performed: Bluetooth device discovery, judgment of connection requirements, sending a connection request to the Bluetooth device, connection success, etc. If the mini-program terminal wants to establish a connection with another Bluetooth device, it needs to disconnect the connection with the current Bluetooth device and then establish a connection with the other Bluetooth device through the above steps. That is, the process of the mini-program terminal establishing a connection with each Bluetooth device is the same, which is rather troublesome. Based on this situation, the embodiments of the present invention provide a solution for Bluetooth device connection.
[0027] In a first aspect, the embodiments of the present invention provide a method for connecting a Bluetooth device. This method is executed by a mini-program terminal. Refer to Figure 1 , this method includes the following steps S110 to S140:
[0028] S110. Obtain the first service information of each Bluetooth device in the surrounding environment; wherein, there are multiple Bluetooth devices in the surrounding environment, and the Bluetooth devices are connected through WIFI, and each powered-on Bluetooth device is configured in a discoverable and connectable mode;
[0029] Among them, the mini-program terminal refers to a terminal device installed with a mini-program, such as computing devices like mobile phones, tablets, and computers.
[0030] Among them, there are multiple Bluetooth devices in the surrounding environment, such as Bluetooth air conditioners, Bluetooth refrigerators, Bluetooth TVs, etc. These Bluetooth devices are located in the same local area network, so these Bluetooth devices are connected through WIFI. Therefore, a Bluetooth device can obtain relevant information of other Bluetooth devices, such as device type codes, address information, etc.
[0031] It is understandable that the method provided by the embodiments of the present invention is particularly suitable for the home scenario. Generally, there are multiple different types of Bluetooth devices in the home, and each Bluetooth device is located in the same local area network. The applet terminal can establish a connection with any one of these Bluetooth devices through the method provided by the embodiments of the present invention, so as to control the connected Bluetooth device.
[0032] For example, in an actual scenario, each Bluetooth device will enter the discoverable and connectable mode after being powered on. Only in this mode can the Bluetooth device be discovered and connected by the applet terminal and other Bluetooth devices. The applet terminal can search through the Bluetooth device search interface in the surrounding environment to obtain the first service information of each Bluetooth device in the surrounding environment.
[0033] Among them, each Bluetooth device has corresponding first service information, and the first service information may include information such as the name, address information, device type code, and Bluetooth signal strength of the Bluetooth device.
[0034] S120. Display a first device list formed by each Bluetooth device according to the first service information;
[0035] For example, form the above-mentioned first device list with the names of each Bluetooth device searched by the applet terminal, and then the applet terminal displays the first device list, so that the user can see each Bluetooth device that the applet terminal can search on the applet terminal. If the user wants to control a Bluetooth device in the first device list, the user can perform a selection operation in the first device list. For example, if the user wants to adjust the temperature of a Bluetooth air conditioner, then the user can select the Bluetooth air conditioner in the first device list.
[0036] S130. In response to the device selection operation of the user in the first device list, determine whether the selected first Bluetooth device meets the connection requirements. If so, send a first connection request to the first Bluetooth device, and the first connection request carries the second service information of the applet terminal, so that the first Bluetooth device establishes a first connection with the applet terminal according to the second service information after receiving the connection request, and forwards the second service information to the remaining each Bluetooth device after establishing the first connection;
[0037] That is to say, if the user performs a device selection operation on a certain Bluetooth device in the first device list of the applet terminal, then before establishing a connection with the selected Bluetooth device, it is necessary to determine whether the selected Bluetooth device meets the connection requirements.
[0038] It is understandable that the Bluetooth device selected by the user in the first device list this time is called the first Bluetooth device, the Bluetooth device selected by the user in the first device list next time is called the second Bluetooth device, and the Bluetooth device selected by the user in the first device list the next time after the next time is called the third Bluetooth device.
[0039] In one embodiment, determining whether the first Bluetooth device selected by the user meets the connection requirements may specifically include: determining whether the address information and device type code of the first Bluetooth device meet the protocol requirements for Bluetooth connection; if so, it is determined that the first Bluetooth device meets the connection requirements.
[0040] That is to say, it is necessary to determine whether both the address information and device type code of the first Bluetooth device meet the protocol requirements for Bluetooth connection; if they meet the protocol requirements, it is considered that the first Bluetooth device meets the connection requirements; if they do not meet the protocol requirements, it is considered that the first Bluetooth device does not meet the connection requirements. If the first Bluetooth device meets the connection requirements, the applet terminal can send a connection request to the first Bluetooth device to establish a connection. If the first Bluetooth device does not meet the connection requirements, the applet terminal can remind the user to replace a Bluetooth device, and it is also necessary to determine whether the replaced Bluetooth device meets the connection requirements.
[0041] For example, determining whether the address information and device type code of the first Bluetooth device meet the protocol requirements for Bluetooth connection may include: determining whether the address information of the first Bluetooth device is within the address range of the local area network of the current home, and whether the device type represented by the device type code of the first Bluetooth device is within a range of multiple device types.
[0042] Among them, the protocol requirements are the protocol requirements agreed in advance for the connection between the applet terminal and the Bluetooth device.
[0043] Of course, if the address information and device type code of the first Bluetooth device meet the protocol requirements for Bluetooth connection, but the Bluetooth signal strength of the first Bluetooth device is relatively low, after the applet terminal establishes a connection with the first Bluetooth device, due to poor Bluetooth signal, it may lead to poor control effect of the applet terminal on the first Bluetooth device, affecting the user's Bluetooth control experience.
[0044] For this reason, in one embodiment, determining whether the first Bluetooth device selected by the user meets the connection requirements may further include:
[0045] If the address information and device type code of the first Bluetooth device meet the protocol requirements for Bluetooth connection, then determine whether the Bluetooth signal strength of the first Bluetooth device is greater than a preset strength value;
[0046] If the Bluetooth signal strength of the first Bluetooth device is greater than a preset strength value, it is determined that the first Bluetooth device meets the connection requirement; otherwise, it is determined that the first Bluetooth device does not meet the connection requirement.
[0047] That is to say, if the address information and device type code of the first Bluetooth device meet the protocol requirements of the Bluetooth connection, it is still necessary to determine whether the Bluetooth signal strength of the first Bluetooth device is greater than the preset strength value. If it is greater than the preset strength value, it means that the Bluetooth signal strength of the first Bluetooth device can meet the user's control requirements, and the first Bluetooth device can be considered to meet the connection requirements. If the Bluetooth signal strength of the first Bluetooth device is less than or equal to the preset strength value, it is considered that the first Bluetooth device does not meet the connection requirements.
[0048] It can be seen that here, based on the address information and device type code, the Bluetooth signal strength is further judged. Only when the address information and the device type code meet the protocol requirements and the Bluetooth signal strength is greater than the preset strength value, can the first Bluetooth device be considered to meet the connection requirements, and the mini program terminal will send a connection request to the first Bluetooth device.
[0049] Specifically, the process of establishing a connection between the mini program terminal and the first Bluetooth device may include:
[0050] The mini-program terminal sends a first connection request to the first Bluetooth device. The first connection request carries the second service information of the mini-program terminal. The second service information includes the address information, device type code and other information of the mini-program terminal. After receiving the first connection request, the first Bluetooth device will determine whether the second service information in the first connection request meets the requirements. If it is determined to meet the relevant requirements, a connection with the mini-program terminal is established. This connection is called the first connection. Then a successful connection message is fed back to the mini-program terminal. At this point, the connection between the mini-program terminal and the first Bluetooth device is successfully established.
[0051] In order to avoid continuing to carry the second service information in the connection request during the subsequent process of establishing a connection with other Bluetooth devices, the first Bluetooth device will forward the second service information to the remaining Bluetooth devices through the WIFI local area network after establishing a connection with the mini-program terminal.
[0052] In one embodiment, the method provided by the embodiment of the present invention may further include:
[0053] After establishing a first connection with the first Bluetooth device, obtaining, from the first Bluetooth device, first service information of the first Bluetooth device and each Bluetooth device connected to the first Bluetooth device;
[0054] The first device list is updated according to the first service information obtained from the first Bluetooth device.
[0055] That is to say, after the mini-program terminal establishes a first connection with the first Bluetooth device, it will obtain the first service information of the first Bluetooth device and each Bluetooth device connected to the first Bluetooth device from the first Bluetooth device.
[0056] It can be understood that after the mini-program terminal obtains the first service information of each Bluetooth device through the Bluetooth device search interface, a first device list is formed. At this time, each Bluetooth device in the first device list is obtained by the mini-program terminal through search. Since the spatial range of Bluetooth search is limited, if the space in a family is relatively large, there may be one or some Bluetooth devices that are relatively far from the mini-program terminal and cannot be searched. Therefore, it is necessary to update the first device list.
[0057] Specifically, since the first Bluetooth device and the other Bluetooth devices are in the same local area network, the first Bluetooth device can search for other Bluetooth devices in the same local area network through WIFI. Therefore, the first Bluetooth device can send its own first service information and the first service information of the other Bluetooth devices that the first Bluetooth device can search to the mini-program terminal, so that the mini-program terminal can obtain the first service information of the first Bluetooth device and each Bluetooth device connected to the first Bluetooth device.
[0058] After the mini-program terminal obtains the first service information of the first Bluetooth device and each Bluetooth device connected to the first Bluetooth device, it updates the first device list according to the newly obtained first service information, which can ensure that the first service list is more comprehensive and reduce omissions. Because the position of the mini-program terminal in the family is not always unchanged, a Bluetooth device that was relatively far from the mini-program terminal at the previous moment may be relatively close to the mini-program terminal at the next moment. At this time, the mini-program terminal can perform Bluetooth control on this Bluetooth device. If the first device list remains unchanged all the time, the user may not be able to see the information of this Bluetooth device on the mini-program terminal and thus cannot select this Bluetooth device for connection.
[0059] In one embodiment, the method provided by the embodiment of the present invention may further include:
[0060] If there is no interaction operation with the first Bluetooth device within a preset time window, then disconnect the first connection with the first Bluetooth device.
[0061] That is to say, if there is no interaction between the mini-program terminal and the first Bluetooth device within a certain time window, then disconnect the first connection between the mini-program terminal and the first Bluetooth device, which can reduce unnecessary energy consumption.
[0062] S140. In response to a device selection operation of the user in the first device list, determine whether the second Bluetooth device selected by the user meets the connection requirements. If so, disconnect the first connection with the first Bluetooth device and send a second connection request to the second Bluetooth device, so that when the second Bluetooth device receives the second connection request, it establishes a second connection with the applet terminal according to the second service information obtained from the first Bluetooth device.
[0063] After the user no longer wants to control the first Bluetooth device and wants to control the second Bluetooth device. For example, the user wants to watch TV for a while, so a second connection needs to be established with the Bluetooth TV. Therefore, the user can select the Bluetooth TV on the applet terminal. Since the name and other information of the Bluetooth TV are included in the first device list, the user does not need to perform the discovery step for the Bluetooth TV. Since the second service information sent by the first Bluetooth device is stored in the Bluetooth TV, when sending a second connection request to the Bluetooth TV, it is not necessary to carry the second service information of the applet terminal. It can be seen that the connection process between each Bluetooth device after the first Bluetooth device and the applet terminal is simplified.
[0064] It can be seen that the user selects a Bluetooth device again in the first device list, and this Bluetooth device is called the second Bluetooth device. The applet terminal will determine whether the second Bluetooth device selected by the user meets the connection requirements. The process by which the applet terminal determines whether the second Bluetooth device meets the connection requirements is similar to the process by which the applet terminal determines whether the first Bluetooth device meets the connection requirements, and will not be elaborated here.
[0065] If the applet terminal determines through judgment that the second Bluetooth device also meets the connection requirements, the applet terminal will disconnect the connection with the first Bluetooth device because Bluetooth connections are one-to-one, and the applet terminal cannot connect to multiple Bluetooth terminals simultaneously through Bluetooth technology. At the same time, the applet terminal can also send a second connection request to the second Bluetooth device, and it is not necessary to carry the second service information of the applet terminal in the second connection request.
[0066] When the second Bluetooth device receives the second connection request, it will determine whether the second service information obtained from the first Bluetooth device meets the relevant connection requirements. If it meets the relevant connection requirements, the connection is successful, and the connection between the applet terminal and the second Bluetooth device is called the second connection. After the connection is successful, the second Bluetooth device will feedback a connection success message to the applet terminal.
[0067] In one embodiment, the method provided by the embodiments of the present invention may further include:
[0068] After establishing a second connection with the second Bluetooth device, obtain the first service information of the second Bluetooth device and each Bluetooth device connected to the second Bluetooth device from the second Bluetooth device; update the first device list according to the first service information obtained from the second Bluetooth device.
[0069] That is to say, after the mini-program terminal establishes a second connection with the second Bluetooth device, the second Bluetooth device will send the first service information of the second Bluetooth device and each Bluetooth device that the second Bluetooth device can search for to the mini-program terminal, so that the mini-program terminal obtains the first service information of the second Bluetooth device and each Bluetooth device connected to the second Bluetooth device. After the mini-program terminal obtains the first service information of the second Bluetooth device and each Bluetooth device connected to the second Bluetooth device, update the first device list according to the newly obtained first service information.
[0070] It can be understood that when the first Bluetooth device previously sent its own first service information and the first service information of each Bluetooth device connected to the first Bluetooth device to the mini-program terminal, one or more Bluetooth devices' first service information might be missed due to factors such as network fluctuations. Therefore, after the second Bluetooth device establishes a second connection with the mini-program terminal, it will perform a WIFI search again and send the first service information of each Bluetooth device in the local area network at this time to the mini-program terminal, so that the Bluetooth devices identified in the updated first device list are consistent with each Bluetooth device in the current local area network.
[0071] Moreover, some Bluetooth devices may malfunction and be unable to access the network or be removed from the home after being used for a period of time. Therefore, updating the first device list again can ensure the real-time nature of the first device list.
[0072] In one embodiment, the method provided by the embodiment of the present invention may further include:
[0073] After establishing a second connection with the second Bluetooth device, set the first service information of the first Bluetooth device as reconnection buffer information.
[0074] When the mini-program terminal establishes a second connection with the second Bluetooth device, the connection between the first Bluetooth device and the mini-program terminal is in a disconnected state. If the user wants to connect to the first Bluetooth device again, since the first service information of the first Bluetooth device is set to the reconnection buffer state, this can simplify the process of reconnecting the mini-program terminal to the first Bluetooth device.
[0075] When the first service information of the first Bluetooth device is set to the reconnection buffer state, it indicates that the mini-program terminal will record that it has successfully connected to the first Bluetooth device before. Therefore, the mini-program terminal does not need to judge the address information and device type code of the first Bluetooth device, and only needs to judge the Bluetooth signal strength. Moreover, the first service information of the first Bluetooth device does not need to be carried in the first connection request sent to the first Bluetooth device. It can be seen that setting the first service information of the first Bluetooth device as the reconnection buffer information can greatly simplify the process of reconnecting the first Bluetooth device and the mini-program terminal.
[0076] It can be understood that the user can continue to replace the connected Bluetooth device. For example, if the user wants to perform Bluetooth control on the third Bluetooth device, the mini-program terminal needs to establish a third connection with the third Bluetooth device. The process of establishing a connection between the mini-program terminal and the third Bluetooth device is similar to the process of establishing a connection between the mini-program terminal and the second Bluetooth device. Moreover, after establishing the third connection, the first device list can be updated according to the first service information of the third Bluetooth device sent by the third Bluetooth device and the first service information of each Bluetooth device connected to the third Bluetooth device. That is to say, after establishing a connection with each Bluetooth device, the first device list can be updated according to the first service information sent by this Bluetooth device to ensure the real-time nature of the first device list.
[0077] In a second aspect, an embodiment of the present invention provides a Bluetooth device connection device, which is deployed on a mini-program terminal. Refer to Figure 2 , the device includes:
[0078] An information acquisition module, configured to acquire the first service information of each Bluetooth device in the surrounding environment; wherein, there are multiple Bluetooth devices in the surrounding environment, and each Bluetooth device is connected through WIFI, and each powered-on Bluetooth device is configured to be in a discoverable and connectable mode;
[0079] A list display module, configured to display a first device list formed by each Bluetooth device according to the first service information;
[0080] A first connection module, configured to, in response to a device selection operation of the user in the first device list, judge whether the selected first Bluetooth device meets the connection requirements. If so, send a first connection request to the first Bluetooth device, and the first connection request carries the second service information of the mini-program terminal, so that the first Bluetooth device establishes a first connection with the mini-program terminal according to the second service information after receiving the connection request, and forwards the second service information to the remaining each Bluetooth device after establishing the first connection;
[0081] The second connection module is configured to, in response to a device selection operation of the user in the first device list, determine whether the second Bluetooth device selected by the user meets the connection requirements. If so, it disconnects the first connection with the first Bluetooth device and sends a second connection request to the second Bluetooth device, so that the second Bluetooth device can establish a second connection with the mini-program terminal according to the second service information obtained from the first Bluetooth device when receiving the second connection request.
[0082] In one embodiment, the first service information of each Bluetooth device includes the address information and device type code of the Bluetooth device. Correspondingly, the first connection module is specifically configured to: determine whether the address information and device type code of the first Bluetooth device meet the protocol requirements for Bluetooth connection; if so, determine that the first Bluetooth device meets the connection requirements.
[0083] Further, the first service information of each Bluetooth device further includes: Bluetooth signal strength;
[0084] Correspondingly, the first connection module is further specifically configured to: if the address information and device type code of the first Bluetooth device meet the protocol requirements for Bluetooth connection, determine whether the Bluetooth signal strength of the first Bluetooth device is greater than a preset strength value; if the Bluetooth signal strength of the first Bluetooth device is greater than the preset strength value, determine that the first Bluetooth device meets the connection requirements; otherwise, determine that the first Bluetooth device does not meet the connection requirements.
[0085] In one embodiment, the apparatus further includes:
[0086] The first update module is configured to, after establishing a first connection with the first Bluetooth device, obtain the first service information of the first Bluetooth device and each Bluetooth device connected to the first Bluetooth device from the first Bluetooth device; update the first device list according to the first service information obtained from the first Bluetooth device.
[0087] In one embodiment, the apparatus further includes:
[0088] The second update module is configured to, after establishing a second connection with the second Bluetooth device, obtain the first service information of the second Bluetooth device and each Bluetooth device connected to the second Bluetooth device from the second Bluetooth device; update the first device list according to the first service information obtained from the second Bluetooth device.
[0089] In one embodiment, the second connection module is further configured to: after establishing a second connection with the second Bluetooth device, set the first service information of the first Bluetooth device as reconnection buffer information.
[0090] In one embodiment, the first connection module is further configured to: if there is no interaction operation with the first Bluetooth device within a preset time window, disconnect the first connection with the first Bluetooth device.
[0091] It can be understood that the explanations, examples, beneficial effects, etc. of the relevant content in the device provided by the embodiments of the present invention can refer to the relevant content in the first aspect, and will not be elaborated here.
[0092] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor is caused to execute the method provided in the first aspect.
[0093] Specifically, a system or device equipped with a storage medium can be provided. On this storage medium, software program codes for implementing the functions of any one of the above embodiments are stored, and the computer (or CPU or MPU) of the system or device is caused to read and execute the program codes stored in the storage medium.
[0094] In this case, the program code read from the storage medium itself can implement the functions of any one of the above embodiments. Therefore, the program code and the storage medium storing the program code constitute a part of the present invention.
[0095] Embodiments of the storage medium for providing program codes include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Optionally, the program codes can be downloaded from a server computer via a communication network.
[0096] In addition, it should be clear that not only can the functions of any one of the above embodiments be realized by executing the program codes read by the computer, but also by means of instructions based on the program codes, the operating system operating on the computer, etc. to complete part or all of the actual operations.
[0097] In addition, it can be understood that the program codes read from the storage medium are written into the memory provided in the expansion board inserted into the computer or the memory provided in the expansion module connected to the computer, and then based on the instructions of the program codes, the CPUs, etc. installed on the expansion board or the expansion module are caused to execute part and all of the actual operations, so as to realize the functions of any one of the above embodiments.
[0098] It can be understood that the explanations, specific implementation manners, beneficial effects, examples, etc. of the relevant content in the computer-readable medium provided by the embodiments of the present invention can refer to the corresponding parts in the method provided in the first aspect, and will not be elaborated here.
[0099] Fourthly, an embodiment of this specification provides a computing device, including a memory and a processor. An executable code is stored in the memory. When the processor executes the executable code, the method in any one of the embodiments in the specification is implemented.
[0100] It can be understood that for the explanations, specific implementation manners, beneficial effects, examples, etc. of the relevant content in the computing device provided in the embodiments of the present invention, reference can be made to the corresponding parts in the method provided in the first aspect, and details are not described herein again.
[0101] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and reference can be made to the partial description of the method embodiment for the relevant parts.
[0102] Those skilled in the art should be able to realize that in the above one or more examples, the functions described in the present invention can be implemented by hardware, software, add-ons, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0103] The above specific implementation manners further elaborate on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above is only the specific implementation manner of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for connecting a Bluetooth device, characterized in that, the method is executed by a mini-program terminal, and the method includes: obtaining first service information of each Bluetooth device in the surrounding environment; wherein, there are multiple Bluetooth devices in the surrounding environment, and each Bluetooth device is connected through WIFI, and each powered-on Bluetooth device is configured to be in a discoverable and connectable mode; displaying a first device list formed by each Bluetooth device according to the first service information; in response to a device selection operation of the user in the first device list, determining whether the first Bluetooth device selected by the user meets the connection requirements, and if so, sending a first connection request to the first Bluetooth device, where the first connection request carries second service information of the mini-program terminal, so that the first Bluetooth device establishes a first connection with the mini-program terminal according to the second service information after receiving the connection request, and forwards the second service information to each of the remaining Bluetooth devices after establishing the first connection; in response to a device selection operation of the user in the first device list, determining whether the second Bluetooth device selected by the user meets the connection requirements, and if so, disconnecting the first connection with the first Bluetooth device and sending a second connection request to the second Bluetooth device, so that the second Bluetooth device establishes a second connection with the mini-program terminal according to the second service information obtained from the first Bluetooth device when receiving the second connection request.
2. The method according to claim 1, characterized in that, the first service information of each Bluetooth device includes the address information and device type code of the Bluetooth device; correspondingly, the determining whether the first Bluetooth device selected by the user meets the connection requirements includes: determining whether the address information and device type code of the first Bluetooth device meet the protocol requirements of Bluetooth connection; if so, determining that the first Bluetooth device meets the connection requirements.
3. The method according to claim 2, characterized in that, the first service information of each Bluetooth device further includes: Bluetooth signal strength; correspondingly, the determining whether the first Bluetooth device selected by the user meets the connection requirements further includes: if the address information and device type code of the first Bluetooth device meet the protocol requirements of Bluetooth connection, determining whether the Bluetooth signal strength of the first Bluetooth device is greater than a preset strength value; if the Bluetooth signal strength of the first Bluetooth device is greater than the preset strength value, determining that the first Bluetooth device meets the connection requirements; otherwise, determining that the first Bluetooth device does not meet the connection requirements.
4. The method according to claim 1, characterized in that, further includes: after establishing the first connection with the first Bluetooth device, obtaining the first service information of the first Bluetooth device and each Bluetooth device connected to the first Bluetooth device from the first Bluetooth device; updating the first device list according to the first service information obtained from the first Bluetooth device.
5. The method according to claim 1, characterized in that, further includes: After establishing a second connection with the second Bluetooth device, obtain first service information of the second Bluetooth device and each Bluetooth device connected to the second Bluetooth device from the second Bluetooth device; update the first device list according to the first service information obtained from the second Bluetooth device.
6. The method according to claim 1, wherein, further comprising: After establishing a second connection with the second Bluetooth device, set the first service information of the first Bluetooth device as reconnection buffer information.
7. The method according to claim 1, wherein, further comprising: If there is no interaction operation with the first Bluetooth device within a preset time window, disconnect the first connection with the first Bluetooth device.
8. A Bluetooth device connection device, wherein, The device is deployed on a mini-program terminal, and the device includes: An information acquisition module, configured to acquire first service information of each Bluetooth device in the surrounding environment; wherein, there are multiple Bluetooth devices in the surrounding environment, and each Bluetooth device is connected through WIFI, and each powered-on Bluetooth device is configured to be in a discoverable and connectable mode; A list display module, configured to display a first device list formed by each Bluetooth device according to the first service information; A first connection module, configured to, in response to a device selection operation of a user in the first device list, determine whether the first Bluetooth device selected by the user meets the connection requirements. If so, send a first connection request to the first Bluetooth device, and the first connection request carries second service information of the mini-program terminal, so that the first Bluetooth device establishes a first connection with the mini-program terminal according to the second service information after receiving the connection request, and forwards the second service information to each of the remaining Bluetooth devices after establishing the first connection; A second connection module, configured to, in response to a device selection operation of a user in the first device list, determine whether the second Bluetooth device selected by the user meets the connection requirements. If so, disconnect the first connection with the first Bluetooth device, and send a second connection request to the second Bluetooth device, so that the second Bluetooth device establishes a second connection with the mini-program terminal according to the second service information obtained from the first Bluetooth device when receiving the second connection request.
9. A computer-readable medium, on which computer instructions are stored, and when the computer instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 7.
10. A computing device, including a memory and a processor, wherein executable code is stored in the memory, and when the processor executes the executable code, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Intelligent terminal based Bluetooth connection device switching method and system
CN105912115A
Bluetooth connection method and device
CN112789867A