A Bluetooth connection method, storage medium and related equipment
By switching the working mode of the slave device to the master mode when the Bluetooth connection fails, detecting and connecting to an available master device, the problem of high learning cost for new users caused by the variety of Bluetooth connection methods between different devices is solved, a simple and universal connection method is implemented, and the user experience is improved.
Patent Information
- Application Number
- CN202110202557.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-23
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2041-02-23
AI Technical Summary
The various Bluetooth connection methods between different devices result in high learning costs and poor user experience for new users.
When the slave device is in a pairing state and the connection fails, its working mode is switched to the master mode, a master device detection signal is sent to detect a connectable master device, and a Bluetooth connection is established with the master device after switching back to the slave mode.
A simple and universal Bluetooth connection method is implemented, which reduces the user's learning cost and improves the user experience.
Smart Images

Figure CN114980044B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a Bluetooth connection method, storage medium, and related equipment. Background Art
[0002] With the advancement and development of technology, the connection methods between different devices are becoming increasingly rich and diverse. For example, a meeting requires the following equipment: a smart touch tablet, an active capacitive stylus, a screen sharer, and a desktop microphone. The screen sharer connects to the smart touch tablet by plugging it into the tablet's USB port, while the active capacitive stylus and desktop microphone require users to configure them on the smart touch tablet's settings page before they can connect to the tablet. The diverse connection methods vary between different devices, creating a high learning curve for new users and making them inconvenient to use. Summary of the Invention
[0003] The embodiments of the present application provide a Bluetooth connection method, storage medium and related devices, which can realize fast connection between a slave device and a master device in a simple and universal method, reduce the user's learning cost and improve the user experience.
[0004] A first aspect of an embodiment of the present application provides a Bluetooth connection method, including:
[0005] When the slave device determines that the slave device is in a pairing state and the reconnection fails, switching the working mode of the slave device to a master mode;
[0006] The slave device sends a master device detection signal based on the master mode to detect a connectable master device;
[0007] The master device receives the master device detection signal;
[0008] The slave device switches the working mode of the slave device to a slave mode;
[0009] The master device establishes a Bluetooth connection with the slave device based on the master device detection signal.
[0010] A second aspect of an embodiment of the present application provides a Bluetooth connection method, including:
[0011] When determining that the slave device is in a pairable state and the backconnection fails, switching the working mode of the slave device to a master mode;
[0012] detecting a connectable master device based on the master mode;
[0013] The working mode of the slave device is switched to the slave mode, and a Bluetooth connection is established with the master device based on the slave mode.
[0014] A third aspect of the embodiments of the present application provides a Bluetooth connection method, including:
[0015] Receiving a master device detection signal sent by a slave device, wherein the master device detection signal is a signal sent to detect a connectable master device when the slave device is in a pairing state and fails to reconnect, switching the working mode to the master mode;
[0016] A Bluetooth connection is established with the slave device based on the master device detecting the signal, and the working mode of the slave device is switched to a slave mode.
[0017] A fourth aspect of the embodiments of the present application provides a slave device, including:
[0018] a state determination module, configured to switch the working mode of the slave device to the master mode when determining that the slave device is in a pairable state and the reconnection fails;
[0019] a device detection module, configured to detect a connectable master device based on the master mode;
[0020] The connection establishing module is used to switch the working mode of the slave device to the slave mode, and establish a Bluetooth connection with the master device based on the slave mode.
[0021] A fifth aspect of an embodiment of the present application provides a master device, including:
[0022] A signal receiving module is used to receive a master device detection signal sent by a slave device, wherein the master device detection signal is a signal sent to detect a connectable master device when the slave device is in a pairing state and fails to reconnect, switching the working mode to the master mode;
[0023] The connection establishment module is used to establish a Bluetooth connection with the slave device based on the master device detection signal, and the working mode of the slave device is switched to the slave mode.
[0024] A sixth aspect of an embodiment of the present application provides a Bluetooth connection system, comprising the above-mentioned slave device and the above-mentioned master device.
[0025] The seventh aspect of an embodiment of the present application provides a computer device, including a processor, a memory, and an input / output interface, wherein the processor is connected to the memory and the input / output interface, respectively, wherein the input / output interface is used for page interaction, the memory is used to store program code, and the processor is used to call the program code to execute the above-mentioned method steps.
[0026] An eighth aspect of an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the above-mentioned method steps are executed.
[0027] In an embodiment of the present application, when a slave device is in a pairing state and fails to reconnect, the operating mode of the slave device is switched to master mode. At this time, the slave device sends a master device detection signal based on the master mode to detect a connectable master device, and then switches the operating mode to slave mode, thereby establishing a Bluetooth connection with the master device based on the slave mode. The slave device automatically completes the search for the master device and the pairing process with the master device through the master-slave mode switching. The above method can be used for the connection and pairing of all master and slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0029] Figure 1 This is a system architecture diagram of a Bluetooth connection system provided by an embodiment of the present application;
[0030] Figure 2 This is a flow chart of a Bluetooth connection method provided in an embodiment of the present application;
[0031] Figure 3 This is a flow chart of a Bluetooth connection method provided in an embodiment of the present application;
[0032] Figure 4 This is an example schematic diagram of a device detection provided in an embodiment of the present application;
[0033] Figure 5 This is a schematic diagram illustrating an example of Bluetooth connection between a slave device and multiple master devices provided in an embodiment of the present application;
[0034] Figure 6 This is a flowchart of a Bluetooth connection method provided in an embodiment of the present application;
[0035] Figure 7 This is a flow chart of a method for establishing a communication connection provided by an embodiment of the present application;
[0036] Figure 8 This is a flow chart of a method for establishing a communication connection provided by an embodiment of the present application;
[0037] Figure 9 This is a flow chart of a method for establishing a communication connection provided by an embodiment of the present application;
[0038] Figure 10 This is a schematic structural diagram of a slave device provided in an embodiment of the present application;
[0039] Figure 11 This is a schematic structural diagram of a slave device provided in an embodiment of the present application;
[0040] Figure 12 This is a schematic diagram of the structure of a state determination module provided in an embodiment of the present application;
[0041] Figure 13 This is a structural diagram of a connection establishment module provided by an embodiment of the present application;
[0042] Figure 14 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application;
[0043] Figure 15 This is a structural diagram of a main device provided in an embodiment of the present application;
[0044] Figure 16 This is a structural diagram of a main device provided in an embodiment of the present application;
[0045] Figure 17 This is a schematic diagram of the structure of a connection establishment module provided in an embodiment of the present application;
[0046] Figure 18 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0048] See Figure 1 , provides a schematic diagram of the architecture of a Bluetooth connection system according to an embodiment of the present application. Figure 1As shown, the embodiment of the present application can be applied to establish a Bluetooth connection between a slave device and a master device, and the Bluetooth connection system may include at least one slave device and at least one master device. The master device can be understood as a control center, including but not limited to terminal devices such as smart interactive tablets, mobile phones, personal computers, laptops, smart furniture, and vehicle-mounted devices, or a functional module in a terminal device; the slave device can be a terminal device with data acquisition and data transmission functions, including but not limited to accessory devices such as microphones, styluses, cameras, mice, keyboards, and screen transmitters, or a functional module in an accessory device.
[0049] In an embodiment of the present application, when a slave device is in a pairing state and fails to reconnect, the operating mode of the slave device is switched to master mode. At this time, the slave device sends a master device detection signal based on the master mode to detect a connectable master device, and then switches the operating mode to slave mode, thereby establishing a Bluetooth connection with the master device based on the slave mode. The slave device automatically completes the search for the master device and the pairing process with the master device through the master-slave mode switching. The above method can be used for the connection and pairing of all master and slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience.
[0050] based on Figure 1 The system architecture shown below will be combined with Figure 2-Figure 10 , the Bluetooth connection method provided in the embodiment of the present application is introduced in detail.
[0051] See Figure 2 , provides a flow chart of a Bluetooth connection method according to an embodiment of the present application. Figure 2 As shown, the embodiment of the present application describes the specific process of the Bluetooth connection method from both the slave device side and the master device side, and the method may include the following steps S101-S105.
[0052] S101, when the slave device determines that the slave device is in a pairing state and the backconnection fails, switching the working mode of the slave device to a master mode;
[0053] Specifically, the slave device works in slave mode by default, that is, before switching to master mode, the working mode of the slave device is slave mode. When the slave device enters the pairing state and fails to reconnect, the Bluetooth system working mode of the slave device is switched to master mode.
[0054] The pairable state refers to a state in which the Bluetooth of the slave device is turned on, is not currently connected to any device, and can be paired with other devices. The master mode refers to a working mode in which the slave device can detect and search for surrounding devices.
[0055] The reconnection failure may mean that there is no reconnectable device within the connectable range of the slave device, or that there is a reconnectable device within the connectable range but the reconnection fails. The reconnectable device refers to a device that has previously established a Bluetooth connection with the slave device and can be directly connected without re-pairing.
[0056] S102, the slave device sends a master device detection signal based on the master mode to detect a connectable master device;
[0057] Specifically, the master device detection signal is used to detect a connectable master device. When the slave device detects a connectable master device based on the master device detection signal, it obtains a connectable signal fed back by the master device. Based on the connectable signal, the slave device can determine the number of connectable master devices. The number may include one or more.
[0058] The master device detection signal carries the slave device identification information of the slave device, and the slave device identification can be the device number, device name, etc. of the slave device used for Bluetooth connection. The connectable signal carries information such as signal strength and master device identification, and the master device identification can be the device number, device name, etc. of the master device used for Bluetooth connection.
[0059] S103, the master device receives the master device detection signal;
[0060] S104, the slave device switches the working mode of the slave device to the slave mode;
[0061] Specifically, the slave mode refers to an operating mode in which the slave device can establish a Bluetooth connection with the master device.
[0062] S105: The master device establishes a Bluetooth connection with the slave device based on the master device detection signal.
[0063] Specifically, the master device detection signal carries the slave device identification information of the slave device, and the master device establishes a Bluetooth connection with the slave device based on the slave device identification. At this time, the slave device is in a slave mode.
[0064] In an embodiment of the present application, when the slave device is in a pairing state and fails to reconnect, the working mode of the slave device is switched to the master mode. At this time, the slave device sends a master device detection signal based on the master mode to detect a connectable master device. The master device receives the master device detection signal, and then switches the working mode of the slave device to the slave mode. The master device then establishes a Bluetooth connection with the slave device based on the master device detection signal. The slave device automatically completes the search for the master device and the pairing process with the master device through the master-slave mode switching. The above method can be used for the connection and pairing methods of all master-slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience.
[0065] See Figure 3 , provides a flow chart of a Bluetooth connection method according to an embodiment of the present application. Figure 3 As shown, the embodiment of the present application describes the specific process of the Bluetooth connection method from both the slave device side and the master device side, and the method may include the following steps S201-S213.
[0066] S201, when it is determined that the slave device is in a pairing state and the reconnection fails, switching the working mode of the slave device to a master mode;
[0067] Specifically, the slave device works in slave mode by default, that is, before switching to master mode, the working mode of the slave device is slave mode. When the slave device enters the pairing state and fails to reconnect, the Bluetooth system working mode of the slave device is switched to master mode.
[0068] The pairable state refers to the state in which the Bluetooth of the slave device is turned on and is not currently connected to any device, and can be paired with other master devices. The master mode refers to the working mode in which the slave device can detect and search for surrounding devices.
[0069] The reconnection failure may mean that there is no reconnectable device within the connectable range of the slave device, or that there is a reconnectable device within the connectable range but the reconnection fails. The reconnectable device refers to a device that has previously established a Bluetooth connection with the slave device and can be directly connected without re-pairing.
[0070] S202, sending a master device detection signal based on the master mode to detect a connectable master device;
[0071] Specifically, the slave device can send a master device detection signal based on the master mode to actively detect a connectable master device. When the slave device detects a connectable master device based on the master device detection signal, it will obtain a connectable signal fed back by the master device. Based on the connectable signal, the slave device can determine the number of connectable master devices. The number of master devices may include one or more. The connectable signal carries information such as signal strength and master device identification. The master device identification can be an identification for Bluetooth connection, such as the device number and device name of the master device.
[0072] Please also see Figure 4 , is an example diagram of a device detection provided in an embodiment of the present application. Figure 4 As shown, taking the slave device being a desktop microphone and the master device being a smart touch panel as an example, the working mode of the slave device is switched from slave mode to master mode, a master device detection signal is sent based on the master mode, the master device is detected, and a connectable signal fed back by the master device is obtained.
[0073] S203, receiving a detection signal from the master device;
[0074] Specifically, the master device receives a master device detection signal and feeds back a connectable signal. The master device detection signal carries the slave device identifier of the slave device, which can be an identifier for Bluetooth connection, such as the device number or device name of the slave device. The connectable signal carries information such as signal strength and the master device identifier, which can be an identifier for Bluetooth connection, such as the device number or device name of the master device.
[0075] S204, switching the working mode of the slave device to slave mode;
[0076] Specifically, the slave mode refers to an operating mode in which the slave device can establish a Bluetooth connection with the master device.
[0077] S205, sending a Bluetooth connection request to the slave device based on the master device detection signal;
[0078] Specifically, when the master device receives a master device detection signal, the master device sends a Bluetooth connection request to the slave device based on the master device detection signal. The slave device operates in slave mode. The Bluetooth connection request carries a master device identifier of the master device. The master device identifier can be an identifier for establishing a Bluetooth connection, such as a device number or device name of the master device.
[0079] It can be understood that the master device sends a Bluetooth connection request to the slave device only if the slave device is in slave mode and receives a master device detection signal.
[0080] S206, receiving the Bluetooth connection request, and establishing a Bluetooth connection with the current master device based on the Bluetooth connection request;
[0081] Specifically, if the master device includes one, the slave device receives the Bluetooth connection request sent by the master device based on the slave mode. When the slave device receives the Bluetooth connection request, the slave device establishes a Bluetooth connection with the master device based on the Bluetooth connection request. The Bluetooth connection is completed and there is no need to continue to execute steps S207-S214.
[0082] If there are multiple master devices, after establishing a Bluetooth connection with the current master device based on the Bluetooth connection request, the following steps S207 to S214 need to be performed. The current master device can be selected in descending order based on the master device signal strength or randomly selected. The signal strength can be obtained from the connectable signal.
[0083] S207, sending a connection confirmation pop-up window to the current master device based on the Bluetooth connection;
[0084] Specifically, the slave device sends a connection confirmation pop-up window to the current master device based on the Bluetooth connection, so that the current master device disconnects the Bluetooth connection after receiving the connection confirmation pop-up window.
[0085] S208, receiving a connection confirmation pop-up window sent by the slave device, and disconnecting the Bluetooth connection;
[0086] Specifically, the current master device receives the connection confirmation pop-up window sent by the slave device, displays it on the display interface, and then disconnects the Bluetooth connection.
[0087] S209, receiving the Bluetooth connection request, and establishing a Bluetooth connection with the current master device based on the Bluetooth connection request;
[0088] S210, sending a connection confirmation pop-up window to the current master device based on the Bluetooth connection;
[0089] S211, receiving a connection confirmation pop-up window sent by the slave device, and disconnecting the Bluetooth connection;
[0090] Steps S209 to S211 are to disconnect the Bluetooth connection with the current master device. After determining that the next master device is the current master device, the slave device repeats the steps performed with the current master device. When there is no next master device, it indicates that all detected master devices have completed the above process, and the following steps can be executed.
[0091] S212, receiving a selection instruction for the connection confirmation pop-up window, and sending a Bluetooth connection request to the slave device;
[0092] Specifically, the master device includes multiple devices, and the user selects a target master device from each of the master devices. When the master device receives the selection instruction in the connection confirmation pop-up window, the target master device sends a Bluetooth connection request to the slave device. The user can select the target master device by voice command, fingerprint authentication, touch command, etc.
[0093] S213, if no selection instruction for the connection confirmation pop-up window is received within the preset time, entering a standby state;
[0094] Specifically, a preset time period is set. After the master device disconnects the Bluetooth connection with the slave device, if the master device does not receive a selection instruction in the connection confirmation pop-up window within the preset time period, the master device enters a standby state. This prevents the master device from remaining in a waiting state without receiving a selection instruction in the connection confirmation pop-up window, thereby reducing the power consumption of the master device.
[0095] S214, receiving the Bluetooth connection request, and re-establishing a Bluetooth connection with the target master device based on the Bluetooth connection request;
[0096] Specifically, a Bluetooth connection request sent by the target host device is received, and a Bluetooth connection is re-established with the target host device based on the Bluetooth connection request. The target host device is the host device that receives the user's selection instruction in the connection confirmation pop-up window.
[0097] Please refer to Steps S206-S214 for details. Figure 5 , is a schematic diagram of an example of Bluetooth connection between a slave device and multiple master devices provided in an embodiment of the present application. Figure 5 As shown, the slave device is in slave mode, and the slave mode establishes a Bluetooth connection with the master device 1, sends a connection confirmation pop-up window to the master device 1 based on the Bluetooth connection, and then disconnects the Bluetooth connection. The connection and disconnection operations are completed for the master devices 2 and 3 in the same manner. The master devices 2 and 3 receive the connection confirmation pop-up windows in turn, and the user selects the target master device. As shown in the figure, the user selects the master device 2 as the target master device. The master device 2 receives the user's selection instruction on the connection confirmation pop-up window, and then re-establishes the Bluetooth connection with the slave device.
[0098] S215, if the Bluetooth connection exceeds the first duration, executing the step of determining that the slave device is in a pairing state and the reconnection fails;
[0099] Specifically, a first duration is pre-set, where the first duration refers to the maximum duration that the slave device cannot exceed when executing step S206. If the duration used by the slave device in executing step S206 exceeds the first duration, the step of determining that the slave device is in a pairing state and that the reconnection has failed is executed. This allows the slave device to re-execute the connection operation when it is unable to establish a Bluetooth connection with the master device for a long period of time, thereby improving connection efficiency and fault tolerance.
[0100] S216, if the Bluetooth connection exceeds the second duration, switching to a standby state;
[0101] Specifically, a second duration is pre-set, which refers to the maximum duration that the slave device can take from being turned on to establishing a Bluetooth connection. If the duration of time it takes for the slave device to establish a Bluetooth connection exceeds the second duration, the slave device switches to a standby state, which is a state where the slave device is powered on but not performing any substantive work. This can avoid repeated connection operations when the slave device has not established a Bluetooth connection with the master device for a long time, effectively reducing the power consumption of the slave device.
[0102] In an embodiment of the present application, when the slave device is in a pairing state and the backconnection fails, the working mode of the slave device is switched to the master mode. At this time, the slave device sends a master device detection signal based on the master mode to detect a connectable master device, the master device receives the master device detection signal, and then switches the working mode of the slave device back to the slave mode, and then the master device receives the master device detection signal and establishes a Bluetooth connection with the slave device based on the master device detection signal. The slave device automatically completes the search for the master device and the pairing process with the master device through the master-slave mode switching. The above method can be used for the connection and pairing methods of all master-slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience; the master device sends a master device detection signal to the slave device based on the master device detection signal carrying the slave device identifier. The present invention relates to a method for transmitting the Bluetooth connection of a slave device to a master device through a Bluetooth communication channel, wherein the slave device sends a Bluetooth connection request carrying the master device identifier, and then the slave device establishes a Bluetooth connection with the master device based on the Bluetooth connection request carrying the master device identifier, thereby ensuring the accuracy of the Bluetooth connection; the target master device is selected by the user through the selection instruction of the connection confirmation pop-up window, thereby further improving the reliability of the Bluetooth connection; by setting the first time length, the connection operation can be re-executed when the slave device cannot establish a Bluetooth connection with the master device for a long time, thereby improving the connection efficiency and fault tolerance; by setting the second time length, the connection operation can be avoided from being repeated when the slave device has not established a Bluetooth connection with the master device for a long time, thereby effectively reducing the power consumption of the slave device; by setting the preset time length, the master device is avoided from not receiving the selection instruction of the connection confirmation pop-up window and being in a waiting state for reception, thereby reducing the power consumption of the master device.
[0103] See Figure 6 , provides a flow chart of a Bluetooth connection method according to an embodiment of the present application. Figure 6 As shown, the embodiment of the present application describes the specific process of the Bluetooth connection method from the device side, and the method may include the following steps S301-S303.
[0104] S301, when it is determined that the slave device is in a pairing state and the backconnection fails, switching the working mode of the slave device to a master mode;
[0105] Specifically, the slave device works in slave mode by default, that is, before switching to master mode, the working mode of the slave device is slave mode. The Bluetooth system working mode of the slave device defaults to slave mode. When the slave device enters the pairing state and fails to reconnect, the Bluetooth system working mode of the slave device is switched to master mode.
[0106] The pairable state refers to the state in which the Bluetooth of the slave device is turned on and is not currently connected to any device, and can be paired with other master devices. The master mode refers to the working mode in which the slave device can detect and search for surrounding devices.
[0107] The reconnection failure may mean that there is no reconnectable device within the connectable range of the slave device, or that there is a reconnectable device within the connectable range but the reconnection fails. The reconnectable device refers to a device that has previously established a Bluetooth connection with the slave device and can be directly connected without re-pairing.
[0108] S302, detecting a connectable master device based on the master mode;
[0109] Specifically, a master device detection signal is sent based on the master mode, and the master device detection signal is used to detect a connectable master device. When the slave device detects a connectable master device based on the master device detection signal, it obtains a connectable signal fed back by the master device. Based on the connectable signal, the slave device can determine the number of connectable master devices. The number may include one or more.
[0110] The master device detection signal carries the slave device identification information of the slave device, and the slave device identification can be the device number, device name, etc. of the slave device used for Bluetooth connection. The connectable signal carries information such as signal strength and master device identification, and the master device identification can be the device number, device name, etc. of the master device used for Bluetooth connection.
[0111] S303: Switch the working mode of the slave device to a slave mode, and establish a Bluetooth connection with the master device based on the slave mode.
[0112] Specifically, the slave mode refers to an operating mode in which the slave device can establish a Bluetooth connection with the master device. If there is one master device, the slave device receives a Bluetooth connection request sent by the master device based on the slave mode. When the slave device receives the Bluetooth connection request, the slave device establishes a Bluetooth connection with the master device based on the Bluetooth connection request. If the master device includes multiple devices, a Bluetooth connection is established with the current master device among the master devices based on the slave mode. The current master device can be selected in order from strong to weak based on the master device signal strength or can be selected in random order. Then, a connection confirmation pop-up window is sent to the current master device based on the Bluetooth connection, so that the current master device disconnects the Bluetooth connection when receiving the connection confirmation pop-up window. Then, the next master device among the master devices is determined, and the next master device is used as the current master device. The steps of establishing a Bluetooth connection with the current master device among the master devices based on the slave mode are performed, and the connection and disconnection operations are completed in the same manner. When there is no next master device, it indicates that all detected master devices have completed the above process. Then, a target master device is selected from the multiple master devices according to the user's selection instruction on the connection confirmation pop-up window, and a Bluetooth connection with the target master device is established. The user can select the target master device in a manner that can be voice command, fingerprint authentication, touch command, etc.
[0113] In an embodiment of the present application, when a slave device is in a pairing state and fails to reconnect, the operating mode of the slave device is switched to master mode. At this time, the slave device sends a master device detection signal based on the master mode to detect a connectable master device, and then switches the operating mode to slave mode, thereby establishing a Bluetooth connection with the master device based on the slave mode. The slave device automatically completes the search for the master device and the pairing process with the master device through the master-slave mode switching. The above method can be used for the connection and pairing of all master and slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience.
[0114] See Figure 7 , provides a flow chart of a Bluetooth connection method according to an embodiment of the present application. Figure 7 As shown, the embodiment of the present application describes the specific process of the Bluetooth connection method from the device side, and the method may include the following steps S401-S409.
[0115] S401, when it is determined that the slave device is in a pairing state and there is currently no device to which it can reconnect, switching the working mode of the slave device to a master mode;
[0116] Specifically, the slave device works in slave mode by default, that is, before switching to master mode, the working mode of the slave device is slave mode. The Bluetooth system working mode of the slave device defaults to slave mode. When the slave device is in a pairing state and there is currently no device that can be connected back, the Bluetooth system working mode of the slave device is switched to master mode.
[0117] The pairable state refers to the state in which the Bluetooth of the slave device is turned on, is not currently connected to any device, and can be paired with other master devices. The reconnectable device refers to a device that has previously established a Bluetooth connection with the slave device and does not need to be re-paired and can be directly connected. The master mode refers to the working mode in which the slave device can detect and search for surrounding devices.
[0118] S402, when it is determined that the slave device is in a pairing state and there is a device to which it can reconnect, if the reconnection fails, switching the working mode of the slave device to a master mode;
[0119] Specifically, the slave device works in slave mode by default, that is, before switching to master mode, the working mode of the slave device is slave mode. The Bluetooth system working mode of the slave device defaults to slave mode. When the slave device is in a pairing state and there is a device that can be reconnected, if the reconnection fails, the Bluetooth system working mode of the slave device is switched to master mode.
[0120] S403, detecting a connectable master device based on the master mode;
[0121] Specifically, a master device detection signal is sent based on the master mode, and the master device detection signal is used to detect a connectable master device. When the slave device detects a connectable master device based on the master device detection signal, it obtains a connectable signal fed back by the master device. Based on the connectable signal, the slave device can determine the number of connectable master devices. The number may include one or more.
[0122] The master device detection signal carries the slave device identification information of the slave device, and the slave device identification can be the device number, device name, etc. of the slave device used for Bluetooth connection. The connectable signal carries information such as signal strength and master device identification, and the master device identification can be the device number, device name, etc. of the master device used for Bluetooth connection.
[0123] S404, switching the working mode of the slave device to slave mode;
[0124] Specifically, the slave mode refers to an operating mode in which the slave device can establish a Bluetooth connection with the master device.
[0125] S405, if there is one master device, waiting for a Bluetooth connection request sent by the master device, and establishing a Bluetooth connection with the master device based on the Bluetooth connection request;
[0126] S406, if there are multiple master devices, establishing a Bluetooth connection with each master device in sequence based on the slave mode and then disconnecting the Bluetooth connection;
[0127] Specifically, if the master device includes multiple devices, a Bluetooth connection is established with the current master device among the master devices based on the slave mode, and a connection confirmation pop-up window is sent to each of the current master devices based on the Bluetooth connection, so that the current master device disconnects the Bluetooth connection when receiving the connection confirmation pop-up window, determines the next master device among the master devices, uses the next master device as the current master device, and executes the step of establishing a Bluetooth connection with the current master device among the master devices based on the slave mode, and completes the connection and disconnection operations in the same manner.
[0128] The current master device may be selected based on the master device signal strength from strong to weak or may be selected in a random order.
[0129] S407, establishing a Bluetooth connection with the target master device based on the selection instruction for the target master device among the master devices;
[0130] Specifically, referring to step S406, when there is no next master device, indicating that all detected master devices have completed the above process, a Bluetooth connection is established with the target master device based on a selection instruction for the target master device among the master devices. The selection instruction may be a voice instruction.
[0131] S408, if the Bluetooth connection exceeds the first duration, executing the step of determining that the slave device is in a pairing state and the reconnection fails;
[0132] Specifically, a first duration is pre-set, where the first duration refers to the maximum duration that the slave device cannot exceed when executing step S206. If the duration used by the slave device in executing step S206 exceeds the first duration, the step of determining that the slave device is in a pairing state and that the reconnection has failed is executed. This allows the slave device to re-execute the connection operation when it is unable to establish a Bluetooth connection with the master device for a long period of time, thereby improving connection efficiency and fault tolerance.
[0133] S409: If the Bluetooth connection exceeds the second duration, switch to a standby state.
[0134] Specifically, a second duration is pre-set, which refers to the maximum duration that the slave device can take from being turned on to establishing a Bluetooth connection. If the duration of time it takes for the slave device to establish a Bluetooth connection exceeds the second duration, the slave device switches to a standby state, which is a state where the slave device is powered on but not performing any substantive work. This can avoid repeated connection operations when the slave device has not established a Bluetooth connection with the master device for a long time, effectively reducing the power consumption of the slave device.
[0135] In an embodiment of the present application, when the slave device is in a pairing state and the reconnection fails, the working mode of the slave device is switched to the master mode. At this time, the slave device sends a master device detection signal based on the master mode to detect a connectable master device. The master device receives the master device detection signal, and then switches the working mode of the slave device back to the slave mode. If the master device includes one, a Bluetooth connection is established with the master device based on the slave mode. If the master device includes multiple, a Bluetooth connection is established with each of the master devices in turn based on the slave mode and then the Bluetooth connection is disconnected. A connection confirmation pop-up window is sent and a connection confirmation is made based on the user's connection. , the slave device automatically completes the search for the master device and the pairing process with the master device through the master-slave mode switching. The above method can be used for all master-slave device connection and pairing methods. It is simple and universal, reduces the user's learning cost, and improves the user experience. By setting the first duration, when the slave device cannot establish a Bluetooth connection with the master device for a long time, the connection operation can be re-executed, thereby improving the connection efficiency and fault tolerance rate. By setting the second duration, when the slave device has not established a Bluetooth connection with the master device for a long time, the connection operation can be avoided repeatedly, thereby effectively reducing the power consumption of the slave device.
[0136] See Figure 8 , provides a flow chart of a Bluetooth connection method according to an embodiment of the present application. Figure 8 As shown, the embodiment of the present application describes the specific process of the Bluetooth connection method from the main device side, and the method may include the following steps S501-S502.
[0137] S501, receiving a master device detection signal sent by a slave device, wherein the master device detection signal is a signal sent to detect a connectable master device when the slave device is in a pairing state and fails to reconnect, switching the working mode to the master mode;
[0138] Specifically, the master device receives a master device detection signal and feeds back a connectable signal. The master device detection signal carries the slave device identifier of the slave device, which can be an identifier for Bluetooth connection, such as the device number or device name of the slave device. The connectable signal carries information such as signal strength and the master device identifier, which can be an identifier for Bluetooth connection, such as the device number or device name of the master device.
[0139] S502, establishing a Bluetooth connection with the slave device based on the master device detection signal, and switching the working mode of the slave device to a slave mode;
[0140] Specifically, the master device detection signal carries the slave device identification information of the slave device, and the master device establishes a Bluetooth connection with the slave device based on the slave device identification. At this time, the slave device is in a slave mode.
[0141] In an embodiment of the present application, by receiving a master device detection signal sent by a slave device and establishing a Bluetooth connection with the slave device based on the master device detection signal, the above method can be used for connection pairing of all master and slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience.
[0142] See Figure 9 , provides a flow chart of a Bluetooth connection method according to an embodiment of the present application. Figure 9 As shown, the embodiment of the present application describes the specific process of the Bluetooth connection method from the main device side, and the method may include the following steps S601-S607.
[0143] S601, receiving a master device detection signal sent by a slave device, wherein the master device detection signal is a signal sent to detect a connectable master device when the slave device is in a pairing state and fails to reconnect, switching the working mode to a master mode;
[0144] Specifically, the master device receives a master device detection signal and feeds back a connectable signal. The master device detection signal carries the slave device identifier of the slave device, which can be an identifier for Bluetooth connection, such as the device number or device name of the slave device. The connectable signal carries information such as signal strength and the master device identifier, which can be an identifier for Bluetooth connection, such as the device number or device name of the master device.
[0145] S602, sending a Bluetooth connection request to the slave device based on the master device detection signal;
[0146] Specifically, when the slave device receives a master device detection signal, the master device sends a Bluetooth connection request to the slave device based on the master device detection signal. The slave device operates in slave mode. The Bluetooth connection request carries the master device identifier of the master device. The master device identifier can be an identifier for the master device, such as a device number or device name, used for Bluetooth connection.
[0147] It can be understood that the master device sends a Bluetooth connection request to the slave device only if the slave device is in slave mode and receives a master device detection signal.
[0148] S603, receiving connection confirmation information sent by the slave device based on the Bluetooth connection request, and establishing a Bluetooth connection with the slave device;
[0149] Specifically, the master device receives the connection confirmation information and then establishes a Bluetooth connection with the slave device. The connection confirmation information is sent to the master device after the slave device receives the Bluetooth connection request, confirms the master device identifier based on the Bluetooth connection request and the connectable signal, and then sends it to the master device.
[0150] S604, receiving a connection confirmation pop-up window sent by the slave device, and disconnecting the Bluetooth connection;
[0151] Specifically, if the connection confirmation pop-up window sent by the slave device is not received, the Bluetooth connection is completed; if the connection confirmation pop-up window sent by the slave device is received, the interface displays the connection confirmation pop-up window and disconnects the Bluetooth connection.
[0152] S605, receiving a selection instruction for the connection confirmation pop-up window, and sending a Bluetooth connection request to the slave device;
[0153] Specifically, the master device includes multiple devices, and the user selects a target master device from each of the master devices. When the master device receives the selection instruction in the connection confirmation pop-up window, the target master device sends a Bluetooth connection request to the slave device. The user can select the target master device by voice command, fingerprint authentication, touch command, etc.
[0154] S606, if no selection instruction for the connection confirmation pop-up window is received within the preset time, entering a standby state;
[0155] Specifically, a preset time period is set. After the master device disconnects the Bluetooth connection with the slave device, if the master device does not receive a selection instruction in the connection confirmation pop-up window within the preset time period, the master device enters a standby state. This prevents the master device from being in a state of waiting for a selection instruction in the connection confirmation pop-up window without receiving the selection instruction, thereby reducing the power consumption of the master device.
[0156] S607: Receive connection confirmation information sent by the slave device based on the Bluetooth connection request, and re-establish a Bluetooth connection with the slave device.
[0157] In an embodiment of the present application, a master device detection signal is received from a slave device, and then a Bluetooth connection is established with the slave device based on the master device detection signal. If a connection confirmation pop-up window is received from the slave device, the Bluetooth connection is disconnected, and then a Bluetooth connection is re-established with the slave device based on the user's selection instruction for the connection confirmation pop-up window. The above method can be used for the connection pairing method of all master-slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience. The target master device is selected by the user's selection instruction for the connection confirmation pop-up window, which further improves the reliability of the Bluetooth connection. By setting a preset time length, the master device is prevented from not receiving the selection instruction for the connection confirmation pop-up window and being in a state of waiting for reception, which can reduce the power consumption of the master device.
[0158] based on Figure 1 The system architecture shown below will be combined with Figure 10-13 , the slave device provided in the embodiment of the present application is introduced in detail. It should be noted that, Figure 10-13 The slave device in the application is used to execute the Figure 6-Figure 7 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 6-Figure 7 The embodiment shown.
[0159] See Figure 10 , provides a structural diagram of a slave device according to an embodiment of the present application. Figure 10 As shown, the slave device 1 in the embodiment of the present application may include: a state determination module 11 , a device detection module 12 and a connection establishment module 13 .
[0160] A state determination module 11 is configured to switch the working mode of the slave device to the master mode when determining that the slave device is in a pairing state and the reconnection fails;
[0161] a device detection module 12, configured to detect a connectable master device based on the master mode;
[0162] The connection establishing module 13 is configured to switch the working mode of the slave device to a slave mode, and establish a Bluetooth connection with the master device based on the slave mode.
[0163] In an embodiment of the present application, when a slave device is in a pairing state and fails to reconnect, the operating mode of the slave device is switched to master mode. At this time, the slave device sends a master device detection signal based on the master mode to detect a connectable master device, and then switches the operating mode to slave mode, thereby establishing a Bluetooth connection with the master device based on the slave mode. The slave device automatically completes the search for the master device and the pairing process with the master device through the master-slave mode switching. The above method can be used for the connection and pairing of all master and slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience.
[0164] See Figure 11 , provides a structural diagram of a slave device according to an embodiment of the present application. Figure 11 As shown, the slave device 1 in the embodiment of the present application may include: a state determination module 11, a device detection module 12, a connection establishment module 13, a first duration module 14 and a second duration module 15.
[0165] A state determination module 11 is configured to switch the working mode of the slave device to the master mode when determining that the slave device is in a pairing state and the reconnection fails;
[0166] For details, please refer to Figure 12 , provides a structural diagram of a state determination module according to an embodiment of the present application. Figure 12 As shown, the state determination module 11 may include:
[0167] A state determining unit 111 is configured to switch the working mode of the slave device to a master mode when determining that the slave device is in a pairing state and there is no device to which it can reconnect;
[0168] The second state determination unit 112 is configured to determine that the slave device is in a pairing state and there is a device to which it can be reconnected, and if the reconnection fails, switch the working mode of the slave device to a master mode.
[0169] a device detection module 12, configured to detect a connectable master device based on the master mode;
[0170] a connection establishing module 13, configured to switch the working mode of the slave device to a slave mode, and establish a Bluetooth connection with the master device based on the slave mode;
[0171] For details, please refer to Figure 13 , provides a structural diagram of a connection establishment module according to an embodiment of the present application. Figure 13 As shown, the connection establishing module 11 may include:
[0172] a master device unit 131, configured to, if the master device includes one, wait for a Bluetooth connection request sent by the master device, and establish a Bluetooth connection with the master device based on the Bluetooth connection request;
[0173] A plurality of master device units 132, configured to establish a Bluetooth connection with each of the master devices in sequence based on the slave mode and then disconnect the Bluetooth connection if there are multiple master devices;
[0174] The instruction selection unit 133 is configured to establish a Bluetooth connection with the target master device based on the selection instruction for the target master device among the master devices.
[0175] A first duration module 14 is configured to execute the step of determining that the slave device is in a pairing state and the reconnection fails if the Bluetooth connection exceeds a first duration;
[0176] The second duration module 15 is configured to switch to a standby state if the Bluetooth connection exceeds a second duration.
[0177] In an embodiment of the present application, when the slave device is in a pairing state and the reconnection fails, the working mode of the slave device is switched to the master mode. At this time, the slave device sends a master device detection signal based on the master mode to detect a connectable master device. The master device receives the master device detection signal, and then switches the working mode of the slave device back to the slave mode. If the master device includes one, a Bluetooth connection is established with the master device based on the slave mode. If the master device includes multiple, a Bluetooth connection is established with each of the master devices in turn based on the slave mode and then the Bluetooth connection is disconnected. A connection confirmation pop-up window is sent and a connection confirmation is made based on the user's connection. , the slave device automatically completes the search for the master device and the pairing process with the master device through the master-slave mode switching. The above method can be used for all master-slave device connection and pairing methods. It is simple and universal, reduces the user's learning cost, and improves the user experience. By setting the first duration, when the slave device cannot establish a Bluetooth connection with the master device for a long time, the connection operation can be re-executed, thereby improving the connection efficiency and fault tolerance rate. By setting the second duration, when the slave device has not established a Bluetooth connection with the master device for a long time, the connection operation can be avoided repeatedly, thereby effectively reducing the power consumption of the slave device.
[0178] See Figure 14 , provides a schematic diagram of the structure of a computer device according to an embodiment of the present application. Figure 14As shown, the computer device 1000 may include: at least one processor 1001, such as a CPU, at least one network interface 1004, an input / output interface 1003, a memory 1005, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The network interface 1004 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 14 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, an input and output interface module, and a Bluetooth connection application.
[0179] In one embodiment, the processor 1001 may be configured to call a Bluetooth connection application stored in the memory 1005 and specifically perform the following operations:
[0180] When determining that the slave device is in a pairable state and the backconnection fails, switching the working mode of the slave device to a master mode;
[0181] Sending a master device detection signal based on the master mode to detect a connectable master device;
[0182] The working mode of the slave device is switched to the slave mode, and a Bluetooth connection is established with the master device based on the slave mode.
[0183] Optionally, when determining that the slave device is in a pairable state and the reconnection fails, the processor 1001 switches the working mode of the slave device to the master mode, specifically performing the following operations:
[0184] When it is determined that the slave device is in a pairing state and there is no device to which it can be reconnected, switching the working mode of the slave device to a master mode; or,
[0185] When it is determined that the slave device is in a pairing state and there is currently a device to which it can reconnect, if the reconnection fails, the working mode of the slave device is switched to the master mode.
[0186] Optionally, when switching the working mode of the slave device to the slave mode and establishing a Bluetooth connection with the master device based on the slave mode, the processor 1001 specifically performs the following operations:
[0187] If the master device includes one, waiting for a Bluetooth connection request sent by the master device, and establishing a Bluetooth connection with the master device based on the Bluetooth connection request;
[0188] If there are multiple master devices, establishing a Bluetooth connection with each master device in sequence based on the slave mode and then disconnecting the Bluetooth connection;
[0189] Based on the selection instruction of the target master device among the master devices, a Bluetooth connection is established with the target master device.
[0190] Optionally, after switching the working mode of the slave device to the slave mode and establishing a Bluetooth connection with the master device based on the slave mode, the processor 1001 further performs the following operations:
[0191] If the Bluetooth connection exceeds the first duration, the step of determining that the slave device is in a pairing state and the reconnection fails is performed.
[0192] Optionally, after switching the working mode of the slave device to the slave mode and establishing a Bluetooth connection with the master device based on the slave mode, the processor 1001 further performs the following operations:
[0193] If the Bluetooth connection exceeds the second time period, the device switches to a standby state.
[0194] In an embodiment of the present application, when the slave device is in a pairing state and the reconnection fails, the working mode of the slave device is switched to the master mode. At this time, the slave device sends a master device detection signal based on the master mode to detect a connectable master device. The master device receives the master device detection signal, and then switches the working mode of the slave device back to the slave mode. If the master device includes one, a Bluetooth connection is established with the master device based on the slave mode. If the master device includes multiple, a Bluetooth connection is established with each of the master devices in turn based on the slave mode and then the Bluetooth connection is disconnected. A connection confirmation pop-up window is sent and a connection confirmation is made based on the user's connection. , the slave device automatically completes the search for the master device and the pairing process with the master device through the master-slave mode switching. The above method can be used for all master-slave device connection and pairing methods. It is simple and universal, reduces the user's learning cost, and improves the user experience. By setting the first duration, when the slave device cannot establish a Bluetooth connection with the master device for a long time, the connection operation can be re-executed, thereby improving the connection efficiency and fault tolerance rate. By setting the second duration, when the slave device has not established a Bluetooth connection with the master device for a long time, the connection operation can be avoided repeatedly, thereby effectively reducing the power consumption of the slave device.
[0195] based on Figure 1 The system architecture shown below will be combined with Figure 15-17 , the main device provided in the embodiment of the present application is introduced in detail. It should be noted that, Figure 15-17 The main device in the application is used to execute this application Figure 8-Figure 9 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 8-Figure 9 The embodiment shown.
[0196] See Figure 15 , provides a schematic diagram of the structure of a master device according to an embodiment of the present application. Figure 15 As shown, the master device 2 in the embodiment of the present application may include: a signal receiving module 21 and a connection establishing module 22.
[0197] The signal receiving module 21 is used to receive a master device detection signal sent by the slave device. The master device detection signal is a signal sent to detect a connectable master device when the slave device is in a pairing state and fails to reconnect, switching the working mode to the master mode;
[0198] The connection establishing module 22 is configured to establish a Bluetooth connection with the slave device based on the master device detection signal, and switch the working mode of the slave device to a slave mode.
[0199] The detection signal carries the slave device identification information of the slave device, and the master device establishes a Bluetooth connection with the slave device based on the slave device identification. At this time, the slave device is in a slave mode.
[0200] In an embodiment of the present application, by receiving a master device detection signal sent by a slave device, the working mode of the slave device is switched to slave mode, and a Bluetooth connection is established with the slave device based on the master device detection signal. The above method can be used for the connection and pairing of all master and slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience.
[0201] See Figure 16 , provides a schematic diagram of the structure of a master device according to an embodiment of the present application. Figure 16 As shown, the master device 2 in the embodiment of the present application may include: a signal receiving module 21 , a connection establishing module 22 and a preset duration module 23 .
[0202] The signal receiving module 21 is used to receive a master device detection signal sent by the slave device. The master device detection signal is a signal sent to detect a connectable master device when the slave device is in a pairing state and fails to reconnect, switching the working mode to the master mode;
[0203] A connection establishing module 22 is configured to establish a Bluetooth connection with the slave device based on a detection signal from the master device, and switch the working mode of the slave device to a slave mode;
[0204] For details, please refer to Figure 17, provides a structural diagram of a connection establishment module according to an embodiment of the present application. Figure 17 As shown, the connection establishing module 22 may include:
[0205] A request sending unit 221 is configured to send a Bluetooth connection request to the slave device based on the master device detection signal;
[0206] A connection establishing unit 222 is configured to establish a Bluetooth connection with the slave device based on the master device detection signal, and switch the working mode of the slave device to a slave mode;
[0207] The pop-up window receiving unit 223 is configured to disconnect the Bluetooth connection upon receiving a connection confirmation pop-up window sent by the slave device;
[0208] a pop-up window selection unit 224, configured to receive a selection instruction for the connection confirmation pop-up window and send a Bluetooth connection request to the slave device;
[0209] The second connection establishing unit 225 is configured to receive connection confirmation information sent by the slave device based on the Bluetooth connection request, and re-establish a Bluetooth connection with the slave device.
[0210] The preset time module 23 is configured to enter a standby state if no selection instruction for the connection confirmation pop-up window is received within a preset time.
[0211] In an embodiment of the present application, a master device detection signal is received from a slave device, and then a Bluetooth connection is established with the slave device based on the master device detection signal. If a connection confirmation pop-up window is received from the slave device, the Bluetooth connection is disconnected, and then a Bluetooth connection is re-established with the slave device based on the user's selection instruction for the connection confirmation pop-up window. The above method can be used for the connection pairing method of all master-slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience. The target master device is selected by the user's selection instruction for the connection confirmation pop-up window, which further improves the reliability of the Bluetooth connection. By setting a preset time length, the master device is prevented from not receiving the selection instruction for the connection confirmation pop-up window and being in a state of waiting for reception, which can reduce the power consumption of the master device.
[0212] See Figure 18 , provides a schematic diagram of the structure of a computer device according to an embodiment of the present application. Figure 18As shown, the computer device 2000 may include: at least one processor 2001, such as a CPU, at least one network interface 2004, an input / output interface 2003, a memory 2005, and at least one communication bus 2002. The communication bus 2002 is used to realize the connection and communication between these components. The network interface 2004 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The memory 2005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 2005 may optionally also be at least one storage device located away from the aforementioned processor 2001. As Figure 18 As shown, the memory 2005 as a computer storage medium may include an operating system, a network communication module, an input and output interface module, and a Bluetooth connection application.
[0213] In one embodiment, the processor 2001 may be configured to call a Bluetooth connection application stored in the memory 2005 and specifically perform the following operations:
[0214] Receiving a master device detection signal sent by a slave device, wherein the master device detection signal is a signal sent to detect a connectable master device when the slave device is in a pairing state and fails to reconnect, switching the working mode to the master mode;
[0215] A Bluetooth connection is established with the slave device based on the master device detecting the signal, and the working mode of the slave device is switched to a slave mode.
[0216] Optionally, when the processor 2001 establishes a Bluetooth connection with the slave device based on the master device detection signal and the working mode of the slave device is switched to the slave mode, the processor 2001 specifically performs the following operations:
[0217] Sending a Bluetooth connection request to the slave device based on the master device detection signal;
[0218] receiving connection confirmation information sent by the slave device based on the Bluetooth connection request, and establishing a Bluetooth connection with the slave device;
[0219] Optionally, after receiving connection confirmation information sent by the slave device based on the Bluetooth connection request and establishing a Bluetooth connection with the slave device, the processor 2001 further performs the following operations:
[0220] If a connection confirmation pop-up window sent by the slave device is received, disconnect the Bluetooth connection;
[0221] receiving a selection instruction for the connection confirmation pop-up window, and sending a Bluetooth connection request to the slave device;
[0222] Receive connection confirmation information sent by the slave device based on the Bluetooth connection request, and re-establish a Bluetooth connection with the slave device.
[0223] Optionally, after establishing a Bluetooth connection with the slave device based on the master device detection signal and switching the working mode of the slave device to the slave mode, the processor 2001 further performs the following operations:
[0224] If no selection instruction for the connection confirmation pop-up window is received within a preset time period, the device enters a standby state.
[0225] In an embodiment of the present application, a master device detection signal is received from a slave device, and then a Bluetooth connection is established with the slave device based on the master device detection signal. If a connection confirmation pop-up window is received from the slave device, the Bluetooth connection is disconnected, and then a Bluetooth connection is re-established with the slave device based on the user's selection instruction for the connection confirmation pop-up window. The above method can be used for the connection pairing method of all master-slave devices. It is simple and universal, reduces the user's learning cost, and improves the user experience. The target master device is selected by the user's selection instruction for the connection confirmation pop-up window, which further improves the reliability of the Bluetooth connection. By setting a preset time length, the master device is prevented from not receiving the selection instruction for the connection confirmation pop-up window and being in a state of waiting for reception, which can reduce the power consumption of the master device.
[0226] The embodiment of the present application further provides a computer storage medium, which can store multiple program instructions, and the program instructions are suitable for being loaded and executed by a processor as described above. Figure 1 - The method steps of the embodiment shown in the figure, the specific execution process can be found in Figures 1-9 The detailed description of the illustrated embodiment will not be repeated here.
[0227] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0228] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A Bluetooth connection method, characterized in that: Applied to a slave device, the method includes: When it is determined that the slave device is in a pairing state and the reconnection fails, the working mode of the slave device is switched to a master mode; the master mode refers to a working mode in which the slave device detects and searches for surrounding devices; Sending a master device detection signal based on the master mode to detect a connectable master device; the master device detection signal carries slave device identification information of the slave device; The working mode of the slave device is switched to the slave mode, and a Bluetooth connection is established with the master device based on the slave mode; the slave mode refers to a working mode in which the slave device establishes a Bluetooth connection with the master device.
2. The Bluetooth connection method according to claim 1, wherein: When determining that the slave device is in a pairable state and the reconnection fails, switching the working mode of the slave device to the master mode includes: When it is determined that the slave device is in a pairing state and there is no device to which it can be reconnected, switching the working mode of the slave device to a master mode; or, When it is determined that the slave device is in a pairing state and there is currently a device to which it can reconnect, if the reconnection fails, the working mode of the slave device is switched to the master mode.
3. The method according to claim 1, characterized in that The establishing a Bluetooth connection with the master device based on the slave mode includes: If the master device includes one, waiting for a Bluetooth connection request sent by the master device, and establishing a Bluetooth connection with the master device based on the Bluetooth connection request.
4. The method according to claim 1, wherein The establishing a Bluetooth connection with the master device based on the slave mode includes: If there are multiple master devices, establishing a Bluetooth connection with each master device in sequence based on the slave mode and then disconnecting the Bluetooth connection; Based on the selection instruction of the target master device among the master devices, a Bluetooth connection is established with the target master device.
5. The method according to claim 4, characterized in that The establishing a Bluetooth connection with each of the master devices in sequence based on the slave mode and then disconnecting the Bluetooth connection comprises: Establishing a Bluetooth connection with a current master device among the master devices based on the slave mode; Sending a connection confirmation pop-up window to each of the current master devices based on the Bluetooth connection, so that the current master device disconnects the Bluetooth connection when receiving the connection confirmation pop-up window; Determine a next master device among the master devices, use the next master device as the current master device, and perform the step of establishing a Bluetooth connection with the current master device among the master devices based on the slave mode; The establishing a Bluetooth connection with the target master device based on the selection instruction of the target master device among the master devices includes: When there is no next master device, a Bluetooth connection is established with the target master device based on a selection instruction for the target master device among the master devices.
6. The method according to claim 5, characterized in that The establishing a Bluetooth connection with a current master device among the master devices based on the slave mode includes: Waiting for a Bluetooth connection request sent by the current master device; A Bluetooth connection is established with the current master device based on the Bluetooth connection request.
7. The method according to claim 5, characterized in that The establishing a Bluetooth connection with the target master device based on the selection instruction of the target master device among the master devices includes: Based on a selection instruction for a target master device among the master devices, waiting for a Bluetooth connection request sent by the target master device; A Bluetooth connection is established with the target host device based on the Bluetooth connection request.
8. The Bluetooth connection method according to claim 1, wherein: After switching the working mode of the slave device to the slave mode and establishing a Bluetooth connection with the master device based on the slave mode, the method further includes: If the Bluetooth connection exceeds the first duration, the step of determining that the slave device is in a pairing state and the reconnection fails is performed.
9. The Bluetooth connection method according to claim 1, wherein: The method further comprises: If the Bluetooth connection exceeds the second time period, the device switches to a standby state.
10. A Bluetooth connection method, characterized in that: Applied to a master device, the method includes: receiving a master device detection signal sent by a slave device, wherein the master device detection signal is a signal sent to detect a connectable master device when the slave device is in a pairing state and reconnection fails, switching the working mode to the master mode; the master device detection signal carries the slave device identification information of the slave device; the master mode refers to the working mode in which the slave device detects and searches for surrounding devices; Based on the master device detecting the signal, a Bluetooth connection is established with the slave device, and the working mode of the slave device is switched to a slave mode; the slave mode refers to a working mode in which the slave device establishes a Bluetooth connection with the master device.
11. The Bluetooth connection method according to claim 10, wherein: The establishing a Bluetooth connection with the slave device based on the master device detection signal includes: Sending a Bluetooth connection request to the slave device based on the master device detection signal; Receive connection confirmation information sent by the slave device based on the Bluetooth connection request, and establish a Bluetooth connection with the slave device.
12. The Bluetooth connection method according to claim 10, wherein: After receiving the connection confirmation information sent by the slave device based on the Bluetooth connection request and establishing a Bluetooth connection with the slave device, the method further includes: If a connection confirmation pop-up window sent by the slave device is received, disconnect the Bluetooth connection; receiving a selection instruction for the connection confirmation pop-up window, and sending a Bluetooth connection request to the slave device; Receive connection confirmation information sent by the slave device based on the Bluetooth connection request, and re-establish a Bluetooth connection with the slave device.
13. The Bluetooth connection method according to claim 12, wherein: The method further comprises: If no selection instruction for the connection confirmation pop-up window is received within a preset time period, the device enters a standby state.
14. A slave device, characterized in that: The slave device includes: a state determination module, configured to switch the working mode of the slave device to a master mode when determining that the slave device is in a pairing state and reconnection fails; the master mode refers to a working mode in which the slave device detects and searches for surrounding devices; a device detection module, configured to send a master device detection signal based on the master mode to detect a connectable master device; the master device detection signal carries slave device identification information of the slave device; The connection establishment module is used to switch the working mode of the slave device to the slave mode, and establish a Bluetooth connection with the master device based on the slave mode; the slave mode refers to the working mode in which the slave device establishes a Bluetooth connection with the master device.
15. A master device, characterized in that: The main device includes: A signal receiving module, configured to receive a master device detection signal sent by a slave device, wherein the master device detection signal is a signal sent to detect a connectable master device when the slave device is in a pairing state and fails to reconnect, switching the working mode to the master mode; The connection establishment module is used to establish a Bluetooth connection with the slave device based on the master device detection signal, and the working mode of the slave device is switched to the slave mode.
16. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the Bluetooth connection method according to any one of claims 1 to 9 or 10 to 13 are implemented.
17. A computer storage medium, characterized in that The computer storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the method according to any one of claims 1 to 9 or 10 to 13 is executed.
Citation Information
Patent Citations
Automobile intelligent key system and using method thereof on basis of bluetooth low energy (BLE)
CN104527567A
Low-power Bluetooth connecting method and device
CN104811895A
TWS (True Wireless Stereo) earphone capable of realizing master-slave switching and computer readable storage medium
CN108900939A
Wireless device connection method, mobile terminal and readable storage medium
CN110933774A
Interaction method and device among Bluetooth devices, storage medium and electronic device
CN111629366A